aboutsummaryrefslogtreecommitdiffstats
path: root/asdc-controller/src/main
diff options
context:
space:
mode:
authorMerkel, Jeff <jeff.merkel@att.com>2019-06-06 15:50:15 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2019-06-06 15:50:26 -0400
commit73cb1f8af7a98daa02d72fbdd6bca45056906245 (patch)
treeac3325ab6622c214db2c85cb758ed508fde194fe /asdc-controller/src/main
parentc4b90365d5c117bc6fd64af421a1468539a8aec3 (diff)
Check if configuration resource already exists.
Check if configuration resource already exists. Change-Id: I359aaa96ef66b37880cf369c3f5bd7bfd828aab1 Issue-ID: SO-1978 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'asdc-controller/src/main')
-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;