diff options
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra')
10 files changed, 293 insertions, 272 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandler.java index 4e1468c4e9..2c7bd1cc36 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandler.java @@ -130,33 +130,35 @@ public class NetworkInfoHandler { if (ar.getVnfType () != null) { vi.setNetworkType (ar.getVnfType ()); } - if (version.equals(Constants.SCHEMA_VERSION_V1)) { - if (ar.getServiceType () != null) { - vi.setServiceType (ar.getServiceType ()); - } - if (ar.getAicNodeClli () != null) { - vi.setAicNodeClli (ar.getAicNodeClli ()); - } - } - else if (version.equals(Constants.SCHEMA_VERSION_V2)) { - if (ar.getAaiServiceId () != null) { - vi.setServiceId (ar.getAaiServiceId ()); - } - if (ar.getAicCloudRegion () != null) { - vi.setAicCloudRegion (ar.getAicCloudRegion ()); - } - } - else if (version.equals(Constants.SCHEMA_VERSION_V3)) { - if (ar.getAaiServiceId () != null) { - vi.setServiceId (ar.getAaiServiceId ()); - } - if (ar.getAicCloudRegion () != null) { - vi.setAicCloudRegion (ar.getAicCloudRegion ()); - } - if (ar.getServiceInstanceId () != null) { - vi.setServiceInstanceId (ar.getServiceInstanceId ()); - } - + switch (version) { + case Constants.SCHEMA_VERSION_V1: + if (ar.getServiceType() != null) { + vi.setServiceType(ar.getServiceType()); + } + if (ar.getAicNodeClli() != null) { + vi.setAicNodeClli(ar.getAicNodeClli()); + } + break; + case Constants.SCHEMA_VERSION_V2: + if (ar.getAaiServiceId() != null) { + vi.setServiceId(ar.getAaiServiceId()); + } + if (ar.getAicCloudRegion() != null) { + vi.setAicCloudRegion(ar.getAicCloudRegion()); + } + break; + case Constants.SCHEMA_VERSION_V3: + if (ar.getAaiServiceId() != null) { + vi.setServiceId(ar.getAaiServiceId()); + } + if (ar.getAicCloudRegion() != null) { + vi.setAicCloudRegion(ar.getAicCloudRegion()); + } + if (ar.getServiceInstanceId() != null) { + vi.setServiceInstanceId(ar.getServiceInstanceId()); + } + + break; } if (ar.getTenantId () != null) { diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkMsoInfraRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkMsoInfraRequest.java index c87b4f387d..3d419926f1 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkMsoInfraRequest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkMsoInfraRequest.java @@ -147,24 +147,27 @@ public class NetworkMsoInfraRequest { } // Verify that the elements correspond to the version - - if (version.equals(Constants.SCHEMA_VERSION_V1)) { - if (this.networkInputs.getBackoutOnFailure() != null || this.networkInputs.getAicCloudRegion() != null || - this.networkInputs.getServiceInstanceId() != null) { - throw new ValidationException ("format for v1 version of network request"); - } - } - else if (version.equals(Constants.SCHEMA_VERSION_V2)) { - if (this.networkInputs.getServiceType() != null || this.networkInputs.getAicNodeClli() != null || - this.networkInputs.getServiceInstanceId() != null) { - throw new ValidationException ("format for v2 version of network request"); - } + + switch (version) { + case Constants.SCHEMA_VERSION_V1: + if (this.networkInputs.getBackoutOnFailure() != null || this.networkInputs.getAicCloudRegion() != null + || + this.networkInputs.getServiceInstanceId() != null) { + throw new ValidationException("format for v1 version of network request"); + } + break; + case Constants.SCHEMA_VERSION_V2: + if (this.networkInputs.getServiceType() != null || this.networkInputs.getAicNodeClli() != null || + this.networkInputs.getServiceInstanceId() != null) { + throw new ValidationException("format for v2 version of network request"); + } + break; + case Constants.SCHEMA_VERSION_V3: + if (this.networkInputs.getServiceType() != null || this.networkInputs.getAicNodeClli() != null) { + throw new ValidationException("format for v3 version of network request"); + } + break; } - else if (version.equals(Constants.SCHEMA_VERSION_V3)) { - if (this.networkInputs.getServiceType() != null || this.networkInputs.getAicNodeClli() != null) { - throw new ValidationException ("format for v3 version of network request"); - } - } switch (action) { case UPDATE: diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandler.java index 79247deca8..6a770202fa 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandler.java @@ -158,33 +158,35 @@ public class NetworkRequestHandler { if (ar.getVnfType () != null) { vi.setNetworkType (ar.getVnfType ()); } - if (version.equals(Constants.SCHEMA_VERSION_V1)) { - if (ar.getServiceType () != null) { - vi.setServiceType (ar.getServiceType ()); - } - if (ar.getAicNodeClli () != null) { - vi.setAicNodeClli (ar.getAicNodeClli ()); - } - } - else if (version.equals(Constants.SCHEMA_VERSION_V2)) { - if (ar.getAaiServiceId () != null) { - vi.setServiceId (ar.getAaiServiceId ()); - } - if (ar.getAicCloudRegion () != null) { - vi.setAicCloudRegion (ar.getAicCloudRegion ()); - } - } - else if (version.equals(Constants.SCHEMA_VERSION_V3)) { - if (ar.getAaiServiceId () != null) { - vi.setServiceId (ar.getAaiServiceId ()); - } - if (ar.getAicCloudRegion () != null) { - vi.setAicCloudRegion (ar.getAicCloudRegion ()); - } - if (ar.getServiceInstanceId () != null) { - vi.setServiceInstanceId (ar.getServiceInstanceId ()); - } - + switch (version) { + case Constants.SCHEMA_VERSION_V1: + if (ar.getServiceType() != null) { + vi.setServiceType(ar.getServiceType()); + } + if (ar.getAicNodeClli() != null) { + vi.setAicNodeClli(ar.getAicNodeClli()); + } + break; + case Constants.SCHEMA_VERSION_V2: + if (ar.getAaiServiceId() != null) { + vi.setServiceId(ar.getAaiServiceId()); + } + if (ar.getAicCloudRegion() != null) { + vi.setAicCloudRegion(ar.getAicCloudRegion()); + } + break; + case Constants.SCHEMA_VERSION_V3: + if (ar.getAaiServiceId() != null) { + vi.setServiceId(ar.getAaiServiceId()); + } + if (ar.getAicCloudRegion() != null) { + vi.setAicCloudRegion(ar.getAicCloudRegion()); + } + if (ar.getServiceInstanceId() != null) { + vi.setServiceInstanceId(ar.getServiceInstanceId()); + } + + break; } if (ar.getTenantId () != null) { diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandler.java index a5e1f6f4e2..d13212a483 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandler.java @@ -148,50 +148,52 @@ public class VnfInfoHandler { if (ar.getVolumeGroupId () != null) { vi.setVolumeGroupId (ar.getVolumeGroupId ()); } - if (version.equals(Constants.SCHEMA_VERSION_V1)) { - if (ar.getServiceType () != null) { - vi.setServiceType (ar.getServiceType ()); - } - if (ar.getAicNodeClli () != null) { - vi.setAicNodeClli (ar.getAicNodeClli ()); - } - } - else if (version.equals(Constants.SCHEMA_VERSION_V2)) { - if (ar.getAaiServiceId () != null) { - vi.setServiceId (ar.getAaiServiceId ()); - } - if (ar.getAicCloudRegion () != null) { - vi.setAicCloudRegion (ar.getAicCloudRegion ()); - } - if (ar.getVfModuleName () != null) { - vi.setVfModuleName (ar.getVfModuleName ()); - } - if (ar.getVfModuleId () != null) { - vi.setVfModuleId (ar.getVfModuleId ()); - } - if (ar.getVfModuleModelName () != null) { - vi.setVfModuleModelName (ar.getVfModuleModelName ()); - } - } - else if (version.equals(Constants.SCHEMA_VERSION_V3)) { - if (ar.getAaiServiceId () != null) { - vi.setServiceId (ar.getAaiServiceId ()); - } - if (ar.getAicCloudRegion () != null) { - vi.setAicCloudRegion (ar.getAicCloudRegion ()); - } - if (ar.getVfModuleName () != null) { - vi.setVfModuleName (ar.getVfModuleName ()); - } - if (ar.getVfModuleId () != null) { - vi.setVfModuleId (ar.getVfModuleId ()); - } - if (ar.getVfModuleModelName () != null) { - vi.setVfModuleModelName (ar.getVfModuleModelName ()); - } - if (ar.getServiceInstanceId () != null) { - vi.setServiceInstanceId (ar.getServiceInstanceId ()); - } + switch (version) { + case Constants.SCHEMA_VERSION_V1: + if (ar.getServiceType() != null) { + vi.setServiceType(ar.getServiceType()); + } + if (ar.getAicNodeClli() != null) { + vi.setAicNodeClli(ar.getAicNodeClli()); + } + break; + case Constants.SCHEMA_VERSION_V2: + if (ar.getAaiServiceId() != null) { + vi.setServiceId(ar.getAaiServiceId()); + } + if (ar.getAicCloudRegion() != null) { + vi.setAicCloudRegion(ar.getAicCloudRegion()); + } + if (ar.getVfModuleName() != null) { + vi.setVfModuleName(ar.getVfModuleName()); + } + if (ar.getVfModuleId() != null) { + vi.setVfModuleId(ar.getVfModuleId()); + } + if (ar.getVfModuleModelName() != null) { + vi.setVfModuleModelName(ar.getVfModuleModelName()); + } + break; + case Constants.SCHEMA_VERSION_V3: + if (ar.getAaiServiceId() != null) { + vi.setServiceId(ar.getAaiServiceId()); + } + if (ar.getAicCloudRegion() != null) { + vi.setAicCloudRegion(ar.getAicCloudRegion()); + } + if (ar.getVfModuleName() != null) { + vi.setVfModuleName(ar.getVfModuleName()); + } + if (ar.getVfModuleId() != null) { + vi.setVfModuleId(ar.getVfModuleId()); + } + if (ar.getVfModuleModelName() != null) { + vi.setVfModuleModelName(ar.getVfModuleModelName()); + } + if (ar.getServiceInstanceId() != null) { + vi.setServiceInstanceId(ar.getServiceInstanceId()); + } + break; } qr.setVnfInputs (vi); 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 ())) { diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandler.java index 2b7e71ad9c..098ed31b58 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandler.java @@ -179,50 +179,52 @@ public class VnfRequestHandler { if (ar.getVolumeGroupId () != null) { vi.setVolumeGroupId (ar.getVolumeGroupId ()); } - if (version.equals(Constants.SCHEMA_VERSION_V1)) { - if (ar.getServiceType () != null) { - vi.setServiceType (ar.getServiceType ()); - } - if (ar.getAicNodeClli () != null) { - vi.setAicNodeClli (ar.getAicNodeClli ()); - } - } - else if (version.equals(Constants.SCHEMA_VERSION_V2)) { - if (ar.getAaiServiceId () != null) { - vi.setServiceId (ar.getAaiServiceId ()); - } - if (ar.getAicCloudRegion () != null) { - vi.setAicCloudRegion (ar.getAicCloudRegion ()); - } - if (ar.getVfModuleName () != null) { - vi.setVfModuleName (ar.getVfModuleName ()); - } - if (ar.getVfModuleId () != null) { - vi.setVfModuleId (ar.getVfModuleId ()); - } - if (ar.getVfModuleModelName () != null) { - vi.setVfModuleModelName (ar.getVfModuleModelName ()); - } - } - else if (version.equals(Constants.SCHEMA_VERSION_V3)) { - if (ar.getAaiServiceId () != null) { - vi.setServiceId (ar.getAaiServiceId ()); - } - if (ar.getAicCloudRegion () != null) { - vi.setAicCloudRegion (ar.getAicCloudRegion ()); - } - if (ar.getVfModuleName () != null) { - vi.setVfModuleName (ar.getVfModuleName ()); - } - if (ar.getVfModuleId () != null) { - vi.setVfModuleId (ar.getVfModuleId ()); - } - if (ar.getVfModuleModelName () != null) { - vi.setVfModuleModelName (ar.getVfModuleModelName ()); - } - if (ar.getServiceInstanceId () != null) { - vi.setServiceInstanceId (ar.getServiceInstanceId ()); - } + switch (version) { + case Constants.SCHEMA_VERSION_V1: + if (ar.getServiceType() != null) { + vi.setServiceType(ar.getServiceType()); + } + if (ar.getAicNodeClli() != null) { + vi.setAicNodeClli(ar.getAicNodeClli()); + } + break; + case Constants.SCHEMA_VERSION_V2: + if (ar.getAaiServiceId() != null) { + vi.setServiceId(ar.getAaiServiceId()); + } + if (ar.getAicCloudRegion() != null) { + vi.setAicCloudRegion(ar.getAicCloudRegion()); + } + if (ar.getVfModuleName() != null) { + vi.setVfModuleName(ar.getVfModuleName()); + } + if (ar.getVfModuleId() != null) { + vi.setVfModuleId(ar.getVfModuleId()); + } + if (ar.getVfModuleModelName() != null) { + vi.setVfModuleModelName(ar.getVfModuleModelName()); + } + break; + case Constants.SCHEMA_VERSION_V3: + if (ar.getAaiServiceId() != null) { + vi.setServiceId(ar.getAaiServiceId()); + } + if (ar.getAicCloudRegion() != null) { + vi.setAicCloudRegion(ar.getAicCloudRegion()); + } + if (ar.getVfModuleName() != null) { + vi.setVfModuleName(ar.getVfModuleName()); + } + if (ar.getVfModuleId() != null) { + vi.setVfModuleId(ar.getVfModuleId()); + } + if (ar.getVfModuleModelName() != null) { + vi.setVfModuleModelName(ar.getVfModuleModelName()); + } + if (ar.getServiceInstanceId() != null) { + vi.setServiceInstanceId(ar.getServiceInstanceId()); + } + break; } qr.setVnfInputs (vi); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandler.java index 3de945a275..c74bb0734d 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandler.java @@ -134,43 +134,45 @@ public class VolumeInfoHandler { if (ar.getVnfType () != null) { vi.setVnfType (ar.getVnfType ()); } - - if (version.equals(Constants.SCHEMA_VERSION_V1)) { - if (ar.getServiceType () != null) { - vi.setServiceType (ar.getServiceType ()); - } - if (ar.getAicNodeClli () != null) { - vi.setAicNodeClli (ar.getAicNodeClli ()); - } - } - else if (version.equals(Constants.SCHEMA_VERSION_V2)) { - if (ar.getAaiServiceId () != null) { - vi.setServiceId (ar.getAaiServiceId ()); - } - if (ar.getAicCloudRegion () != null) { - vi.setAicCloudRegion (ar.getAicCloudRegion ()); - } - if (ar.getVfModuleModelName () != null) { - vi.setVfModuleModelName (ar.getVfModuleModelName ()); - } - } - else if (version.equals(Constants.SCHEMA_VERSION_V3)) { - if (ar.getAaiServiceId () != null) { - vi.setServiceId (ar.getAaiServiceId ()); - } - if (ar.getAicCloudRegion () != null) { - vi.setAicCloudRegion (ar.getAicCloudRegion ()); - } - if (ar.getVfModuleModelName () != null) { - vi.setVfModuleModelName (ar.getVfModuleModelName ()); - } - if (ar.getServiceInstanceId () != null) { - vi.setServiceInstanceId (ar.getServiceInstanceId ()); - } - if (ar.getVnfId () != null) { - vi.setVnfId (ar.getVnfId ()); - } - } + + switch (version) { + case Constants.SCHEMA_VERSION_V1: + if (ar.getServiceType() != null) { + vi.setServiceType(ar.getServiceType()); + } + if (ar.getAicNodeClli() != null) { + vi.setAicNodeClli(ar.getAicNodeClli()); + } + break; + case Constants.SCHEMA_VERSION_V2: + if (ar.getAaiServiceId() != null) { + vi.setServiceId(ar.getAaiServiceId()); + } + if (ar.getAicCloudRegion() != null) { + vi.setAicCloudRegion(ar.getAicCloudRegion()); + } + if (ar.getVfModuleModelName() != null) { + vi.setVfModuleModelName(ar.getVfModuleModelName()); + } + break; + case Constants.SCHEMA_VERSION_V3: + if (ar.getAaiServiceId() != null) { + vi.setServiceId(ar.getAaiServiceId()); + } + if (ar.getAicCloudRegion() != null) { + vi.setAicCloudRegion(ar.getAicCloudRegion()); + } + if (ar.getVfModuleModelName() != null) { + vi.setVfModuleModelName(ar.getVfModuleModelName()); + } + if (ar.getServiceInstanceId() != null) { + vi.setServiceInstanceId(ar.getServiceInstanceId()); + } + if (ar.getVnfId() != null) { + vi.setVnfId(ar.getVnfId()); + } + break; + } if (ar.getTenantId () != null) { vi.setTenantId (ar.getTenantId ()); } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeMsoInfraRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeMsoInfraRequest.java index 0524a85bf3..f908a3f0d6 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeMsoInfraRequest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeMsoInfraRequest.java @@ -144,24 +144,27 @@ public class VolumeMsoInfraRequest { // Verify that the elements correspond to the version - if (version.equals(Constants.SCHEMA_VERSION_V1)) { - if (this.volumeInputs.getBackoutOnFailure() != null || this.volumeInputs.getAicCloudRegion() != null || - this.volumeInputs.getVfModuleModelName () != null || this.volumeInputs.getAsdcServiceModelVersion () != null || - this.volumeInputs.getServiceInstanceId () != null || this.volumeInputs.getVnfId () != null) { - throw new ValidationException ("format for v1 version of volume request"); - } - } - else if (version.equals(Constants.SCHEMA_VERSION_V2)) { - if (this.volumeInputs.getServiceType() != null || this.volumeInputs.getAicNodeClli() != null || - this.volumeInputs.getServiceInstanceId () != null || this.volumeInputs.getVnfId () != null) { - throw new ValidationException ("format for v2 version of volume request"); - } - } - else if (version.equals(Constants.SCHEMA_VERSION_V3)) { - if (this.volumeInputs.getServiceType() != null || this.volumeInputs.getAicNodeClli() != null) { - throw new ValidationException ("format for v3 version of volume request"); - } - } + switch (version) { + case Constants.SCHEMA_VERSION_V1: + if (this.volumeInputs.getBackoutOnFailure() != null || this.volumeInputs.getAicCloudRegion() != null || + this.volumeInputs.getVfModuleModelName() != null + || this.volumeInputs.getAsdcServiceModelVersion() != null || + this.volumeInputs.getServiceInstanceId() != null || this.volumeInputs.getVnfId() != null) { + throw new ValidationException("format for v1 version of volume request"); + } + break; + case Constants.SCHEMA_VERSION_V2: + if (this.volumeInputs.getServiceType() != null || this.volumeInputs.getAicNodeClli() != null || + this.volumeInputs.getServiceInstanceId() != null || this.volumeInputs.getVnfId() != null) { + throw new ValidationException("format for v2 version of volume request"); + } + break; + case Constants.SCHEMA_VERSION_V3: + if (this.volumeInputs.getServiceType() != null || this.volumeInputs.getAicNodeClli() != null) { + throw new ValidationException("format for v3 version of volume request"); + } + break; + } if (!InfraUtils.isActionAllowed (props, "volume", version, action.value ())) { diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandler.java index d1c1c18e87..e3af83df92 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeRequestHandler.java @@ -166,43 +166,45 @@ public class VolumeRequestHandler { if (ar.getVnfType () != null) { vi.setVnfType (ar.getVnfType ()); } - - if (version.equals(Constants.SCHEMA_VERSION_V1)) { - if (ar.getServiceType () != null) { - vi.setServiceType (ar.getServiceType ()); - } - if (ar.getAicNodeClli () != null) { - vi.setAicNodeClli (ar.getAicNodeClli ()); - } - } - else if (version.equals(Constants.SCHEMA_VERSION_V2)) { - if (ar.getAaiServiceId () != null) { - vi.setServiceId (ar.getAaiServiceId ()); - } - if (ar.getAicCloudRegion () != null) { - vi.setAicCloudRegion (ar.getAicCloudRegion ()); - } - if (ar.getVfModuleModelName () != null) { - vi.setVfModuleModelName (ar.getVfModuleModelName ()); - } - } - else if (version.equals(Constants.SCHEMA_VERSION_V3)) { - if (ar.getAaiServiceId () != null) { - vi.setServiceId (ar.getAaiServiceId ()); - } - if (ar.getAicCloudRegion () != null) { - vi.setAicCloudRegion (ar.getAicCloudRegion ()); - } - if (ar.getVfModuleModelName () != null) { - vi.setVfModuleModelName (ar.getVfModuleModelName ()); - } - if (ar.getServiceInstanceId () != null) { - vi.setServiceInstanceId (ar.getServiceInstanceId ()); - } - if (ar.getVnfId () != null) { - vi.setVnfId (ar.getVnfId ()); - } - } + + switch (version) { + case Constants.SCHEMA_VERSION_V1: + if (ar.getServiceType() != null) { + vi.setServiceType(ar.getServiceType()); + } + if (ar.getAicNodeClli() != null) { + vi.setAicNodeClli(ar.getAicNodeClli()); + } + break; + case Constants.SCHEMA_VERSION_V2: + if (ar.getAaiServiceId() != null) { + vi.setServiceId(ar.getAaiServiceId()); + } + if (ar.getAicCloudRegion() != null) { + vi.setAicCloudRegion(ar.getAicCloudRegion()); + } + if (ar.getVfModuleModelName() != null) { + vi.setVfModuleModelName(ar.getVfModuleModelName()); + } + break; + case Constants.SCHEMA_VERSION_V3: + if (ar.getAaiServiceId() != null) { + vi.setServiceId(ar.getAaiServiceId()); + } + if (ar.getAicCloudRegion() != null) { + vi.setAicCloudRegion(ar.getAicCloudRegion()); + } + if (ar.getVfModuleModelName() != null) { + vi.setVfModuleModelName(ar.getVfModuleModelName()); + } + if (ar.getServiceInstanceId() != null) { + vi.setServiceInstanceId(ar.getServiceInstanceId()); + } + if (ar.getVnfId() != null) { + vi.setVnfId(ar.getVnfId()); + } + break; + } if (ar.getTenantId () != null) { vi.setTenantId (ar.getTenantId ()); } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java index aa0b109e49..664f810b35 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java @@ -680,7 +680,7 @@ public class E2EServiceInstancesTest { String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
Response resp = instance.updateE2EServiceInstance(request, "v3", "12345");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("success") != -1);
+ assertTrue(respStr.contains("success"));
}
@Test
@@ -751,6 +751,6 @@ public class E2EServiceInstancesTest { String request = "{\"service\":{\"name\":\"so_test4\",\"description\":\"so_test2\",\"serviceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561519\",\"templateId\":\"592f9437-a9c0-4303-b9f6-c445bb7e9814\",\"parameters\":{\"globalSubscriberId\":\"123457\",\"subscriberName\":\"Customer1\",\"serviceType\":\"voLTE\",\"templateName\":\"voLTE Service:1.0\",\"resources\":[{\"resourceName\":\"vIMS\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-vBAS-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}},{\"vnfProfileId\":\"zte-vMME-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad0\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"vEPC\",\"resourceDefId\":\"61c3e96e-0970-4871-b6e0-3b6de7561516\",\"resourceId\":\"62c3e96e-0970-4871-b6e0-3b6de7561512\",\"nsParameters\":{\"locationConstraints\":[{\"vnfProfileId\":\"zte-CSCF-1.0\",\"locationConstraints\":{\"vimId\":\"4050083f-465f-4838-af1e-47a545222ad1\"}}],\"additionalParamForNs\":{}}},{\"resourceName\":\"underlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561513\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561514\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}},{\"resourceName\":\"overlayvpn\",\"resourceDefId\":\"60c3e96e-0970-4871-b6e0-3b6de7561517\",\"resourceId\":\"60c3e96e-0970-4871-b6e0-3b6de7561518\",\"nsParameters\":{\"locationConstraints\":[],\"additionalParamForNs\":{\"externalDataNetworkName\":\"Flow_out_net\",\"m6000_mng_ip\":\"181.18.20.2\",\"externalCompanyFtpDataNetworkName\":\"Flow_out_net\",\"externalPluginManageNetworkName\":\"plugin_net_2014\",\"externalManageNetworkName\":\"mng_net_2017\",\"sfc_data_network\":\"sfc_data_net_2016\",\"NatIpRange\":\"210.1.1.10-210.1.1.20\",\"location\":\"4050083f-465f-4838-af1e-47a545222ad0\",\"sdncontroller\":\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\"}}}]}}}";
Response resp = instance.updateE2EServiceInstance(request, "v3", "12345");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC2000") != -1);
+ assertTrue(respStr.contains("SVC2000"));
}
}
|