2126 BugFix: use both count-index & vdu_id for finding target vdu 44/12444/3
authork4.rahul <rahul.k4@tataelxsi.co.in>
Wed, 27 Jul 2022 10:37:26 +0000 (10:37 +0000)
committercubag <gcuba@whitestack.com>
Mon, 15 Aug 2022 21:17:36 +0000 (23:17 +0200)
Change-Id: I1c00273f8f98119b38913cbb9a11ae96171fe3f7
Signed-off-by: k4.rahul <rahul.k4@tataelxsi.co.in>
(cherry picked from commit 4ca27538725d8f167d7128124ce09dc57b7a5d0f)

osm_lcm/ns.py

index 8dd8b2a..ee5832f 100644 (file)
@@ -7275,13 +7275,17 @@ class NsLcm(LcmBase):
             db_vnfr = self.db.get_one("vnfrs", {"_id": vnf_id})
             vim_account_id = db_vnfr.get("vim-account-id")
             vim_info_key = "vim:" + vim_account_id
+            vdu_id = additional_param["vdu_id"]
+            vdurs = [item for item in db_vnfr["vdur"] if item["vdu-id-ref"] == vdu_id]
             vdur = find_in_list(
-                db_vnfr["vdur"], lambda vdu: vdu["count-index"] == additional_param["count-index"]
+                vdurs, lambda vdu: vdu["count-index"] == additional_param["count-index"]
                 )
             if vdur:
                 vdu_vim_name = vdur["name"]
                 vim_vm_id = vdur["vim_info"][vim_info_key]["vim_id"]
                 target_vim, _ = next(k_v for k_v in vdur["vim_info"].items())
+            else:
+                raise LcmException("Target vdu is not found")
             self.logger.info("vdu_vim_name >> {} ".format(vdu_vim_name))
             # wait for any previous tasks in process
             stage[1] = "Waiting for previous operations to terminate"