From 073d731620daa5dd08e41fcabfe7f5a463485e22 Mon Sep 17 00:00:00 2001 From: sarada prasad sahoo Date: Tue, 3 Sep 2019 15:27:13 +0530 Subject: fix public NS distribution issue Fix Multiple VFModule under single service distribution Issue-ID: SO-2275 Change-Id: I7a4a7dbb68d23c0e44f9985b3fdc89816dbfd232 Signed-off-by: sarada prasad sahoo --- .../so/asdc/installer/heat/ToscaResourceInstaller.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'asdc-controller/src/main/java/org') diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java index da989b0155..c3ee081c69 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java @@ -656,7 +656,10 @@ public class ToscaResourceInstaller { NetworkResourceCustomization networkCustomization = createNetwork(vlEntity, toscaResourceStruct, heatTemplate, tempNetworkLookUp.getAicVersionMax(), tempNetworkLookUp.getAicVersionMin(), service); - service.getNetworkCustomizations().add(networkCustomization); + // only insert unique entries + if (!service.getNetworkCustomizations().contains(networkCustomization)) { + service.getNetworkCustomizations().add(networkCustomization); + } } else { throw new ArtifactInstallerException("No HeatTemplate found for artifactUUID: " + tempNetworkLookUp.getHeatTemplateArtifactUuid()); @@ -2499,7 +2502,6 @@ public class ToscaResourceInstaller { // setting resource input for vnf customization vnfResourceCustomization.setResourceInput( getResourceInput(toscaResourceStructure, vnfResourceCustomization.getModelCustomizationUUID())); - service.getVnfCustomizations().add(vnfResourceCustomization); } return vnfResourceCustomization; @@ -2815,10 +2817,16 @@ public class ToscaResourceInstaller { Service existingService = services.get(0); List existingVnfCustomizations = existingService.getVnfCustomizations(); if (existingService != null) { - service.getVnfCustomizations().addAll(existingVnfCustomizations); + // it is duplicating entries, so added a check + for (VnfResourceCustomization existingVnfResourceCustomization : existingVnfCustomizations) { + if (!service.getVnfCustomizations().contains(existingVnfResourceCustomization)) { + service.getVnfCustomizations().add(existingVnfResourceCustomization); + } + } } } service.getVnfCustomizations().add(vnfResourceCustomization); + } -- cgit 1.2.3-korg