trunk: switchport trunk allowed vlan except <list> inverts the named list over 1-4094 #2038

Merged
jaylouisw merged 1 commit from rev/1118-2112 into main 2026-11-18 23:08:26 +00:00
Owner

Question

switchport trunk allowed vlan accepted a list, all, add <list> and remove <list>, and refused every other word in front of the list - including except, which the vendor's own grammar lists as one of the command's verbs.

Sources

Verdict and change

except is a verb of the command and is the only one that is not an edit: it replaces the allowed list with the inversion of the named ids over 1-4094, regardless of what the port carried. remove on a default trunk performs the same arithmetic today, so this reuses vlanLib.allVlansExcept().

s1(config-if)# switchport trunk allowed vlan except 1,999
Trunk on Fa0/1 allows VLANs 2-998,1000-4094 (all but 1,999)
  • A list naming a media default gets the existing "cannot be removed" answer, list untouched.
  • The dead-trunk refusal is asked first, so except 1-4094 gets it rather than a sentence about 1002.
  • The refusal that listed four forms now lists five; docs/CLI.md and docs/ARCHITECTURE.md follow (the latter used except 20 as its unknown-word example).

Research note

research/trunk-allowed-except.md - what is known, what is inferred (the 1-4094 universe, the pinned defaults), what is unresolved (does a box keep except in show running-config; except 1002; extended-range ids, where the CR's "1 to 1005" line for except has none of the notes add/remove carry; none, still unimplemented).

Tests

node scripts/syntax-check.js OK (424 files); new test/trunk-allowed-except.test.js 26 assertions; test/trunk-allowed-add-remove.test.js 58 (its except 20 assertion was the old refusal); full npm test: 350 suites, 12135 assertions, 0 failed.

## Question `switchport trunk allowed vlan` accepted a list, `all`, `add <list>` and `remove <list>`, and refused every other word in front of the list - including `except`, which the vendor's own grammar lists as one of the command's verbs. ## Sources * Catalyst 9300 17.12 command reference, `switchport trunk`, vlan-list choices: `all | none | [add | remove | except] vlan-atom`; "except lists the VLANs that should be calculated by inverting the defined list of VLANs. (VLANs are added except the ones specified.)" - https://www.cisco.com/c/en/us/td/docs/switches/lan/catalyst9300/software/release/17-12/command_reference/b_1712_9300_cr/vlan_commands.html * Catalyst 2960-X configuration guide 15.2(3)E, Defining the Allowed VLANs on a Trunk: `switchport trunk allowed vlan {add | all | except | remove} vlan-list` - https://www.cisco.com/c/en/us/td/docs/switches/lan/catalyst2960x/software/15-2_3_e/consolidated_guide/b_1523e_consolidated_2960x_cg/m_vlan_trunk_cg_2960-x.html * CCNPv7.1 SWITCH lab 3-1 transcript: `switchport trunk allowed vlan except 1,999` then `show interface trunk` -> `Fa0/7 2-998,1000-4094` - https://data.kemt.fei.tuke.sk/TechnologieNaBazePrepinanychSieti/Cvicenia/2024/CCNPv7.1_SWITCH_Lab3-1_VLAN-TRUNK-VTP_STUDENT.docx * NetAcad CE1 M1-5, the full syntax in prose (and what `none` does) - https://netacad.fit.vutbr.cz/wp-content/uploads/ccnp/ce1/CE1_M1-5.pdf * Existing: research/trunk-allowed-reserved-vlans.md (1002-1005 cannot be removed from a trunk) ## Verdict and change `except` is a verb of the command and is the only one that is not an edit: it **replaces** the allowed list with the inversion of the named ids over 1-4094, regardless of what the port carried. `remove` on a default trunk performs the same arithmetic today, so this reuses `vlanLib.allVlansExcept()`. ``` s1(config-if)# switchport trunk allowed vlan except 1,999 Trunk on Fa0/1 allows VLANs 2-998,1000-4094 (all but 1,999) ``` * A list naming a media default gets the existing "cannot be removed" answer, list untouched. * The dead-trunk refusal is asked first, so `except 1-4094` gets it rather than a sentence about 1002. * The refusal that listed four forms now lists five; `docs/CLI.md` and `docs/ARCHITECTURE.md` follow (the latter used `except 20` as its unknown-word example). ## Research note `research/trunk-allowed-except.md` - what is known, what is inferred (the 1-4094 universe, the pinned defaults), what is unresolved (does a box keep `except` in `show running-config`; `except 1002`; extended-range ids, where the CR's "1 to 1005" line for `except` has none of the notes `add`/`remove` carry; `none`, still unimplemented). ## Tests `node scripts/syntax-check.js` OK (424 files); new `test/trunk-allowed-except.test.js` 26 assertions; `test/trunk-allowed-add-remove.test.js` 58 (its `except 20` assertion was the old refusal); full `npm test`: **350 suites, 12135 assertions, 0 failed**.
trunk: switchport trunk allowed vlan except <list> inverts the named list over 1-4094
All checks were successful
CI / Classify the change (pull_request) Successful in 7s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 9s
CI / Server smoke test (pull_request) Successful in 12s
CI / Docker build (pull_request) Successful in 24s
CI / Test (Node 20) (pull_request) Successful in 56s
CI / Test (Node 22) (pull_request) Successful in 57s
CI / Test (Node 18) (pull_request) Successful in 1m4s
CI / Arm auto-merge (pull_request) Successful in 3s
9e235fbf09
The console refused the command's third documented verb outright:

  s1(config-if)# switchport trunk allowed vlan except 5
  % Unrecognized "except": this console takes a list (10,20), a range (10-20), "all", "add <list>" or "remove <list>"

Vendor grammar for this command's vlan-list is `all | none | [add | remove | except] vlan-atom`
(Catalyst 9300 17.12 command reference, `switchport trunk`), and `except` "lists the VLANs that should
be calculated by inverting the defined list of VLANs. (VLANs are added except the ones specified.)"
It is not an edit like add/remove: it replaces the list. The CCNPv7.1 SWITCH lab 3-1 transcript prints
the answer that arithmetic gives - `except 1,999` then `show interface trunk` -> `2-998,1000-4094`.

So the stored list becomes the inversion of the named ids over 1-4094, whatever the port carried
before, and the answer names what came out: `Trunk on Fa0/1 allows VLANs 2-998,1000-4094 (all but
1,999)`. The four media defaults cannot leave a trunk, so a list naming one is answered with the same
rule `remove 1002` gets, and the dead-trunk refusal is asked first so `except 1-4094` gets it too.

research/trunk-allowed-except.md records the sources, the inferred half (the 1-4094 universe, the
pinned defaults) and the open questions (the running-config form, `except 1002` on a real box,
extended-range ids, `none`).

Tests: test/trunk-allowed-except.test.js (26 assertions); the `except 20` example in
trunk-allowed-add-remove.test.js was the old refusal and is now `banana`.
forgejo-actions force-pushed rev/1118-2112 from 9e235fbf09
All checks were successful
CI / Classify the change (pull_request) Successful in 7s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 9s
CI / Server smoke test (pull_request) Successful in 12s
CI / Docker build (pull_request) Successful in 24s
CI / Test (Node 20) (pull_request) Successful in 56s
CI / Test (Node 22) (pull_request) Successful in 57s
CI / Test (Node 18) (pull_request) Successful in 1m4s
CI / Arm auto-merge (pull_request) Successful in 3s
to 7eff45591b 2026-11-18 21:27:33 +00:00
Compare
jaylouisw force-pushed rev/1118-2112 from da0c7ef284 to ed2a00fc7b
Some checks failed
CI / Classify the change (pull_request) Successful in 5s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 5s
CI / Server smoke test (pull_request) Successful in 10s
CI / Test (Node 18) (pull_request) Failing after 59s
CI / Docker build (pull_request) Successful in 21s
CI / Test (Node 20) (pull_request) Successful in 51s
CI / Test (Node 22) (pull_request) Successful in 50s
CI / Arm auto-merge (pull_request) Successful in 5s
2026-11-18 22:47:08 +00:00
Compare
jaylouisw force-pushed rev/1118-2112 from ed2a00fc7b
Some checks failed
CI / Classify the change (pull_request) Successful in 5s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 5s
CI / Server smoke test (pull_request) Successful in 10s
CI / Test (Node 18) (pull_request) Failing after 59s
CI / Docker build (pull_request) Successful in 21s
CI / Test (Node 20) (pull_request) Successful in 51s
CI / Test (Node 22) (pull_request) Successful in 50s
CI / Arm auto-merge (pull_request) Successful in 5s
to 6cfad8e466
All checks were successful
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 4s
CI / Classify the change (pull_request) Successful in 6s
CI / Server smoke test (pull_request) Successful in 8s
CI / Test (Node 18) (pull_request) Successful in 1m10s
CI / Test (Node 20) (pull_request) Successful in 46s
CI / Docker build (pull_request) Successful in 31s
CI / Test (Node 22) (pull_request) Successful in 57s
CI / Arm auto-merge (pull_request) Successful in 4s
2026-11-18 23:04:52 +00:00
Compare
jaylouisw deleted branch rev/1118-2112 2026-11-18 23:08:28 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
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!2038
No description provided.