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