From: bravof Date: Fri, 26 Feb 2021 19:57:52 +0000 (-0300) Subject: fix(query): new query to get VNFD using the session object. Bug 1390 X-Git-Tag: branch-bug1511-start~3 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F57%2F10457%2F2;p=osm%2FNBI.git fix(query): new query to get VNFD using the session object. Bug 1390 Change-Id: I787f8715314b113f349c9b659b41aa4e0795250d Signed-off-by: bravof Signed-off-by: garciadeblas --- diff --git a/osm_nbi/instance_topics.py b/osm_nbi/instance_topics.py index de49738..f2dbd6b 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 = {}