Skip to content

cli: show interface, layered presentation on IEEE 802.3.2-2025#1495

Open
troglobit wants to merge 6 commits into
mainfrom
speed-duplex
Open

cli: show interface, layered presentation on IEEE 802.3.2-2025#1495
troglobit wants to merge 6 commits into
mainfrom
speed-duplex

Conversation

@troglobit
Copy link
Copy Markdown
Contributor

@troglobit troglobit commented May 10, 2026

Description

Rebuilt bottom-up by protocol layer, sourced from the standard IEEE pmd-type identityref 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:speed is now status obsolete in the IEEE model; speed moves to ietf-interfaces:speed (gauge64 bits/s, RFC 8343).
  • infix-ethernet-interface deviations re-evaluated against the new base (no surface changes beyond import revision pinning)
  • infix-interfaces revision bumped to track the upgrade

Second commit catches up on a long-overdue show interfacesshow interface rename 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"
          ]
        }
      }
  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                      fdc2:e5c2:ef3:4a6c:302e:3fff:fe76:8fc2/64 (link-layer)
                    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)

Checklist

Tick relevant boxes, this PR is-a or has-a:

  • Bugfix
    • Regression tests
    • ChangeLog updates (for next release)
  • Feature
    • YANG model change => revision updated?
    • Regression tests added/updated?
    • ChangeLog updates (for next release)
    • Documentation added?
  • Test changes
    • Checked in changed Readme.adoc (make test-spec)
    • Added new test to group Readme.adoc and yaml file
  • Code style update (formatting, renaming)
  • Refactoring (please detail in commit messages)
  • Build related changes
  • Documentation content changes
    • ChangeLog updated (for major changes)
  • Other (please describe):

@troglobit troglobit linked an issue May 10, 2026 that may be closed by this pull request
@troglobit troglobit requested review from jovatn and rical May 10, 2026 02:59
Copy link
Copy Markdown
Contributor

@jovatn jovatn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread doc/scripting-prod.md Outdated
@troglobit
Copy link
Copy Markdown
Contributor Author

troglobit commented May 18, 2026

CCB review comments:

  • This is quickly becoming unreadable, we want 'show interface' to remain friendly & useful
  • We're mixing data that does not always match the protocol
  • Drop the mac: prefix to mac addresses, the data should be stand-alone, like IP addresses
  • Data should be in protocol layer order: wifi -> ethernet -> ip, gre -> ethernet -> ip, etc.
  • General comment: the wifi Station, ssid: ... should be station ssid: ...
  • We could also indent protocols and add line drawing characters
  • A "speed line" protocol row: 1000-baseTX with DATA duplex: full, i.e., before the 'ethernet' protocol line, a '1000-baseTX' protocol type line, which would be useful for various types of SFP's as well
  • ... more was said, passionate and interesting discussion!

@troglobit troglobit changed the title cli: tag DATA column in 'show interface' summary cli: show interface, layered presentation on IEEE 802.3.2-2025 May 19, 2026
@troglobit troglobit force-pushed the speed-duplex branch 2 times, most recently from b27b5cf to bbf1a81 Compare May 19, 2026 04:04
@troglobit troglobit requested review from jovatn and wkz May 19, 2026 04:05
@troglobit troglobit linked an issue May 19, 2026 that may be closed by this pull request
troglobit added 3 commits May 19, 2026 09:01
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>
troglobit added 2 commits May 19, 2026 10:20
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add documentation on how to configure VLAN interfaces cli: list speed/duplex of Ethernet ports in show interface

2 participants