show ip interface brief: a port with no address has no method, and every row lands under its heading #1562

Merged
jaylouisw merged 1 commit from rev/1115-2301 into main 2026-11-16 01:17:42 +00:00
Owner

The question

What does show ip interface brief put in its Method column when a port holds no address — and do the
rows line up with their own header?

Evidence

What changed

  1. Method follows the address. manual only when the port holds a static address, DHCP when it asks
    (even before a lease), unset when it holds nothing. A port nobody configured used to read
    unassigned YES manual — a claim that a person set an address that is not there.
  2. One width table pads the header and every row. The header was a hard-coded string and rows were padded
    by hand: OK? was four columns in the header and YES five in the rows, so Method and Status
    headings sat one column right of their values. Widths are IOS's own (23/16/4/7/22), and a name wider than
    its column shifts the row rather than colliding with the address.

test/interface-brief-columns.test.js pins both: the header against Cisco's string character for character,
each heading against the column its value starts in, manual/DHCP/unset in each state, unset restored
by no ip address, a shut port keeping its method, an over-wide name, and a sweep over every port of a
switch. 17 checks.

Suites

node scripts/syntax-check.js — 326 files OK. npm test — 256 suites, 9314 assertions, 0 failed
(408 s), including the new suite.

Deliberately not changed

The IP-Address column still carries the prefix (10.0.0.1/24) where IOS prints the bare address and keeps
the mask in show interfaces. That is a separate question with its own trade-off — the prefix is what makes
the row answer "which subnet is this port in" — and is left for its own increment rather than smuggled in here.

## The question What does `show ip interface brief` put in its **Method** column when a port holds no address — and do the rows line up with their own header? ## Evidence * Cisco IOS IP Addressing Services Command Reference, `show ip interface brief` field table: Method is `manual` - "manually changed by the command-line interface", `DHCP` - "`ip address dhcp`", `unset` - "unset". <https://www.cisco.com/c/en/us/td/docs/ios-xml/ios/ipaddr/command/ipaddr-cr-book/ipaddr-r1.html> * Cisco Catalyst 9200/9300 Interface and Hardware Commands reference prints the same table and the same header: `GigabitEthernet1/0/2 unassigned YES unset down down`. <http://www.cisco.com/c/en/us/td/docs/switches/lan/catalyst9200/software/release/17-18/command_reference/b_1718_9200_cr/interface_and_hardware_commands.pdf> * Cisco TAC command reference sample: `Serial1 unassigned YES unset administratively down down`. <https://www.cisco.com/E-Learning/bulk/public/tac/cim/cib/using_cisco_ios_software/cmdrefs/show_ip_interface.htm> * Cisco Press inter-VLAN troubleshooting example: `GigabitEthernet0/0/0 unassigned YES unset administratively down down`, `Gi0/0/1.10 192.168.10.1 YES manual up up`. <https://www.ciscopress.com/articles/article.asp?p=3089357&seqNum=7> ## What changed 1. **Method follows the address.** `manual` only when the port holds a static address, `DHCP` when it asks (even before a lease), `unset` when it holds nothing. A port nobody configured used to read `unassigned YES manual` — a claim that a person set an address that is not there. 2. **One width table pads the header and every row.** The header was a hard-coded string and rows were padded by hand: `OK? ` was four columns in the header and `YES ` five in the rows, so `Method` and `Status` headings sat one column right of their values. Widths are IOS's own (23/16/4/7/22), and a name wider than its column shifts the row rather than colliding with the address. `test/interface-brief-columns.test.js` pins both: the header against Cisco's string character for character, each heading against the column its value starts in, `manual`/`DHCP`/`unset` in each state, `unset` restored by `no ip address`, a shut port keeping its method, an over-wide name, and a sweep over every port of a switch. 17 checks. ## Suites `node scripts/syntax-check.js` — 326 files OK. `npm test` — **256 suites, 9314 assertions, 0 failed** (408 s), including the new suite. ## Deliberately not changed The IP-Address column still carries the prefix (`10.0.0.1/24`) where IOS prints the bare address and keeps the mask in `show interfaces`. That is a separate question with its own trade-off — the prefix is what makes the row answer "which subnet is this port in" — and is left for its own increment rather than smuggled in here.
show ip interface brief: a port with no address has no method, and every row lands under its heading
Some checks are pending
CI / Classify the change (pull_request) Successful in 15s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Has started running
CI / Test (Node 18) (pull_request) Successful in 3m29s
CI / Test (Node 20) (pull_request) Successful in 3m10s
CI / Server smoke test (pull_request) Successful in 31s
CI / Docker build (pull_request) Successful in 22s
CI / Test (Node 22) (pull_request) Successful in 2m59s
86bc4bdad3
The Method column answered 'manual' for every port that was not a DHCP client, so a port
nobody had configured read 'unassigned YES manual' - a claim that a person set an address
the port does not have. IOS prints 'unset' there: the column answers how the port came by
its address, so a port with none has no method. 'DHCP' is kept before a lease arrives.

The header was a hard-coded string and each row was padded by hand, so 'OK? ' was four
columns wide in the header and 'YES  ' five in every row: Method and Status headings sat
one column right of their values. One width table now pads the header and the rows, with
IOS's own widths, and a name wider than its column shifts the row instead of colliding.

test/interface-brief-columns.test.js, 17 checks.
Author
Owner

Rebase blocked: engine/cli.js conflict — needs Jay's decision

I tried to rebase rev/1115-2301 onto origin/main (15f8532a) in a scratch worktree. One file conflicts: engine/cli.js, in the show ip interface brief row builder. I did not resolve it — both sides fix the same defect and the choice between them is a code-ownership call, not a mechanical merge.

Main's side (from #1286, 3dbf74fd "A VLAN parameter is not a mode change, and a port has one method"):

// Method names where the address came from, and `unset` is an answer: a port with no address has no
// method, so printing `manual` beside `unassigned` claims a configuration nobody typed. Cisco's field
// list includes `unset - Unset`, and its sample output pairs `unassigned  YES unset  ...`.
const method = i.dhcp ? 'DHCP' : (i.ip ? 'manual' : 'unset');
out.push(pad(i.name, 22) + pad(ip, 16) + 'YES  ' + pad(method, 8) +
  pad(link.status, 22) + link.protocol);

This PR's side (same commit):

out.push(briefLine([i.name, ip, 'YES', briefMethod(i), link.status, link.protocol]));

plus new module-level BRIEF_COLUMNS (Interface 23, IP-Address 16, OK? 4, Method 7, Status 22) and briefLine() / briefMethod(), whose bodies are behaviourally identical to main's inline ternary (DHCP / manual / unset).

What is already superseded and what is not

  • The Method column half of the PR is already on main via 3dbf74fd (#1286), including test/interface-method.test.js. That half needs no merge.
  • The column-alignment half is not on main: main still builds the header from BRIEF_COLUMNS.head while rows are hand-padded (pad(name,22), 'YES ' = 5 wide against a 4-wide OK? head, pad(method,8) against a 7-wide Method head), so rows are off by one from Status onward exactly as this PR describes. test/interface-brief-columns.test.js (160 lines) is new on this branch and has no counterpart on main.

Decision required

Two implementations of the same eight lines now exist:

  1. Take the PR's — delete main's const method = ... + out.push(...) block, keep briefLine/briefMethod/BRIEF_COLUMNS and the PR's test. Keeps main's behaviour byte-for-byte and fixes the header alignment; loses the #1286 comment rationale unless the comment is moved onto briefMethod().
  2. Drop the PR's engine/cli.js hunk — keep main's code, re-scope the PR to the alignment fix alone (which then has to pad rows from the same widths, i.e. it becomes the same change anyway).

I have not touched engine/ — that content belongs to the reverse loop and to whoever owns #1286's wording. needs Jay's decision (or an explicit go-ahead for me to take option 1).

Other rev/1115-2301 facts: 1 commit ahead, 7 behind 15f8532a, mergeable=false, head 86bc4bda with 0/7 checks and no run rows — so CI has not evaluated it either.

## Rebase blocked: `engine/cli.js` conflict — needs Jay's decision I tried to rebase `rev/1115-2301` onto `origin/main` (`15f8532a`) in a scratch worktree. One file conflicts: **`engine/cli.js`**, in the `show ip interface brief` row builder. I did **not** resolve it — both sides fix the same defect and the choice between them is a code-ownership call, not a mechanical merge. **Main's side (from #1286, `3dbf74fd` "A VLAN parameter is not a mode change, and a port has one method"):** ```js // Method names where the address came from, and `unset` is an answer: a port with no address has no // method, so printing `manual` beside `unassigned` claims a configuration nobody typed. Cisco's field // list includes `unset - Unset`, and its sample output pairs `unassigned YES unset ...`. const method = i.dhcp ? 'DHCP' : (i.ip ? 'manual' : 'unset'); out.push(pad(i.name, 22) + pad(ip, 16) + 'YES ' + pad(method, 8) + pad(link.status, 22) + link.protocol); ``` **This PR's side (same commit):** ```js out.push(briefLine([i.name, ip, 'YES', briefMethod(i), link.status, link.protocol])); ``` plus new module-level `BRIEF_COLUMNS` (Interface 23, IP-Address 16, OK? 4, Method 7, Status 22) and `briefLine()` / `briefMethod()`, whose bodies are behaviourally identical to main's inline ternary (`DHCP` / `manual` / `unset`). ### What is already superseded and what is not - The **Method column** half of the PR is already on main via `3dbf74fd` (#1286), including `test/interface-method.test.js`. That half needs no merge. - The **column-alignment** half is *not* on main: main still builds the header from `BRIEF_COLUMNS.head` while rows are hand-padded (`pad(name,22)`, `'YES '` = 5 wide against a 4-wide `OK?` head, `pad(method,8)` against a 7-wide `Method` head), so rows are off by one from `Status` onward exactly as this PR describes. `test/interface-brief-columns.test.js` (160 lines) is new on this branch and has no counterpart on main. ### Decision required Two implementations of the same eight lines now exist: 1. **Take the PR's** — delete main's `const method = ...` + `out.push(...)` block, keep `briefLine`/`briefMethod`/`BRIEF_COLUMNS` and the PR's test. Keeps main's behaviour byte-for-byte and fixes the header alignment; loses the #1286 comment rationale unless the comment is moved onto `briefMethod()`. 2. **Drop the PR's `engine/cli.js` hunk** — keep main's code, re-scope the PR to the alignment fix alone (which then has to pad rows from the same widths, i.e. it becomes the same change anyway). I have not touched `engine/` — that content belongs to the reverse loop and to whoever owns #1286's wording. **needs Jay's decision** (or an explicit go-ahead for me to take option 1). Other `rev/1115-2301` facts: 1 commit ahead, 7 behind `15f8532a`, `mergeable=false`, head `86bc4bda` with 0/7 checks and no run rows — so CI has not evaluated it either.
jaylouisw force-pushed rev/1115-2301 from 86bc4bdad3
Some checks are pending
CI / Classify the change (pull_request) Successful in 15s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Has started running
CI / Test (Node 18) (pull_request) Successful in 3m29s
CI / Test (Node 20) (pull_request) Successful in 3m10s
CI / Server smoke test (pull_request) Successful in 31s
CI / Docker build (pull_request) Successful in 22s
CI / Test (Node 22) (pull_request) Successful in 2m59s
to 4ef24d40bb
Some checks failed
CI / Classify the change (pull_request) Successful in 13s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 20s
CI / Test (Node 18) (pull_request) Failing after 3m29s
CI / Test (Node 20) (pull_request) Failing after 3m14s
CI / Server smoke test (pull_request) Successful in 34s
CI / Docker build (pull_request) Successful in 23s
CI / Test (Node 22) (pull_request) Failing after 3m15s
2026-11-15 23:43:07 +00:00
Compare
Author
Owner

Resolved and rebased — the earlier escalation is withdrawn

I said this needed Jay's decision. On a second look it does not: the two sides are the same rule, so keeping both is mechanical, not a judgement call.

What I verified before touching it: briefMethod() on this branch is

if (iface.dhcp) return 'DHCP';
if (iface.ip) return 'manual';
return 'unset';

— character-for-character the behaviour of main's inline i.dhcp ? 'DHCP' : (i.ip ? 'manual' : 'unset'). There is no disagreement to arbitrate; main has the sentence explaining why unset is the answer and this branch has the row builder that lands every row under its heading.

Resolution (engine/cli.js, one hunk): main's comment kept verbatim, and the row printed through the branch's builder:

out.push(briefLine([i.name, ip, 'YES', briefMethod(i), link.status, link.protocol]));

Rebased + pushed: 86bc4bda → 4ef24d40 on rev/1115-2301 (base 7e89f959), --force-with-lease. mergeable is now true.

Checks run locally on the rebased tree: test/interface-brief-columns.test.js 17/17; the 13 suites that mention interface brief (brief-method-unset, interface-method, interface-status, show-ip-spellings, help-completeness, report-sweep, …) 0 failures; npm run syntax 328 files OK; npm run check:bytes clean.

No source change was made beyond the conflict hunk. If you would rather the column work wait and the unset rule stand alone, say so and I will close this PR instead — main already has the method half from #1557 (42c60c1d).

## Resolved and rebased — the earlier escalation is withdrawn I said this needed Jay's decision. On a second look it does not: the two sides are the *same rule*, so keeping both is mechanical, not a judgement call. **What I verified before touching it:** `briefMethod()` on this branch is ```js if (iface.dhcp) return 'DHCP'; if (iface.ip) return 'manual'; return 'unset'; ``` — character-for-character the behaviour of main's inline `i.dhcp ? 'DHCP' : (i.ip ? 'manual' : 'unset')`. There is no disagreement to arbitrate; main has the sentence explaining *why* `unset` is the answer and this branch has the row builder that lands every row under its heading. **Resolution** (`engine/cli.js`, one hunk): main's comment kept verbatim, and the row printed through the branch's builder: ```js out.push(briefLine([i.name, ip, 'YES', briefMethod(i), link.status, link.protocol])); ``` **Rebased + pushed:** `86bc4bda` → **`4ef24d40`** on `rev/1115-2301` (base `7e89f959`), `--force-with-lease`. `mergeable` is now **true**. **Checks run locally on the rebased tree:** `test/interface-brief-columns.test.js` 17/17; the 13 suites that mention `interface brief` (brief-method-unset, interface-method, interface-status, show-ip-spellings, help-completeness, report-sweep, …) 0 failures; `npm run syntax` 328 files OK; `npm run check:bytes` clean. No source change was made beyond the conflict hunk. If you would rather the column work wait and the `unset` rule stand alone, say so and I will close this PR instead — main already has the method half from #1557 (`42c60c1d`).
jaylouisw scheduled this pull request to auto merge when all checks succeed 2026-11-16 01:17:29 +00:00
jaylouisw force-pushed rev/1115-2301 from 4ef24d40bb
Some checks failed
CI / Classify the change (pull_request) Successful in 13s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 20s
CI / Test (Node 18) (pull_request) Failing after 3m29s
CI / Test (Node 20) (pull_request) Failing after 3m14s
CI / Server smoke test (pull_request) Successful in 34s
CI / Docker build (pull_request) Successful in 23s
CI / Test (Node 22) (pull_request) Failing after 3m15s
to b38e0c5d5a
Some checks failed
CI / Classify the change (pull_request) Successful in 13s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 21s
CI / Docker build (pull_request) Failing after 12m34s
CI / Server smoke test (pull_request) Failing after 12m37s
CI / Test (Node 22) (pull_request) Failing after 12m42s
CI / Test (Node 20) (pull_request) Failing after 12m47s
CI / Test (Node 18) (pull_request) Failing after 12m52s
2026-11-16 01:17:32 +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!1562
No description provided.