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.
16 from lcm.pub.utils.jobutil import enum
18 VNF_STATUS = enum(NULL='null', INSTANTIATING="instantiating", INACTIVE='inactive', ACTIVE="active",
19 FAILED="failed", TERMINATING="terminating", SCALING="scaling", OPERATING="operating",
20 UPDATING="updating", HEALING="healing")
22 RESOURCE_MAP = {'Storage': 'volumn', 'Network': 'network', 'SubNetwork': 'subnet', 'Port': 'port',
23 'Flavour': 'flavor', 'Vm': 'vm'}
26 "flavourId": "flavour_1",
27 "instantiationLevelId": "instantiationLevel_1",
30 "id": "extVirtualLink_1",
31 "vimConnectionId": "vimConnection_1",
32 "resourceProviderId": "resourceProvider_1",
33 "resourceId": "resource_1",
34 "resourceSubnetId": "resourceSubnet_1",
40 "cpInstanceId": "cpInstance_1",
41 "linkPortId": "linkPort_1",
44 "layerProtocol": "IP_OVER_ETHERNET",
46 "macAddress": "00:f3:43:20:a2:a3",
50 "fixedAddresses": ["192.168.104.2", ],
51 "numDynamicAddresses": 0,
53 "subnetId": "subnet_1",
65 "id": "extLinkPort_1",
67 "vimConnectionId": "vimConnection_1",
68 "resourceProviderId": "resourceProvider_1",
69 "resourceId": "resource_1",
70 "vimLevelResourceType": "vimLevelResourceType_1",
76 "extManagedVirtualLinks": [
78 "id": 'extManagedVirtualLink_1',
79 "virtualLinkDescId": 'virtualLinkDesc_1',
80 "vimConnectionId": 'vimConnection_1',
81 "resourceProviderId": 'resourceProvider_1',
82 "resourceId": 'resource_1',
85 "vimConnectionInfo": [
87 "id": 'vimConnection_1',
91 "apiVersion": "apiVersion_1",
92 "protocolType": "http"
95 "tenant": "tenant_vCPE",
97 "password": "vCPE_321",
102 "localizationLanguage": "en_US",
103 "additionalParams": {
116 'domain_type': u'CN',
117 'version': u'v4.14.10',
118 'vmnumber_overquota_alarm': False,
121 'vnfd_version': u'V00000001',
122 'id': u'sss-vnf-template',
123 'name': u'sss-vnf-template'
128 "description": "vdu description",
130 "name": "vduinstname",
133 "support_scaling": True,
136 "tenant": "tenantname",
137 "availability_zone": "zone1",
140 "local_affinity_antiaffinity_rule": [
142 "affinity_antiaffinity": "anti-affinity",
146 "affinity_antiaffinity": "affinity",
150 "inject_data_list": [
152 "file_name": "abc.xml",
153 "file_data": "<a>xxx</a><b>ssss</b>"
156 "storage_policy": "HIGH",
158 "manual_scale_select_vim": False,
160 "enabledelay": 600000,
163 "is_predefined": False,
164 "allow_scale_updown": False,
165 "inject_network_address": True,
166 "inner_hugepage_num": 100,
167 "inner_hugepage_size": "2048",
170 "image_file": u'sss',
177 "volume_storage_id": "volume_storage1",
178 "location": "/usr/data",
179 "device": "/dev/hda1"
189 "cpu_frequency": "1GHz",
190 "flavor_extra_specs": {
191 "hw: cpu_policy": "shared",
192 "hw: cpu_max_threads": 50,
193 "hw: cpu_sockets": 10,
194 "hw: cpu_max_sockets": 20,
195 "hw: cpu_max_cores": 8,
196 "hw: cpu_threads": 30,
197 "hw: numa_mem.0": 12288,
198 "hw: hugepage_num": 100,
199 "hw: high_performance": "dvs_high",
201 "hw: numa_cpus.0": "2,4,8",
202 "hw: numa_pci": True,
204 "pci_passthrough: alias": "ColetoCreek: 1",
205 "hw: mem_page_size": "large",
206 "hw: mem_paging_mechanism": "EPT"
218 "default_instances": 1
223 "implementation": "<implementationScript>",
225 "param1Name": "value1",
226 "paramNName": "valueN"
230 "implementation": "<implementationScript>",
232 "param1Name": "value1",
233 "paramNName": "valueN"
237 "implementation": "<implementationScript>",
239 "param1Name": "value1",
240 "paramNName": "valueN"
244 "implementation": "<implementationScript>",
246 "param1Name": "value1",
247 "paramNName": "valueN"
251 "implementation": "<implementationScript>",
253 "param1Name": "value1",
254 "paramNName": "valueN"
261 "artifact_name": "software_version_file",
262 "type": "tosca.artifacts.Deployment",
263 "file": "AppSoftwares/zte-cn-xgw-V5.16.11_NFV-version.zip",
272 "volume_storage_id": "volume_storage1",
277 "volume_name": "volumeStorage1",
278 "custom_volume_type": "type1",
280 "delete_on_termination_vm": True,
283 "tenant": "tenantname_1",
284 "availability_zone": "zone1"
286 "is_predefined": False,
299 'policy_id': u'policy_scale_sss-vnf-template',
301 'policy_file': '*-vnfd.zip/*-vnf-policy.xml'
310 'name': u'opencos_sss_omm_img_release_20150723-1-disk1.vmdk',
312 'disk_format': u'VMDK',
313 'file_url': u'./zte-cn-sss-main-image/OMM/opencos_sss_omm_img_release_20150723-1-disk1.vmdk',
314 'container_type': 'vm',
316 'hypervisor_type': 'kvm'
318 'image_file_id': u'opencos_sss_omm_img_release_20150723-1-disk1'
325 'disk_format': u'VMDK',
326 'file_url': u'./zte-cn-sss-main-image/NE/sss.vmdk',
327 'container_type': 'vm',
329 'hypervisor_type': 'kvm'
331 'image_file_id': u'sss'
339 "name": "umac_241_control",
340 "network_name": "umac_control",
341 "is_predefined": False,
343 "netmask": "255.255.255.0",
345 "network_type": "vlan",
346 "physical_network": "phynet01",
347 "segmentation_id": "30",
348 "vlan_transparent": False,
350 "cidr": "192.168.199.0/24",
352 "gateway_ip": "192.168.199.1",
353 "dhcp_enabled": False,
358 "start_ip": "192.168.199.2",
359 "end_ip": "192.168.199.254",
362 "destination": "10.43.26.0/24",
363 "nexthop": "10.41.23.1"
368 "tenant": "tenantname_1"
372 "route_id": "router01",
373 "route_external": False
382 "mac_address": "00:d9:00:82:11:e1",
383 "ip_address:": "192.168.1.21",
384 "ip_range_start": "192.168.1.20",
385 "ip_range_end": "192.168.1.29",
386 "floating_ip_address": {
387 "external_network": "extnet01",
388 "ip_address": "10.43.53.23"
390 "service_ip_address": "192.168.1.23",
393 "vnic_type": "normal",
394 "allowed_address_pairs": [
396 "ip": "192.168.1.13",
397 "mac": "00:f3:43:20:a2:a3"
402 "macbond": "00:d9:00:82:11:d1",
403 "sfc_encapsulation": "",
405 "gateway_ip": "192.168.199.1",
406 "netmask": "255.255.255.0",
407 "interface_name": "fe-01-02",
409 "function": "control"
421 c1_data_get_tenant_id = {
425 "name": "tenantname_1"
431 c2_data_create_volume = {
432 "id": "4bd3e9eb-cd8b-456a-8589-910836a0ab31",
435 "vimId": "vim_volume_1",
436 "vimName": "vim_volume_1",
437 "tenantId": "vim_volume_1",
439 "availabilityZone": "availabilityZone",
440 "status": "availuable",
441 "createTime": "2015-12-02T06:39:40.000000",
447 c3_data_get_volume = {
448 "status": "available",
452 "device": "/dev/vdc",
453 "serverId": "3030e666-528e-4954-88f5-cc21dab1262b",
454 "volumeId": "4bd3e9eb-cd8b-456a-8589-910836a0ab31",
456 "id": "4bd3e9eb-cd8b-456a-8589-910836a0ab31"
459 "createTime": "2015-12-02T06:39:40.000000",
461 "id": "4bd3e9eb-cd8b-456a-8589-910836a0ab31",
466 c4_data_create_network = {
471 "id": "3c9eebdbbfd345658269340b9ea6fb73",
473 "tenantId": "tenant1",
474 "networkName": "ommnet",
476 "vlanTransparent": True,
477 "networkType": "vlan",
478 "segmentationId": 202,
479 "physicalNetwork": "ctrl",
480 "routerExternal": False
484 c5_data_create_subnet = {
489 "id": "d62019d3-bc6e-4319-9c1d-6722fc136a23",
490 "tenantId": "tenant1",
491 "networkId": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
492 "networkName": "networkName",
494 "cidr": "10.43.35.0/24",
497 "gatewayIp": "10.43.35.1",
498 "dnsNameservers": [],
501 "start": "192.168.199.2",
502 "end": "192.168.199.254"
509 c6_data_create_port = {
514 "id": " 872019d3-bc6e-4319-9c1d-6722fc136afg",
515 "tenantId": "tenant1",
517 "networkId": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
518 "networkName": "networkName",
519 "subnetId": "d62019d3-bc6e-4319-9c1d-6722fc136a23",
520 "subnetName": "subnet1",
521 "macAddress": "212.12.61.23",
523 "vnicType": "normal",
528 c7_data_create_flavor = {
532 "id": "142019d3-bc6e-4319-9c1d-6722fc136afg",
533 "tenantId": "tenant1",
541 "extraSpecs": "testtt"
545 c8_data_list_image = {
551 "id": "5e2757c1-f846-4727-915c-9a872553ed75",
559 c9_data_create_vm = {
561 "id": "3c9eebdbbfd345658269340b9ea6fb73",
565 "tenantId": "tenant1",
568 "volumeArray": "dfdf",
569 "availabilityZone": "fdvfdv",
570 "flavorId": "fdvfdv",
571 "metadata": "fdvfdv",
572 "securityGroups": "fdvfdv",
573 "serverGroup": "fdvfdv",
580 "id": "3c9eebdbbfd345658269340b9ea6fb73",
584 "tenantId": "tenant1",
591 "volume_storage_id": "test",
595 "tenant": "tenantname_1",
596 "availability_zone": "test",
598 "volume_name": "test",
599 "custom_volume_type": "test",
602 "image_file": "test",
608 "description": "pe1_idofunderlayvpn"
612 "description": "pe2_idofunderlayvpn"
616 "description": "serviceTypeofunderlayvpn"
620 "description": "descriptionofunderlayvpn"
624 "description": "ac2_routeofunderlayvpn"
628 "description": "ac1_routeofunderlayvpn"
632 "description": "ac1_svlanofunderlayvpn"
636 "description": "ac2_ipofunderlayvpn"
640 "description": "ac1_ipofunderlayvpn"
644 "description": "ac2_portofunderlayvpn"
648 "description": "topologyofunderlayvpn"
652 "description": "technologyofunderlayvpn"
656 "description": "ac1_portofunderlayvpn"
660 "description": "ac2_svlanofunderlayvpn"
664 "description": "Nameofunderlayervpn"
670 "local_storages": [],
679 "name": "underlayervpn",
680 "csarVersion": "1.0",
682 "csarProvider": "huawei",
685 "id": "ns_underlayervpn_1_0"
691 "csarId": "vOpenNAT",
693 "csarName": "vOpenNAT.csar",
694 "vnfdModel": json.dumps(vnfdModel),
695 "vnfdProvider": "Intel",
696 "vnfdId": "openNAT_1.0",
697 "downloadUrl": "http://10.96.33.39:8806/static/catalog/vOpenNAT/vOpenNAT.csar",
698 "vnfVersion": "v1.0",
699 "vnfdVersion": "v1.0",
700 "vnfPackageId": "vOpenNAT"
709 # "designer": "sdno",
710 # "name": "underlayervpn",
711 # "csarVersion": "1.0",
712 # "csarType": "SSAR",
713 # "csarProvider": "huawei",
716 # "id": "ns_underlayervpn_1_0"
720 # "id": "ac2_fdhrbk3dvan8hl5wifm9lp1e9",
721 # "type_name": "tosca.nodes.sdn.l3ac",
722 # "template_name": "ac2",
725 # "type_name": "string"
728 # "type_name": "string"
731 # "type_name": "string"
734 # "type_name": "string"
739 # "name": "Standard",
740 # "type_name": "tosca.interfaces.node.lifecycle.Standard"
746 # "type_name": "tosca.capabilities.Node"
750 # "type_name": "tosca.capabilities.sdn.ac"
755 # "target_node_id": "pe2_go3vo1ctxr1vlbl0ij8stbtj6",
756 # "target_capability_name": "feature"
759 # "target_node_id": "ac2_fdhrbk3dvan8hl5wifm9lp1e9",
760 # "target_capability_name": "feature"
765 # "id": "ac1_jqows1ai0j0cmwk9jdvuknt97",
766 # "type_name": "tosca.nodes.sdn.l3ac",
767 # "template_name": "ac1",
770 # "type_name": "string"
773 # "type_name": "string"
776 # "type_name": "string"
779 # "type_name": "string"
784 # "name": "Standard",
785 # "type_name": "tosca.interfaces.node.lifecycle.Standard"
791 # "type_name": "tosca.capabilities.Node"
795 # "type_name": "tosca.capabilities.sdn.ac"
800 # "target_node_id": "pe1_e58ekps6m45g6w9egs9lue2j7",
801 # "target_capability_name": "feature"
804 # "target_node_id": "ac2_fdhrbk3dvan8hl5wifm9lp1e9",
805 # "target_capability_name": "feature"
810 # "id": "vpn_ie0xim076f7cje67fvrrq9tg1",
811 # "type_name": "tosca.nodes.sdn.underlayVPN",
812 # "template_name": "vpn",
815 # "type_name": "string"
818 # "type_name": "string"
821 # "type_name": "string"
824 # "type_name": "string"
829 # "name": "Standard",
830 # "type_name": "tosca.interfaces.node.lifecycle.Standard"
836 # "type_name": "tosca.capabilities.Node"
841 # "target_node_id": "ac1_jqows1ai0j0cmwk9jdvuknt97",
842 # "target_capability_name": "feature"
845 # "target_node_id": "ac2_fdhrbk3dvan8hl5wifm9lp1e9",
846 # "target_capability_name": "feature"
851 # "id": "pe1_e58ekps6m45g6w9egs9lue2j7",
852 # "type_name": "tosca.nodes.sdn.l3pe",
853 # "template_name": "pe1",
856 # "type_name": "string"
861 # "name": "Standard",
862 # "type_name": "tosca.interfaces.node.lifecycle.Standard"
868 # "type_name": "tosca.capabilities.Node"
872 # "type_name": "tosca.capabilities.sdn.pe"
877 # "id": "pe2_go3vo1ctxr1vlbl0ij8stbtj6",
878 # "type_name": "tosca.nodes.sdn.l3pe",
879 # "template_name": "pe2",
882 # "type_name": "string"
887 # "name": "Standard",
888 # "type_name": "tosca.interfaces.node.lifecycle.Standard"
894 # "type_name": "tosca.capabilities.Node"
898 # "type_name": "tosca.capabilities.sdn.pe"
904 # "node_type_name": "tosca.nodes.sdn.ext.NS.ns_underlayervpn"
908 # "type_name": "string",
909 # "description": "ac2_ipofunderlayvpn"
912 # "type_name": "string",
913 # "description": "ac2_routeofunderlayvpn"
916 # "type_name": "string",
917 # "description": "serviceTypeofunderlayvpn"
920 # "type_name": "string",
921 # "description": "descriptionofunderlayvpn"
924 # "type_name": "string",
925 # "description": "pe2_idofunderlayvpn"
928 # "type_name": "string",
929 # "description": "ac1_routeofunderlayvpn"
932 # "type_name": "integer",
933 # "description": "ac1_svlanofunderlayvpn"
936 # "type_name": "string",
937 # "description": "Nameofunderlayervpn"
940 # "type_name": "string",
941 # "description": "ac1_ipofunderlayvpn"
944 # "type_name": "string",
945 # "description": "ac2_portofunderlayvpn"
948 # "type_name": "string",
949 # "description": "pe1_idofunderlayvpn"
952 # "type_name": "string",
953 # "description": "technologyofunderlayvpn"
956 # "type_name": "string",
957 # "description": "ac1_portofunderlayvpn"
960 # "type_name": "integer",
961 # "description": "ac2_svlanofunderlayvpn"
964 # "type_name": "string",
965 # "description": "topologyofunderlayvpn"