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": "chinamobile"
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": "chinamobile",
596 "availability_zone": "test",
598 "volume_name": "test",
599 "custom_volume_type": "test",
602 "image_file": "test",
611 "tenant": "chinamobile",
614 "networkName": "test",
615 "networkType": "test",
616 "physicalNetwork": "test",
617 "vlanTransparent": "test",
618 "segmentationId": "1",
620 "dhcpEnabled": "test",
625 "connectivity_type": {
626 "layer_protocol": "ipv4",
628 "dns_nameservers": "test",
629 "host_routes": "test",
631 "route_external": "test",
638 "networkId": "", # TODO
639 "subnetId": "", # TODO
643 "mac_address": "test",
648 "fixed_ip_address": "test"
663 "tenant": "chinamobile",
664 "availability_zone": "test",
672 "type": "tosca.nodes.nfv.Vdu.Compute",
675 "num_virtual_cpu": "16",
678 "virtual_mem_size": "8000 MB",
679 "vdu_memory_requirements": {
680 "memoryPageSize": "8 MB",
685 "type_of_storage": "ephemeral",
686 "size_of_storage": "10 GB",
688 "type": "tosca.nodes.nfv.Vdu.Compute",
691 "artifact_name": "sw_image",
697 "volume_storage_id": "test",
704 "local_storages": [],
712 "description": "pe1_idofunderlayvpn"
716 "description": "pe2_idofunderlayvpn"
720 "description": "serviceTypeofunderlayvpn"
724 "description": "descriptionofunderlayvpn"
728 "description": "ac2_routeofunderlayvpn"
732 "description": "ac1_routeofunderlayvpn"
736 "description": "ac1_svlanofunderlayvpn"
740 "description": "ac2_ipofunderlayvpn"
744 "description": "ac1_ipofunderlayvpn"
748 "description": "ac2_portofunderlayvpn"
752 "description": "topologyofunderlayvpn"
756 "description": "technologyofunderlayvpn"
760 "description": "ac1_portofunderlayvpn"
764 "description": "ac2_svlanofunderlayvpn"
768 "description": "Nameofunderlayervpn"
773 "name": "underlayervpn",
774 "csarVersion": "1.0",
776 "csarProvider": "huawei",
779 "id": "ns_underlayervpn_1_0"
785 "csarId": "vOpenNAT",
787 "csarName": "vOpenNAT.csar",
788 "vnfdModel": json.dumps(vnfdModel),
789 "vnfdProvider": "Intel",
790 "vnfdId": "openNAT_1.0",
791 "downloadUrl": "http://10.96.33.39:8806/static/catalog/vOpenNAT/vOpenNAT.csar",
792 "vnfVersion": "v1.0",
793 "vnfdVersion": "v1.0",
794 "vnfPackageId": "vOpenNAT"
803 # "designer": "sdno",
804 # "name": "underlayervpn",
805 # "csarVersion": "1.0",
806 # "csarType": "SSAR",
807 # "csarProvider": "huawei",
810 # "id": "ns_underlayervpn_1_0"
814 # "id": "ac2_fdhrbk3dvan8hl5wifm9lp1e9",
815 # "type_name": "tosca.nodes.sdn.l3ac",
816 # "template_name": "ac2",
819 # "type_name": "string"
822 # "type_name": "string"
825 # "type_name": "string"
828 # "type_name": "string"
833 # "name": "Standard",
834 # "type_name": "tosca.interfaces.node.lifecycle.Standard"
840 # "type_name": "tosca.capabilities.Node"
844 # "type_name": "tosca.capabilities.sdn.ac"
849 # "target_node_id": "pe2_go3vo1ctxr1vlbl0ij8stbtj6",
850 # "target_capability_name": "feature"
853 # "target_node_id": "ac2_fdhrbk3dvan8hl5wifm9lp1e9",
854 # "target_capability_name": "feature"
859 # "id": "ac1_jqows1ai0j0cmwk9jdvuknt97",
860 # "type_name": "tosca.nodes.sdn.l3ac",
861 # "template_name": "ac1",
864 # "type_name": "string"
867 # "type_name": "string"
870 # "type_name": "string"
873 # "type_name": "string"
878 # "name": "Standard",
879 # "type_name": "tosca.interfaces.node.lifecycle.Standard"
885 # "type_name": "tosca.capabilities.Node"
889 # "type_name": "tosca.capabilities.sdn.ac"
894 # "target_node_id": "pe1_e58ekps6m45g6w9egs9lue2j7",
895 # "target_capability_name": "feature"
898 # "target_node_id": "ac2_fdhrbk3dvan8hl5wifm9lp1e9",
899 # "target_capability_name": "feature"
904 # "id": "vpn_ie0xim076f7cje67fvrrq9tg1",
905 # "type_name": "tosca.nodes.sdn.underlayVPN",
906 # "template_name": "vpn",
909 # "type_name": "string"
912 # "type_name": "string"
915 # "type_name": "string"
918 # "type_name": "string"
923 # "name": "Standard",
924 # "type_name": "tosca.interfaces.node.lifecycle.Standard"
930 # "type_name": "tosca.capabilities.Node"
935 # "target_node_id": "ac1_jqows1ai0j0cmwk9jdvuknt97",
936 # "target_capability_name": "feature"
939 # "target_node_id": "ac2_fdhrbk3dvan8hl5wifm9lp1e9",
940 # "target_capability_name": "feature"
945 # "id": "pe1_e58ekps6m45g6w9egs9lue2j7",
946 # "type_name": "tosca.nodes.sdn.l3pe",
947 # "template_name": "pe1",
950 # "type_name": "string"
955 # "name": "Standard",
956 # "type_name": "tosca.interfaces.node.lifecycle.Standard"
962 # "type_name": "tosca.capabilities.Node"
966 # "type_name": "tosca.capabilities.sdn.pe"
971 # "id": "pe2_go3vo1ctxr1vlbl0ij8stbtj6",
972 # "type_name": "tosca.nodes.sdn.l3pe",
973 # "template_name": "pe2",
976 # "type_name": "string"
981 # "name": "Standard",
982 # "type_name": "tosca.interfaces.node.lifecycle.Standard"
988 # "type_name": "tosca.capabilities.Node"
992 # "type_name": "tosca.capabilities.sdn.pe"
998 # "node_type_name": "tosca.nodes.sdn.ext.NS.ns_underlayervpn"
1002 # "type_name": "string",
1003 # "description": "ac2_ipofunderlayvpn"
1006 # "type_name": "string",
1007 # "description": "ac2_routeofunderlayvpn"
1010 # "type_name": "string",
1011 # "description": "serviceTypeofunderlayvpn"
1014 # "type_name": "string",
1015 # "description": "descriptionofunderlayvpn"
1018 # "type_name": "string",
1019 # "description": "pe2_idofunderlayvpn"
1022 # "type_name": "string",
1023 # "description": "ac1_routeofunderlayvpn"
1026 # "type_name": "integer",
1027 # "description": "ac1_svlanofunderlayvpn"
1030 # "type_name": "string",
1031 # "description": "Nameofunderlayervpn"
1034 # "type_name": "string",
1035 # "description": "ac1_ipofunderlayvpn"
1038 # "type_name": "string",
1039 # "description": "ac2_portofunderlayvpn"
1042 # "type_name": "string",
1043 # "description": "pe1_idofunderlayvpn"
1046 # "type_name": "string",
1047 # "description": "technologyofunderlayvpn"
1050 # "type_name": "string",
1051 # "description": "ac1_portofunderlayvpn"
1054 # "type_name": "integer",
1055 # "description": "ac2_svlanofunderlayvpn"
1058 # "type_name": "string",
1059 # "description": "topologyofunderlayvpn"