X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FNBI.git;a=blobdiff_plain;f=osm_nbi%2Finstance_topics.py;h=7b3e9ad7166908d1846c31a8aa31f2050f80c658;hp=cabfc1c9ab6718048119e91f037f971e9251ac13;hb=e76b88289b7ee86fa8f79effae73499eb637fadf;hpb=28c13b65cd51c330da88e726a5301d9a60d113de diff --git a/osm_nbi/instance_topics.py b/osm_nbi/instance_topics.py index cabfc1c..7b3e9ad 100644 --- a/osm_nbi/instance_topics.py +++ b/osm_nbi/instance_topics.py @@ -233,7 +233,7 @@ class NsrTopic(BaseTopic): step = "filling nsr from input data" nsr_id = str(uuid4()) - nsr_descriptor = self._create_nsr_descriptor_from_nsd(nsd, ns_request, nsr_id) + nsr_descriptor = self._create_nsr_descriptor_from_nsd(nsd, ns_request, nsr_id, session) # Create VNFRs needed_vnfds = {} @@ -306,7 +306,7 @@ class NsrTopic(BaseTopic): return ns_k8s_namespace - def _create_nsr_descriptor_from_nsd(self, nsd, ns_request, nsr_id): + def _create_nsr_descriptor_from_nsd(self, nsd, ns_request, nsr_id, session): now = time() additional_params, _ = self._format_additional_params(ns_request, descriptor=nsd) @@ -367,10 +367,7 @@ class NsrTopic(BaseTopic): "vnfd-id-ref": vnf_profile.get("vnfd-id") }) - vnfd = self.db.get_one("vnfds", - {"id": vnf_profile.get("vnfd-id")}, - fail_on_empty=True, - fail_on_more=True) + vnfd = self._get_vnfd_from_db(vnf_profile.get("vnfd-id"), session) for vdu in vnfd.get("vdu", ()): flavor_data = {} @@ -547,6 +544,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 +610,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"]))