making _admin.deployed.VCA backward compatible 82/6982/2
authortierno <alfonso.tiernosepulveda@telefonica.com>
Tue, 27 Nov 2018 21:55:36 +0000 (21:55 +0000)
committertierno <alfonso.tiernosepulveda@telefonica.com>
Tue, 27 Nov 2018 22:16:57 +0000 (22:16 +0000)
Change-Id: Ibb3c7830db63c8a1a9d707e2bc8feed0616f09cc
Signed-off-by: tierno <alfonso.tiernosepulveda@telefonica.com>
osm_lcm/lcm.py
osm_lcm/ns.py

index ef5fefa..c6f839a 100644 (file)
@@ -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'
 
 
index 6148d02..eef3e89 100644 (file)
@@ -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"