From bb00602bac72bd5744e1e3ddc8e15068cb27c024 Mon Sep 17 00:00:00 2001 From: K Sai Kiran Date: Thu, 20 May 2021 11:09:49 +0530 Subject: [PATCH] Bug 1538 Fixed In case if df is not available in an NSD then nsd.get("df", [[]])[0].get("vnf-profile", ()) raises an exception. Since [[]][0] returns a list and list does not have a get() function. Fix is to change [[]] to [{}] such that when [{}][0] is executed we get a dict instead of list. Change-Id: I7e7ce62a44720dcc368ce7a4fa3d0bc1d7beb43b Signed-off-by: K Sai Kiran --- osm_nbi/instance_topics.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osm_nbi/instance_topics.py b/osm_nbi/instance_topics.py index d76b0b1..94adb7b 100644 --- a/osm_nbi/instance_topics.py +++ b/osm_nbi/instance_topics.py @@ -334,7 +334,7 @@ class NsrTopic(BaseTopic): # Create VNFRs needed_vnfds = {} # TODO: Change for multiple df support - vnf_profiles = nsd.get("df", [[]])[0].get("vnf-profile", ()) + vnf_profiles = nsd.get("df", [{}])[0].get("vnf-profile", ()) for vnfp in vnf_profiles: vnfd_id = vnfp.get("vnfd-id") vnf_index = vnfp.get("id") -- 2.25.1