From 62cd6aaaf74aa91ee0037c0e155c8e7284f07567 Mon Sep 17 00:00:00 2001 From: Arthur Martella Date: Fri, 8 Sep 2017 13:27:46 -0400 Subject: 1710 Rebase - Second Attempt This commit rebases changes from openecomp-mso/internal-staging-1710 up to and including this codecloud commit: 54483fc6606ddb1591a2e9da61bff8712325f924 Wed Sep 6 18:12:56 2017 -0400 Rebasing was done on a branch on top of this commit in so/master in ONAP: 93fbdfbe46104f8859d4754040f979cb7997c157 Thu Sep 7 16:42:59 2017 +0000 Change-Id: I4ad9abf40da32bf5bdca43e868b8fa2dbcd9dc59 Issue-id: SO-107 Signed-off-by: Arthur Martella --- .../mso/asdc/util/ASDCNotificationLogging.java | 199 ++++++++++++++++++++- .../org/openecomp/mso/asdc/util/YamlEditor.java | 4 +- 2 files changed, 201 insertions(+), 2 deletions(-) (limited to 'asdc-controller/src/main/java/org/openecomp/mso/asdc/util') diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/ASDCNotificationLogging.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/ASDCNotificationLogging.java index a355f0547a..085d761c0a 100644 --- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/ASDCNotificationLogging.java +++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/ASDCNotificationLogging.java @@ -27,8 +27,13 @@ import java.util.Map; import org.openecomp.sdc.api.notification.IArtifactInfo; import org.openecomp.sdc.api.notification.INotificationData; import org.openecomp.sdc.api.notification.IResourceInstance; - +import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper; +import org.openecomp.sdc.tosca.parser.impl.SdcPropertyNames; +import org.openecomp.sdc.toscaparser.api.Group; +import org.openecomp.sdc.toscaparser.api.NodeTemplate; +import org.openecomp.sdc.toscaparser.api.elements.Metadata; import org.openecomp.mso.asdc.installer.IVfModuleData; +import org.openecomp.mso.asdc.installer.ToscaResourceStructure; public class ASDCNotificationLogging { @@ -84,6 +89,198 @@ public class ASDCNotificationLogging { return buffer.toString(); } + public static String dumpCSARNotification(INotificationData asdcNotification, ToscaResourceStructure toscaResourceStructure) { + + if (asdcNotification == null) { + return "NULL"; + } + + + StringBuffer buffer = new StringBuffer("CSAR Notification:"); + buffer.append(System.lineSeparator()); + buffer.append(System.lineSeparator()); + + + ISdcCsarHelper csarHelper = toscaResourceStructure.getSdcCsarHelper(); + + + buffer.append("Service Level Properties:"); + buffer.append(System.lineSeparator()); + buffer.append("Name:"); + buffer.append(testNull(csarHelper.getServiceMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME))); + buffer.append(System.lineSeparator()); + buffer.append("Description:"); + buffer.append(testNull(csarHelper.getServiceMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION))); + buffer.append(System.lineSeparator()); + buffer.append("Model UUID:"); + buffer.append(testNull(csarHelper.getServiceMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID))); + buffer.append(System.lineSeparator()); + buffer.append("Model Version:"); + buffer.append(testNull(csarHelper.getServiceMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION))); + buffer.append(System.lineSeparator()); + buffer.append("Model InvariantUuid:"); + buffer.append(testNull(csarHelper.getServiceMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID))); + + buffer.append(System.lineSeparator()); + buffer.append(System.lineSeparator()); + buffer.append("VNF Level Properties:"); + buffer.append(System.lineSeparator()); + + List vfNodeTemplatesList = toscaResourceStructure.getSdcCsarHelper().getServiceVfList(); + for (NodeTemplate vfNodeTemplate : vfNodeTemplatesList) { + + buffer.append("Model Name:"); + buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME).trim())); + buffer.append(System.lineSeparator()); + buffer.append("Description:"); + buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION).trim())); + buffer.append(System.lineSeparator()); + buffer.append("Version:"); + buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION).trim())); + buffer.append(System.lineSeparator()); + buffer.append("Type:"); + buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_TYPE).trim())); + buffer.append(System.lineSeparator()); + buffer.append("InvariantUuid:"); + buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID).trim())); + buffer.append(System.lineSeparator()); + buffer.append("Max Instances:"); + buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES).trim())); + buffer.append(System.lineSeparator()); + buffer.append("Min Instances:"); + buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MININSTANCES).trim())); + buffer.append(System.lineSeparator()); + + buffer.append(System.lineSeparator()); + buffer.append("VNF Customization Properties:"); + buffer.append(System.lineSeparator()); + + buffer.append("Customization UUID:"); + buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID).trim())); + buffer.append(System.lineSeparator()); + buffer.append("NFFunction:"); + buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NFFUNCTION).trim())); + buffer.append(System.lineSeparator()); + buffer.append("NFCode:"); + buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NFCODE).trim())); + buffer.append(System.lineSeparator()); + buffer.append("NFRole:"); + buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NFROLE).trim())); + buffer.append(System.lineSeparator()); + buffer.append("NFType:"); + buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NFTYPE).trim())); + buffer.append(System.lineSeparator()); + + buffer.append(System.lineSeparator()); + buffer.append("VF Module Properties:"); + buffer.append(System.lineSeparator()); + List vfGroups = toscaResourceStructure.getSdcCsarHelper().getVfModulesByVf(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID).trim())); + + for(Group group : vfGroups){ + + Metadata vfMetadata = group.getMetadata(); + + buffer.append("ModelInvariantUuid:"); + buffer.append(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata, SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELINVARIANTUUID).trim())); + buffer.append(System.lineSeparator()); + buffer.append("ModelName:"); + buffer.append(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata, SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELNAME).trim())); + buffer.append(System.lineSeparator()); + buffer.append("ModelUuid:"); + buffer.append(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata, SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID).trim())); + buffer.append(System.lineSeparator()); + buffer.append("ModelVersion:"); + buffer.append(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata, SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELVERSION).trim())); + buffer.append(System.lineSeparator()); + buffer.append("Description:"); + buffer.append(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata, SdcPropertyNames.PROPERTY_NAME_DESCRIPTION).trim())); + buffer.append(System.lineSeparator()); + } + + } + + + List nodeTemplatesVLList = toscaResourceStructure.getSdcCsarHelper().getServiceVlList(); + + if(nodeTemplatesVLList != null){ + + buffer.append(System.lineSeparator()); + buffer.append("NETWORK Level Properties:"); + buffer.append(System.lineSeparator()); + + for(NodeTemplate vlNode : nodeTemplatesVLList){ + + buffer.append("Model Name:"); + buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME).trim())); + buffer.append(System.lineSeparator()); + buffer.append("Model InvariantUuid:"); + buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID).trim())); + buffer.append(System.lineSeparator()); + buffer.append("Model UUID:"); + buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID).trim())); + buffer.append(System.lineSeparator()); + buffer.append("Model Version:"); + buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION).trim())); + buffer.append(System.lineSeparator()); + buffer.append("AIC Max Version:"); + buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES).trim())); + buffer.append(System.lineSeparator()); + buffer.append("AIC Min Version:"); + buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MININSTANCES).trim())); + buffer.append(System.lineSeparator()); + buffer.append("Tosca Node Type:"); + buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_TYPE).trim())); + buffer.append(System.lineSeparator()); + buffer.append("Description:"); + buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION).trim())); + buffer.append(System.lineSeparator()); + + } + + } + + List allottedResourceList = toscaResourceStructure.getSdcCsarHelper().getAllottedResources(); + + if(allottedResourceList != null){ + + buffer.append(System.lineSeparator()); + buffer.append("Allotted Resource Properties:"); + buffer.append(System.lineSeparator()); + + for(NodeTemplate allottedNode : allottedResourceList){ + + buffer.append("Model Name:"); + buffer.append(testNull(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME).trim())); + buffer.append(System.lineSeparator()); + buffer.append("Model Name:"); + buffer.append(testNull(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME).trim())); + buffer.append(System.lineSeparator()); + buffer.append("Model InvariantUuid:"); + buffer.append(testNull(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID).trim())); + buffer.append(System.lineSeparator()); + buffer.append("Model Version:"); + buffer.append(testNull(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION).trim())); + buffer.append(System.lineSeparator()); + buffer.append("Model UUID:"); + buffer.append(testNull(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID).trim())); + buffer.append(System.lineSeparator()); + + + buffer.append("Allotted Resource Customization Properties:"); + buffer.append(System.lineSeparator()); + + buffer.append("Model Cutomization UUID:"); + buffer.append(testNull(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID).trim())); + buffer.append(System.lineSeparator()); + + + } + } + + + return buffer.toString(); + } + public static String dumpVfModuleMetaDataList(List moduleMetaDataList) { if (moduleMetaDataList == null ) { return null; diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/YamlEditor.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/YamlEditor.java index 773ff86444..f7a0916f3b 100644 --- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/YamlEditor.java +++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/YamlEditor.java @@ -96,7 +96,7 @@ public class YamlEditor { // Based on the email from Ella Kvetny: // Within Heat Template, under parameters catalog, it might indicate the default value of the parameter // If default value exist, the parameter is not mandatory, otherwise its value should be set - public synchronized Set getParameterList () { + public synchronized Set getParameterList (String artifactUUID) { Set paramSet = new HashSet (); @SuppressWarnings("unchecked") Map resourceMap = (Map ) yml.get ("parameters"); @@ -118,6 +118,8 @@ public class YamlEditor { // Now set the type String value = resourceEntry.get ("type"); param.setParamType (value); + + param.setHeatTemplateArtifactUuid(artifactUUID); paramSet.add (param); -- cgit 1.2.3-korg