Implement of reporting port instance data from GVNFM to NFVO
[vfc/gvnfm/vnflcm.git] / lcm / lcm / nf / tests / const.py
1 # Copyright (C) 2019 ZTE. All Rights Reserved.
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 instantiate_grant_result = {
17     "vimConnections": [
18         {
19             "vimid": 'vim_1',
20             "accessInfo":
21                 {
22                     "tenant": 'chinamobile'
23                 }
24         },
25     ],
26     "vnfId": "413aa1fe-b4d1-11e8-8268-dff5aab95c63",
27     "vimAssets": {
28         "computeResourceFlavours": [
29             {
30                 "resourceProviderId": "vgw",
31                 "vimFlavourId": "yui",
32                 "vimConnectionId": ""
33             },
34         ]
35     }
36 }
37
38 inst_req_data = {
39     "flavourId": "flavour_1",
40     "instantiationLevelId": "instantiationLevel_1",
41     "extVirtualLinks": [
42         {
43             "id": "extVirtualLink_1",
44             "vimConnectionId": "vimConnection_1",
45             "resourceProviderId": "resourceProvider_1",
46             "resourceId": "resource_1",
47             "resourceSubnetId": "resourceSubnet_1",
48             "extCps": [
49                 {
50                     "cpdId": "cpd_1",
51                     "cpConfig": [
52                         {
53                             "cpInstanceId": "cpInstance_1",
54                             "linkPortId": "linkPort_1",
55                             "cpProtocolData": [
56                                 {
57                                     "layerProtocol": "IP_OVER_ETHERNET",
58                                     "ipOverEthernet": {
59                                         "macAddress": "00:f3:43:20:a2:a3",
60                                         "ipAddresses": [
61                                             {
62                                                 "type": "IPV4",
63                                                 "fixedAddresses": ["192.168.104.2", ],
64                                                 "numDynamicAddresses": 0,
65                                                 "addressRange": None,
66                                                 "subnetId": "subnet_1",
67                                             }
68                                         ]
69                                     }
70                                 }
71                             ]
72                         }
73                     ]
74                 }
75             ],
76             "extLinkPorts": [
77                 {
78                     "id": "extLinkPort_1",
79                     "resourceHandle": {
80                         "vimConnectionId": "vimConnection_1",
81                         "resourceProviderId": "resourceProvider_1",
82                         "resourceId": "resource_1",
83                         "vimLevelResourceType": "vimLevelResourceType_1",
84                         "tenant": "f7b17b0afd374d48a322e95cf4258eec",
85                         "ipAddress": "10.0.101.1",
86                         "macAddress": "fa:16:3e:a3:ac:5e",
87                         "instId": "fb86af68-be48-4804-a454-3892333b9d4a",
88                         "portid": "2dddd81b-a8d4-41f4-8a90-8f334bbbbe3b",
89                         "networkid": "7d907188-46f0-4aa7-b61b-f2d349554a1b",
90                         "subnetworkid": "08ef29e0-5e61-436a-a9ee-6a4ac502a622"
91                     }
92                 }
93             ]
94         }
95     ],
96     "extManagedVirtualLinks": [
97         {
98             "id": 'extManagedVirtualLink_1',
99             "virtualLinkDescId": 'virtualLinkDesc_1',
100             "vimConnectionId": 'vimConnection_1',
101             "resourceProviderId": 'resourceProvider_1',
102             "resourceId": 'resource_1',
103         }
104     ],
105     "vimConnectionInfo": [
106         {
107             "id": 'vimConnection_1',
108             "vimId": 'vim_1',
109             "vimType": 'vim',
110             "interfaceInfo": {
111                 "apiVersion": "apiVersion_1",
112                 "protocolType": "http"
113             },
114             "accessInfo": {
115                 "tenant": "tenant_vCPE",
116                 "username": "vCPE",
117                 "password": "vCPE_321",
118             },
119             "extra": None,
120         }
121     ],
122     "localizationLanguage": "en_US",
123     "additionalParams": {
124         "vimId": "vim_1",
125         "key1": "test1",
126         "key2": "test2",
127     }
128 }
129
130 vnfd_model_dict = {
131     'metadata': {
132         'vendor': 'zte',
133         'is_shared': False,
134         'description': '',
135         'domain_type': 'CN',
136         'version': 'v4.14.10',
137         'vmnumber_overquota_alarm': False,
138         'cross_dc': False,
139         'vnf_type': 'SSS',
140         'vnfd_version': 'V00000001',
141         'id': 'sss-vnf-template',
142         'name': 'sss-vnf-template'
143     },
144     'vdus': [
145         {
146             "vdu_id": "vdu1Id",
147             "description": "vdu description",
148             "properties": {
149                 "name": "vduinstname",
150                 "vdu_type": "OMP",
151                 "key_vdu": True,
152                 "support_scaling": True,
153                 "location_info": {
154                     "vimid": "vimid",
155                     "tenant": "tenantname",
156                     "availability_zone": "zone1",
157                     "host": "host1"
158                 },
159                 "local_affinity_antiaffinity_rule": [
160                     {
161                         "affinity_antiaffinity": "anti-affinity",
162                         "scope": "node"
163                     },
164                     {
165                         "affinity_antiaffinity": "affinity",
166                         "scope": "zone"
167                     }
168                 ],
169                 "inject_data_list": [
170                     {
171                         "file_name": "abc.xml",
172                         "file_data": "<a>xxx</a><b>ssss</b>"
173                     }
174                 ],
175                 "storage_policy": "HIGH",
176                 "template_id": "26",
177                 "manual_scale_select_vim": False,
178                 "watchdog": {
179                     "enabledelay": 600000,
180                     "action": "reset"
181                 },
182                 "is_predefined": False,
183                 "allow_scale_updown": False,
184                 "inject_network_address": True,
185                 "inner_hugepage_num": 100,
186                 "inner_hugepage_size": "2048",
187                 "action": "add"
188             },
189             "image_file": 'sss',
190             "local_storages": [
191                 "local_storage_id1",
192                 "local_storage_id2"
193             ],
194             "virtual_storages": [
195                 {
196                     "virtual_storage_id": "volume_storage1",
197                     "location": "/usr/data",
198                     "device": "/dev/hda1"
199                 }
200             ],
201             "dependencies": [
202                 "vdu1Id",
203                 "vduNId"
204             ],
205             "nfv_compute": {
206                 "num_cpus": 4,
207                 "mem_size": "1 GB",
208                 "cpu_frequency": "1GHz",
209                 "flavor_extra_specs": {
210                     "hw: cpu_policy": "shared",
211                     "hw: cpu_max_threads": 50,
212                     "hw: cpu_sockets": 10,
213                     "hw: cpu_max_sockets": 20,
214                     "hw: cpu_max_cores": 8,
215                     "hw: cpu_threads": 30,
216                     "hw: numa_mem.0": 12288,
217                     "hw: hugepage_num": 100,
218                     "hw: high_performance": "dvs_high",
219                     "hw: numa_nodes": 1,
220                     "hw: numa_cpus.0": "2,4,8",
221                     "hw: numa_pci": True,
222                     "hw: cpu_cores": 4,
223                     "pci_passthrough: alias": "ColetoCreek: 1",
224                     "hw: mem_page_size": "large",
225                     "hw: mem_paging_mechanism": "EPT"
226                 }
227             },
228             "vls": [
229                 "vlId1",
230             ],
231             "cps": [
232                 "cpId1",
233             ],
234             "scalable": {
235                 "min_instances": 1,
236                 "max_instances": 2,
237                 "default_instances": 1
238             },
239             "interfaces": {
240                 "Standard": {
241                     "create": {
242                         "implementation": "<implementationScript>",
243                         "inputs": {
244                             "param1Name": "value1",
245                             "paramNName": "valueN"
246                         }
247                     },
248                     "configure": {
249                         "implementation": "<implementationScript>",
250                         "inputs": {
251                             "param1Name": "value1",
252                             "paramNName": "valueN"
253                         }
254                     },
255                     "start": {
256                         "implementation": "<implementationScript>",
257                         "inputs": {
258                             "param1Name": "value1",
259                             "paramNName": "valueN"
260                         }
261                     },
262                     "stop": {
263                         "implementation": "<implementationScript>",
264                         "inputs": {
265                             "param1Name": "value1",
266                             "paramNName": "valueN"
267                         }
268                     },
269                     "delete": {
270                         "implementation": "<implementationScript>",
271                         "inputs": {
272                             "param1Name": "value1",
273                             "paramNName": "valueN"
274                         }
275                     }
276                 }
277             },
278             "artifacts": [
279             ]
280         }
281     ],
282     'volume_storages': [
283         {
284             "volume_storage_id": "volume_storage1",
285             "description": "",
286             "properties": {
287                 "size": "\"100 GB\"",
288                 "volume_id": "",
289                 "volume_name": "volumeStorage1",
290                 "custom_volume_type": "type1",
291                 "disk_type": "data",
292                 "delete_on_termination_vm": True,
293                 "location_info": {
294                     "vimid": "vimid_1",
295                     "tenant": "tenantname_1",
296                     "availability_zone": "zone1"
297                 },
298                 "is_predefined": False,
299                 "is_shared": False
300             },
301             "image_file": [
302                 "volume_image"
303             ]
304         }
305     ],
306     'policies': {
307         'scaling': {
308             'targets': {
309
310             },
311             'policy_id': 'policy_scale_sss-vnf-template',
312             'properties': {
313                 'policy_file': '*-vnfd.zip/*-vnf-policy.xml'
314             },
315             'description': ''
316         }
317     },
318     'image_files': [
319         {
320             'description': '',
321             'properties': {
322                 'name': 'opencos_sss_omm_img_release_20150723-1-disk1.vmdk',
323                 'checksum': '',
324                 'disk_format': 'VMDK',
325                 'file_url': './zte-cn-sss-main-image/OMM/opencos_sss_omm_img_release_20150723-1-disk1.vmdk',
326                 'container_type': 'vm',
327                 'version': '',
328                 'hypervisor_type': 'kvm'
329             },
330             'image_file_id': 'opencos_sss_omm_img_release_20150723-1-disk1'
331         },
332         {
333             'description': '',
334             'properties': {
335                 'name': 'sss.vmdk',
336                 'checksum': '',
337                 'disk_format': 'VMDK',
338                 'file_url': './zte-cn-sss-main-image/NE/sss.vmdk',
339                 'container_type': 'vm',
340                 'version': '',
341                 'hypervisor_type': 'kvm'
342             },
343             'image_file_id': 'sss'
344         }
345     ],
346     'vls': [
347         {
348             "vl_id": "vldId1",
349             "description": "",
350             "properties": {
351                 "name": "umac_241_control",
352                 "network_name": "umac_control",
353                 "is_predefined": False,
354                 "vendor": "zte",
355                 "netmask": "255.255.255.0",
356                 "mtu": 1500,
357                 "network_type": "vlan",
358                 "physical_network": "phynet01",
359                 "segmentation_id": "30",
360                 "vlan_transparent": False,
361                 "vds_name": "vds1",
362                 "cidr": "192.168.199.0/24",
363                 "ip_version": 4,
364                 "gateway_ip": "192.168.199.1",
365                 "dhcp_enabled": False,
366                 "dns_nameservers": [
367                     "192.168.0.4",
368                     "192.168.0.10"
369                 ],
370                 "start_ip": "192.168.199.2",
371                 "end_ip": "192.168.199.254",
372                 "host_routes": [
373                     {
374                         "destination": "10.43.26.0/24",
375                         "nexthop": "10.41.23.1"
376                     }
377                 ],
378                 "location_info": {
379                     "vimid": "vimid_1",
380                     "tenant": "tenantname_1"
381                 },
382                 "cloud_type": "IaaS"
383             },
384             "route_id": "router01",
385             "route_external": False
386         }
387     ],
388     'cps': [
389         {
390             "cp_id": "cpId1",
391             "description": "",
392             "properties": {
393                 "name": "",
394                 "mac_address": "00:d9:00:82:11:e1",
395                 "ip_address:": "192.168.1.21",
396                 "ip_range_start": "192.168.1.20",
397                 "ip_range_end": "192.168.1.29",
398                 "floating_ip_address": {
399                     "external_network": "extnet01",
400                     "ip_address": "10.43.53.23"
401                 },
402                 "service_ip_address": "192.168.1.23",
403                 "order": 1,
404                 "bandwidth": 1000,
405                 "vnic_type": "normal",
406                 "allowed_address_pairs": [
407                     {
408                         "ip": "192.168.1.13",
409                         "mac": "00:f3:43:20:a2:a3"
410                     }
411                 ],
412                 "bond": "none",
413                 "bond_index": 1,
414                 "macbond": "00:d9:00:82:11:d1",
415                 "sfc_encapsulation": "",
416                 "direction": "",
417                 "gateway_ip": "192.168.199.1",
418                 "netmask": "255.255.255.0",
419                 "interface_name": "fe-01-02",
420                 "is_virtual": False,
421                 "function": "control"
422             },
423             "vl_id": "vldId1",
424             "vdu_id": "vdu1Id"
425         }
426     ],
427     'local_storages': [
428
429     ],
430 }
431
432 # get_tenant_id
433 c1_data_get_tenant_id = {
434     "tenants": [
435         {
436             "id": "1",
437             "name": "chinamobile"
438         }
439     ]
440 }
441 c1_data_get_tenant_id_1 = {
442     "tenants": [
443         {
444             "id": "1",
445             "name": "tenantname"
446         }
447     ]
448 }
449
450 # create_volume
451 c2_data_create_volume = {
452     "id": "4bd3e9eb-cd8b-456a-8589-910836a0ab31",
453     "name": "volume1",
454     "returnCode": 1,
455     "vimId": "vim_volume_1",
456     "vimName": "vim_volume_1",
457     "tenantId": "vim_volume_1",
458     "volumeType": "123",
459     "availabilityZone": "availabilityZone",
460     "status": "availuable",
461     "createTime": "2015-12-02T06:39:40.000000",
462     "type": None,
463     "size": 40
464 }
465
466 # get_volume
467 c3_data_get_volume = {
468     "status": "available",
469     "name": "wangsong",
470     "attachments": [
471         {
472             "device": "/dev/vdc",
473             "serverId": "3030e666-528e-4954-88f5-cc21dab1262b",
474             "volumeId": "4bd3e9eb-cd8b-456a-8589-910836a0ab31",
475             "hostName": None,
476             "id": "4bd3e9eb-cd8b-456a-8589-910836a0ab31"
477         }
478     ],
479     "createTime": "2015-12-02T06:39:40.000000",
480     "type": None,
481     "id": "4bd3e9eb-cd8b-456a-8589-910836a0ab31",
482     "size": 40
483 }
484
485 # create_network
486 c4_data_create_network = {
487     "returnCode": 0,
488     "vimId": "11111",
489     "vimName": "11111",
490     "status": "ACTIVE",
491     "id": "3c9eebdbbfd345658269340b9ea6fb73",
492     "name": "net1",
493     "tenantId": "tenant1",
494     "networkName": "ommnet",
495     "shared": True,
496     "vlanTransparent": True,
497     "networkType": "vlan",
498     "segmentationId": 202,
499     "physicalNetwork": "physnet1",
500     "routerExternal": False
501 }
502
503 # create_subnet
504 c5_data_create_subnet = {
505     "returnCode": 0,
506     "vimId": "11111",
507     "vimName": "11111",
508     "status": " ACTIVE",
509     "id": "d62019d3-bc6e-4319-9c1d-6722fc136a23",
510     "tenantId": "tenant1",
511     "networkId": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
512     "networkName": "networkName",
513     "name": "subnet1",
514     "cidr": "10.43.35.0/24",
515     "ipVersion": 4,
516     "enableDhcp": 1,
517     "gatewayIp": "10.43.35.1",
518     "dnsNameservers": [],
519     "allocationPools": [
520         {
521             "start": "192.168.199.2",
522             "end": "192.168.199.254"
523         }
524     ],
525     "hostRoutes": []
526 }
527
528 # create_ports
529 c6_data_create_port = {
530     "returnCode": 0,
531     "vimId": "11111",
532     "vimName": "11111",
533     "status": " ACTIVE",
534     "id": " 872019d3-bc6e-4319-9c1d-6722fc136afg",
535     "tenantId": "tenant1",
536     "name": "subnet1",
537     "networkId": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
538     "networkName": "networkName",
539     "subnetId": "d62019d3-bc6e-4319-9c1d-6722fc136a23",
540     "subnetName": "subnet1",
541     "macAddress": "212.12.61.23",
542     "ip": "10.43.38.11",
543     "vnicType": "direct",
544     "securityGroups": ""
545 }
546
547 # create_flavor
548 c7_data_create_flavor = {
549     "returnCode": 0,
550     "vimId": "11111",
551     "vimName": "11111",
552     "id": "142019d3-bc6e-4319-9c1d-6722fc136afg",
553     "tenantId": "tenant1",
554     "name": "subnet1",
555     "vcpu": 5,
556     "memory": 2,
557     "disk": 40,
558     "ephemeral": 40,
559     "swap": 20,
560     "isPublic": True,
561     "extraSpecs": "testtt"
562 }
563
564 # list_image
565 c8_data_list_image = {
566     "vimid": "",
567     "vimname": "",
568     "images": [
569         {
570             "status": "active",
571             "id": "5e2757c1-f846-4727-915c-9a872553ed75",
572             "size": 862016,
573             "name": 'sss.vmdk'
574         }
575     ]
576 }
577
578 # create_vm
579 c9_data_create_vm = {
580     "returnCode": 1,
581     "id": "3c9eebdbbfd345658269340b9ea6fb73",
582     "name": "vm1",
583     "vimId": "11111",
584     "vimName": "11111",
585     "tenantId": "tenant1",
586     "boot": "boot_1",
587     "nicArray": "dfdf",
588     "volumeArray": "dfdf",
589     "availabilityZone": "fdvfdv",
590     "flavorId": "fdvfdv",
591     "metadata": "fdvfdv",
592     "securityGroups": "fdvfdv",
593     "serverGroup": "fdvfdv",
594     "status": "ACTIVE"
595 }
596
597 # get_vm
598 c10_data_get_vm = {
599     "returnCode": 1,
600     "id": "3c9eebdbbfd345658269340b9ea6fb73",
601     "name": "vm1",
602     "vimId": "11111",
603     "vimName": "11111",
604     "tenantId": "tenant1",
605     "status": "ACTIVE"
606 }
607
608 vnfdModel = {
609     "volume_storages": [
610         {
611             "volume_storage_id": "test",
612             "properties": {
613                 "location_info": {
614                     "vimid": "vim_1",
615                     "tenant": "chinamobile",
616                     "availability_zone": "test",
617                 },
618                 "volume_name": "test",
619                 "custom_volume_type": "test",
620                 "size_of_storage": "\"10 GB\"",
621             },
622             "image_file": "test",
623         },
624     ],
625     "vls": [
626         {
627             "vl_id": "test",
628             "properties": {
629                 "location_info": {
630                     "vimid": "test",
631                     "tenant": "chinamobile",
632                 },
633                 "vl_profile": {
634                     "networkName": "test",
635                     "networkType": "test",
636                     "physicalNetwork": "test",
637                     "vlanTransparent": "test",
638                     "segmentationId": "1",
639                     "cidr": "test",
640                     "dhcpEnabled": "test",
641                     "gatewayIp": "test",
642                     "startIp": "test",
643                     "endIp": "test",
644                 },
645                 "connectivity_type": {
646                     "layer_protocol": "ipv4",
647                 },
648                 "dns_nameservers": ["test"],
649                 "host_routes": [],
650             },
651             "route_external": False
652         }
653     ],
654     "cps": [
655         {
656             "vdu_id": "test",
657             "cp_id": "cp1",
658             "networkId": "",  # TODO
659             "subnetId": "",  # TODO
660             "vl_id": "test",
661             "properties": {
662                 "name": "test",
663                 "mac_address": "test",
664                 "protocol_data": [
665                     {
666                         "address_data": {
667                             "l3_address_data": {
668                                 "fixed_ip_address": "test"
669                             },
670                         },
671                     },
672                 ],
673                 "vnic_type": "direct",
674                 "role": "root",
675                 "virtual_network_interface_requirements": [
676                     {
677                         "network_interface_requirements": {
678                             "interfaceType": '{"schemaVersion": "0", "schemaLocation":"", "platformId": "generic", "mandatory": false, "configurationValue": "SR-IOV"}'
679                         },
680                         "support_mandatory": False,
681                         "name": "SRIOV_Port",
682                         "description": "sriov"
683                     }
684                 ]
685             }
686         }
687     ],
688     "vdus": [
689         {
690             "vdu_id": "test",
691             "properties": {
692                 "location_info": {
693                     "vimid": "test",
694                     "tenant": "chinamobile",
695                     "availability_zone": "test",
696                     "vnfId": "",
697                     "vnfName": "",
698                     "cloudOwner": "",
699                     "cloudRegionId": "",
700                     "vduInfo": [
701                         {
702                             "vduName": "VDU_vbng_0",
703                             "flavorId": "12345",
704                             "directive": ""
705                         }
706                     ]
707                 },
708                 "name": "test",
709                 "inject_files": [],
710                 "user_data": "test",
711                 "meta_data": {},
712             },
713             "cps": [],
714             "type": "tosca.nodes.nfv.Vdu.Compute",
715             "virtual_compute": {
716                 "virtual_cpu": {
717                     "num_virtual_cpu": "16",
718                 },
719                 "virtual_memory": {
720                     "virtual_mem_size": "8000 MB",
721                     "vdu_memory_requirements": {
722                         "memoryPageSize": "8 MB",
723                     },
724                 },
725             },
726             "virtual_storages": [{
727                 "virtual_storage_id": "test",
728                 "type_of_storage": "ephemeral",
729                 "size_of_storage": "10 GB",
730             }],
731             "type": "tosca.nodes.nfv.Vdu.Compute",
732             "artifacts": [
733                 {
734                     "artifact_name": "sw_image",
735                     "file": "sss.vmdk",
736                 },
737             ],
738             "volume_storages": [
739                 {
740                     "volume_storage_id": "test",
741                 }
742             ],
743         },
744     ],
745     "image_files": [],
746     "routers": [],
747     "local_storages": [],
748     "vnf_exposed": {
749         "external_cps": [],
750         "forward_cps": []
751     },
752     "inputs": {
753         "pe1_id": {
754             "type": "string",
755             "description": "pe1_idofunderlayvpn"
756         },
757         "pe2_id": {
758             "type": "string",
759             "description": "pe2_idofunderlayvpn"
760         },
761         "serviceType": {
762             "type": "string",
763             "description": "serviceTypeofunderlayvpn"
764         },
765         "description": {
766             "type": "string",
767             "description": "descriptionofunderlayvpn"
768         },
769         "ac2_route": {
770             "type": "string",
771             "description": "ac2_routeofunderlayvpn"
772         },
773         "ac1_route": {
774             "type": "string",
775             "description": "ac1_routeofunderlayvpn"
776         },
777         "ac1_svlan": {
778             "type": "integer",
779             "description": "ac1_svlanofunderlayvpn"
780         },
781         "ac2_ip": {
782             "type": "string",
783             "description": "ac2_ipofunderlayvpn"
784         },
785         "ac1_ip": {
786             "type": "string",
787             "description": "ac1_ipofunderlayvpn"
788         },
789         "ac2_port": {
790             "type": "string",
791             "description": "ac2_portofunderlayvpn"
792         },
793         "topology": {
794             "type": "string",
795             "description": "topologyofunderlayvpn"
796         },
797         "technology": {
798             "type": "string",
799             "description": "technologyofunderlayvpn"
800         },
801         "ac1_port": {
802             "type": "string",
803             "description": "ac1_portofunderlayvpn"
804         },
805         "ac2_svlan": {
806             "type": "integer",
807             "description": "ac2_svlanofunderlayvpn"
808         },
809         "name": {
810             "type": "string",
811             "description": "Nameofunderlayervpn"
812         }
813     },
814     "metadata": {
815         "designer": "sdno",
816         "name": "underlayervpn",
817         "csarVersion": "1.0",
818         "csarType": "SSAR",
819         "csarProvider": "huawei",
820         "version": "1.0",
821         "type": "SSAR",
822         "id": "ns_underlayervpn_1_0"
823     }
824 }
825
826 vnfpackage_info = {
827     "imageInfo": [],
828     "csarId": "vOpenNAT",
829     "packageInfo": {
830         "csarName": "vOpenNAT.csar",
831         "vnfdModel": json.dumps(vnfdModel),
832         "vnfdProvider": "Intel",
833         "vnfdId": "openNAT_1.0",
834         "downloadUrl": "http://10.96.33.39:8806/static/catalog/vOpenNAT/vOpenNAT.csar",
835         "vnfVersion": "v1.0",
836         "vnfdVersion": "v1.0",
837         "vnfPackageId": "vOpenNAT"
838     }
839 }
840
841 single_vnf_lcm_op = {
842     "id": "99442b18-a5c7-11e8-998c-bf1755941f16",
843     "operationState": "STARTING",
844     "stateEnteredTime": "2018-07-09",
845     "startTime": "2018-07-09",
846     "vnfInstanceId": "cd552c9c-ab6f-11e8-b354-236c32aa91a1",
847     "grantId": None,
848     "operation": "SCALE",
849     "isAutomaticInvocation": False,
850     "operationParams": {},
851     "isCancelPending": False,
852     "cancelMode": None,
853     "error": None,
854     "resourceChanges": None,
855     "changedInfo": None,
856     "changedExtConnectivity": None,
857     "_links": {
858         "self": {
859             "href": "demo"
860         },
861         "vnfInstance": "demo"
862     }
863 }
864
865 vnflcmop_with_exclude_default = [{
866     "id": "99442b18-a5c7-11e8-998c-bf1755941f16",
867     "operationState": "STARTING",
868     "stateEnteredTime": "2018-07-09",
869     "startTime": "2018-07-09",
870     "vnfInstanceId": "cd552c9c-ab6f-11e8-b354-236c32aa91a1",
871     "grantId": None,
872     "operation": "SCALE",
873     "isAutomaticInvocation": False,
874     "isCancelPending": False,
875     "cancelMode": None,
876     "_links": {
877         "self": {
878             "href": "demo"
879         },
880         "vnfInstance": "demo"
881     }
882 }]
883
884 multiple_vnf_lcm_op = [{
885     "id": "a6b9415c-ab99-11e8-9d37-dbb5e0378955",
886     "operationState": "STARTING",
887     "stateEnteredTime": "2018-07-09",
888     "startTime": "2018-07-09",
889     "vnfInstanceId": "cd552c9c-ab6f-11e8-b354-236c32aa91a1",
890     "grantId": None,
891     "operation": "INSTANTIATE",
892     "isAutomaticInvocation": False,
893     "operationParams": {},
894     "isCancelPending": False,
895     "cancelMode": None,
896     "error": None,
897     "resourceChanges": None,
898     "changedInfo": None,
899     "changedExtConnectivity": None,
900     "_links": {
901         "self": {
902             "href": "demo"
903         },
904         "vnfInstance": "demo"
905     }
906 }]
907
908 # # vnfd_rawdata
909 # vnfd_rawdata = {
910 #     "rawData": {
911 #         "instance": {
912 #             "metadata": {
913 #                 "designer": "sdno",
914 #                 "name": "underlayervpn",
915 #                 "csarVersion": "1.0",
916 #                 "csarType": "SSAR",
917 #                 "csarProvider": "huawei",
918 #                 "version": "1.0",
919 #                 "type": "SSAR",
920 #                 "id": "ns_underlayervpn_1_0"
921 #             },
922 #             "nodes": [
923 #                 {
924 #                     "id": "ac2_fdhrbk3dvan8hl5wifm9lp1e9",
925 #                     "type_name": "tosca.nodes.sdn.l3ac",
926 #                     "template_name": "ac2",
927 #                     "properties": {
928 #                         "ip": {
929 #                             "type_name": "string"
930 #                         },
931 #                         "route": {
932 #                             "type_name": "string"
933 #                         },
934 #                         "port": {
935 #                             "type_name": "string"
936 #                         },
937 #                         "svlan": {
938 #                             "type_name": "string"
939 #                         }
940 #                     },
941 #                     "interfaces": [
942 #                         {
943 #                             "name": "Standard",
944 #                             "type_name": "tosca.interfaces.node.lifecycle.Standard"
945 #                         }
946 #                     ],
947 #                     "capabilities": [
948 #                         {
949 #                             "name": "feature",
950 #                             "type_name": "tosca.capabilities.Node"
951 #                         },
952 #                         {
953 #                             "name": "ac",
954 #                             "type_name": "tosca.capabilities.sdn.ac"
955 #                         }
956 #                     ],
957 #                     "relationships": [
958 #                         {
959 #                             "target_node_id": "pe2_go3vo1ctxr1vlbl0ij8stbtj6",
960 #                             "target_capability_name": "feature"
961 #                         },
962 #                         {
963 #                             "target_node_id": "ac2_fdhrbk3dvan8hl5wifm9lp1e9",
964 #                             "target_capability_name": "feature"
965 #                         }
966 #                     ]
967 #                 },
968 #                 {
969 #                     "id": "ac1_jqows1ai0j0cmwk9jdvuknt97",
970 #                     "type_name": "tosca.nodes.sdn.l3ac",
971 #                     "template_name": "ac1",
972 #                     "properties": {
973 #                         "ip": {
974 #                             "type_name": "string"
975 #                         },
976 #                         "route": {
977 #                             "type_name": "string"
978 #                         },
979 #                         "port": {
980 #                             "type_name": "string"
981 #                         },
982 #                         "svlan": {
983 #                             "type_name": "string"
984 #                         }
985 #                     },
986 #                     "interfaces": [
987 #                         {
988 #                             "name": "Standard",
989 #                             "type_name": "tosca.interfaces.node.lifecycle.Standard"
990 #                         }
991 #                     ],
992 #                     "capabilities": [
993 #                         {
994 #                             "name": "feature",
995 #                             "type_name": "tosca.capabilities.Node"
996 #                         },
997 #                         {
998 #                             "name": "ac",
999 #                             "type_name": "tosca.capabilities.sdn.ac"
1000 #                         }
1001 #                     ],
1002 #                     "relationships": [
1003 #                         {
1004 #                             "target_node_id": "pe1_e58ekps6m45g6w9egs9lue2j7",
1005 #                             "target_capability_name": "feature"
1006 #                         },
1007 #                         {
1008 #                             "target_node_id": "ac2_fdhrbk3dvan8hl5wifm9lp1e9",
1009 #                             "target_capability_name": "feature"
1010 #                         }
1011 #                     ]
1012 #                 },
1013 #                 {
1014 #                     "id": "vpn_ie0xim076f7cje67fvrrq9tg1",
1015 #                     "type_name": "tosca.nodes.sdn.underlayVPN",
1016 #                     "template_name": "vpn",
1017 #                     "properties": {
1018 #                         "serviceType": {
1019 #                             "type_name": "string"
1020 #                         },
1021 #                         "description": {
1022 #                             "type_name": "string"
1023 #                         },
1024 #                         "name": {
1025 #                             "type_name": "string"
1026 #                         },
1027 #                         "topology": {
1028 #                             "type_name": "string"
1029 #                         }
1030 #                     },
1031 #                     "interfaces": [
1032 #                         {
1033 #                             "name": "Standard",
1034 #                             "type_name": "tosca.interfaces.node.lifecycle.Standard"
1035 #                         }
1036 #                     ],
1037 #                     "capabilities": [
1038 #                         {
1039 #                             "name": "feature",
1040 #                             "type_name": "tosca.capabilities.Node"
1041 #                         }
1042 #                     ],
1043 #                     "relationships": [
1044 #                         {
1045 #                             "target_node_id": "ac1_jqows1ai0j0cmwk9jdvuknt97",
1046 #                             "target_capability_name": "feature"
1047 #                         },
1048 #                         {
1049 #                             "target_node_id": "ac2_fdhrbk3dvan8hl5wifm9lp1e9",
1050 #                             "target_capability_name": "feature"
1051 #                         }
1052 #                     ]
1053 #                 },
1054 #                 {
1055 #                     "id": "pe1_e58ekps6m45g6w9egs9lue2j7",
1056 #                     "type_name": "tosca.nodes.sdn.l3pe",
1057 #                     "template_name": "pe1",
1058 #                     "properties": {
1059 #                         "id": {
1060 #                             "type_name": "string"
1061 #                         }
1062 #                     },
1063 #                     "interfaces": [
1064 #                         {
1065 #                             "name": "Standard",
1066 #                             "type_name": "tosca.interfaces.node.lifecycle.Standard"
1067 #                         }
1068 #                     ],
1069 #                     "capabilities": [
1070 #                         {
1071 #                             "name": "feature",
1072 #                             "type_name": "tosca.capabilities.Node"
1073 #                         },
1074 #                         {
1075 #                             "name": "pe",
1076 #                             "type_name": "tosca.capabilities.sdn.pe"
1077 #                         }
1078 #                     ]
1079 #                 },
1080 #                 {
1081 #                     "id": "pe2_go3vo1ctxr1vlbl0ij8stbtj6",
1082 #                     "type_name": "tosca.nodes.sdn.l3pe",
1083 #                     "template_name": "pe2",
1084 #                     "properties": {
1085 #                         "id": {
1086 #                             "type_name": "string"
1087 #                         }
1088 #                     },
1089 #                     "interfaces": [
1090 #                         {
1091 #                             "name": "Standard",
1092 #                             "type_name": "tosca.interfaces.node.lifecycle.Standard"
1093 #                         }
1094 #                     ],
1095 #                     "capabilities": [
1096 #                         {
1097 #                             "name": "feature",
1098 #                             "type_name": "tosca.capabilities.Node"
1099 #                         },
1100 #                         {
1101 #                             "name": "pe",
1102 #                             "type_name": "tosca.capabilities.sdn.pe"
1103 #                         }
1104 #                     ]
1105 #                 }
1106 #             ],
1107 #             "substitution": {
1108 #                 "node_type_name": "tosca.nodes.sdn.ext.NS.ns_underlayervpn"
1109 #             },
1110 #             "inputs": {
1111 #                 "ac2_ip": {
1112 #                     "type_name": "string",
1113 #                     "description": "ac2_ipofunderlayvpn"
1114 #                 },
1115 #                 "ac2_route": {
1116 #                     "type_name": "string",
1117 #                     "description": "ac2_routeofunderlayvpn"
1118 #                 },
1119 #                 "serviceType": {
1120 #                     "type_name": "string",
1121 #                     "description": "serviceTypeofunderlayvpn"
1122 #                 },
1123 #                 "description": {
1124 #                     "type_name": "string",
1125 #                     "description": "descriptionofunderlayvpn"
1126 #                 },
1127 #                 "pe2_id": {
1128 #                     "type_name": "string",
1129 #                     "description": "pe2_idofunderlayvpn"
1130 #                 },
1131 #                 "ac1_route": {
1132 #                     "type_name": "string",
1133 #                     "description": "ac1_routeofunderlayvpn"
1134 #                 },
1135 #                 "ac1_svlan": {
1136 #                     "type_name": "integer",
1137 #                     "description": "ac1_svlanofunderlayvpn"
1138 #                 },
1139 #                 "name": {
1140 #                     "type_name": "string",
1141 #                     "description": "Nameofunderlayervpn"
1142 #                 },
1143 #                 "ac1_ip": {
1144 #                     "type_name": "string",
1145 #                     "description": "ac1_ipofunderlayvpn"
1146 #                 },
1147 #                 "ac2_port": {
1148 #                     "type_name": "string",
1149 #                     "description": "ac2_portofunderlayvpn"
1150 #                 },
1151 #                 "pe1_id": {
1152 #                     "type_name": "string",
1153 #                     "description": "pe1_idofunderlayvpn"
1154 #                 },
1155 #                 "technology": {
1156 #                     "type_name": "string",
1157 #                     "description": "technologyofunderlayvpn"
1158 #                 },
1159 #                 "ac1_port": {
1160 #                     "type_name": "string",
1161 #                     "description": "ac1_portofunderlayvpn"
1162 #                 },
1163 #                 "ac2_svlan": {
1164 #                     "type_name": "integer",
1165 #                     "description": "ac2_svlanofunderlayvpn"
1166 #                 },
1167 #                 "topology": {
1168 #                     "type_name": "string",
1169 #                     "description": "topologyofunderlayvpn"
1170 #                 }
1171 #             }
1172 #         }
1173 #     }
1174 # }
1175 vnfd_for_scale = {
1176     "volume_storages": [
1177         {
1178             "volume_storage_id": "test",
1179             "properties": {
1180                 "location_info": {
1181                     "vimid": "vim_1",
1182                     "tenant": "chinamobile",
1183                     "availability_zone": "test",
1184                 },
1185                 "volume_name": "test",
1186                 "custom_volume_type": "test",
1187                 "size_of_storage": "\"10 GB\"",
1188             },
1189             "image_file": "test",
1190         },
1191     ],
1192     "vnf": {
1193         "type": "tosca.nodes.nfv.VNF",
1194         "requirements": {
1195             "virtual_link": [
1196                 "ext_cp",
1197                 "virtual_link"
1198             ]
1199         },
1200         "properties": {
1201             "descriptor_id": "b1bb0ce7-1234-4fa7-95ed-4840d70a1179",
1202             "flavour_description": "simple",
1203             "descriptor_verison": "1.0",
1204             "software_version": "1.0.0",
1205             "template_name": "test",
1206             "vnfm_info": [
1207                 "vnfm"
1208             ],
1209             "descriptor_version": "1.0.0",
1210             "provider": "zte",
1211             "flavour_id": "simple",
1212             "product_name": "test"
1213         },
1214         "capabilities": {
1215
1216         },
1217         "metadata": {
1218             "template_name": "test",
1219             "template_version": "1.0",
1220             "template_author": "ZTE"
1221         }
1222     },
1223     "vdus": [
1224         {
1225             "description": "",
1226             "virtual_storages": [
1227                 {
1228                     "virtual_storage_id": "test",
1229                     "type_of_storage": "ephemeral",
1230                     "size_of_storage": "10 GB",
1231                 }
1232             ],
1233             "volume_storages": [
1234                 {
1235                     "volume_storage_id": "test",
1236                 }
1237             ],
1238             "vdu_id": "sunshine",
1239             "artifacts": [
1240                 {
1241                     "artifact_name": "sw_image",
1242                     "type": "tosca.artifacts.nfv.SwImage",
1243                     "file": "sss.vmdk"
1244                 }
1245             ],
1246             "dependencies": [
1247
1248             ],
1249             "virtual_compute": {
1250                 "virtual_cpu": {
1251                     "num_virtual_cpu": 2
1252                 },
1253                 "virtual_memory": {
1254                     "virtual_mem_size": "4096 MB"
1255                 },
1256             },
1257             "vls": [
1258
1259             ],
1260             "cps": [
1261                 "ext_cp"
1262             ],
1263             "type": "tosca.nodes.nfv.Vdu.Compute",
1264             "properties": {
1265                 "vdu_profile": {
1266                     "max_number_of_instances": 3,
1267                     "min_number_of_instances": 1
1268                 },
1269                 "name": "sunshine1234",
1270                 "sw_image_data": {
1271                     "operating_system": "linux",
1272                     "name": "ubuntu",
1273                     "checksum": {
1274                         "hash": "d0e7828293355a07c2dccaaa765c80b507e60e6167067c950dc2e6b0da0dbd34",
1275                         "algorithm": "SHA-256"
1276                     },
1277                     "min_ram": "2 GB",
1278                     "disk_format": "qcow2",
1279                     "version": 16.04,
1280                     "container_format": "bare",
1281                     "min_disk": "2 GB",
1282                     "size": "2 GB"
1283                 },
1284                 "description": "vdu test",
1285                 "location_info": {
1286                     "vimid": "",
1287                     "tenant": "",
1288                     "availability_zone": "",
1289                     "vnfId": "",
1290                     "vnfName": "",
1291                     "cloudOwner": "",
1292                     "cloudRegionId": "",
1293                     "vduInfo": [
1294                         {
1295                             "vduName": "sunshine1234",
1296                             "flavorId": "12345",
1297                             "directive": ""
1298                         }
1299                     ]
1300                 }
1301             }
1302         }
1303     ],
1304     "description": "test",
1305     "inputs": {
1306
1307     },
1308     "graph": {
1309         "sunshine": [
1310             "ext_cp"
1311         ],
1312         "ext_cp": [
1313
1314         ]
1315     },
1316     "basepath": "/tmp/tmpil6wVG",
1317     "vnf_exposed": {
1318         "external_cps": [
1319             {
1320                 "key_name": "virtual_link",
1321                 "cpd_id": "ext_cp"
1322             }
1323         ],
1324         "forward_cps": [
1325
1326         ]
1327     },
1328     "policies": [
1329         {
1330             "type": "tosca.policies.nfv.InstantiationLevels",
1331             "targets": "",
1332             "properties": {
1333                 "default_level": "instantiation_level_1",
1334                 "levels": {
1335                     "instantiation_level_1": {
1336                         "scale_info": {
1337                             "sunshine_aspect": {
1338                                 "scale_level": 0
1339                             }
1340                         },
1341                         "description": "vnf test instantiation_level_1"
1342                     },
1343                     "instantiation_level_2": {
1344                         "scale_info": {
1345                             "sunshine_aspect": {
1346                                 "scale_level": 1
1347                             }
1348                         },
1349                         "description": "vnf test instantiation_level_2"
1350                     },
1351                     "instantiation_level_3": {
1352                         "scale_info": {
1353                             "sunshine_aspect": {
1354                                 "scale_level": 2
1355                             }
1356                         },
1357                         "description": "vnf test instantiation_level_3"
1358                     }
1359                 }
1360             }
1361         },
1362         {
1363             "type": "tosca.policies.nfv.VduInstantiationLevels",
1364             "targets": [
1365                 "sunshine"
1366             ],
1367             "properties": {
1368                 "levels": {
1369                     "instantiation_level_1": {
1370                         "number_of_instances": 1
1371                     },
1372                     "instantiation_level_2": {
1373                         "number_of_instances": 2
1374                     },
1375                     "instantiation_level_3": {
1376                         "number_of_instances": 3
1377                     }
1378                 }
1379             }
1380         },
1381         {
1382             "type": "tosca.policies.nfv.ScalingAspects",
1383             "targets": "",
1384             "properties": {
1385                 "aspects": {
1386                     "sunshine_aspect": {
1387                         "max_scale_level": 2,
1388                         "description": "sunshine aspect",
1389                         "name": "sunshine_aspect",
1390                         "step_deltas": [
1391                             "sunshine_delta"
1392                         ]
1393                     }
1394                 }
1395             }
1396         },
1397         {
1398             "type": "tosca.policies.nfv.VduInitialDelta",
1399             "targets": [
1400                 "sunshine"
1401             ],
1402             "properties": {
1403                 "initial_delta": {
1404                     "number_of_instances": 1
1405                 }
1406             }
1407         },
1408         {
1409             "type": "tosca.policies.nfv.VduScalingAspectDeltas",
1410             "targets": [
1411                 "sunshine"
1412             ],
1413             "properties": {
1414                 "deltas": {
1415                     "sunshine_delta": {
1416                         "number_of_instances": 1
1417                     }
1418                 },
1419                 "aspect": "sunshine_aspect"
1420             }
1421         }
1422     ],
1423     "vls": [
1424
1425     ],
1426     "cps": [
1427         {
1428             "vl_id": "",
1429             "description": "",
1430             "vdu_id": "sunshine",
1431             "properties": {
1432                 "trunk_mode": "false",
1433                 "protocol_data": [{
1434                     "address_data": {
1435                         "address_type": "ip_address",
1436                         "l3_address_data": {
1437                             "floating_ip_activated": False,
1438                             "ip_address_assignment": False
1439                         }
1440                     }
1441                 }]
1442             },
1443             "cp_id": "ext_cp",
1444             "cpd_id": "ext_cp"
1445         }
1446     ],
1447     "metadata": {
1448         "template_name": "test",
1449         "template_version": "1.0",
1450         "template_author": "ZTE"
1451     }
1452 }