Modify code of create flavour
[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": "omm_image",
349             "local_storages": [
350                 "local_storage_id1",
351                 "local_storage_id2"
352             ],
353             "volume_storages": [
354                 {
355                     "volume_storage_id": "volume_storage_id1",
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                 "vlIdN"
390             ],
391             "cps": [
392                 "cpId1",
393                 "cpIdN"
394             ],
395             "scalable": {
396                 "min_instances": 1,
397                 "max_instances": 2,
398                 "default_instances": 1
399             },
400             "interfaces": {
401                 "Standard": {
402                     "create": {
403                         "implementation": "<implementationScript>",
404                         "inputs": {
405                             "param1Name": "value1",
406                             "paramNName": "valueN"
407                         }
408                     },
409                     "configure": {
410                         "implementation": "<implementationScript>",
411                         "inputs": {
412                             "param1Name": "value1",
413                             "paramNName": "valueN"
414                         }
415                     },
416                     "start": {
417                         "implementation": "<implementationScript>",
418                         "inputs": {
419                             "param1Name": "value1",
420                             "paramNName": "valueN"
421                         }
422                     },
423                     "stop": {
424                         "implementation": "<implementationScript>",
425                         "inputs": {
426                             "param1Name": "value1",
427                             "paramNName": "valueN"
428                         }
429                     },
430                     "delete": {
431                         "implementation": "<implementationScript>",
432                         "inputs": {
433                             "param1Name": "value1",
434                             "paramNName": "valueN"
435                         }
436                     }
437                 }
438             },
439             "artifacts": [
440                 {
441                     "artifact_name": "software_version_file",
442                     "type": "tosca.artifacts.Deployment",
443                     "file": "AppSoftwares/zte-cn-xgw-V5.16.11_NFV-version.zip",
444                     "repository": "",
445                     "deploy_path": ""
446                 }
447             ]
448         }
449     ],
450     'volume_storages': [
451         {
452             "volume_storage_id": "volume_storage1",
453             "description": "",
454             "properties": {
455                 "size": "100 GB",
456                 "volume_id": "",
457                 "volume_name": "volumeStorage1",
458                 "custom_volume_type": "type1",
459                 "disk_type": "data",
460                 "delete_on_termination_vm": True,
461                 "location_info": {
462                     "vimid": "vimid_1",
463                     "tenant": "tenantname_1",
464                     "availability_zone": "zone1"
465                 },
466                 "is_predefined": False,
467                 "is_shared": False
468             },
469             "image_file": [
470                 "volume_image"
471             ]
472         }
473     ],
474     'policies': {
475         'scaling': {
476             'targets': {
477
478             },
479             'policy_id': u'policy_scale_sss-vnf-template',
480             'properties': {
481                 'policy_file': '*-vnfd.zip/*-vnf-policy.xml'
482             },
483             'description': ''
484         }
485     },
486     'image_files': [
487         {
488             'description': '',
489             'properties': {
490                 'name': u'opencos_sss_omm_img_release_20150723-1-disk1.vmdk',
491                 'checksum': '',
492                 'disk_format': u'VMDK',
493                 'file_url': u'./zte-cn-sss-main-image/OMM/opencos_sss_omm_img_release_20150723-1-disk1.vmdk',
494                 'container_type': 'vm',
495                 'version': '',
496                 'hypervisor_type': 'kvm'
497             },
498             'image_file_id': u'opencos_sss_omm_img_release_20150723-1-disk1'
499         },
500         {
501             'description': '',
502             'properties': {
503                 'name': u'sss.vmdk',
504                 'checksum': '',
505                 'disk_format': u'VMDK',
506                 'file_url': u'./zte-cn-sss-main-image/NE/sss.vmdk',
507                 'container_type': 'vm',
508                 'version': '',
509                 'hypervisor_type': 'kvm'
510             },
511             'image_file_id': u'sss'
512         }
513     ],
514     'vls': [
515         {
516             "vl_id": "vldId1",
517             "description": "",
518             "properties": {
519                 "name": "umac_241_control",
520                 "network_name": "umac_control",
521                 "is_predefined": False,
522                 "vendor": "zte",
523                 "netmask": "255.255.255.0",
524                 "mtu": 1500,
525                 "network_type": "vlan",
526                 "physical_network": "phynet01",
527                 "segmentation_id": "30",
528                 "vlan_transparent": False,
529                 "vds_name": "vds1",
530                 "cidr": "192.168.199.0/24",
531                 "ip_version": 4,
532                 "gateway_ip": "192.168.199.1",
533                 "dhcp_enabled": False,
534                 "dns_nameservers": [
535                     "192.168.0.4",
536                     "192.168.0.10"
537                 ],
538                 "start_ip": "192.168.199.2",
539                 "end_ip": "192.168.199.254",
540                 "host_routes": [
541                     {
542                         "destination": "10.43.26.0/24",
543                         "nexthop": "10.41.23.1"
544                     }
545                 ],
546                 "location_info": {
547                     "vimid": "vimid_1",
548                     "tenant": "tenantname_1"
549                 },
550                 "cloud_type": "IaaS"
551             },
552             "route_id": "router01",
553             "route_external": False
554         }
555     ],
556     'cps': [
557         {
558             "cp_id": "cpId",
559             "description": "",
560             "properties": {
561                 "name": "",
562                 "mac_address": "00:d9:00:82:11:e1",
563                 "ip_address:": "192.168.1.21",
564                 "ip_range_start": "192.168.1.20",
565                 "ip_range_end": "192.168.1.29",
566                 "floating_ip_address": {
567                     "external_network": "extnet01",
568                     "ip_address": "10.43.53.23"
569                 },
570                 "service_ip_address": "192.168.1.23",
571                 "order": 1,
572                 "bandwidth": 1000,
573                 "vnic_type": "normal",
574                 "allowed_address_pairs": [
575                     {
576                         "ip": "192.168.1.13",
577                         "mac": "00:f3:43:20:a2:a3"
578                     }
579                 ],
580                 "bond": "none",
581                 "bond_index": 1,
582                 "macbond": "00:d9:00:82:11:d1",
583                 "sfc_encapsulation": "",
584                 "direction": "",
585                 "gateway_ip": "192.168.199.1",
586                 "netmask": "255.255.255.0",
587                 "interface_name": "fe-01-02",
588                 "is_virtual": False,
589                 "function": "control"
590             },
591             "vl_id": "vldId1",
592             "vdu_id": "vdu1Id"
593         }
594     ],
595     'local_storages': [
596
597     ],
598 }
599
600 c1_data_get_tenant_id = {  # get_tenant_id
601     "tenants": [
602         {
603             "id": "1",
604             "name": "tenantname_1"
605         }
606     ]
607 }
608 c2_data_create_volume = {
609     "id": "4bd3e9eb-cd8b-456a-8589-910836a0ab31",
610     "name": "volume1",
611     "returnCode": 1,
612     "vimId": "vim_volume_1",
613     "vimName": "vim_volume_1",
614     "tenantId": "vim_volume_1",
615     "volumeType": "123",
616     "availabilityZone": "availabilityZone",
617     "status": "availuable",
618     "createTime": "2015-12-02T06:39:40.000000",
619     "type": None,
620     "size": 40
621 }
622 c3_data_get_volume = {  # get_volume
623     "status": "available",
624     "name": "wangsong",
625     "attachments": [
626         {
627             "device": "/dev/vdc",
628             "serverId": "3030e666-528e-4954-88f5-cc21dab1262b",
629             "volumeId": "4bd3e9eb-cd8b-456a-8589-910836a0ab31",
630             "hostName": None,
631             "id": "4bd3e9eb-cd8b-456a-8589-910836a0ab31"
632         }
633     ],
634     "createTime": "2015-12-02T06:39:40.000000",
635     "type": None,
636     "id": "4bd3e9eb-cd8b-456a-8589-910836a0ab31",
637     "size": 40
638 }
639 c4_data_create_network = {  # create_network
640     "returnCode": 0,
641     "vimId": "11111",
642     "vimName": "11111",
643     "status": "ACTIVE",
644     "id": "3c9eebdbbfd345658269340b9ea6fb73",
645     "name": "net1",
646     "tenantId": "tenant1",
647     "networkName": "ommnet",
648     "shared": True,
649     "vlanTransparent": True,
650     "networkType": "vlan",
651     "segmentationId": 202,
652     "physicalNetwork": "ctrl",
653     "routerExternal": False
654 }
655 c5_data_create_subnet = {
656     "returnCode": 0,
657     "vimId": "11111",
658     "vimName": "11111",
659     "status": " ACTIVE",
660     "id": "d62019d3-bc6e-4319-9c1d-6722fc136a23",
661     "tenantId": "tenant1",
662     "networkId": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
663     "networkName": "networkName",
664     "name": "subnet1",
665     "cidr": "10.43.35.0/24",
666     "ipVersion": 4,
667     "enableDhcp": 1,
668     "gatewayIp": "10.43.35.1",
669     "dnsNameservers": [],
670     "allocationPools": [
671         {
672             "start": "192.168.199.2",
673             "end": "192.168.199.254"
674         }
675     ],
676     "hostRoutes": []
677 }
678 c6_data_create_port = {
679     "returnCode": 0,
680     "vimId": "11111",
681     "vimName": "11111",
682     "status": " ACTIVE",
683     "id": " 872019d3-bc6e-4319-9c1d-6722fc136afg",
684     "tenantId": "tenant1",
685     "name": "subnet1",
686     "networkId": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
687     "networkName": "networkName",
688     "subnetId": "d62019d3-bc6e-4319-9c1d-6722fc136a23",
689     "subnetName": "subnet1",
690     "macAddress": "212.12.61.23",
691     "ip": "10.43.38.11",
692     "vnicType": "normal",
693     "securityGroups": ""
694 }
695 c1_data_create_flavor ={
696     "returnCode": 0,
697     "vimId": "11111",
698     "vimName": "11111",
699     "id": "142019d3-bc6e-4319-9c1d-6722fc136afg",
700     "tenantId": "tenant1",
701     "name": "subnet1",
702     "vcpu": 5,
703     "memory": 2,
704     "disk": 40,
705     "ephemeral": 40,
706     "swap": 20,
707     "isPublic": True,
708     "extraSpecs": "testtt"
709 }