From: Pedro Escaleira Date: Mon, 30 May 2022 14:37:01 +0000 (+0100) Subject: Bug 2050 fixed: avoid trying to insert pk in a VM for a KNF VCA X-Git-Tag: v12.0.0rc1~9 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F36%2F12136%2F3;p=osm%2FLCM.git Bug 2050 fixed: avoid trying to insert pk in a VM for a KNF VCA Change-Id: I62bb34d29848c57fda2af6556d5e8fce6795f0c8 Signed-off-by: Pedro Escaleira --- diff --git a/osm_lcm/ns.py b/osm_lcm/ns.py index 1cbd93a..afd3828 100644 --- a/osm_lcm/ns.py +++ b/osm_lcm/ns.py @@ -1989,6 +1989,9 @@ class NsLcm(LcmBase): step = "Waiting to VM being up and getting IP address" self.logger.debug(logging_text + step) + # default rw_mgmt_ip to None, avoiding the non definition of the variable + rw_mgmt_ip = None + # n2vc_redesign STEP 5.1 # wait for RO (ip-address) Insert pub_key into VM if vnfr_id: @@ -2020,7 +2023,13 @@ class NsLcm(LcmBase): }, vca_id=vca_id, ) - else: + + # This verification is needed in order to avoid trying to add a public key + # to a VM, when the VNF is a KNF (in the edge case where the user creates a VCA + # for a KNF and not for its KDUs, the previous verification gives False, and the code + # jumps to this block, meaning that there is the need to verify if the VNF is actually a VNF + # or it is a KNF) + elif db_vnfr.get('vdur'): rw_mgmt_ip = await self.wait_vm_up_insert_key_ro( logging_text, nsr_id, @@ -2031,9 +2040,6 @@ class NsLcm(LcmBase): pub_key=pub_key, ) - else: - rw_mgmt_ip = None # This is for a NS configuration - self.logger.debug(logging_text + " VM_ip_address={}".format(rw_mgmt_ip)) # store rw_mgmt_ip in deploy params for later replacement