cli: no vlan refuses a VLAN a port holds as its staged voice VLAN #1705

Merged
jaylouisw merged 1 commit from fix/1116-1805 into main 2026-11-16 18:30:02 +00:00
Owner

Fixes #1701.

switchport voice vlan 20 on a port that is not a trunk is stored — the receipt says so — and classifyEgress only reads the voice VLAN once the mode is trunk. So nothing in the switch carried VLAN 20 and nothing stopped no vlan 20: the VLAN went, the port kept switchport voice vlan 20, and one switchport mode trunk later the switch was carrying voice traffic in a VLAN it did not have.

The staged guard in no vlan already refuses two kinds of reference on a port that is not a trunk yet — a native VLAN and an allowed list — on the stated ground that removing the VLAN otherwise leaves the port pointing at something that is not there. The voice VLAN (#1368) added a third staged reference and the guard was never extended to it. It is now named with the other two, in the same sentence:

switch(config)#no vlan 20
% VLAN 20 is still referenced by 1 port(s): Fa0/3 (trunk native, trunk allowed, voice, stored) - clear that first

The access-VLAN case is untouched: the device deletes the VLAN and the port goes down (inactive), which vlan-delete-leaves-port-inactive.test.js pins.

Tests

  • test/vlan-delete-leaves-port-inactive.test.js — a new section: the staged voice VLAN refuses the removal and is named, the VLAN and the port are untouched, and switchport voice vlan none lets the removal through. 5 of its assertions failed before the fix.
  • node scripts/syntax-check.js — 356 files, all OK.
  • npm test — 285 suites, 10237 assertions, 0 failed.
  • Related suites individually: voice-vlan 30, show-interfaces-port 40, vlan-id-argument 39, config-undo 47, switchport-agreement 13, switchport-negation 46, show-vlan 32, running-config-switchport-order 12 — all green.

docs/CLI.md names the third staged reference, with the combined refusal transcript (verified by running it).

Fixes #1701. `switchport voice vlan 20` on a port that is not a trunk is *stored* — the receipt says so — and `classifyEgress` only reads the voice VLAN once the mode is trunk. So nothing in the switch carried VLAN 20 and nothing stopped `no vlan 20`: the VLAN went, the port kept `switchport voice vlan 20`, and one `switchport mode trunk` later the switch was carrying voice traffic in a VLAN it did not have. The `staged` guard in `no vlan` already refuses two kinds of reference on a port that is not a trunk yet — a native VLAN and an allowed list — on the stated ground that removing the VLAN otherwise leaves the port pointing at something that is not there. The voice VLAN (#1368) added a third staged reference and the guard was never extended to it. It is now named with the other two, in the same sentence: ``` switch(config)#no vlan 20 % VLAN 20 is still referenced by 1 port(s): Fa0/3 (trunk native, trunk allowed, voice, stored) - clear that first ``` The access-VLAN case is untouched: the device deletes the VLAN and the port goes `down (inactive)`, which `vlan-delete-leaves-port-inactive.test.js` pins. ## Tests * `test/vlan-delete-leaves-port-inactive.test.js` — a new section: the staged voice VLAN refuses the removal and is named, the VLAN and the port are untouched, and `switchport voice vlan none` lets the removal through. 5 of its assertions failed before the fix. * `node scripts/syntax-check.js` — 356 files, all OK. * `npm test` — **285 suites, 10237 assertions, 0 failed**. * Related suites individually: voice-vlan 30, show-interfaces-port 40, vlan-id-argument 39, config-undo 47, switchport-agreement 13, switchport-negation 46, show-vlan 32, running-config-switchport-order 12 — all green. `docs/CLI.md` names the third staged reference, with the combined refusal transcript (verified by running it).
cli: no vlan refuses a VLAN a port holds as its staged voice VLAN (#1701)
All checks were successful
CI / Classify the change (pull_request) Successful in 15s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 20s
CI / Server smoke test (pull_request) Successful in 18s
CI / Docker build (pull_request) Successful in 34s
CI / Test (Node 20) (pull_request) Successful in 1m16s
CI / Test (Node 18) (pull_request) Successful in 1m23s
CI / Test (Node 22) (pull_request) Successful in 1m24s
6f7ad82188
switchport voice vlan 20 on a port that is not a trunk is stored - the receipt says so - and classifyEgress reads it only once the mode is trunk, so nothing carried the VLAN and no guard stopped the deletion. no vlan 20 removed it, left switchport voice vlan 20 in the running config, and one switchport mode trunk later the switch carried voice traffic in a VLAN it did not have.

The staged-reference guard now names the voice VLAN with the native VLAN and the allowed list: 'still referenced by 1 port(s): Fa0/3 (trunk native, trunk allowed, voice, stored) - clear that first'.
jaylouisw scheduled this pull request to auto merge when all checks succeed 2026-11-16 18:29:47 +00:00
jaylouisw force-pushed fix/1116-1805 from 6f7ad82188
All checks were successful
CI / Classify the change (pull_request) Successful in 15s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 20s
CI / Server smoke test (pull_request) Successful in 18s
CI / Docker build (pull_request) Successful in 34s
CI / Test (Node 20) (pull_request) Successful in 1m16s
CI / Test (Node 18) (pull_request) Successful in 1m23s
CI / Test (Node 22) (pull_request) Successful in 1m24s
to 2eb7da59f2
All checks were successful
CI / Classify the change (pull_request) Successful in 24s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 16s
CI / Test (Node 18) (pull_request) Has been skipped
CI / Test (Node 20) (pull_request) Has been skipped
CI / Test (Node 22) (pull_request) Has been skipped
CI / Server smoke test (pull_request) Has been skipped
CI / Docker build (pull_request) Has been skipped
2026-11-16 18:29:51 +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!1705
No description provided.