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