Dealing with test related stuffs. 25/61025/1
authorlaili <lai.li@zte.com.cn>
Fri, 17 Aug 2018 05:28:05 +0000 (13:28 +0800)
committerlaili <lai.li@zte.com.cn>
Fri, 17 Aug 2018 05:28:05 +0000 (13:28 +0800)
Modify const and instantiation test.

Change-Id: I218128ab7eaac785c58a3832ba3ab559a5ee5f27
Issue-ID: VFC-1012
Signed-off-by: laili <lai.li@zte.com.cn>
lcm/lcm/nf/const.py
lcm/lcm/nf/tests/test_instantiate_vnf.py

index 7da4d85..c5ebf5d 100644 (file)
@@ -602,15 +602,6 @@ vnfdModel = {
             "image_file": "test",
         },
     ],
-    "vdus": [
-    ],
-    "image_files": [],
-    "routers": [],
-    "local_storages": [],
-    "vnf_exposed": {
-        "external_cps": [],
-        "forward_cps": []
-    },
     "vls": [
         {
             "vl_id": "test",
@@ -640,7 +631,81 @@ vnfdModel = {
             "route_external": "test",
         }
     ],
-    "cps": [],  # TODO
+    "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": "test",
+            }
+        }
+    ],
+    "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",
index a599aed..5801cb9 100644 (file)
@@ -176,8 +176,9 @@ class TestNFInstantiate(TestCase):
                                    create_time=now_time())\r
         r1_get_vnfpackage_by_vnfdid = [0, json.JSONEncoder().encode(vnfpackage_info), '200']\r
         r2_apply_grant_result = [0, json.JSONEncoder().encode(self.grant_result), '200']\r
-        r3_lcm_notify_result = [0, json.JSONEncoder().encode(''), '200']\r
-        mock_call_req.side_effect = [r1_get_vnfpackage_by_vnfdid, r2_apply_grant_result, r3_lcm_notify_result]\r
+        r3_all_aai_result = [1, json.JSONEncoder().encode(''), '404']\r
+        r4_lcm_notify_result = [0, json.JSONEncoder().encode(''), '200']\r
+        mock_call_req.side_effect = [r1_get_vnfpackage_by_vnfdid, r2_apply_grant_result, r3_all_aai_result, r4_lcm_notify_result]\r
         mock_call.side_effect = [c1_data_get_tenant_id,\r
                                  c2_data_create_volume, c3_data_get_volume,\r
                                  c4_data_create_network,\r