summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java38
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java2
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java7
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CvnfcConfigurationCustomizationRepository.java3
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/CvnfcCustomizationTest.java4
6 files changed, 36 insertions, 22 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();
+ }
}
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
index 09ba55aac0..afd735ce5d 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
@@ -1063,7 +1063,7 @@ public class WorkflowActionTest extends BaseTaskTest {
vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationResource(configurationResource);
vnfVfmoduleCvnfcConfigurationCustomization.setModelInstanceName("modelInstanceName1");
vnfVfmoduleCvnfcConfigurationCustomization.setCvnfcCustomization(cvnfcCustomization);
- Set<CvnfcConfigurationCustomization> custSet = new HashSet<CvnfcConfigurationCustomization>();
+ List<CvnfcConfigurationCustomization> custSet = new ArrayList<CvnfcConfigurationCustomization>();
custSet.add(vnfVfmoduleCvnfcConfigurationCustomization);
cvnfcCustomization.setCvnfcConfigurationCustomization(custSet);
cvnfcCustomization.setDescription("description");
@@ -1077,7 +1077,7 @@ public class WorkflowActionTest extends BaseTaskTest {
vnfVfmoduleCvnfcConfigurationCustomization2.setConfigurationResource(configurationResource2);
vnfVfmoduleCvnfcConfigurationCustomization2.setModelInstanceName("modelInstanceName2");
vnfVfmoduleCvnfcConfigurationCustomization2.setCvnfcCustomization(cvnfcCustomization2);
- Set<CvnfcConfigurationCustomization> custSet2 = new HashSet<CvnfcConfigurationCustomization>();
+ List<CvnfcConfigurationCustomization> custSet2 = new ArrayList<CvnfcConfigurationCustomization>();
custSet2.add(vnfVfmoduleCvnfcConfigurationCustomization2);
cvnfcCustomization2.setCvnfcConfigurationCustomization(custSet2);
cvnfcCustomization2.setDescription("description2");
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java
index 34ad1b0fd4..6b5395ae07 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java
@@ -89,7 +89,7 @@ public class WorkflowActionUnitTest {
configuration.setToscaNodeType("FabricConfiguration");
configuration.setModelUUID("my-uuid");
vfModuleCustomization.setConfigurationResource(configuration);
- cvnfcCustomization.setCvnfcConfigurationCustomization(Collections.singleton(vfModuleCustomization));
+ cvnfcCustomization.setCvnfcConfigurationCustomization(Collections.singletonList(vfModuleCustomization));
List<CvnfcCustomization> cvnfcCustomizations = Arrays.asList(cvnfcCustomization);
// when(catalogDbClient.getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID(any(String.class),
// any(String.class)))
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java
index da3e391e11..7fb328fdb5 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java
@@ -22,6 +22,7 @@ package org.onap.so.db.catalog.beans;
import java.io.Serializable;
import java.util.Date;
+import java.util.List;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
@@ -100,7 +101,7 @@ public class CvnfcCustomization implements Serializable {
private VnfcCustomization vnfcCustomization;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "cvnfcCustomization")
- private Set<CvnfcConfigurationCustomization> cvnfcConfigurationCustomization;
+ private List<CvnfcConfigurationCustomization> cvnfcConfigurationCustomization;
@Override
public boolean equals(final Object other) {
@@ -142,12 +143,12 @@ public class CvnfcCustomization implements Serializable {
}
@LinkedResource
- public Set<CvnfcConfigurationCustomization> getCvnfcConfigurationCustomization() {
+ public List<CvnfcConfigurationCustomization> getCvnfcConfigurationCustomization() {
return cvnfcConfigurationCustomization;
}
public void setCvnfcConfigurationCustomization(
- Set<CvnfcConfigurationCustomization> cvnfcConfigurationCustomization) {
+ List<CvnfcConfigurationCustomization> cvnfcConfigurationCustomization) {
this.cvnfcConfigurationCustomization = cvnfcConfigurationCustomization;
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CvnfcConfigurationCustomizationRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CvnfcConfigurationCustomizationRepository.java
index 1e5a07350d..d974e88890 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CvnfcConfigurationCustomizationRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CvnfcConfigurationCustomizationRepository.java
@@ -20,6 +20,7 @@
package org.onap.so.db.catalog.data.repository;
+import java.util.List;
import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
@@ -29,4 +30,6 @@ import org.springframework.data.rest.core.annotation.RepositoryRestResource;
public interface CvnfcConfigurationCustomizationRepository
extends JpaRepository<CvnfcConfigurationCustomization, Integer> {
+ List<CvnfcConfigurationCustomization> findByModelCustomizationUUID(String modelCustomizationUUID);
+
}
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/CvnfcCustomizationTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/CvnfcCustomizationTest.java
index 80e3d53c57..4010328ad9 100644
--- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/CvnfcCustomizationTest.java
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/CvnfcCustomizationTest.java
@@ -21,7 +21,9 @@
package org.onap.so.db.catalog.beans;
import static org.junit.Assert.assertTrue;
+import java.util.ArrayList;
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
import org.junit.Test;
@@ -54,7 +56,7 @@ public class CvnfcCustomizationTest {
cvnfcCustomization.setNfcNamingCode(NFC_NAMING_CODE);
cvnfcCustomization.setToscaNodeType(TOSCA_NODE_TYPE);
cvnfcCustomization.setVfModuleCustomization(setupVfModuleCustomization());
- Set<CvnfcConfigurationCustomization> cvnfcConfigurationCustomizationSet = new HashSet();
+ List<CvnfcConfigurationCustomization> cvnfcConfigurationCustomizationSet = new ArrayList();
cvnfcConfigurationCustomizationSet.add(setupCvnfcConfigurationCustomization());
cvnfcCustomization.setCvnfcConfigurationCustomization(cvnfcConfigurationCustomizationSet);