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