various bugfixes for casablanca
[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(System.lineSeparator());
209                 buffer.append("VNF Properties:");
210                 buffer.append(System.lineSeparator());          
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(System.lineSeparator());
267                         buffer.append("VNFC Instance Group Properties:");
268                         buffer.append(System.lineSeparator());
269                                         
270                                 buffer.append("Model Name:");
271                         buffer.append(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
272                         buffer.append(System.lineSeparator());
273                         buffer.append("Version:");
274                         buffer.append(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
275                         buffer.append(System.lineSeparator());
276                         buffer.append("Type:");
277                         buffer.append(vfNodeTemplate.getType());
278                         buffer.append(System.lineSeparator());
279                         buffer.append("InvariantUuid:");
280                         buffer.append(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
281                         buffer.append(System.lineSeparator());                          
282                         }
283                         
284                 }
285                 
286                 
287                 List<Group> vfGroups = toscaResourceStructure.getSdcCsarHelper().getVfModulesByVf(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
288                 
289                 for(Group group : vfGroups){
290                         
291                         Metadata vfMetadata = group.getMetadata();
292                         
293                         buffer.append(System.lineSeparator());
294                         buffer.append(System.lineSeparator());
295                         buffer.append("VF Module Properties:");
296                         buffer.append(System.lineSeparator());
297                         buffer.append("ModelInvariantUuid:");
298                         buffer.append(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata, SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELINVARIANTUUID)));
299                         buffer.append(System.lineSeparator());
300                         buffer.append("ModelName:");
301                         buffer.append(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata, SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELNAME)));
302                         buffer.append(System.lineSeparator()); 
303                         buffer.append("ModelUuid:");
304                         buffer.append(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata, SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID)));
305                         buffer.append(System.lineSeparator());
306                         buffer.append("ModelVersion:");
307                         buffer.append(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata, SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELVERSION)));
308                         buffer.append(System.lineSeparator()); 
309                         buffer.append("Description:");
310                         buffer.append(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata, SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
311                         buffer.append(System.lineSeparator());
312                 }
313                 
314                 List<NodeTemplate> cvfcList = toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(vfNodeTemplate, SdcTypes.CVFC);
315                 
316                 for(NodeTemplate cvfcTemplate : cvfcList) {
317                         
318                         buffer.append(System.lineSeparator());
319                         buffer.append(System.lineSeparator());
320                         buffer.append("CVNFC Properties:");
321                         buffer.append(System.lineSeparator());
322                         buffer.append("ModelCustomizationUuid:");
323                         buffer.append(testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
324                         buffer.append(System.lineSeparator());
325                         buffer.append("ModelInvariantUuid:");
326                         buffer.append(testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
327                         buffer.append(System.lineSeparator());
328                         buffer.append("ModelName:");
329                         buffer.append(testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
330                         buffer.append(System.lineSeparator()); 
331                         buffer.append("ModelUuid:");
332                         buffer.append(testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
333                         buffer.append(System.lineSeparator());
334                         buffer.append("ModelVersion:");
335                         buffer.append(testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
336                         buffer.append(System.lineSeparator()); 
337                         buffer.append("Description:");
338                         buffer.append(testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
339                         buffer.append(System.lineSeparator()); 
340                         
341                         
342                         List<NodeTemplate> vfcList = toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(cvfcTemplate, SdcTypes.VFC);
343                         
344                         for(NodeTemplate vfcTemplate : vfcList) {
345                                 buffer.append(System.lineSeparator());
346                         buffer.append(System.lineSeparator());
347                         buffer.append("VNFC Properties:");
348                         buffer.append(System.lineSeparator());
349                         buffer.append("ModelCustomizationUuid:");
350                         buffer.append(testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
351                         buffer.append(System.lineSeparator());
352                                 buffer.append("ModelInvariantUuid:");
353                         buffer.append(testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
354                         buffer.append(System.lineSeparator());
355                         buffer.append("ModelName:");
356                         buffer.append(testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
357                         buffer.append(System.lineSeparator()); 
358                         buffer.append("ModelUuid:");
359                         buffer.append(testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
360                         buffer.append(System.lineSeparator());
361                         buffer.append("ModelVersion:");
362                         buffer.append(testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
363                         buffer.append(System.lineSeparator()); 
364                         buffer.append("Description:");
365                         buffer.append(testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
366                         buffer.append(System.lineSeparator()); 
367                                 
368                         }               
369                         
370                 }
371         }
372         
373                 
374                 List<NodeTemplate> nodeTemplatesVLList = toscaResourceStructure.getSdcCsarHelper().getServiceVlList();
375                                         
376         if(nodeTemplatesVLList != null){
377                                 
378                 for(NodeTemplate vlNode : nodeTemplatesVLList){
379                         
380                         buffer.append(System.lineSeparator());
381                         buffer.append(System.lineSeparator());
382                         buffer.append("NETWORK Level Properties:");
383                         buffer.append(System.lineSeparator());
384                         buffer.append("Model Name:");
385                         buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
386                         buffer.append(System.lineSeparator()); 
387                         buffer.append("Model InvariantUuid:");
388                         buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
389                         buffer.append(System.lineSeparator());   
390                         buffer.append("Model UUID:");
391                         buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
392                         buffer.append(System.lineSeparator()); 
393                         buffer.append("Model Version:");
394                         buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
395                         buffer.append(System.lineSeparator());   
396                         buffer.append("AIC Max Version:");
397                         buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES)));
398                         buffer.append(System.lineSeparator()); 
399                         buffer.append("AIC Min Version:");
400                         buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MININSTANCES)));
401                         buffer.append(System.lineSeparator());  
402                         buffer.append("Tosca Node Type:");
403                         buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_TYPE)));
404                         buffer.append(System.lineSeparator());  
405                         buffer.append("Description:");
406                         buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
407                         buffer.append(System.lineSeparator());  
408                 
409                 }
410                         
411         }
412         
413                 buffer.append(System.lineSeparator());
414                 buffer.append("Network Collection Resource Properties:");
415                 buffer.append(System.lineSeparator());
416                 
417         List<NodeTemplate> networkCollectionList = toscaResourceStructure.getSdcCsarHelper().getServiceNodeTemplateBySdcType(SdcTypes.CR);
418                 
419                 if (networkCollectionList != null) {
420                         for (NodeTemplate crNode : networkCollectionList) {     
421                                 buffer.append(System.lineSeparator());
422                                 buffer.append("Model Name:");
423                         buffer.append(crNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
424                         buffer.append(System.lineSeparator());
425                         buffer.append("Model UUID:");
426                         buffer.append(crNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));              
427                         buffer.append(System.lineSeparator());
428                         buffer.append("InvariantUuid:");
429                         buffer.append(crNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
430                         buffer.append(System.lineSeparator());
431                         buffer.append("Description:");
432                         buffer.append(crNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
433                         buffer.append(System.lineSeparator());
434                         buffer.append("Version:");
435                         buffer.append(crNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));   
436                         buffer.append(System.lineSeparator());
437                         buffer.append("Tosca Node Type:");
438                         buffer.append(crNode.getType());
439                         buffer.append(System.lineSeparator());
440                         buffer.append("CR Function:");
441                         buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(crNode, "cr_function"));       
442                         buffer.append(System.lineSeparator());
443                         buffer.append("CR Role:");
444                         buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(crNode, "cr_role"));   
445                         buffer.append(System.lineSeparator());
446                         buffer.append("CR Type:");
447                         buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(crNode, "cr_type"));   
448                         buffer.append(System.lineSeparator());
449                         
450                         List<NodeTemplate> vlNodeList = toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(crNode, SdcTypes.VL);
451                                                 
452                         for(NodeTemplate vlNodeTemplate : vlNodeList){
453                                 
454                                 Metadata vlMetadata = vlNodeTemplate.getMetaData();
455                                 
456                                 buffer.append(System.lineSeparator());
457                                 buffer.append(System.lineSeparator());
458                                 buffer.append("Network CR VL Properties:");
459                                 buffer.append(System.lineSeparator());
460                                 
461                                 buffer.append("Model Name:");
462                         buffer.append(vlMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
463                         buffer.append(System.lineSeparator());
464                         buffer.append("Model UUID:");
465                         buffer.append(vlMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));                
466                         buffer.append(System.lineSeparator());
467                         buffer.append("InvariantUuid:");
468                         buffer.append(vlMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
469                         buffer.append(System.lineSeparator());
470                         buffer.append("Version:");
471                         buffer.append(vlMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));     
472                         buffer.append(System.lineSeparator());
473                         buffer.append("AIC Max Version:");
474                         buffer.append(vlMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES));
475                         buffer.append(System.lineSeparator());
476                         buffer.append("Description:");
477                         buffer.append(vlMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)); 
478                         buffer.append(System.lineSeparator());
479                         buffer.append("Tosca Node Type:");
480                         buffer.append(vlNodeTemplate.getType());            
481                         buffer.append(System.lineSeparator());  
482                                 
483                         }
484                         
485                         List<Group> groupList = toscaResourceStructure.getSdcCsarHelper().getGroupsOfOriginOfNodeTemplateByToscaGroupType(crNode, "org.openecomp.groups.NetworkCollection");    
486                         
487                         if(groupList != null){
488                                 for (Group group : groupList) { 
489                                         Metadata instanceMetadata = group.getMetadata();
490                                         buffer.append(System.lineSeparator());
491                                         buffer.append(System.lineSeparator());
492                                         buffer.append("Network Instance Group Properties:");
493                                         buffer.append(System.lineSeparator());
494                                         
495                                         buffer.append("Model Name:");
496                                 buffer.append(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
497                                 buffer.append(System.lineSeparator());
498                                 buffer.append("Model UUID:");
499                                 buffer.append(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));          
500                                 buffer.append(System.lineSeparator());
501                                 buffer.append("InvariantUuid:");
502                                 buffer.append(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
503                                 buffer.append(System.lineSeparator());
504                                 buffer.append("Version:");
505                                 buffer.append(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));       
506                                 buffer.append(System.lineSeparator());  
507                                 }
508                         
509                         }
510                         
511                                 buffer.append(System.lineSeparator());
512                                 buffer.append("Network Collection Customization Properties:");
513                                 buffer.append(System.lineSeparator());
514                                 
515                         buffer.append("Model Customization UUID:");
516                         buffer.append(crNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
517                         buffer.append(System.lineSeparator());
518                         buffer.append("Model Instance Name:");
519                         buffer.append(crNode.getName());                
520                         buffer.append(System.lineSeparator());
521                         buffer.append("Network Scope:");
522                         buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(crNode, SdcPropertyNames.PROPERTY_NAME_NETWORKSCOPE));
523                         buffer.append(System.lineSeparator());
524                         buffer.append("Network Role:");
525                         buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(crNode, SdcPropertyNames.PROPERTY_NAME_NETWORKROLE));
526                         buffer.append(System.lineSeparator());
527                         buffer.append("Network Type:");
528                         buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(crNode, SdcPropertyNames.PROPERTY_NAME_NETWORKTYPE));
529                         buffer.append(System.lineSeparator());
530                         buffer.append("Network Technology:");
531                         buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(crNode, SdcPropertyNames.PROPERTY_NAME_NETWORKTECHNOLOGY));
532                         buffer.append(System.lineSeparator());
533         
534                         }
535                 }
536         
537         List<NodeTemplate> allottedResourceList = toscaResourceStructure.getSdcCsarHelper().getAllottedResources();
538         
539                 if(allottedResourceList != null){
540                         
541                         buffer.append(System.lineSeparator());
542                         buffer.append("Allotted Resource Properties:");
543                         buffer.append(System.lineSeparator());
544                 
545                         for(NodeTemplate allottedNode : allottedResourceList){
546                                 
547                                 buffer.append("Model Name:");
548                                 buffer.append(testNull(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
549                                 buffer.append(System.lineSeparator());
550                                 buffer.append("Model Name:");
551                                 buffer.append(testNull(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
552                                 buffer.append(System.lineSeparator()); 
553                                 buffer.append("Model InvariantUuid:");
554                                 buffer.append(testNull(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
555                                 buffer.append(System.lineSeparator());  
556                                 buffer.append("Model Version:");
557                                 buffer.append(testNull(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
558                                 buffer.append(System.lineSeparator()); 
559                                 buffer.append("Model UUID:");
560                                 buffer.append(testNull(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
561                                 buffer.append(System.lineSeparator());
562                                 buffer.append("Model Subcategory:");
563                                 buffer.append(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY));
564                                         buffer.append(System.lineSeparator());
565                                         buffer.append("Model Description:");
566                                         buffer.append(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
567                                         buffer.append(System.lineSeparator());
568                                 
569                                 
570                                 buffer.append("Allotted Resource Customization Properties:");
571                                 buffer.append(System.lineSeparator());
572                         
573                                 buffer.append("Model Cutomization UUID:");
574                                 buffer.append(testNull(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
575                         buffer.append(System.lineSeparator());
576                         buffer.append("NFFunction:");
577                         buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(allottedNode, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION));
578                         buffer.append(System.lineSeparator());
579                         buffer.append("NFCode:");
580                         buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(allottedNode, "nf_naming_code"));
581                         buffer.append(System.lineSeparator());
582                         buffer.append("NFRole:");
583                         buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(allottedNode, SdcPropertyNames.PROPERTY_NAME_NFROLE));
584                         buffer.append(System.lineSeparator());
585                         buffer.append("NFType:");
586                         buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(allottedNode, SdcPropertyNames.PROPERTY_NAME_NFTYPE));
587                         buffer.append(System.lineSeparator());      
588                                 
589                                 
590                         }
591                 }
592                 
593                 
594                 return buffer.toString();
595         }
596         
597         public static String dumpVfModuleMetaDataList(List<IVfModuleData> moduleMetaDataList) {
598                 if (moduleMetaDataList == null ) {
599                         return null;
600                 }
601
602                 StringBuilder buffer = new StringBuilder("VfModuleMetaData List:");
603                 buffer.append(System.lineSeparator());
604
605                 buffer.append("{");
606
607                 for (IVfModuleData moduleMetaData:moduleMetaDataList) {
608                         buffer.append(System.lineSeparator());
609                         buffer.append(testNull(dumpVfModuleMetaData(moduleMetaData)));
610                         buffer.append(System.lineSeparator());
611                         buffer.append(",");
612
613                 }
614                 buffer.replace(buffer.length()-1,buffer.length(), System.lineSeparator());
615                 buffer.append("}");
616                 buffer.append(System.lineSeparator());
617
618                 return buffer.toString();
619         }
620
621         private static String dumpVfModuleMetaData(IVfModuleData moduleMetaData) {
622
623                 if (moduleMetaData == null ) {
624                         return "NULL";
625                 }
626
627                 StringBuilder stringBuilder = new StringBuilder("VfModuleMetaData:");
628                 stringBuilder.append(System.lineSeparator());
629
630                 stringBuilder.append("VfModuleModelName:");
631                 stringBuilder.append(testNull(moduleMetaData.getVfModuleModelName()));
632                 stringBuilder.append(System.lineSeparator());
633
634                 stringBuilder.append("VfModuleModelVersion:");
635                 stringBuilder.append(testNull(moduleMetaData.getVfModuleModelVersion()));
636                 stringBuilder.append(System.lineSeparator());
637
638                 stringBuilder.append("VfModuleModelUUID:");
639                 stringBuilder.append(testNull(moduleMetaData.getVfModuleModelUUID()));
640                 stringBuilder.append(System.lineSeparator());
641
642                 stringBuilder.append("VfModuleModelInvariantUUID:");
643                 stringBuilder.append(testNull(moduleMetaData.getVfModuleModelInvariantUUID()));
644                 stringBuilder.append(System.lineSeparator());
645
646                 stringBuilder.append("VfModuleModelDescription:");
647                 stringBuilder.append(testNull(moduleMetaData.getVfModuleModelDescription()));
648                 stringBuilder.append(System.lineSeparator());
649
650                 stringBuilder.append("Artifacts UUID List:");
651
652                 if (moduleMetaData.getArtifacts() != null) {
653                         stringBuilder.append("{");
654
655                         for (String artifactUUID:moduleMetaData.getArtifacts()) {
656                                 stringBuilder.append(System.lineSeparator());
657                                 stringBuilder.append(testNull(artifactUUID));
658                                 stringBuilder.append(System.lineSeparator());
659                                 stringBuilder.append(",");
660                         }
661                         stringBuilder.replace(stringBuilder.length()-1,stringBuilder.length(), System.lineSeparator());
662                         stringBuilder.append("}");
663                         stringBuilder.append(System.lineSeparator());
664                 } else {
665                         stringBuilder.append("NULL");
666                 }
667
668                 if (moduleMetaData.getProperties() != null) {
669                         Map<String, String> vfModuleMap = moduleMetaData.getProperties();
670                         stringBuilder.append("Properties List:");
671                         stringBuilder.append("{");
672
673                         for (Map.Entry<String, String> entry : vfModuleMap.entrySet()) {
674                                 stringBuilder.append(System.lineSeparator());
675                                 stringBuilder.append("  ").append(entry.getKey()).append(" : ").append(entry.getValue());
676                         }
677                         stringBuilder.replace(stringBuilder.length()-1,stringBuilder.length(), System.lineSeparator());
678                         stringBuilder.append("}");
679                         stringBuilder.append(System.lineSeparator());
680                 } else {
681                         stringBuilder.append("NULL");
682                 }
683
684
685                 stringBuilder.append(System.lineSeparator());
686
687                 stringBuilder.append("isBase:");
688                 stringBuilder.append(moduleMetaData.isBase());
689                 stringBuilder.append(System.lineSeparator());
690
691                 return stringBuilder.toString();
692         }
693
694         private static String testNull(Object object) {
695                 if (object == null) {
696                         return "NULL";
697                 } else if (object instanceof Integer) {
698                         return object.toString();
699                 } else if (object instanceof String) {
700                         return (String)object;
701                 } else {
702                         return "Type not recognized";
703                 }
704         }
705
706         private static String dumpASDCResourcesList(INotificationData asdcNotification) {
707                 if (asdcNotification == null || asdcNotification.getResources() == null) {
708                         return null;
709                 }
710
711                 StringBuilder buffer = new StringBuilder();
712                 buffer.append("{");
713
714                 for (IResourceInstance resourceInstanceElem:asdcNotification.getResources()) {
715                         buffer.append(System.lineSeparator());
716                         buffer.append(testNull(dumpASDCResourceInstance(resourceInstanceElem)));
717                         buffer.append(System.lineSeparator());
718                         buffer.append(",");
719                 }
720                 buffer.replace(buffer.length()-1,buffer.length(), System.lineSeparator());
721                 buffer.append("}");
722                 buffer.append(System.lineSeparator());
723
724                 return buffer.toString();
725
726         }
727
728         private static String dumpASDCResourceInstance(IResourceInstance resourceInstance) {
729
730                 if (resourceInstance == null) {
731                         return null;
732                 }
733
734         return "Resource Instance Info:" + System.lineSeparator() +
735             "ResourceInstanceName:" + testNull(resourceInstance.getResourceInstanceName()) + System.lineSeparator() +
736             "ResourceCustomizationUUID:" + testNull(resourceInstance.getResourceCustomizationUUID()) + System.lineSeparator() +
737             "ResourceInvariantUUID:" + testNull(resourceInstance.getResourceInvariantUUID()) + System.lineSeparator() +
738             "ResourceName:" + testNull(resourceInstance.getResourceName()) + System.lineSeparator() +
739             "ResourceType:" + testNull(resourceInstance.getResourceType()) + System.lineSeparator() +
740             "ResourceUUID:" + testNull(resourceInstance.getResourceUUID()) + System.lineSeparator() +
741             "ResourceVersion:" + testNull(resourceInstance.getResourceVersion()) + System.lineSeparator() +
742             "Category:" + testNull(resourceInstance.getCategory()) + System.lineSeparator() +
743             "SubCategory:" + testNull(resourceInstance.getSubcategory()) + System.lineSeparator() +
744             "Resource Artifacts List:" + System.lineSeparator() + testNull(dumpArtifactInfoList(resourceInstance.getArtifacts())) + System.lineSeparator();
745         }
746
747
748         private static String dumpArtifactInfoList(List<IArtifactInfo> artifactsList) {
749
750                 if (artifactsList == null || artifactsList.isEmpty()) {
751                         return null;
752                 }
753
754                 StringBuilder buffer = new StringBuilder();
755                 buffer.append("{");
756                 for (IArtifactInfo artifactInfoElem:artifactsList) {
757                         buffer.append(System.lineSeparator());
758                         buffer.append(testNull(dumpASDCArtifactInfo(artifactInfoElem)));
759                         buffer.append(System.lineSeparator());
760                         buffer.append(",");
761
762                 }
763                 buffer.replace(buffer.length()-1,buffer.length(), System.lineSeparator());
764                 buffer.append("}");
765                 buffer.append(System.lineSeparator());
766
767                 return buffer.toString();
768         }
769
770         private static String dumpASDCArtifactInfo(IArtifactInfo artifactInfo) {
771
772                 if (artifactInfo == null) {
773                         return null;
774                 }
775
776                 StringBuilder buffer = new StringBuilder("Service Artifacts Info:");
777                 buffer.append(System.lineSeparator());
778
779                 buffer.append("ArtifactName:");
780                 buffer.append(testNull(artifactInfo.getArtifactName()));
781                 buffer.append(System.lineSeparator());
782
783                 buffer.append("ArtifactVersion:");
784                 buffer.append(testNull(artifactInfo.getArtifactVersion()));
785                 buffer.append(System.lineSeparator());
786
787                 buffer.append("ArtifactType:");
788                 buffer.append(testNull(artifactInfo.getArtifactType()));
789                 buffer.append(System.lineSeparator());
790
791                 buffer.append("ArtifactDescription:");
792                 buffer.append(testNull(artifactInfo.getArtifactDescription()));
793                 buffer.append(System.lineSeparator());
794
795                 buffer.append("ArtifactTimeout:");
796                 buffer.append(testNull(artifactInfo.getArtifactTimeout()));
797                 buffer.append(System.lineSeparator());
798
799                 buffer.append("ArtifactURL:");
800                 buffer.append(testNull(artifactInfo.getArtifactURL()));
801                 buffer.append(System.lineSeparator());
802
803                 buffer.append("ArtifactUUID:");
804                 buffer.append(testNull(artifactInfo.getArtifactUUID()));
805                 buffer.append(System.lineSeparator());
806
807                 buffer.append("ArtifactChecksum:");
808                 buffer.append(testNull(artifactInfo.getArtifactChecksum()));
809                 buffer.append(System.lineSeparator());
810
811                 buffer.append("GeneratedArtifact:");
812                 buffer.append("{");
813                 buffer.append(testNull(dumpASDCArtifactInfo(artifactInfo.getGeneratedArtifact())));
814                 buffer.append(System.lineSeparator());
815                 buffer.append("}");
816                 buffer.append(System.lineSeparator());
817
818                 buffer.append("RelatedArtifacts:");
819
820
821                 if (artifactInfo.getRelatedArtifacts() != null) {
822                         buffer.append("{");
823                         buffer.append(System.lineSeparator());
824                         for (IArtifactInfo artifactInfoElem:artifactInfo.getRelatedArtifacts()) {
825
826                                 buffer.append(testNull(dumpASDCArtifactInfo(artifactInfoElem)));
827                                 buffer.append(System.lineSeparator());
828                                 buffer.append(",");
829
830                         }
831                         buffer.replace(buffer.length()-1,buffer.length(), System.lineSeparator());
832                         buffer.append("}");
833                         buffer.append(System.lineSeparator());
834                 } else {
835                         buffer.append("NULL");
836                 }
837
838                 buffer.append(System.lineSeparator());
839
840                 return buffer.toString();
841         }
842 }