From 0b27334b1e4f12930defaa850f200147475aa98d Mon Sep 17 00:00:00 2001 From: jegan Date: Mon, 13 Nov 2023 05:01:53 +0000 Subject: [PATCH] Bug 2312 Fix for manual healing with invalid vdu id Change-Id: I8d9388da3a883889e90d7cd6a2a6a741338c6f6b Signed-off-by: jegan --- osm_nbi/instance_topics.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/osm_nbi/instance_topics.py b/osm_nbi/instance_topics.py index 4ed706b..b176801 100644 --- a/osm_nbi/instance_topics.py +++ b/osm_nbi/instance_topics.py @@ -1549,7 +1549,24 @@ class NsLcmOpTopic(BaseTopic): ) def _check_heal_ns_operation(self, indata, nsr): - return + try: + for data in indata.get("healVnfData"): + vnf_id = data.get("vnfInstanceId") + vnf = self.db.get_one("vnfrs", {"_id": vnf_id}) + vnfd_member_vnf_index = vnf.get("member-vnf-index-ref") + vnfd = self._get_vnfd_from_vnf_member_index( + vnfd_member_vnf_index, nsr["_id"] + ) + if data.get("additionalParams"): + vdu_id = data["additionalParams"].get("vdu") + if vdu_id: + for index in range(len(vdu_id)): + vdu = vdu_id[index].get("vdu-id") + self._check_valid_vdu(vnfd, vdu) + except (DbException, AttributeError, IndexError, KeyError, ValueError) as e: + raise type(e)( + "Ns healing request could not be processed with error: {}.".format(e) + ) def _check_instantiate_ns_operation(self, indata, nsr, session): vnf_member_index_to_vnfd = {} # map between vnf_member_index to vnf descriptor. -- 2.25.1