RouterOS 008: CHR export oracle + round-trip golden gate (route B) #70

Closed
opened 2026-11-14 01:41:05 +00:00 by ginjiruu · 2 comments
Owner

Part of #43

Refs: lab/iac#45
Migrated from router-as-code tracker 008 (docs/routeros/tracker in this repo history). Research notes: docs/routeros/notes/.

Two uses of "ask a RouterOS box, don't trust the renderer". Design in note
§5. Depends on #001 (sim rig); #007 plugs the gate into CI.

Oracle: simulator export

  • Apply each device's Terraform to its CHR stand-in, /export, post-process
    (trim dynamic entries, re-inject the secrets the export refuses to print —
    verified omission, note §1), wrap in boot.tmpl.
  • Use as the independent check of #007's mechanical render for a few months:
    where the two disagree, the simulator is right until proven otherwise.

Round-trip gate (the task-golden equivalent)

  • CI job per change: render boot script (route A) → factory-reset a sim →
    import the render → tofu plan -detailed-exitcode against the sim → must
    be empty. This proves boot artifact ↔ Terraform truth equivalence and
    catches provider/RouterOS schema drift before hardware sees anything.
  • Same job re-run nightly against the pinned CHR version; a version bump that
    breaks round-trip pages before any device is upgraded (this is also the
    answer to "test RouterOS upgrades", see #009).

Done when

  • Gate green in CI for all three devices; disagreeing export vs mechanical
    render is a build failure with the diff attached.
Part of #43 Refs: lab/iac#45 Migrated from router-as-code tracker 008 (docs/routeros/tracker in this repo history). Research notes: docs/routeros/notes/. Two uses of "ask a RouterOS box, don't trust the renderer". Design in note §5. Depends on #001 (sim rig); #007 plugs the gate into CI. ## Oracle: simulator export - Apply each device's Terraform to its CHR stand-in, `/export`, post-process (trim dynamic entries, re-inject the secrets the export refuses to print — verified omission, note §1), wrap in `boot.tmpl`. - Use as the independent check of #007's mechanical render for a few months: where the two disagree, the simulator is right until proven otherwise. ## Round-trip gate (the task-golden equivalent) - CI job per change: render boot script (route A) → factory-reset a sim → `import` the render → `tofu plan -detailed-exitcode` against the sim → must be empty. This proves boot artifact ↔ Terraform truth equivalence and catches provider/RouterOS schema drift before hardware sees anything. - Same job re-run nightly against the pinned CHR version; a version bump that breaks round-trip pages before any device is upgraded (this is also the answer to "test RouterOS upgrades", see #009). ## Done when - Gate green in CI for all three devices; disagreeing export vs mechanical render is a build failure with the diff attached.
Author
Owner

ADR-0009: the oracle CHR gets its www-ssl cert from the harness OpenBao (#85 adds the role there too). /export omits installed certificates (note §1), so the round-trip re-injects the OpenBao-issued cert, same as the secrets.

ADR-0009: the oracle CHR gets its `www-ssl` cert from the harness OpenBao (#85 adds the role there too). `/export` omits installed certificates (note §1), so the round-trip re-injects the OpenBao-issued cert, same as the secrets.
Author
Owner

Implemented in PR #117 (routeros/render/).

The route changed from this issue's text in one way: the render is not wrapped in a boot template. The netinstall slot holds the #64 bootstrap only (recovery config), and the full render is a second file loaded on the bench after it. Terraform adopts the result with generated import blocks.

Gate (task render:gate): fresh CHR, bootstrap, render, empty state + imports, plan. Everything must import with no change except a fixed allowlist: move_items x2, ip_dns (no importer) and the www-ssl rotation (the vault cert cannot be imported). The residue is applied, and the device export must stay byte-identical. The second plan must exit 0. Coverage: nothing unmanaged in owned menus. task render:selftest proves it rejects five kinds of broken render.

Green on CHR 7.25.1 for rb5009-a, rb5009-b and crs309 (2026-11-16). Not done from the issue text: CI and nightly runs (needs a runner with KVM, containerlab and the harness OpenBao), and the #69 comparison (#69 does not exist yet).

Implemented in PR #117 (`routeros/render/`). The route changed from this issue's text in one way: the render is not wrapped in a boot template. The netinstall slot holds the #64 bootstrap only (recovery config), and the full render is a second file loaded on the bench after it. Terraform adopts the result with generated import blocks. Gate (`task render:gate`): fresh CHR, bootstrap, render, **empty state** + imports, plan. Everything must import with no change except a fixed allowlist: `move_items` x2, `ip_dns` (no importer) and the www-ssl rotation (the vault cert cannot be imported). The residue is applied, and the device export must stay byte-identical. The second plan must exit 0. Coverage: nothing unmanaged in owned menus. `task render:selftest` proves it rejects five kinds of broken render. Green on CHR 7.25.1 for rb5009-a, rb5009-b and crs309 (2026-11-16). Not done from the issue text: CI and nightly runs (needs a runner with KVM, containerlab and the harness OpenBao), and the #69 comparison (#69 does not exist yet).
Sign in to join this conversation.
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
lab/iac#70
No description provided.