From 82974b2578eeefa319cb9507b63d8f29499c85b0 Mon Sep 17 00:00:00 2001 From: tierno Date: Tue, 27 Nov 2018 21:55:36 +0000 Subject: [PATCH] making _admin.deployed.VCA backward compatible Change-Id: Ibb3c7830db63c8a1a9d707e2bc8feed0616f09cc Signed-off-by: tierno --- osm_lcm/lcm.py | 2 +- osm_lcm/ns.py | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/osm_lcm/lcm.py b/osm_lcm/lcm.py index ef5fefac..c6f839ad 100644 --- a/osm_lcm/lcm.py +++ b/osm_lcm/lcm.py @@ -28,7 +28,7 @@ min_RO_version = [0, 5, 84] min_n2vc_version = "0.0.2" min_common_version = "0.1.11" # uncomment if LCM is installed as library and installed, and get them from __init__.py -lcm_version = '0.1.26' +lcm_version = '0.1.27' lcm_version_date = '2018-11-27' diff --git a/osm_lcm/ns.py b/osm_lcm/ns.py index 6148d02a..eef3e891 100644 --- a/osm_lcm/ns.py +++ b/osm_lcm/ns.py @@ -1048,6 +1048,12 @@ class NsLcm(LcmBase): db_nsr_update["detailed-status"] = "Deleting charms" self.logger.debug(logging_text + step) self.update_db_2("nsrs", nsr_id, db_nsr_update) + # for backward compatibility + if isinstance(nsr_deployed["VCA"], dict): + nsr_deployed["VCA"] = list(nsr_deployed["VCA"].values()) + db_nsr_update["_admin.deployed.VCA"] = nsr_deployed["VCA"] + self.update_db_2("nsrs", nsr_id, db_nsr_update) + for vca_index, vca_deployed in enumerate(nsr_deployed["VCA"]): if vca_deployed: # TODO it would be desirable having a and deploy_info.get("deployed"): task = asyncio.ensure_future( @@ -1340,6 +1346,12 @@ class NsLcm(LcmBase): if pending: raise LcmException("Timeout waiting related tasks to be completed") + # for backward compatibility + if nsr_deployed and isinstance(nsr_deployed.get("VCA"), dict): + nsr_deployed["VCA"] = list(nsr_deployed["VCA"].values()) + db_nsr_update["_admin.deployed.VCA"] = nsr_deployed["VCA"] + self.update_db_2("nsrs", nsr_id, db_nsr_update) + # TODO check if ns is in a proper status primitive = db_nslcmop["operationParams"]["primitive"] primitive_params = db_nslcmop["operationParams"]["primitive_params"] @@ -1426,6 +1438,12 @@ class NsLcm(LcmBase): scaling_type = db_nslcmop["operationParams"]["scaleVnfData"]["scaleVnfType"] # scaling_policy = db_nslcmop["operationParams"]["scaleVnfData"]["scaleByStepData"].get("scaling-policy") + # for backward compatibility + if nsr_deployed and isinstance(nsr_deployed.get("VCA"), dict): + nsr_deployed["VCA"] = list(nsr_deployed["VCA"].values()) + db_nsr_update["_admin.deployed.VCA"] = nsr_deployed["VCA"] + self.update_db_2("nsrs", nsr_id, db_nsr_update) + step = "Getting vnfr from database" db_vnfr = self.db.get_one("vnfrs", {"member-vnf-index-ref": vnf_index, "nsr-id-ref": nsr_id}) step = "Getting vnfd from database" -- 2.25.1