A port name is the whole rest of the line (#1401) #1402

Merged
jaylouisw merged 1 commit from fix/port-name-arguments into main 2026-11-11 00:08:52 +00:00
Owner

A port name is the whole rest of the line. Fixes #1401.

Found by asking two reports of the same box whether they agree about how many ports it has, over the whole
catalogue. They do — but three commands could not be asked about one port by the name printed in front of the
operator
.

interface Port 1 has read the name as the rest of the line since #1230, and its own comment says why: Ubiquiti
calls its ports Port 1 and its cages SFP+ 1, so reading only the first word looked up a port called Port. That
fix reached the configuration door. The reporting doors were left behind — on the 17 models whose ports are named
this way:

sw1#show interfaces Port 1                   % No interface Port on EdgeSwitch 24 PoE (250W)
sw1#show power inline Port 1                 % No interface Port on EdgeSwitch 24 PoE (250W)
sw1#show mac address-table interface Port 1  every entry on the switch

The first two refuse a port that is right there and name one that does not exist. The third accepts a filter and
drops it, which reads as "this port has all of them".

What changed

  • show interfaces <name> / show interface <name> take the whole rest of the line as the name, the same rule
    interface <name> uses. A name that matches nothing is refused with the whole name typed — % No interface Port 99 on … — never truncated to its first word.
  • show power inline <name> takes it the same way.
  • show mac address-table interface <name> applies the filter (int abbreviates it), and a filter that matches
    nothing says so about that port — (no entry learned on Port 9) — instead of printing an empty table, which reads
    as a claim about the whole box. Any other trailing words are refused rather than ignored: an argument that is
    accepted and not applied is the same defect as a config command that is accepted and inert.

Evidence

test/port-name-arguments.test.js — 26 checks: a spaced name resolves through show interfaces, show interface and a cage name like SFP 1; an unknown name is refused by the whole name; what interface Port 3
configured is what show interfaces Port 3 reads back; show power inline Port 1 answers about Port 1; the MAC
filter holds one port and not the other; the abbreviation works; an empty filter result says so; a filter the command
does not implement is refused; a missing name is asked for; an unknown port is refused by name. Plus the sweep that
found this — every model, the first three ports it lists, each namable and each answer about exactly that port
(6,114 checks inside the suite). A single-word name such as Gi0/0/0 is unchanged.

Reverting engine/cli.js fails 21 of the 26.

docs/CLI.md: the naming rule, the MAC filter, and the show mac address-table example brought up to date — it
still showed the pre-ageing header and claimed entries are never aged.

Suite: 203 suites, 7,777 assertions, 0 failed. Syntax: 271 files, OK.

A port name is the whole rest of the line. Fixes #1401. Found by asking two reports of the same box whether they agree about how many ports it has, over the whole catalogue. They do — but three commands could not be asked about one port *by the name printed in front of the operator*. `interface Port 1` has read the name as the rest of the line since #1230, and its own comment says why: Ubiquiti calls its ports `Port 1` and its cages `SFP+ 1`, so reading only the first word looked up a port called `Port`. That fix reached the configuration door. The reporting doors were left behind — on the 17 models whose ports are named this way: ``` sw1#show interfaces Port 1 % No interface Port on EdgeSwitch 24 PoE (250W) sw1#show power inline Port 1 % No interface Port on EdgeSwitch 24 PoE (250W) sw1#show mac address-table interface Port 1 every entry on the switch ``` The first two refuse a port that is right there and name one that does not exist. The third accepts a filter and drops it, which reads as "this port has all of them". ## What changed * **`show interfaces <name>` / `show interface <name>`** take the whole rest of the line as the name, the same rule `interface <name>` uses. A name that matches nothing is refused with the whole name typed — `% No interface Port 99 on …` — never truncated to its first word. * **`show power inline <name>`** takes it the same way. * **`show mac address-table interface <name>`** applies the filter (`int` abbreviates it), and a filter that matches nothing says so about that port — `(no entry learned on Port 9)` — instead of printing an empty table, which reads as a claim about the whole box. Any other trailing words are refused rather than ignored: an argument that is accepted and not applied is the same defect as a config command that is accepted and inert. ## Evidence `test/port-name-arguments.test.js` — **26 checks**: a spaced name resolves through `show interfaces`, `show interface` and a cage name like `SFP 1`; an unknown name is refused by the whole name; what `interface Port 3` configured is what `show interfaces Port 3` reads back; `show power inline Port 1` answers about `Port 1`; the MAC filter holds one port and not the other; the abbreviation works; an empty filter result says so; a filter the command does not implement is refused; a missing name is asked for; an unknown port is refused by name. Plus the sweep that found this — every model, the first three ports it lists, each namable and each answer about exactly that port (6,114 checks inside the suite). A single-word name such as `Gi0/0/0` is unchanged. Reverting `engine/cli.js` fails **21 of the 26**. `docs/CLI.md`: the naming rule, the MAC filter, and the `show mac address-table` example brought up to date — it still showed the pre-ageing header and claimed entries are never aged. Suite: **203 suites, 7,777 assertions, 0 failed**. Syntax: 271 files, OK.
A port name is the whole rest of the line (#1401)
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 15s
CI / Test (Node 20) (pull_request) Successful in 2m37s
CI / Test (Node 18) (pull_request) Successful in 2m49s
CI / Server smoke test (pull_request) Successful in 29s
CI / Docker build (pull_request) Successful in 41s
CI / Test (Node 22) (pull_request) Successful in 2m22s
a0e16a9eeb
Found by asking two reports of the same box whether they agree about how many ports it has, over the whole
catalogue: they do, but three commands could not be asked about one port by the name printed in front of the
operator. `interface Port 1` has read the name as the rest of the line since #1230 - its own comment says why:
Ubiquiti calls its ports "Port 1" and its cages "SFP+ 1", so reading only the first word looked up a port called
"Port". That fix reached the configuration door. The reporting doors were left behind: 17 models of the catalogue
name their ports with a space, and on every one of them

    sw1#show interfaces Port 1        -> % No interface Port on EdgeSwitch 24 PoE (250W)
    sw1#show power inline Port 1      -> % No interface Port on EdgeSwitch 24 PoE (250W)

refused a port that is right there, and named one that does not exist. And a third command accepted a filter and
dropped it:

    sw1#show mac address-table interface Port 1    -> every entry on the switch

which reads as "this port has all of them".

Fixed:

* `show interfaces <name>` / `show interface <name>` take the whole rest of the line as the name, the same rule
  `interface <name>` uses. A name that matches nothing is refused with the whole name typed - `% No interface
  Port 99 on ...` - never truncated to its first word.
* `show power inline <name>` takes it the same way.
* `show mac address-table interface <name>` applies the filter, `int` abbreviates it, and a filter that matches
  nothing says so about that port (`(no entry learned on Port 9)`) instead of printing an empty table, which reads
  as a claim about the whole box. Any other trailing words are refused rather than ignored: an argument that is
  accepted and not applied is the same defect as a config command that is accepted and inert.

Evidence: test/port-name-arguments.test.js, 26 checks - a spaced name resolves through `show interfaces`, `show
interface` and a cage name like "SFP 1"; an unknown name is refused by the whole name; what `interface Port 3`
configured is what `show interfaces Port 3` reads back; `show power inline Port 1` answers about Port 1; the MAC
filter holds one port and not the other, the abbreviation works, an empty filter result says so, a filter the
command does not implement is refused, a missing name is asked for, an unknown port is refused by name; and the
sweep that found this - every model, the first three ports it lists, each namable and each answer about exactly
that port (6,114 checks inside the suite). A single-word name such as `Gi0/0/0` is unchanged.

Reverting engine/cli.js fails 21 of the 26.

docs/CLI.md: the naming rule, the MAC filter, and the `show mac address-table` example brought up to date (it still
showed the pre-ageing header and claimed entries are never aged).

Suite: 203 suites, 7,777 assertions, 0 failed. Syntax: 271 files, OK.
jaylouisw scheduled this pull request to auto merge when all checks succeed 2026-11-11 00:08:48 +00:00
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!1402
No description provided.