From 9edef4945b520b3d60efca6cab86b110a6e21bb2 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Sat, 9 May 2026 21:43:03 +0200 Subject: [PATCH 1/2] cli: type-prefix DATA column in 'show interfaces' summary MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The summary view's DATA column previously held a single bare value (MAC for ethernet/veth/gretap/vxlan, empty for gre, etc.). Add a key:value-per-token format on the row types where DATA was thin or actively misleading: - ethernet: mac: [speed:-] - veth: mac: - vlan: vid: (was: parent's MAC, duplicate of the └ parent row drawn underneath) - gre: remote: - gretap: mac: [remote:] - vxlan: mac: [vni:] Speed/duplex use a compact summary token: 100M-FDX, 1G-FDX, 25G-FDX, HDX for half-duplex. Unit hop M->G at 1 Gbps. Token omitted when ethtool can't report (no link, no SFP). Detail view (show interface ) is unchanged and still spells out auto-negotiation, duplex, and speed in full. Bridge ports, wireguard, wifi, lag, container, and loopback rows already carried the right info; left untouched. Updates affected unit-test snapshots under test/case/statd/* and doc/*.md screenshots. Closes #530 Signed-off-by: Joachim Wiberg --- doc/dhcp.md | 4 +- doc/ethernet.md | 28 ++++-- doc/iface.md | 9 +- doc/ip.md | 40 ++++----- doc/lag.md | 8 +- doc/management.md | 6 +- doc/scripting-prod.md | 42 ++++----- src/statd/python/cli_pretty/cli_pretty.py | 86 ++++++++++++++----- .../case/statd/containers/cli/show-interfaces | 30 +++---- .../statd/interfaces-all/cli/show-interfaces | 52 +++++------ 10 files changed, 185 insertions(+), 120 deletions(-) diff --git a/doc/dhcp.md b/doc/dhcp.md index c2792930d..fae88700d 100644 --- a/doc/dhcp.md +++ b/doc/dhcp.md @@ -111,9 +111,9 @@ subnet. For example:
admin@example:/> show interfaces
 INTERFACE       PROTOCOL   STATE       DATA                                    
-eth0            ethernet   UP          02:00:00:00:00:00
+eth0            ethernet   UP          mac:02:00:00:00:00:00
                 ipv4                   192.168.1.1/24 (static)
-eth1            ethernet   UP          02:00:00:00:00:01
+eth1            ethernet   UP          mac:02:00:00:00:00:01
                 ipv4                   192.168.2.1/24 (static)
 
 admin@example:/config/dhcp-server/subnet/192.168.1.0/24/> edit option dns-server
diff --git a/doc/ethernet.md b/doc/ethernet.md
index 84e8cb75c..7fb14c51a 100644
--- a/doc/ethernet.md
+++ b/doc/ethernet.md
@@ -56,16 +56,30 @@ top of a bridge interface *br0* is named *vlan10*.
 Physical Ethernet interfaces provide low-level settings for speed/duplex as
 well as packet status and [statistics](#ethernet-statistics).
 
-By default, Ethernet interfaces defaults to auto-negotiating
-speed/duplex modes, advertising all speed and duplex modes available.
-In the example below, the switch would by default auto-negotiate speed
-1 Gbit/s on port eth1 and 100 Mbit/s on port eth4, as those are the
-highest speeds supported by H1 and H2 respectively.
+By default, Ethernet interfaces defaults to auto-negotiating speed/duplex
+modes, advertising all speed and duplex modes available.  In the example
+below, the switch would by default auto-negotiate speed 1 Gbps on port eth1
+and 100 Mbps on port eth4, as those are the highest speeds supported by H1 and
+H2 respectively.
 
 ![4-port Gbit/s switch connected to Gbit and Fast Ethernet Hosts](img/ethernet-autoneg.svg)
 
-The speed and duplex status for the links can be listed as shown
-below, assuming the link operational status is 'up'.
+A quick at-a-glance view of speed and duplex is available in the summary
+listing.  The DATA column shows a compact `speed:-` token (`FDX`
+for full-duplex, `HDX` for half-duplex) for each linked Ethernet port.  The
+token is omitted when the link is down or the interface is disabled.
+
+
admin@example:/> show interface
+INTERFACE       PROTOCOL   STATE       DATA
+eth1            ethernet   UP          mac:00:53:00:06:11:01 speed:1G-FDX
+eth2            ethernet   UP          mac:00:53:00:06:11:02 speed:1G-FDX
+eth3            ethernet   DOWN        mac:00:53:00:06:11:03
+eth4            ethernet   UP          mac:00:53:00:06:11:04 speed:100M-FDX
+...
+
+ +The detail view spells everything out, including auto-negotiation +state and the speed in Mbit/s.
admin@example:/> show interface eth1
 name                : eth1
diff --git a/doc/iface.md b/doc/iface.md
index 9cecd8daa..8e2767080 100644
--- a/doc/iface.md
+++ b/doc/iface.md
@@ -63,11 +63,16 @@ actual link state:
 
 
admin@example:/> show interfaces
 INTERFACE       PROTOCOL   STATE       DATA
-eth0            ethernet   DISABLED    02:00:00:00:00:00
-eth1            ethernet   UP          02:00:00:00:00:01
+eth0            ethernet   DISABLED    mac:02:00:00:00:00:00
+eth1            ethernet   UP          mac:02:00:00:00:00:01 speed:1G-FDX
 ...
 
+The DATA column carries type-specific operational info: a `mac:` for +each interface that has one, plus extras like `speed:1G-FDX` when the +link is up. See [Ethernet](ethernet.md) for the full set of summary +fields. + ## Description diff --git a/doc/ip.md b/doc/ip.md index a42302ff4..f6cd1bef1 100644 --- a/doc/ip.md +++ b/doc/ip.md @@ -119,9 +119,9 @@ will be ignored. For details on how to enable the NTP client, see the
admin@example:/> show interfaces
 INTERFACE       PROTOCOL   STATE       DATA                                    
-eth0            ethernet   UP          02:00:00:00:00:00
+eth0            ethernet   UP          mac:02:00:00:00:00:00
                 ipv6                   fe80::ff:fe00:0/64 (link-layer)
-lo              ethernet   UP          00:00:00:00:00:00
+lo              ethernet   UP          mac:00:00:00:00:00:00
                 ipv4                   127.0.0.1/8 (static)
                 ipv6                   ::1/128 (static)
 admin@example:/>
@@ -155,11 +155,11 @@ admin@example:/config/interface/eth0/ipv4/> diff
 admin@example:/config/interface/eth0/ipv4/> leave
 admin@example:/> show interfaces
 INTERFACE       PROTOCOL   STATE       DATA                                    
-eth0            ethernet   UP          02:00:00:00:00:00
+eth0            ethernet   UP          mac:02:00:00:00:00:00
                 ipv4                   169.254.1.3/16 (random)
                 ipv4                   10.0.1.1/24 (static)
                 ipv6                   fe80::ff:fe00:0/64 (link-layer)
-lo              ethernet   UP          00:00:00:00:00:00
+lo              ethernet   UP          mac:00:00:00:00:00:00
                 ipv4                   127.0.0.1/8 (static)
                 ipv6                   ::1/128 (static)
 admin@example:/>
@@ -190,10 +190,10 @@ admin@example:/config/interface/eth0/ipv4/> set dhcp
 admin@example:/config/interface/eth0/ipv4/> leave
 admin@example:/> show interfaces
 INTERFACE       PROTOCOL   STATE       DATA                                    
-eth0            ethernet   UP          02:00:00:00:00:00
+eth0            ethernet   UP          mac:02:00:00:00:00:00
                 ipv4                   10.1.2.100/24 (dhcp)
                 ipv6                   fe80::ff:fe00:0/64 (link-layer)
-lo              ethernet   UP          00:00:00:00:00:00
+lo              ethernet   UP          mac:00:00:00:00:00:00
                 ipv4                   127.0.0.1/8 (static)
                 ipv6                   ::1/128 (static)
 admin@example:/>
@@ -236,10 +236,10 @@ admin@example:/config/interface/eth0/ipv6/> set dhcp
 admin@example:/config/interface/eth0/ipv6/> leave
 admin@example:/> show interface
 INTERFACE       PROTOCOL   STATE       DATA                                    
-eth0            ethernet   UP          02:00:00:00:00:00
+eth0            ethernet   UP          mac:02:00:00:00:00:00
                 ipv6                   2001:db8::42/128 (dhcp)
                 ipv6                   fe80::ff:fe00:0/64 (link-layer)
-lo              ethernet   UP          00:00:00:00:00:00
+lo              ethernet   UP          mac:00:00:00:00:00:00
                 ipv4                   127.0.0.1/8 (static)
                 ipv6                   ::1/128 (static)
 admin@example:/>
@@ -293,8 +293,8 @@ admin@example:/config/interface/eth0/ipv6/> set enabled false
 admin@example:/config/interface/eth0/ipv6/> leave
 admin@example:/> show interfaces
 INTERFACE       PROTOCOL   STATE       DATA                                    
-eth0            ethernet   UP          02:00:00:00:00:00
-lo              ethernet   UP          00:00:00:00:00:00
+eth0            ethernet   UP          mac:02:00:00:00:00:00
+lo              ethernet   UP          mac:00:00:00:00:00:00
                 ipv4                   127.0.0.1/8 (static)
                 ipv6                   ::1/128 (static)
 admin@example:/>
@@ -310,10 +310,10 @@ admin@example:/config/interface/eth0/ipv6/> set address 2001:db8::1 prefix-le
 admin@example:/config/interface/eth0/ipv6/> leave
 admin@example:/> show interfaces
 INTERFACE       PROTOCOL   STATE       DATA                                    
-eth0            ethernet   UP          02:00:00:00:00:00
+eth0            ethernet   UP          mac:02:00:00:00:00:00
                 ipv6                   2001:db8::1/64 (static)
                 ipv6                   fe80::ff:fe00:0/64 (link-layer)
-lo              ethernet   UP          00:00:00:00:00:00
+lo              ethernet   UP          mac:00:00:00:00:00:00
                 ipv4                   127.0.0.1/8 (static)
                 ipv6                   ::1/128 (static)
 admin@example:/>
@@ -332,10 +332,10 @@ formed based on the interface identifier ([ietf-ip.yang][2]).
 
 
admin@example:/> show interfaces
 INTERFACE       PROTOCOL   STATE       DATA                                    
-eth0            ethernet   UP          02:00:00:00:00:00
+eth0            ethernet   UP          mac:02:00:00:00:00:00
                 ipv6                   2001:db8:0:1:0:ff:fe00:0/64 (link-layer)
                 ipv6                   fe80::ff:fe00:0/64 (link-layer)
-lo              ethernet   UP          00:00:00:00:00:00
+lo              ethernet   UP          mac:00:00:00:00:00:00
                 ipv4                   127.0.0.1/8 (static)
                 ipv6                   ::1/128 (static)
 admin@example:/>
@@ -350,9 +350,9 @@ admin@example:/config/interface/eth0/ipv6/> set autoconf create-global-addres
 admin@example:/config/interface/eth0/ipv6/> leave
 admin@example:/> show interfaces
 INTERFACE       PROTOCOL   STATE       DATA                                    
-eth0            ethernet   UP          02:00:00:00:00:00
+eth0            ethernet   UP          mac:02:00:00:00:00:00
                 ipv6                   fe80::ff:fe00:0/64 (link-layer)
-lo              ethernet   UP          00:00:00:00:00:00
+lo              ethernet   UP          mac:00:00:00:00:00:00
                 ipv4                   127.0.0.1/8 (static)
                 ipv6                   ::1/128 (static)
 admin@example:/>
@@ -368,10 +368,10 @@ are formed from a link-identifier based on the MAC address.
 
 
admin@example:/> show interfaces
 INTERFACE       PROTOCOL   STATE       DATA                                    
-eth0            ethernet   UP          02:00:00:00:00:00
+eth0            ethernet   UP          mac:02:00:00:00:00:00
                 ipv6                   2001:db8:0:1:0:ff:fe00:0/64 (link-layer)
                 ipv6                   fe80::ff:fe00:0/64 (link-layer)
-lo              ethernet   UP          00:00:00:00:00:00
+lo              ethernet   UP          mac:00:00:00:00:00:00
                 ipv4                   127.0.0.1/8 (static)
                 ipv6                   ::1/128 (static)
 admin@example:/>
@@ -387,10 +387,10 @@ admin@example:/config/interface/eth0/ipv6/> set autoconf create-temporary-add
 admin@example:/config/interface/eth0/ipv6/> leave
 admin@example:/> show interfaces
 INTERFACE       PROTOCOL   STATE       DATA                                    
-eth0            ethernet   UP          02:00:00:00:00:00
+eth0            ethernet   UP          mac:02:00:00:00:00:00
                 ipv6                   2001:db8:0:1:b705:8374:638e:74a8/64 (random)
                 ipv6                   fe80::ad3d:b274:885a:9ffb/64 (random)
-lo              ethernet   UP          00:00:00:00:00:00
+lo              ethernet   UP          mac:00:00:00:00:00:00
                 ipv4                   127.0.0.1/8 (static)
                 ipv6                   ::1/128 (static)
 admin@example:/>
diff --git a/doc/lag.md b/doc/lag.md
index b4c6b4f81..fe7cf8904 100644
--- a/doc/lag.md
+++ b/doc/lag.md
@@ -89,14 +89,14 @@ static mode aggregate:
 
 
admin@example:/> show interfaces
 INTERFACE       PROTOCOL   STATE       DATA                                    
-lo              ethernet   UP          00:00:00:00:00:00
+lo              ethernet   UP          mac:00:00:00:00:00:00
                 ipv4                   127.0.0.1/8 (static)
                 ipv6                   ::1/128 (static)
 .
 .
 .
 lag0            lag        UP          static: balance-xor, hash: layer2
-│               ethernet   UP          00:a0:85:00:02:00
+│               ethernet   UP          mac:00:a0:85:00:02:00
 ├ eth7          lag        ACTIVE
 └ eth8          lag        ACTIVE
 
@@ -105,14 +105,14 @@ Same aggregate, but in LACP mode:
admin@example:/> show interfaces
 INTERFACE       PROTOCOL   STATE       DATA                                    
-lo              ethernet   UP          00:00:00:00:00:00
+lo              ethernet   UP          mac:00:00:00:00:00:00
                 ipv4                   127.0.0.1/8 (static)
                 ipv6                   ::1/128 (static)
 .
 .
 .
 lag0            lag        UP          lacp: active, rate: fast (1s), hash: layer2
-│               ethernet   UP          00:a0:85:00:02:00
+│               ethernet   UP          mac:00:a0:85:00:02:00
 ├ eth7          lag        ACTIVE      active, short_timeout, aggregating, in_sync, collecting, distributing
 └ eth8          lag        ACTIVE      active, short_timeout, aggregating, in_sync, collecting, distributing
 
diff --git a/doc/management.md b/doc/management.md index 2a75214cb..032a6e539 100644 --- a/doc/management.md +++ b/doc/management.md @@ -111,11 +111,11 @@ See the 'help' command for an introduction to the system admin@example:/> show interfaces INTERFACE PROTOCOL STATE DATA -lo ethernet UP 00:00:00:00:00:00 +lo ethernet UP mac:00:00:00:00:00:00 ipv4 127.0.0.1/8 (static) ipv6 ::1/128 (static) -e1 ethernet LOWER-DOWN 00:53:00:06:03:01 -e2 ethernet LOWER-DOWN 00:53:00:06:03:02 +e1 ethernet LOWER-DOWN mac:00:53:00:06:03:01 +e2 ethernet LOWER-DOWN mac:00:53:00:06:03:02 ... admin@example:/>
diff --git a/doc/scripting-prod.md b/doc/scripting-prod.md index 70fd1da44..31705c2be 100644 --- a/doc/scripting-prod.md +++ b/doc/scripting-prod.md @@ -40,19 +40,19 @@ interfaces (possibly with IPv6 enabled). ``` admin@example:/> show interfaces -lo ethernet UP 00:00:00:00:00:00 +lo ethernet UP mac:00:00:00:00:00:00 ipv4 127.0.0.1/8 (static) ipv6 ::1/128 (static) -e1 ethernet LOWER-DOWN 00:53:00:06:11:01 -e2 ethernet LOWER-DOWN 00:53:00:06:11:02 -e3 ethernet LOWER-DOWN 00:53:00:06:11:03 -e4 ethernet LOWER-DOWN 00:53:00:06:11:04 -e5 ethernet LOWER-DOWN 00:53:00:06:11:05 -e6 ethernet LOWER-DOWN 00:53:00:06:11:06 -e7 ethernet LOWER-DOWN 00:53:00:06:11:07 -e8 ethernet LOWER-DOWN 00:53:00:06:11:08 -e9 ethernet LOWER-DOWN 00:53:00:06:11:09 -e10 ethernet UP 00:53:00:06:11:0a +e1 ethernet LOWER-DOWN mac:00:53:00:06:11:01 +e2 ethernet LOWER-DOWN mac:00:53:00:06:11:02 +e3 ethernet LOWER-DOWN mac:00:53:00:06:11:03 +e4 ethernet LOWER-DOWN mac:00:53:00:06:11:04 +e5 ethernet LOWER-DOWN mac:00:53:00:06:11:05 +e6 ethernet LOWER-DOWN mac:00:53:00:06:11:06 +e7 ethernet LOWER-DOWN mac:00:53:00:06:11:07 +e8 ethernet LOWER-DOWN mac:00:53:00:06:11:08 +e9 ethernet LOWER-DOWN mac:00:53:00:06:11:09 +e10 ethernet UP mac:00:53:00:06:11:0a ipv6 fe80::0053:00ff:fe06:110a/64 (link-layer) admin@example:/> ``` @@ -98,7 +98,7 @@ admin@example:/> admin@example:/> show interfaces INTERFACE PROTOCOL STATE DATA br0 bridge -│ ethernet UP 00:53:00:06:11:01 +│ ethernet UP mac:00:53:00:06:11:01 ├ e1 bridge LOWER-DOWN ├ e2 bridge LOWER-DOWN ├ e3 bridge LOWER-DOWN @@ -109,7 +109,7 @@ br0 bridge ├ e8 bridge LOWER-DOWN ├ e9 bridge LOWER-DOWN └ e10 bridge FORWARDING -lo ethernet UP 00:00:00:00:00:00 +lo ethernet UP mac:00:00:00:00:00:00 ipv4 127.0.0.1/8 (static) ipv6 ::1/128 (static) admin@example:/> @@ -157,7 +157,7 @@ Interface status would now should something like the following admin@example:/> show interfaces INTERFACE PROTOCOL STATE DATA br0 bridge -│ ethernet UP 00:53:00:06:11:01 +│ ethernet UP mac:00:53:00:06:11:01 ├ e1 bridge LOWER-DOWN vlan:10u pvid:10 ├ e2 bridge LOWER-DOWN vlan:10u pvid:10 ├ e3 bridge LOWER-DOWN vlan:20u pvid:20 @@ -168,7 +168,7 @@ br0 bridge ├ e8 bridge LOWER-DOWN vlan:40u pvid:40 ├ e9 bridge LOWER-DOWN vlan:50u pvid:50 └ e10 bridge FORWARDING vlan:50u pvid:50 -lo ethernet UP 00:00:00:00:00:00 +lo ethernet UP mac:00:00:00:00:00:00 ipv4 127.0.0.1/8 (static) ipv6 ::1/128 (static) admin@example:/> @@ -184,7 +184,7 @@ patched according to [above](#vlan-snake). We should see link up and admin@example:/> show interfaces INTERFACE PROTOCOL STATE DATA br0 bridge -│ ethernet UP 00:53:00:06:11:01 +│ ethernet UP mac:00:53:00:06:11:01 ├ e1 bridge FORWARDING vlan:10u pvid:10 ├ e2 bridge FORWARDING vlan:10u pvid:10 ├ e3 bridge FORWARDING vlan:20u pvid:20 @@ -195,7 +195,7 @@ br0 bridge ├ e8 bridge FORWARDING vlan:40u pvid:40 ├ e9 bridge FORWARDING vlan:50u pvid:50 └ e10 bridge FORWARDING vlan:50u pvid:50 -lo ethernet UP 00:00:00:00:00:00 +lo ethernet UP mac:00:00:00:00:00:00 ipv4 127.0.0.1/8 (static) ipv6 ::1/128 (static) admin@example:/> @@ -287,7 +287,7 @@ Interface *vlan10* with an auto-configured IPv6 address should appear. admin@example:/> show interfaces INTERFACE PROTOCOL STATE DATA br0 bridge vlan:10t -│ ethernet UP 00:53:00:06:11:01 +│ ethernet UP mac:00:53:00:06:11:01 ├ e1 bridge FORWARDING vlan:10u pvid:10 ├ e2 bridge FORWARDING vlan:10u pvid:10 ├ e3 bridge FORWARDING vlan:20u pvid:20 @@ -298,12 +298,12 @@ br0 bridge vlan:10t ├ e8 bridge FORWARDING vlan:40u pvid:40 ├ e9 bridge FORWARDING vlan:50u pvid:50 └ e10 bridge FORWARDING vlan:50u pvid:50 -lo ethernet UP 00:00:00:00:00:00 +lo ethernet UP mac:00:00:00:00:00:00 ipv4 127.0.0.1/8 (static) ipv6 ::1/128 (static) -vlan10 ethernet UP 00:53:00:06:11:01 +vlan10 ethernet UP mac:00:53:00:06:11:01 │ ipv6 fe80::0053:00ff:fe06:1101/64 (link-layer) -└ br0 ethernet UP 00:53:00:06:11:01 +└ br0 ethernet UP mac:00:53:00:06:11:01 admin@example:/> ``` diff --git a/src/statd/python/cli_pretty/cli_pretty.py b/src/statd/python/cli_pretty/cli_pretty.py index bf77df3db..f0aab3c36 100755 --- a/src/statd/python/cli_pretty/cli_pretty.py +++ b/src/statd/python/cli_pretty/cli_pretty.py @@ -1107,9 +1107,12 @@ def __init__(self, data): self.wireguard = self.data.get('infix-interfaces:wireguard') if self.data.get('infix-interfaces:vlan'): - self.lower_if = self.data.get('infix-interfaces:vlan', None).get('lower-layer-if',None) + vlan_data = self.data.get('infix-interfaces:vlan') + self.lower_if = vlan_data.get('lower-layer-if', None) + self.vid = vlan_data.get('id', None) else: self.lower_if = '' + self.vid = None def is_wifi(self): return self.type == "infix-if-type:wifi" @@ -1173,7 +1176,32 @@ def pr_proto_ipv6(self, pipe=''): row += f"{'':<{Pad.state}}{addr['ip']}/{addr['prefix-length']} {origin}" print(row) - def _pr_proto_common(self, name, phys_address, pipe=''): + def _speed_duplex_token(self): + """Compact summary token, e.g. '100M-FDX' or '1G-FDX'. + + Empty when speed or duplex is unknown — typical for non-physical + interfaces (bridges, VLANs, tunnels) and for ports with no link. + """ + if not self.speed or not self.duplex: + return "" + try: + mbps = int(round(float(self.speed) * 1000)) + except (TypeError, ValueError): + return "" + if mbps < 1000: + rate = f"{mbps}M" + else: + gbps = mbps / 1000 + rate = f"{int(gbps)}G" if gbps == int(gbps) else f"{gbps:g}G" + if self.duplex == "full": + dup = "FDX" + elif self.duplex == "half": + dup = "HDX" + else: + dup = self.duplex.upper() + return f"{rate}-{dup}" + + def _pr_proto_common(self, name, pipe='', data=''): row = "" if len(pipe) > 0: row = f"{'':<{Pad.flags}}" @@ -1182,16 +1210,28 @@ def _pr_proto_common(self, name, phys_address, pipe=''): row += f"{name:<{Pad.proto}}" dec = Decore.green if self.oper() == "up" else Decore.red row += dec(f"{self.oper().upper():<{Pad.state}}") - if phys_address: - row += f"{self.phys_address:<{Pad.data}}" + if data: + row += f"{data:<{Pad.data}}" return row + def _data_with_mac(self, *extras): + """Build a DATA string starting with mac: (when known) and + appending any non-empty extra tokens, single-space separated.""" + parts = [] + if self.phys_address: + parts.append(f"mac:{self.phys_address}") + parts.extend(e for e in extras if e) + return " ".join(parts) + def pr_proto_eth(self, pipe=''): - row = self._pr_proto_common("ethernet", True, pipe); + extras = [] + if token := self._speed_duplex_token(): + extras.append(f"speed:{token}") + row = self._pr_proto_common("ethernet", pipe, self._data_with_mac(*extras)) print(row) def pr_proto_veth(self, pipe=''): - row = self._pr_proto_common("veth", True, pipe); + row = self._pr_proto_common("veth", pipe, self._data_with_mac()) if self.lower_if: row = f"{'':<{Pad.iface}}" @@ -1202,36 +1242,41 @@ def pr_proto_veth(self, pipe=''): print(row) def pr_proto_gretap(self, pipe=''): - row = self._pr_proto_common("gretap", True, pipe); + extras = [] + if self.gre and (remote := self.gre.get('remote')): + extras.append(f"remote:{remote}") + row = self._pr_proto_common("gretap", pipe, self._data_with_mac(*extras)) print(row) def pr_proto_gre(self, pipe=''): - row = self._pr_proto_common("gre", False, pipe); + data = "" + if self.gre and (remote := self.gre.get('remote')): + data = f"remote:{remote}" + row = self._pr_proto_common("gre", pipe, data) print(row) def pr_proto_vxlan(self, pipe=''): - row = self._pr_proto_common("vxlan", True, pipe); + extras = [] + if self.vxlan and (vni := self.vxlan.get('vni')) is not None: + extras.append(f"vni:{vni}") + row = self._pr_proto_common("vxlan", pipe, self._data_with_mac(*extras)) print(row) def pr_proto_wireguard(self, pipe=''): - row = self._pr_proto_common("wireguard", False, pipe) - + data = "" if self.wireguard: peer_status = self.wireguard.get('peer-status', {}) peers = peer_status.get('peer', []) total_peers = len(peers) up_peers = sum(1 for p in peers if p.get('connection-status') == 'up') - if total_peers > 0: - row += f"{total_peers} peer" - if total_peers != 1: - row += "s" - row += f" ({up_peers} up)" - + plural = "s" if total_peers != 1 else "" + data = f"{total_peers} peer{plural} ({up_peers} up)" + row = self._pr_proto_common("wireguard", pipe, data) print(row) def pr_proto_loopack(self, pipe=''): - row = self._pr_proto_common("loopback", False, pipe); + row = self._pr_proto_common("loopback", pipe); print(row) def pr_wifi_ssids(self): @@ -1309,7 +1354,7 @@ def pr_wifi_stations(self): def pr_proto_wifi(self, pipe=''): - row = self._pr_proto_common("ethernet", True, pipe); + row = self._pr_proto_common("ethernet", pipe, self._data_with_mac()) print(row) ssid = None signal = None @@ -1500,7 +1545,8 @@ def pr_wifi(self): def pr_vlan(self, _ifaces): self.pr_name(pipe="") - self.pr_proto_eth() + data = f"vid:{self.vid}" if self.vid is not None else "" + print(self._pr_proto_common("ethernet", "", data)) if self.lower_if: self.pr_proto_ipv4(pipe='│') diff --git a/test/case/statd/containers/cli/show-interfaces b/test/case/statd/containers/cli/show-interfaces index 375beb061..459da309a 100644 --- a/test/case/statd/containers/cli/show-interfaces +++ b/test/case/statd/containers/cli/show-interfaces @@ -3,7 +3,7 @@ ipv4 127.0.0.1/8 (static) ipv6 ::1/128 (static) br0 bridge  vlan:1u pvid:1 - │ ethernet UP 00:a0:85:00:03:00 + │ ethernet UP mac:00:a0:85:00:03:00 │ ipv4 169.254.1.1/16 (random) │ ipv6 fe80::2a0:85ff:fe00:300/64 (link-layer) ├ e3 bridge FORWARDING vlan:1u pvid:1 @@ -11,31 +11,31 @@ ├ veth0b bridge FORWARDING vlan:1u pvid:1 └ veth2b bridge FORWARDING vlan:1u pvid:1 br1 bridge   - │ ethernet UP 00:a0:85:00:03:00 + │ ethernet UP mac:00:a0:85:00:03:00 ├ veth1b bridge FORWARDING vlan:6u pvid:6 └ veth3b bridge FORWARDING  - e1 ethernet UP 00:a0:85:00:03:01 + e1 ethernet UP mac:00:a0:85:00:03:01 ipv6 fe80::2a0:85ff:fe00:301/64 (link-layer) - e2 ethernet UP 00:a0:85:00:03:02 + e2 ethernet UP mac:00:a0:85:00:03:02 ipv6 fe80::2a0:85ff:fe00:302/64 (link-layer) - e3.8 ethernet UP 00:a0:85:00:03:03 + e3.8 ethernet UP vid:8 │ ipv4 10.1.1.1/32 (static) - └ e3 ethernet UP 00:a0:85:00:03:03 - e4.8 ethernet UP 00:a0:85:00:03:04 + └ e3 ethernet UP mac:00:a0:85:00:03:03 + e4.8 ethernet UP vid:8 │ ipv4 10.1.1.1/32 (static) - └ e4 ethernet UP 00:a0:85:00:03:04 - e5 ethernet UP 00:a0:85:00:03:05 + └ e4 ethernet UP mac:00:a0:85:00:03:04 + e5 ethernet UP mac:00:a0:85:00:03:05 ipv6 fe80::2a0:85ff:fe00:305/64 (link-layer) - e6 ethernet UP 00:a0:85:00:03:06 + e6 ethernet UP mac:00:a0:85:00:03:06 ipv4 10.1.1.101/24 (static) ipv6 fe80::2a0:85ff:fe00:306/64 (link-layer) - e7 ethernet UP 00:a0:85:00:03:07 + e7 ethernet UP mac:00:a0:85:00:03:07 ipv6 fe80::2a0:85ff:fe00:307/64 (link-layer) veth0a container container-A  - veth0b veth UP e6:19:75:86:80:dd + veth0b veth UP mac:e6:19:75:86:80:dd veth1a container container-A  - veth1b veth UP 3e:67:0f:15:24:14 + veth1b veth UP mac:3e:67:0f:15:24:14 veth2a container container-B  - veth2b veth UP b2:fa:30:63:98:f0 + veth2b veth UP mac:b2:fa:30:63:98:f0 veth3a container container-B  - veth3b veth UP b2:1c:fa:a7:45:eb + veth3b veth UP mac:b2:1c:fa:a7:45:eb diff --git a/test/case/statd/interfaces-all/cli/show-interfaces b/test/case/statd/interfaces-all/cli/show-interfaces index 2d64d5a4a..e8df0cd77 100644 --- a/test/case/statd/interfaces-all/cli/show-interfaces +++ b/test/case/statd/interfaces-all/cli/show-interfaces @@ -3,49 +3,49 @@ ipv4 127.0.0.1/8 (static) ipv6 ::1/128 (static) br-0 bridge DOWN  - ethernet DOWN 00:a0:85:00:03:00 + ethernet DOWN mac:00:a0:85:00:03:00 br-D bridge   - │ ethernet UP 00:a0:85:00:03:00 + │ ethernet UP mac:00:a0:85:00:03:00 │ ipv4 10.0.0.1/8 (static) │ ipv4 192.168.20.1/24 (static) │ ipv6 2001:db8::1/64 (static) │ ipv6 fe80::2a0:85ff:fe00:300/64 (link-layer) └ veth0a.20 bridge FORWARDING  br-Q bridge  vlan:20u,30u,40t - │ ethernet UP 00:a0:85:00:03:00 + │ ethernet UP mac:00:a0:85:00:03:00 ├ e3 bridge FORWARDING vlan:20t,30t,40t └ veth0b bridge FORWARDING vlan:20t,30t,40t - br-Q.40 ethernet UP 00:a0:85:00:03:00 - └ br-Q ethernet UP 00:a0:85:00:03:00 + br-Q.40 ethernet UP vid:40 + └ br-Q ethernet UP mac:00:a0:85:00:03:00 br-X bridge   - │ ethernet UP 00:a0:85:00:03:00 + │ ethernet UP mac:00:a0:85:00:03:00 └ e2.30 bridge FORWARDING  - e1 ethernet UP 00:a0:85:00:03:01 + e1 ethernet UP mac:00:a0:85:00:03:01 ipv6 fe80::2a0:85ff:fe00:301/64 (link-layer) - e2 ethernet UP 00:a0:85:00:03:02 + e2 ethernet UP mac:00:a0:85:00:03:02 ipv6 fe80::2a0:85ff:fe00:302/64 (link-layer) - e2.30 ethernet UP 00:a0:85:00:03:02 - └ e2 ethernet UP 00:a0:85:00:03:02 - e3.10 ethernet UP 00:a0:85:00:03:03 - └ e3 ethernet UP 00:a0:85:00:03:03 - e4 ethernet UP 00:a0:85:00:03:04 + e2.30 ethernet UP vid:30 + └ e2 ethernet UP mac:00:a0:85:00:03:02 + e3.10 ethernet UP vid:10 + └ e3 ethernet UP mac:00:a0:85:00:03:03 + e4 ethernet UP mac:00:a0:85:00:03:04 ipv6 fe80::2a0:85ff:fe00:304/64 (link-layer) - e5 ethernet UP 00:a0:85:00:03:05 + e5 ethernet UP mac:00:a0:85:00:03:05 ipv6 fe80::2a0:85ff:fe00:305/64 (link-layer) - e6 ethernet UP 00:a0:85:00:03:06 + e6 ethernet UP mac:00:a0:85:00:03:06 ipv6 fe80::2a0:85ff:fe00:306/64 (link-layer) - e7 ethernet UP 00:a0:85:00:03:07 + e7 ethernet UP mac:00:a0:85:00:03:07 ipv6 fe80::2a0:85ff:fe00:307/64 (link-layer) - gre-v4 gre UP  - gre-v6 gre UP  + gre-v4 gre UP remote:192.168.20.2 + gre-v6 gre UP remote:2001:db8::2 ipv4 192.168.50.2/16 (static) - gretap-v4 gretap UP f6:d4:96:d8:9f:96 - gretap-v6 gretap UP 7a:46:13:bd:fa:e6 - veth0a veth UP 6e:d0:98:c4:e7:ef - veth0a.20 ethernet UP 6e:d0:98:c4:e7:ef - └ veth0a ethernet UP 6e:d0:98:c4:e7:ef - veth0b veth UP 36:da:80:06:7f:99 - vxlan-v4 vxlan UP 8a:ea:59:32:df:70 + gretap-v4 gretap UP mac:f6:d4:96:d8:9f:96 remote:192.168.20.2 + gretap-v6 gretap UP mac:7a:46:13:bd:fa:e6 remote:2001:db8::2 + veth0a veth UP mac:6e:d0:98:c4:e7:ef + veth0a.20 ethernet UP vid:20 + └ veth0a ethernet UP mac:6e:d0:98:c4:e7:ef + veth0b veth UP mac:36:da:80:06:7f:99 + vxlan-v4 vxlan UP mac:8a:ea:59:32:df:70 vni:4 ipv4 192.168.30.2/24 (static) - vxlan-v6 vxlan UP 3e:30:c6:a1:71:64 + vxlan-v6 vxlan UP mac:3e:30:c6:a1:71:64 vni:6 ipv4 192.168.40.2/24 (static) From 55de4f6757da10dfe99a47b0077bd7c4a89fbfad Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Sat, 9 May 2026 21:47:33 +0200 Subject: [PATCH 2/2] doc: replace 'show interfaces' with 'show interface' The CLI command was renamed long ago when the plural form was removed from klish (now only `show interface [name]` exists), but docs and the landing page still showed the old plural form. Update all user-facing examples to match. Internal subcommand names (cli_pretty's `-t show-interfaces`, test fixture filenames) and historical ChangeLog entries are intentionally left as-is. Signed-off-by: Joachim Wiberg --- doc/cli/introduction.md | 2 +- doc/dhcp.md | 2 +- doc/iface.md | 2 +- doc/ip.md | 18 +++++++++--------- doc/lag.md | 4 ++-- doc/management.md | 2 +- doc/scripting-prod.md | 12 ++++++------ doc/vpn-wireguard.md | 4 ++-- src/landing/index.html | 2 +- 9 files changed, 24 insertions(+), 24 deletions(-) diff --git a/doc/cli/introduction.md b/doc/cli/introduction.md index 4630c3562..aeb7f0652 100644 --- a/doc/cli/introduction.md +++ b/doc/cli/introduction.md @@ -164,7 +164,7 @@ interfaces { } } admin@host-12-34-56:/config/interface/eth0/> leave -admin@host-12-34-56:/> show interfaces +admin@host-12-34-56:/> show interface INTERFACE PROTOCOL STATE DATA lo loopback UNKNOWN 00:00:00:00:00:00 ipv4 127.0.0.1/8 (static) diff --git a/doc/dhcp.md b/doc/dhcp.md index fae88700d..002b19de4 100644 --- a/doc/dhcp.md +++ b/doc/dhcp.md @@ -109,7 +109,7 @@ When configuring, e.g., `dns-server`, or `router` options with the value `auto`, the system uses the IP address from the interface matching the subnet. For example: -
admin@example:/> show interfaces
+
admin@example:/> show interface
 INTERFACE       PROTOCOL   STATE       DATA                                    
 eth0            ethernet   UP          mac:02:00:00:00:00:00
                 ipv4                   192.168.1.1/24 (static)
diff --git a/doc/iface.md b/doc/iface.md
index 8e2767080..cc226ff79 100644
--- a/doc/iface.md
+++ b/doc/iface.md
@@ -61,7 +61,7 @@ admin@example:/config/interface/eth0/> leave
 The operational status can be inspected to see both administrative and
 actual link state:
 
-
admin@example:/> show interfaces
+
admin@example:/> show interface
 INTERFACE       PROTOCOL   STATE       DATA
 eth0            ethernet   DISABLED    mac:02:00:00:00:00:00
 eth1            ethernet   UP          mac:02:00:00:00:00:01 speed:1G-FDX
diff --git a/doc/ip.md b/doc/ip.md
index f6cd1bef1..70d6b07c7 100644
--- a/doc/ip.md
+++ b/doc/ip.md
@@ -117,7 +117,7 @@ will be ignored. For details on how to enable the NTP client, see the
 
 ![Switch example (eth0 and lo)](img/ip-address-example-switch.svg)
 
-
admin@example:/> show interfaces
+
admin@example:/> show interface
 INTERFACE       PROTOCOL   STATE       DATA                                    
 eth0            ethernet   UP          mac:02:00:00:00:00:00
                 ipv6                   fe80::ff:fe00:0/64 (link-layer)
@@ -153,7 +153,7 @@ admin@example:/config/interface/eth0/ipv4/> diff
 +  }
 +}
 admin@example:/config/interface/eth0/ipv4/> leave
-admin@example:/> show interfaces
+admin@example:/> show interface
 INTERFACE       PROTOCOL   STATE       DATA                                    
 eth0            ethernet   UP          mac:02:00:00:00:00:00
                 ipv4                   169.254.1.3/16 (random)
@@ -188,7 +188,7 @@ admin@example:/config/interface/eth0/ipv4/autoconf/> leave
 admin@example:/config/> edit interface eth0 ipv4
 admin@example:/config/interface/eth0/ipv4/> set dhcp
 admin@example:/config/interface/eth0/ipv4/> leave
-admin@example:/> show interfaces
+admin@example:/> show interface
 INTERFACE       PROTOCOL   STATE       DATA                                    
 eth0            ethernet   UP          mac:02:00:00:00:00:00
                 ipv4                   10.1.2.100/24 (dhcp)
@@ -291,7 +291,7 @@ on the interface.
 admin@example:/config/> edit interface eth0 ipv6
 admin@example:/config/interface/eth0/ipv6/> set enabled false
 admin@example:/config/interface/eth0/ipv6/> leave
-admin@example:/> show interfaces
+admin@example:/> show interface
 INTERFACE       PROTOCOL   STATE       DATA                                    
 eth0            ethernet   UP          mac:02:00:00:00:00:00
 lo              ethernet   UP          mac:00:00:00:00:00:00
@@ -308,7 +308,7 @@ admin@example:/>
 admin@example:/config/> edit interface eth0 ipv6
 admin@example:/config/interface/eth0/ipv6/> set address 2001:db8::1 prefix-length 64
 admin@example:/config/interface/eth0/ipv6/> leave
-admin@example:/> show interfaces
+admin@example:/> show interface
 INTERFACE       PROTOCOL   STATE       DATA                                    
 eth0            ethernet   UP          mac:02:00:00:00:00:00
                 ipv6                   2001:db8::1/64 (static)
@@ -330,7 +330,7 @@ advertised by the router (here 2001:db8:0:1::0/64) and the interface
 identifier.  The resulting address is of type *link-layer*, as it is
 formed based on the interface identifier ([ietf-ip.yang][2]).
 
-
admin@example:/> show interfaces
+
admin@example:/> show interface
 INTERFACE       PROTOCOL   STATE       DATA                                    
 eth0            ethernet   UP          mac:02:00:00:00:00:00
                 ipv6                   2001:db8:0:1:0:ff:fe00:0/64 (link-layer)
@@ -348,7 +348,7 @@ below.
 admin@example:/config/> edit interface eth0 ipv6
 admin@example:/config/interface/eth0/ipv6/> set autoconf create-global-addresses false
 admin@example:/config/interface/eth0/ipv6/> leave
-admin@example:/> show interfaces
+admin@example:/> show interface
 INTERFACE       PROTOCOL   STATE       DATA                                    
 eth0            ethernet   UP          mac:02:00:00:00:00:00
                 ipv6                   fe80::ff:fe00:0/64 (link-layer)
@@ -366,7 +366,7 @@ admin@example:/>
 By default, the auto-configured link-local and global IPv6 addresses
 are formed from a link-identifier based on the MAC address.
 
-
admin@example:/> show interfaces
+
admin@example:/> show interface
 INTERFACE       PROTOCOL   STATE       DATA                                    
 eth0            ethernet   UP          mac:02:00:00:00:00:00
                 ipv6                   2001:db8:0:1:0:ff:fe00:0/64 (link-layer)
@@ -385,7 +385,7 @@ possible to specify use of a random identifier ([ietf-ip.yang][2] and
 admin@example:/config/> edit interface eth0 ipv6
 admin@example:/config/interface/eth0/ipv6/> set autoconf create-temporary-addresses true
 admin@example:/config/interface/eth0/ipv6/> leave
-admin@example:/> show interfaces
+admin@example:/> show interface
 INTERFACE       PROTOCOL   STATE       DATA                                    
 eth0            ethernet   UP          mac:02:00:00:00:00:00
                 ipv6                   2001:db8:0:1:b705:8374:638e:74a8/64 (random)
diff --git a/doc/lag.md b/doc/lag.md
index fe7cf8904..bec9726be 100644
--- a/doc/lag.md
+++ b/doc/lag.md
@@ -87,7 +87,7 @@ Like other interfaces, link aggregates are also available in the general
 interfaces overview in the CLI admin-exec context.  Here is the above
 static mode aggregate:
 
-
admin@example:/> show interfaces
+
admin@example:/> show interface
 INTERFACE       PROTOCOL   STATE       DATA                                    
 lo              ethernet   UP          mac:00:00:00:00:00:00
                 ipv4                   127.0.0.1/8 (static)
@@ -103,7 +103,7 @@ lag0            lag        UP          static: balance-xor, hash: layer2
 
 Same aggregate, but in LACP mode:
 
-
admin@example:/> show interfaces
+
admin@example:/> show interface
 INTERFACE       PROTOCOL   STATE       DATA                                    
 lo              ethernet   UP          mac:00:00:00:00:00:00
                 ipv4                   127.0.0.1/8 (static)
diff --git a/doc/management.md b/doc/management.md
index 032a6e539..b38beb8fb 100644
--- a/doc/management.md
+++ b/doc/management.md
@@ -109,7 +109,7 @@ CLI can be entered from shell in the same way as for SSH.
 
 See the 'help' command for an introduction to the system
 
-admin@example:/> show interfaces
+admin@example:/> show interface
 INTERFACE       PROTOCOL   STATE       DATA                                    
 lo              ethernet   UP          mac:00:00:00:00:00:00
                 ipv4                   127.0.0.1/8 (static)
diff --git a/doc/scripting-prod.md b/doc/scripting-prod.md
index 31705c2be..651779cef 100644
--- a/doc/scripting-prod.md
+++ b/doc/scripting-prod.md
@@ -39,7 +39,7 @@ Starting out, we assume a configuration where all ports are network
 interfaces (possibly with IPv6 enabled).
 
 ```
-admin@example:/> show interfaces
+admin@example:/> show interface
 lo              ethernet   UP          mac:00:00:00:00:00:00
                 ipv4                   127.0.0.1/8 (static)
                 ipv6                   ::1/128 (static)
@@ -80,7 +80,7 @@ admin@example:/config/> set interface e10 bridge-port bridge br0
 admin@example:/config/>
 ```
 
-The interface status can be viewed using `show interfaces` after leaving
+The interface status can be viewed using `show interface` after leaving
 configuration context.  When configuring via SSH, first assign an IP
 address to `br0` *before leaving* configuration context, e.g.
 
@@ -95,7 +95,7 @@ setup, including [setting IP address](#set-ip-address).
 ```
 admin@example:/config/> leave
 admin@example:/>
-admin@example:/> show interfaces
+admin@example:/> show interface
 INTERFACE       PROTOCOL   STATE       DATA
 br0             bridge
 │               ethernet   UP          mac:00:53:00:06:11:01
@@ -154,7 +154,7 @@ admin@example:/>
 Interface status would now should something like the following
 
 ```
-admin@example:/> show interfaces
+admin@example:/> show interface
 INTERFACE       PROTOCOL   STATE       DATA
 br0             bridge
 │               ethernet   UP          mac:00:53:00:06:11:01
@@ -181,7 +181,7 @@ patched according to [above](#vlan-snake).  We should see link up and
 *FORWARDING* on all ports in the bridge.
 
 ```
-admin@example:/> show interfaces
+admin@example:/> show interface
 INTERFACE       PROTOCOL   STATE       DATA
 br0             bridge
 │               ethernet   UP          mac:00:53:00:06:11:01
@@ -284,7 +284,7 @@ admin@example:/>
 Interface *vlan10* with an auto-configured IPv6 address should appear.
 
 ```
-admin@example:/> show interfaces
+admin@example:/> show interface
 INTERFACE       PROTOCOL   STATE       DATA
 br0             bridge                 vlan:10t
 │               ethernet   UP          mac:00:53:00:06:11:01
diff --git a/doc/vpn-wireguard.md b/doc/vpn-wireguard.md
index 10255847e..8db1e4e4a 100644
--- a/doc/vpn-wireguard.md
+++ b/doc/vpn-wireguard.md
@@ -345,12 +345,12 @@ tunnel endpoints use IPv4 or IPv6.
 
 Check WireGuard interface status and peer connections:
 
-
admin@example:/> show interfaces
+
admin@example:/> show interface
 wg0             wireguard  UP          2 peers (1 up)
                 ipv4                   10.0.0.1/24 (static)
                 ipv6                   fd00::1/64 (static)
 
-admin@example:/> show interfaces wg0
+admin@example:/> show interface wg0
 name                : wg0
 type                : wireguard
 index               : 12
diff --git a/src/landing/index.html b/src/landing/index.html
index 2a0a4ec51..447f89295 100644
--- a/src/landing/index.html
+++ b/src/landing/index.html
@@ -106,7 +106,7 @@ 

Welcome to Infix :-)

} } admin@infix-12-34-56:/config/interface/eth0/> leave -admin@infix-12-34-56:/> show interfaces +admin@infix-12-34-56:/> show interface INTERFACE PROTOCOL STATE DATA eth0 ethernet UP 52:54:00:12:34:56 ipv4 192.168.2.200/24 (static)