X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=mso-api-handlers%2Fmso-api-handler-infra%2Fsrc%2Fmain%2Fjava%2Forg%2Fopenecomp%2Fmso%2Fapihandlerinfra%2FVnfMsoInfraRequest.java;h=1f3008aa1ac9e205ce01c0827fb1fbcba2d8ac23;hb=6310dbd5b69ecd9e5b87cd31a7420c4ff3d4f36d;hp=80d0c48a5e402e86290e7256185a7e68737f5d97;hpb=b224e2a46248a1f6b3034affd5370dd6d21abc61;p=so.git diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequest.java index 80d0c48a5e..1f3008aa1a 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequest.java @@ -157,26 +157,29 @@ public class VnfMsoInfraRequest { throw new ValidationException ("format for vnf request"); } // Verify that the elements correspond to the version - - - if (version.equals(Constants.SCHEMA_VERSION_V1)) { - if (this.vnfInputs.getVfModuleName () != null || this.vnfInputs.getVfModuleId () != null || - this.vnfInputs.getVfModuleModelName () != null || this.vnfInputs.getAsdcServiceModelVersion () != null || - this.vnfInputs.getBackoutOnFailure() != null || this.vnfInputs.getAicCloudRegion() != null || - this.vnfInputs.getServiceInstanceId () != null) { - throw new ValidationException ("format for v1 version of vnf request"); - } - } - else if (version.equals(Constants.SCHEMA_VERSION_V2)) { - if (this.vnfInputs.getServiceType() != null || this.vnfInputs.getAicNodeClli() != null || this.vnfInputs.getServiceInstanceId () != null) { - throw new ValidationException ("format for v2 version of vnf request"); - } + + switch (version) { + case Constants.SCHEMA_VERSION_V1: + if (this.vnfInputs.getVfModuleName() != null || this.vnfInputs.getVfModuleId() != null || + this.vnfInputs.getVfModuleModelName() != null || this.vnfInputs.getAsdcServiceModelVersion() != null + || + this.vnfInputs.getBackoutOnFailure() != null || this.vnfInputs.getAicCloudRegion() != null || + this.vnfInputs.getServiceInstanceId() != null) { + throw new ValidationException("format for v1 version of vnf request"); + } + break; + case Constants.SCHEMA_VERSION_V2: + if (this.vnfInputs.getServiceType() != null || this.vnfInputs.getAicNodeClli() != null + || this.vnfInputs.getServiceInstanceId() != null) { + throw new ValidationException("format for v2 version of vnf request"); + } + break; + case Constants.SCHEMA_VERSION_V3: + if (this.vnfInputs.getServiceType() != null || this.vnfInputs.getAicNodeClli() != null) { + throw new ValidationException("format for v3 version of vnf request"); + } + break; } - else if (version.equals(Constants.SCHEMA_VERSION_V3)) { - if (this.vnfInputs.getServiceType() != null || this.vnfInputs.getAicNodeClli() != null) { - throw new ValidationException ("format for v3 version of vnf request"); - } - } if (!InfraUtils.isActionAllowed (props, "vnf", version, action.value ())) {