1 # Copyright 2017 ZTE Corporation.
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
7 # http://www.apache.org/licenses/LICENSE-2.0
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.
15 from lcm.pub.utils.jobutil import enum
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")
22 "flavourId": "flavour_1",
23 "instantiationLevelId": "instantiationLevel_1",
26 # "vlInstanceId": "1",
33 # "protocolType": "http"
36 # "tenant": "tenant_vCPE",
38 # "password": "vCPE_321"
40 # "interfaceEndpoint": "http://10.43.21.105:80/"
42 # "resourceId": "1246",
48 # "addressType": "MAC",
49 # "l2AddressData": "00:f3:43:20:a2:a3"
52 # "addressType": "IP",
54 # "iPAddressType": "IPv4",
55 # "iPAddress": "192.168.104.2"
59 # "numDynamicAddresses": 0
65 "resourceId": '55_network',
66 "resourceSubnetId": '55_subnet',
73 "localizationLanguage": "en_US",
74 "additionalParams": {}
82 "name": "underlayervpn",
85 "csarProvider": "huawei",
88 "id": "ns_underlayervpn_1_0"
92 "id": "ac2_fdhrbk3dvan8hl5wifm9lp1e9",
93 "type_name": "tosca.nodes.sdn.l3ac",
94 "template_name": "ac2",
100 "type_name": "string"
103 "type_name": "string"
106 "type_name": "string"
112 "type_name": "tosca.interfaces.node.lifecycle.Standard"
118 "type_name": "tosca.capabilities.Node"
122 "type_name": "tosca.capabilities.sdn.ac"
127 "target_node_id": "pe2_go3vo1ctxr1vlbl0ij8stbtj6",
128 "target_capability_name": "feature"
131 "target_node_id": "ac2_fdhrbk3dvan8hl5wifm9lp1e9",
132 "target_capability_name": "feature"
137 "id": "ac1_jqows1ai0j0cmwk9jdvuknt97",
138 "type_name": "tosca.nodes.sdn.l3ac",
139 "template_name": "ac1",
142 "type_name": "string"
145 "type_name": "string"
148 "type_name": "string"
151 "type_name": "string"
157 "type_name": "tosca.interfaces.node.lifecycle.Standard"
163 "type_name": "tosca.capabilities.Node"
167 "type_name": "tosca.capabilities.sdn.ac"
172 "target_node_id": "pe1_e58ekps6m45g6w9egs9lue2j7",
173 "target_capability_name": "feature"
176 "target_node_id": "ac2_fdhrbk3dvan8hl5wifm9lp1e9",
177 "target_capability_name": "feature"
182 "id": "vpn_ie0xim076f7cje67fvrrq9tg1",
183 "type_name": "tosca.nodes.sdn.underlayVPN",
184 "template_name": "vpn",
187 "type_name": "string"
190 "type_name": "string"
193 "type_name": "string"
196 "type_name": "string"
202 "type_name": "tosca.interfaces.node.lifecycle.Standard"
208 "type_name": "tosca.capabilities.Node"
213 "target_node_id": "ac1_jqows1ai0j0cmwk9jdvuknt97",
214 "target_capability_name": "feature"
217 "target_node_id": "ac2_fdhrbk3dvan8hl5wifm9lp1e9",
218 "target_capability_name": "feature"
223 "id": "pe1_e58ekps6m45g6w9egs9lue2j7",
224 "type_name": "tosca.nodes.sdn.l3pe",
225 "template_name": "pe1",
228 "type_name": "string"
234 "type_name": "tosca.interfaces.node.lifecycle.Standard"
240 "type_name": "tosca.capabilities.Node"
244 "type_name": "tosca.capabilities.sdn.pe"
249 "id": "pe2_go3vo1ctxr1vlbl0ij8stbtj6",
250 "type_name": "tosca.nodes.sdn.l3pe",
251 "template_name": "pe2",
254 "type_name": "string"
260 "type_name": "tosca.interfaces.node.lifecycle.Standard"
266 "type_name": "tosca.capabilities.Node"
270 "type_name": "tosca.capabilities.sdn.pe"
276 "node_type_name": "tosca.nodes.sdn.ext.NS.ns_underlayervpn"
280 "type_name": "string",
281 "description": "ac2_ipofunderlayvpn"
284 "type_name": "string",
285 "description": "ac2_routeofunderlayvpn"
288 "type_name": "string",
289 "description": "serviceTypeofunderlayvpn"
292 "type_name": "string",
293 "description": "descriptionofunderlayvpn"
296 "type_name": "string",
297 "description": "pe2_idofunderlayvpn"
300 "type_name": "string",
301 "description": "ac1_routeofunderlayvpn"
304 "type_name": "integer",
305 "description": "ac1_svlanofunderlayvpn"
308 "type_name": "string",
309 "description": "Nameofunderlayervpn"
312 "type_name": "string",
313 "description": "ac1_ipofunderlayvpn"
316 "type_name": "string",
317 "description": "ac2_portofunderlayvpn"
320 "type_name": "string",
321 "description": "pe1_idofunderlayvpn"
324 "type_name": "string",
325 "description": "technologyofunderlayvpn"
328 "type_name": "string",
329 "description": "ac1_portofunderlayvpn"
332 "type_name": "integer",
333 "description": "ac2_svlanofunderlayvpn"
336 "type_name": "string",
337 "description": "topologyofunderlayvpn"
350 'domain_type': u'CN',
351 'version': u'v4.14.10',
352 'vmnumber_overquota_alarm': False,
355 'vnfd_version': u'V00000001',
356 'id': u'sss-vnf-template',
357 'name': u'sss-vnf-template'
362 "description": "vdu description",
364 "name": "vduinstname",
367 "support_scaling": True,
370 "tenant": "tenantname",
371 "availability_zone": "zone1",
374 "local_affinity_antiaffinity_rule": [
376 "affinity_antiaffinity": "anti-affinity",
380 "affinity_antiaffinity": "affinity",
384 "inject_data_list": [
386 "file_name": "abc.xml",
387 "file_data": "<a>xxx</a><b>ssss</b>"
390 "storage_policy": "HIGH",
392 "manual_scale_select_vim": False,
394 "enabledelay": 600000,
397 "is_predefined": False,
398 "allow_scale_updown": False,
399 "inject_network_address": True,
400 "inner_hugepage_num": 100,
401 "inner_hugepage_size": "2048",
404 "image_file": u'sss',
411 "volume_storage_id": "volume_storage1",
412 "location": "/usr/data",
413 "device": "/dev/hda1"
422 "mem_size": "1024MB",
423 "cpu_frequency": "1GHz",
424 "flavor_extra_specs": {
425 "hw: cpu_policy": "shared",
426 "hw: cpu_max_threads": 50,
427 "hw: cpu_sockets": 10,
428 "hw: cpu_max_sockets": 20,
429 "hw: cpu_max_cores": 8,
430 "hw: cpu_threads": 30,
431 "hw: numa_mem.0": 12288,
432 "hw: hugepage_num": 100,
433 "hw: high_performance": "dvs_high",
435 "hw: numa_cpus.0": "2,4,8",
436 "hw: numa_pci": True,
438 "pci_passthrough: alias": "ColetoCreek: 1",
439 "hw: mem_page_size": "large",
440 "hw: mem_paging_mechanism": "EPT"
452 "default_instances": 1
457 "implementation": "<implementationScript>",
459 "param1Name": "value1",
460 "paramNName": "valueN"
464 "implementation": "<implementationScript>",
466 "param1Name": "value1",
467 "paramNName": "valueN"
471 "implementation": "<implementationScript>",
473 "param1Name": "value1",
474 "paramNName": "valueN"
478 "implementation": "<implementationScript>",
480 "param1Name": "value1",
481 "paramNName": "valueN"
485 "implementation": "<implementationScript>",
487 "param1Name": "value1",
488 "paramNName": "valueN"
495 "artifact_name": "software_version_file",
496 "type": "tosca.artifacts.Deployment",
497 "file": "AppSoftwares/zte-cn-xgw-V5.16.11_NFV-version.zip",
506 "volume_storage_id": "volume_storage1",
511 "volume_name": "volumeStorage1",
512 "custom_volume_type": "type1",
514 "delete_on_termination_vm": True,
517 "tenant": "tenantname_1",
518 "availability_zone": "zone1"
520 "is_predefined": False,
533 'policy_id': u'policy_scale_sss-vnf-template',
535 'policy_file': '*-vnfd.zip/*-vnf-policy.xml'
544 'name': u'opencos_sss_omm_img_release_20150723-1-disk1.vmdk',
546 'disk_format': u'VMDK',
547 'file_url': u'./zte-cn-sss-main-image/OMM/opencos_sss_omm_img_release_20150723-1-disk1.vmdk',
548 'container_type': 'vm',
550 'hypervisor_type': 'kvm'
552 'image_file_id': u'opencos_sss_omm_img_release_20150723-1-disk1'
559 'disk_format': u'VMDK',
560 'file_url': u'./zte-cn-sss-main-image/NE/sss.vmdk',
561 'container_type': 'vm',
563 'hypervisor_type': 'kvm'
565 'image_file_id': u'sss'
573 "name": "umac_241_control",
574 "network_name": "umac_control",
575 "is_predefined": False,
577 "netmask": "255.255.255.0",
579 "network_type": "vlan",
580 "physical_network": "phynet01",
581 "segmentation_id": "30",
582 "vlan_transparent": False,
584 "cidr": "192.168.199.0/24",
586 "gateway_ip": "192.168.199.1",
587 "dhcp_enabled": False,
592 "start_ip": "192.168.199.2",
593 "end_ip": "192.168.199.254",
596 "destination": "10.43.26.0/24",
597 "nexthop": "10.41.23.1"
602 "tenant": "tenantname_1"
606 "route_id": "router01",
607 "route_external": False
616 "mac_address": "00:d9:00:82:11:e1",
617 "ip_address:": "192.168.1.21",
618 "ip_range_start": "192.168.1.20",
619 "ip_range_end": "192.168.1.29",
620 "floating_ip_address": {
621 "external_network": "extnet01",
622 "ip_address": "10.43.53.23"
624 "service_ip_address": "192.168.1.23",
627 "vnic_type": "normal",
628 "allowed_address_pairs": [
630 "ip": "192.168.1.13",
631 "mac": "00:f3:43:20:a2:a3"
636 "macbond": "00:d9:00:82:11:d1",
637 "sfc_encapsulation": "",
639 "gateway_ip": "192.168.199.1",
640 "netmask": "255.255.255.0",
641 "interface_name": "fe-01-02",
643 "function": "control"
654 c1_data_get_tenant_id = { # get_tenant_id
658 "name": "tenantname_1"
662 c2_data_create_volume = {
663 "id": "4bd3e9eb-cd8b-456a-8589-910836a0ab31",
666 "vimId": "vim_volume_1",
667 "vimName": "vim_volume_1",
668 "tenantId": "vim_volume_1",
670 "availabilityZone": "availabilityZone",
671 "status": "availuable",
672 "createTime": "2015-12-02T06:39:40.000000",
676 c3_data_get_volume = { # get_volume
677 "status": "available",
681 "device": "/dev/vdc",
682 "serverId": "3030e666-528e-4954-88f5-cc21dab1262b",
683 "volumeId": "4bd3e9eb-cd8b-456a-8589-910836a0ab31",
685 "id": "4bd3e9eb-cd8b-456a-8589-910836a0ab31"
688 "createTime": "2015-12-02T06:39:40.000000",
690 "id": "4bd3e9eb-cd8b-456a-8589-910836a0ab31",
693 c4_data_create_network = { # create_network
698 "id": "3c9eebdbbfd345658269340b9ea6fb73",
700 "tenantId": "tenant1",
701 "networkName": "ommnet",
703 "vlanTransparent": True,
704 "networkType": "vlan",
705 "segmentationId": 202,
706 "physicalNetwork": "ctrl",
707 "routerExternal": False
709 c5_data_create_subnet = {
714 "id": "d62019d3-bc6e-4319-9c1d-6722fc136a23",
715 "tenantId": "tenant1",
716 "networkId": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
717 "networkName": "networkName",
719 "cidr": "10.43.35.0/24",
722 "gatewayIp": "10.43.35.1",
723 "dnsNameservers": [],
726 "start": "192.168.199.2",
727 "end": "192.168.199.254"
732 c6_data_create_port = {
737 "id": " 872019d3-bc6e-4319-9c1d-6722fc136afg",
738 "tenantId": "tenant1",
740 "networkId": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
741 "networkName": "networkName",
742 "subnetId": "d62019d3-bc6e-4319-9c1d-6722fc136a23",
743 "subnetName": "subnet1",
744 "macAddress": "212.12.61.23",
746 "vnicType": "normal",
749 c7_data_create_flavor ={
753 "id": "142019d3-bc6e-4319-9c1d-6722fc136afg",
754 "tenantId": "tenant1",
762 "extraSpecs": "testtt"
765 c8_data_list_image = {
771 "id": "5e2757c1-f846-4727-915c-9a872553ed75",
777 c9_data_create_vm = {
779 "id": "3c9eebdbbfd345658269340b9ea6fb73",
783 "tenantId": "tenant1",
786 "volumeArray": "dfdf",
787 "availabilityZone": "fdvfdv",
788 "flavorId": "fdvfdv",
789 "metadata": "fdvfdv",
790 "securityGroups": "fdvfdv",
791 "serverGroup": "fdvfdv",
796 "id": "3c9eebdbbfd345658269340b9ea6fb73",
800 "tenantId": "tenant1",