Bug 2374 Fixed:IP's are not listed properly when using vnf-list command in osmclient 51/14351/5
author36970 <jegan.s@tataelxsi.co.in>
Tue, 7 May 2024 11:52:03 +0000 (11:52 +0000)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Mon, 30 Sep 2024 15:39:41 +0000 (17:39 +0200)
Change-Id: I5afdfd737506882687ed938fc790e33433c0f396
Signed-off-by: 36970 <jegan.s@tataelxsi.co.in>
osmclient/cli_commands/vnf.py

index 59c8df4..9d8acfc 100755 (executable)
@@ -45,7 +45,7 @@ def vnf_list(ctx, ns, filter, long, output):
         "vnf member index",
         "vnfd name",
         "vim account id",
-        "ip address",
+        "mgmt ip address",
     ]
     if long:
         field_names = [
@@ -55,9 +55,10 @@ def vnf_list(ctx, ns, filter, long, output):
             "vnf member index",
             "vnfd name",
             "vim account id",
-            "ip address",
+            "mgmt ip address",
             "date",
             "last update",
+            "vdu ip addresses",
         ]
     table = PrettyTable(field_names)
     for vnfr in resp:
@@ -78,7 +79,14 @@ def vnf_list(ctx, ns, filter, long, output):
             last_update = datetime.fromtimestamp(vnfr["_admin"]["modified"]).strftime(
                 "%Y-%m-%dT%H:%M:%S"
             )
-            new_row.extend([date, last_update])
+            vdu_ip_addresses = (
+                [
+                    vnfr["vdur"][vdur]["interfaces"][interface].get("ip-address")
+                    for vdur in range(len(vnfr["vdur"]))
+                    for interface in range(len(vnfr["vdur"][vdur]["interfaces"]))
+                ],
+            )
+            new_row.extend([date, last_update, vdu_ip_addresses])
         table.add_row(new_row)
     print_output.print_output(output, table.field_names, table._rows)