From 09682c03bb6faed2a1c97fd166c0637b0270174d Mon Sep 17 00:00:00 2001 From: tierno Date: Wed, 27 Jun 2018 15:06:50 +0200 Subject: [PATCH] Fix multivim bug at updating vnfr Change-Id: I86ea26a786c1d88b1623edfbd13d126c70bd22e1 Signed-off-by: tierno --- osm_lcm/__init__.py | 2 +- osm_lcm/lcm.py | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/osm_lcm/__init__.py b/osm_lcm/__init__.py index b1ad67b..038e365 100644 --- a/osm_lcm/__init__.py +++ b/osm_lcm/__init__.py @@ -1,2 +1,2 @@ -version = '0.1.6' +version = '0.1.7' date_version = '2018-06-27' diff --git a/osm_lcm/lcm.py b/osm_lcm/lcm.py index b14f640..c679add 100644 --- a/osm_lcm/lcm.py +++ b/osm_lcm/lcm.py @@ -815,11 +815,13 @@ class Lcm: for vnf_index, vnfr in db_vnfr.items(): if vnfr.get("vim-account-id"): continue - if db_nsr["instantiate_params"].get("vnf") and db_nsr["instantiate_params"]["vnf"].get(vnf_index) \ - and db_nsr["instantiate_params"]["vnf"][vnf_index].get("vimAccountId"): - vnfr["vim-account-id"] = db_nsr["instantiate_params"]["vnf"][vnf_index]["vimAccountId"] - else: - vnfr["vim-account-id"] = db_nsr["instantiate_params"]["vimAccountId"] + vnfr["vim-account-id"] = db_nsr["instantiate_params"]["vimAccountId"] + if db_nsr["instantiate_params"].get("vnf"): + for vnf_params in db_nsr["instantiate_params"]["vnf"]: + if vnf_params.get("member-vnf-index") == vnf_index: + if vnf_params.get("vimAccountId"): + vnfr["vim-account-id"] = vnf_params.get("vimAccountId") + break self.update_db("vnfrs", vnfr["_id"], vnfr) # wait until NS is ready @@ -1158,6 +1160,7 @@ class Lcm: self.db.del_one("nsrs", {"_id": nsr_id}) self.db.del_list("nslcmops", {"nsInstanceId": nsr_id}) self.db.del_list("vnfrs", {"nsr-id-ref": nsr_id}) + self.logger.debug(logging_text + "Delete from database") else: db_nsr_update = { "operational-status": "terminated", -- 2.25.1