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