Fix bug 2240 to get packages from id and _id 50/14250/1
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Mon, 11 Mar 2024 16:11:52 +0000 (17:11 +0100)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Mon, 11 Mar 2024 16:11:52 +0000 (17:11 +0100)
Change-Id: Iad5de449b0dcb036749c7d1536a84aec203ec396
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
osmclient/cli_commands/nfpkg.py
osmclient/sol005/vnfd.py

index ce7212e..8d3f01b 100755 (executable)
@@ -71,7 +71,7 @@ def vnfd_list(ctx, nf_type, filter, long):
     else:
         table = PrettyTable(["nfpkg name", "id", "desc type"])
     for vnfd in resp:
-        name = vnfd.get("id", vnfd.get("name", "-"))
+        name = vnfd.get("id", vnfd.get("product-name", "-"))
         descriptor_type = "sol006" if "product-name" in vnfd else "rel8"
         if long:
             onb_state = vnfd["_admin"].get("onboardingState", "-")
index 3c09707..5c8b310 100644 (file)
@@ -66,9 +66,9 @@ class Vnfd(object):
                     return vnfd
         else:
             for vnfd in self.list():
-                if "product-name" in vnfd and name == vnfd["product-name"]:
+                if "id" in vnfd and name == vnfd["id"]:
                     return vnfd
-                elif "name" in vnfd and name == vnfd["name"]:
+                elif "product-name" in vnfd and name == vnfd["product-name"]:
                     return vnfd
         raise NotFound("vnfd {} not found".format(name))