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