aboutsummaryrefslogtreecommitdiffstats
path: root/asdc-controller/src/main/java
diff options
context:
space:
mode:
authorSteve Smokowski <ss835w@att.com>2019-06-07 17:39:13 +0000
committerGerrit Code Review <gerrit@onap.org>2019-06-07 17:39:13 +0000
commit83bd49d1f3576be61173b426fc899d687f9f34fa (patch)
treebee4e1313fce1088f47a06b9596cc00ac4408aa9 /asdc-controller/src/main/java
parent986dd3431bc196a2234dc45436102d692031ea4f (diff)
parent73cb1f8af7a98daa02d72fbdd6bca45056906245 (diff)
Merge "Check if configuration resource already exists."
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 6d1c97eba3..9357c40f6c 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
@@ -739,8 +739,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()
@@ -1406,24 +1406,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;
}
@@ -2165,6 +2164,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;