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