From 0964edf54da6607131d354e1bcb30fbb97dbc5f4 Mon Sep 17 00:00:00 2001 From: garciadeblas Date: Fri, 11 Feb 2022 00:43:44 +0100 Subject: [PATCH] Feature 10909: Heal operation for VDU Change-Id: I9cda701cc265f8acad82574dab96a374cc399fa2 Signed-off-by: garciadeblas --- osm_nbi/instance_topics.py | 9 +++++++- osm_nbi/nbi.py | 6 ++++- osm_nbi/validation.py | 47 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 2 deletions(-) diff --git a/osm_nbi/instance_topics.py b/osm_nbi/instance_topics.py index 84aeda3..d371216 100644 --- a/osm_nbi/instance_topics.py +++ b/osm_nbi/instance_topics.py @@ -27,6 +27,7 @@ from osm_nbi.validation import ( ns_action, ns_scale, ns_update, + ns_heal, nsi_instantiate, ns_migrate, ) @@ -1163,6 +1164,7 @@ class NsLcmOpTopic(BaseTopic): "action": ns_action, "update": ns_update, "scale": ns_scale, + "heal": ns_heal, "terminate": ns_terminate, "migrate": ns_migrate, } @@ -1175,7 +1177,7 @@ class NsLcmOpTopic(BaseTopic): """ Check that user has enter right parameters for the operation :param session: contains "username", "admin", "force", "public", "project_id", "set_project" - :param operation: it can be: instantiate, terminate, action, update. TODO: heal + :param operation: it can be: instantiate, terminate, action, update, heal :param indata: descriptor with the parameters of the operation :return: None """ @@ -1185,6 +1187,8 @@ class NsLcmOpTopic(BaseTopic): self._check_scale_ns_operation(indata, nsr) elif operation == "update": self._check_update_ns_operation(indata, nsr) + elif operation == "heal": + self._check_heal_ns_operation(indata, nsr) elif operation == "instantiate": self._check_instantiate_ns_operation(indata, nsr, session) @@ -1387,6 +1391,9 @@ class NsLcmOpTopic(BaseTopic): ) ) + def _check_heal_ns_operation(self, indata, nsr): + return + def _check_instantiate_ns_operation(self, indata, nsr, session): vnf_member_index_to_vnfd = {} # map between vnf_member_index to vnf descriptor. vim_accounts = [] diff --git a/osm_nbi/nbi.py b/osm_nbi/nbi.py index 29e085a..de48c03 100644 --- a/osm_nbi/nbi.py +++ b/osm_nbi/nbi.py @@ -86,8 +86,8 @@ URL: /osm GET POST action O scale O5 migrate O - heal 5 update 05 + heal O5 /ns_lcm_op_occs 5 5 / 5 5 5 TO BE COMPLETED 5 5 @@ -433,6 +433,10 @@ valid_url_methods = { "": { "METHODS": ("GET", "DELETE"), "ROLE_PERMISSION": "ns_instances:id:", + "heal": { + "METHODS": ("POST",), + "ROLE_PERMISSION": "ns_instances:id:heal:", + }, "scale": { "METHODS": ("POST",), "ROLE_PERMISSION": "ns_instances:id:scale:", diff --git a/osm_nbi/validation.py b/osm_nbi/validation.py index ae9644c..7e50aa9 100644 --- a/osm_nbi/validation.py +++ b/osm_nbi/validation.py @@ -492,6 +492,7 @@ ns_action = { # TODO for the moment it is only contemplated the vnfd primitive "required": ["primitive", "primitive_params"], # TODO add member_vnf_index "additionalProperties": False, } + ns_scale = { # TODO for the moment it is only VDU-scaling "title": "ns scale input schema", "$schema": "http://json-schema.org/draft-04/schema#", @@ -549,6 +550,51 @@ ns_migrate = { "additionalProperties": False } +ns_heal = { + "title": "ns heal input schema", + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "lcmOperationType": string_schema, + "nsInstanceId": id_schema, + "timeout_ns_heal": integer1_schema, + "healVnfData": { + "type": "array", + "items": { + "type": "object", + "properties": { + "vnfInstanceId": id_schema, + "cause": description_schema, + "additionalParams": { + "type": "object", + "properties": { + "run-day1": bool_schema, + "vdu": { + "type": "array", + "items": { + "type": "object", + "properties": { + "run-day1": bool_schema, + "vdu-id": name_schema, + "count-index": integer0_schema, + }, + "required": ["vdu-id"], + "additionalProperties": False, + }, + }, + }, + "additionalProperties": False, + }, + }, + "required": ["vnfInstanceId"], + "additionalProperties": False, + }, + }, + }, + "required": ["healVnfData"], + "additionalProperties": False, +} + schema_version = {"type": "string", "enum": ["1.0"]} schema_type = {"type": "string"} vim_type = shortname_schema # {"enum": ["openstack", "openvim", "vmware", "opennebula", "aws", "azure", "fos"]} @@ -1117,6 +1163,7 @@ nbi_new_input_schemas = { "ns_action": ns_action, "ns_scale": ns_scale, "ns_update": ns_update, + "ns_heal": ns_heal, "pdus": pdu_new_schema, } -- 2.25.1