summaryrefslogtreecommitdiffstats
path: root/asdc-controller/src
diff options
context:
space:
mode:
authorMarcus Williams <marcus.williams@intel.com>2019-02-14 20:02:18 +0000
committerGerrit Code Review <gerrit@onap.org>2019-02-14 20:02:18 +0000
commit1d69925fef5c972f045081db9b5e4795d96c6f84 (patch)
tree9c01a14b7f76eda361c6a71953077cb0b2ac9eb4 /asdc-controller/src
parent26b6a204084991a3a5ad9f02792366c96f89f28e (diff)
parent90494ef7fdddf8307a510d9c4619d26a92f22b50 (diff)
Merge "fix fields not set correctly in Fabric Policy dist"
Diffstat (limited to 'asdc-controller/src')
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java85
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java16
2 files changed, 56 insertions, 45 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 90b705c019..4f64af0110 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
@@ -671,7 +671,7 @@ public class ToscaResourceInstaller {
logger.debug("vfModuleStructure:" + vfModuleStructure.toString());
List<org.onap.sdc.toscaparser.api.Group> vfGroups = toscaResourceStruct
.getSdcCsarHelper().getVfModulesByVf(vfCustomizationUUID);
- IVfModuleData vfMetadata = vfModuleStructure.getVfModuleMetadata();
+ IVfModuleData vfMetadata = vfModuleStructure.getVfModuleMetadata();
logger.debug("Comparing Vf_Modules_Metadata CustomizationUUID : " + vfMetadata.getVfModuleModelCustomizationUUID());
@@ -982,7 +982,7 @@ public class ToscaResourceInstaller {
return configCustomizationResource;
}
- protected ConfigurationResourceCustomization createFabricConfiguration(NodeTemplate nodeTemplate, ToscaResourceStructure toscaResourceStructure) {
+ protected ConfigurationResource createFabricConfiguration(NodeTemplate nodeTemplate, ToscaResourceStructure toscaResourceStructure) {
Metadata fabricMetadata = nodeTemplate.getMetaData();
@@ -995,23 +995,7 @@ public class ToscaResourceInstaller {
configResource.setDescription(fabricMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
configResource.setToscaNodeType(nodeTemplate.getType());
- ConfigurationResourceCustomization configCustomizationResource = new ConfigurationResourceCustomization();
-
- Set<ConfigurationResourceCustomization> configResourceCustomizationSet = new HashSet<>();
-
- configCustomizationResource.setModelCustomizationUUID(fabricMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
- configCustomizationResource.setModelInstanceName(nodeTemplate.getName());
-
- configCustomizationResource.setNfFunction(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(nodeTemplate, "function"));
- configCustomizationResource.setNfRole(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(nodeTemplate, "role"));
- configCustomizationResource.setNfType(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(nodeTemplate, "type"));
- configCustomizationResource.setConfigResourceCustomization(configCustomizationResource);
- configCustomizationResource.setConfigurationResource(configResource);
- configResourceCustomizationSet.add(configCustomizationResource);
-
- configResource.setConfigurationResourceCustomization(configResourceCustomizationSet);
-
- return configCustomizationResource;
+ return configResource;
}
protected void createToscaCsar(ToscaResourceStructure toscaResourceStructure) {
@@ -1383,7 +1367,7 @@ public class ToscaResourceInstaller {
}
- protected VfModuleCustomization createVFModuleResource(Group group, NodeTemplate nodeTemplate,
+ protected VfModuleCustomization createVFModuleResource(Group group, NodeTemplate vfTemplate,
ToscaResourceStructure toscaResourceStructure, VfResourceStructure vfResourceStructure,
IVfModuleData vfModuleData, VnfResourceCustomization vnfResource, Service service, Set<CvnfcCustomization> existingCvnfcSet, Set<VnfcCustomization> existingVnfcSet) {
@@ -1391,7 +1375,7 @@ public class ToscaResourceInstaller {
vfModuleData.getVfModuleModelCustomizationUUID());
if(vfModuleCustomization == null){
VfModule vfModule = findExistingVfModule(vnfResource,
- nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID));
+ vfTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID));
Metadata vfMetadata = group.getMetadata();
if(vfModule==null)
vfModule=createVfModule(group, toscaResourceStructure, vfModuleData, vfMetadata);
@@ -1413,15 +1397,24 @@ public class ToscaResourceInstaller {
Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomizations = new HashSet<VnfVfmoduleCvnfcConfigurationCustomization>();
Set<CvnfcCustomization> cvnfcCustomizations = new HashSet<CvnfcCustomization>();
Set<VnfcCustomization> vnfcCustomizations = new HashSet<VnfcCustomization>();
+
+ // Only set the CVNFC if this vfModule group is a member of it.
+ List<NodeTemplate> groupMembers = toscaResourceStructure.getSdcCsarHelper().getMembersOfVfModule(vfTemplate, group);
+ String vfModuleMemberName = null;
+
+ for(NodeTemplate node : groupMembers){
+ vfModuleMemberName = node.getName();
+ }
+
// Extract CVFC lists
- List<NodeTemplate> cvfcList = toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(nodeTemplate, SdcTypes.CVFC);
+ List<NodeTemplate> cvfcList = toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(vfTemplate, SdcTypes.CVFC);
for(NodeTemplate cvfcTemplate : cvfcList) {
-
+
CvnfcCustomization existingCvnfcCustomization = findExistingCvfc(existingCvnfcSet, cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
- if(existingCvnfcCustomization == null){
+ if(existingCvnfcCustomization == null && (vfModuleMemberName != null && vfModuleMemberName.equalsIgnoreCase(cvfcTemplate.getName()))){
//Extract associated VFC - Should always be just one
List<NodeTemplate> vfcList = toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(cvfcTemplate, SdcTypes.VFC);
@@ -1473,9 +1466,11 @@ public class ToscaResourceInstaller {
cvnfcCustomization.setVnfcCustomization(vnfcCustomization);
}
+ cvnfcCustomization.setNfcFunction(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vfTemplate, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION));
+ cvnfcCustomization.setNfcNamingCode(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vfTemplate, "nf_naming_code"));
cvnfcCustomization.setVfModuleCustomization(vfModuleCustomization);
- cvnfcCustomization.setVnfResourceCustomization(vnfResource);
-
+ cvnfcCustomization.setVnfResourceCustomization(vnfResource);
+
cvnfcCustomizations.add(cvnfcCustomization);
existingCvnfcSet.add(cvnfcCustomization);
@@ -1483,7 +1478,7 @@ public class ToscaResourceInstaller {
//* Extract Fabric Configuration
//*****************************************************************************************************************************************
- List<NodeTemplate> fabricConfigList = toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(nodeTemplate, SdcTypes.CONFIGURATION);
+ List<NodeTemplate> fabricConfigList = toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(vfTemplate, SdcTypes.CONFIGURATION);
for(NodeTemplate fabricTemplate : fabricConfigList) {
@@ -1493,18 +1488,14 @@ public class ToscaResourceInstaller {
if(existingConfig == null){
- ConfigurationResourceCustomization fabricConfigCustomization = createFabricConfiguration(fabricTemplate, toscaResourceStructure);
-
- fabricConfig = fabricConfigCustomization.getConfigurationResource();
+ fabricConfig = createFabricConfiguration(fabricTemplate, toscaResourceStructure);
- service.getConfigurationCustomizations().add(fabricConfigCustomization);
}else {
fabricConfig = existingConfig;
- }
-
+ }
VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = createVfCnvfConfigCustomization(fabricTemplate, toscaResourceStructure,
- vnfResource, vfModuleCustomization, cvnfcCustomization, fabricConfig);
+ vnfResource, vfModuleCustomization, cvnfcCustomization, fabricConfig, vfTemplate);
vnfVfmoduleCvnfcConfigurationCustomizations.add(vnfVfmoduleCvnfcConfigurationCustomization);
}
@@ -1525,7 +1516,7 @@ public class ToscaResourceInstaller {
protected VnfVfmoduleCvnfcConfigurationCustomization createVfCnvfConfigCustomization(NodeTemplate fabricTemplate, ToscaResourceStructure toscaResourceStruct,
VnfResourceCustomization vnfResource, VfModuleCustomization vfModuleCustomization, CvnfcCustomization cvnfcCustomization,
- ConfigurationResource configResource) {
+ ConfigurationResource configResource, NodeTemplate vfTemplate) {
Metadata fabricMetadata = fabricTemplate.getMetaData();
@@ -1538,20 +1529,24 @@ public class ToscaResourceInstaller {
vfModuleToCvnfc.setModelInstanceName(fabricTemplate.getName());
vfModuleToCvnfc.setVfModuleCustomization(vfModuleCustomization);
vfModuleToCvnfc.setVnfResourceCustomization(vnfResource);
- vfModuleToCvnfc.setPolicyName(toscaResourceStruct.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(fabricTemplate, "name"));
- List<Policy> policyList = toscaResourceStruct.getSdcCsarHelper().getPoliciesOfTarget(fabricTemplate);
+ List<Policy> policyList = toscaResourceStruct.getSdcCsarHelper().getPoliciesOfOriginOfNodeTemplateByToscaPolicyType(vfTemplate, "org.openecomp.policies.External");
if(policyList != null){
for(Policy policy : policyList){
- vfModuleToCvnfc.setPolicyName(policy.getName());
+
+ Map<String, Object> propMap = policy.getPolicyProperties();
+
+ if(propMap.get("type").toString().equalsIgnoreCase("Fabric Policy")){
+ vfModuleToCvnfc.setPolicyName(propMap.get("name").toString());
+ }
}
- }
-
- vfModuleToCvnfc.setConfigurationFunction(toscaResourceStruct.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(fabricTemplate, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION));
- vfModuleToCvnfc.setConfigurationRole(toscaResourceStruct.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(fabricTemplate, SdcPropertyNames.PROPERTY_NAME_NFROLE));
- vfModuleToCvnfc.setConfigurationType(toscaResourceStruct.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(fabricTemplate, SdcPropertyNames.PROPERTY_NAME_NFTYPE));
-
+ }
+
+ vfModuleToCvnfc.setConfigurationFunction(toscaResourceStruct.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(fabricTemplate, "function"));
+ vfModuleToCvnfc.setConfigurationRole(toscaResourceStruct.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(fabricTemplate, "role"));
+ vfModuleToCvnfc.setConfigurationType(toscaResourceStruct.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(fabricTemplate, "type"));
+
return vfModuleToCvnfc;
}
@@ -1672,7 +1667,7 @@ public class ToscaResourceInstaller {
protected void setHeatInformationForVfModule(ToscaResourceStructure toscaResourceStructure,
VfResourceStructure vfResourceStructure, VfModule vfModule, VfModuleCustomization vfModuleCustomization,
Metadata vfMetadata) {
-
+
Optional<VfModuleStructure> matchingObject = vfResourceStructure.getVfModuleStructure().stream()
.filter(vfModuleStruct -> vfModuleStruct.getVfModuleMetadata().getVfModuleModelUUID()
.equalsIgnoreCase(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata,
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java b/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java
index 24304ba28c..f886ce7a3e 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java
@@ -313,6 +313,16 @@ public class ASDCNotificationLogging {
buffer.append("Description:");
buffer.append(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata, SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
buffer.append(System.lineSeparator());
+
+ List<NodeTemplate> groupMembers = toscaResourceStructure.getSdcCsarHelper().getMembersOfVfModule(vfNodeTemplate, group);
+
+ for(NodeTemplate node : groupMembers){
+ buffer.append("Member Name:");
+ buffer.append(testNull(node.getName()));
+ buffer.append(System.lineSeparator());
+ }
+
+
}
List<NodeTemplate> cvfcList = toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(vfNodeTemplate, SdcTypes.CVFC);
@@ -341,6 +351,9 @@ public class ASDCNotificationLogging {
buffer.append("Description:");
buffer.append(testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
buffer.append(System.lineSeparator());
+ buffer.append("Template Name:");
+ buffer.append(testNull(cvfcTemplate.getName()));
+ buffer.append(System.lineSeparator());
List<NodeTemplate> vfcList = toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(cvfcTemplate, SdcTypes.VFC);
@@ -368,6 +381,9 @@ public class ASDCNotificationLogging {
buffer.append("Description:");
buffer.append(testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
buffer.append(System.lineSeparator());
+ buffer.append("Sub Category:");
+ buffer.append(testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY)));
+ buffer.append(System.lineSeparator());
}