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,
"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,