Add port of SR-IOV NIC support
[vfc/gvnfm/vnflcm.git] / lcm / lcm / nf / const.py
index 47097d5..a20d39f 100644 (file)
@@ -15,6 +15,9 @@ import json
 
 from lcm.pub.utils.jobutil import enum
 
+HEAL_ACTION_TYPE = enum(START="vmCreate", RESTART="vmReset")
+ACTION_TYPE = enum(START=1, STOP=2, REBOOT=3)
+GRANT_TYPE = enum(INSTANTIATE="Instantiate", TERMINATE="Terminate", HEAL_CREATE="Heal Create", HEAL_RESTART="Heal Restart", OPERATE="Operate")
 VNF_STATUS = enum(NULL='null', INSTANTIATING="instantiating", INACTIVE='inactive', ACTIVE="active",
                   FAILED="failed", TERMINATING="terminating", SCALING="scaling", OPERATING="operating",
                   UPDATING="updating", HEALING="healing")
@@ -22,6 +25,16 @@ VNF_STATUS = enum(NULL='null', INSTANTIATING="instantiating", INACTIVE='inactive
 RESOURCE_MAP = {'Storage': 'volumn', 'Network': 'network', 'SubNetwork': 'subnet', 'Port': 'port',
                 'Flavour': 'flavor', 'Vm': 'vm'}
 
+ROOT_URI = "api/vnflcm/v1/subscriptions/"
+
+AUTH_TYPES = ["BASIC", "OAUTH2_CLIENT_CREDENTIALS", "TLS_CERT"]
+
+BASIC = "BASIC"
+
+OAUTH2_CLIENT_CREDENTIALS = "OAUTH2_CLIENT_CREDENTIALS"
+
+LCCNNOTIFICATION = "VnfLcmOperationOccurrenceNotification"
+
 inst_req_data = {
     "flavourId": "flavour_1",
     "instantiationLevelId": "instantiationLevel_1",
@@ -422,7 +435,7 @@ c1_data_get_tenant_id = {
     "tenants": [
         {
             "id": "1",
-            "name": "tenantname_1"
+            "name": "chinamobile"
         }
     ]
 }
@@ -476,7 +489,7 @@ c4_data_create_network = {
     "vlanTransparent": True,
     "networkType": "vlan",
     "segmentationId": 202,
-    "physicalNetwork": "ctrl",
+    "physicalNetwork": "physnet1",
     "routerExternal": False
 }
 
@@ -520,7 +533,7 @@ c6_data_create_port = {
     "subnetName": "subnet1",
     "macAddress": "212.12.61.23",
     "ip": "10.43.38.11",
-    "vnicType": "normal",
+    "vnicType": "direct",
     "securityGroups": ""
 }
 
@@ -586,7 +599,137 @@ c10_data_get_vm = {
 }
 
 vnfdModel = {
-    "volume_storages": [],
+    "volume_storages": [
+        {
+            "volume_storage_id": "test",
+            "properties": {
+                "location_info": {
+                    "vimid": "vim_1",
+                    "tenant": "chinamobile",
+                    "availability_zone": "test",
+                },
+                "volume_name": "test",
+                "custom_volume_type": "test",
+                "size": "10 GB",
+            },
+            "image_file": "test",
+        },
+    ],
+    "vls": [
+        {
+            "vl_id": "test",
+            "properties": {
+                "location_info": {
+                    "vimid": "test",
+                    "tenant": "chinamobile",
+                },
+                "vl_profile": {
+                    "networkName": "test",
+                    "networkType": "test",
+                    "physicalNetwork": "test",
+                    "vlanTransparent": "test",
+                    "segmentationId": "1",
+                    "cidr": "test",
+                    "dhcpEnabled": "test",
+                    "gatewayIp": "test",
+                    "startIp": "test",
+                    "endIp": "test",
+                },
+                "connectivity_type": {
+                    "layer_protocol": "ipv4",
+                },
+                "dns_nameservers": "test",
+                "host_routes": "test",
+            },
+            "route_external": "test",
+        }
+    ],
+    "cps": [
+        {
+            "vdu_id": "test",
+            "cp_id": "cp1",
+            "networkId": "",  # TODO
+            "subnetId": "",  # TODO
+            "vl_id": "test",
+            "properties": {
+                "name": "test",
+                "mac_address": "test",
+                "protocol_data": [
+                    {
+                        "address_data": {
+                            "l3_address_data": {
+                                "fixed_ip_address": "test"
+                            },
+                        },
+                    },
+                ],
+                "vnic_type": "direct",
+                "role": "root",
+                "virtual_network_interface_requirements": [
+                    {
+                        "network_interface_requirements": {
+                            "interfaceType": '{"schema-version": "0", "schema-location":"", "platform-id": "generic", "mandatory": false, "configuration-value": "SR-IOV"}'
+                        },
+                        "support_mandatory": False,
+                        "name": "SRIOV_Port",
+                        "description": "sriov"
+                    }
+                ]
+            }
+        }
+    ],
+    "vdus": [
+        {
+            "vdu_id": "test",
+            "properties": {
+                "location_info": {
+                    "vimid": "test",
+                    "tenant": "chinamobile",
+                    "availability_zone": "test",
+                },
+                "name": "test",
+                "inject_files": [],
+                "user_data": "test",
+                "meta_data": {},
+            },
+            "cps": [],
+            "type": "tosca.nodes.nfv.Vdu.Compute",
+            "virtual_compute": {
+                "virtual_cpu": {
+                    "num_virtual_cpu": "16",
+                },
+                "virtual_memory": {
+                    "virtual_mem_size": "8000 MB",
+                    "vdu_memory_requirements": {
+                        "memoryPageSize": "8 MB",
+                    },
+                },
+            },
+            "virtual_storage": {
+                "type_of_storage": "ephemeral",
+                "size_of_storage": "10 GB",
+            },
+            "type": "tosca.nodes.nfv.Vdu.Compute",
+            "artifacts": [
+                {
+                    "artifact_name": "sw_image",
+                    "file": "sss.vmdk",
+                },
+            ],
+            "volume_storages": [
+                {
+                    "volume_storage_id": "test",
+                }
+            ],
+        },
+    ],
+    "image_files": [],
+    "routers": [],
+    "local_storages": [],
+    "vnf_exposed": {
+        "external_cps": [],
+        "forward_cps": []
+    },
     "inputs": {
         "pe1_id": {
             "type": "string",
@@ -649,16 +792,6 @@ vnfdModel = {
             "description": "Nameofunderlayervpn"
         }
     },
-    "vdus": [],
-    "image_files": [],
-    "routers": [],
-    "local_storages": [],
-    "vnf_exposed": {
-        "external_cps": [],
-        "forward_cps": []
-    },
-    "vls": [],
-    "cps": [],
     "metadata": {
         "designer": "sdno",
         "name": "underlayervpn",