5e6cb6755d95b63d986c1a597462ff35b05b29f4
[vfc/gvnfm/vnflcm.git] / lcm / lcm / nf / const.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 import json
15
16 from lcm.pub.utils.jobutil import enum
17
18 HEAL_ACTION_TYPE = enum(START="vmCreate", RESTART="vmReset")
19 ACTION_TYPE = enum(START=1, STOP=2, REBOOT=3)
20 GRANT_TYPE = enum(INSTANTIATE="INSTANTIATE", TERMINATE="TERMINATE", HEAL_CREATE="Heal Create", HEAL_RESTART="Heal Restart", OPERATE="OPERATE")
21 VNF_STATUS = enum(NULL='null', INSTANTIATING="instantiating", INACTIVE='inactive', ACTIVE="active",
22                   FAILED="failed", TERMINATING="terminating", SCALING="scaling", OPERATING="operating",
23                   UPDATING="updating", HEALING="healing")
24
25 OPERATION_TYPE = enum(
26     INSTANTIATE="INSTANTIATE",
27     SCALE="SCALE",
28     SCALE_TO_LEVEL="SCALE_TO_LEVEL",
29     CHANGE_FLAVOUR="CHANGE_FLAVOUR",
30     TERMINATE="TERMINATE",
31     HEAL="HEAL",
32     OPERATE="OPERATE",
33     CHANGE_EXT_CONN="CHANGE_EXT_CONN",
34     MODIFY_INFO="MODIFY_INFO"
35 )
36
37 OPERATION_STATE_TYPE = enum(
38     STARTING="STARTING",
39     PROCESSING="PROCESSING",
40     COMPLETED="COMPLETED",
41     FAILED_TEMP="FAILED_TEMP",
42     FAILED="FAILED",
43     ROLLING_BACK="ROLLING_BACK",
44     ROLLED_BACK="ROLLED_BACK"
45 )
46
47 CHANGE_TYPE = enum(
48     ADDED='ADDED',
49     REMOVED='REMOVED',
50     MODIFIED='MODIFIED',
51     TEMPORARY='TEMPORARY',
52     LINK_PORT_ADDED='LINK_PORT_ADDED',
53     LINK_PORT_REMOVED='LINK_PORT_REMOVED'
54 )
55
56 RESOURCE_MAP = {'Storage': 'volumn', 'Network': 'network', 'SubNetwork': 'subnet', 'Port': 'port',
57                 'Flavour': 'flavor', 'Vm': 'vm'}
58
59 ROOT_URI = "api/vnflcm/v1/subscriptions/"
60
61 AUTH_TYPES = ["BASIC", "OAUTH2_CLIENT_CREDENTIALS", "TLS_CERT"]
62
63 BASIC = "BASIC"
64
65 OAUTH2_CLIENT_CREDENTIALS = "OAUTH2_CLIENT_CREDENTIALS"
66
67 LCCNNOTIFICATION = "VnfLcmOperationOccurrenceNotification"
68
69 NOTIFICATION_TYPES = [
70     "VnfLcmOperationOccurrenceNotification",
71     "VnfIdentifierCreationNotification",
72     "VnfIdentifierDeletionNotification"
73 ]
74
75 LCM_OPERATION_TYPES = [
76     OPERATION_TYPE.INSTANTIATE,
77     OPERATION_TYPE.SCALE,
78     OPERATION_TYPE.SCALE_TO_LEVEL,
79     OPERATION_TYPE.CHANGE_FLAVOUR,
80     OPERATION_TYPE.TERMINATE,
81     OPERATION_TYPE.HEAL,
82     OPERATION_TYPE.OPERATE,
83     OPERATION_TYPE.CHANGE_EXT_CONN,
84     OPERATION_TYPE.MODIFY_INFO
85 ]
86
87 LCM_OPERATION_STATE_TYPES = [
88     OPERATION_STATE_TYPE.STARTING,
89     OPERATION_STATE_TYPE.PROCESSING,
90     OPERATION_STATE_TYPE.COMPLETED,
91     OPERATION_STATE_TYPE.FAILED_TEMP,
92     OPERATION_STATE_TYPE.FAILED,
93     OPERATION_STATE_TYPE.ROLLING_BACK,
94     OPERATION_STATE_TYPE.ROLLED_BACK
95 ]
96
97
98 inst_req_data = {
99     "flavourId": "flavour_1",
100     "instantiationLevelId": "instantiationLevel_1",
101     "extVirtualLinks": [
102         {
103             "id": "extVirtualLink_1",
104             "vimConnectionId": "vimConnection_1",
105             "resourceProviderId": "resourceProvider_1",
106             "resourceId": "resource_1",
107             "resourceSubnetId": "resourceSubnet_1",
108             "extCps": [
109                 {
110                     "cpdId": "cpd_1",
111                     "cpConfig": [
112                         {
113                             "cpInstanceId": "cpInstance_1",
114                             "linkPortId": "linkPort_1",
115                             "cpProtocolData": [
116                                 {
117                                     "layerProtocol": "IP_OVER_ETHERNET",
118                                     "ipOverEthernet": {
119                                         "macAddress": "00:f3:43:20:a2:a3",
120                                         "ipAddresses": [
121                                             {
122                                                 "type": "IPV4",
123                                                 "fixedAddresses": ["192.168.104.2", ],
124                                                 "numDynamicAddresses": 0,
125                                                 "addressRange": None,
126                                                 "subnetId": "subnet_1",
127                                             }
128                                         ]
129                                     }
130                                 }
131                             ]
132                         }
133                     ]
134                 }
135             ],
136             "extLinkPorts": [
137                 {
138                     "id": "extLinkPort_1",
139                     "resourceHandle": {
140                         "vimConnectionId": "vimConnection_1",
141                         "resourceProviderId": "resourceProvider_1",
142                         "resourceId": "resource_1",
143                         "vimLevelResourceType": "vimLevelResourceType_1",
144                     }
145                 }
146             ]
147         }
148     ],
149     "extManagedVirtualLinks": [
150         {
151             "id": 'extManagedVirtualLink_1',
152             "virtualLinkDescId": 'virtualLinkDesc_1',
153             "vimConnectionId": 'vimConnection_1',
154             "resourceProviderId": 'resourceProvider_1',
155             "resourceId": 'resource_1',
156         }
157     ],
158     "vimConnectionInfo": [
159         {
160             "id": 'vimConnection_1',
161             "vimId": 'vim_1',
162             "vimType": 'vim',
163             "interfaceInfo": {
164                 "apiVersion": "apiVersion_1",
165                 "protocolType": "http"
166             },
167             "accessInfo": {
168                 "tenant": "tenant_vCPE",
169                 "username": "vCPE",
170                 "password": "vCPE_321",
171             },
172             "extra": None,
173         }
174     ],
175     "localizationLanguage": "en_US",
176     "additionalParams": {
177         "vimId": "vim_1",
178         "key1": "test1",
179         "key2": "test2",
180     }
181 }
182
183
184 vnfd_model_dict = {
185     'metadata': {
186         'vendor': u'zte',
187         'is_shared': False,
188         'description': '',
189         'domain_type': u'CN',
190         'version': u'v4.14.10',
191         'vmnumber_overquota_alarm': False,
192         'cross_dc': False,
193         'vnf_type': u'SSS',
194         'vnfd_version': u'V00000001',
195         'id': u'sss-vnf-template',
196         'name': u'sss-vnf-template'
197     },
198     'vdus': [
199         {
200             "vdu_id": "vdu1Id",
201             "description": "vdu description",
202             "properties": {
203                 "name": "vduinstname",
204                 "vdu_type": "OMP",
205                 "key_vdu": True,
206                 "support_scaling": True,
207                 "location_info": {
208                     "vimid": "vimid",
209                     "tenant": "tenantname",
210                     "availability_zone": "zone1",
211                     "host": "host1"
212                 },
213                 "local_affinity_antiaffinity_rule": [
214                     {
215                         "affinity_antiaffinity": "anti-affinity",
216                         "scope": "node"
217                     },
218                     {
219                         "affinity_antiaffinity": "affinity",
220                         "scope": "zone"
221                     }
222                 ],
223                 "inject_data_list": [
224                     {
225                         "file_name": "abc.xml",
226                         "file_data": "<a>xxx</a><b>ssss</b>"
227                     }
228                 ],
229                 "storage_policy": "HIGH",
230                 "template_id": "26",
231                 "manual_scale_select_vim": False,
232                 "watchdog": {
233                     "enabledelay": 600000,
234                     "action": "reset"
235                 },
236                 "is_predefined": False,
237                 "allow_scale_updown": False,
238                 "inject_network_address": True,
239                 "inner_hugepage_num": 100,
240                 "inner_hugepage_size": "2048",
241                 "action": "add"
242             },
243             "image_file": u'sss',
244             "local_storages": [
245                 "local_storage_id1",
246                 "local_storage_id2"
247             ],
248             "volume_storages": [
249                 {
250                     "volume_storage_id": "volume_storage1",
251                     "location": "/usr/data",
252                     "device": "/dev/hda1"
253                 }
254             ],
255             "dependencies": [
256                 "vdu1Id",
257                 "vduNId"
258             ],
259             "nfv_compute": {
260                 "num_cpus": 4,
261                 "mem_size": "1 GB",
262                 "cpu_frequency": "1GHz",
263                 "flavor_extra_specs": {
264                     "hw: cpu_policy": "shared",
265                     "hw: cpu_max_threads": 50,
266                     "hw: cpu_sockets": 10,
267                     "hw: cpu_max_sockets": 20,
268                     "hw: cpu_max_cores": 8,
269                     "hw: cpu_threads": 30,
270                     "hw: numa_mem.0": 12288,
271                     "hw: hugepage_num": 100,
272                     "hw: high_performance": "dvs_high",
273                     "hw: numa_nodes": 1,
274                     "hw: numa_cpus.0": "2,4,8",
275                     "hw: numa_pci": True,
276                     "hw: cpu_cores": 4,
277                     "pci_passthrough: alias": "ColetoCreek: 1",
278                     "hw: mem_page_size": "large",
279                     "hw: mem_paging_mechanism": "EPT"
280                 }
281             },
282             "vls": [
283                 "vlId1",
284             ],
285             "cps": [
286                 "cpId1",
287             ],
288             "scalable": {
289                 "min_instances": 1,
290                 "max_instances": 2,
291                 "default_instances": 1
292             },
293             "interfaces": {
294                 "Standard": {
295                     "create": {
296                         "implementation": "<implementationScript>",
297                         "inputs": {
298                             "param1Name": "value1",
299                             "paramNName": "valueN"
300                         }
301                     },
302                     "configure": {
303                         "implementation": "<implementationScript>",
304                         "inputs": {
305                             "param1Name": "value1",
306                             "paramNName": "valueN"
307                         }
308                     },
309                     "start": {
310                         "implementation": "<implementationScript>",
311                         "inputs": {
312                             "param1Name": "value1",
313                             "paramNName": "valueN"
314                         }
315                     },
316                     "stop": {
317                         "implementation": "<implementationScript>",
318                         "inputs": {
319                             "param1Name": "value1",
320                             "paramNName": "valueN"
321                         }
322                     },
323                     "delete": {
324                         "implementation": "<implementationScript>",
325                         "inputs": {
326                             "param1Name": "value1",
327                             "paramNName": "valueN"
328                         }
329                     }
330                 }
331             },
332             "artifacts": [
333             ]
334         }
335     ],
336     'volume_storages': [
337         {
338             "volume_storage_id": "volume_storage1",
339             "description": "",
340             "properties": {
341                 "size": "100 GB",
342                 "volume_id": "",
343                 "volume_name": "volumeStorage1",
344                 "custom_volume_type": "type1",
345                 "disk_type": "data",
346                 "delete_on_termination_vm": True,
347                 "location_info": {
348                     "vimid": "vimid_1",
349                     "tenant": "tenantname_1",
350                     "availability_zone": "zone1"
351                 },
352                 "is_predefined": False,
353                 "is_shared": False
354             },
355             "image_file": [
356                 "volume_image"
357             ]
358         }
359     ],
360     'policies': {
361         'scaling': {
362             'targets': {
363
364             },
365             'policy_id': u'policy_scale_sss-vnf-template',
366             'properties': {
367                 'policy_file': '*-vnfd.zip/*-vnf-policy.xml'
368             },
369             'description': ''
370         }
371     },
372     'image_files': [
373         {
374             'description': '',
375             'properties': {
376                 'name': u'opencos_sss_omm_img_release_20150723-1-disk1.vmdk',
377                 'checksum': '',
378                 'disk_format': u'VMDK',
379                 'file_url': u'./zte-cn-sss-main-image/OMM/opencos_sss_omm_img_release_20150723-1-disk1.vmdk',
380                 'container_type': 'vm',
381                 'version': '',
382                 'hypervisor_type': 'kvm'
383             },
384             'image_file_id': u'opencos_sss_omm_img_release_20150723-1-disk1'
385         },
386         {
387             'description': '',
388             'properties': {
389                 'name': u'sss.vmdk',
390                 'checksum': '',
391                 'disk_format': u'VMDK',
392                 'file_url': u'./zte-cn-sss-main-image/NE/sss.vmdk',
393                 'container_type': 'vm',
394                 'version': '',
395                 'hypervisor_type': 'kvm'
396             },
397             'image_file_id': u'sss'
398         }
399     ],
400     'vls': [
401         {
402             "vl_id": "vldId1",
403             "description": "",
404             "properties": {
405                 "name": "umac_241_control",
406                 "network_name": "umac_control",
407                 "is_predefined": False,
408                 "vendor": "zte",
409                 "netmask": "255.255.255.0",
410                 "mtu": 1500,
411                 "network_type": "vlan",
412                 "physical_network": "phynet01",
413                 "segmentation_id": "30",
414                 "vlan_transparent": False,
415                 "vds_name": "vds1",
416                 "cidr": "192.168.199.0/24",
417                 "ip_version": 4,
418                 "gateway_ip": "192.168.199.1",
419                 "dhcp_enabled": False,
420                 "dns_nameservers": [
421                     "192.168.0.4",
422                     "192.168.0.10"
423                 ],
424                 "start_ip": "192.168.199.2",
425                 "end_ip": "192.168.199.254",
426                 "host_routes": [
427                     {
428                         "destination": "10.43.26.0/24",
429                         "nexthop": "10.41.23.1"
430                     }
431                 ],
432                 "location_info": {
433                     "vimid": "vimid_1",
434                     "tenant": "tenantname_1"
435                 },
436                 "cloud_type": "IaaS"
437             },
438             "route_id": "router01",
439             "route_external": False
440         }
441     ],
442     'cps': [
443         {
444             "cp_id": "cpId1",
445             "description": "",
446             "properties": {
447                 "name": "",
448                 "mac_address": "00:d9:00:82:11:e1",
449                 "ip_address:": "192.168.1.21",
450                 "ip_range_start": "192.168.1.20",
451                 "ip_range_end": "192.168.1.29",
452                 "floating_ip_address": {
453                     "external_network": "extnet01",
454                     "ip_address": "10.43.53.23"
455                 },
456                 "service_ip_address": "192.168.1.23",
457                 "order": 1,
458                 "bandwidth": 1000,
459                 "vnic_type": "normal",
460                 "allowed_address_pairs": [
461                     {
462                         "ip": "192.168.1.13",
463                         "mac": "00:f3:43:20:a2:a3"
464                     }
465                 ],
466                 "bond": "none",
467                 "bond_index": 1,
468                 "macbond": "00:d9:00:82:11:d1",
469                 "sfc_encapsulation": "",
470                 "direction": "",
471                 "gateway_ip": "192.168.199.1",
472                 "netmask": "255.255.255.0",
473                 "interface_name": "fe-01-02",
474                 "is_virtual": False,
475                 "function": "control"
476             },
477             "vl_id": "vldId1",
478             "vdu_id": "vdu1Id"
479         }
480     ],
481     'local_storages': [
482
483     ],
484 }
485
486 # get_tenant_id
487 c1_data_get_tenant_id = {
488     "tenants": [
489         {
490             "id": "1",
491             "name": "chinamobile"
492         }
493     ]
494 }
495 c1_data_get_tenant_id_1 = {
496     "tenants": [
497         {
498             "id": "1",
499             "name": "tenantname"
500         }
501     ]
502 }
503
504
505 # create_volume
506 c2_data_create_volume = {
507     "id": "4bd3e9eb-cd8b-456a-8589-910836a0ab31",
508     "name": "volume1",
509     "returnCode": 1,
510     "vimId": "vim_volume_1",
511     "vimName": "vim_volume_1",
512     "tenantId": "vim_volume_1",
513     "volumeType": "123",
514     "availabilityZone": "availabilityZone",
515     "status": "availuable",
516     "createTime": "2015-12-02T06:39:40.000000",
517     "type": None,
518     "size": 40
519 }
520
521 # get_volume
522 c3_data_get_volume = {
523     "status": "available",
524     "name": "wangsong",
525     "attachments": [
526         {
527             "device": "/dev/vdc",
528             "serverId": "3030e666-528e-4954-88f5-cc21dab1262b",
529             "volumeId": "4bd3e9eb-cd8b-456a-8589-910836a0ab31",
530             "hostName": None,
531             "id": "4bd3e9eb-cd8b-456a-8589-910836a0ab31"
532         }
533     ],
534     "createTime": "2015-12-02T06:39:40.000000",
535     "type": None,
536     "id": "4bd3e9eb-cd8b-456a-8589-910836a0ab31",
537     "size": 40
538 }
539
540 # create_network
541 c4_data_create_network = {
542     "returnCode": 0,
543     "vimId": "11111",
544     "vimName": "11111",
545     "status": "ACTIVE",
546     "id": "3c9eebdbbfd345658269340b9ea6fb73",
547     "name": "net1",
548     "tenantId": "tenant1",
549     "networkName": "ommnet",
550     "shared": True,
551     "vlanTransparent": True,
552     "networkType": "vlan",
553     "segmentationId": 202,
554     "physicalNetwork": "physnet1",
555     "routerExternal": False
556 }
557
558 # create_subnet
559 c5_data_create_subnet = {
560     "returnCode": 0,
561     "vimId": "11111",
562     "vimName": "11111",
563     "status": " ACTIVE",
564     "id": "d62019d3-bc6e-4319-9c1d-6722fc136a23",
565     "tenantId": "tenant1",
566     "networkId": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
567     "networkName": "networkName",
568     "name": "subnet1",
569     "cidr": "10.43.35.0/24",
570     "ipVersion": 4,
571     "enableDhcp": 1,
572     "gatewayIp": "10.43.35.1",
573     "dnsNameservers": [],
574     "allocationPools": [
575         {
576             "start": "192.168.199.2",
577             "end": "192.168.199.254"
578         }
579     ],
580     "hostRoutes": []
581 }
582
583 # create_ports
584 c6_data_create_port = {
585     "returnCode": 0,
586     "vimId": "11111",
587     "vimName": "11111",
588     "status": " ACTIVE",
589     "id": " 872019d3-bc6e-4319-9c1d-6722fc136afg",
590     "tenantId": "tenant1",
591     "name": "subnet1",
592     "networkId": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
593     "networkName": "networkName",
594     "subnetId": "d62019d3-bc6e-4319-9c1d-6722fc136a23",
595     "subnetName": "subnet1",
596     "macAddress": "212.12.61.23",
597     "ip": "10.43.38.11",
598     "vnicType": "direct",
599     "securityGroups": ""
600 }
601
602 # create_flavor
603 c7_data_create_flavor = {
604     "returnCode": 0,
605     "vimId": "11111",
606     "vimName": "11111",
607     "id": "142019d3-bc6e-4319-9c1d-6722fc136afg",
608     "tenantId": "tenant1",
609     "name": "subnet1",
610     "vcpu": 5,
611     "memory": 2,
612     "disk": 40,
613     "ephemeral": 40,
614     "swap": 20,
615     "isPublic": True,
616     "extraSpecs": "testtt"
617 }
618
619 # list_image
620 c8_data_list_image = {
621     "vimid": "",
622     "vimname": "",
623     "images": [
624         {
625             "status": "active",
626             "id": "5e2757c1-f846-4727-915c-9a872553ed75",
627             "size": 862016,
628             "name": u'sss.vmdk'
629         }
630     ]
631 }
632
633 # create_vm
634 c9_data_create_vm = {
635     "returnCode": 1,
636     "id": "3c9eebdbbfd345658269340b9ea6fb73",
637     "name": "vm1",
638     "vimId": "11111",
639     "vimName": "11111",
640     "tenantId": "tenant1",
641     "boot": "boot_1",
642     "nicArray": "dfdf",
643     "volumeArray": "dfdf",
644     "availabilityZone": "fdvfdv",
645     "flavorId": "fdvfdv",
646     "metadata": "fdvfdv",
647     "securityGroups": "fdvfdv",
648     "serverGroup": "fdvfdv",
649     "status": "ACTIVE"
650 }
651
652 # get_vm
653 c10_data_get_vm = {
654     "returnCode": 1,
655     "id": "3c9eebdbbfd345658269340b9ea6fb73",
656     "name": "vm1",
657     "vimId": "11111",
658     "vimName": "11111",
659     "tenantId": "tenant1",
660     "status": "ACTIVE"
661 }
662
663 vnfdModel = {
664     "volume_storages": [
665         {
666             "volume_storage_id": "test",
667             "properties": {
668                 "location_info": {
669                     "vimid": "vim_1",
670                     "tenant": "chinamobile",
671                     "availability_zone": "test",
672                 },
673                 "volume_name": "test",
674                 "custom_volume_type": "test",
675                 "size": "10 GB",
676             },
677             "image_file": "test",
678         },
679     ],
680     "vls": [
681         {
682             "vl_id": "test",
683             "properties": {
684                 "location_info": {
685                     "vimid": "test",
686                     "tenant": "chinamobile",
687                 },
688                 "vl_profile": {
689                     "networkName": "test",
690                     "networkType": "test",
691                     "physicalNetwork": "test",
692                     "vlanTransparent": "test",
693                     "segmentationId": "1",
694                     "cidr": "test",
695                     "dhcpEnabled": "test",
696                     "gatewayIp": "test",
697                     "startIp": "test",
698                     "endIp": "test",
699                 },
700                 "connectivity_type": {
701                     "layer_protocol": "ipv4",
702                 },
703                 "dns_nameservers": "test",
704                 "host_routes": "test",
705             },
706             "route_external": "test",
707         }
708     ],
709     "cps": [
710         {
711             "vdu_id": "test",
712             "cp_id": "cp1",
713             "networkId": "",  # TODO
714             "subnetId": "",  # TODO
715             "vl_id": "test",
716             "properties": {
717                 "name": "test",
718                 "mac_address": "test",
719                 "protocol_data": [
720                     {
721                         "address_data": {
722                             "l3_address_data": {
723                                 "fixed_ip_address": "test"
724                             },
725                         },
726                     },
727                 ],
728                 "vnic_type": "direct",
729                 "role": "root",
730                 "virtual_network_interface_requirements": [
731                     {
732                         "network_interface_requirements": {
733                             "interfaceType": '{"schema-version": "0", "schema-location":"", "platform-id": "generic", "mandatory": false, "configuration-value": "SR-IOV"}'
734                         },
735                         "support_mandatory": False,
736                         "name": "SRIOV_Port",
737                         "description": "sriov"
738                     }
739                 ]
740             }
741         }
742     ],
743     "vdus": [
744         {
745             "vdu_id": "test",
746             "properties": {
747                 "location_info": {
748                     "vimid": "test",
749                     "tenant": "chinamobile",
750                     "availability_zone": "test",
751                     "vnfId": "",
752                     "vnfName": "",
753                     "cloudOwner": "",
754                     "cloudRegionId": "",
755                     "vduInfo": [
756                         {
757                             "vduName": "VDU_vbng_0",
758                             "flavorName": "flavor_1",
759                             "directive": ""
760                         }
761                     ]
762                 },
763                 "name": "test",
764                 "inject_files": [],
765                 "user_data": "test",
766                 "meta_data": {},
767             },
768             "cps": [],
769             "type": "tosca.nodes.nfv.Vdu.Compute",
770             "virtual_compute": {
771                 "virtual_cpu": {
772                     "num_virtual_cpu": "16",
773                 },
774                 "virtual_memory": {
775                     "virtual_mem_size": "8000 MB",
776                     "vdu_memory_requirements": {
777                         "memoryPageSize": "8 MB",
778                     },
779                 },
780             },
781             "virtual_storage": {
782                 "type_of_storage": "ephemeral",
783                 "size_of_storage": "10 GB",
784             },
785             "type": "tosca.nodes.nfv.Vdu.Compute",
786             "artifacts": [
787                 {
788                     "artifact_name": "sw_image",
789                     "file": "sss.vmdk",
790                 },
791             ],
792             "volume_storages": [
793                 {
794                     "volume_storage_id": "test",
795                 }
796             ],
797         },
798     ],
799     "image_files": [],
800     "routers": [],
801     "local_storages": [],
802     "vnf_exposed": {
803         "external_cps": [],
804         "forward_cps": []
805     },
806     "inputs": {
807         "pe1_id": {
808             "type": "string",
809             "description": "pe1_idofunderlayvpn"
810         },
811         "pe2_id": {
812             "type": "string",
813             "description": "pe2_idofunderlayvpn"
814         },
815         "serviceType": {
816             "type": "string",
817             "description": "serviceTypeofunderlayvpn"
818         },
819         "description": {
820             "type": "string",
821             "description": "descriptionofunderlayvpn"
822         },
823         "ac2_route": {
824             "type": "string",
825             "description": "ac2_routeofunderlayvpn"
826         },
827         "ac1_route": {
828             "type": "string",
829             "description": "ac1_routeofunderlayvpn"
830         },
831         "ac1_svlan": {
832             "type": "integer",
833             "description": "ac1_svlanofunderlayvpn"
834         },
835         "ac2_ip": {
836             "type": "string",
837             "description": "ac2_ipofunderlayvpn"
838         },
839         "ac1_ip": {
840             "type": "string",
841             "description": "ac1_ipofunderlayvpn"
842         },
843         "ac2_port": {
844             "type": "string",
845             "description": "ac2_portofunderlayvpn"
846         },
847         "topology": {
848             "type": "string",
849             "description": "topologyofunderlayvpn"
850         },
851         "technology": {
852             "type": "string",
853             "description": "technologyofunderlayvpn"
854         },
855         "ac1_port": {
856             "type": "string",
857             "description": "ac1_portofunderlayvpn"
858         },
859         "ac2_svlan": {
860             "type": "integer",
861             "description": "ac2_svlanofunderlayvpn"
862         },
863         "name": {
864             "type": "string",
865             "description": "Nameofunderlayervpn"
866         }
867     },
868     "metadata": {
869         "designer": "sdno",
870         "name": "underlayervpn",
871         "csarVersion": "1.0",
872         "csarType": "SSAR",
873         "csarProvider": "huawei",
874         "version": "1.0",
875         "type": "SSAR",
876         "id": "ns_underlayervpn_1_0"
877     }
878 }
879
880 vnfpackage_info = {
881     "imageInfo": [],
882     "csarId": "vOpenNAT",
883     "packageInfo": {
884         "csarName": "vOpenNAT.csar",
885         "vnfdModel": json.dumps(vnfdModel),
886         "vnfdProvider": "Intel",
887         "vnfdId": "openNAT_1.0",
888         "downloadUrl": "http://10.96.33.39:8806/static/catalog/vOpenNAT/vOpenNAT.csar",
889         "vnfVersion": "v1.0",
890         "vnfdVersion": "v1.0",
891         "vnfPackageId": "vOpenNAT"
892     }
893 }
894
895 # # vnfd_rawdata
896 # vnfd_rawdata = {
897 #     "rawData": {
898 #         "instance": {
899 #             "metadata": {
900 #                 "designer": "sdno",
901 #                 "name": "underlayervpn",
902 #                 "csarVersion": "1.0",
903 #                 "csarType": "SSAR",
904 #                 "csarProvider": "huawei",
905 #                 "version": "1.0",
906 #                 "type": "SSAR",
907 #                 "id": "ns_underlayervpn_1_0"
908 #             },
909 #             "nodes": [
910 #                 {
911 #                     "id": "ac2_fdhrbk3dvan8hl5wifm9lp1e9",
912 #                     "type_name": "tosca.nodes.sdn.l3ac",
913 #                     "template_name": "ac2",
914 #                     "properties": {
915 #                         "ip": {
916 #                             "type_name": "string"
917 #                         },
918 #                         "route": {
919 #                             "type_name": "string"
920 #                         },
921 #                         "port": {
922 #                             "type_name": "string"
923 #                         },
924 #                         "svlan": {
925 #                             "type_name": "string"
926 #                         }
927 #                     },
928 #                     "interfaces": [
929 #                         {
930 #                             "name": "Standard",
931 #                             "type_name": "tosca.interfaces.node.lifecycle.Standard"
932 #                         }
933 #                     ],
934 #                     "capabilities": [
935 #                         {
936 #                             "name": "feature",
937 #                             "type_name": "tosca.capabilities.Node"
938 #                         },
939 #                         {
940 #                             "name": "ac",
941 #                             "type_name": "tosca.capabilities.sdn.ac"
942 #                         }
943 #                     ],
944 #                     "relationships": [
945 #                         {
946 #                             "target_node_id": "pe2_go3vo1ctxr1vlbl0ij8stbtj6",
947 #                             "target_capability_name": "feature"
948 #                         },
949 #                         {
950 #                             "target_node_id": "ac2_fdhrbk3dvan8hl5wifm9lp1e9",
951 #                             "target_capability_name": "feature"
952 #                         }
953 #                     ]
954 #                 },
955 #                 {
956 #                     "id": "ac1_jqows1ai0j0cmwk9jdvuknt97",
957 #                     "type_name": "tosca.nodes.sdn.l3ac",
958 #                     "template_name": "ac1",
959 #                     "properties": {
960 #                         "ip": {
961 #                             "type_name": "string"
962 #                         },
963 #                         "route": {
964 #                             "type_name": "string"
965 #                         },
966 #                         "port": {
967 #                             "type_name": "string"
968 #                         },
969 #                         "svlan": {
970 #                             "type_name": "string"
971 #                         }
972 #                     },
973 #                     "interfaces": [
974 #                         {
975 #                             "name": "Standard",
976 #                             "type_name": "tosca.interfaces.node.lifecycle.Standard"
977 #                         }
978 #                     ],
979 #                     "capabilities": [
980 #                         {
981 #                             "name": "feature",
982 #                             "type_name": "tosca.capabilities.Node"
983 #                         },
984 #                         {
985 #                             "name": "ac",
986 #                             "type_name": "tosca.capabilities.sdn.ac"
987 #                         }
988 #                     ],
989 #                     "relationships": [
990 #                         {
991 #                             "target_node_id": "pe1_e58ekps6m45g6w9egs9lue2j7",
992 #                             "target_capability_name": "feature"
993 #                         },
994 #                         {
995 #                             "target_node_id": "ac2_fdhrbk3dvan8hl5wifm9lp1e9",
996 #                             "target_capability_name": "feature"
997 #                         }
998 #                     ]
999 #                 },
1000 #                 {
1001 #                     "id": "vpn_ie0xim076f7cje67fvrrq9tg1",
1002 #                     "type_name": "tosca.nodes.sdn.underlayVPN",
1003 #                     "template_name": "vpn",
1004 #                     "properties": {
1005 #                         "serviceType": {
1006 #                             "type_name": "string"
1007 #                         },
1008 #                         "description": {
1009 #                             "type_name": "string"
1010 #                         },
1011 #                         "name": {
1012 #                             "type_name": "string"
1013 #                         },
1014 #                         "topology": {
1015 #                             "type_name": "string"
1016 #                         }
1017 #                     },
1018 #                     "interfaces": [
1019 #                         {
1020 #                             "name": "Standard",
1021 #                             "type_name": "tosca.interfaces.node.lifecycle.Standard"
1022 #                         }
1023 #                     ],
1024 #                     "capabilities": [
1025 #                         {
1026 #                             "name": "feature",
1027 #                             "type_name": "tosca.capabilities.Node"
1028 #                         }
1029 #                     ],
1030 #                     "relationships": [
1031 #                         {
1032 #                             "target_node_id": "ac1_jqows1ai0j0cmwk9jdvuknt97",
1033 #                             "target_capability_name": "feature"
1034 #                         },
1035 #                         {
1036 #                             "target_node_id": "ac2_fdhrbk3dvan8hl5wifm9lp1e9",
1037 #                             "target_capability_name": "feature"
1038 #                         }
1039 #                     ]
1040 #                 },
1041 #                 {
1042 #                     "id": "pe1_e58ekps6m45g6w9egs9lue2j7",
1043 #                     "type_name": "tosca.nodes.sdn.l3pe",
1044 #                     "template_name": "pe1",
1045 #                     "properties": {
1046 #                         "id": {
1047 #                             "type_name": "string"
1048 #                         }
1049 #                     },
1050 #                     "interfaces": [
1051 #                         {
1052 #                             "name": "Standard",
1053 #                             "type_name": "tosca.interfaces.node.lifecycle.Standard"
1054 #                         }
1055 #                     ],
1056 #                     "capabilities": [
1057 #                         {
1058 #                             "name": "feature",
1059 #                             "type_name": "tosca.capabilities.Node"
1060 #                         },
1061 #                         {
1062 #                             "name": "pe",
1063 #                             "type_name": "tosca.capabilities.sdn.pe"
1064 #                         }
1065 #                     ]
1066 #                 },
1067 #                 {
1068 #                     "id": "pe2_go3vo1ctxr1vlbl0ij8stbtj6",
1069 #                     "type_name": "tosca.nodes.sdn.l3pe",
1070 #                     "template_name": "pe2",
1071 #                     "properties": {
1072 #                         "id": {
1073 #                             "type_name": "string"
1074 #                         }
1075 #                     },
1076 #                     "interfaces": [
1077 #                         {
1078 #                             "name": "Standard",
1079 #                             "type_name": "tosca.interfaces.node.lifecycle.Standard"
1080 #                         }
1081 #                     ],
1082 #                     "capabilities": [
1083 #                         {
1084 #                             "name": "feature",
1085 #                             "type_name": "tosca.capabilities.Node"
1086 #                         },
1087 #                         {
1088 #                             "name": "pe",
1089 #                             "type_name": "tosca.capabilities.sdn.pe"
1090 #                         }
1091 #                     ]
1092 #                 }
1093 #             ],
1094 #             "substitution": {
1095 #                 "node_type_name": "tosca.nodes.sdn.ext.NS.ns_underlayervpn"
1096 #             },
1097 #             "inputs": {
1098 #                 "ac2_ip": {
1099 #                     "type_name": "string",
1100 #                     "description": "ac2_ipofunderlayvpn"
1101 #                 },
1102 #                 "ac2_route": {
1103 #                     "type_name": "string",
1104 #                     "description": "ac2_routeofunderlayvpn"
1105 #                 },
1106 #                 "serviceType": {
1107 #                     "type_name": "string",
1108 #                     "description": "serviceTypeofunderlayvpn"
1109 #                 },
1110 #                 "description": {
1111 #                     "type_name": "string",
1112 #                     "description": "descriptionofunderlayvpn"
1113 #                 },
1114 #                 "pe2_id": {
1115 #                     "type_name": "string",
1116 #                     "description": "pe2_idofunderlayvpn"
1117 #                 },
1118 #                 "ac1_route": {
1119 #                     "type_name": "string",
1120 #                     "description": "ac1_routeofunderlayvpn"
1121 #                 },
1122 #                 "ac1_svlan": {
1123 #                     "type_name": "integer",
1124 #                     "description": "ac1_svlanofunderlayvpn"
1125 #                 },
1126 #                 "name": {
1127 #                     "type_name": "string",
1128 #                     "description": "Nameofunderlayervpn"
1129 #                 },
1130 #                 "ac1_ip": {
1131 #                     "type_name": "string",
1132 #                     "description": "ac1_ipofunderlayvpn"
1133 #                 },
1134 #                 "ac2_port": {
1135 #                     "type_name": "string",
1136 #                     "description": "ac2_portofunderlayvpn"
1137 #                 },
1138 #                 "pe1_id": {
1139 #                     "type_name": "string",
1140 #                     "description": "pe1_idofunderlayvpn"
1141 #                 },
1142 #                 "technology": {
1143 #                     "type_name": "string",
1144 #                     "description": "technologyofunderlayvpn"
1145 #                 },
1146 #                 "ac1_port": {
1147 #                     "type_name": "string",
1148 #                     "description": "ac1_portofunderlayvpn"
1149 #                 },
1150 #                 "ac2_svlan": {
1151 #                     "type_name": "integer",
1152 #                     "description": "ac2_svlanofunderlayvpn"
1153 #                 },
1154 #                 "topology": {
1155 #                     "type_name": "string",
1156 #                     "description": "topologyofunderlayvpn"
1157 #                 }
1158 #             }
1159 #         }
1160 #     }
1161 # }