Merge "Create Pre Building Block validator"
[so.git] / asdc-controller / src / main / java / org / onap / so / asdc / util / ASDCNotificationLogging.java
index 13af95a..de28ca2 100644 (file)
@@ -28,13 +28,14 @@ import org.onap.sdc.api.notification.IArtifactInfo;
 import org.onap.sdc.api.notification.INotificationData;
 import org.onap.sdc.api.notification.IResourceInstance;
 import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
+import org.onap.sdc.tosca.parser.enums.SdcTypes;
 import org.onap.sdc.tosca.parser.impl.SdcPropertyNames;
-import org.onap.sdc.tosca.parser.impl.SdcTypes;
 import org.onap.sdc.toscaparser.api.Group;
 import org.onap.sdc.toscaparser.api.NodeTemplate;
 import org.onap.sdc.toscaparser.api.elements.Metadata;
 import org.onap.so.asdc.installer.IVfModuleData;
 import org.onap.so.asdc.installer.ToscaResourceStructure;
+import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
 
 public class ASDCNotificationLogging {
 
@@ -97,6 +98,7 @@ public class ASDCNotificationLogging {
                buffer.append(System.lineSeparator());
                buffer.append("Environment Context:");
                buffer.append(csarHelper.getServiceMetadata().getValue("environmentContext"));
+               buffer.append(System.lineSeparator());
                
                
                List<NodeTemplate> serviceProxyResourceList = toscaResourceStructure.getSdcCsarHelper().getServiceNodeTemplateBySdcType(SdcTypes.SERVICE_PROXY);
@@ -201,14 +203,13 @@ public class ASDCNotificationLogging {
                }
                }
                
-               buffer.append(System.lineSeparator());
-               buffer.append(System.lineSeparator());
-               buffer.append("VNF Level Properties:");
-               buffer.append(System.lineSeparator());
-               
         List<NodeTemplate> vfNodeTemplatesList = toscaResourceStructure.getSdcCsarHelper().getServiceVfList();
         for (NodeTemplate vfNodeTemplate :  vfNodeTemplatesList) {
-               
+                 
+               buffer.append(System.lineSeparator());
+               buffer.append(System.lineSeparator());
+               buffer.append("VNF Properties:");
+               buffer.append(System.lineSeparator());          
                buffer.append("Model Name:");
                buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
                buffer.append(System.lineSeparator());
@@ -224,6 +225,9 @@ public class ASDCNotificationLogging {
                buffer.append("Type:");
                buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_TYPE)));
                buffer.append(System.lineSeparator());
+               buffer.append("Category:");
+               buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY)));
+               buffer.append(System.lineSeparator());
                buffer.append("InvariantUuid:");
                buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
                buffer.append(System.lineSeparator());
@@ -263,6 +267,7 @@ public class ASDCNotificationLogging {
                        for (Group group : groupList) {         
                                Metadata instanceMetadata = group.getMetadata();
                                
+                               buffer.append(System.lineSeparator());
                        buffer.append(System.lineSeparator());
                        buffer.append("VNFC Instance Group Properties:");
                        buffer.append(System.lineSeparator());
@@ -278,22 +283,22 @@ public class ASDCNotificationLogging {
                        buffer.append(System.lineSeparator());
                        buffer.append("InvariantUuid:");
                        buffer.append(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
-                       buffer.append(System.lineSeparator());                                  
+                       buffer.append(System.lineSeparator());                          
                        }
                        
                }
                
                
-               
-               buffer.append(System.lineSeparator());
-               buffer.append("VF Module Properties:");
-               buffer.append(System.lineSeparator());
                List<Group> vfGroups = toscaResourceStructure.getSdcCsarHelper().getVfModulesByVf(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
                
                for(Group group : vfGroups){
                        
                        Metadata vfMetadata = group.getMetadata();
                        
+                       buffer.append(System.lineSeparator());
+                       buffer.append(System.lineSeparator());
+                       buffer.append("VF Module Properties:");
+                       buffer.append(System.lineSeparator());
                        buffer.append("ModelInvariantUuid:");
                        buffer.append(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata, SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELINVARIANTUUID)));
                        buffer.append(System.lineSeparator());
@@ -308,22 +313,97 @@ public class ASDCNotificationLogging {
                        buffer.append(System.lineSeparator()); 
                        buffer.append("Description:");
                        buffer.append(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata, SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
-                       buffer.append(System.lineSeparator());     
+                       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);
+               
+               for(NodeTemplate cvfcTemplate : cvfcList) {
+                       
+                       buffer.append(System.lineSeparator());
+                       buffer.append(System.lineSeparator());
+                       buffer.append("CVNFC Properties:");
+                       buffer.append(System.lineSeparator());
+                       buffer.append("ModelCustomizationUuid:");
+                       buffer.append(testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
+                       buffer.append(System.lineSeparator());
+                       buffer.append("ModelInvariantUuid:");
+                       buffer.append(testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
+                       buffer.append(System.lineSeparator());
+                       buffer.append("ModelName:");
+                       buffer.append(testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
+                       buffer.append(System.lineSeparator()); 
+                       buffer.append("ModelUuid:");
+                       buffer.append(testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
+                       buffer.append(System.lineSeparator());
+                       buffer.append("ModelVersion:");
+                       buffer.append(testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
+                       buffer.append(System.lineSeparator()); 
+                       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);
+                       
+                       for(NodeTemplate vfcTemplate : vfcList) {
+                               buffer.append(System.lineSeparator());
+                       buffer.append(System.lineSeparator());
+                       buffer.append("VNFC Properties:");
+                       buffer.append(System.lineSeparator());
+                       buffer.append("ModelCustomizationUuid:");
+                       buffer.append(testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
+                       buffer.append(System.lineSeparator());
+                               buffer.append("ModelInvariantUuid:");
+                       buffer.append(testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
+                       buffer.append(System.lineSeparator());
+                       buffer.append("ModelName:");
+                       buffer.append(testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
+                       buffer.append(System.lineSeparator()); 
+                       buffer.append("ModelUuid:");
+                       buffer.append(testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
+                       buffer.append(System.lineSeparator());
+                       buffer.append("ModelVersion:");
+                       buffer.append(testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
+                       buffer.append(System.lineSeparator()); 
+                       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());
+                               
+                       }               
+                       
                }
-  
-        }
+               
+        }              
+                       
         
                
                List<NodeTemplate> 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(System.lineSeparator());
+                       buffer.append(System.lineSeparator());
+                       buffer.append("NETWORK Level Properties:");
+                       buffer.append(System.lineSeparator());
                        buffer.append("Model Name:");
                        buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
                        buffer.append(System.lineSeparator()); 
@@ -347,20 +427,40 @@ public class ASDCNotificationLogging {
                        buffer.append(System.lineSeparator());  
                                buffer.append("Description:");
                        buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
-                       buffer.append(System.lineSeparator());  
+                       buffer.append(System.lineSeparator()); 
+                       
+                       buffer.append(System.lineSeparator());
+                       buffer.append("NETWORK Customization Properties:");
+                       buffer.append(System.lineSeparator());
+                               buffer.append("CustomizationUUID:");
+                       buffer.append(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+                       buffer.append(System.lineSeparator()); 
+                               buffer.append("Network Technology:");
+                       buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vlNode, SdcPropertyNames.PROPERTY_NAME_NETWORKTECHNOLOGY));
+                       buffer.append(System.lineSeparator()); 
+                       buffer.append("Network Type:");
+                       buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vlNode, SdcPropertyNames.PROPERTY_NAME_NETWORKTYPE));
+                       buffer.append(System.lineSeparator()); 
+                       buffer.append("Network Role:");
+                       buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vlNode, SdcPropertyNames.PROPERTY_NAME_NETWORKROLE));
+                       buffer.append(System.lineSeparator()); 
+                       buffer.append("Network Scope:");
+                       buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vlNode, SdcPropertyNames.PROPERTY_NAME_NETWORKSCOPE));
+                       buffer.append(System.lineSeparator());                          
                
                }
                        
        }
        
-               buffer.append(System.lineSeparator());
-               buffer.append("Network Collection Resource Properties:");
-               buffer.append(System.lineSeparator());
-               
+               
        List<NodeTemplate> networkCollectionList = toscaResourceStructure.getSdcCsarHelper().getServiceNodeTemplateBySdcType(SdcTypes.CR);
                
                if (networkCollectionList != null) {
                        for (NodeTemplate crNode : networkCollectionList) {     
+                               buffer.append(System.lineSeparator());
+                               buffer.append("Network Collection Properties:");
+                               buffer.append(System.lineSeparator());
                                buffer.append("Model Name:");
                        buffer.append(crNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
                        buffer.append(System.lineSeparator());
@@ -395,6 +495,7 @@ public class ASDCNotificationLogging {
                                
                                Metadata vlMetadata = vlNodeTemplate.getMetaData();
                                
+                               buffer.append(System.lineSeparator());
                                buffer.append(System.lineSeparator());
                                buffer.append("Network CR VL Properties:");
                                buffer.append(System.lineSeparator());
@@ -428,7 +529,8 @@ public class ASDCNotificationLogging {
                        if(groupList != null){
                                for (Group group : groupList) { 
                                        Metadata instanceMetadata = group.getMetadata();
-                                       buffer.append(System.lineSeparator());
+                                       buffer.append(System.lineSeparator());
+                                       buffer.append(System.lineSeparator());
                                        buffer.append("Network Instance Group Properties:");
                                        buffer.append(System.lineSeparator());