aboutsummaryrefslogtreecommitdiffstats
path: root/asdc-controller/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'asdc-controller/src/main/java')
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java38
1 files changed, 25 insertions, 13 deletions
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 bd5f0d0dbc..9af1cb9935 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
@@ -740,8 +740,8 @@ public class ToscaResourceInstaller {
toscaResourceStruct.getSdcCsarHelper().getRequirementsOf(configNode).getAll();
for (RequirementAssignment requirement : requirementsList) {
if (requirement.getNodeTemplateName().equals(spNode.getName())) {
- ConfigurationResourceCustomization configurationResource =
- createConfiguration(configNode, toscaResourceStruct, serviceProxy, service);
+ ConfigurationResourceCustomization configurationResource = createConfiguration(configNode,
+ toscaResourceStruct, serviceProxy, service, configurationResourceList);
Optional<ConfigurationResourceCustomization> matchingObject =
configurationResourceList.stream()
@@ -1400,24 +1400,23 @@ public class ToscaResourceInstaller {
protected ConfigurationResourceCustomization createConfiguration(NodeTemplate nodeTemplate,
ToscaResourceStructure toscaResourceStructure, ServiceProxyResourceCustomization spResourceCustomization,
- Service service) {
+ Service service, List<ConfigurationResourceCustomization> configurationResourceList) {
ConfigurationResourceCustomization configCustomizationResource = getConfigurationResourceCustomization(
nodeTemplate, toscaResourceStructure, spResourceCustomization, service);
- ConfigurationResource configResource = getConfigurationResource(nodeTemplate);
-
- Set<ConfigurationResourceCustomization> configResourceCustomizationSet = new HashSet<>();
-
- configCustomizationResource.setConfigurationResource(configResource);
-
- configResourceCustomizationSet.add(configCustomizationResource);
+ ConfigurationResource configResource = null;
- configResource.setConfigurationResourceCustomization(configResourceCustomizationSet);
+ ConfigurationResource existingConfigResource = findExistingConfiguration(service,
+ nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID), configurationResourceList);
- toscaResourceStructure.setCatalogConfigurationResource(configResource);
+ if (existingConfigResource == null) {
+ configResource = getConfigurationResource(nodeTemplate);
+ } else {
+ configResource = existingConfigResource;
+ }
- toscaResourceStructure.setCatalogConfigurationResourceCustomization(configCustomizationResource);
+ configCustomizationResource.setConfigurationResource(configResource);
return configCustomizationResource;
}
@@ -2159,6 +2158,19 @@ public class ToscaResourceInstaller {
return configResource;
}
+ protected ConfigurationResource findExistingConfiguration(Service service, String modelUUID,
+ List<ConfigurationResourceCustomization> configurationResourceList) {
+ ConfigurationResource configResource = null;
+ for (ConfigurationResourceCustomization configurationResourceCustom : configurationResourceList) {
+ if (configurationResourceCustom.getConfigurationResource() != null
+ && configurationResourceCustom.getConfigurationResource().getModelUUID().equals(modelUUID)) {
+ configResource = configurationResourceCustom.getConfigurationResource();
+ }
+ }
+
+ return configResource;
+ }
+
protected VfModuleCustomization findExistingVfModuleCustomization(VnfResourceCustomization vnfResource,
String vfModuleModelCustomizationUUID) {
VfModuleCustomization vfModuleCustomization = null;