Merge "Add notification system util in GVNFM"
[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                 },
719                 "name": "test",
720                 "inject_files": [],
721                 "user_data": "test",
722                 "meta_data": {},
723             },
724             "cps": [],
725             "type": "tosca.nodes.nfv.Vdu.Compute",
726             "virtual_compute": {
727                 "virtual_cpu": {
728                     "num_virtual_cpu": "16",
729                 },
730                 "virtual_memory": {
731                     "virtual_mem_size": "8000 MB",
732                     "vdu_memory_requirements": {
733                         "memoryPageSize": "8 MB",
734                     },
735                 },
736             },
737             "virtual_storage": {
738                 "type_of_storage": "ephemeral",
739                 "size_of_storage": "10 GB",
740             },
741             "type": "tosca.nodes.nfv.Vdu.Compute",
742             "artifacts": [
743                 {
744                     "artifact_name": "sw_image",
745                     "file": "sss.vmdk",
746                 },
747             ],
748             "volume_storages": [
749                 {
750                     "volume_storage_id": "test",
751                 }
752             ],
753         },
754     ],
755     "image_files": [],
756     "routers": [],
757     "local_storages": [],
758     "vnf_exposed": {
759         "external_cps": [],
760         "forward_cps": []
761     },
762     "inputs": {
763         "pe1_id": {
764             "type": "string",
765             "description": "pe1_idofunderlayvpn"
766         },
767         "pe2_id": {
768             "type": "string",
769             "description": "pe2_idofunderlayvpn"
770         },
771         "serviceType": {
772             "type": "string",
773             "description": "serviceTypeofunderlayvpn"
774         },
775         "description": {
776             "type": "string",
777             "description": "descriptionofunderlayvpn"
778         },
779         "ac2_route": {
780             "type": "string",
781             "description": "ac2_routeofunderlayvpn"
782         },
783         "ac1_route": {
784             "type": "string",
785             "description": "ac1_routeofunderlayvpn"
786         },
787         "ac1_svlan": {
788             "type": "integer",
789             "description": "ac1_svlanofunderlayvpn"
790         },
791         "ac2_ip": {
792             "type": "string",
793             "description": "ac2_ipofunderlayvpn"
794         },
795         "ac1_ip": {
796             "type": "string",
797             "description": "ac1_ipofunderlayvpn"
798         },
799         "ac2_port": {
800             "type": "string",
801             "description": "ac2_portofunderlayvpn"
802         },
803         "topology": {
804             "type": "string",
805             "description": "topologyofunderlayvpn"
806         },
807         "technology": {
808             "type": "string",
809             "description": "technologyofunderlayvpn"
810         },
811         "ac1_port": {
812             "type": "string",
813             "description": "ac1_portofunderlayvpn"
814         },
815         "ac2_svlan": {
816             "type": "integer",
817             "description": "ac2_svlanofunderlayvpn"
818         },
819         "name": {
820             "type": "string",
821             "description": "Nameofunderlayervpn"
822         }
823     },
824     "metadata": {
825         "designer": "sdno",
826         "name": "underlayervpn",
827         "csarVersion": "1.0",
828         "csarType": "SSAR",
829         "csarProvider": "huawei",
830         "version": "1.0",
831         "type": "SSAR",
832         "id": "ns_underlayervpn_1_0"
833     }
834 }
835
836 vnfpackage_info = {
837     "imageInfo": [],
838     "csarId": "vOpenNAT",
839     "packageInfo": {
840         "csarName": "vOpenNAT.csar",
841         "vnfdModel": json.dumps(vnfdModel),
842         "vnfdProvider": "Intel",
843         "vnfdId": "openNAT_1.0",
844         "downloadUrl": "http://10.96.33.39:8806/static/catalog/vOpenNAT/vOpenNAT.csar",
845         "vnfVersion": "v1.0",
846         "vnfdVersion": "v1.0",
847         "vnfPackageId": "vOpenNAT"
848     }
849 }
850
851 # # vnfd_rawdata
852 # vnfd_rawdata = {
853 #     "rawData": {
854 #         "instance": {
855 #             "metadata": {
856 #                 "designer": "sdno",
857 #                 "name": "underlayervpn",
858 #                 "csarVersion": "1.0",
859 #                 "csarType": "SSAR",
860 #                 "csarProvider": "huawei",
861 #                 "version": "1.0",
862 #                 "type": "SSAR",
863 #                 "id": "ns_underlayervpn_1_0"
864 #             },
865 #             "nodes": [
866 #                 {
867 #                     "id": "ac2_fdhrbk3dvan8hl5wifm9lp1e9",
868 #                     "type_name": "tosca.nodes.sdn.l3ac",
869 #                     "template_name": "ac2",
870 #                     "properties": {
871 #                         "ip": {
872 #                             "type_name": "string"
873 #                         },
874 #                         "route": {
875 #                             "type_name": "string"
876 #                         },
877 #                         "port": {
878 #                             "type_name": "string"
879 #                         },
880 #                         "svlan": {
881 #                             "type_name": "string"
882 #                         }
883 #                     },
884 #                     "interfaces": [
885 #                         {
886 #                             "name": "Standard",
887 #                             "type_name": "tosca.interfaces.node.lifecycle.Standard"
888 #                         }
889 #                     ],
890 #                     "capabilities": [
891 #                         {
892 #                             "name": "feature",
893 #                             "type_name": "tosca.capabilities.Node"
894 #                         },
895 #                         {
896 #                             "name": "ac",
897 #                             "type_name": "tosca.capabilities.sdn.ac"
898 #                         }
899 #                     ],
900 #                     "relationships": [
901 #                         {
902 #                             "target_node_id": "pe2_go3vo1ctxr1vlbl0ij8stbtj6",
903 #                             "target_capability_name": "feature"
904 #                         },
905 #                         {
906 #                             "target_node_id": "ac2_fdhrbk3dvan8hl5wifm9lp1e9",
907 #                             "target_capability_name": "feature"
908 #                         }
909 #                     ]
910 #                 },
911 #                 {
912 #                     "id": "ac1_jqows1ai0j0cmwk9jdvuknt97",
913 #                     "type_name": "tosca.nodes.sdn.l3ac",
914 #                     "template_name": "ac1",
915 #                     "properties": {
916 #                         "ip": {
917 #                             "type_name": "string"
918 #                         },
919 #                         "route": {
920 #                             "type_name": "string"
921 #                         },
922 #                         "port": {
923 #                             "type_name": "string"
924 #                         },
925 #                         "svlan": {
926 #                             "type_name": "string"
927 #                         }
928 #                     },
929 #                     "interfaces": [
930 #                         {
931 #                             "name": "Standard",
932 #                             "type_name": "tosca.interfaces.node.lifecycle.Standard"
933 #                         }
934 #                     ],
935 #                     "capabilities": [
936 #                         {
937 #                             "name": "feature",
938 #                             "type_name": "tosca.capabilities.Node"
939 #                         },
940 #                         {
941 #                             "name": "ac",
942 #                             "type_name": "tosca.capabilities.sdn.ac"
943 #                         }
944 #                     ],
945 #                     "relationships": [
946 #                         {
947 #                             "target_node_id": "pe1_e58ekps6m45g6w9egs9lue2j7",
948 #                             "target_capability_name": "feature"
949 #                         },
950 #                         {
951 #                             "target_node_id": "ac2_fdhrbk3dvan8hl5wifm9lp1e9",
952 #                             "target_capability_name": "feature"
953 #                         }
954 #                     ]
955 #                 },
956 #                 {
957 #                     "id": "vpn_ie0xim076f7cje67fvrrq9tg1",
958 #                     "type_name": "tosca.nodes.sdn.underlayVPN",
959 #                     "template_name": "vpn",
960 #                     "properties": {
961 #                         "serviceType": {
962 #                             "type_name": "string"
963 #                         },
964 #                         "description": {
965 #                             "type_name": "string"
966 #                         },
967 #                         "name": {
968 #                             "type_name": "string"
969 #                         },
970 #                         "topology": {
971 #                             "type_name": "string"
972 #                         }
973 #                     },
974 #                     "interfaces": [
975 #                         {
976 #                             "name": "Standard",
977 #                             "type_name": "tosca.interfaces.node.lifecycle.Standard"
978 #                         }
979 #                     ],
980 #                     "capabilities": [
981 #                         {
982 #                             "name": "feature",
983 #                             "type_name": "tosca.capabilities.Node"
984 #                         }
985 #                     ],
986 #                     "relationships": [
987 #                         {
988 #                             "target_node_id": "ac1_jqows1ai0j0cmwk9jdvuknt97",
989 #                             "target_capability_name": "feature"
990 #                         },
991 #                         {
992 #                             "target_node_id": "ac2_fdhrbk3dvan8hl5wifm9lp1e9",
993 #                             "target_capability_name": "feature"
994 #                         }
995 #                     ]
996 #                 },
997 #                 {
998 #                     "id": "pe1_e58ekps6m45g6w9egs9lue2j7",
999 #                     "type_name": "tosca.nodes.sdn.l3pe",
1000 #                     "template_name": "pe1",
1001 #                     "properties": {
1002 #                         "id": {
1003 #                             "type_name": "string"
1004 #                         }
1005 #                     },
1006 #                     "interfaces": [
1007 #                         {
1008 #                             "name": "Standard",
1009 #                             "type_name": "tosca.interfaces.node.lifecycle.Standard"
1010 #                         }
1011 #                     ],
1012 #                     "capabilities": [
1013 #                         {
1014 #                             "name": "feature",
1015 #                             "type_name": "tosca.capabilities.Node"
1016 #                         },
1017 #                         {
1018 #                             "name": "pe",
1019 #                             "type_name": "tosca.capabilities.sdn.pe"
1020 #                         }
1021 #                     ]
1022 #                 },
1023 #                 {
1024 #                     "id": "pe2_go3vo1ctxr1vlbl0ij8stbtj6",
1025 #                     "type_name": "tosca.nodes.sdn.l3pe",
1026 #                     "template_name": "pe2",
1027 #                     "properties": {
1028 #                         "id": {
1029 #                             "type_name": "string"
1030 #                         }
1031 #                     },
1032 #                     "interfaces": [
1033 #                         {
1034 #                             "name": "Standard",
1035 #                             "type_name": "tosca.interfaces.node.lifecycle.Standard"
1036 #                         }
1037 #                     ],
1038 #                     "capabilities": [
1039 #                         {
1040 #                             "name": "feature",
1041 #                             "type_name": "tosca.capabilities.Node"
1042 #                         },
1043 #                         {
1044 #                             "name": "pe",
1045 #                             "type_name": "tosca.capabilities.sdn.pe"
1046 #                         }
1047 #                     ]
1048 #                 }
1049 #             ],
1050 #             "substitution": {
1051 #                 "node_type_name": "tosca.nodes.sdn.ext.NS.ns_underlayervpn"
1052 #             },
1053 #             "inputs": {
1054 #                 "ac2_ip": {
1055 #                     "type_name": "string",
1056 #                     "description": "ac2_ipofunderlayvpn"
1057 #                 },
1058 #                 "ac2_route": {
1059 #                     "type_name": "string",
1060 #                     "description": "ac2_routeofunderlayvpn"
1061 #                 },
1062 #                 "serviceType": {
1063 #                     "type_name": "string",
1064 #                     "description": "serviceTypeofunderlayvpn"
1065 #                 },
1066 #                 "description": {
1067 #                     "type_name": "string",
1068 #                     "description": "descriptionofunderlayvpn"
1069 #                 },
1070 #                 "pe2_id": {
1071 #                     "type_name": "string",
1072 #                     "description": "pe2_idofunderlayvpn"
1073 #                 },
1074 #                 "ac1_route": {
1075 #                     "type_name": "string",
1076 #                     "description": "ac1_routeofunderlayvpn"
1077 #                 },
1078 #                 "ac1_svlan": {
1079 #                     "type_name": "integer",
1080 #                     "description": "ac1_svlanofunderlayvpn"
1081 #                 },
1082 #                 "name": {
1083 #                     "type_name": "string",
1084 #                     "description": "Nameofunderlayervpn"
1085 #                 },
1086 #                 "ac1_ip": {
1087 #                     "type_name": "string",
1088 #                     "description": "ac1_ipofunderlayvpn"
1089 #                 },
1090 #                 "ac2_port": {
1091 #                     "type_name": "string",
1092 #                     "description": "ac2_portofunderlayvpn"
1093 #                 },
1094 #                 "pe1_id": {
1095 #                     "type_name": "string",
1096 #                     "description": "pe1_idofunderlayvpn"
1097 #                 },
1098 #                 "technology": {
1099 #                     "type_name": "string",
1100 #                     "description": "technologyofunderlayvpn"
1101 #                 },
1102 #                 "ac1_port": {
1103 #                     "type_name": "string",
1104 #                     "description": "ac1_portofunderlayvpn"
1105 #                 },
1106 #                 "ac2_svlan": {
1107 #                     "type_name": "integer",
1108 #                     "description": "ac2_svlanofunderlayvpn"
1109 #                 },
1110 #                 "topology": {
1111 #                     "type_name": "string",
1112 #                     "description": "topologyofunderlayvpn"
1113 #                 }
1114 #             }
1115 #         }
1116 #     }
1117 # }