aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap
diff options
context:
space:
mode:
authorAleem Raja <aleem.raja@t-systems.com>2022-08-10 21:20:12 +0530
committerAleem Raja <aleem.raja@t-systems.com>2022-08-10 21:20:23 +0530
commitea65e0397e030bbd0a685f473b1c8416dd0a82f3 (patch)
treefc6acc9c4dbf23856ea3c21beb09478db5ebd5b6 /mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap
parentb0f785e99096f230281d17e0fa89c21aca00fbac (diff)
Multiple PNFs with same ModelInfo but different instance name not able to be instantiated
When instantiating a service with multiple PNFs, SO differentiates them using ModelCustomizationId. This causes issues when creating multiple instances of same model resource, and each lookup would return the same object. With this patch, Instead of using ModelCustomizationId, we enable SO to use instanceName parameter to differentiate the PNFs. Issue-ID: SO-3948 Signed-off-by: Aleem Raja <aleem.raja@t-systems.com> Change-Id: I9dd039ac786a60f7cf4d4a9c456c7681f64d6786
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/UserParamsValidationTest.java69
1 files changed, 69 insertions, 0 deletions
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 548b957303..30b7662b59 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
@@ -243,6 +243,75 @@ public class UserParamsValidationTest {
}
@Test
+ public void validateDuplicateInstanceNameDifferentCustomizationIdPnfTest() throws IOException, ValidationException {
+ thrown.expect(ValidationException.class);
+ thrown.expectMessage(
+ "No valid instanceName: same instanceName but different modelCustomizationId (instanceName should be unique) in userParams pnf resources is specified");
+ ValidationInformation info = setupValidationInformation(
+ "src/test/resources/Validation/UserParamsValidation/DuplicateInstanceNamesPnf.json");
+ info.getUserParams().getResources().getPnfs().get(0).setInstanceName("ORAN_SIM1_2106_pnf_01");
+ validation.validate(info);
+ }
+
+ @Test
+ public void validateDuplicateInstanceNameSameCustomizationIdPnfTest() throws IOException, ValidationException {
+ thrown.expect(ValidationException.class);
+ thrown.expectMessage(
+ "No valid instanceName: same instanceName with same modelCustomizationId in userParams pnf resources is specified");
+ ValidationInformation info = setupValidationInformation(
+ "src/test/resources/Validation/UserParamsValidation/DuplicateInstanceNamesPnf.json");
+ info.getUserParams().getResources().getPnfs().get(1).getModelInfo()
+ .setModelCustomizationId("88a3096a-af87-4853-99f6-7256a9ab6c3e");
+ info.getUserParams().getResources().getPnfs().get(1).setInstanceName("ORAN_SIM1_2106_pnf_01");
+ validation.validate(info);
+ }
+
+ @Test
+ public void validateNullInstanceNameSameCustomizationIdPnfTest() throws IOException, ValidationException {
+ thrown.expect(ValidationException.class);
+ thrown.expectMessage(
+ "No valid instanceName: instanceName is missing or empty with same modelCustomizationId in userParams pnf resources is specified");
+ ValidationInformation info = setupValidationInformation(
+ "src/test/resources/Validation/UserParamsValidation/DuplicateInstanceNamesPnf.json");
+ info.getUserParams().getResources().getPnfs().get(1).getModelInfo()
+ .setModelCustomizationId("88a3096a-af87-4853-99f6-7256a9ab6c3e");
+ info.getUserParams().getResources().getPnfs().get(1).setInstanceName(null);
+ validation.validate(info);
+ }
+
+ @Test
+ public void validateDuplicateNullInstanceNameSameCustomizationIdPnfTest() throws IOException, ValidationException {
+ thrown.expect(ValidationException.class);
+ thrown.expectMessage(
+ "No valid instanceName: same instanceName with same modelCustomizationId in userParams pnf resources is specified");
+ ValidationInformation info = setupValidationInformation(
+ "src/test/resources/Validation/UserParamsValidation/DuplicateInstanceNamesPnf.json");
+ info.getUserParams().getResources().getPnfs().get(0).setInstanceName(null);
+ info.getUserParams().getResources().getPnfs().get(1).getModelInfo()
+ .setModelCustomizationId("88a3096a-af87-4853-99f6-7256a9ab6c3e");
+ info.getUserParams().getResources().getPnfs().get(1).setInstanceName(null);
+ validation.validate(info);
+ }
+
+ @Test
+ public void validateDifferentInstanceNameSameCustomizationIdPnfTest() throws IOException, ValidationException {
+ ValidationInformation info = setupValidationInformation(
+ "src/test/resources/Validation/UserParamsValidation/DuplicateInstanceNamesPnf.json");
+ info.getUserParams().getResources().getPnfs().get(1).getModelInfo()
+ .setModelCustomizationId("88a3096a-af87-4853-99f6-7256a9ab6c3e");
+ info.getUserParams().getResources().getPnfs().get(1).setInstanceName("new-pnf-instance-name");
+ validation.validate(info);
+ }
+
+ @Test
+ public void validateNullInstanceNameDifferentCustomizationIdPnfTest() throws IOException, ValidationException {
+ ValidationInformation info = setupValidationInformation(
+ "src/test/resources/Validation/UserParamsValidation/DuplicateInstanceNamesPnf.json");
+ info.getUserParams().getResources().getPnfs().get(0).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");