diff options
author | Aleem Raja <aleem.raja@t-systems.com> | 2022-08-10 21:20:12 +0530 |
---|---|---|
committer | Aleem Raja <aleem.raja@t-systems.com> | 2022-08-10 21:20:23 +0530 |
commit | ea65e0397e030bbd0a685f473b1c8416dd0a82f3 (patch) | |
tree | fc6acc9c4dbf23856ea3c21beb09478db5ebd5b6 /bpmn/MSOCommonBPMN/src/main | |
parent | b0f785e99096f230281d17e0fa89c21aca00fbac (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/MSOCommonBPMN/src/main')
3 files changed, 21 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); |