One switchport sentence for the console and the inspector panel (#1291) #1292
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jaylouisw/packetforge!1292
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/switchport-sentence"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
One switchport sentence for the console and the panel.
Fixes #1291.
show interfaces <port>prints one line saying what the port does with a frame; the inspector panel shows thesame fact under a
VLANheading. The browser cannotrequirethe engine, so the rule exists twice on purpose —and the two copies had drifted.
Before
Three lies and one second spelling:
identical to a plain access port;
|| 1on every field made an unset trunk native VLAN indistinguishable from a native VLAN of 1;classifyEgressdrops every VLAN on — was rendered with the list missing;access 20versusaccess VLAN 20meant an operator comparing the two had to translate.After
One string, written once in
engine/vlan.jsasswitchportSentence(), printed by the console afterswitchport:and mirrored inweb/app.jsfor the panel.The staged clause is read from the stored fields, not the normalised ones — the normaliser derives a native
VLAN from the access VLAN when the field is absent, so asking it would report a staged parameter on every access
port in a non-default VLAN. An empty allowed list prints
none, notall, becauseclassifyEgressdrops everyVLAN on it.
Evidence
test/switchport-agreement.test.js— 13 checks over a 360-state matrix (mode × access VLAN × native VLAN ×allowed list):
sentences, so it is not testing one branch;
vlanSummary(iface)is the sentence and nothing else;classifyEgress:allowed allcarries every probedVLAN,
allowed nonecarries none, a listed VLAN is carried and an unlisted one is not,access VLAN Ncarries N, and anything the sentence calls staged is not carried;
console text == engine sentence == panel rendering;nonein both implementations while the data plane drops.test/ui-render.test.jsasserts the console's words (access VLAN 20) instead of the old panel spelling;test/show-interfaces-port.test.jsexpectations updated to the one sentence.With
web/app.jsreverted the suite fails immediately (switchportSentence is not exported), and with bothfiles reverted
engine/vlan.jshas no function to compare against — the before/after table above was capturedby evaluating the old
vlanSummarybody against the new engine function.docs/CLI.md: the switchport examples are the canonical sentences, withallowed noneexplained and the rule'shome recorded.
Suite: 161 suites, 6,726 assertions, 0 failed.
`show interfaces <port>` prints one line saying what the port does with a frame, and the inspector panel shows the same fact under a `VLAN` heading. The browser cannot require the engine, so the rule exists twice on purpose - and the two copies had drifted: port state panel said console said {access, nativeVlan 20} access 1 access VLAN 1 · trunk staged: native 20 (not in use) {trunk, allowedVlans: []} trunk · native 1 · allowed (nothing) -> claimed "allowed" trunk · native 1 · allowed none {access, allowedVlans: [10,20]} access 1 access VLAN 1 · trunk staged: allowed 10,20 (not in use) Three separate lies, and one second spelling: * the panel knew nothing about parameters stored but not in force, so a port staged for a trunk looked identical to a plain access port; * `|| 1` on every field made an unset trunk native VLAN indistinguishable from a native VLAN of 1; * an empty allowed list - a trunk `classifyEgress` drops every VLAN on - was rendered with the list missing; * and `access 20` in the panel vs `access VLAN 20` in the console meant an operator comparing the two had to translate. Now there is one sentence, written once in engine/vlan.js as switchportSentence(), printed by the console after `switchport: ` and mirrored in web/app.js for the panel - the same string in both places: access VLAN 20 access VLAN 1 · trunk staged: native 20 (not in use) trunk · native 30 · allowed 10,20 trunk · native 1 · allowed none The staged clause is read from the stored fields, not the normalised ones: the normaliser derives a native VLAN from the access VLAN when the field is absent, so asking it would report a staged parameter on every access port in a non-default VLAN. An empty allowed list prints `none` rather than `all`, because classifyEgress drops every VLAN on it. test/switchport-agreement.test.js: 13 checks over a 360-state matrix (mode x access VLAN x native VLAN x allowed list). Engine and panel produce the same sentence for every state, and the matrix reaches at least six distinct sentences so it is not testing one branch. vlanSummary(iface) is the sentence and nothing else. Every claim the sentence makes is checked against classifyEgress: `allowed all` carries every probed VLAN, `allowed none` carries none, a listed VLAN is carried and an unlisted one is not, `access VLAN N` carries N, and anything called "staged" is NOT carried. Then five real ports (four states) confirm console text == engine sentence == panel rendering, and a trunk that allows nothing says `none` in both implementations while the data plane drops. test/ui-render.test.js: asserts the console's words (access VLAN 20) rather than the old panel spelling. test/show-interfaces-port.test.js: expectations updated to the one sentence. docs/CLI.md: the switchport line examples are the canonical sentences, plus why `allowed none` exists and where the rule lives. Suite: 161 suites, 6,726 assertions, 0 failed.