diff options
Diffstat (limited to 'bpmn/MSOCommonBPMN')
4 files changed, 24 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); |