aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java
index 68161a8dd5..54922d4ea0 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java
@@ -34,6 +34,8 @@ final class BBInputSetupPnf {
}
static void populatePnfToServiceInstance(Pnfs pnfs, String pnfId, ServiceInstance serviceInstance) {
+ removePnfFromServiceIfExists(serviceInstance, pnfId);
+
Pnf pnf = new Pnf();
pnf.setPnfId(pnfId);
pnf.setPnfName(pnfs.getInstanceName());
@@ -45,4 +47,9 @@ final class BBInputSetupPnf {
serviceInstance.getPnfs().add(pnf);
}
+
+ private static void removePnfFromServiceIfExists(ServiceInstance serviceInstance, String pnfId) {
+ serviceInstance.getPnfs().stream().filter(pnf -> pnf.getPnfId().equals(pnfId)).findFirst()
+ .ifPresent(serviceInstance.getPnfs()::remove);
+ }
}