cli-pretty: print ip address origin (ip route proto)

Print the origin which is based on info from ip route proto.

Signed-off-by: Richard Alpe <richard@bit42.se>
This commit is contained in:
Richard Alpe
2023-09-19 11:56:14 +02:00
committed by Joachim Wiberg
parent 6e9ba0fce5
commit e3a2895531
+3 -1
View File
@@ -75,9 +75,11 @@ class Iface:
def pr_proto_ipv4(self, pipe=''):
for addr in self.ipv4_addr:
origin = f"({addr['origin']})" if addr.get('origin') else ""
row = f"{pipe:<{Pad.iface}}"
row += f"{'ipv4':<{Pad.proto}}"
row += f"{'':<{Pad.state}}{addr['ip']}/{addr['prefix-length']}"
row += f"{'':<{Pad.state}}{addr['ip']}/{addr['prefix-length']} {origin}"
print(row)
def pr_proto_eth(self):