Give the spanning tree a root anybody can choose (#1364) #1365
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!1365
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/stp-priority"
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?
Give the spanning tree a root anybody can choose. Fixes #1364.
computeStp()has built each bridge withsince STP was modelled.
config.stpPriorityhad no writer anywhere — no catalogue spec sets it, no commandsets it,
Device.serialize()did not carry it. Every switch in every lab ran 32768, the root was decided by MACaddress alone, and "make this box the root" — the first thing anyone does to a switched network — could not be
done.
show spanning-treedid not print the priority either, so the report described a tree without explainingits shape.
Measured on three CX 6000s in a triangle (
s3lowest MAC, all priorities default):Underneath, two more defects:
0was unreachable. Priority 0 is legal (0–61440in 4096 steps) and is the best there is; the||above turned it into the default, so a box told "you must be root" read as "you must not".
runStp()returnedroot: {priority, mac}— a bridge ID, not a device — sonothing downstream could say which switch won, and the first version of the report printed the model label
(
Aruba CX 6000 24G 4SFP+), which is the same string on all three switches.The command
values. Never rounded — rounding elects a root nobody asked for:
% 4500 is not a valid bridge priority: it must be a multiple of 4096 …; the nearest valid values are 4096 and 8192% This device runs one spanning tree, not one per VLAN: use \spanning-tree priority <0-61440>``The report
The root is named by hostname, else by the lab's id. With no simulator behind the session the line reads
root bridge not measured (no election has run)— the same distinctionshow interfacesmakes for its counters.Survives a save
stpPriorityis serialized only when set (a switch that never had one does not grow anullin every savedboard), restored on load, and printed by
show running-config— so a reloaded lab elects the same root it didbefore.
test/config-completeness.test.jsgains the print declaration the suite demands for a new config key(56 checks, was 55).
Evidence
test/stp-priority.test.js— 40 checks. Lower priority beats a lower MAC in both directions;0wins;4500and65536are refused with the rule and the nearest valid values; the per-VLAN form is refused and doesnot set the device-wide value instead;
norestores the MAC winner and refuses when nothing is set; the reportprints the priority in force, claims the root only when it is, and says "not measured" with no simulator; the
priority and the root survive a save; running-config round-trips.
With
engine/{cli,simulator,stp,device}.jsreverted, 32 of the 40 fail.npm run syntax— 253 files, all OK.npm test— 185 suites, 7,173 assertions, 0 failed.computeStp() has built each bridge with priority: (dev.config && dev.config.stpPriority) || STP_DEFAULT_PRIORITY since STP was modelled. config.stpPriority had NO writer anywhere: no catalogue spec sets it, no command sets it, and Device.serialize() did not carry it. Every switch in every lab therefore ran 32768, the root was decided by MAC address alone, and 'make this box the root' - the first thing anyone does to a switched network - could not be done. show spanning-tree did not print the priority either, so the report described a tree without explaining its shape. Two defects underneath: - 0 was unreachable. Priority 0 is legal (0-61440 in 4096 steps) and is the best there is, and the '||' above turned it into the default. A box told 'you must be root' read as 'you must not'. - The election named no bridge. runStp() returned root: {priority, mac} - a bridge ID, not a device - so nothing downstream could say which switch won. Now: - 'spanning-tree priority <0-61440>' sets it; 'no spanning-tree priority' restores 32768 and says so. - A value that is not a multiple of 4096, or outside the range, is refused naming the rule and the two nearest valid values. Never rounded: rounding elects a root nobody asked for. - IOS's per-VLAN spelling is refused with the reason rather than accepted and applied to everything. This model runs one spanning tree per device; pretending otherwise would be the 'one command changes something the operator did not ask about' defect. - show spanning-tree prints the bridge priority in force, says 'this bridge is the root' when it is, and names the root by hostname or lab id - not by the model label, which is the same string on every switch of one kind. - The priority is serialized only when set, restored on load, and printed by show running-config, so a reloaded lab elects the same root. - A device with no bridging ports is told the value is stored but no election runs there. test/stp-priority.test.js: 40 checks. Lower priority beats a lower MAC in both directions; 0 wins; 4500 and 65536 are refused with the rule and the nearest valid values; the per-VLAN form is refused; no-form restores the MAC winner; the report names the root and reports 'not measured' with no simulator; the priority and the root survive a save; running-config round-trips. With engine/{cli,simulator,stp,device}.js reverted, 32 of the 40 fail. test/config-completeness.test.js gains the print declaration the suite demands for a new config key (56 checks, was 55). Suite: 185 suites, 7,173 assertions, 0 failed. Syntax: 253 files, all OK.