mirror of
https://github.com/kernelkit/infix.git
synced 2026-08-01 21:33:02 +02:00
cli: for consistency with YANG model, rename METRIC --> PREF(ERENCE)
In review discussions we have decided, for resonsons of consistency over correctness, to rename this column to match the YANG model node name rather than the Linux kernel name. Also, right align the values. Numbers should always be right-aligned. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
committed by
Mattias Walström
parent
eb89f14ea3
commit
95bcc1d902
@@ -18,7 +18,7 @@ class PadRoute:
|
||||
prefix = 30
|
||||
protocol = 10
|
||||
next_hop = 30
|
||||
metric = 10
|
||||
pref = 8
|
||||
|
||||
class PadSoftware:
|
||||
name = 10
|
||||
@@ -59,7 +59,7 @@ class Route:
|
||||
self.data = data
|
||||
self.prefix = data.get(f'ietf-{ip}-unicast-routing:destination-prefix', '')
|
||||
self.protocol = data.get('source-protocol','')[14:]
|
||||
self.metric = data.get('route-preference','')
|
||||
self.pref = data.get('route-preference','')
|
||||
|
||||
interface = get_json_data(None, self.data, 'next-hop', 'outgoing-interface')
|
||||
address = get_json_data(None, self.data, 'next-hop', f'ietf-{ip}-unicast-routing:next-hop-address')
|
||||
@@ -76,7 +76,7 @@ class Route:
|
||||
def print(self):
|
||||
row = f"{self.prefix:<{PadRoute.prefix}}"
|
||||
row += f"{self.next_hop:<{PadRoute.next_hop}}"
|
||||
row += f"{self.metric:<{PadRoute.metric}}"
|
||||
row += f"{self.pref:>{PadRoute.pref}} "
|
||||
row += f"{self.protocol:<{PadRoute.protocol}}"
|
||||
print(row)
|
||||
|
||||
@@ -375,7 +375,7 @@ def ietf_routing(json, ip="ipv4"):
|
||||
sys.exit(1)
|
||||
hdr = (f"{'PREFIX':<{PadRoute.prefix}}"
|
||||
f"{'NEXT-HOP':<{PadRoute.next_hop}}"
|
||||
f"{'METRIC':<{PadRoute.metric}}"
|
||||
f"{'PREF':>{PadRoute.pref}} "
|
||||
f"{'PROTOCOL':<{PadRoute.protocol}}")
|
||||
|
||||
print(Decore.invert(hdr))
|
||||
|
||||
+12
-11
@@ -422,25 +422,26 @@ NETCONF or using the CLI:
|
||||
#### IPv4 routing table
|
||||
|
||||
admin@example:/> show routes ipv4
|
||||
PREFIX NEXT-HOP METRIC PROTOCOL
|
||||
192.168.1.0/24 e0 kernel
|
||||
192.168.200.0/24 192.168.1.1 20 static
|
||||
PREFIX NEXT-HOP PREF PROTOCOL
|
||||
192.168.1.0/24 e0 kernel
|
||||
192.168.200.0/24 192.168.1.1 20 static
|
||||
admin@example:/>
|
||||
|
||||
#### IPv6 routing table
|
||||
|
||||
admin@example:/> show routes ipv6
|
||||
PREFIX NEXT-HOP METRIC PROTOCOL
|
||||
2001:db8:3c4d:50::/64 eth4 256 kernel
|
||||
fe80::/64 eth5 256 kernel
|
||||
fe80::/64 eth3 256 kernel
|
||||
fe80::/64 eth1 256 kernel
|
||||
fe80::/64 eth0 256 kernel
|
||||
fe80::/64 eth2 256 kernel
|
||||
fe80::/64 eth4 256 kernel
|
||||
PREFIX NEXT-HOP PREF PROTOCOL
|
||||
2001:db8:3c4d:50::/64 eth4 256 kernel
|
||||
fe80::/64 eth5 256 kernel
|
||||
fe80::/64 eth3 256 kernel
|
||||
fe80::/64 eth1 256 kernel
|
||||
fe80::/64 eth0 256 kernel
|
||||
fe80::/64 eth2 256 kernel
|
||||
fe80::/64 eth4 256 kernel
|
||||
admin@example:/>
|
||||
|
||||
#### Source protocol
|
||||
|
||||
The source protocol describes the origin of the route.
|
||||
|
||||
| **Protocol** | **Description** |
|
||||
|
||||
Reference in New Issue
Block a user