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