Optimized code logic of termination vnfs
authorying.yunlong <ying.yunlong@zte.com.cn>
Mon, 24 Apr 2017 12:47:16 +0000 (20:47 +0800)
committerying.yunlong <ying.yunlong@zte.com.cn>
Mon, 24 Apr 2017 12:47:16 +0000 (20:47 +0800)
Change-Id: Ib483113a74b5e5fb27dc2f4672e1816b26aceee2
Issue-Id: GVNFM-50
Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
lcm/lcm/nf/vnfs/vnf_cancel/term_vnf.py
lcm/lcm/pub/vimapi/adaptor.py

index c43875d..8b17fd2 100644 (file)
@@ -263,7 +263,7 @@ class TermVnf(Thread):
     def lcm_notify(self):
         NfInstModel.objects.filter(nfinstid=self.nf_inst_id).update(status='NOT_INSTANTIATED', lastuptime=now_time())
         logger.info('[NF termination] send notify request to nfvo end')
-        resp = notify_lcm_to_nfvo(self.notify_data)
+        resp = notify_lcm_to_nfvo(json.dumps(self.notify_data))
         logger.info('[NF termination] get lcm response %s' % resp)
         logger.info('[NF termination] send notify request to nfvo end')
 
index bf57b35..c13f332 100644 (file)
@@ -164,7 +164,7 @@ def create_port(vim_cache, res_cache, data, port, do_notify, res_type):
     for vdu in ignore_case_get(data, "vdus"):
         if vdu["vdu_id"] == port_ref_vdu_id:
             location_info = vdu["properties"]["location_info"]
-            if  port["cp_id"] not in vdu["cps"]:
+            if port["cp_id"] not in vdu["cps"]:
                 vdu["cps"].append(port["cp_id"])
             break
     if not location_info:
@@ -285,7 +285,7 @@ def create_vm(vim_cache, res_cache, data, vm, do_notify, res_type):
     #vm_id, vm_name, return_code = ret["id"], ret["name"], ret["returnCode"]
     vm_id, return_code = ret["id"], ret["returnCode"]
     if ignore_case_get(ret, "name"):
-        vm_name = vm["properties"].get("name","undefined")
+        vm_name = vm["properties"].get("name", "undefined")
         logger.debug("vm_name:%s" % vm_name)
     opt_vm_status = "Timeout"
     retry_count, max_retry_count = 0, 100