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