9adb4ed6c82bc200ed963b02fc81894a04e5156c
[vfc/gvnfm/vnflcm.git] / lcm / lcm / nf / vnfs / const.py
1 # Copyright 2017 ZTE Corporation.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #         http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 from lcm.pub.utils.jobutil import enum
16
17 VNF_STATUS = enum(NULL='null', INSTANTIATING="instantiating", INACTIVE='inactive', ACTIVE="active",
18                   FAILED="failed", TERMINATING="terminating", SCALING="scaling", OPERATING="operating",
19                   UPDATING="updating", HEALING="healing")
20
21 vnfd_rawdata = {
22     "rawData": {
23         "instance": {
24             "metadata": {
25                 "designer": "sdno",
26                 "name": "underlayervpn",
27                 "csarVersion": "1.0",
28                 "csarType": "SSAR",
29                 "csarProvider": "huawei",
30                 "version": "1.0",
31                 "type": "SSAR",
32                 "id": "ns_underlayervpn_1_0"
33             },
34             "nodes": [
35                 {
36                     "id": "ac2_fdhrbk3dvan8hl5wifm9lp1e9",
37                     "type_name": "tosca.nodes.sdn.l3ac",
38                     "template_name": "ac2",
39                     "properties": {
40                         "ip": {
41                             "type_name": "string"
42                         },
43                         "route": {
44                             "type_name": "string"
45                         },
46                         "port": {
47                             "type_name": "string"
48                         },
49                         "svlan": {
50                             "type_name": "string"
51                         }
52                     },
53                     "interfaces": [
54                         {
55                             "name": "Standard",
56                             "type_name": "tosca.interfaces.node.lifecycle.Standard"
57                         }
58                     ],
59                     "capabilities": [
60                         {
61                             "name": "feature",
62                             "type_name": "tosca.capabilities.Node"
63                         },
64                         {
65                             "name": "ac",
66                             "type_name": "tosca.capabilities.sdn.ac"
67                         }
68                     ],
69                     "relationships": [
70                         {
71                             "target_node_id": "pe2_go3vo1ctxr1vlbl0ij8stbtj6",
72                             "target_capability_name": "feature"
73                         },
74                         {
75                             "target_node_id": "ac2_fdhrbk3dvan8hl5wifm9lp1e9",
76                             "target_capability_name": "feature"
77                         }
78                     ]
79                 },
80                 {
81                     "id": "ac1_jqows1ai0j0cmwk9jdvuknt97",
82                     "type_name": "tosca.nodes.sdn.l3ac",
83                     "template_name": "ac1",
84                     "properties": {
85                         "ip": {
86                             "type_name": "string"
87                         },
88                         "route": {
89                             "type_name": "string"
90                         },
91                         "port": {
92                             "type_name": "string"
93                         },
94                         "svlan": {
95                             "type_name": "string"
96                         }
97                     },
98                     "interfaces": [
99                         {
100                             "name": "Standard",
101                             "type_name": "tosca.interfaces.node.lifecycle.Standard"
102                         }
103                     ],
104                     "capabilities": [
105                         {
106                             "name": "feature",
107                             "type_name": "tosca.capabilities.Node"
108                         },
109                         {
110                             "name": "ac",
111                             "type_name": "tosca.capabilities.sdn.ac"
112                         }
113                     ],
114                     "relationships": [
115                         {
116                             "target_node_id": "pe1_e58ekps6m45g6w9egs9lue2j7",
117                             "target_capability_name": "feature"
118                         },
119                         {
120                             "target_node_id": "ac2_fdhrbk3dvan8hl5wifm9lp1e9",
121                             "target_capability_name": "feature"
122                         }
123                     ]
124                 },
125                 {
126                     "id": "vpn_ie0xim076f7cje67fvrrq9tg1",
127                     "type_name": "tosca.nodes.sdn.underlayVPN",
128                     "template_name": "vpn",
129                     "properties": {
130                         "serviceType": {
131                             "type_name": "string"
132                         },
133                         "description": {
134                             "type_name": "string"
135                         },
136                         "name": {
137                             "type_name": "string"
138                         },
139                         "topology": {
140                             "type_name": "string"
141                         }
142                     },
143                     "interfaces": [
144                         {
145                             "name": "Standard",
146                             "type_name": "tosca.interfaces.node.lifecycle.Standard"
147                         }
148                     ],
149                     "capabilities": [
150                         {
151                             "name": "feature",
152                             "type_name": "tosca.capabilities.Node"
153                         }
154                     ],
155                     "relationships": [
156                         {
157                             "target_node_id": "ac1_jqows1ai0j0cmwk9jdvuknt97",
158                             "target_capability_name": "feature"
159                         },
160                         {
161                             "target_node_id": "ac2_fdhrbk3dvan8hl5wifm9lp1e9",
162                             "target_capability_name": "feature"
163                         }
164                     ]
165                 },
166                 {
167                     "id": "pe1_e58ekps6m45g6w9egs9lue2j7",
168                     "type_name": "tosca.nodes.sdn.l3pe",
169                     "template_name": "pe1",
170                     "properties": {
171                         "id": {
172                             "type_name": "string"
173                         }
174                     },
175                     "interfaces": [
176                         {
177                             "name": "Standard",
178                             "type_name": "tosca.interfaces.node.lifecycle.Standard"
179                         }
180                     ],
181                     "capabilities": [
182                         {
183                             "name": "feature",
184                             "type_name": "tosca.capabilities.Node"
185                         },
186                         {
187                             "name": "pe",
188                             "type_name": "tosca.capabilities.sdn.pe"
189                         }
190                     ]
191                 },
192                 {
193                     "id": "pe2_go3vo1ctxr1vlbl0ij8stbtj6",
194                     "type_name": "tosca.nodes.sdn.l3pe",
195                     "template_name": "pe2",
196                     "properties": {
197                         "id": {
198                             "type_name": "string"
199                         }
200                     },
201                     "interfaces": [
202                         {
203                             "name": "Standard",
204                             "type_name": "tosca.interfaces.node.lifecycle.Standard"
205                         }
206                     ],
207                     "capabilities": [
208                         {
209                             "name": "feature",
210                             "type_name": "tosca.capabilities.Node"
211                         },
212                         {
213                             "name": "pe",
214                             "type_name": "tosca.capabilities.sdn.pe"
215                         }
216                     ]
217                 }
218             ],
219             "substitution": {
220                 "node_type_name": "tosca.nodes.sdn.ext.NS.ns_underlayervpn"
221             },
222             "inputs": {
223                 "ac2_ip": {
224                     "type_name": "string",
225                     "description": "ac2_ipofunderlayvpn"
226                 },
227                 "ac2_route": {
228                     "type_name": "string",
229                     "description": "ac2_routeofunderlayvpn"
230                 },
231                 "serviceType": {
232                     "type_name": "string",
233                     "description": "serviceTypeofunderlayvpn"
234                 },
235                 "description": {
236                     "type_name": "string",
237                     "description": "descriptionofunderlayvpn"
238                 },
239                 "pe2_id": {
240                     "type_name": "string",
241                     "description": "pe2_idofunderlayvpn"
242                 },
243                 "ac1_route": {
244                     "type_name": "string",
245                     "description": "ac1_routeofunderlayvpn"
246                 },
247                 "ac1_svlan": {
248                     "type_name": "integer",
249                     "description": "ac1_svlanofunderlayvpn"
250                 },
251                 "name": {
252                     "type_name": "string",
253                     "description": "Nameofunderlayervpn"
254                 },
255                 "ac1_ip": {
256                     "type_name": "string",
257                     "description": "ac1_ipofunderlayvpn"
258                 },
259                 "ac2_port": {
260                     "type_name": "string",
261                     "description": "ac2_portofunderlayvpn"
262                 },
263                 "pe1_id": {
264                     "type_name": "string",
265                     "description": "pe1_idofunderlayvpn"
266                 },
267                 "technology": {
268                     "type_name": "string",
269                     "description": "technologyofunderlayvpn"
270                 },
271                 "ac1_port": {
272                     "type_name": "string",
273                     "description": "ac1_portofunderlayvpn"
274                 },
275                 "ac2_svlan": {
276                     "type_name": "integer",
277                     "description": "ac2_svlanofunderlayvpn"
278                 },
279                 "topology": {
280                     "type_name": "string",
281                     "description": "topologyofunderlayvpn"
282                 }
283             }
284         }
285     }
286 }
287
288
289 vnfd_model_dict = {
290     'metadata': {
291         'vendor': u'zte',
292         'is_shared': False,
293         'description': '',
294         'domain_type': u'CN',
295         'version': u'v4.14.10',
296         'vmnumber_overquota_alarm': False,
297         'cross_dc': False,
298         'vnf_type': u'SSS',
299         'vnfd_version': u'V00000001',
300         'id': u'sss-vnf-template',
301         'name': u'sss-vnf-template'
302     },
303     'vdus': [
304         {
305             "vdu_id": "vdu1Id",
306             "description": "vdu description",
307             "properties": {
308                 "name": "vduinstname",
309                 "vdu_type": "OMP",
310                 "key_vdu": True,
311                 "support_scaling": True,
312                 "location_info": {
313                     "vimid": "vimid",
314                     "tenant": "tenantname",
315                     "availability_zone": "zone1",
316                     "host": "host1"
317                 },
318                 "local_affinity_antiaffinity_rule": [
319                     {
320                         "affinity_antiaffinity": "anti-affinity",
321                         "scope": "node"
322                     },
323                     {
324                         "affinity_antiaffinity": "affinity",
325                         "scope": "zone"
326                     }
327                 ],
328                 "inject_data_list": [
329                     {
330                         "file_name": "abc.xml",
331                         "file_data": "<a>xxx</a><b>ssss</b>"
332                     }
333                 ],
334                 "storage_policy": "HIGH",
335                 "template_id": "26",
336                 "manual_scale_select_vim": False,
337                 "watchdog": {
338                     "enabledelay": 600000,
339                     "action": "reset"
340                 },
341                 "is_predefined": False,
342                 "allow_scale_updown": False,
343                 "inject_network_address": True,
344                 "inner_hugepage_num": 100,
345                 "inner_hugepage_size": "2048",
346                 "action": "add"
347             },
348             "image_file": u'sss',
349             "local_storages": [
350                 "local_storage_id1",
351                 "local_storage_id2"
352             ],
353             "volume_storages": [
354                 {
355                     "volume_storage_id": "volume_storage1",
356                     "location": "/usr/data",
357                     "device": "/dev/hda1"
358                 }
359             ],
360             "dependencies": [
361                 "vdu1Id",
362                 "vduNId"
363             ],
364             "nfv_compute": {
365                 "num_cpus": 4,
366                 "mem_size": "1024MB",
367                 "cpu_frequency": "1GHz",
368                 "flavor_extra_specs": {
369                     "hw: cpu_policy": "shared",
370                     "hw: cpu_max_threads": 50,
371                     "hw: cpu_sockets": 10,
372                     "hw: cpu_max_sockets": 20,
373                     "hw: cpu_max_cores": 8,
374                     "hw: cpu_threads": 30,
375                     "hw: numa_mem.0": 12288,
376                     "hw: hugepage_num": 100,
377                     "hw: high_performance": "dvs_high",
378                     "hw: numa_nodes": 1,
379                     "hw: numa_cpus.0": "2,4,8",
380                     "hw: numa_pci": True,
381                     "hw: cpu_cores": 4,
382                     "pci_passthrough: alias": "ColetoCreek: 1",
383                     "hw: mem_page_size": "large",
384                     "hw: mem_paging_mechanism": "EPT"
385                 }
386             },
387             "vls": [
388                 "vlId1",
389             ],
390             "cps": [
391                 "cpId1",
392             ],
393             "scalable": {
394                 "min_instances": 1,
395                 "max_instances": 2,
396                 "default_instances": 1
397             },
398             "interfaces": {
399                 "Standard": {
400                     "create": {
401                         "implementation": "<implementationScript>",
402                         "inputs": {
403                             "param1Name": "value1",
404                             "paramNName": "valueN"
405                         }
406                     },
407                     "configure": {
408                         "implementation": "<implementationScript>",
409                         "inputs": {
410                             "param1Name": "value1",
411                             "paramNName": "valueN"
412                         }
413                     },
414                     "start": {
415                         "implementation": "<implementationScript>",
416                         "inputs": {
417                             "param1Name": "value1",
418                             "paramNName": "valueN"
419                         }
420                     },
421                     "stop": {
422                         "implementation": "<implementationScript>",
423                         "inputs": {
424                             "param1Name": "value1",
425                             "paramNName": "valueN"
426                         }
427                     },
428                     "delete": {
429                         "implementation": "<implementationScript>",
430                         "inputs": {
431                             "param1Name": "value1",
432                             "paramNName": "valueN"
433                         }
434                     }
435                 }
436             },
437             "artifacts": [
438                 {
439                     "artifact_name": "software_version_file",
440                     "type": "tosca.artifacts.Deployment",
441                     "file": "AppSoftwares/zte-cn-xgw-V5.16.11_NFV-version.zip",
442                     "repository": "",
443                     "deploy_path": ""
444                 }
445             ]
446         }
447     ],
448     'volume_storages': [
449         {
450             "volume_storage_id": "volume_storage1",
451             "description": "",
452             "properties": {
453                 "size": "100 GB",
454                 "volume_id": "",
455                 "volume_name": "volumeStorage1",
456                 "custom_volume_type": "type1",
457                 "disk_type": "data",
458                 "delete_on_termination_vm": True,
459                 "location_info": {
460                     "vimid": "vimid_1",
461                     "tenant": "tenantname_1",
462                     "availability_zone": "zone1"
463                 },
464                 "is_predefined": False,
465                 "is_shared": False
466             },
467             "image_file": [
468                 "volume_image"
469             ]
470         }
471     ],
472     'policies': {
473         'scaling': {
474             'targets': {
475
476             },
477             'policy_id': u'policy_scale_sss-vnf-template',
478             'properties': {
479                 'policy_file': '*-vnfd.zip/*-vnf-policy.xml'
480             },
481             'description': ''
482         }
483     },
484     'image_files': [
485         {
486             'description': '',
487             'properties': {
488                 'name': u'opencos_sss_omm_img_release_20150723-1-disk1.vmdk',
489                 'checksum': '',
490                 'disk_format': u'VMDK',
491                 'file_url': u'./zte-cn-sss-main-image/OMM/opencos_sss_omm_img_release_20150723-1-disk1.vmdk',
492                 'container_type': 'vm',
493                 'version': '',
494                 'hypervisor_type': 'kvm'
495             },
496             'image_file_id': u'opencos_sss_omm_img_release_20150723-1-disk1'
497         },
498         {
499             'description': '',
500             'properties': {
501                 'name': u'sss.vmdk',
502                 'checksum': '',
503                 'disk_format': u'VMDK',
504                 'file_url': u'./zte-cn-sss-main-image/NE/sss.vmdk',
505                 'container_type': 'vm',
506                 'version': '',
507                 'hypervisor_type': 'kvm'
508             },
509             'image_file_id': u'sss'
510         }
511     ],
512     'vls': [
513         {
514             "vl_id": "vldId1",
515             "description": "",
516             "properties": {
517                 "name": "umac_241_control",
518                 "network_name": "umac_control",
519                 "is_predefined": False,
520                 "vendor": "zte",
521                 "netmask": "255.255.255.0",
522                 "mtu": 1500,
523                 "network_type": "vlan",
524                 "physical_network": "phynet01",
525                 "segmentation_id": "30",
526                 "vlan_transparent": False,
527                 "vds_name": "vds1",
528                 "cidr": "192.168.199.0/24",
529                 "ip_version": 4,
530                 "gateway_ip": "192.168.199.1",
531                 "dhcp_enabled": False,
532                 "dns_nameservers": [
533                     "192.168.0.4",
534                     "192.168.0.10"
535                 ],
536                 "start_ip": "192.168.199.2",
537                 "end_ip": "192.168.199.254",
538                 "host_routes": [
539                     {
540                         "destination": "10.43.26.0/24",
541                         "nexthop": "10.41.23.1"
542                     }
543                 ],
544                 "location_info": {
545                     "vimid": "vimid_1",
546                     "tenant": "tenantname_1"
547                 },
548                 "cloud_type": "IaaS"
549             },
550             "route_id": "router01",
551             "route_external": False
552         }
553     ],
554     'cps': [
555         {
556             "cp_id": "cpId1",
557             "description": "",
558             "properties": {
559                 "name": "",
560                 "mac_address": "00:d9:00:82:11:e1",
561                 "ip_address:": "192.168.1.21",
562                 "ip_range_start": "192.168.1.20",
563                 "ip_range_end": "192.168.1.29",
564                 "floating_ip_address": {
565                     "external_network": "extnet01",
566                     "ip_address": "10.43.53.23"
567                 },
568                 "service_ip_address": "192.168.1.23",
569                 "order": 1,
570                 "bandwidth": 1000,
571                 "vnic_type": "normal",
572                 "allowed_address_pairs": [
573                     {
574                         "ip": "192.168.1.13",
575                         "mac": "00:f3:43:20:a2:a3"
576                     }
577                 ],
578                 "bond": "none",
579                 "bond_index": 1,
580                 "macbond": "00:d9:00:82:11:d1",
581                 "sfc_encapsulation": "",
582                 "direction": "",
583                 "gateway_ip": "192.168.199.1",
584                 "netmask": "255.255.255.0",
585                 "interface_name": "fe-01-02",
586                 "is_virtual": False,
587                 "function": "control"
588             },
589             "vl_id": "vldId1",
590             "vdu_id": "vdu1Id"
591         }
592     ],
593     'local_storages': [
594
595     ],
596 }
597
598 c1_data_get_tenant_id = {  # get_tenant_id
599     "tenants": [
600         {
601             "id": "1",
602             "name": "tenantname_1"
603         }
604     ]
605 }
606 c2_data_create_volume = {
607     "id": "4bd3e9eb-cd8b-456a-8589-910836a0ab31",
608     "name": "volume1",
609     "returnCode": 1,
610     "vimId": "vim_volume_1",
611     "vimName": "vim_volume_1",
612     "tenantId": "vim_volume_1",
613     "volumeType": "123",
614     "availabilityZone": "availabilityZone",
615     "status": "availuable",
616     "createTime": "2015-12-02T06:39:40.000000",
617     "type": None,
618     "size": 40
619 }
620 c3_data_get_volume = {  # get_volume
621     "status": "available",
622     "name": "wangsong",
623     "attachments": [
624         {
625             "device": "/dev/vdc",
626             "serverId": "3030e666-528e-4954-88f5-cc21dab1262b",
627             "volumeId": "4bd3e9eb-cd8b-456a-8589-910836a0ab31",
628             "hostName": None,
629             "id": "4bd3e9eb-cd8b-456a-8589-910836a0ab31"
630         }
631     ],
632     "createTime": "2015-12-02T06:39:40.000000",
633     "type": None,
634     "id": "4bd3e9eb-cd8b-456a-8589-910836a0ab31",
635     "size": 40
636 }
637 c4_data_create_network = {  # create_network
638     "returnCode": 0,
639     "vimId": "11111",
640     "vimName": "11111",
641     "status": "ACTIVE",
642     "id": "3c9eebdbbfd345658269340b9ea6fb73",
643     "name": "net1",
644     "tenantId": "tenant1",
645     "networkName": "ommnet",
646     "shared": True,
647     "vlanTransparent": True,
648     "networkType": "vlan",
649     "segmentationId": 202,
650     "physicalNetwork": "ctrl",
651     "routerExternal": False
652 }
653 c5_data_create_subnet = {
654     "returnCode": 0,
655     "vimId": "11111",
656     "vimName": "11111",
657     "status": " ACTIVE",
658     "id": "d62019d3-bc6e-4319-9c1d-6722fc136a23",
659     "tenantId": "tenant1",
660     "networkId": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
661     "networkName": "networkName",
662     "name": "subnet1",
663     "cidr": "10.43.35.0/24",
664     "ipVersion": 4,
665     "enableDhcp": 1,
666     "gatewayIp": "10.43.35.1",
667     "dnsNameservers": [],
668     "allocationPools": [
669         {
670             "start": "192.168.199.2",
671             "end": "192.168.199.254"
672         }
673     ],
674     "hostRoutes": []
675 }
676 c6_data_create_port = {
677     "returnCode": 0,
678     "vimId": "11111",
679     "vimName": "11111",
680     "status": " ACTIVE",
681     "id": " 872019d3-bc6e-4319-9c1d-6722fc136afg",
682     "tenantId": "tenant1",
683     "name": "subnet1",
684     "networkId": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
685     "networkName": "networkName",
686     "subnetId": "d62019d3-bc6e-4319-9c1d-6722fc136a23",
687     "subnetName": "subnet1",
688     "macAddress": "212.12.61.23",
689     "ip": "10.43.38.11",
690     "vnicType": "normal",
691     "securityGroups": ""
692 }
693 c7_data_create_flavor ={
694     "returnCode": 0,
695     "vimId": "11111",
696     "vimName": "11111",
697     "id": "142019d3-bc6e-4319-9c1d-6722fc136afg",
698     "tenantId": "tenant1",
699     "name": "subnet1",
700     "vcpu": 5,
701     "memory": 2,
702     "disk": 40,
703     "ephemeral": 40,
704     "swap": 20,
705     "isPublic": True,
706     "extraSpecs": "testtt"
707 }
708
709 c8_data_list_image = {
710     "vimid": "",
711     "vimname": "",
712     "imageList": [
713         {
714             "status": "active",
715             "id": "5e2757c1-f846-4727-915c-9a872553ed75",
716             "size": 862016,
717             "name": u'sss.vmdk'
718         }
719     ]
720 }
721 c9_data_create_vm = {
722     "returnCode": 1,
723     "id": "3c9eebdbbfd345658269340b9ea6fb73",
724     "name": "vm1",
725     "vimId": "11111",
726     "vimName": "11111",
727     "tenantId": "tenant1",
728     "boot": "boot_1",
729     "nicArray": "dfdf",
730     "volumeArray": "dfdf",
731     "availabilityZone": "fdvfdv",
732     "flavorId": "fdvfdv",
733     "metadata": "fdvfdv",
734     "securityGroups": "fdvfdv",
735     "serverGroup": "fdvfdv",
736     "status": "ACTIVE"
737 }
738 c10_data_get_vm = {
739     "returnCode": 1,
740     "id": "3c9eebdbbfd345658269340b9ea6fb73",
741     "name": "vm1",
742     "vimId": "11111",
743     "vimName": "11111",
744     "tenantId": "tenant1",
745     "status": "ACTIVE"
746 }