A reopened lab announced nothing #1468

Merged
jaylouisw merged 1 commit from fix/announce-on-load into main 2026-11-12 03:19:58 +00:00
Owner

Closes #1467

sw> show lldp neighbors            save the lab, reopen it, ask again
Router-r1  Fa0/1  Gi0/0  10.0.0.1        (none - no LLDP has been heard on any port)
PC-p1      Fa0/3  eth0   10.0.0.12

Neighbour rows are not stored state — they are announced. The board announces when a cable is plugged (refreshNeighbours(), the call the UI makes after addLink), and a load is that same event: every cable in the document is being added right now. Topology.fromJSON() marked nothing, so the simulator built on a reopened lab never announced, and every port claimed its far end had never been heard from with the cables all in place — the #1457 symptom arriving by a different road.

The change

  • Topology.fromJSON() marks the board it built (loadedFromDocument);
  • the Simulator constructor announces once for such a board — PoE budgets, LLDP to the far end, router advertisements: the same three things plugging a cable does;
  • a board built in code is untouched and still announces nothing until something asks it to.

A reopened lab now shows the same neighbour rows as before the save, port for port, with nothing plugged and no ping sent — on both ends of a cable and across a trunk carrying one VLAN.

Deliberately not invented

  • the MAC table is not restored: an entry is learned from a frame, so a reopened board holds exactly the table a live board holds after the same announcement (the test asserts that equality, not a fixed list), and a board that announced nothing holds none;
  • counters stay a fresh run: they belong to a run, not a lab — and the announcement is counted on the wire, as #1457 settled;
  • save → load → save remains byte-identical.

Evidence

test/neighbours-on-load.test.js, 20 checks. Reverting engine/ fails 7.

Neighbours green: lldp 27, show-lldp 23, lldp-across-trunk 32, flows-survive-save-load 16, spec-survives-load 32, dhcp-leases-survive-save 32, state-payload-complete 16, examples-generated 21, counters-agreement 32, link-state 69, stp-port-state 31, poe 18, config-roundtrip 46, pon-splitter 33.

Docs: docs/ARCHITECTURE.md § "A reopened lab announced nothing".

Closes #1467 ``` sw> show lldp neighbors save the lab, reopen it, ask again Router-r1 Fa0/1 Gi0/0 10.0.0.1 (none - no LLDP has been heard on any port) PC-p1 Fa0/3 eth0 10.0.0.12 ``` Neighbour rows are not stored state — they are announced. The board announces when a cable is plugged (`refreshNeighbours()`, the call the UI makes after `addLink`), and a **load is that same event**: every cable in the document is being added right now. `Topology.fromJSON()` marked nothing, so the simulator built on a reopened lab never announced, and every port claimed its far end had never been heard from with the cables all in place — the #1457 symptom arriving by a different road. ### The change * `Topology.fromJSON()` marks the board it built (`loadedFromDocument`); * the `Simulator` constructor announces **once** for such a board — PoE budgets, LLDP to the far end, router advertisements: the same three things plugging a cable does; * a board built in code is untouched and still announces nothing until something asks it to. A reopened lab now shows the same neighbour rows as before the save, port for port, with nothing plugged and no ping sent — on both ends of a cable and across a trunk carrying one VLAN. ### Deliberately not invented * **the MAC table is not restored**: an entry is learned from a frame, so a reopened board holds exactly the table a live board holds after the same announcement (the test asserts that equality, not a fixed list), and a board that announced nothing holds none; * **counters stay a fresh run**: they belong to a run, not a lab — and the announcement is counted on the wire, as #1457 settled; * save → load → save remains **byte-identical**. ### Evidence `test/neighbours-on-load.test.js`, **20 checks**. Reverting `engine/` fails 7. Neighbours green: `lldp` 27, `show-lldp` 23, `lldp-across-trunk` 32, `flows-survive-save-load` 16, `spec-survives-load` 32, `dhcp-leases-survive-save` 32, `state-payload-complete` 16, `examples-generated` 21, `counters-agreement` 32, `link-state` 69, `stp-port-state` 31, `poe` 18, `config-roundtrip` 46, `pon-splitter` 33. Docs: `docs/ARCHITECTURE.md` § *"A reopened lab announced nothing"*.
A reopened lab announced nothing (#1467)
All checks were successful
CI / Classify the change (pull_request) Successful in 10s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 13s
CI / Test (Node 20) (pull_request) Successful in 3m13s
CI / Test (Node 18) (pull_request) Successful in 3m22s
CI / Server smoke test (pull_request) Successful in 26s
CI / Docker build (pull_request) Successful in 43s
CI / Test (Node 22) (pull_request) Successful in 2m51s
75f58a8ec4
sw> show lldp neighbors          save the lab, reopen it, ask again
  Router-r1  Fa0/1  Gi0/0  10.0.0.1        (none - no LLDP has been heard on any port)
  PC-p1      Fa0/3  eth0   10.0.0.12

Neighbour rows are not stored state - they are announced. The board announces
when a cable is plugged (refreshNeighbours(), the call the UI makes after
addLink), and a load is that same event: every cable in the document is being
added right now. Topology.fromJSON() marked nothing, so the simulator built on a
reopened lab never announced, and every port claimed its far end had never been
heard from with the cables all in place - the #1457 symptom arriving by the load
path instead of the trunk path.

  * fromJSON marks the board it built (loadedFromDocument) and sets a one-shot
    pendingAnnouncement;
  * the first simulator built on such a board spends the flag and announces:
    PoE budgets, LLDP to the far end, router advertisements - the three things
    plugging a cable does;
  * once per board, not once per simulator: the server builds a fresh simulator
    per request, so announcing per construction put another LLDP frame on the
    wire for every read and made one board publish two different payloads a
    second apart (caught by replay-identical);
  * a board built in code is untouched and still announces nothing until
    something asks it to.

Deliberately not invented: the MAC table is not restored (an entry is learned
from a frame, so a reopened board holds exactly the table a live board holds
after the same announcement), counters stay a fresh run, and save -> load ->
save is byte-identical.

Evidence: test/neighbours-on-load.test.js, 23 checks; reverting engine/ fails 7.
Suite 234 suites, 8760 assertions, 0 failed.
jaylouisw scheduled this pull request to auto merge when all checks succeed 2026-11-12 03:19:54 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
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!1468
No description provided.