Fix Tosca convert logic of gvnfm
[vfc/gvnfm/vnflcm.git] / lcm / lcm / pub / utils / toscautil_new.py
1 # Copyright 2017 ZTE Corporation.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #         http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 import json
16
17 def safe_get(key_val, key):
18     return key_val[key] if key in key_val else ""
19
20
21 def find_node_name(node_id, node_list):
22     for node in node_list:
23         if node['id'] == node_id:
24             return node['template_name']
25     raise Exception('can not find node(%s).' % node_id)
26
27
28 def find_node_type(node_id, node_list):
29     for node in node_list:
30         if node['id'] == node_id:
31             return node['type_name']
32     raise Exception('can not find node(%s).' % node_id)
33
34
35 def find_related_node(node_id, src_json_model, requirement_name):
36     related_nodes = []
37     for model_tpl in safe_get(src_json_model, "node_templates"):
38         for rt in safe_get(model_tpl, 'requirement_templates'):
39             if safe_get(rt, 'name') == requirement_name and \
40                 safe_get(rt, 'target_node_template_name') == node_id:
41                 related_nodes.append(model_tpl['name'])
42     return related_nodes
43
44
45 def convert_props(src_node, dest_node):
46     if 'properties' in src_node and src_node['properties']:
47         for prop_name, prop_info in src_node['properties'].items():
48             if 'value' in prop_info:
49                 dest_node['properties'][prop_name] = prop_info['value']   
50
51
52 def convert_metadata(src_json):
53     return src_json['metadata'] if 'metadata' in src_json else {}
54
55 def convert_factor_unit(value):
56     if isinstance(value, (str, unicode)):
57         return value
58     return "%s %s" % (value["factor"], value["unit"])
59
60 def convert_inputs(src_json):
61     inputs = {}
62     if 'inputs' in src_json:
63         src_inputs = src_json['inputs']
64         for param_name, param_info in src_inputs.items():
65             input_param = {}
66             if 'type_name' in param_info:
67                 input_param['type'] = param_info['type_name']
68             if 'description' in param_info:
69                 input_param['description'] = param_info['description']
70             if 'value' in param_info:
71                 input_param['value'] = param_info['value']
72             inputs[param_name] = input_param
73     return inputs
74
75
76 def convert_vnf_node(src_node, src_json_model):
77     vnf_node = {'type': src_node['type_name'], 'vnf_id': src_node['template_name'],
78         'description': '', 'properties': {}, 'dependencies': [], 'networks': []}
79     convert_props(src_node, vnf_node)
80     for model_tpl in safe_get(src_json_model, "node_templates"):
81         if model_tpl['name'] != vnf_node['vnf_id']:
82             continue
83         vnf_node['dependencies'] = [{
84             'key_name': requirement['name'],
85             'vl_id': requirement['target_node_template_name']} for \
86             requirement in safe_get(model_tpl, 'requirement_templates') if \
87             safe_get(requirement, 'target_capability_name') == 'virtual_linkable']
88         vnf_node['networks'] = [requirement['target_node_template_name'] for \
89             requirement in safe_get(model_tpl, 'requirement_templates') if \
90             safe_get(requirement, 'name') == 'dependency']
91     return vnf_node
92
93
94 def convert_pnf_node(src_node, src_json_model):
95     pnf_node = {'pnf_id': src_node['template_name'], 'description': '', 'properties': {}}
96     convert_props(src_node, pnf_node)
97     pnf_node['cps'] = find_related_node(src_node['id'], src_json_model, 'virtualbinding')
98     return pnf_node
99
100
101 def convert_vl_node(src_node, src_node_list):
102     vl_node = {'vl_id': src_node['template_name'], 'description': '', 'properties': {}}
103     convert_props(src_node, vl_node)
104     vl_node['route_id'] = ''
105     for relation in safe_get(src_node, 'relationships'):
106         if safe_get(relation, 'type_name').endswith('.VirtualLinksTo'):
107             vl_node['route_id'] = find_node_name(relation['target_node_id'], src_node_list)
108             break
109     vl_node['route_external'] = (src_node['type_name'].find('.RouteExternalVL') > 0)
110     return vl_node
111
112
113 def convert_cp_node(src_node, src_node_list, model_type='NSD'):
114     cp_node = {'cp_id': src_node['template_name'], 'description': '', 'properties': {}}
115     convert_props(src_node, cp_node)
116     src_relationships = src_node['relationships']
117     for relation in src_relationships:
118         if safe_get(relation, 'name') in ('virtualLink', 'virtual_link'):
119             cp_node['vl_id'] = find_node_name(relation['target_node_id'], src_node_list)
120         elif safe_get(relation, 'name') in ('virtualbinding', 'virtual_binding'):
121             node_key = 'pnf_id' if model_type == 'NSD' else 'vdu_id'
122             cp_node[node_key] = find_node_name(relation['target_node_id'], src_node_list)
123     return cp_node
124
125
126 def convert_router_node(src_node, src_node_list):
127     router_node = {'router_id': src_node['template_name'], 'description': '', 'properties': {}}
128     convert_props(src_node, router_node)
129     for relation in src_node['relationships']:
130         if safe_get(relation, 'name') != 'external_virtual_link':
131             continue
132         router_node['external_vl_id'] = find_node_name(relation['target_node_id'], src_node_list)
133         router_node['external_ip_addresses'] = []
134         if 'properties' not in relation:
135             continue
136         for prop_name, prop_info in relation['properties'].items():
137             if prop_name == 'router_ip_address':
138                 router_node['external_ip_addresses'].append(prop_info['value'])
139         break
140     return router_node
141
142
143 def convert_fp_node(src_node, src_node_list, src_json_model):
144     fp_node = {'fp_id': src_node['template_name'], 'description': '', 
145         'properties': {}, 'forwarder_list': []}
146     convert_props(src_node, fp_node)
147     for relation in safe_get(src_node, 'relationships'):
148         if safe_get(relation, 'name') != 'forwarder':
149             continue
150         forwarder_point = {'type': 'vnf'}
151         target_node_type = find_node_type(relation['target_node_id'], src_node_list).upper()
152         if target_node_type.find('.CP.') >= 0 or target_node_type.endswith('.CP'):
153             forwarder_point['type'] = 'cp'
154         forwarder_point['node_name'] = find_node_name(relation['target_node_id'], src_node_list)
155         forwarder_point['capability'] = ''
156         if forwarder_point['type'] == 'vnf':
157             for node_tpl in src_json_model["node_templates"]:
158                 if fp_node['fp_id'] != node_tpl["name"]:
159                     continue
160                 for r_tpl in safe_get(node_tpl, "requirement_templates"):
161                     if safe_get(r_tpl, "target_node_template_name") != forwarder_point['node_name']:
162                         continue
163                     forwarder_point['capability'] = safe_get(r_tpl, "target_capability_name")
164                     break
165                 break
166         fp_node['forwarder_list'].append(forwarder_point)
167     return fp_node
168
169
170 def convert_vnffg_group(src_group, src_group_list, src_node_list):
171     vnffg = {'vnffg_id': src_group['template_name'], 'description': '', 
172         'properties': {}, 'members': []}
173     convert_props(src_group, vnffg)
174     for member_node_id in src_group['member_node_ids']:
175         vnffg['members'].append(find_node_name(member_node_id, src_node_list))
176     return vnffg
177
178
179 def convert_imagefile_node(src_node, src_node_list):
180     image_node = {'image_file_id': src_node['template_name'], 'description': '', 
181         'properties': {}}
182     convert_props(src_node, image_node)
183     return image_node
184
185
186 def convert_localstorage_node(src_node, src_node_list):
187     localstorage_node = {'local_storage_id': src_node['template_name'], 'description': '', 
188         'properties': {}}
189     convert_props(src_node, localstorage_node)
190     return localstorage_node
191
192 def convert_volumestorage_node(src_node, src_node_list):
193     volumestorage_node = {
194         'volume_storage_id': src_node['id'], 
195         'description': "", 
196         'properties': {}}
197     convert_props(src_node, volumestorage_node)
198     volumestorage_node["properties"]["size"] = convert_factor_unit(
199         volumestorage_node["properties"]["size_of_storage"])
200     return volumestorage_node
201
202 def convert_vdu_node(src_node, src_node_list, src_json_model):
203     vdu_node = {'vdu_id': src_node['template_name'], 'description': '', 'properties': {},
204         'image_file': '', 'local_storages': [], 'dependencies': [], 'nfv_compute': {},
205         'vls': [], 'artifacts': [], 'volume_storages': []}
206     convert_props(src_node, vdu_node)
207
208     for relation in src_node.get('relationships', ''):
209         r_id, r_name = safe_get(relation, 'target_node_id'), safe_get(relation, 'name')
210         if r_name == 'guest_os':
211             vdu_node['image_file'] = find_node_name(r_id, src_node_list)
212         elif r_name == 'local_storage':
213             vdu_node['local_storages'].append(find_node_name(r_id, src_node_list))
214         elif r_name == 'virtual_storage':
215             vdu_node['volume_storages'].append(r_id)
216         elif r_name.endswith('.AttachesTo'):
217             nt = find_node_type(r_id, src_node_list)
218             if nt.endswith('.BlockStorage.Local') or nt.endswith('.LocalStorage'):
219                 vdu_node['local_storages'].append(find_node_name(r_id, src_node_list))
220
221     for capability in src_node['capabilities']:
222         if not capability['type_name'].endswith('.VirtualCompute'):
223             continue
224         vdu_node['nfv_compute']['flavor_extra_specs'] = {}
225         for prop_name, prop_info in capability['properties'].items():
226             if prop_name == "virtual_cpu":
227                 vdu_node['nfv_compute']['num_cpus'] = prop_info["value"]["num_virtual_cpu"]
228                 vdu_node['nfv_compute']['cpu_frequency'] = convert_factor_unit(
229                     prop_info["value"]["virtual_cpu_clock"])               
230             elif prop_name == "virtual_memory":
231                 vdu_node['nfv_compute']['mem_size'] = convert_factor_unit(
232                     prop_info["value"]["virtual_mem_size"])
233             elif prop_name == "requested_additional_capabilities":
234                 for key, val in prop_info["value"].items():
235                     vdu_node['nfv_compute']['flavor_extra_specs'].update(
236                         val["target_performance_parameters"])
237
238     vdu_node['cps'] = find_related_node(src_node['id'], src_json_model, 'virtualbinding')
239
240     for cp_node in vdu_node['cps']:
241         for src_cp_node in src_node_list:
242             if src_cp_node['template_name'] != cp_node:
243                 continue
244             for relation in safe_get(src_cp_node, 'relationships'):
245                 if relation['name'] != 'virtualLink':
246                     continue
247                 vl_node_name = find_node_name(relation['target_node_id'], src_node_list)
248                 if vl_node_name not in vdu_node['vls']:
249                     vdu_node['vls'].append(vl_node_name)
250
251     for item in safe_get(src_node, 'artifacts'):
252         artifact = {'artifact_name': item['name'], 'type': item['type_name'], 
253             'file': item['source_path'], 'properties': {}}
254         convert_props(item, artifact)
255         for key in artifact['properties']:
256             if 'factor' in artifact['properties'][key] and 'unit' in artifact['properties'][key]:
257                 artifact['properties'][key] = convert_factor_unit(artifact['properties'][key])
258         vdu_node['artifacts'].append(artifact)
259         if artifact["type"].endswith(".SwImage"):
260             vdu_node['image_file'] = artifact["artifact_name"]
261     return vdu_node
262
263
264 def convert_exposed_node(src_json, src_nodes, exposed):
265     for item in safe_get(safe_get(src_json, 'substitution'), 'requirements'):
266         exposed['external_cps'].append({'key_name': item['mapped_name'],
267             "cp_id": find_node_name(item['node_id'], src_nodes)})
268     for item in safe_get(safe_get(src_json, 'substitution'), 'capabilities'):
269         exposed['forward_cps'].append({'key_name': item['mapped_name'],
270             "cp_id": find_node_name(item['node_id'], src_nodes)})
271
272
273 def convert_vnffgs(src_json_inst, src_nodes):
274     vnffgs = []
275     src_groups = safe_get(src_json_inst, 'groups')
276     for group in src_groups:
277         type_name = group['type_name'].upper()
278         if type_name.find('.VNFFG.') >= 0 or type_name.endswith('.VNFFG'):
279             vnffgs.append(convert_vnffg_group(group, src_groups, src_nodes))
280     return vnffgs
281
282 def merge_imagefile_node(img_nodes, vdu_nodes):
283     for vdu_node in vdu_nodes:
284         for artifact in vdu_node.get("artifacts", []):
285             if not artifact["type"].endswith(".SwImage"):
286                 continue
287             imgids = [img["image_file_id"] for img in img_nodes]
288             if artifact["artifact_name"] in imgids:
289                 continue
290             img_nodes.append({
291                 "image_file_id": artifact["artifact_name"],
292                 "description": "",
293                 "properties": artifact["properties"]
294             })
295
296 def convert_common(src_json, target_json):
297     if isinstance(src_json, (unicode, str)):
298         src_json_dict = json.loads(src_json)
299     else:
300         src_json_dict = src_json
301     src_json_inst = src_json_dict["instance"]
302     src_json_model = src_json_dict["model"] if "model" in src_json_dict else {}
303
304     target_json['metadata'] = convert_metadata(src_json_inst)
305     target_json['inputs'] = convert_inputs(src_json_inst)
306     target_json['vls'] = []
307     target_json['cps'] = []
308     target_json['routers'] = []
309
310     return src_json_inst, src_json_model
311
312
313 def convert_nsd_model(src_json):
314     target_json = {'vnfs': [], 'pnfs': [], 'fps': []}
315     src_json_inst, src_json_model = convert_common(src_json, target_json)
316    
317     src_nodes = src_json_inst['nodes']
318     for node in src_nodes:
319         type_name = node['type_name']
320         if type_name.find('.VNF.') > 0 or type_name.endswith('.VNF'):
321             target_json['vnfs'].append(convert_vnf_node(node, src_json_model))
322         elif type_name.find('.PNF.') > 0 or type_name.endswith('.PNF'):
323             target_json['pnfs'].append(convert_pnf_node(node, src_json_model))
324         elif type_name.find('.VL.') > 0 or type_name.endswith('.VL') \
325                 or node['type_name'].find('.RouteExternalVL') > 0:
326             target_json['vls'].append(convert_vl_node(node, src_nodes))
327         elif type_name.find('.CP.') > 0 or type_name.endswith('.CP'):
328             target_json['cps'].append(convert_cp_node(node, src_nodes))
329         elif type_name.find('.FP.') > 0 or type_name.endswith('.FP'):
330             target_json['fps'].append(convert_fp_node(node, src_nodes, src_json_model))
331         elif type_name.endswith('.Router'):
332             target_json['routers'].append(convert_router_node(node, src_nodes))
333
334     target_json['vnffgs'] = convert_vnffgs(src_json_inst, src_nodes)
335
336     target_json['ns_exposed'] = {'external_cps': [], 'forward_cps': []}
337     convert_exposed_node(src_json_inst, src_nodes, target_json['ns_exposed'])
338     return json.dumps(target_json)
339
340
341 def convert_vnfd_model(src_json):
342     target_json = {'image_files': [], 'local_storages': [], 'vdus': [], 'volume_storages': []}
343     src_json_inst, src_json_model = convert_common(src_json, target_json)
344
345     src_nodes = src_json_inst['nodes']
346     for node in src_nodes:
347         type_name = node['type_name']
348         if type_name.endswith('.ImageFile'):
349             target_json['image_files'].append(convert_imagefile_node(node, src_nodes))
350         elif type_name.endswith('.BlockStorage.Local') or type_name.endswith('.LocalStorage'):
351             target_json['local_storages'].append(convert_localstorage_node(node, src_nodes))
352         elif type_name.endswith('VDU.VirtualStorage'):
353             target_json['volume_storages'].append(convert_volumestorage_node(node, src_nodes))
354         elif type_name.endswith('VDU.Compute'):
355             target_json['vdus'].append(convert_vdu_node(node, src_nodes, src_json_model))
356         elif type_name.find('.VL.') > 0 or type_name.endswith('.VL') \
357                 or type_name.endswith('.VnfVirtualLinkDesc') \
358                 or type_name.endswith('.RouteExternalVL'):
359             target_json['vls'].append(convert_vl_node(node, src_nodes))
360         elif type_name.find('.CP.') > 0 or type_name.endswith('.CP') or type_name.endswith(".VduCpd"):
361             target_json['cps'].append(convert_cp_node(node, src_nodes, 'VNFD'))
362         elif type_name.endswith('.Router'):
363             target_json['routers'].append(convert_router_node(node, src_nodes))
364     
365     target_json['vnf_exposed'] = {'external_cps': [], 'forward_cps': []}
366     convert_exposed_node(src_json_inst, src_nodes, target_json['vnf_exposed'])
367     merge_imagefile_node(target_json['image_files'], target_json['vdus'])
368     return json.dumps(target_json)
369
370 if __name__ == '__main__':
371     src_json = json.dumps({
372         "instance": {
373             "metadata": {
374                 "vnfSoftwareVersion": "1.0.0",
375                 "vnfProductName": "zte",
376                 "localizationLanguage": [
377                     "english",
378                     "chinese"
379                 ],
380                 "vnfProvider": "zte",
381                 "vnfmInfo": "zte",
382                 "defaultLocalizationLanguage": "english",
383                 "vnfdId": "zte-hss-1.0",
384                 "vnfProductInfoDescription": "hss",
385                 "vnfdVersion": "1.0.0",
386                 "vnfProductInfoName": "hss"
387             },
388             "nodes": [
389                 {
390                     "id": "vNAT_Storage_6wdgwzedlb6sq18uzrr41sof7",
391                     "type_name": "tosca.nodes.nfv.VDU.VirtualStorage",
392                     "template_name": "vNAT_Storage",
393                     "properties": {
394                         "size_of_storage": {
395                             "type_name": "scalar-unit.size",
396                             "value": {
397                                 "value": 10000000000,
398                                 "factor": 10,
399                                 "unit": "GB",
400                                 "unit_size": 1000000000
401                             }
402                         },
403                         "type_of_storage": {
404                             "type_name": "string",
405                             "value": "volume"
406                         },
407                         "rdma_enabled": {
408                             "type_name": "boolean",
409                             "value": False
410                         }
411                     },
412                     "interfaces": [
413                         {
414                             "name": "Standard",
415                             "description": "This lifecycle interface defines the essential, normative operations that TOSCA nodes may support.",
416                             "type_name": "tosca.interfaces.node.lifecycle.Standard",
417                             "operations": [
418                                 {
419                                     "name": "create",
420                                     "description": "Standard lifecycle create operation."
421                                 },
422                                 {
423                                     "name": "stop",
424                                     "description": "Standard lifecycle stop operation."
425                                 },
426                                 {
427                                     "name": "start",
428                                     "description": "Standard lifecycle start operation."
429                                 },
430                                 {
431                                     "name": "delete",
432                                     "description": "Standard lifecycle delete operation."
433                                 },
434                                 {
435                                     "name": "configure",
436                                     "description": "Standard lifecycle configure operation."
437                                 }
438                             ]
439                         }
440                     ],
441                     "capabilities": [
442                         {
443                             "name": "feature",
444                             "type_name": "tosca.capabilities.Node"
445                         },
446                         {
447                             "name": "virtual_storage",
448                             "type_name": "tosca.capabilities.nfv.VirtualStorage"
449                         }
450                     ]
451                 },
452                 {
453                     "id": "sriov_link_2610d7gund4e645wo39dvp238",
454                     "type_name": "tosca.nodes.nfv.VnfVirtualLinkDesc",
455                     "template_name": "sriov_link",
456                     "properties": {
457                         "vl_flavours": {
458                             "type_name": "map",
459                             "value": {
460                                 "vl_id": "aaaa"
461                             }
462                         },
463                         "connectivity_type": {
464                             "type_name": "tosca.datatypes.nfv.ConnectivityType",
465                             "value": {
466                                 "layer_protocol": "ipv4",
467                                 "flow_pattern": "flat"
468                             }
469                         },
470                         "description": {
471                             "type_name": "string",
472                             "value": "sriov_link"
473                         },
474                         "test_access": {
475                             "type_name": "list",
476                             "value": [
477                                 "test"
478                             ]
479                         }
480                     },
481                     "interfaces": [
482                         {
483                             "name": "Standard",
484                             "description": "This lifecycle interface defines the essential, normative operations that TOSCA nodes may support.",
485                             "type_name": "tosca.interfaces.node.lifecycle.Standard",
486                             "operations": [
487                                 {
488                                     "name": "create",
489                                     "description": "Standard lifecycle create operation."
490                                 },
491                                 {
492                                     "name": "stop",
493                                     "description": "Standard lifecycle stop operation."
494                                 },
495                                 {
496                                     "name": "start",
497                                     "description": "Standard lifecycle start operation."
498                                 },
499                                 {
500                                     "name": "delete",
501                                     "description": "Standard lifecycle delete operation."
502                                 },
503                                 {
504                                     "name": "configure",
505                                     "description": "Standard lifecycle configure operation."
506                                 }
507                             ]
508                         }
509                     ],
510                     "capabilities": [
511                         {
512                             "name": "feature",
513                             "type_name": "tosca.capabilities.Node"
514                         },
515                         {
516                             "name": "virtual_linkable",
517                             "type_name": "tosca.capabilities.nfv.VirtualLinkable"
518                         }
519                     ]
520                 },
521                 {
522                     "id": "vdu_vNat_7ozwkcr86sa87fmd2nue2ww07",
523                     "type_name": "tosca.nodes.nfv.VDU.Compute",
524                     "template_name": "vdu_vNat",
525                     "properties": {
526                         "configurable_properties": {
527                             "type_name": "map",
528                             "value": {
529                                 "test": {
530                                     "additional_vnfc_configurable_properties": {
531                                         "aaa": "1",
532                                         "bbb": "2",
533                                         "ccc": "3"
534                                     }
535                                 }
536                             }
537                         },
538                         "boot_order": {
539                             "type_name": "list",
540                             "value": [
541                                 "vNAT_Storage"
542                             ]
543                         },
544                         "name": {
545                             "type_name": "string",
546                             "value": "vNat"
547                         },
548                         "nfvi_constraints": {
549                             "type_name": "list",
550                             "value": [
551                                 "test"
552                             ]
553                         },
554                         "description": {
555                             "type_name": "string",
556                             "value": "the virtual machine of vNat"
557                         }
558                     },
559                     "interfaces": [
560                         {
561                             "name": "Standard",
562                             "description": "This lifecycle interface defines the essential, normative operations that TOSCA nodes may support.",
563                             "type_name": "tosca.interfaces.node.lifecycle.Standard",
564                             "operations": [
565                                 {
566                                     "name": "create",
567                                     "description": "Standard lifecycle create operation."
568                                 },
569                                 {
570                                     "name": "stop",
571                                     "description": "Standard lifecycle stop operation."
572                                 },
573                                 {
574                                     "name": "start",
575                                     "description": "Standard lifecycle start operation."
576                                 },
577                                 {
578                                     "name": "delete",
579                                     "description": "Standard lifecycle delete operation."
580                                 },
581                                 {
582                                     "name": "configure",
583                                     "description": "Standard lifecycle configure operation."
584                                 }
585                             ]
586                         }
587                     ],
588                     "artifacts": [
589                         {
590                             "name": "vNatVNFImage",
591                             "type_name": "tosca.artifacts.nfv.SwImage",
592                             "source_path": "/swimages/vRouterVNF_ControlPlane.qcow2",
593                             "properties": {
594                                 "operating_system": {
595                                     "type_name": "string",
596                                     "value": "linux"
597                                 },
598                                 "sw_image": {
599                                     "type_name": "string",
600                                     "value": "/swimages/vRouterVNF_ControlPlane.qcow2"
601                                 },
602                                 "name": {
603                                     "type_name": "string",
604                                     "value": "vNatVNFImage"
605                                 },
606                                 "checksum": {
607                                     "type_name": "string",
608                                     "value": "5000"
609                                 },
610                                 "min_ram": {
611                                     "type_name": "scalar-unit.size",
612                                     "value": {
613                                         "value": 1000000000,
614                                         "factor": 1,
615                                         "unit": "GB",
616                                         "unit_size": 1000000000
617                                     }
618                                 },
619                                 "disk_format": {
620                                     "type_name": "string",
621                                     "value": "qcow2"
622                                 },
623                                 "version": {
624                                     "type_name": "string",
625                                     "value": "1.0"
626                                 },
627                                 "container_format": {
628                                     "type_name": "string",
629                                     "value": "bare"
630                                 },
631                                 "min_disk": {
632                                     "type_name": "scalar-unit.size",
633                                     "value": {
634                                         "value": 10000000000,
635                                         "factor": 10,
636                                         "unit": "GB",
637                                         "unit_size": 1000000000
638                                     }
639                                 },
640                                 "supported_virtualisation_environments": {
641                                     "type_name": "list",
642                                     "value": [
643                                         "test_0"
644                                     ]
645                                 },
646                                 "size": {
647                                     "type_name": "scalar-unit.size",
648                                     "value": {
649                                         "value": 10000000000,
650                                         "factor": 10,
651                                         "unit": "GB",
652                                         "unit_size": 1000000000
653                                     }
654                                 }
655                             }
656                         }
657                     ],
658                     "capabilities": [
659                         {
660                             "name": "feature",
661                             "type_name": "tosca.capabilities.Node"
662                         },
663                         {
664                             "name": "os",
665                             "type_name": "tosca.capabilities.OperatingSystem",
666                             "properties": {
667                                 "distribution": {
668                                     "type_name": "string",
669                                     "description": "The Operating System (OS) distribution. Examples of valid values for a \"type\" of \"Linux\" would include: debian, fedora, rhel and ubuntu."
670                                 },
671                                 "version": {
672                                     "type_name": "version",
673                                     "description": "The Operating System version."
674                                 },
675                                 "type": {
676                                     "type_name": "string",
677                                     "description": "The Operating System (OS) type. Examples of valid values include: linux, aix, mac, windows, etc."
678                                 },
679                                 "architecture": {
680                                     "type_name": "string",
681                                     "description": "The Operating System (OS) architecture. Examples of valid values include: x86_32, x86_64, etc."
682                                 }
683                             }
684                         },
685                         {
686                             "name": "host",
687                             "type_name": "tosca.capabilities.Container",
688                             "properties": {
689                                 "cpu_frequency": {
690                                     "type_name": "scalar-unit.frequency",
691                                     "description": "Specifies the operating frequency of CPU's core. This property expresses the expected frequency of one (1) CPU as provided by the property \"num_cpus\"."
692                                 },
693                                 "mem_size": {
694                                     "type_name": "scalar-unit.size",
695                                     "description": "Size of memory available to applications running on the Compute node (default unit is MB)."
696                                 },
697                                 "num_cpus": {
698                                     "type_name": "integer",
699                                     "description": "Number of (actual or virtual) CPUs associated with the Compute node."
700                                 },
701                                 "disk_size": {
702                                     "type_name": "scalar-unit.size",
703                                     "description": "Size of the local disk available to applications running on the Compute node (default unit is MB)."
704                                 }
705                             }
706                         },
707                         {
708                             "name": "binding",
709                             "type_name": "tosca.capabilities.network.Bindable"
710                         },
711                         {
712                             "name": "scalable",
713                             "type_name": "tosca.capabilities.Scalable",
714                             "properties": {
715                                 "min_instances": {
716                                     "type_name": "integer",
717                                     "value": 1,
718                                     "description": "This property is used to indicate the minimum number of instances that should be created for the associated TOSCA Node Template by a TOSCA orchestrator."
719                                 },
720                                 "default_instances": {
721                                     "type_name": "integer",
722                                     "description": "An optional property that indicates the requested default number of instances that should be the starting number of instances a TOSCA orchestrator should attempt to allocate. Note: The value for this property MUST be in the range between the values set for \"min_instances\" and \"max_instances\" properties."
723                                 },
724                                 "max_instances": {
725                                     "type_name": "integer",
726                                     "value": 1,
727                                     "description": "This property is used to indicate the maximum number of instances that should be created for the associated TOSCA Node Template by a TOSCA orchestrator."
728                                 }
729                             }
730                         },
731                         {
732                             "name": "virtual_compute",
733                             "type_name": "tosca.capabilities.nfv.VirtualCompute",
734                             "properties": {
735                                 "requested_additional_capabilities": {
736                                     "type_name": "map",
737                                     "value": {
738                                         "ovs_dpdk": {
739                                             "requested_additional_capability_name": "ovs_dpdk",
740                                             "min_requested_additional_capability_version": "1.0",
741                                             "support_mandatory": True,
742                                             "target_performance_parameters": {
743                                                 "sw:ovs_dpdk": "true"
744                                             },
745                                             "preferred_requested_additional_capability_version": "1.0"
746                                         },
747                                         "hyper_threading": {
748                                             "requested_additional_capability_name": "hyper_threading",
749                                             "min_requested_additional_capability_version": "1.0",
750                                             "support_mandatory": True,
751                                             "target_performance_parameters": {
752                                                 "hw:cpu_cores": "2",
753                                                 "hw:cpu_threads": "2",
754                                                 "hw:cpu_threads_policy": "isolate",
755                                                 "hw:cpu_sockets": "2"
756                                             },
757                                             "preferred_requested_additional_capability_version": "1.0"
758                                         },
759                                         "numa": {
760                                             "requested_additional_capability_name": "numa",
761                                             "min_requested_additional_capability_version": "1.0",
762                                             "support_mandatory": True,
763                                             "target_performance_parameters": {
764                                                 "hw:numa_cpus.0": "0,1",
765                                                 "hw:numa_cpus.1": "2,3,4,5",
766                                                 "hw:numa_nodes": "2",
767                                                 "hw:numa_mem.1": "3072",
768                                                 "hw:numa_mem.0": "1024"
769                                             },
770                                             "preferred_requested_additional_capability_version": "1.0"
771                                         }
772                                     }
773                                 },
774                                 "virtual_cpu": {
775                                     "type_name": "tosca.datatypes.nfv.VirtualCpu",
776                                     "value": {
777                                         "num_virtual_cpu": 2,
778                                         "virtual_cpu_clock": {
779                                             "value": 2400000000,
780                                             "factor": 2.4,
781                                             "unit": "GHz",
782                                             "unit_size": 1000000000
783                                         },
784                                         "cpu_architecture": "X86",
785                                         "virtual_cpu_oversubscription_policy": "test",
786                                         "virtual_cpu_pinning": {
787                                             "cpu_pinning_map": {
788                                                 "cpu_pinning_0": "1"
789                                             },
790                                             "cpu_pinning_policy": "static"
791                                         }
792                                     }
793                                 },
794                                 "virtual_memory": {
795                                     "type_name": "tosca.datatypes.nfv.VirtualMemory",
796                                     "value": {
797                                         "virtual_mem_oversubscription_policy": "mem_policy_test",
798                                         "numa_enabled": True,
799                                         "virtual_mem_size": {
800                                             "value": 10000000000,
801                                             "factor": 10,
802                                             "unit": "GB",
803                                             "unit_size": 1000000000
804                                         }
805                                     }
806                                 }
807                             }
808                         },
809                         {
810                             "name": "virtual_binding",
811                             "type_name": "tosca.capabilities.nfv.VirtualBindable"
812                         }
813                     ],
814                     "relationships": [
815                         {
816                             "name": "virtual_storage",
817                             "source_requirement_index": 0,
818                             "target_node_id": "vNAT_Storage_6wdgwzedlb6sq18uzrr41sof7",
819                             "properties": {
820                                 "location": {
821                                     "type_name": "string",
822                                     "value": "/mnt/volume_0",
823                                     "description": "The relative location (e.g., path on the file system), which provides the root location to address an attached node. e.g., a mount point / path such as '/usr/data'. Note: The user must provide it and it cannot be \"root\"."
824                                 }
825                             },
826                             "source_interfaces": [
827                                 {
828                                     "name": "Configure",
829                                     "description": "The lifecycle interfaces define the essential, normative operations that each TOSCA Relationship Types may support.",
830                                     "type_name": "tosca.interfaces.relationship.Configure",
831                                     "operations": [
832                                         {
833                                             "name": "add_source",
834                                             "description": "Operation to notify the target node of a source node which is now available via a relationship."
835                                         },
836                                         {
837                                             "name": "pre_configure_target",
838                                             "description": "Operation to pre-configure the target endpoint."
839                                         },
840                                         {
841                                             "name": "post_configure_source",
842                                             "description": "Operation to post-configure the source endpoint."
843                                         },
844                                         {
845                                             "name": "target_changed",
846                                             "description": "Operation to notify source some property or attribute of the target changed"
847                                         },
848                                         {
849                                             "name": "pre_configure_source",
850                                             "description": "Operation to pre-configure the source endpoint."
851                                         },
852                                         {
853                                             "name": "post_configure_target",
854                                             "description": "Operation to post-configure the target endpoint."
855                                         },
856                                         {
857                                             "name": "remove_target",
858                                             "description": "Operation to remove a target node."
859                                         },
860                                         {
861                                             "name": "add_target",
862                                             "description": "Operation to notify the source node of a target node being added via a relationship."
863                                         }
864                                     ]
865                                 }
866                             ]
867                         }
868                     ]
869                 },
870                 {
871                     "id": "SRIOV_Port_leu1j6rfdt4c8vta6aec1xe39",
872                     "type_name": "tosca.nodes.nfv.VduCpd",
873                     "template_name": "SRIOV_Port",
874                     "properties": {
875                         "address_data": {
876                             "type_name": "list",
877                             "value": [
878                                 {
879                                     "address_type": "ip_address",
880                                     "l3_address_data": {
881                                         "ip_address_type": "ipv4",
882                                         "floating_ip_activated": False,
883                                         "number_of_ip_address": 1,
884                                         "ip_address_assignment": True
885                                     }
886                                 }
887                             ]
888                         },
889                         "description": {
890                             "type_name": "string",
891                             "value": "sriov port"
892                         },
893                         "layer_protocol": {
894                             "type_name": "string",
895                             "value": "ipv4"
896                         },
897                         "virtual_network_interface_requirements": {
898                             "type_name": "list",
899                             "value": [
900                                 {
901                                     "requirement": {
902                                         "SRIOV": "true"
903                                     },
904                                     "support_mandatory": False,
905                                     "name": "sriov",
906                                     "description": "sriov"
907                                 },
908                                 {
909                                     "requirement": {
910                                         "SRIOV": "false"
911                                     },
912                                     "support_mandatory": False,
913                                     "name": "normal",
914                                     "description": "normal"
915                                 }
916                             ]
917                         },
918                         "role": {
919                             "type_name": "string",
920                             "value": "root"
921                         },
922                         "bitrate_requirement": {
923                             "type_name": "integer",
924                             "value": 10
925                         }
926                     },
927                     "interfaces": [
928                         {
929                             "name": "Standard",
930                             "description": "This lifecycle interface defines the essential, normative operations that TOSCA nodes may support.",
931                             "type_name": "tosca.interfaces.node.lifecycle.Standard",
932                             "operations": [
933                                 {
934                                     "name": "create",
935                                     "description": "Standard lifecycle create operation."
936                                 },
937                                 {
938                                     "name": "stop",
939                                     "description": "Standard lifecycle stop operation."
940                                 },
941                                 {
942                                     "name": "start",
943                                     "description": "Standard lifecycle start operation."
944                                 },
945                                 {
946                                     "name": "delete",
947                                     "description": "Standard lifecycle delete operation."
948                                 },
949                                 {
950                                     "name": "configure",
951                                     "description": "Standard lifecycle configure operation."
952                                 }
953                             ]
954                         }
955                     ],
956                     "capabilities": [
957                         {
958                             "name": "feature",
959                             "type_name": "tosca.capabilities.Node"
960                         }
961                     ],
962                     "relationships": [
963                         {
964                             "name": "virtual_binding",
965                             "source_requirement_index": 0,
966                             "target_node_id": "vdu_vNat_7ozwkcr86sa87fmd2nue2ww07",
967                             "source_interfaces": [
968                                 {
969                                     "name": "Configure",
970                                     "description": "The lifecycle interfaces define the essential, normative operations that each TOSCA Relationship Types may support.",
971                                     "type_name": "tosca.interfaces.relationship.Configure",
972                                     "operations": [
973                                         {
974                                             "name": "add_source",
975                                             "description": "Operation to notify the target node of a source node which is now available via a relationship."
976                                         },
977                                         {
978                                             "name": "pre_configure_target",
979                                             "description": "Operation to pre-configure the target endpoint."
980                                         },
981                                         {
982                                             "name": "post_configure_source",
983                                             "description": "Operation to post-configure the source endpoint."
984                                         },
985                                         {
986                                             "name": "target_changed",
987                                             "description": "Operation to notify source some property or attribute of the target changed"
988                                         },
989                                         {
990                                             "name": "pre_configure_source",
991                                             "description": "Operation to pre-configure the source endpoint."
992                                         },
993                                         {
994                                             "name": "post_configure_target",
995                                             "description": "Operation to post-configure the target endpoint."
996                                         },
997                                         {
998                                             "name": "remove_target",
999                                             "description": "Operation to remove a target node."
1000                                         },
1001                                         {
1002                                             "name": "add_target",
1003                                             "description": "Operation to notify the source node of a target node being added via a relationship."
1004                                         }
1005                                     ]
1006                                 }
1007                             ]
1008                         },
1009                         {
1010                             "name": "virtual_link",
1011                             "source_requirement_index": 1,
1012                             "target_node_id": "sriov_link_2610d7gund4e645wo39dvp238",
1013                             "target_capability_name": "feature",
1014                             "source_interfaces": [
1015                                 {
1016                                     "name": "Configure",
1017                                     "description": "The lifecycle interfaces define the essential, normative operations that each TOSCA Relationship Types may support.",
1018                                     "type_name": "tosca.interfaces.relationship.Configure",
1019                                     "operations": [
1020                                         {
1021                                             "name": "add_source",
1022                                             "description": "Operation to notify the target node of a source node which is now available via a relationship."
1023                                         },
1024                                         {
1025                                             "name": "pre_configure_target",
1026                                             "description": "Operation to pre-configure the target endpoint."
1027                                         },
1028                                         {
1029                                             "name": "post_configure_source",
1030                                             "description": "Operation to post-configure the source endpoint."
1031                                         },
1032                                         {
1033                                             "name": "target_changed",
1034                                             "description": "Operation to notify source some property or attribute of the target changed"
1035                                         },
1036                                         {
1037                                             "name": "pre_configure_source",
1038                                             "description": "Operation to pre-configure the source endpoint."
1039                                         },
1040                                         {
1041                                             "name": "post_configure_target",
1042                                             "description": "Operation to post-configure the target endpoint."
1043                                         },
1044                                         {
1045                                             "name": "remove_target",
1046                                             "description": "Operation to remove a target node."
1047                                         },
1048                                         {
1049                                             "name": "add_target",
1050                                             "description": "Operation to notify the source node of a target node being added via a relationship."
1051                                         }
1052                                     ]
1053                                 }
1054                             ]
1055                         }
1056                     ]
1057                 }
1058             ],
1059             "substitution": {
1060                 "node_type_name": "tosca.nodes.nfv.VNF.vOpenNAT",
1061                 "requirements": [
1062                     {
1063                         "mapped_name": "sriov_plane",
1064                         "node_id": "SRIOV_Port_leu1j6rfdt4c8vta6aec1xe39",
1065                         "name": "virtual_link"
1066                     }
1067                 ]
1068             }
1069         },
1070         "model": {
1071             "metadata": {
1072                 "vnfSoftwareVersion": "1.0.0",
1073                 "vnfProductName": "openNAT",
1074                 "localizationLanguage": [
1075                     "english",
1076                     "chinese"
1077                 ],
1078                 "vnfProvider": "intel",
1079                 "vnfmInfo": "GVNFM",
1080                 "defaultLocalizationLanguage": "english",
1081                 "vnfdId": "openNAT-1.0",
1082                 "vnfProductInfoDescription": "openNAT",
1083                 "vnfdVersion": "1.0.0",
1084                 "vnfProductInfoName": "openNAT"
1085             },
1086             "node_templates": [
1087                 {
1088                     "name": "vNAT_Storage",
1089                     "type_name": "tosca.nodes.nfv.VDU.VirtualStorage",
1090                     "default_instances": 1,
1091                     "min_instances": 0,
1092                     "properties": {
1093                         "size_of_storage": {
1094                             "type_name": "scalar-unit.size",
1095                             "value": {
1096                                 "value": 10000000000,
1097                                 "factor": 10,
1098                                 "unit": "GB",
1099                                 "unit_size": 1000000000
1100                             }
1101                         },
1102                         "type_of_storage": {
1103                             "type_name": "string",
1104                             "value": "volume"
1105                         },
1106                         "rdma_enabled": {
1107                             "type_name": "boolean",
1108                             "value": False
1109                         }
1110                     },
1111                     "interface_templates": [
1112                         ""
1113                     ],
1114                     "capability_templates": [
1115                         {
1116                             "name": "feature",
1117                             "type_name": "tosca.capabilities.Node"
1118                         },
1119                         {
1120                             "name": "virtual_storage",
1121                             "type_name": "tosca.capabilities.nfv.VirtualStorage"
1122                         }
1123                     ]
1124                 },
1125                 {
1126                     "name": "vdu_vNat",
1127                     "type_name": "tosca.nodes.nfv.VDU.Compute",
1128                     "default_instances": 1,
1129                     "min_instances": 0,
1130                     "properties": {
1131                         "configurable_properties": {
1132                             "type_name": "map",
1133                             "value": {
1134                                 "test": {
1135                                     "additional_vnfc_configurable_properties": {
1136                                         "aaa": "1",
1137                                         "bbb": "2",
1138                                         "ccc": "3"
1139                                     }
1140                                 }
1141                             }
1142                         },
1143                         "boot_order": {
1144                             "type_name": "list",
1145                             "value": [
1146                                 "vNAT_Storage"
1147                             ]
1148                         },
1149                         "name": {
1150                             "type_name": "string",
1151                             "value": "vNat"
1152                         },
1153                         "nfvi_constraints": {
1154                             "type_name": "list",
1155                             "value": [
1156                                 "test"
1157                             ]
1158                         },
1159                         "description": {
1160                             "type_name": "string",
1161                             "value": "the virtual machine of vNat"
1162                         }
1163                     },
1164                     "interface_templates": [
1165                         ""
1166                     ],
1167                     "artifact_templates": [
1168                         ""
1169                     ],
1170                     "capability_templates": [
1171                         {
1172                             "name": "feature",
1173                             "type_name": "tosca.capabilities.Node"
1174                         },
1175                         {
1176                             "name": "os",
1177                             "type_name": "tosca.capabilities.OperatingSystem",
1178                             "properties": {
1179                                 "distribution": {
1180                                     "type_name": "string",
1181                                     "description": "The Operating System (OS) distribution. Examples of valid values for a \"type\" of \"Linux\" would include: debian, fedora, rhel and ubuntu."
1182                                 },
1183                                 "version": {
1184                                     "type_name": "version",
1185                                     "description": "The Operating System version."
1186                                 },
1187                                 "type": {
1188                                     "type_name": "string",
1189                                     "description": "The Operating System (OS) type. Examples of valid values include: linux, aix, mac, windows, etc."
1190                                 },
1191                                 "architecture": {
1192                                     "type_name": "string",
1193                                     "description": "The Operating System (OS) architecture. Examples of valid values include: x86_32, x86_64, etc."
1194                                 }
1195                             }
1196                         },
1197                         {
1198                             "name": "host",
1199                             "type_name": "tosca.capabilities.Container",
1200                             "valid_source_node_type_names": [
1201                                 "tosca.nodes.SoftwareComponent"
1202                             ],
1203                             "properties": {
1204                                 "cpu_frequency": {
1205                                     "type_name": "scalar-unit.frequency",
1206                                     "description": "Specifies the operating frequency of CPU's core. This property expresses the expected frequency of one (1) CPU as provided by the property \"num_cpus\"."
1207                                 },
1208                                 "mem_size": {
1209                                     "type_name": "scalar-unit.size",
1210                                     "description": "Size of memory available to applications running on the Compute node (default unit is MB)."
1211                                 },
1212                                 "num_cpus": {
1213                                     "type_name": "integer",
1214                                     "description": "Number of (actual or virtual) CPUs associated with the Compute node."
1215                                 },
1216                                 "disk_size": {
1217                                     "type_name": "scalar-unit.size",
1218                                     "description": "Size of the local disk available to applications running on the Compute node (default unit is MB)."
1219                                 }
1220                             }
1221                         },
1222                         {
1223                             "name": "binding",
1224                             "type_name": "tosca.capabilities.network.Bindable"
1225                         },
1226                         {
1227                             "name": "scalable",
1228                             "type_name": "tosca.capabilities.Scalable",
1229                             "properties": {
1230                                 "min_instances": {
1231                                     "type_name": "integer",
1232                                     "value": 1,
1233                                     "description": "This property is used to indicate the minimum number of instances that should be created for the associated TOSCA Node Template by a TOSCA orchestrator."
1234                                 },
1235                                 "default_instances": {
1236                                     "type_name": "integer",
1237                                     "description": "An optional property that indicates the requested default number of instances that should be the starting number of instances a TOSCA orchestrator should attempt to allocate. Note: The value for this property MUST be in the range between the values set for \"min_instances\" and \"max_instances\" properties."
1238                                 },
1239                                 "max_instances": {
1240                                     "type_name": "integer",
1241                                     "value": 1,
1242                                     "description": "This property is used to indicate the maximum number of instances that should be created for the associated TOSCA Node Template by a TOSCA orchestrator."
1243                                 }
1244                             }
1245                         },
1246                         {
1247                             "name": "virtual_compute",
1248                             "type_name": "tosca.capabilities.nfv.VirtualCompute",
1249                             "properties": {
1250                                 "requested_additional_capabilities": {
1251                                     "type_name": "map",
1252                                     "value": {
1253                                         "ovs_dpdk": {
1254                                             "requested_additional_capability_name": "ovs_dpdk",
1255                                             "min_requested_additional_capability_version": "1.0",
1256                                             "support_mandatory": True,
1257                                             "target_performance_parameters": {
1258                                                 "sw:ovs_dpdk": "true"
1259                                             },
1260                                             "preferred_requested_additional_capability_version": "1.0"
1261                                         },
1262                                         "hyper_threading": {
1263                                             "requested_additional_capability_name": "hyper_threading",
1264                                             "min_requested_additional_capability_version": "1.0",
1265                                             "support_mandatory": True,
1266                                             "target_performance_parameters": {
1267                                                 "hw:cpu_cores": "2",
1268                                                 "hw:cpu_threads": "2",
1269                                                 "hw:cpu_threads_policy": "isolate",
1270                                                 "hw:cpu_sockets": "2"
1271                                             },
1272                                             "preferred_requested_additional_capability_version": "1.0"
1273                                         },
1274                                         "numa": {
1275                                             "requested_additional_capability_name": "numa",
1276                                             "min_requested_additional_capability_version": "1.0",
1277                                             "support_mandatory": True,
1278                                             "target_performance_parameters": {
1279                                                 "hw:numa_cpus.0": "0,1",
1280                                                 "hw:numa_cpus.1": "2,3,4,5",
1281                                                 "hw:numa_nodes": "2",
1282                                                 "hw:numa_mem.1": "3072",
1283                                                 "hw:numa_mem.0": "1024"
1284                                             },
1285                                             "preferred_requested_additional_capability_version": "1.0"
1286                                         }
1287                                     }
1288                                 },
1289                                 "virtual_cpu": {
1290                                     "type_name": "tosca.datatypes.nfv.VirtualCpu",
1291                                     "value": {
1292                                         "num_virtual_cpu": 2,
1293                                         "virtual_cpu_clock": {
1294                                             "value": 2400000000,
1295                                             "factor": 2.4,
1296                                             "unit": "GHz",
1297                                             "unit_size": 1000000000
1298                                         },
1299                                         "cpu_architecture": "X86",
1300                                         "virtual_cpu_oversubscription_policy": "test",
1301                                         "virtual_cpu_pinning": {
1302                                             "cpu_pinning_map": {
1303                                                 "cpu_pinning_0": "1"
1304                                             },
1305                                             "cpu_pinning_policy": "static"
1306                                         }
1307                                     }
1308                                 },
1309                                 "virtual_memory": {
1310                                     "type_name": "tosca.datatypes.nfv.VirtualMemory",
1311                                     "value": {
1312                                         "virtual_mem_oversubscription_policy": "mem_policy_test",
1313                                         "numa_enabled": True,
1314                                         "virtual_mem_size": {
1315                                             "value": 10000000000,
1316                                             "factor": 10,
1317                                             "unit": "GB",
1318                                             "unit_size": 1000000000
1319                                         }
1320                                     }
1321                                 }
1322                             }
1323                         },
1324                         {
1325                             "name": "virtual_binding",
1326                             "type_name": "tosca.capabilities.nfv.VirtualBindable"
1327                         }
1328                     ],
1329                     "requirement_templates": [
1330                         {
1331                             "name": "virtual_storage",
1332                             "target_node_template_name": "vNAT_Storage",
1333                             "relationship_template": {
1334                                 "type_name": "tosca.relationships.nfv.VDU.AttachedTo",
1335                                 "properties": {
1336                                     "location": {
1337                                         "type_name": "string",
1338                                         "value": "/mnt/volume_0",
1339                                         "description": "The relative location (e.g., path on the file system), which provides the root location to address an attached node. e.g., a mount point / path such as '/usr/data'. Note: The user must provide it and it cannot be \"root\"."
1340                                     }
1341                                 },
1342                                 "source_interface_templates": [
1343                                     ""
1344                                 ]
1345                             }
1346                         }
1347                     ]
1348                 },
1349                 {
1350                     "name": "SRIOV_Port",
1351                     "type_name": "tosca.nodes.nfv.VduCpd",
1352                     "default_instances": 1,
1353                     "min_instances": 0,
1354                     "properties": {
1355                         "address_data": {
1356                             "type_name": "list",
1357                             "value": [
1358                                 {
1359                                     "address_type": "ip_address",
1360                                     "l3_address_data": {
1361                                         "ip_address_type": "ipv4",
1362                                         "floating_ip_activated": False,
1363                                         "number_of_ip_address": 1,
1364                                         "ip_address_assignment": True
1365                                     }
1366                                 }
1367                             ]
1368                         },
1369                         "description": {
1370                             "type_name": "string",
1371                             "value": "sriov port"
1372                         },
1373                         "layer_protocol": {
1374                             "type_name": "string",
1375                             "value": "ipv4"
1376                         },
1377                         "virtual_network_interface_requirements": {
1378                             "type_name": "list",
1379                             "value": [
1380                                 {
1381                                     "requirement": {
1382                                         "SRIOV": "true"
1383                                     },
1384                                     "support_mandatory": False,
1385                                     "name": "sriov",
1386                                     "description": "sriov"
1387                                 },
1388                                 {
1389                                     "requirement": {
1390                                         "SRIOV": "false"
1391                                     },
1392                                     "support_mandatory": False,
1393                                     "name": "normal",
1394                                     "description": "normal"
1395                                 }
1396                             ]
1397                         },
1398                         "role": {
1399                             "type_name": "string",
1400                             "value": "root"
1401                         },
1402                         "bitrate_requirement": {
1403                             "type_name": "integer",
1404                             "value": 10
1405                         }
1406                     },
1407                     "interface_templates": [
1408                         ""
1409                     ],
1410                     "capability_templates": [
1411                         {
1412                             "name": "feature",
1413                             "type_name": "tosca.capabilities.Node"
1414                         }
1415                     ],
1416                     "requirement_templates": [
1417                         {
1418                             "name": "virtual_binding",
1419                             "target_node_template_name": "vdu_vNat",
1420                             "relationship_template": {
1421                                 "type_name": "tosca.relationships.nfv.VirtualBindsTo",
1422                                 "source_interface_templates": [
1423                                     ""
1424                                 ]
1425                             }
1426                         },
1427                         {
1428                             "name": "virtual_link",
1429                             "target_node_type_name": "tosca.nodes.nfv.VnfVirtualLinkDesc",
1430                             "relationship_template": {
1431                                 "type_name": "tosca.relationships.nfv.VirtualLinksTo",
1432                                 "source_interface_templates": [
1433                                     ""
1434                                 ]
1435                             }
1436                         }
1437                     ]
1438                 }
1439             ],
1440             "substitution_template": {
1441                 "node_type_name": "tosca.nodes.nfv.VNF.vOpenNAT",
1442                 "requirement_templates": [
1443                     {
1444                         "mapped_name": "sriov_plane",
1445                         "node_template_name": "SRIOV_Port",
1446                         "name": "virtual_link"
1447                     }
1448                 ]
1449             }
1450         }
1451     })
1452     print convert_vnfd_model(src_json)
1453
1454
1455
1456