aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn
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 /bpmn
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 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java1
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java9
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java14
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversal.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtils.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversalTest.java25
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtilsTest.java9
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroCreateMultipleSameModelPnfs.json91
9 files changed, 153 insertions, 3 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java
index cb4bd81918..aa5da4c790 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java
@@ -35,6 +35,7 @@ public enum ResourceKey {
VPN_BONDING_LINK_ID,
INSTANCE_GROUP_ID,
PNF,
+ PNF_INSTANCE_NAME,
VNF_INSTANCE_NAME,
VF_MODULE_INSTANCE_NAME,
CHILD_SERVICE_INSTANCE_ID,
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java
index cfcc1f9f3b..a44d5e972d 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java
@@ -44,6 +44,7 @@ public class WorkflowResourceIds implements Serializable {
private String vfModuleInstanceName;
private String childServiceInstanceId;
private String childServiceInstanceName;
+ private String pnfInstanceName;
@@ -178,4 +179,12 @@ public class WorkflowResourceIds implements Serializable {
public void setChildServiceInstanceName(String childServiceInstanceName) {
this.childServiceInstanceName = childServiceInstanceName;
}
+
+ public String getPnfInstanceName() {
+ return pnfInstanceName;
+ }
+
+ public void setPnfInstanceName(String pnfInstanceName) {
+ this.pnfInstanceName = pnfInstanceName;
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
index b29b95a3b1..a0784b375e 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
@@ -264,6 +264,7 @@ public class BBInputSetup implements JavaDelegate {
lookupKeyMap.put(ResourceKey.VF_MODULE_INSTANCE_NAME, workflowResourceIds.getVfModuleInstanceName());
lookupKeyMap.put(ResourceKey.CHILD_SERVICE_INSTANCE_ID, workflowResourceIds.getChildServiceInstanceId());
lookupKeyMap.put(ResourceKey.CHILD_SERVICE_INSTANCE_NAME, workflowResourceIds.getChildServiceInstanceName());
+ lookupKeyMap.put(ResourceKey.PNF_INSTANCE_NAME, workflowResourceIds.getPnfInstanceName());
}
protected GeneralBuildingBlock getGBBALaCarteNonService(ExecuteBuildingBlock executeBB,
@@ -1634,9 +1635,16 @@ public class BBInputSetup implements JavaDelegate {
} else if (bbName.contains(PNF) || (bbName.contains(CONTROLLER)
&& (PNF).equalsIgnoreCase(executeBB.getBuildingBlock().getBpmnScope()))) {
String pnfId = lookupKeyMap.get(ResourceKey.PNF);
- resources.getPnfs().stream()
- .filter(pnfs -> Objects.equals(key, pnfs.getModelInfo().getModelCustomizationId())).findFirst()
- .ifPresent(pnfs -> BBInputSetupPnf.populatePnfToServiceInstance(pnfs, pnfId, serviceInstance));
+ String pnfInstanceName = lookupKeyMap.get(ResourceKey.PNF_INSTANCE_NAME);
+ if (StringUtils.isNotBlank(pnfInstanceName)) {
+ resources.getPnfs().stream().filter(pnfs -> Objects.equals(pnfInstanceName, pnfs.getInstanceName()))
+ .findFirst()
+ .ifPresent(pnfs -> BBInputSetupPnf.populatePnfToServiceInstance(pnfs, pnfId, serviceInstance));
+ } else {
+ resources.getPnfs().stream()
+ .filter(pnfs -> Objects.equals(key, pnfs.getModelInfo().getModelCustomizationId())).findFirst()
+ .ifPresent(pnfs -> BBInputSetupPnf.populatePnfToServiceInstance(pnfs, pnfId, serviceInstance));
+ }
} else if (bbName.contains(VF_MODULE) || bbName.contains(VOLUME_GROUP) || (bbName.contains(CONTROLLER)
&& (VF_MODULE).equalsIgnoreCase(executeBB.getBuildingBlock().getBpmnScope()))) {
String vfModuleInstanceName = lookupKeyMap.get(ResourceKey.VF_MODULE_INSTANCE_NAME);
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
index 7f066af080..803d2bf8a3 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
@@ -2123,6 +2123,7 @@ public class BBInputSetupTest {
String vfModuleInstanceName = "vfModuleInstanceName";
String childServiceInstanceId = "childServiceInstanceId";
String childServiceInstanceName = "childServiceInstanceName";
+ String pnfInstanceName = "pnfInstanceName";
expected.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstanceId);
expected.put(ResourceKey.NETWORK_ID, networkId);
@@ -2136,6 +2137,7 @@ public class BBInputSetupTest {
expected.put(ResourceKey.VF_MODULE_INSTANCE_NAME, vfModuleInstanceName);
expected.put(ResourceKey.CHILD_SERVICE_INSTANCE_ID, childServiceInstanceId);
expected.put(ResourceKey.CHILD_SERVICE_INSTANCE_NAME, childServiceInstanceName);
+ expected.put(ResourceKey.PNF_INSTANCE_NAME, pnfInstanceName);
WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
workflowResourceIds.setServiceInstanceId(serviceInstanceId);
@@ -2150,6 +2152,7 @@ public class BBInputSetupTest {
workflowResourceIds.setVfModuleInstanceName(vfModuleInstanceName);
workflowResourceIds.setChildServiceInstanceId(childServiceInstanceId);
workflowResourceIds.setChildServiceInstanceName(childServiceInstanceName);
+ workflowResourceIds.setPnfInstanceName(pnfInstanceName);
SPY_bbInputSetup.populateLookupKeyMapWithIds(workflowResourceIds, actual);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversal.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversal.java
index b56bd905a6..466b49644f 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversal.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversal.java
@@ -246,6 +246,7 @@ public class UserParamsServiceTraversal {
pnfResource.setModelCustomizationId(modelInfo.getModelCustomizationUuid());
pnfResource.setModelVersionId(modelInfo.getModelVersionId());
}
+ pnfResource.setInstanceName(pnf.getInstanceName());
pnfResource.setProcessingPriority(pnf.getProcessingPriority());
resourceList.add(pnfResource);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtils.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtils.java
index 9cabf6665c..f3aafde2a2 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtils.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtils.java
@@ -70,6 +70,8 @@ public final class WorkflowResourceIdsUtils {
workflowResourceIds.setVnfInstanceName(instanceName);
} else if (resourceType == WorkflowType.VFMODULE) {
workflowResourceIds.setVfModuleInstanceName(instanceName);
+ } else if (resourceType == WorkflowType.PNF) {
+ workflowResourceIds.setPnfInstanceName(instanceName);
}
}
@@ -110,6 +112,7 @@ public final class WorkflowResourceIdsUtils {
workflowResourceIds.setInstanceGroupId((String) execution.getVariable("instanceGroupId"));
workflowResourceIds.setVnfInstanceName((String) execution.getVariable("vnfInstanceName"));
workflowResourceIds.setVfModuleInstanceName((String) execution.getVariable("vfModuleInstanceName"));
+ workflowResourceIds.setPnfInstanceName((String) execution.getVariable("pnfInstanceName"));
return workflowResourceIds;
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversalTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversalTest.java
index cac7f872b3..cf6588e113 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversalTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversalTest.java
@@ -66,6 +66,7 @@ public class UserParamsServiceTraversalTest extends BaseTaskTest {
private static final String MACRO_CREATE_WITHOUT_RESOURCES_JSON = "Macro/ServiceMacroCreateWithoutResources.json";
private static final String MACRO_CREATE_SVC_SAME_MODEL_VNF_VFMODULE =
"Macro/ServiceMacroCreateMultipleSameModelVnfsAndVfModules.json";
+ private static final String MACRO_CREATE_SVC_SAME_MODEL_PNF = "Macro/ServiceMacroCreateMultipleSameModelPnfs.json";
private static final String serviceInstanceId = "123";
private DelegateExecution execution;
private CatalogDbClient mockCatalogDbClient;
@@ -149,6 +150,30 @@ public class UserParamsServiceTraversalTest extends BaseTaskTest {
}
@Test
+ public void getResourceListFromUserParamsMultiplePnfs() throws Exception {
+ initExecution("createInstance", readBpmnRequestFromFile(MACRO_CREATE_SVC_SAME_MODEL_PNF), false);
+
+ List<Resource> resourceListFromUserParams = userParamsServiceTraversal.getResourceListFromUserParams(execution,
+ getUserParams(), serviceInstanceId, requestAction);
+
+ assertEquals(3, resourceListFromUserParams.size());
+
+ Resource service = resourceListFromUserParams.get(0);
+ assertTrue(service.getResourceType() == WorkflowType.SERVICE);
+ assertEquals(2, service.getChildren().size());
+
+ Resource pnf1 = service.getChildren().get(0);
+ assertEquals(service, pnf1.getParent());
+ assertEquals("ORAN_SIM1_2106_pnf_01", pnf1.getInstanceName());
+ assertEquals("88a3096a-af87-4853-99f6-7256a9ab6c3e", pnf1.getResourceId());
+
+ Resource pnf2 = service.getChildren().get(1);
+ assertEquals(service, pnf2.getParent());
+ assertEquals("ORAN_SIM1_2106_pnf_02", pnf2.getInstanceName());
+ assertEquals("88a3096a-af87-4853-99f6-7256a9ab6c3e", pnf2.getResourceId());
+ }
+
+ @Test
public void getResourceListFromUserParamsForVnfs() throws Exception {
initExecution(requestAction, readBpmnRequestFromFile(MACRO_ASSIGN_JSON), false);
Mockito.doReturn(getVfModuleCustomization("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f", true))
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtilsTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtilsTest.java
index 996c0c07e1..f8bd963c49 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtilsTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtilsTest.java
@@ -42,6 +42,7 @@ public class WorkflowResourceIdsUtilsTest {
private static final String CONFIGURATION_ID = "configurationId";
private static final String VNF_INSTANCE_NAME = "vnfInstanceNameId";
private static final String VF_MODULE_INSTANCE_NAME = "vfModuleInstanceNameId";
+ private static final String PNF_INSTANCE_NAME = "pnfInstanceNameId";
private WorkflowResourceIds workflowResourceIds;
@Before
@@ -60,6 +61,7 @@ public class WorkflowResourceIdsUtilsTest {
execution.setVariable("instanceGroupId", INSTANCE_GROUP_ID);
execution.setVariable("vnfInstanceName", VNF_INSTANCE_NAME);
execution.setVariable("vfModuleInstanceName", VF_MODULE_INSTANCE_NAME);
+ execution.setVariable("pnfInstanceName", PNF_INSTANCE_NAME);
workflowResourceIds = WorkflowResourceIdsUtils.getWorkflowResourceIdsFromExecution(execution);
@@ -71,6 +73,7 @@ public class WorkflowResourceIdsUtilsTest {
assertEquals(INSTANCE_GROUP_ID, workflowResourceIds.getInstanceGroupId());
assertEquals(VNF_INSTANCE_NAME, workflowResourceIds.getVnfInstanceName());
assertEquals(VF_MODULE_INSTANCE_NAME, workflowResourceIds.getVfModuleInstanceName());
+ assertEquals(PNF_INSTANCE_NAME, workflowResourceIds.getPnfInstanceName());
}
@Test
@@ -149,6 +152,12 @@ public class WorkflowResourceIdsUtilsTest {
workflowResourceIds::getVfModuleInstanceName);
}
+ @Test
+ public void shouldPropertySetPnfInstanceName() {
+ assertFieldSetProperlyInstanceName(WorkflowType.PNF, PNF_INSTANCE_NAME,
+ workflowResourceIds::getPnfInstanceName);
+ }
+
private void assertFieldSetProperly(WorkflowType workflowType, String expectedId,
Supplier<String> testedObjectField) {
WorkflowResourceIdsUtils.setResourceIdByWorkflowType(workflowResourceIds, workflowType, expectedId);
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroCreateMultipleSameModelPnfs.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroCreateMultipleSameModelPnfs.json
new file mode 100644
index 0000000000..4eb6faee64
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroCreateMultipleSameModelPnfs.json
@@ -0,0 +1,91 @@
+{
+ "requestDetails": {
+ "modelInfo": {
+ "modelInvariantId": "d6f8f4e8-7de9-47c1-aa5c-4b6868738f5c",
+ "modelType": "service",
+ "modelName": "service_pnf_2305",
+ "modelVersion": "2.0",
+ "modelVersionId": "e199ca4e-08f9-4f10-a15d-b94d50e52a6a",
+ "modelUuid": "e199ca4e-08f9-4f10-a15d-b94d50e52a6a",
+ "modelInvariantUuid": "d6f8f4e8-7de9-47c1-aa5c-4b6868738f5c"
+ },
+ "requestInfo": {
+ "productFamilyId": "5G",
+ "source": "VID",
+ "instanceName": "ORAN_SIM1_2106_1",
+ "suppressRollback": false,
+ "requestorId": "NBI"
+ },
+ "subscriberInfo": {
+ "globalSubscriberId": "5GCustomer"
+ },
+ "requestParameters": {
+ "subscriptionServiceType": "5G",
+ "userParams": [{
+ "service": {
+ "modelInfo": {
+ "modelVersionId": "e199ca4e-08f9-4f10-a15d-b94d50e52a6a",
+ "modelName": "service_pnf_2305",
+ "modelType": "service"
+ },
+ "instanceName": "ORAN_SIM1_2106_1",
+ "instanceParams": [],
+ "resources": {
+ "pnfs": [{
+ "modelInfo": {
+ "modelCustomizationName": "pnf_only_2305 0",
+ "modelCustomizationId": "88a3096a-af87-4853-99f6-7256a9ab6c3e",
+ "modelInvariantId": "d6f8f4e8-7de9-47c1-aa5c-4b6868738f5c",
+ "modelVersionId": "a6a9dc3d-204c-4dbb-862b-46214788b0e5",
+ "modelName": "service_pnf_2305",
+ "modelType": "pnf",
+ "modelVersion": "2.0"
+ },
+ "platform": {
+ "platformName": "test"
+ },
+ "lineOfBusiness": {
+ "lineOfBusinessName": "LOB-5GCustomer"
+ },
+ "productFamilyId": "5G",
+ "instanceParams": [],
+ "instanceName": "ORAN_SIM1_2106_pnf_01",
+ "processingPriority": 1
+ }, {
+ "modelInfo": {
+ "modelCustomizationName": "pnf_only_2305 0",
+ "modelCustomizationId": "88a3096a-af87-4853-99f6-7256a9ab6c3e",
+ "modelInvariantId": "d6f8f4e8-7de9-47c1-aa5c-4b6868738f5c",
+ "modelVersionId": "a6a9dc3d-204c-4dbb-862b-46214788b0e5",
+ "modelName": "service_pnf_2305",
+ "modelType": "pnf",
+ "modelVersion": "2.0"
+ },
+ "platform": {
+ "platformName": "test"
+ },
+ "lineOfBusiness": {
+ "lineOfBusinessName": "LOB-5GCustomer"
+ },
+ "productFamilyId": "5G",
+ "instanceParams": [],
+ "instanceName": "ORAN_SIM1_2106_pnf_02",
+ "processingPriority": 2
+ }]
+ }
+ }
+ }, {
+ "Homing_Solution": "none"
+ }],
+ "aLaCarte": false,
+ "usePreload": false
+ },
+ "project": {
+ "projectName": "basicnw-project"
+ },
+ "owningEntity": {
+ "owningEntityId": "67f2e84c-734d-4e90-a1e4-d2ffa2e75849",
+ "owningEntityName": "OE-5GCustomer"
+ }
+ }
+} \ No newline at end of file