ab9c359b7fd170f92d3263b22d7742967cf39dc4
[so.git] / asdc-controller / src / main / java / org / onap / so / asdc / util / ASDCNotificationLogging.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.so.asdc.util;
22
23
24 import java.util.List;
25 import java.util.Map;
26
27 import org.onap.sdc.api.notification.IArtifactInfo;
28 import org.onap.sdc.api.notification.INotificationData;
29 import org.onap.sdc.api.notification.IResourceInstance;
30 import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
31 import org.onap.sdc.tosca.parser.impl.SdcPropertyNames;
32 import org.onap.sdc.tosca.parser.impl.SdcTypes;
33 import org.onap.sdc.toscaparser.api.Group;
34 import org.onap.sdc.toscaparser.api.NodeTemplate;
35 import org.onap.sdc.toscaparser.api.elements.Metadata;
36 import org.onap.so.asdc.installer.IVfModuleData;
37 import org.onap.so.asdc.installer.ToscaResourceStructure;
38
39 public class ASDCNotificationLogging {
40
41         public static String dumpASDCNotification(INotificationData asdcNotification) {
42
43                 if (asdcNotification == null) {
44                         return "NULL";
45                 }
46         return "ASDC Notification:" + System.lineSeparator() +
47             "DistributionID:" + testNull(asdcNotification.getDistributionID()) + System.lineSeparator() +
48             "ServiceName:" + testNull(asdcNotification.getServiceName()) + System.lineSeparator() +
49             "ServiceVersion:" + testNull(asdcNotification.getServiceVersion()) + System.lineSeparator() +
50             "ServiceUUID:" + testNull(asdcNotification.getServiceUUID()) + System.lineSeparator() +
51             "ServiceInvariantUUID:" + testNull(asdcNotification.getServiceInvariantUUID()) + System.lineSeparator() +
52             "ServiceDescription:" + testNull(asdcNotification.getServiceDescription()) + System.lineSeparator() +
53             "Service Artifacts List:" + System.lineSeparator() + testNull(dumpArtifactInfoList(asdcNotification.getServiceArtifacts())) + System.lineSeparator() +
54             "Resource Instances List:" + System.lineSeparator() + testNull(dumpASDCResourcesList(asdcNotification)) + System.lineSeparator();
55         }
56
57         public static String dumpCSARNotification(INotificationData asdcNotification, ToscaResourceStructure toscaResourceStructure) {
58                 
59                 if (asdcNotification == null) {
60                         return "NULL";
61                 }
62                 
63
64                 StringBuilder buffer = new StringBuilder("CSAR Notification:");
65                 buffer.append(System.lineSeparator());
66                 buffer.append(System.lineSeparator());
67                 
68                 
69                 ISdcCsarHelper csarHelper = toscaResourceStructure.getSdcCsarHelper();
70
71         
72                 buffer.append("Service Level Properties:");
73                 buffer.append(System.lineSeparator());
74                 buffer.append("Name:");
75                 buffer.append(testNull(csarHelper.getServiceMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
76                 buffer.append(System.lineSeparator());
77                 buffer.append("Description:");
78                 buffer.append(testNull(csarHelper.getServiceMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
79                 buffer.append(System.lineSeparator());
80                 buffer.append("Model UUID:");
81                 buffer.append(testNull(csarHelper.getServiceMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
82                 buffer.append(System.lineSeparator());
83                 buffer.append("Model Version:");
84                 buffer.append(testNull(csarHelper.getServiceMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
85                 buffer.append(System.lineSeparator());
86                 buffer.append("Model InvariantUuid:");
87                 buffer.append(testNull(csarHelper.getServiceMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
88                 buffer.append(System.lineSeparator());
89                 buffer.append("Service Type:");
90                 buffer.append(csarHelper.getServiceMetadata().getValue("serviceType"));
91                 buffer.append(System.lineSeparator());
92                 buffer.append("Service Role:");
93                 buffer.append(csarHelper.getServiceMetadata().getValue("serviceRole"));
94                 buffer.append(System.lineSeparator());
95                 buffer.append("WorkLoad Context:");
96                 buffer.append(asdcNotification.getWorkloadContext());
97                 buffer.append(System.lineSeparator());
98                 buffer.append("Environment Context:");
99                 buffer.append(csarHelper.getServiceMetadata().getValue("environmentContext"));
100                 
101                 
102                 List<NodeTemplate> serviceProxyResourceList = toscaResourceStructure.getSdcCsarHelper().getServiceNodeTemplateBySdcType(SdcTypes.SERVICE_PROXY);
103                 
104                 if(serviceProxyResourceList != null){
105                         
106                 for (NodeTemplate serviceProxyNodeTemplate :  serviceProxyResourceList) {
107                         
108                         buffer.append(System.lineSeparator());
109                         buffer.append(System.lineSeparator());
110                         buffer.append("Service Proxy Properties:");
111                         buffer.append(System.lineSeparator());
112                         buffer.append("Model Name:");
113                 buffer.append(serviceProxyNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
114                 buffer.append(System.lineSeparator());
115                 buffer.append("Model UUID:");
116                 buffer.append(serviceProxyNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));            
117                 buffer.append(System.lineSeparator());
118                 buffer.append("Description:");
119                 buffer.append(serviceProxyNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
120                 buffer.append(System.lineSeparator());
121                 buffer.append("Version:");
122                 buffer.append(serviceProxyNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
123                 buffer.append(System.lineSeparator());
124                 buffer.append("InvariantUuid:");
125                 buffer.append(serviceProxyNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
126                 buffer.append(System.lineSeparator());
127                 
128                 buffer.append(System.lineSeparator());
129                 buffer.append(System.lineSeparator());
130                 buffer.append("Service Proxy Customization Properties:");
131                 buffer.append(System.lineSeparator());
132                 
133                 buffer.append("Model Customization UUID:");
134                 buffer.append(serviceProxyNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
135                 buffer.append(System.lineSeparator());
136                 buffer.append("Model Instance Name:");
137                 buffer.append(serviceProxyNodeTemplate.getName());              
138                 buffer.append(System.lineSeparator());
139                 buffer.append("Tosca Node Type:");
140                 buffer.append(serviceProxyNodeTemplate.getType());
141                 buffer.append(System.lineSeparator());
142                 buffer.append("Version:");
143                 buffer.append(serviceProxyNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
144                 buffer.append(System.lineSeparator());
145                 buffer.append("InvariantUuid:");
146                 buffer.append(serviceProxyNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
147                 buffer.append(System.lineSeparator());
148                         
149                 }
150                 }
151                 
152                 List<NodeTemplate> configurationNodeTemplatesList = toscaResourceStructure.getSdcCsarHelper().getServiceNodeTemplateBySdcType(SdcTypes.CONFIGURATION);
153                 
154                 if(configurationNodeTemplatesList != null){
155                 for (NodeTemplate configNodeTemplate :  configurationNodeTemplatesList) {
156                         
157                         buffer.append(System.lineSeparator());
158                         buffer.append(System.lineSeparator());
159                         buffer.append("Configuration Properties:");
160                         buffer.append(System.lineSeparator());
161                         
162                         buffer.append("Model Name:");
163                 buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
164                 buffer.append(System.lineSeparator());
165                 buffer.append("Model UUID:");
166                 buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));          
167                 buffer.append(System.lineSeparator());
168                 buffer.append("Description:");
169                 buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
170                 buffer.append(System.lineSeparator());
171                 buffer.append("Version:");
172                 buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
173                 buffer.append(System.lineSeparator());
174                 buffer.append("InvariantUuid:");
175                 buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
176                 buffer.append(System.lineSeparator());
177                 buffer.append("Tosca Node Type:");
178                 buffer.append(configNodeTemplate.getType());
179                 
180                 buffer.append(System.lineSeparator());
181                 buffer.append(System.lineSeparator());
182                 buffer.append("Configuration Customization Properties:");
183                 buffer.append(System.lineSeparator());
184                 
185                 buffer.append("Model Customization UUID:");
186                 buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
187                 buffer.append(System.lineSeparator());
188                 buffer.append("Model Instance Name:");
189                 buffer.append(configNodeTemplate.getName());            
190                 buffer.append(System.lineSeparator());
191                 buffer.append("NFFunction:");
192                 buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(configNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION));
193                 buffer.append(System.lineSeparator());
194                 buffer.append("NFRole:");
195                 buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(configNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFROLE));
196                 buffer.append(System.lineSeparator());
197                 buffer.append("NFType:");
198                 buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(configNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFTYPE));
199                 buffer.append(System.lineSeparator());
200                         
201                 }
202                 }
203                 
204         List<NodeTemplate> vfNodeTemplatesList = toscaResourceStructure.getSdcCsarHelper().getServiceVfList();
205         for (NodeTemplate vfNodeTemplate :  vfNodeTemplatesList) {
206                 
207                 buffer.append(System.lineSeparator());
208                 buffer.append("VNF Properties:");
209                 buffer.append(System.lineSeparator());
210                 
211                 buffer.append("Model Name:");
212                 buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
213                 buffer.append(System.lineSeparator());
214                 buffer.append("Model UUID:");
215                 buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
216                 buffer.append(System.lineSeparator());
217                 buffer.append("Description:");
218                 buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
219                 buffer.append(System.lineSeparator());
220                 buffer.append("Version:");
221                 buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
222                 buffer.append(System.lineSeparator());
223                 buffer.append("Type:");
224                 buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_TYPE)));
225                 buffer.append(System.lineSeparator());
226                 buffer.append("InvariantUuid:");
227                 buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
228                 buffer.append(System.lineSeparator());
229                 buffer.append("Max Instances:");
230                 buffer.append(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES));
231                 buffer.append(System.lineSeparator());
232                 buffer.append("Min Instances:");
233                 buffer.append(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MININSTANCES));
234                 buffer.append(System.lineSeparator());
235                 
236                 buffer.append(System.lineSeparator());
237                 buffer.append("VNF Customization Properties:");
238                 buffer.append(System.lineSeparator());
239                 
240                 buffer.append("Customization UUID:");
241                 buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
242                 buffer.append(System.lineSeparator());
243                 buffer.append("NFFunction:");
244                 buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vfNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION));
245                 buffer.append(System.lineSeparator());
246                 buffer.append("NFCode:");
247                 buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vfNodeTemplate, "nf_naming_code"));
248                 buffer.append(System.lineSeparator());
249                 buffer.append("NFRole:");
250                 buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vfNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFROLE));
251                 buffer.append(System.lineSeparator());
252                 buffer.append("NFType:");
253                 buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vfNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFTYPE));
254                 buffer.append(System.lineSeparator());
255                 buffer.append("MultiStageDesign:");
256                 buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vfNodeTemplate, "multi_stage_design"));
257                 buffer.append(System.lineSeparator());
258                                 
259                 List<Group> groupList = toscaResourceStructure.getSdcCsarHelper().getGroupsOfOriginOfNodeTemplateByToscaGroupType(vfNodeTemplate, "org.openecomp.groups.VfcInstanceGroup");
260                 
261                 if(groupList != null){
262                         for (Group group : groupList) {         
263                                 Metadata instanceMetadata = group.getMetadata();
264                                 
265                         buffer.append(System.lineSeparator());
266                         buffer.append("VNFC Instance Group Properties:");
267                         buffer.append(System.lineSeparator());
268                                         
269                                 buffer.append("Model Name:");
270                         buffer.append(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
271                         buffer.append(System.lineSeparator());
272                         buffer.append("Version:");
273                         buffer.append(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
274                         buffer.append(System.lineSeparator());
275                         buffer.append("Type:");
276                         buffer.append(vfNodeTemplate.getType());
277                         buffer.append(System.lineSeparator());
278                         buffer.append("InvariantUuid:");
279                         buffer.append(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
280                         buffer.append(System.lineSeparator());                                  
281                         }
282                         
283                 }
284                 
285                         
286                 List<Group> vfGroups = toscaResourceStructure.getSdcCsarHelper().getVfModulesByVf(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
287                 
288                 for(Group group : vfGroups){
289                         
290                         Metadata vfMetadata = group.getMetadata();
291                         
292                         buffer.append(System.lineSeparator());
293                         buffer.append("VF Module Properties:");
294                         buffer.append(System.lineSeparator());
295                         buffer.append("ModelInvariantUuid:");
296                         buffer.append(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata, SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELINVARIANTUUID)));
297                         buffer.append(System.lineSeparator());
298                         buffer.append("ModelName:");
299                         buffer.append(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata, SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELNAME)));
300                         buffer.append(System.lineSeparator()); 
301                         buffer.append("ModelUuid:");
302                         buffer.append(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata, SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID)));
303                         buffer.append(System.lineSeparator());
304                         buffer.append("ModelVersion:");
305                         buffer.append(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata, SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELVERSION)));
306                         buffer.append(System.lineSeparator()); 
307                         buffer.append("Description:");
308                         buffer.append(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata, SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
309                         buffer.append(System.lineSeparator());     
310                 }
311                 
312                 List<NodeTemplate> cvfcList = toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(vfNodeTemplate, SdcTypes.CVFC);
313                 
314                 for(NodeTemplate cvfcTemplate : cvfcList) {
315                         
316                         buffer.append(System.lineSeparator());
317                         buffer.append("CVNFC Properties:");
318                         buffer.append(System.lineSeparator());
319                         buffer.append("ModelCustomizationUuid:");
320                         buffer.append(testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
321                         buffer.append(System.lineSeparator());
322                         buffer.append("ModelInvariantUuid:");
323                         buffer.append(testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
324                         buffer.append(System.lineSeparator());
325                         buffer.append("ModelName:");
326                         buffer.append(testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
327                         buffer.append(System.lineSeparator()); 
328                         buffer.append("ModelUuid:");
329                         buffer.append(testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
330                         buffer.append(System.lineSeparator());
331                         buffer.append("ModelVersion:");
332                         buffer.append(testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
333                         buffer.append(System.lineSeparator()); 
334                         buffer.append("Description:");
335                         buffer.append(testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
336                         buffer.append(System.lineSeparator()); 
337                         
338                         
339                         List<NodeTemplate> vfcList = toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(cvfcTemplate, SdcTypes.VFC);
340                         
341                         for(NodeTemplate vfcTemplate : vfcList) {
342                         buffer.append(System.lineSeparator());
343                         buffer.append("VNFC Properties:");
344                         buffer.append(System.lineSeparator());
345                         buffer.append("ModelCustomizationUuid:");
346                         buffer.append(testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
347                         buffer.append(System.lineSeparator());
348                                 buffer.append("ModelInvariantUuid:");
349                         buffer.append(testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
350                         buffer.append(System.lineSeparator());
351                         buffer.append("ModelName:");
352                         buffer.append(testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
353                         buffer.append(System.lineSeparator()); 
354                         buffer.append("ModelUuid:");
355                         buffer.append(testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
356                         buffer.append(System.lineSeparator());
357                         buffer.append("ModelVersion:");
358                         buffer.append(testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
359                         buffer.append(System.lineSeparator()); 
360                         buffer.append("Description:");
361                         buffer.append(testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
362                         buffer.append(System.lineSeparator()); 
363                                 
364                         }               
365                         
366                 }
367         }
368         
369                 
370                 List<NodeTemplate> nodeTemplatesVLList = toscaResourceStructure.getSdcCsarHelper().getServiceVlList();
371                                         
372         if(nodeTemplatesVLList != null){
373                 
374                 buffer.append(System.lineSeparator());
375                 buffer.append("NETWORK Level Properties:");
376                 buffer.append(System.lineSeparator());
377                 
378                 for(NodeTemplate vlNode : nodeTemplatesVLList){
379                         
380                         buffer.append("Model Name:");
381                         buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
382                         buffer.append(System.lineSeparator()); 
383                         buffer.append("Model InvariantUuid:");
384                         buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
385                         buffer.append(System.lineSeparator());   
386                         buffer.append("Model UUID:");
387                         buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
388                         buffer.append(System.lineSeparator()); 
389                         buffer.append("Model Version:");
390                         buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
391                         buffer.append(System.lineSeparator());   
392                         buffer.append("AIC Max Version:");
393                         buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES)));
394                         buffer.append(System.lineSeparator()); 
395                         buffer.append("AIC Min Version:");
396                         buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MININSTANCES)));
397                         buffer.append(System.lineSeparator());  
398                         buffer.append("Tosca Node Type:");
399                         buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_TYPE)));
400                         buffer.append(System.lineSeparator());  
401                         buffer.append("Description:");
402                         buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
403                         buffer.append(System.lineSeparator());  
404                 
405                 }
406                         
407         }
408         
409                 buffer.append(System.lineSeparator());
410                 buffer.append("Network Collection Resource Properties:");
411                 buffer.append(System.lineSeparator());
412                 
413         List<NodeTemplate> networkCollectionList = toscaResourceStructure.getSdcCsarHelper().getServiceNodeTemplateBySdcType(SdcTypes.CR);
414                 
415                 if (networkCollectionList != null) {
416                         for (NodeTemplate crNode : networkCollectionList) {     
417                                 buffer.append("Model Name:");
418                         buffer.append(crNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
419                         buffer.append(System.lineSeparator());
420                         buffer.append("Model UUID:");
421                         buffer.append(crNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));              
422                         buffer.append(System.lineSeparator());
423                         buffer.append("InvariantUuid:");
424                         buffer.append(crNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
425                         buffer.append(System.lineSeparator());
426                         buffer.append("Description:");
427                         buffer.append(crNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
428                         buffer.append(System.lineSeparator());
429                         buffer.append("Version:");
430                         buffer.append(crNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));   
431                         buffer.append(System.lineSeparator());
432                         buffer.append("Tosca Node Type:");
433                         buffer.append(crNode.getType());
434                         buffer.append(System.lineSeparator());
435                         buffer.append("CR Function:");
436                         buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(crNode, "cr_function"));       
437                         buffer.append(System.lineSeparator());
438                         buffer.append("CR Role:");
439                         buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(crNode, "cr_role"));   
440                         buffer.append(System.lineSeparator());
441                         buffer.append("CR Type:");
442                         buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(crNode, "cr_type"));   
443                         buffer.append(System.lineSeparator());
444                         
445                         List<NodeTemplate> vlNodeList = toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(crNode, SdcTypes.VL);
446                                                 
447                         for(NodeTemplate vlNodeTemplate : vlNodeList){
448                                 
449                                 Metadata vlMetadata = vlNodeTemplate.getMetaData();
450                                 
451                                 buffer.append(System.lineSeparator());
452                                 buffer.append("Network CR VL Properties:");
453                                 buffer.append(System.lineSeparator());
454                                 
455                                 buffer.append("Model Name:");
456                         buffer.append(vlMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
457                         buffer.append(System.lineSeparator());
458                         buffer.append("Model UUID:");
459                         buffer.append(vlMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));                
460                         buffer.append(System.lineSeparator());
461                         buffer.append("InvariantUuid:");
462                         buffer.append(vlMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
463                         buffer.append(System.lineSeparator());
464                         buffer.append("Version:");
465                         buffer.append(vlMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));     
466                         buffer.append(System.lineSeparator());
467                         buffer.append("AIC Max Version:");
468                         buffer.append(vlMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES));
469                         buffer.append(System.lineSeparator());
470                         buffer.append("Description:");
471                         buffer.append(vlMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)); 
472                         buffer.append(System.lineSeparator());
473                         buffer.append("Tosca Node Type:");
474                         buffer.append(vlNodeTemplate.getType());            
475                         buffer.append(System.lineSeparator());  
476                                 
477                         }
478                         
479                         List<Group> groupList = toscaResourceStructure.getSdcCsarHelper().getGroupsOfOriginOfNodeTemplateByToscaGroupType(crNode, "org.openecomp.groups.NetworkCollection");    
480                         
481                         if(groupList != null){
482                                 for (Group group : groupList) { 
483                                         Metadata instanceMetadata = group.getMetadata();
484                                         buffer.append(System.lineSeparator());
485                                         buffer.append("Network Instance Group Properties:");
486                                         buffer.append(System.lineSeparator());
487                                         
488                                         buffer.append("Model Name:");
489                                 buffer.append(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
490                                 buffer.append(System.lineSeparator());
491                                 buffer.append("Model UUID:");
492                                 buffer.append(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));          
493                                 buffer.append(System.lineSeparator());
494                                 buffer.append("InvariantUuid:");
495                                 buffer.append(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
496                                 buffer.append(System.lineSeparator());
497                                 buffer.append("Version:");
498                                 buffer.append(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));       
499                                 buffer.append(System.lineSeparator());  
500                                 }
501                         
502                         }
503                         
504                                 buffer.append(System.lineSeparator());
505                                 buffer.append("Network Collection Customization Properties:");
506                                 buffer.append(System.lineSeparator());
507                                 
508                         buffer.append("Model Customization UUID:");
509                         buffer.append(crNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
510                         buffer.append(System.lineSeparator());
511                         buffer.append("Model Instance Name:");
512                         buffer.append(crNode.getName());                
513                         buffer.append(System.lineSeparator());
514                         buffer.append("Network Scope:");
515                         buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(crNode, SdcPropertyNames.PROPERTY_NAME_NETWORKSCOPE));
516                         buffer.append(System.lineSeparator());
517                         buffer.append("Network Role:");
518                         buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(crNode, SdcPropertyNames.PROPERTY_NAME_NETWORKROLE));
519                         buffer.append(System.lineSeparator());
520                         buffer.append("Network Type:");
521                         buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(crNode, SdcPropertyNames.PROPERTY_NAME_NETWORKTYPE));
522                         buffer.append(System.lineSeparator());
523                         buffer.append("Network Technology:");
524                         buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(crNode, SdcPropertyNames.PROPERTY_NAME_NETWORKTECHNOLOGY));
525                         buffer.append(System.lineSeparator());
526         
527                         }
528                 }
529         
530         List<NodeTemplate> allottedResourceList = toscaResourceStructure.getSdcCsarHelper().getAllottedResources();
531         
532                 if(allottedResourceList != null){
533                         
534                         buffer.append(System.lineSeparator());
535                         buffer.append("Allotted Resource Properties:");
536                         buffer.append(System.lineSeparator());
537                 
538                         for(NodeTemplate allottedNode : allottedResourceList){
539                                 
540                                 buffer.append("Model Name:");
541                                 buffer.append(testNull(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
542                                 buffer.append(System.lineSeparator());
543                                 buffer.append("Model Name:");
544                                 buffer.append(testNull(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
545                                 buffer.append(System.lineSeparator()); 
546                                 buffer.append("Model InvariantUuid:");
547                                 buffer.append(testNull(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
548                                 buffer.append(System.lineSeparator());  
549                                 buffer.append("Model Version:");
550                                 buffer.append(testNull(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
551                                 buffer.append(System.lineSeparator()); 
552                                 buffer.append("Model UUID:");
553                                 buffer.append(testNull(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
554                                 buffer.append(System.lineSeparator());
555                                 buffer.append("Model Subcategory:");
556                                 buffer.append(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY));
557                                         buffer.append(System.lineSeparator());
558                                         buffer.append("Model Description:");
559                                         buffer.append(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
560                                         buffer.append(System.lineSeparator());
561                                 
562                                 
563                                 buffer.append("Allotted Resource Customization Properties:");
564                                 buffer.append(System.lineSeparator());
565                         
566                                 buffer.append("Model Cutomization UUID:");
567                                 buffer.append(testNull(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
568                         buffer.append(System.lineSeparator());
569                         buffer.append("NFFunction:");
570                         buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(allottedNode, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION));
571                         buffer.append(System.lineSeparator());
572                         buffer.append("NFCode:");
573                         buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(allottedNode, "nf_naming_code"));
574                         buffer.append(System.lineSeparator());
575                         buffer.append("NFRole:");
576                         buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(allottedNode, SdcPropertyNames.PROPERTY_NAME_NFROLE));
577                         buffer.append(System.lineSeparator());
578                         buffer.append("NFType:");
579                         buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(allottedNode, SdcPropertyNames.PROPERTY_NAME_NFTYPE));
580                         buffer.append(System.lineSeparator());      
581                                 
582                                 
583                         }
584                 }
585                 
586                 
587                 return buffer.toString();
588         }
589         
590         public static String dumpVfModuleMetaDataList(List<IVfModuleData> moduleMetaDataList) {
591                 if (moduleMetaDataList == null ) {
592                         return null;
593                 }
594
595                 StringBuilder buffer = new StringBuilder("VfModuleMetaData List:");
596                 buffer.append(System.lineSeparator());
597
598                 buffer.append("{");
599
600                 for (IVfModuleData moduleMetaData:moduleMetaDataList) {
601                         buffer.append(System.lineSeparator());
602                         buffer.append(testNull(dumpVfModuleMetaData(moduleMetaData)));
603                         buffer.append(System.lineSeparator());
604                         buffer.append(",");
605
606                 }
607                 buffer.replace(buffer.length()-1,buffer.length(), System.lineSeparator());
608                 buffer.append("}");
609                 buffer.append(System.lineSeparator());
610
611                 return buffer.toString();
612         }
613
614         private static String dumpVfModuleMetaData(IVfModuleData moduleMetaData) {
615
616                 if (moduleMetaData == null ) {
617                         return "NULL";
618                 }
619
620                 StringBuilder stringBuilder = new StringBuilder("VfModuleMetaData:");
621                 stringBuilder.append(System.lineSeparator());
622
623                 stringBuilder.append("VfModuleModelName:");
624                 stringBuilder.append(testNull(moduleMetaData.getVfModuleModelName()));
625                 stringBuilder.append(System.lineSeparator());
626
627                 stringBuilder.append("VfModuleModelVersion:");
628                 stringBuilder.append(testNull(moduleMetaData.getVfModuleModelVersion()));
629                 stringBuilder.append(System.lineSeparator());
630
631                 stringBuilder.append("VfModuleModelUUID:");
632                 stringBuilder.append(testNull(moduleMetaData.getVfModuleModelUUID()));
633                 stringBuilder.append(System.lineSeparator());
634
635                 stringBuilder.append("VfModuleModelInvariantUUID:");
636                 stringBuilder.append(testNull(moduleMetaData.getVfModuleModelInvariantUUID()));
637                 stringBuilder.append(System.lineSeparator());
638
639                 stringBuilder.append("VfModuleModelDescription:");
640                 stringBuilder.append(testNull(moduleMetaData.getVfModuleModelDescription()));
641                 stringBuilder.append(System.lineSeparator());
642
643                 stringBuilder.append("Artifacts UUID List:");
644
645                 if (moduleMetaData.getArtifacts() != null) {
646                         stringBuilder.append("{");
647
648                         for (String artifactUUID:moduleMetaData.getArtifacts()) {
649                                 stringBuilder.append(System.lineSeparator());
650                                 stringBuilder.append(testNull(artifactUUID));
651                                 stringBuilder.append(System.lineSeparator());
652                                 stringBuilder.append(",");
653                         }
654                         stringBuilder.replace(stringBuilder.length()-1,stringBuilder.length(), System.lineSeparator());
655                         stringBuilder.append("}");
656                         stringBuilder.append(System.lineSeparator());
657                 } else {
658                         stringBuilder.append("NULL");
659                 }
660
661                 if (moduleMetaData.getProperties() != null) {
662                         Map<String, String> vfModuleMap = moduleMetaData.getProperties();
663                         stringBuilder.append("Properties List:");
664                         stringBuilder.append("{");
665
666                         for (Map.Entry<String, String> entry : vfModuleMap.entrySet()) {
667                                 stringBuilder.append(System.lineSeparator());
668                                 stringBuilder.append("  ").append(entry.getKey()).append(" : ").append(entry.getValue());
669                         }
670                         stringBuilder.replace(stringBuilder.length()-1,stringBuilder.length(), System.lineSeparator());
671                         stringBuilder.append("}");
672                         stringBuilder.append(System.lineSeparator());
673                 } else {
674                         stringBuilder.append("NULL");
675                 }
676
677
678                 stringBuilder.append(System.lineSeparator());
679
680                 stringBuilder.append("isBase:");
681                 stringBuilder.append(moduleMetaData.isBase());
682                 stringBuilder.append(System.lineSeparator());
683
684                 return stringBuilder.toString();
685         }
686
687         private static String testNull(Object object) {
688                 if (object == null) {
689                         return "NULL";
690                 } else if (object instanceof Integer) {
691                         return object.toString();
692                 } else if (object instanceof String) {
693                         return (String)object;
694                 } else {
695                         return "Type not recognized";
696                 }
697         }
698
699         private static String dumpASDCResourcesList(INotificationData asdcNotification) {
700                 if (asdcNotification == null || asdcNotification.getResources() == null) {
701                         return null;
702                 }
703
704                 StringBuilder buffer = new StringBuilder();
705                 buffer.append("{");
706
707                 for (IResourceInstance resourceInstanceElem:asdcNotification.getResources()) {
708                         buffer.append(System.lineSeparator());
709                         buffer.append(testNull(dumpASDCResourceInstance(resourceInstanceElem)));
710                         buffer.append(System.lineSeparator());
711                         buffer.append(",");
712                 }
713                 buffer.replace(buffer.length()-1,buffer.length(), System.lineSeparator());
714                 buffer.append("}");
715                 buffer.append(System.lineSeparator());
716
717                 return buffer.toString();
718
719         }
720
721         private static String dumpASDCResourceInstance(IResourceInstance resourceInstance) {
722
723                 if (resourceInstance == null) {
724                         return null;
725                 }
726
727         return "Resource Instance Info:" + System.lineSeparator() +
728             "ResourceInstanceName:" + testNull(resourceInstance.getResourceInstanceName()) + System.lineSeparator() +
729             "ResourceCustomizationUUID:" + testNull(resourceInstance.getResourceCustomizationUUID()) + System.lineSeparator() +
730             "ResourceInvariantUUID:" + testNull(resourceInstance.getResourceInvariantUUID()) + System.lineSeparator() +
731             "ResourceName:" + testNull(resourceInstance.getResourceName()) + System.lineSeparator() +
732             "ResourceType:" + testNull(resourceInstance.getResourceType()) + System.lineSeparator() +
733             "ResourceUUID:" + testNull(resourceInstance.getResourceUUID()) + System.lineSeparator() +
734             "ResourceVersion:" + testNull(resourceInstance.getResourceVersion()) + System.lineSeparator() +
735             "Category:" + testNull(resourceInstance.getCategory()) + System.lineSeparator() +
736             "SubCategory:" + testNull(resourceInstance.getSubcategory()) + System.lineSeparator() +
737             "Resource Artifacts List:" + System.lineSeparator() + testNull(dumpArtifactInfoList(resourceInstance.getArtifacts())) + System.lineSeparator();
738         }
739
740
741         private static String dumpArtifactInfoList(List<IArtifactInfo> artifactsList) {
742
743                 if (artifactsList == null || artifactsList.isEmpty()) {
744                         return null;
745                 }
746
747                 StringBuilder buffer = new StringBuilder();
748                 buffer.append("{");
749                 for (IArtifactInfo artifactInfoElem:artifactsList) {
750                         buffer.append(System.lineSeparator());
751                         buffer.append(testNull(dumpASDCArtifactInfo(artifactInfoElem)));
752                         buffer.append(System.lineSeparator());
753                         buffer.append(",");
754
755                 }
756                 buffer.replace(buffer.length()-1,buffer.length(), System.lineSeparator());
757                 buffer.append("}");
758                 buffer.append(System.lineSeparator());
759
760                 return buffer.toString();
761         }
762
763         private static String dumpASDCArtifactInfo(IArtifactInfo artifactInfo) {
764
765                 if (artifactInfo == null) {
766                         return null;
767                 }
768
769                 StringBuilder buffer = new StringBuilder("Service Artifacts Info:");
770                 buffer.append(System.lineSeparator());
771
772                 buffer.append("ArtifactName:");
773                 buffer.append(testNull(artifactInfo.getArtifactName()));
774                 buffer.append(System.lineSeparator());
775
776                 buffer.append("ArtifactVersion:");
777                 buffer.append(testNull(artifactInfo.getArtifactVersion()));
778                 buffer.append(System.lineSeparator());
779
780                 buffer.append("ArtifactType:");
781                 buffer.append(testNull(artifactInfo.getArtifactType()));
782                 buffer.append(System.lineSeparator());
783
784                 buffer.append("ArtifactDescription:");
785                 buffer.append(testNull(artifactInfo.getArtifactDescription()));
786                 buffer.append(System.lineSeparator());
787
788                 buffer.append("ArtifactTimeout:");
789                 buffer.append(testNull(artifactInfo.getArtifactTimeout()));
790                 buffer.append(System.lineSeparator());
791
792                 buffer.append("ArtifactURL:");
793                 buffer.append(testNull(artifactInfo.getArtifactURL()));
794                 buffer.append(System.lineSeparator());
795
796                 buffer.append("ArtifactUUID:");
797                 buffer.append(testNull(artifactInfo.getArtifactUUID()));
798                 buffer.append(System.lineSeparator());
799
800                 buffer.append("ArtifactChecksum:");
801                 buffer.append(testNull(artifactInfo.getArtifactChecksum()));
802                 buffer.append(System.lineSeparator());
803
804                 buffer.append("GeneratedArtifact:");
805                 buffer.append("{");
806                 buffer.append(testNull(dumpASDCArtifactInfo(artifactInfo.getGeneratedArtifact())));
807                 buffer.append(System.lineSeparator());
808                 buffer.append("}");
809                 buffer.append(System.lineSeparator());
810
811                 buffer.append("RelatedArtifacts:");
812
813
814                 if (artifactInfo.getRelatedArtifacts() != null) {
815                         buffer.append("{");
816                         buffer.append(System.lineSeparator());
817                         for (IArtifactInfo artifactInfoElem:artifactInfo.getRelatedArtifacts()) {
818
819                                 buffer.append(testNull(dumpASDCArtifactInfo(artifactInfoElem)));
820                                 buffer.append(System.lineSeparator());
821                                 buffer.append(",");
822
823                         }
824                         buffer.replace(buffer.length()-1,buffer.length(), System.lineSeparator());
825                         buffer.append("}");
826                         buffer.append(System.lineSeparator());
827                 } else {
828                         buffer.append("NULL");
829                 }
830
831                 buffer.append(System.lineSeparator());
832
833                 return buffer.toString();
834         }
835 }