From 487061f35d918536c6ce8ec6fe7e0ee70532aedc Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Wed, 12 Sep 2018 16:55:02 -0400 Subject: Stability fixes sdnc now logs the full response message as a json removed erroneous encoding of variables with full XML Return created network from getVirtualLinkL3Network added exception logger to workflowaction aai check Check for null value for vnfcPorts before referencing it Added test case for invalid camunda response Changed to use updateStatus method Added saving for currentActiveReq and test for 401 resp Change JUnit to use expectedException and clean up unused items. Add vfModuleId to the exception message for missing model info. Report an error if VF Module model info is expected but is null. - Just renamed the Cvnfc and Vnfc set names - Updated code to check for duplicate VNFC's across multiple modules in the same VNF. - Removed commented out if statement line for ALLOTTED_RESOURCE - Reinitialize the Cvnfc and Vnfc Sets each time we iterate the VFModule loop. This will avoid the concurrent modification exception. Eliminated Ben from the sample request Changed to use else if for null check Added null check before catdb call and test case Fix implementation of a call to VNF Adapter for DeleteVolumeGroupBB. Update the method to no call save and do a put Revert usage of PUT method, use save instead Change-Id: I9f69fb68d0639c23b8e1de6931938119bd3ac54b Issue-ID: SO-1032 Signed-off-by: Benjamin, Max (mb388a) --- .../installer/heat/ToscaResourceInstaller.java | 92 ++++++++++++---------- 1 file changed, 51 insertions(+), 41 deletions(-) (limited to 'asdc-controller') 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 f7b457c718..1fca9d3ff2 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 @@ -459,7 +459,6 @@ public class ToscaResourceInstaller { logger.debug("VF Category is : " + vfCustomizationCategory); - //if (!vfCustomizationCategory.equalsIgnoreCase(ALLOTTED_RESOURCE)) if(vfResourceStructure.getVfModuleStructure() != null && !vfResourceStructure.getVfModuleStructure().isEmpty()) { @@ -479,9 +478,9 @@ public class ToscaResourceInstaller { VnfResourceCustomization vnfResource = createVnfResource(nodeTemplate, toscaResourceStruct, service); - Set cvnfcCustomizations = new HashSet(); - Set vnfcCustomizations = new HashSet(); - + Set existingCvnfcSet = new HashSet(); + Set existingVnfcSet = new HashSet(); + for (VfModuleStructure vfModuleStructure : vfResourceStructure.getVfModuleStructure()) { logger.debug("vfModuleStructure:" + vfModuleStructure.toString()); @@ -499,7 +498,7 @@ public class ToscaResourceInstaller { findFirst(); if(matchingObject.isPresent()){ VfModuleCustomization vfModuleCustomization = createVFModuleResource(matchingObject.get(), nodeTemplate, toscaResourceStruct, - vfResourceStructure,vfMetadata, vnfResource, service, cvnfcCustomizations, vnfcCustomizations); + vfResourceStructure,vfMetadata, vnfResource, service, existingCvnfcSet, existingVnfcSet); vfModuleCustomization.getVfModule().setVnfResources(vnfResource.getVnfResources()); }else throw new Exception("Cannot find matching VFModule Customization for VF Module Metadata: " + vfMetadata.getVfModuleModelCustomizationUUID()); @@ -1193,7 +1192,8 @@ public class ToscaResourceInstaller { protected VfModuleCustomization createVFModuleResource(Group group, NodeTemplate nodeTemplate, ToscaResourceStructure toscaResourceStructure, VfResourceStructure vfResourceStructure, - IVfModuleData vfModuleData, VnfResourceCustomization vnfResource, Service service, Set cvnfcCustomizations, Set vnfcCustomizations) { + IVfModuleData vfModuleData, VnfResourceCustomization vnfResource, Service service, Set existingCvnfcSet, Set existingVnfcSet) { + VfModuleCustomization vfModuleCustomization = findExistingVfModuleCustomization(vnfResource, vfModuleData.getVfModuleModelCustomizationUUID()); if(vfModuleCustomization == null){ @@ -1216,29 +1216,32 @@ public class ToscaResourceInstaller { //****************************************************************************************************************** //* Extract VFC's and CVFC's then add them to VFModule //****************************************************************************************************************** - - Set vnfVfmoduleCvnfcConfigurationCustomizations = new HashSet(); + + Set vnfVfmoduleCvnfcConfigurationCustomizations = new HashSet(); + Set cvnfcCustomizations = new HashSet(); + Set vnfcCustomizations = new HashSet(); // Extract CVFC lists List cvfcList = toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(nodeTemplate, SdcTypes.CVFC); for(NodeTemplate cvfcTemplate : cvfcList) { - - CvnfcCustomization existingCvnfcCustomization = findExistingCvfc(cvnfcCustomizations, cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); + + CvnfcCustomization existingCvnfcCustomization = findExistingCvfc(existingCvnfcSet, cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); if(existingCvnfcCustomization == null){ //Extract associated VFC - Should always be just one List vfcList = toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(cvfcTemplate, SdcTypes.VFC); - - VnfcCustomization vnfcCustomization = new VnfcCustomization(); - VnfcCustomization existingVnfcCustomization = null; - + for(NodeTemplate vfcTemplate : vfcList) { - existingVnfcCustomization = findExistingVfc(vnfcCustomizations, vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); - - if(existingVnfcCustomization == null){ + VnfcCustomization vnfcCustomization = new VnfcCustomization(); + VnfcCustomization existingVnfcCustomization = null; + + existingVnfcCustomization = findExistingVfc(existingVnfcSet, vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); + + // Only Add Abstract VNFC's to our DB, ignore all others + if(existingVnfcCustomization == null && vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY).equalsIgnoreCase("Abstract")){ vnfcCustomization.setModelCustomizationUUID(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); vnfcCustomization.setModelInstanceName(vfcTemplate.getName()); vnfcCustomization.setModelInvariantUUID(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); @@ -1252,31 +1255,36 @@ public class ToscaResourceInstaller { vnfcCustomization.setToscaNodeType(testNull(vfcTemplate.getType())); vnfcCustomizations.add(vnfcCustomization); + existingVnfcSet.add(vnfcCustomization); } - - CvnfcCustomization cvnfcCustomization = new CvnfcCustomization(); - cvnfcCustomization.setModelCustomizationUUID(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); - cvnfcCustomization.setModelInstanceName(cvfcTemplate.getName()); - cvnfcCustomization.setModelInvariantUUID(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); - cvnfcCustomization.setModelName(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); - cvnfcCustomization.setModelUUID(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); - - cvnfcCustomization.setModelVersion( - testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION))); - cvnfcCustomization.setDescription( - testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION))); - cvnfcCustomization.setToscaNodeType(testNull(cvfcTemplate.getType())); - - if(existingVnfcCustomization != null){ - cvnfcCustomization.setVnfcCustomization(existingVnfcCustomization); - }else{ - cvnfcCustomization.setVnfcCustomization(vnfcCustomization); - } - - cvnfcCustomization.setVfModuleCustomization(vfModuleCustomization); - cvnfcCustomization.setVnfResourceCustomization(vnfResource); - cvnfcCustomizations.add(cvnfcCustomization); + // This check is needed incase the VFC subcategory is something other than Abstract. In that case we want to skip adding that record to our DB. + if(vnfcCustomization.getModelCustomizationUUID() != null){ + + CvnfcCustomization cvnfcCustomization = new CvnfcCustomization(); + cvnfcCustomization.setModelCustomizationUUID(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); + cvnfcCustomization.setModelInstanceName(cvfcTemplate.getName()); + cvnfcCustomization.setModelInvariantUUID(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); + cvnfcCustomization.setModelName(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); + cvnfcCustomization.setModelUUID(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); + + cvnfcCustomization.setModelVersion( + testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION))); + cvnfcCustomization.setDescription( + testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION))); + cvnfcCustomization.setToscaNodeType(testNull(cvfcTemplate.getType())); + + if(existingVnfcCustomization != null){ + cvnfcCustomization.setVnfcCustomization(existingVnfcCustomization); + }else{ + cvnfcCustomization.setVnfcCustomization(vnfcCustomization); + } + + cvnfcCustomization.setVfModuleCustomization(vfModuleCustomization); + cvnfcCustomization.setVnfResourceCustomization(vnfResource); + + cvnfcCustomizations.add(cvnfcCustomization); + existingCvnfcSet.add(cvnfcCustomization); //***************************************************************************************************************************************** //* Extract Fabric Configuration @@ -1308,11 +1316,13 @@ public class ToscaResourceInstaller { vnfVfmoduleCvnfcConfigurationCustomizations.add(vnfVfmoduleCvnfcConfigurationCustomization); } + } + } } - } + } vfModuleCustomization.setCvnfcCustomization(cvnfcCustomizations); vfModuleCustomization.setVnfVfmoduleCvnfcConfigurationCustomization(vnfVfmoduleCvnfcConfigurationCustomizations); -- cgit 1.2.3-korg