From cd7d9f0cf5df27ad9720ed7c8a2d951f0da0493d Mon Sep 17 00:00:00 2001 From: jegan Date: Thu, 16 May 2024 07:07:27 +0000 Subject: [PATCH] Bug 2376 fixed: NBI fix for Performing NS-Update through CLI Change-Id: Ic7ce37d4a6197459fd535e55f9914e47c4daa2ff Signed-off-by: 36970 --- osm_nbi/instance_topics.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/osm_nbi/instance_topics.py b/osm_nbi/instance_topics.py index 0e4d9ba..115f433 100644 --- a/osm_nbi/instance_topics.py +++ b/osm_nbi/instance_topics.py @@ -1338,6 +1338,11 @@ class NsLcmOpTopic(BaseTopic): If updateType is REMOVE_VNF: - it checks if the vnfInstanceId is available in the ns instance - Otherwise exception will be raised. + If updateType is OPERATE_VNF + - it checks if the vdu-id is persent in the descriptor or not + - it checks if the changeStateTo is either start, stop or rebuild + If updateType is VERTICAL_SCALE + - it checks if the vdu-id is persent in the descriptor or not Args: indata: includes updateType such as CHANGE_VNFPKG, @@ -1404,6 +1409,36 @@ class NsLcmOpTopic(BaseTopic): "Invalid VNF Instance Id. '{}' is not " "present in the NS '{}'".format(vnf_instance_id, ns_instance_id) ) + elif indata["updateType"] == "OPERATE_VNF": + if indata.get("operateVnfData"): + if indata["operateVnfData"]["changeStateTo"] not in ( + "start", + "stop", + "rebuild", + ): + raise EngineException( + f"The operate type should be either start, stop or rebuild not {indata['operateVnfData']['changeStateTo']}", + http_code=HTTPStatus.UNPROCESSABLE_ENTITY, + ) + if indata["operateVnfData"].get("additionalParam"): + vdu_id = indata["operateVnfData"]["additionalParam"]["vdu_id"] + vnfinstance_id = indata["operateVnfData"]["vnfInstanceId"] + vnf = self.db.get_one("vnfrs", {"_id": vnfinstance_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"] + ) + self._check_valid_vdu(vnfd, vdu_id) + elif indata["updateType"] == "VERTICAL_SCALE": + if indata.get("verticalScaleVnf"): + vdu_id = indata["verticalScaleVnf"]["vduId"] + vnfinstance_id = indata["verticalScaleVnf"]["vnfInstanceId"] + vnf = self.db.get_one("vnfrs", {"_id": vnfinstance_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"] + ) + self._check_valid_vdu(vnfd, vdu_id) except ( DbException, -- 2.25.1