From: bravof Date: Wed, 24 Feb 2021 20:22:24 +0000 (-0300) Subject: feat/fix(mgmt-cp): allows package creators to specify an external connection as ... X-Git-Tag: v9.1.0~1^2 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F86%2F10386%2F3;p=osm%2FNBI.git feat/fix(mgmt-cp): allows package creators to specify an external connection as 'management' through VDU/KDU configuration Change-Id: I73cf116609e9e5e569db49d7469cbc9ebce50ab9 Signed-off-by: bravof --- diff --git a/osm_nbi/instance_topics.py b/osm_nbi/instance_topics.py index cabfc1c..5088b24 100644 --- a/osm_nbi/instance_topics.py +++ b/osm_nbi/instance_topics.py @@ -547,6 +547,21 @@ class NsrTopic(BaseTopic): vnfd_mgmt_cp = vnfd.get("mgmt-cp") for vdu in vnfd.get("vdu", ()): + vdu_mgmt_cp = [] + try: + configs = vnfd.get("df")[0]["lcm-operations-configuration"]["operate-vnf-op-config"]["day1-2"] + vdu_config = utils.find_in_list(configs, lambda config: config["id"] == vdu["id"]) + except Exception: + vdu_config = None + + if vdu_config: + external_connection_ee = utils.filter_in_list( + vdu_config.get("execution-environment-list", []), + lambda ee: "external-connection-point-ref" in ee + ) + for ee in external_connection_ee: + vdu_mgmt_cp.append(ee["external-connection-point-ref"]) + additional_params, vdu_params = self._format_additional_params( ns_request, vnf_index, vdu_id=vdu["id"], descriptor=vnfd) vdur = { @@ -598,7 +613,11 @@ class NsrTopic(BaseTopic): if vnfd_mgmt_cp and vdu_iface.get("external-connection-point-ref") == vnfd_mgmt_cp: vdu_iface["mgmt-vnf"] = True - vdu_iface["mgmt-interface"] = True # TODO change to mgmt-vdu + vdu_iface["mgmt-interface"] = True + + for ecp in vdu_mgmt_cp: + if vdu_iface.get("external-connection-point-ref") == ecp: + vdu_iface["mgmt-interface"] = True if iface.get("virtual-interface"): vdu_iface.update(deepcopy(iface["virtual-interface"])) diff --git a/osm_nbi/utils.py b/osm_nbi/utils.py index aac3d90..73fc40f 100644 --- a/osm_nbi/utils.py +++ b/osm_nbi/utils.py @@ -31,6 +31,14 @@ def find_in_list(the_list, condition_lambda): return None +def filter_in_list(the_list, condition_lambda): + ret = [] + for item in the_list: + if condition_lambda(item): + ret.append(item) + return ret + + def find_index_in_list(the_list, condition_lambda): for index, item in enumerate(the_list): if condition_lambda(item):