aboutsummaryrefslogtreecommitdiffstats
path: root/asdc-controller/src/main
diff options
context:
space:
mode:
authorMerkel, Jeff <jeff.merkel@att.com>2019-10-18 10:56:10 -0400
committerBenjamin, Max (mb388a) <mb388a@att.com>2019-10-18 15:39:49 -0400
commit00257f37f7a030f1a93dc3dd67686c9fc10fafe0 (patch)
treefc9c77498d9969210ec5aa902c635a2d480dc284 /asdc-controller/src/main
parent78cd154393607d41974fbcf1e3ebc2669a8165c2 (diff)
- Update ResourceInput column length and check
- Update ResourceInput column length and check for existing vnfc's. Issue-ID: SO-2462 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com> Change-Id: I0b0168453d3c20bb6d88a33ec82788f449bf3593
Diffstat (limited to 'asdc-controller/src/main')
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java63
1 files changed, 36 insertions, 27 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 8b3bccf892..00ca74b5f4 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
@@ -1068,10 +1068,11 @@ public class ToscaResourceInstaller {
EntityQuery.newBuilder("org.openecomp.groups.VfcInstanceGroup"),
TopologyTemplateQuery.newBuilder(SdcTypes.VF).customizationUUID(vfCustomizationUUID), false);
+ Set<VnfcCustomization> existingVnfcGroupSet = new HashSet<>();
for (IEntityDetails groupEntity : vfcEntityList) {
- VnfcInstanceGroupCustomization vnfcInstanceGroupCustomization =
- createVNFCInstanceGroup(groupEntity, nodeTemplate, vnfResource, toscaResourceStruct);
+ VnfcInstanceGroupCustomization vnfcInstanceGroupCustomization = createVNFCInstanceGroup(groupEntity,
+ nodeTemplate, vnfResource, toscaResourceStruct, existingVnfcGroupSet);
vnfcInstanceGroupCustomizationRepo.saveAndFlush(vnfcInstanceGroupCustomization);
}
@@ -1888,7 +1889,7 @@ public class ToscaResourceInstaller {
protected VnfcInstanceGroupCustomization createVNFCInstanceGroup(IEntityDetails vfcInstanceEntity,
NodeTemplate vnfcNodeTemplate, VnfResourceCustomization vnfResourceCustomization,
- ToscaResourceStructure toscaResourceStructure) {
+ ToscaResourceStructure toscaResourceStructure, Set<VnfcCustomization> existingVnfcGroupSet) {
Metadata instanceMetadata = vfcInstanceEntity.getMetadata();
@@ -1958,39 +1959,47 @@ public class ToscaResourceInstaller {
vfcInstanceGroupCustom.setInstanceGroup(vfcInstanceGroup);
ArrayList<Input> inputs = vnfcNodeTemplate.getSubMappingToscaTemplate().getInputs();
- createVFCInstanceGroupMembers(vfcInstanceGroupCustom, vfcInstanceEntity, inputs);
+ createVFCInstanceGroupMembers(vfcInstanceGroupCustom, vfcInstanceEntity, inputs, existingVnfcGroupSet);
return vfcInstanceGroupCustom;
}
private void createVFCInstanceGroupMembers(VnfcInstanceGroupCustomization vfcInstanceGroupCustom,
- IEntityDetails vfcModuleEntity, List<Input> inputList) {
+ IEntityDetails vfcModuleEntity, List<Input> inputList, Set<VnfcCustomization> existingVnfcGroupSet) {
List<IEntityDetails> members = vfcModuleEntity.getMemberNodes();
if (!CollectionUtils.isEmpty(members)) {
for (IEntityDetails vfcEntity : members) {
- VnfcCustomization vnfcCustomization = new VnfcCustomization();
-
- Metadata metadata = vfcEntity.getMetadata();
- vnfcCustomization
- .setModelCustomizationUUID(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
- vnfcCustomization.setModelInstanceName(vfcEntity.getName());
- vnfcCustomization.setModelUUID(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
- vnfcCustomization
- .setModelInvariantUUID(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
- vnfcCustomization.setModelVersion(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
- vnfcCustomization.setModelName(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
- vnfcCustomization.setToscaNodeType(testNull(vfcEntity.getToscaType()));
- vnfcCustomization
- .setDescription(testNull(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
- vnfcCustomization.setResourceInput(getVnfcResourceInput(vfcEntity, inputList));
- vnfcCustomization.setVnfcInstanceGroupCustomization(vfcInstanceGroupCustom);
- List<VnfcCustomization> vnfcCustomizations = vfcInstanceGroupCustom.getVnfcCustomizations();
-
- if (vnfcCustomizations == null) {
- vnfcCustomizations = new ArrayList<>();
- vfcInstanceGroupCustom.setVnfcCustomizations(vnfcCustomizations);
+
+ VnfcCustomization existingVfcGroup = findExistingVfc(existingVnfcGroupSet,
+ vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+
+ if (existingVfcGroup == null) {
+ VnfcCustomization vnfcCustomization = new VnfcCustomization();
+
+ Metadata metadata = vfcEntity.getMetadata();
+ vnfcCustomization.setModelCustomizationUUID(
+ metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ vnfcCustomization.setModelInstanceName(vfcEntity.getName());
+ vnfcCustomization.setModelUUID(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ vnfcCustomization
+ .setModelInvariantUUID(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ vnfcCustomization.setModelVersion(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
+ vnfcCustomization.setModelName(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ vnfcCustomization.setToscaNodeType(testNull(vfcEntity.getToscaType()));
+ vnfcCustomization
+ .setDescription(testNull(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
+ vnfcCustomization.setResourceInput(getVnfcResourceInput(vfcEntity, inputList));
+ vnfcCustomization.setVnfcInstanceGroupCustomization(vfcInstanceGroupCustom);
+ List<VnfcCustomization> vnfcCustomizations = vfcInstanceGroupCustom.getVnfcCustomizations();
+
+ if (vnfcCustomizations == null) {
+ vnfcCustomizations = new ArrayList<>();
+ vfcInstanceGroupCustom.setVnfcCustomizations(vnfcCustomizations);
+ }
+ vnfcCustomizations.add(vnfcCustomization);
+
+ existingVnfcGroupSet.add(vnfcCustomization);
}
- vnfcCustomizations.add(vnfcCustomization);
}
}
}