From: tierno Date: Fri, 25 Sep 2020 12:33:15 +0000 (+0000) Subject: fix 1223. Get properly the IP address on scaled vdus X-Git-Tag: release-v9.0-start~24 X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FLCM.git;a=commitdiff_plain;h=683eb39c709978c0206f2991599a9c3d94770a61 fix 1223. Get properly the IP address on scaled vdus Change-Id: I9e2754a905706b4bc632c6187ba5994e471229bb Signed-off-by: tierno --- diff --git a/osm_lcm/ns.py b/osm_lcm/ns.py index 2fad94e..10d07ef 100644 --- a/osm_lcm/ns.py +++ b/osm_lcm/ns.py @@ -629,11 +629,21 @@ class NsLcm(LcmBase): continue vdu_id_ref = vdur["vdu-id-ref"] if vdu_create and vdu_create.get(vdu_id_ref): + vdur_copy = deepcopy(vdur) + vdur_copy["status"] = "BUILD" + vdur_copy["status-detailed"] = None + vdur_copy["ip_address"]: None + for iface in vdur_copy["interfaces"]: + iface["ip-address"] = None + iface["mac-address"] = None + iface.pop("mgmt_vnf", None) # only first vdu can be managment of vnf # TODO ALF for index in range(0, vdu_create[vdu_id_ref]): - vdur = deepcopy(vdur) - vdur["_id"] = str(uuid4()) - vdur["count-index"] += 1 - vdurs.insert(vdu_index+1+index, vdur) + vdur_copy["_id"] = str(uuid4()) + vdur_copy["count-index"] += 1 + vdurs.insert(vdu_index+1+index, vdur_copy) + self.logger.debug("scale out, adding vdu={}".format(vdur_copy)) + vdur_copy = deepcopy(vdur_copy) + del vdu_create[vdu_id_ref] if vdu_delete and vdu_delete.get(vdu_id_ref): del vdurs[vdu_index] @@ -3853,7 +3863,6 @@ class NsLcm(LcmBase): scale_process = None old_operational_status = "" old_config_status = "" - vnfr_scaled = False try: # wait for any previous tasks in process step = "Waiting for previous operations to terminate" @@ -4098,7 +4107,7 @@ class NsLcm(LcmBase): db_nslcmop_update["_admin.deploy.RO"] = RO_nslcmop_id RO_task_done = False - step = detailed_status = "Waiting RO_task_id={} to complete the scale action.".format(RO_nslcmop_id) + step = detailed_status = "Waiting for VIM to scale. RO_task_id={}.".format(RO_nslcmop_id) detailed_status_old = None self.logger.debug(logging_text + step) @@ -4118,11 +4127,16 @@ class NsLcm(LcmBase): detailed_status = step + "; {}".format(ns_status_info) elif ns_status == "ACTIVE": RO_task_done = True + self.scale_vnfr(db_vnfr, vdu_create=vdu_create, vdu_delete=vdu_delete) step = detailed_status = "Waiting ns ready at RO. RO_id={}".format(RO_nsr_id) self.logger.debug(logging_text + step) else: assert False, "ROclient.check_action_status returns unknown {}".format(ns_status) else: + desc = await self.RO.show("ns", RO_nsr_id) + ns_status, ns_status_info = self.RO.check_ns_status(desc) + # deploymentStatus + self._on_update_ro_db(nsrs_id=nsr_id, ro_descriptor=desc) if ns_status == "ERROR": raise ROclient.ROClientException(ns_status_info) @@ -4131,15 +4145,7 @@ class NsLcm(LcmBase): elif ns_status == "ACTIVE": step = detailed_status = \ "Waiting for management IP address reported by the VIM. Updating VNFRs" - if not vnfr_scaled: - self.scale_vnfr(db_vnfr, vdu_create=vdu_create, vdu_delete=vdu_delete) - vnfr_scaled = True try: - desc = await self.RO.show("ns", RO_nsr_id) - - # deploymentStatus - self._on_update_ro_db(nsrs_id=nsr_id, ro_descriptor=desc) - # nsr_deployed["nsr_ip"] = RO.get_ns_vnf_info(desc) self.ns_update_vnfr({db_vnfr["member-vnf-index-ref"]: db_vnfr}, desc) break