The canvas, the front panel and the inspector now agree with the engine about a port (#1238) #1240
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!1240
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/port-state-one-rule"
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 canvas, the front panel and the inspector now agree with the engine about a port (#1238)
Fixes #1238. Follows #1237, which fixed the same defect in the CLI.
Three views describe a port and each of them answered the older question — did somebody shut it — and
printed the answer as the status. In faceplate.js that was the cell's
data-state, in canvas.js thetooltip suffix, in app.js the status bar. So an unplugged port read as healthy in the three places
you look when a link will not come up.
One rule, three callers
portState(facts)/portStateText(facts)now live inweb/faceplate.jsand the other two call them.Facts are passed in rather than looked up, so a view that cannot see the topology says
undefinedandgets "not down" instead of guessing: an unknown cable is not a missing cable.
downadministratively downnotconnectdown (no cable)link downdowndown (link down)downdown (peer shut down)cabled/upupnotconnectis deliberately notdown: painting every unused port on a 48-port faceplate red wouldsay "fault" 46 times. The tooltip still states the operational truth.
Found while doing it: a cut cable
docs/LINK-STATE.mddocumentslink down— the ports stay patched, the simulator will not carry aframe. Neither the CLI nor the UI knew about it: the port reported up/up with a dead cable between
it and its peer. The engine's
Device.ifaceStatus()and the UI rule both grew alink downverdict,distinct from
no cable, because the two faults have different fixes. (blocked— STP — is nottreated as down: the link is physically up; only
state === 'down'is.)Evidence
test/port-state-agreement.test.js— 37 checks:Device.ifaceStatus()and the UI'sportStateText()name each situation identically,case for case, on a real two-router lab;
fp-notconnect+down (no cable)for an empty socket (and nofp-down), andfp-down+administratively downfor a shut one;down (no cable)/administratively downin itsport tooltips and nothing about being down for a healthy cabled port;
setLinkState()readsdown (link down)in the engine, the panel and thecanvas, keeps its peer, and carries no packet;
index.htmlloads faceplate.js before canvas.js before app.js — the order the shared rule needs;enabledany more.Reverting
web/makes the suite fail outright (portStateTextis the thing under test).One existing assertion had to change, and it is worth naming:
test/faceplate.test.jsasserted "anempty socket is up but not cabled". That was the bug, written down as a requirement. It now asserts
notconnectand the reason, with a comment saying what it used to claim.docs/LINK-STATE.mdgains a table of what each view says per situation;docs/CLI.mdgains thelink downrow.Suite: 134 suites, 5,861 assertions, 0 failed.