interfaces: a view word after a real port is answered as the view, not as a missing port (#1834) #1837

Merged
jaylouisw merged 1 commit from fix/1117-1135 into main 2026-11-17 11:57:57 +00:00
Owner

Fixes #1834.

show interfaces [<port>] switchport / counters are the port-first spellings of the IOS views #1443/#1449 made honest for the keyword form. The port lookup consumed the whole line as a name, so

s1# show interfaces Fa0/1 counters
% No interface Fa0/1 counters on Switch (L2)-s1

claimed a socket called "Fa0/1 counters" was missing.

  • new viewAfterPort() resolves the prefix through the same table interface Fa0/1 uses, and reads a tail as a view only when it is a word from INTERFACES_VIEW_KEYWORDS (or ?/help);
  • the whole phrase is still looked up as a port first, so a port genuinely called counters keeps its port; multi-word names (Port 1) resolve;
  • an absent port (Fa0/99 counters) and an unknown tail (Fa0/1 nonsense) keep the missing-port sentence;
  • show interfaces Fa0/1 ? is now a usage line instead of % No interface Fa0/1 ?;
  • the advice reuses the table's sentence with the port substituted, and where it names no port (status, summary, flowcontrol, brief) it ends on show interfaces <port>.
s1# show interfaces Fa0/1 counters
% `show interfaces Fa0/1 counters` is a view of Fa0/1, not a port name: this console has no `show interfaces Fa0/1 counters`. `show interfaces Fa0/1` prints that port's packet and byte counters; `show interfaces` prints them for every port.

QA: node scripts/syntax-check.js 384 files OK; node scripts/check-doc-citations.js exit 0; node scripts/check-control-bytes.js clean; full npm test 312 suites / 10,931 assertions / 0 failed (baseline main was 312 / 10,905 / 0). test/show-interfaces-view-keywords.test.js is 97 checks.

Fixes #1834. `show interfaces [<port>] switchport` / `counters` are the port-first spellings of the IOS views #1443/#1449 made honest for the keyword form. The port lookup consumed the whole line as a name, so ``` s1# show interfaces Fa0/1 counters % No interface Fa0/1 counters on Switch (L2)-s1 ``` claimed a socket called "Fa0/1 counters" was missing. - new `viewAfterPort()` resolves the prefix through the same table `interface Fa0/1` uses, and reads a tail as a view only when it is a word from `INTERFACES_VIEW_KEYWORDS` (or `?`/`help`); - the whole phrase is still looked up as a port first, so a port genuinely called `counters` keeps its port; multi-word names (`Port 1`) resolve; - an absent port (`Fa0/99 counters`) and an unknown tail (`Fa0/1 nonsense`) keep the missing-port sentence; - `show interfaces Fa0/1 ?` is now a usage line instead of `% No interface Fa0/1 ?`; - the advice reuses the table's sentence with the port substituted, and where it names no port (`status`, `summary`, `flowcontrol`, `brief`) it ends on `show interfaces <port>`. ``` s1# show interfaces Fa0/1 counters % `show interfaces Fa0/1 counters` is a view of Fa0/1, not a port name: this console has no `show interfaces Fa0/1 counters`. `show interfaces Fa0/1` prints that port's packet and byte counters; `show interfaces` prints them for every port. ``` QA: `node scripts/syntax-check.js` 384 files OK; `node scripts/check-doc-citations.js` exit 0; `node scripts/check-control-bytes.js` clean; full `npm test` 312 suites / 10,931 assertions / 0 failed (baseline main was 312 / 10,905 / 0). `test/show-interfaces-view-keywords.test.js` is 97 checks.
interfaces: a view word after a real port is answered as the view, not as a missing port (#1834)
All checks were successful
CI / Classify the change (pull_request) Successful in 8s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 14s
CI / Server smoke test (pull_request) Successful in 9s
CI / Docker build (pull_request) Successful in 23s
CI / Test (Node 20) (pull_request) Successful in 56s
CI / Test (Node 22) (pull_request) Successful in 58s
CI / Test (Node 18) (pull_request) Successful in 1m4s
CI / Arm auto-merge (pull_request) Successful in 11s
452e38e6d8
`show interfaces Fa0/1 counters` is `show interfaces counters` with the port named, and it
answered `% No interface Fa0/1 counters on <box>` - the sentence a misspelt port name gets,
about a socket that is right there. #1443/#1449 fixed the keyword-first half of the door and
left the port-first half claiming a port was missing.

The prefix is resolved by the same table `interface Fa0/1` uses, and only a tail the view
table knows (or the `?` key) is read as a view, so `show interfaces Fa0/99 counters` and
`show interfaces Fa0/1 nonsense` keep the missing-port sentence. The whole phrase is still
looked up as a port first, so a device with a port called `counters` keeps it. Where the
table's advice names no port (four entries do not), the answer ends on the port's own block.

test/show-interfaces-view-keywords.test.js grows 26 checks (97 in the file).
jaylouisw force-pushed fix/1117-1135 from 452e38e6d8
All checks were successful
CI / Classify the change (pull_request) Successful in 8s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 14s
CI / Server smoke test (pull_request) Successful in 9s
CI / Docker build (pull_request) Successful in 23s
CI / Test (Node 20) (pull_request) Successful in 56s
CI / Test (Node 22) (pull_request) Successful in 58s
CI / Test (Node 18) (pull_request) Successful in 1m4s
CI / Arm auto-merge (pull_request) Successful in 11s
to 7e85d74026
All checks were successful
CI / Classify the change (pull_request) Successful in 12s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 7s
CI / Server smoke test (pull_request) Successful in 6s
CI / Docker build (pull_request) Successful in 28s
CI / Test (Node 20) (pull_request) Successful in 58s
CI / Test (Node 18) (pull_request) Successful in 1m5s
CI / Test (Node 22) (pull_request) Successful in 1m0s
CI / Arm auto-merge (pull_request) Successful in 16s
2026-11-17 11:55:45 +00:00
Compare
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jaylouisw/packetforge!1837
No description provided.