Modify code and test case of lcm notify
[vfc/gvnfm/vnflcm.git] / lcm / lcm / pub / vimapi / adaptor.py
index 593d779..fed69b1 100644 (file)
@@ -101,6 +101,7 @@ def create_volume(vim_cache, res_cache, vol, do_notify, res_type):
     vim_id, tenant_name = location_info["vimid"], location_info["tenant"]
     tenant_id = get_tenant_id(vim_cache, vim_id, tenant_name)
     ret = api.create_volume(vim_id, tenant_id, param)
+    ret["nodeId"] = vol["volume_storage_id"]
     do_notify(res_type, ret)
     vol_id, vol_name, return_code = ret["id"], ret["name"], ret["returnCode"]
     set_res_cache(res_cache, res_type, vol["volume_storage_id"], vol_id)
@@ -128,6 +129,7 @@ def create_network(vim_cache, res_cache, network, do_notify, res_type):
     vim_id, tenant_name = location_info["vimid"], location_info["tenant"]
     tenant_id = get_tenant_id(vim_cache, vim_id, tenant_name)
     ret = api.create_network(vim_id, tenant_id, param)
+    ret["nodeId"] = network["vl_id"]
     do_notify(res_type, ret)
     set_res_cache(res_cache, res_type, network["vl_id"], ret["id"])
     
@@ -179,6 +181,7 @@ def create_port(vim_cache, res_cache, data, port, do_notify, res_type):
     vim_id, tenant_name = location_info["vimid"], location_info["tenant"]
     tenant_id = get_tenant_id(vim_cache, vim_id, tenant_name)
     ret = api.create_subnet(vim_id, tenant_id, param)
+    ret["nodeId"] = port["cp_id"]
     do_notify(res_type, ret)
     set_res_cache(res_cache, res_type, port["cp_id"], ret["id"])
 
@@ -277,7 +280,7 @@ def create_vm(vim_cache, res_cache, data, vm, do_notify, res_type):
     opt_vm_status = "Timeout"
     retry_count, max_retry_count = 0, 100
     while retry_count < max_retry_count:
-        vm_info = api.get_vm(vim_id, vm_id)
+        vm_info = api.get_vm(vim_id, tenant_id, vm_id)
         if vm_info["status"].upper() == "ACTIVE":
             logger.debug("Vm(%s) is active", vim_id)
             return