cli: show interface, layered presentation on IEEE 802.3.2-2025#1495
Open
troglobit wants to merge 6 commits into
Open
cli: show interface, layered presentation on IEEE 802.3.2-2025#1495troglobit wants to merge 6 commits into
show interface, layered presentation on IEEE 802.3.2-2025#1495troglobit wants to merge 6 commits into
Conversation
jovatn
approved these changes
May 13, 2026
Contributor
jovatn
left a comment
There was a problem hiding this comment.
I have reviewed documentation part (i.e., all by the cli_pretty.py code).
Providing additional info in the overview command is very useful!
In short: LGTM!
Some general comments:
- Using colon as separator may cause some confusion in mac address lines, but users will get used to it (and I have no improvement to suggest).
- (key:value format is not applied to IPv4 and IPv6 addresses, but the choice is wise.)
Specific comment on VLAN example (scripting-prod.md) interleaved below.
Contributor
Author
|
CCB review comments:
|
show interface, layered presentation on IEEE 802.3.2-2025
b27b5cf to
bbf1a81
Compare
Import ieee802-ethernet-interface@2025-09-10.yang, from IEEE 802.3.2-2025,
and companion ieee802-ethernet-phy-type.yang, replacing the 2019 revision.
Operational interface speed moves to ietf-interfaces:speed, RFC 8343,
eth:speed is now obsolete. Bump infix-interfaces.yang revision to track
the upgrade.
The CLI 'show interface' command renders interfaces as bottom-up layered
protocol rows. Ethernet interfaces a new IEEE link-mode row (1000baseT,
10GbaseLR, ...) is added with 'duplex: full|half' in the DATA column.
Without link the ethernet row is the first row. Tunnels and wifi follow
the same layering: gre/vxlan rows carry remote:/vni: tokens with optional
ethernet sub-row for the L2-bearing variants; wifi rows carry 'station' or
'access-point' ssid:, signal:, stations: tokens.
admin@bpi-76-8f-c2:/> show interface
⚑ INTERFACE PROTOCOL STATE DATA
⇅ lo loopback UP
ipv4 127.0.0.1/8 (static)
ipv6 ::1/128 (static)
⇅ br0 bridge DOWN
│ ethernet 32:2e:3f:76:8f:c2
│ ipv4 192.168.0.1/24 (static)
⇅ ├ lan0 bridge LOWER-DOWN
⇅ ├ lan1 bridge LOWER-DOWN
⇅ ├ lan2 bridge LOWER-DOWN
⇅ └ lan3 bridge LOWER-DOWN
⇅ gre0 gre UP remote: 198.51.100.7
ipv4 10.255.0.1/30 (static)
⇅ sfp1 ethernet DOWN ca:59:f0:77:80:5b
⇅ wan 1000baseT UP duplex: full
ethernet 32:2e:3f:76:8f:c2
ipv4 192.168.0.235/24 (dhcp)
ipv6 fe80::302e:3fff:fe76:8fc2/64 (link-layer)
⇅ wan.10 vlan UP vid: 10
│ ipv4 10.0.10.1/24 (static)
└ wan
⇅ wan.10.20 vlan UP vid: 20
│ ipv4 10.0.10.20/28 (static)
└ wan.10
⇅ wifi0 wifi UP station ssid: corp-net signal: good
ethernet dc:a6:32:00:11:22
ipv4 192.168.7.42/24 (dhcp)
The detailed interface view gains a 'link mode' row carrying the same
label.
yanger populates phy-type and pmd-type from a static ETHTOOL link-mode
identity table keyed on (port, speed, duplex). Both leaves are populated
for unambiguous media (copper, DAC, copper-T); for generic fiber where
the (port, speed, duplex) tuple can map to multiple PMDs (SR vs LR vs
ER, etc.) only the phy-type family identity is emitted — guessing the
PMD would be misleading. Future SFP EEPROM reads (ethtool -m) could
refine pmd-type at runtime. cli_pretty prefers pmd-type (specific) and
falls back to phy-type (family) for display.
yanger also emits ietf-interfaces:speed and fixes a long-standing
'auto-negotation' typo (yanger had never matched ethtool's correctly-
spelled JSON field, so operational auto-negotiation always read
'unknown').
No config migration needed: the only config-true leaf in the ethernet
container, auto-negotiation/enable, is unchanged across the model upgrade.
Closes #530
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Update CLI samples across the documentation to the new layered presentation: physical-medium row when linked (1000baseT/...), bare MACs, and key: value DATA tokens. Add a short prose block in ethernet.md and iface.md explaining the layering. Drop the historical 'show interfaces' (plural) form — removed from klish years ago — from all user-facing examples and the landing page. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Fix #1506: restore the VLAN interface documentation that was lost when networking.md was split into per-topic pages. Content adapted from the v25.11.0 networking.md VLAN section, plus a new "Stacked (Q-in-Q)" section showing `eth0.10.20`-style nesting and the layered `show interface` rendering of the parent chain. Update the interface-type table in networking.md to point at the new vlan.md instead of the dangling ethernet.md#vlan-interfaces anchor. ChangeLog: document the user-facing changes on this branch (YANG model upgrade, layered show interface output, auto-negotation typo fix) and the new VLAN documentation. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
The Ethernet packet/RMON counters at the bottom of 'show interface <name>' were appended with a wider label column than the operational data above them, breaking visual alignment. Group them under an "Ethernet Statistics" section heading (Decore.title), same convention as 'Available Networks' in the wifi scan view. Narrow the operational-data label column from 20 to 19 chars so the title bar exactly matches the heading text — a tighter and more deliberately aligned look. All labels in pr_iface fit within 19 chars except 'lacp system priority' (20); rename it to 'lacp sys priority' for consistency with the other 'lacp ...' labels (lacp aggregate id, lacp partner mac, ...) so the new field width works universally. Refresh CLI snapshots and doc samples to match. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
cli-pretty prints a friendly message on stdout before any sys.exit(1) — 'Interface "w" not found', 'Error, top level "ietf-routing:routing" missing', etc. The wrapper used subprocess.run(..., check=True) and on non-zero exit caught CalledProcessError, throwing away the captured stdout and printing the generic exception message instead. Drop the check=True / try-except dance, always relay stdout, and only fall back to the generic 'Error running cli-pretty' line when the subprocess crashed without producing any output. Before: admin@bpi:/> show interface w Error running cli-pretty: Command '['/usr/libexec/statd/cli-pretty', 'show-interfaces', '-n', 'w']' returned non-zero exit status 1. After: admin@bpi:/> show interface w Interface "w" not found Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Extend the existing 'show <running|startup|factory>-config' family with an optional 'path /XPATH' argument that maps straight to the underlying 'copy -x' flag, and add 'show operational [path /XPATH]' for symmetry with the configuration datastores. admin@example:/> show running-config path /ietf-interfaces:interfaces admin@example:/> show operational path /ietf-system:system-state Also, improve error feedback from the copy command slightly. Before: admin@example:~$ copy running -x /foo Error: (null) (5) Error: failed retrieving running-config data After: admin@example:~$ copy running -x /foo Error: Couldn't parse path "/foo": Prefix "foo" not defined. (5) Error: failed retrieving running-config data Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Rebuilt bottom-up by protocol layer, sourced from the standard IEEE
pmd-typeidentityref in ieee802-ethernet-interface@2025-09-10.yang and ieee802-ethernet-phy-type@2025-09-10.yang from IEEE 802.3.2-2025:pmd-type(identityref) is the discriminator we render — names map cleanly to ethtool's link mode strings (100baseTX, 1000baseT, 2.5GbaseT, 10GbaseLR,25GbaseCR, etc.).
eth:speedis now status obsolete in the IEEE model; speed moves toietf-interfaces:speed(gauge64 bits/s, RFC 8343).infix-ethernet-interfacedeviations re-evaluated against the new base (no surface changes beyond import revision pinning)infix-interfacesrevision bumped to track the upgradeSecond commit catches up on a long-overdue
show interfaces→show interfacerename in docs and the landing page (the plural form was removed from klish years ago; user-facing examples were missed).Example
Operational raw data, new YANG format
{ "name": "wan", "type": "infix-if-type:ethernet", "admin-status": "up", "oper-status": "up", "if-index": 3, "phys-address": "72:1c:0b:97:a4:9b", "speed": "1000000000", "statistics": { "in-octets": "3999404", "out-octets": "450585" }, "ieee802-ethernet-interface:ethernet": { "auto-negotiation": { "enable": true }, "pmd-type": "ieee802-ethernet-phy-type:pmd-type-1000BASE-T", "duplex": "full" }, "ietf-ip:ipv4": { "mtu": 1500, "address": [ { "ip": "192.168.0.240", "prefix-length": 24, "origin": "dhcp" } ], "neighbor": [ { "ip": "192.168.0.1", "link-layer-address": "06:5b:a4:43:14:e9", "origin": "dynamic" } ] }, "ietf-ip:ipv6": { "mtu": 1500, "address": [ { "ip": "fdc2:e5c2:ef3:4a6c:701c:bff:fe97:a49b", "prefix-length": 64, "origin": "link-layer" }, { "ip": "fe80::701c:bff:fe97:a49b", "prefix-length": 64, "origin": "link-layer" } ], "neighbor": [ { "ip": "fe80::1407:4e04:f3f6:9cc8", "link-layer-address": "1c:b3:c9:0e:ea:95", "origin": "dynamic", "state": "stale" }, { "ip": "fe80::1c0d:61d5:bdd1:bdca", "link-layer-address": "1c:b3:c9:0e:ea:95", "origin": "dynamic", "state": "stale" } ] }, "infix-interfaces:ptp-capabilities": { "capabilities": [ "software-receive", "software-system-clock" ] } }Checklist
Tick relevant boxes, this PR is-a or has-a: