diff options
author | Merkel, Jeff <jeff.merkel@att.com> | 2019-06-26 11:23:02 -0400 |
---|---|---|
committer | Max Benjamin <max.benjamin@att.com> | 2019-06-27 16:09:26 +0000 |
commit | 2d499f6efeaf9f2ee227199fda5e350882861a7b (patch) | |
tree | 2dd56f40f465455e6c6809cde134293ab24dd699 /asdc-controller/src/main | |
parent | 5c58eeca5ffd8b080b9af7619a903eb0acff3a0d (diff) |
handle multiple cvnfc configs
- Handle multiple cvnfc configs with the same model uuid.
- Update CvnfcConfigurationCustomization to a List from a Set
Change-Id: I8c026510d813ebb6294a9cedd39d4d4b8f4b9dcf
Issue-ID: SO-2056
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.java | 38 |
1 files changed, 23 insertions, 15 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 30196379a3..94517ccc45 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 @@ -107,6 +107,7 @@ import org.onap.so.db.catalog.data.repository.CollectionResourceCustomizationRep import org.onap.so.db.catalog.data.repository.CollectionResourceRepository; import org.onap.so.db.catalog.data.repository.ConfigurationResourceCustomizationRepository; import org.onap.so.db.catalog.data.repository.ConfigurationResourceRepository; +import org.onap.so.db.catalog.data.repository.CvnfcConfigurationCustomizationRepository; import org.onap.so.db.catalog.data.repository.CvnfcCustomizationRepository; import org.onap.so.db.catalog.data.repository.ExternalServiceToInternalServiceRepository; import org.onap.so.db.catalog.data.repository.HeatEnvironmentRepository; @@ -980,6 +981,7 @@ public class ToscaResourceInstaller { Set<CvnfcCustomization> existingCvnfcSet = new HashSet<>(); Set<VnfcCustomization> existingVnfcSet = new HashSet<>(); + List<CvnfcConfigurationCustomization> existingCvnfcConfigurationCustom = new ArrayList<>(); for (VfModuleStructure vfModuleStructure : vfResourceStructure.getVfModuleStructure()) { @@ -1000,7 +1002,7 @@ public class ToscaResourceInstaller { if (matchingObject.isPresent()) { VfModuleCustomization vfModuleCustomization = createVFModuleResource(matchingObject.get(), nodeTemplate, toscaResourceStruct, vfResourceStructure, vfMetadata, vnfResource, - service, existingCvnfcSet, existingVnfcSet); + existingCvnfcSet, existingVnfcSet, existingCvnfcConfigurationCustom); vfModuleCustomization.getVfModule().setVnfResources(vnfResource.getVnfResources()); } else throw new Exception( @@ -1928,8 +1930,9 @@ public class ToscaResourceInstaller { protected VfModuleCustomization createVFModuleResource(Group group, NodeTemplate vfTemplate, ToscaResourceStructure toscaResourceStructure, VfResourceStructure vfResourceStructure, - IVfModuleData vfModuleData, VnfResourceCustomization vnfResource, Service service, - Set<CvnfcCustomization> existingCvnfcSet, Set<VnfcCustomization> existingVnfcSet) { + IVfModuleData vfModuleData, VnfResourceCustomization vnfResource, Set<CvnfcCustomization> existingCvnfcSet, + Set<VnfcCustomization> existingVnfcSet, + List<CvnfcConfigurationCustomization> existingCvnfcConfigurationCustom) { VfModuleCustomization vfModuleCustomization = findExistingVfModuleCustomization(vnfResource, vfModuleData.getVfModuleModelCustomizationUUID()); @@ -1955,7 +1958,7 @@ public class ToscaResourceInstaller { // * Extract VFC's and CVFC's then add them to VFModule // ****************************************************************************************************************** - Set<CvnfcConfigurationCustomization> cvnfcConfigurationCustomizations = new HashSet<>(); + List<CvnfcConfigurationCustomization> cvnfcConfigurationCustomizations = new ArrayList<>(); Set<CvnfcCustomization> cvnfcCustomizations = new HashSet<>(); Set<VnfcCustomization> vnfcCustomizations = new HashSet<>(); @@ -2060,8 +2063,6 @@ public class ToscaResourceInstaller { .getNodeTemplatePropertyLeafValue(cvfcTemplate, "nfc_naming_code")); cvnfcCustomization.setVfModuleCustomization(vfModuleCustomization); - cvnfcCustomizations.add(cvnfcCustomization); - existingCvnfcSet.add(cvnfcCustomization); // ***************************************************************************************************************************************** // * Extract Fabric Configuration @@ -2074,8 +2075,9 @@ public class ToscaResourceInstaller { ConfigurationResource fabricConfig = null; - ConfigurationResource existingConfig = findExistingConfiguration(service, - fabricTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); + ConfigurationResource existingConfig = + findExistingConfiguration(existingCvnfcConfigurationCustom, + fabricTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); if (existingConfig == null) { @@ -2089,11 +2091,16 @@ public class ToscaResourceInstaller { createCvnfcConfigurationCustomization(fabricTemplate, toscaResourceStructure, vnfResource, vfModuleCustomization, cvnfcCustomization, fabricConfig, vfTemplate, vfModuleMemberName); + cvnfcConfigurationCustomizations.add(cvnfcConfigurationCustomization); - fabricConfig.setCvnfcConfigurationCustomization(cvnfcConfigurationCustomizations); + existingCvnfcConfigurationCustom.add(cvnfcConfigurationCustomization); + } cvnfcCustomization.setCvnfcConfigurationCustomization(cvnfcConfigurationCustomizations); + cvnfcCustomizations.add(cvnfcCustomization); + existingCvnfcSet.add(cvnfcCustomization); + } } @@ -2152,13 +2159,14 @@ public class ToscaResourceInstaller { return cvnfcConfigurationCustomization; } - protected ConfigurationResource findExistingConfiguration(Service service, String modelUUID) { + protected ConfigurationResource findExistingConfiguration( + List<CvnfcConfigurationCustomization> existingCvnfcConfigurationCustom, String modelUUID) { ConfigurationResource configResource = null; - for (ConfigurationResourceCustomization configurationResourceCustom : service - .getConfigurationCustomizations()) { - if (configurationResourceCustom.getConfigurationResource() != null - && configurationResourceCustom.getConfigurationResource().getModelUUID().equals(modelUUID)) { - configResource = configurationResourceCustom.getConfigurationResource(); + for (CvnfcConfigurationCustomization cvnfcConfigCustom : existingCvnfcConfigurationCustom) { + if (cvnfcConfigCustom != null) { + if (cvnfcConfigCustom.getConfigurationResource().getModelUUID().equals(modelUUID)) { + configResource = cvnfcConfigCustom.getConfigurationResource(); + } } } |