From: 36970 Date: Tue, 7 May 2024 11:52:03 +0000 (+0000) Subject: Bug 2374 Fixed:IP's are not listed properly when using vnf-list command in osmclient X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F51%2F14351%2F5;p=osm%2Fosmclient.git Bug 2374 Fixed:IP's are not listed properly when using vnf-list command in osmclient Change-Id: I5afdfd737506882687ed938fc790e33433c0f396 Signed-off-by: 36970 --- diff --git a/osmclient/cli_commands/vnf.py b/osmclient/cli_commands/vnf.py index 59c8df4..9d8acfc 100755 --- a/osmclient/cli_commands/vnf.py +++ b/osmclient/cli_commands/vnf.py @@ -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)