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