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