The PoE panel stops powering ports the engine has shut down (#1293) #1294
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!1294
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/poe-agreement"
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?
The PoE panel stops powering ports the engine has shut down.
Fixes #1293.
The gap
poeSummary()inweb/app.jsis a second implementation ofSimulator.computePoe(), because the browsercannot
requirethe engine. The engine walksactiveInterfaces(), so a shut-down PSE port serves no power. Thepanel walked every port:
With a tight budget the panel then denied the wrong port — it had powered the port the engine skipped, so the
budget ran out on the port the engine was actually powering:
test/ui-render.test.jsalready compared the two — on one lab, with two powered devices and a tight budget,which is the one arrangement where both copies happen to agree. One comparison is not agreement.
After
PoE in use 0 Wwhen the only PSE port is shut down, andnothing flagged
DENIEDbecause nothing was asked for.Evidence
test/poe-agreement.test.js— 16 checks comparing the two implementations port by port, not just totals:Every case compares
budget,used,deniedand the per-port on/off set, so an implementation cannot agreeon the totals while powering different ports.
With
web/app.jsreverted, 4 of the 16 fail — including the reversed denial and 25.9 W reported in use with bothPSE ports shut down.
docs/PHYSICAL_LAYER.md: a "Who gets powered, and who reports it" section — active ports only, non-PD peersskipped, and why the mirror exists and what it got wrong.
Suite: 162 suites, 6,742 assertions, 0 failed.
poeSummary() in web/app.js is a second implementation of Simulator.computePoe(), because the browser cannot require the engine. The engine walks activeInterfaces(), so a shut-down PSE port serves no power. The panel walked every port. Measured on a PSE whose only PSE port is shut down, with a powered device behind it: engine: { budget: 30, used: 0, ports: [] } panel: { budget: 30, used: 12.95, ports: ['1/1/1/true'] } And with a tight budget the panel marked the wrong port denied, because it powered the port the engine had skipped and then ran out of budget on the port the engine was actually powering: one PSE port shut down, budget 20 engine: powers 1/1/2 (12.95 W, nothing denied) panel: powers 1/1/1, denies 1/1/2 test/ui-render.test.js already compared the two - on one lab, with two powered devices and a tight budget, which is the one arrangement where both copies agree. One comparison is not agreement. Now the panel's power accounting follows the engine: only an enabled PSE port serves power. The PSE port count stays a hardware count, because the ports exist whether or not they are up, and a device with no budget is still reported as "budget not modelled" rather than claiming 0 W in use. test/poe-agreement.test.js: 16 checks comparing the two implementations port by port, not just totals, across every case a PSE meets - both devices fitting, a budget that cannot fit both, one PSE port shut down (budget fine and budget tight), both shut down, a peer that is not a powered device, a PSE port with nothing plugged in, a device with no budget, and a sweep of twelve budgets each also checked for drawing more than it has. The rendered sentence is checked too: `PoE in use 0 W` when the only PSE port is shut down, nothing flagged DENIED because nothing was asked for. With web/app.js reverted, 4 of the 16 fail, including the reversed denial above and 25.9 W reported in use with both PSE ports shut down. docs/PHYSICAL_LAYER.md: a "Who gets powered, and who reports it" section - active ports only, non-PD peers skipped, and why the mirror exists and what it got wrong. Suite: 162 suites, 6,742 assertions, 0 failed.