fix(query): new query to get VNFD using the session object. Bug 1390 57/10457/2
authorbravof <fbravo@whitestack.com>
Fri, 26 Feb 2021 19:57:52 +0000 (16:57 -0300)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Thu, 8 Apr 2021 16:06:28 +0000 (18:06 +0200)
Change-Id: I787f8715314b113f349c9b659b41aa4e0795250d
Signed-off-by: bravof <fbravo@whitestack.com>
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
osm_nbi/instance_topics.py

index de49738..f2dbd6b 100644 (file)
@@ -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 = {}