Bug 2374 Fixed:IP's are not listed properly when using vnf-list command in osmclient
Change-Id: I5afdfd737506882687ed938fc790e33433c0f396
Signed-off-by: 36970 <jegan.s@tataelxsi.co.in>
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 @@
"vnf member index",
"vnfd name",
"vim account id",
- "ip address",
+ "mgmt ip address",
]
if long:
field_names = [
@@ -55,9 +55,10 @@
"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 @@
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)