diff options
author | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2018-09-08 16:04:51 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2018-09-08 22:33:28 -0400 |
commit | 032c4e3bffa6171e5ea0f7fd584d86cfc16ac31c (patch) | |
tree | 6614308f00a7ebd034d63d77dea288c2777a190e /asdc-controller/src/main | |
parent | 8ad64f284cfcecb63dafa787df6fd8a1d2e2b91d (diff) |
stability fixes
fixed bean error
fixed execution variable name
do not explicitly set hibernate objects
Removed remaing references to tunnel-xconnect
fixed virtual link case
Change-Id: Ia5a59794e84beadcbf259efb899878cc4465ca57
Issue-ID: SO-997
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 | 54 |
1 files changed, 42 insertions, 12 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 70831bc828..f7b457c718 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 @@ -101,6 +101,7 @@ import org.onap.so.db.catalog.data.repository.InstanceGroupRepository; import org.onap.so.db.catalog.data.repository.NetworkResourceCustomizationRepository; import org.onap.so.db.catalog.data.repository.NetworkResourceRepository; import org.onap.so.db.catalog.data.repository.ServiceProxyResourceCustomizationRepository; +import org.onap.so.db.catalog.data.repository.ServiceProxyResourceRepository; import org.onap.so.db.catalog.data.repository.ServiceRepository; import org.onap.so.db.catalog.data.repository.TempNetworkHeatTemplateRepository; import org.onap.so.db.catalog.data.repository.VFModuleCustomizationRepository; @@ -151,6 +152,9 @@ public class ToscaResourceInstaller { protected ServiceProxyResourceCustomizationRepository serviceProxyCustomizationRepo; @Autowired + protected ServiceProxyResourceRepository serviceProxyRepo; + + @Autowired protected CollectionResourceRepository collectionRepo; @Autowired @@ -386,32 +390,48 @@ public class ToscaResourceInstaller { } } } - + protected void processServiceProxyAndConfiguration(ToscaResourceStructure toscaResourceStruct, Service service) { List<NodeTemplate> serviceProxyResourceList = toscaResourceStruct.getSdcCsarHelper().getServiceNodeTemplateBySdcType(SdcTypes.SERVICE_PROXY); List<NodeTemplate> configurationNodeTemplatesList = toscaResourceStruct.getSdcCsarHelper().getServiceNodeTemplateBySdcType(SdcTypes.CONFIGURATION); + List<ServiceProxyResourceCustomization> serviceProxyList = new ArrayList<ServiceProxyResourceCustomization>(); + List<ConfigurationResourceCustomization> configurationResourceList = new ArrayList<ConfigurationResourceCustomization>(); + + ServiceProxyResourceCustomization serviceProxy = null; + if (serviceProxyResourceList != null) { for (NodeTemplate spNode : serviceProxyResourceList) { - createServiceProxy(spNode, service, toscaResourceStruct); - serviceProxyCustomizationRepo.saveAndFlush(toscaResourceStruct.getCatalogServiceProxyResourceCustomization()); + serviceProxy = createServiceProxy(spNode, service, toscaResourceStruct); + + ServiceProxyResource serviceProxyResource = findExistingServiceProxyResource(serviceProxyList, serviceProxy.getServiceProxyResource().getModelUUID()); + + if(serviceProxyResource == null){ + + serviceProxyList.add(serviceProxy); for (NodeTemplate configNode : configurationNodeTemplatesList) { - + List<RequirementAssignment> requirementsList = toscaResourceStruct.getSdcCsarHelper().getRequirementsOf(configNode).getAll(); for (RequirementAssignment requirement : requirementsList) { if (requirement.getNodeTemplateName().equals(spNode.getName())) { - createConfiguration(configNode, toscaResourceStruct, toscaResourceStruct.getCatalogServiceProxyResourceCustomization()); - configCustomizationRepo.saveAndFlush(toscaResourceStruct.getCatalogConfigurationResourceCustomization()); + ConfigurationResourceCustomization configurationResource = createConfiguration(configNode, toscaResourceStruct, serviceProxy); + + configurationResourceList.add(configurationResource); break; } } } + + } } } + + service.setConfigurationCustomizations(configurationResourceList); + service.setServiceProxyCustomizations(serviceProxyList); } protected void processNetworkCollections(ToscaResourceStructure toscaResourceStruct, Service service) { @@ -731,9 +751,6 @@ public class ToscaResourceInstaller { spCustomizationResource.setServiceProxyResource(spResource); serviceProxyCustomizationSet.add(spCustomizationResource); - - spResource.setServiceProxyCustomization(serviceProxyCustomizationSet); - toscaResourceStructure.setCatalogServiceProxyResource(spResource); toscaResourceStructure.setCatalogServiceProxyResourceCustomization(spCustomizationResource); @@ -1237,8 +1254,6 @@ public class ToscaResourceInstaller { vnfcCustomizations.add(vnfcCustomization); } - } - CvnfcCustomization cvnfcCustomization = new CvnfcCustomization(); cvnfcCustomization.setModelCustomizationUUID(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); cvnfcCustomization.setModelInstanceName(cvfcTemplate.getName()); @@ -1293,11 +1308,12 @@ public class ToscaResourceInstaller { vnfVfmoduleCvnfcConfigurationCustomizations.add(vnfVfmoduleCvnfcConfigurationCustomization); } + } + } } - vfModuleCustomization.setVnfcCustomization(vnfcCustomizations); vfModuleCustomization.setCvnfcCustomization(cvnfcCustomizations); vfModuleCustomization.setVnfVfmoduleCvnfcConfigurationCustomization(vnfVfmoduleCvnfcConfigurationCustomizations); @@ -1350,6 +1366,20 @@ public class ToscaResourceInstaller { return configResource; } + protected ServiceProxyResource findExistingServiceProxyResource(List<ServiceProxyResourceCustomization> serviceProxyList, String modelUUID) { + ServiceProxyResource serviceProxyResource = null; + for(ServiceProxyResourceCustomization serviceProxyResourceCustom : serviceProxyList){ + if (serviceProxyResourceCustom.getServiceProxyResource() != null + && serviceProxyResourceCustom.getServiceProxyResource().getModelUUID().equals(modelUUID)) { + serviceProxyResource = serviceProxyResourceCustom.getServiceProxyResource(); + } + } + if(serviceProxyResource==null) + serviceProxyResource = serviceProxyRepo.findResourceByModelUUID(modelUUID); + + return serviceProxyResource; + } + protected VfModuleCustomization findExistingVfModuleCustomization(VnfResourceCustomization vnfResource, String vfModuleModelCustomizationUUID) { VfModuleCustomization vfModuleCustomization = null; |