aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers
diff options
context:
space:
mode:
authorMichael Pruss <michael.pruss@bell.ca>2021-05-31 18:28:08 -0400
committerJozsef Csongvai <jozsef.csongvai@bell.ca>2021-07-30 12:24:31 -0400
commited5c51313c1bd3745a554888c969e840341599b0 (patch)
tree27b6ed17d52f0d8b14428c98b0886d60a70670bc /mso-api-handlers
parent1be8408f26d3f20cf2ffb923a956b7ba6dfbd994 (diff)
Support instantiation of same model vnfs/vf-modules
When instantiating a service with multiple vnfs and/or vfmodules SO would differentiate using ModelCustomizationId. This would cause issues when creating multiple instances of same model resource, and each lookup would return the same object. Instead of using ModelCustomizationId, this patch enables SO to use instanceName parameter to differentiate the resources. Validation was added to ensure that instanceNames are provided if there are multiple resources of the same model. If there are no duplicate resources and instanceName is not set, SO will default to previous logic using ModelCustomizationId. In order to properly associate vfmodules with their parent vnfs, the Resource class was augmented with a parent reference which maintains the relationship in further processing. Id generation logic was corrected to ensure that multiple resources of the same model are assigned unique instance ids and references to parent instanceId. Issue-ID: SO-3677 Change-Id: If39a0138f501177e12262f8e911137012e287fca Signed-off-by: Michael Pruss <michael.pruss@bell.ca>
Diffstat (limited to 'mso-api-handlers')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/UserParamsValidation.java63
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/UserParamsValidationTest.java177
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/Network.json12
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkCloudConfig.json12
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkModelCustomizationId.json12
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkModelVersionId.json12
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/ServiceAssign.json12
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceAssign.json6
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/UserParamsValidation/DuplicateInstanceNames.json193
9 files changed, 472 insertions, 27 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/UserParamsValidation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/UserParamsValidation.java
index 067e8611d0..8646a74a2f 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/UserParamsValidation.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/UserParamsValidation.java
@@ -22,7 +22,13 @@
package org.onap.so.apihandlerinfra.validation;
import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+import org.apache.commons.lang3.StringUtils;
import org.onap.so.apihandlerinfra.Action;
import org.onap.so.apihandlerinfra.Actions;
import org.onap.so.exceptions.ValidationException;
@@ -36,8 +42,6 @@ public class UserParamsValidation implements ValidationRule {
@Override
public ValidationInformation validate(ValidationInformation info) throws ValidationException {
Service validate = info.getUserParams();
- Actions action = info.getAction();
-
if (validate.getModelInfo() == null) {
throw new ValidationException("modelInfo in userParams", true);
} else if (validate.getModelInfo().getModelType() == null) {
@@ -49,6 +53,10 @@ public class UserParamsValidation implements ValidationRule {
if (validate.getInstanceName() != null && info.getRequestInfo().getInstanceName() != null) {
instanceNameValidation(info, validate);
}
+
+ Actions action = info.getAction();
+ Map<String, Set<String>> vnfCustomIdToInstanceNames = new HashMap<>();
+ Map<String, Set<String>> vfModuleCustomIdToInstanceNames = new HashMap<>();
for (Vnfs vnf : validate.getResources().getVnfs()) {
if (vnf.getModelInfo() == null) {
throw new ValidationException("modelInfo in userParams vnf resources", true);
@@ -71,19 +79,42 @@ public class UserParamsValidation implements ValidationRule {
if (vnf.getPlatform() != null && vnf.getPlatform().getPlatformName() == null) {
throw new ValidationException("platformName in userParams vnf resources", true);
}
+
+ String vnfCustomizationId = vnf.getModelInfo().getModelCustomizationId();
+ vnfCustomIdToInstanceNames.putIfAbsent(vnfCustomizationId, new HashSet<>());
+ String vnfInstanceName = StringUtils.defaultString(vnf.getInstanceName());
+ Set<String> vnfVisitedInstanceNames = vnfCustomIdToInstanceNames.get(vnfCustomizationId);
+ if (!vnfVisitedInstanceNames.add(vnfInstanceName)) {
+ throw new ValidationException(
+ "instanceName: same instanceName with same modelCustomizationId in userParams vnf resources",
+ true);
+ }
if (vnf.getVfModules().isEmpty()) {
throw new ValidationException("vfModules in userParams vnf resources", true);
}
- for (VfModules vfModules : vnf.getVfModules()) {
- if (vfModules.getModelInfo() == null) {
+
+ for (VfModules vfModule : vnf.getVfModules()) {
+ if (vfModule.getModelInfo() == null) {
throw new ValidationException("modelInfo in userParams vfModules resources", true);
- } else if (vfModules.getModelInfo().getModelCustomizationId() == null) {
+ } else if (vfModule.getModelInfo().getModelCustomizationId() == null) {
throw new ValidationException("modelCustomizationId in userParams vfModule resources", true);
- } else if (vfModules.getModelInfo().getModelVersionId() == null) {
+ } else if (vfModule.getModelInfo().getModelVersionId() == null) {
throw new ValidationException("modelVersionId in userParams vfModule resources", true);
}
+
+ String vfModulecustomizationId = vfModule.getModelInfo().getModelCustomizationId();
+ vfModuleCustomIdToInstanceNames.putIfAbsent(vfModulecustomizationId, new HashSet<>());
+ String vfModuleInstanceName = StringUtils.defaultString(vfModule.getInstanceName());
+ Set<String> vfModuleVisitedInstanceNames = vfModuleCustomIdToInstanceNames.get(vfModulecustomizationId);
+ if (!vfModuleVisitedInstanceNames.add(vfModuleInstanceName)) {
+ throw new ValidationException(
+ "instanceName: same instanceName with same modelCustomizationId in userParams vfModule resources",
+ true);
+ }
}
}
+ validateDuplicateInstanceNames(vnfCustomIdToInstanceNames, "vnf");
+ validateDuplicateInstanceNames(vfModuleCustomIdToInstanceNames, "vfModule");
List<Networks> validateNetworks = new ArrayList<>();
validateNetworks = validate.getResources().getNetworks();
@@ -135,4 +166,24 @@ public class UserParamsValidation implements ValidationRule {
"modelCustomizationId in userParams service");
}
}
+
+ private void validateDuplicateInstanceNames(Map<String, Set<String>> duplicateValidator, String type)
+ throws ValidationException {
+ Set<String> allInstanceNames = new HashSet<>();
+ for (Map.Entry<String, Set<String>> entry : duplicateValidator.entrySet()) {
+ Set<String> instanceNames = entry.getValue();
+ if (instanceNames.size() > 1 && instanceNames.contains(""))
+ throw new ValidationException(String.format(
+ "instanceName: instanceName is missing or empty with same modelCustomizationId in userParams %s resources",
+ type), true);
+
+ for (String instanceName : instanceNames) {
+ if (!instanceName.isBlank() && !allInstanceNames.add(instanceName)) {
+ throw new ValidationException(String.format(
+ "instanceName: same instanceName but different modelCustomizationId (instanceName should be unique) in userParams %s resources",
+ type), true);
+ }
+ }
+ }
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/UserParamsValidationTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/UserParamsValidationTest.java
index ba02254ad8..548b957303 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/UserParamsValidationTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/UserParamsValidationTest.java
@@ -32,6 +32,7 @@ import org.onap.so.exceptions.ValidationException;
import org.onap.so.serviceinstancebeans.Service;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
import com.fasterxml.jackson.databind.ObjectMapper;
+import org.onap.so.serviceinstancebeans.VfModules;
public class UserParamsValidationTest {
@@ -66,6 +67,182 @@ public class UserParamsValidationTest {
}
@Test
+ public void validateDuplicateInstanceNameDifferentCustomizationIdVnfTest() throws IOException, ValidationException {
+ thrown.expect(ValidationException.class);
+ thrown.expectMessage(
+ "No valid instanceName: same instanceName but different modelCustomizationId (instanceName should be unique) in userParams vnf resources is specified");
+ ValidationInformation info = setupValidationInformation(
+ "src/test/resources/Validation/UserParamsValidation/DuplicateInstanceNames.json");
+ info.getUserParams().getResources().getVnfs().get(0).setInstanceName("UbuntuVNF2");
+ validation.validate(info);
+ }
+
+ @Test
+ public void validateDuplicateInstanceNameSameCustomizationIdVnfTest() throws IOException, ValidationException {
+ thrown.expect(ValidationException.class);
+ thrown.expectMessage(
+ "No valid instanceName: same instanceName with same modelCustomizationId in userParams vnf resources is specified");
+ ValidationInformation info = setupValidationInformation(
+ "src/test/resources/Validation/UserParamsValidation/DuplicateInstanceNames.json");
+ info.getUserParams().getResources().getVnfs().get(2).setInstanceName("UbuntuVNF2");
+ validation.validate(info);
+ }
+
+ @Test
+ public void validateNullInstanceNameSameCustomizationIdVnfTest() throws IOException, ValidationException {
+ thrown.expect(ValidationException.class);
+ thrown.expectMessage(
+ "No valid instanceName: instanceName is missing or empty with same modelCustomizationId in userParams vnf resources is specified");
+ ValidationInformation info = setupValidationInformation(
+ "src/test/resources/Validation/UserParamsValidation/DuplicateInstanceNames.json");
+ info.getUserParams().getResources().getVnfs().get(1).setInstanceName(null);
+ validation.validate(info);
+ }
+
+ @Test
+ public void validateDuplicateNullInstanceNameSameCustomizationIdVnfTest() throws IOException, ValidationException {
+ thrown.expect(ValidationException.class);
+ thrown.expectMessage(
+ "No valid instanceName: same instanceName with same modelCustomizationId in userParams vnf resources is specified");
+ ValidationInformation info = setupValidationInformation(
+ "src/test/resources/Validation/UserParamsValidation/DuplicateInstanceNames.json");
+ info.getUserParams().getResources().getVnfs().get(1).setInstanceName(null);
+ info.getUserParams().getResources().getVnfs().get(2).setInstanceName(null);
+ validation.validate(info);
+ }
+
+ @Test
+ public void validateDifferentInstanceNameSameCustomizationIdVnfTest() throws IOException, ValidationException {
+ ValidationInformation info = setupValidationInformation(
+ "src/test/resources/Validation/UserParamsValidation/DuplicateInstanceNames.json");
+ validation.validate(info);
+ }
+
+ @Test
+ public void validateNullInstanceNameDifferentCustomizationIdVnfTest() throws IOException, ValidationException {
+ ValidationInformation info = setupValidationInformation(
+ "src/test/resources/Validation/UserParamsValidation/DuplicateInstanceNames.json");
+ info.getUserParams().getResources().getVnfs().get(0).setInstanceName(null);
+ validation.validate(info);
+ }
+
+ @Test
+ public void validateDuplicateInstanceNameDifferentCustomizationIdVfModuleInOneVnfTest()
+ throws IOException, ValidationException {
+ thrown.expect(ValidationException.class);
+ thrown.expectMessage(
+ "No valid instanceName: same instanceName but different modelCustomizationId (instanceName should be unique) in userParams vfModule resources is specified");
+ ValidationInformation info = setupValidationInformation(
+ "src/test/resources/Validation/UserParamsValidation/DuplicateInstanceNames.json");
+ info.getUserParams().getResources().getVnfs().get(2).getVfModules().get(2).setInstanceName("lcm-demo-ubuntu-3");
+ validation.validate(info);
+ }
+
+ @Test
+ public void validateDuplicateInstanceNameDifferentCustomizationIdVfModuleInMultipleVnfTest()
+ throws IOException, ValidationException {
+ thrown.expect(ValidationException.class);
+ thrown.expectMessage(
+ "No valid instanceName: same instanceName but different modelCustomizationId (instanceName should be unique) in userParams vfModule resources is specified");
+ ValidationInformation info = setupValidationInformation(
+ "src/test/resources/Validation/UserParamsValidation/DuplicateInstanceNames.json");
+ info.getUserParams().getResources().getVnfs().get(0).getVfModules().get(0).setInstanceName("lcm-demo-ubuntu-3");
+ validation.validate(info);
+ }
+
+ @Test
+ public void validateDuplicateInstanceNameSameCustomizationIdVfModuleInOneVnfTest()
+ throws IOException, ValidationException {
+ thrown.expect(ValidationException.class);
+ thrown.expectMessage(
+ "No valid instanceName: same instanceName with same modelCustomizationId in userParams vfModule resources is specified");
+ ValidationInformation info = setupValidationInformation(
+ "src/test/resources/Validation/UserParamsValidation/DuplicateInstanceNames.json");
+ info.getUserParams().getResources().getVnfs().get(2).getVfModules().get(1).setInstanceName("lcm-demo-ubuntu-2");
+ validation.validate(info);
+ }
+
+ @Test
+ public void validateDuplicateInstanceNameSameCustomizationIdVfModuleInMultipleVnfTest()
+ throws IOException, ValidationException {
+ thrown.expect(ValidationException.class);
+ thrown.expectMessage(
+ "No valid instanceName: same instanceName with same modelCustomizationId in userParams vfModule resources is specified");
+ ValidationInformation info = setupValidationInformation(
+ "src/test/resources/Validation/UserParamsValidation/DuplicateInstanceNames.json");
+ VfModules vfModule1 = info.getUserParams().getResources().getVnfs().get(0).getVfModules().get(0);
+ VfModules vfModule2 = info.getUserParams().getResources().getVnfs().get(1).getVfModules().get(0);
+ vfModule2.setInstanceName(vfModule1.getInstanceName());
+ vfModule2.getModelInfo().setModelCustomizationId(vfModule1.getModelInfo().getModelCustomizationId());
+ validation.validate(info);
+ }
+
+ @Test
+ public void validateNullInstanceNameSameCustomizationIdVfModuleInOneVnfTest()
+ throws IOException, ValidationException {
+ thrown.expect(ValidationException.class);
+ thrown.expectMessage(
+ "No valid instanceName: instanceName is missing or empty with same modelCustomizationId in userParams vfModule resources is specified");
+ ValidationInformation info = setupValidationInformation(
+ "src/test/resources/Validation/UserParamsValidation/DuplicateInstanceNames.json");
+ info.getUserParams().getResources().getVnfs().get(2).getVfModules().get(1).setInstanceName(null);
+ validation.validate(info);
+ }
+
+ @Test
+ public void validateNullInstanceNameSameCustomizationIdVfModuleInMultipleVnfTest()
+ throws IOException, ValidationException {
+ thrown.expect(ValidationException.class);
+ thrown.expectMessage(
+ "No valid instanceName: instanceName is missing or empty with same modelCustomizationId in userParams vfModule resources is specified");
+ ValidationInformation info = setupValidationInformation(
+ "src/test/resources/Validation/UserParamsValidation/DuplicateInstanceNames.json");
+ VfModules vfModule1 = info.getUserParams().getResources().getVnfs().get(0).getVfModules().get(0);
+ VfModules vfModule2 = info.getUserParams().getResources().getVnfs().get(1).getVfModules().get(0);
+ vfModule2.setInstanceName(null);
+ vfModule2.getModelInfo().setModelCustomizationId(vfModule1.getModelInfo().getModelCustomizationId());
+ validation.validate(info);
+ }
+
+ @Test
+ public void validateDuplicateNullInstanceNameSameCustomizationIdVfModuleInMultipleVnfTest()
+ throws IOException, ValidationException {
+ thrown.expect(ValidationException.class);
+ thrown.expectMessage(
+ "No valid instanceName: same instanceName with same modelCustomizationId in userParams vfModule resources is specified");
+ ValidationInformation info = setupValidationInformation(
+ "src/test/resources/Validation/UserParamsValidation/DuplicateInstanceNames.json");
+ VfModules vfModule1 = info.getUserParams().getResources().getVnfs().get(0).getVfModules().get(0);
+ VfModules vfModule2 = info.getUserParams().getResources().getVnfs().get(1).getVfModules().get(0);
+ vfModule1.setInstanceName(null);
+ vfModule2.setInstanceName(null);
+ vfModule2.getModelInfo().setModelCustomizationId(vfModule1.getModelInfo().getModelCustomizationId());
+ validation.validate(info);
+ }
+
+ @Test
+ public void validateInstanceNameSameCustomizationIdVfModuleInVnfTest() throws IOException, ValidationException {
+ ValidationInformation info = setupValidationInformation(
+ "src/test/resources/Validation/UserParamsValidation/DuplicateInstanceNames.json");
+ VfModules vfModule1 = info.getUserParams().getResources().getVnfs().get(0).getVfModules().get(0);
+ VfModules vfModule2 = info.getUserParams().getResources().getVnfs().get(1).getVfModules().get(0);
+ vfModule2.getModelInfo().setModelCustomizationId(vfModule1.getModelInfo().getModelCustomizationId());
+ validation.validate(info);
+ }
+
+ @Test
+ public void validateNullInstanceNameDifferentCustomizationIdVfModuleInVnfTest()
+ throws IOException, ValidationException {
+ ValidationInformation info = setupValidationInformation(
+ "src/test/resources/Validation/UserParamsValidation/DuplicateInstanceNames.json");
+ VfModules vfModule1 = info.getUserParams().getResources().getVnfs().get(0).getVfModules().get(0);
+ vfModule1.setInstanceName(null);
+ VfModules vfModule2 = info.getUserParams().getResources().getVnfs().get(2).getVfModules().get(2);
+ vfModule2.setInstanceName(null);
+ validation.validate(info);
+ }
+
+ @Test
public void validateInstanceNameExceptionTest() throws IOException, ValidationException {
thrown.expect(ValidationException.class);
thrown.expectMessage("instanceName in requestInfo does not match instanceName in userParams service");
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/Network.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/Network.json
index a7d930f756..aa6448e934 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/Network.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/Network.json
@@ -72,7 +72,8 @@
"modelName": "201673MowBvL._base_BV..module-0",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
"modelCustomizationId": "a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"
- },
+ },
+ "instanceName": "vfModule1",
"instanceParams": [
{
"vmx_int_net_len": "24",
@@ -86,7 +87,8 @@
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
"modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8",
"modelType": "vfModule"
- },
+ },
+ "instanceName": "vfModule2",
"instanceParams": [
{
"availability_zone_0": "mtpocdv-kvm-az01",
@@ -99,7 +101,8 @@
"modelName": "201673MowBvL._vRE_BV..module-1",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
"modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8"
- },
+ },
+ "instanceName": "vfModule3",
"instanceParams": [
{
"availability_zone_0": "mtpocdv-kvm-az01",
@@ -112,7 +115,8 @@
"modelName": "201673MowBvL._vPFE_BV..module-2",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
"modelCustomizationId": "da4d4327-fb7d-4311-ac7a-be7ba60cf969"
- },
+ },
+ "instanceName": "vfModule4",
"instanceParams": [
{
"availability_zone_0": "mtpocdv-kvm-az01",
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkCloudConfig.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkCloudConfig.json
index 75e8fb5cd1..c93b49a992 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkCloudConfig.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkCloudConfig.json
@@ -72,7 +72,8 @@
"modelName": "201673MowBvL._base_BV..module-0",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
"modelCustomizationId": "a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"
- },
+ },
+ "instanceName": "vfModule1",
"instanceParams": [
{
"vmx_int_net_len": "24",
@@ -86,7 +87,8 @@
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
"modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8",
"modelType": "vfModule"
- },
+ },
+ "instanceName": "vfModule2",
"instanceParams": [
{
"availability_zone_0": "mtpocdv-kvm-az01",
@@ -99,7 +101,8 @@
"modelName": "201673MowBvL._vRE_BV..module-1",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
"modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8"
- },
+ },
+ "instanceName": "vfModule3",
"instanceParams": [
{
"availability_zone_0": "mtpocdv-kvm-az01",
@@ -112,7 +115,8 @@
"modelName": "201673MowBvL._vPFE_BV..module-2",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
"modelCustomizationId": "da4d4327-fb7d-4311-ac7a-be7ba60cf969"
- },
+ },
+ "instanceName": "vfModule4",
"instanceParams": [
{
"availability_zone_0": "mtpocdv-kvm-az01",
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkModelCustomizationId.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkModelCustomizationId.json
index baf620b668..a81cfd001a 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkModelCustomizationId.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkModelCustomizationId.json
@@ -72,7 +72,8 @@
"modelName": "201673MowBvL._base_BV..module-0",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
"modelCustomizationId": "a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"
- },
+ },
+ "instanceName": "vfModule1",
"instanceParams": [
{
"vmx_int_net_len": "24",
@@ -86,7 +87,8 @@
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
"modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8",
"modelType": "vfModule"
- },
+ },
+ "instanceName": "vfModule2",
"instanceParams": [
{
"availability_zone_0": "mtpocdv-kvm-az01",
@@ -99,7 +101,8 @@
"modelName": "201673MowBvL._vRE_BV..module-1",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
"modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8"
- },
+ },
+ "instanceName": "vfModule3",
"instanceParams": [
{
"availability_zone_0": "mtpocdv-kvm-az01",
@@ -112,7 +115,8 @@
"modelName": "201673MowBvL._vPFE_BV..module-2",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
"modelCustomizationId": "da4d4327-fb7d-4311-ac7a-be7ba60cf969"
- },
+ },
+ "instanceName": "vfModule4",
"instanceParams": [
{
"availability_zone_0": "mtpocdv-kvm-az01",
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkModelVersionId.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkModelVersionId.json
index 6c152855ee..148abbc4bb 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkModelVersionId.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkModelVersionId.json
@@ -72,7 +72,8 @@
"modelName": "201673MowBvL._base_BV..module-0",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
"modelCustomizationId": "a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"
- },
+ },
+ "instanceName": "vfModule1",
"instanceParams": [
{
"vmx_int_net_len": "24",
@@ -86,7 +87,8 @@
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
"modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8",
"modelType": "vfModule"
- },
+ },
+ "instanceName": "vfModule2",
"instanceParams": [
{
"availability_zone_0": "mtpocdv-kvm-az01",
@@ -99,7 +101,8 @@
"modelName": "201673MowBvL._vRE_BV..module-1",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
"modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8"
- },
+ },
+ "instanceName": "vfModule3",
"instanceParams": [
{
"availability_zone_0": "mtpocdv-kvm-az01",
@@ -112,7 +115,8 @@
"modelName": "201673MowBvL._vPFE_BV..module-2",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
"modelCustomizationId": "da4d4327-fb7d-4311-ac7a-be7ba60cf969"
- },
+ },
+ "instanceName": "vfModule4",
"instanceParams": [
{
"availability_zone_0": "mtpocdv-kvm-az01",
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/ServiceAssign.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/ServiceAssign.json
index bc6f8fc610..d8bfcc2d5b 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/ServiceAssign.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/ServiceAssign.json
@@ -72,7 +72,8 @@
"modelName": "201673MowBvL._base__BV..module-0",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
"modelCustomizationId": "a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"
- },
+ },
+ "instanceName": "vfModule1",
"instanceParams": [
{
"vmx_int_net_len": "24",
@@ -86,7 +87,8 @@
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
"modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8",
"modelType": "vfModule"
- },
+ },
+ "instanceName": "vfModule2",
"instanceParams": [
{
"availability_zone_0": "mtpocdv-kvm-az01",
@@ -99,7 +101,8 @@
"modelName": "201673MowBvL._vRE_BV..module-1",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
"modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8"
- },
+ },
+ "instanceName": "vfModule3",
"instanceParams": [
{
"availability_zone_0": "mtpocdv-kvm-az01",
@@ -112,7 +115,8 @@
"modelName": "201673MowBvL._vPFE_BV..module-2",
"modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
"modelCustomizationId": "da4d4327-fb7d-4311-ac7a-be7ba60cf969"
- },
+ },
+ "instanceName": "vfModule4",
"instanceParams": [
{
"availability_zone_0": "mtpocdv-kvm-az01",
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceAssign.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceAssign.json
index fd8b7c4e69..1efb0c1243 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceAssign.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceAssign.json
@@ -75,6 +75,7 @@
"modelVersionId":"4c75f813-fa91-45a4-89d0-790ff5f1ae79",
"modelCustomizationId":"a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"
},
+ "instanceName": "vfModule1",
"instanceParams":[
{
"vmx_int_net_len":"24"
@@ -88,6 +89,7 @@
"modelVersionId":"56e2b103-637c-4d1a-adc8-3a7f4a6c3240",
"modelCustomizationId":"72d9d1cd-f46d-447a-abdb-451d6fb05fa8"
},
+ "instanceName": "vfModule2",
"instanceParams":[
{
"availability_zone_0":"mtpocdv-kvm-az01",
@@ -102,6 +104,7 @@
"modelVersionId":"56e2b103-637c-4d1a-adc8-3a7f4a6c3240",
"modelCustomizationId":"72d9d1cd-f46d-447a-abdb-451d6fb05fa8"
},
+ "instanceName": "vfModule3",
"instanceParams":[
{
"availability_zone_0":"mtpocdv-kvm-az01",
@@ -116,6 +119,7 @@
"modelVersionId":"f555558f-d538-4876-8ffa-b102650fad64",
"modelCustomizationId":"da4d4327-fb7d-4311-ac7a-be7ba60cf969"
},
+ "instanceName": "vfModule4",
"instanceParams":[
{
"availability_zone_0":"mtpocdv-kvm-az01",
@@ -132,4 +136,4 @@
]
}
}
-} \ No newline at end of file
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/UserParamsValidation/DuplicateInstanceNames.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/UserParamsValidation/DuplicateInstanceNames.json
new file mode 100644
index 0000000000..19106202a4
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/UserParamsValidation/DuplicateInstanceNames.json
@@ -0,0 +1,193 @@
+{
+ "requestDetails": {
+ "subscriberInfo": {
+ "globalSubscriberId": "ubuntu-customer"
+ },
+ "requestInfo": {
+ "suppressRollback": false,
+ "instanceName": "ThreeVNFTest",
+ "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "requestorId": "portal",
+ "source": "postman"
+ },
+ "requestParameters": {
+ "subscriptionServiceType": "ubuntu",
+ "userParams": [
+ {
+ "service": {
+ "instanceParams": [],
+ "resources": {
+ "vnfs": [
+ {
+ "modelInfo": {
+ "modelName": "UbuntuVF",
+ "modelVersionId": "9306f24c-2b99-46d9-a92c-2236199555bd",
+ "modelInvariantUuid": "5bd13140-11b6-4975-b6ee-e496d9a0cf0d",
+ "modelVersion": "3.0",
+ "modelCustomizationId": "435f34f8-1701-4276-ae39-47ad03bad782",
+ "modelInstanceName": "UbuntuVF 0"
+ },
+ "cloudConfiguration": {
+ },
+ "platform": {
+ "platformName": "test"
+ },
+ "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "instanceName": "UbuntuVNF1",
+ "instanceParams": [
+ {
+ "vnf-name": "vnf-vnf-name",
+ "vnf_name": "UbuntuVNFName"
+ }
+ ],
+ "vfModules": [
+ {
+ "modelInfo": {
+ "modelName": "Ubuntuvf..base..module-0",
+ "modelVersionId": "c9de87ba-9d2a-44df-94c4-68aad72947e8",
+ "modelInvariantUuid": "51aaa747-68e7-4313-9717-9d32c752bbdf",
+ "modelVersion": "1",
+ "modelCustomizationId": "25409778-c4b0-448c-aa45-89c0a2cc4165"
+ },
+ "instanceName": "lcm-demo-network-1",
+ "instanceParams": [
+ {
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "modelInfo": {
+ "modelName": "UbuntuBVF",
+ "modelVersionId": "0e5c37c2-8c35-4ff8-a538-803a5f44aeb5",
+ "modelInvariantUuid": "cf4ac32e-88b8-4fff-b5fc-9ebe2b7251f8",
+ "modelVersion": "1.0",
+ "modelCustomizationId": "e774a853-4a47-4a88-b5b4-9324f1d7f6a7",
+ "modelInstanceName": "UbuntuBVF 0"
+ },
+ "cloudConfiguration": {
+ },
+ "platform": {
+ "platformName": "test"
+ },
+ "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "instanceName": "UbuntuVNF2",
+ "instanceParams": [
+ {
+ "vnf-name": "vnf-vnf-name",
+ "vnf_name": "UbuntuVNFName2"
+ }
+ ],
+ "vfModules": [
+ {
+ "modelInfo": {
+ "modelName": "Ubuntubvf..ubuntu-vf-module..module-1",
+ "modelVersionId": "548fa27f-d9d7-498f-9292-4c1ddcf79d2d",
+ "modelInvariantUuid": "7689624d-fdcd-40a5-acf1-93f5ef1a5a59",
+ "modelVersion": "1",
+ "modelCustomizationId": "c8db1431-ffbe-4978-9b28-b310ca2c7d93"
+ },
+ "instanceName": "lcm-demo-ubuntu-1",
+ "instanceParams": [
+ {
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "modelInfo": {
+ "modelName": "UbuntuBVF",
+ "modelVersionId": "0e5c37c2-8c35-4ff8-a538-803a5f44aeb5",
+ "modelInvariantUuid": "cf4ac32e-88b8-4fff-b5fc-9ebe2b7251f8",
+ "modelVersion": "1.0",
+ "modelCustomizationId": "e774a853-4a47-4a88-b5b4-9324f1d7f6a7",
+ "modelInstanceName": "UbuntuBVF 0"
+ },
+ "cloudConfiguration": {
+ },
+ "platform": {
+ "platformName": "test"
+ },
+ "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "instanceName": "UbuntuVNF3",
+ "instanceParams": [
+ {
+ "vnf-name": "vnf-vnf-name",
+ "vnf_name": "UbuntuVNFName3"
+ }
+ ],
+ "vfModules": [
+ {
+ "modelInfo": {
+ "modelName": "Ubuntubvf..ubuntu-vf-module..module-1",
+ "modelVersionId": "548fa27f-d9d7-498f-9292-4c1ddcf79d2d",
+ "modelInvariantUuid": "7689624d-fdcd-40a5-acf1-93f5ef1a5a59",
+ "modelVersion": "1",
+ "modelCustomizationId": "c8db1431-ffbe-4978-9b28-b310ca2c7d93"
+ },
+ "instanceName": "lcm-demo-ubuntu-2",
+ "instanceParams": [
+ {
+ }
+ ]
+ },
+ {
+ "modelInfo": {
+ "modelName": "Ubuntubvf..ubuntu-vf-module..module-1",
+ "modelVersionId": "548fa27f-d9d7-498f-9292-4c1ddcf79d2d",
+ "modelInvariantUuid": "7689624d-fdcd-40a5-acf1-93f5ef1a5a59",
+ "modelVersion": "1",
+ "modelCustomizationId": "c8db1431-ffbe-4978-9b28-b310ca2c7d93"
+ },
+ "instanceName": "lcm-demo-ubuntu-3",
+ "instanceParams": [
+ {
+ }
+ ]
+ },
+ {
+ "modelInfo": {
+ "modelName": "Ubuntunosriov..base..module-0",
+ "modelVersionId": "bcc8ef84-b367-40c0-8a5d-ceabdc1785e0",
+ "modelInvariantUuid": "f3927419-9e68-4883-b861-20c8412872d7",
+ "modelVersion": "1",
+ "modelCustomizationId": "ee848516-4e08-4b30-8ed0-d411bb059842"
+ },
+ "instanceName": "ubuntu-demo-mp-network-1",
+ "instanceParams": [
+ {
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ "modelInfo": {
+ "modelVersion": "2.0",
+ "modelVersionId": "3a9ff92f-dc19-4f05-930d-d238939d508b",
+ "modelInvariantId": "115405d8-6944-407d-b0ae-6b7155754643",
+ "modelName": "Ubuntu3VNFService",
+ "modelType": "service"
+ }
+ }
+ }
+ ],
+ "aLaCarte": false
+ },
+ "project": {
+ "projectName": "Project-test"
+ },
+ "owningEntity": {
+ },
+ "modelInfo": {
+ "modelVersion": "2.0",
+ "modelVersionId": "3a9ff92f-dc19-4f05-930d-d238939d508b",
+ "modelInvariantId": "115405d8-6944-407d-b0ae-6b7155754643",
+ "modelName": "Ubuntu3VNFService",
+ "modelType": "service"
+ }
+ }
+} \ No newline at end of file