A backup now carries the routing configuration (#1279) #1280

Merged
jaylouisw merged 1 commit from fix/config-completeness into main 2026-11-09 21:52:06 +00:00
Owner

A backup of a configured router now carries its routing configuration.

Fixes #1279.

The gap

Eight layer-3 features were configurable, stored in device.config, and printed nowhere:

r1(config)#ip name-server 10.0.0.9
r1(config)#scion 1-ff00:0:110
r1(config)#ospf router-id 1.1.1.1
r1(config)#router bgp 65001
r1(config)#neighbor 10.0.0.2 remote-as 65002
r1(config)#interface Gi0
r1(config-if)#ipv6 address 2001:db8:1::1/64
r1(config-if)#ip ospf cost 20
r1(config-if)#ipv6 nd ra enable
r1(config)#end
r1#show running-config
! PacketForge running-config
hostname ASR 1001-X aggregation services router-r1
interface Gi0
exit
...
feature stored in printed before
ip name-server <addr> config.dnsServers no
scion <isd-as> config.scionAs no
ospf router-id, ospf area config.ospf no
ip ospf cost|area|passive config.ospf.interfaces[] no
router bgp, bgp router-id, neighbor … remote-as config.bgp no
ipv6 address <p>/<len> config.ip6[iface] no
ipv6 route, ipv6 gateway config.routes6, config.gateway6 no
ipv6 nd ra|suppress-ra|prefix config.ra no

Restoring that backup gives a different device — one that looks configured and is not. Same class as #1232
(VRRP printed nowhere), one level out.

Why the existing completeness sweep could not see it

test/config-roundtrip.test.js asserts the printed config replays and that nothing configured is missing from
the text. Both are trivially true of a feature nobody configured in the sweep: it prints what each device
holds and reads it back, and an absent feature has nothing to be left out of.

The guard that can see it

test/config-completeness.test.js (56 checks, 20 fail with engine/cli.js reverted) declares every
key device.config can hold, with the pattern the printer must produce for it — plus a stated reason for the
two that are deliberately never printed (gateway6Iface, motd). A key it has not been taught fails the
suite, so a new piece of state that nobody taught the printer ships as a test failure instead of a silent
omission:

✗ no config key exists without a declared way to print it
  [undeclared: newThing - add it to KEY_PRINTS]

It also asserts, per feature: the command is accepted, the config text changes, the printed line appears,
a default device prints none of them (no invented defaults), each is removable again, and the whole lot
replays with zero rejected lines into a byte-identical config on the ASR 1001-X, the ISR 4331 and the
generic router.

Printing order matters and is tested implicitly by the byte-identical replay: ospf router-id is emitted
before the interface blocks whose ip ospf … lines require the process to exist.

One level down: a DHCP pool's leaves

test/dhcp-pool-undo.test.js (51 checks, 20 fail reverted) — the parent level was #1278, the leaves were
half missing and half silent:

leaf before
no network, no host <addr> missing outright → % Unrecognized DHCP pool command
no range deleted, then reported by the exit-time validation as an error — a deletion the operator asked for read like one the device refused
no default-router|dns-server|lease deleted in silence: "it worked" and "there was nothing to do" printed the same nothing
no excluded-address 10.5.0.5 cleared the whole list, including 10.5.0.6 — how a box starts handing out an address that was reserved for a printer

Each now removes only its own leaf, says what it removed, and refuses — naming the pool and the leaf — when
there is nothing there. no range still leaves the pool incomplete and now says so about the pool:

% Pool P1 is incomplete - DHCP pool P1: both rangeStart and rangeEnd are required. (E_DHCP_BAD_RANGE)

rather than a bare error code that looks like a rejection. no host works by address or by MAC.

Docs

docs/CLI.md: the "What the config contains" table gains all eight sections, and explains why the replay
sweep cannot see a feature nobody configured, with the census that can.

Suite: 154 suites, 6,487 assertions, 0 failed.

A backup of a configured router now carries its routing configuration. Fixes #1279. ## The gap Eight layer-3 features were configurable, stored in `device.config`, and printed **nowhere**: ``` r1(config)#ip name-server 10.0.0.9 r1(config)#scion 1-ff00:0:110 r1(config)#ospf router-id 1.1.1.1 r1(config)#router bgp 65001 r1(config)#neighbor 10.0.0.2 remote-as 65002 r1(config)#interface Gi0 r1(config-if)#ipv6 address 2001:db8:1::1/64 r1(config-if)#ip ospf cost 20 r1(config-if)#ipv6 nd ra enable r1(config)#end r1#show running-config ! PacketForge running-config hostname ASR 1001-X aggregation services router-r1 interface Gi0 exit ... ``` | feature | stored in | printed before | |---|---|---| | `ip name-server <addr>` | `config.dnsServers` | **no** | | `scion <isd-as>` | `config.scionAs` | **no** | | `ospf router-id`, `ospf area` | `config.ospf` | **no** | | `ip ospf cost\|area\|passive` | `config.ospf.interfaces[]` | **no** | | `router bgp`, `bgp router-id`, `neighbor … remote-as` | `config.bgp` | **no** | | `ipv6 address <p>/<len>` | `config.ip6[iface]` | **no** | | `ipv6 route`, `ipv6 gateway` | `config.routes6`, `config.gateway6` | **no** | | `ipv6 nd ra\|suppress-ra\|prefix` | `config.ra` | **no** | Restoring that backup gives a different device — one that *looks* configured and is not. Same class as #1232 (VRRP printed nowhere), one level out. ## Why the existing completeness sweep could not see it `test/config-roundtrip.test.js` asserts the printed config replays and that nothing configured is missing from the text. Both are trivially true of a feature **nobody configured in the sweep**: it prints what each device holds and reads it back, and an absent feature has nothing to be left out of. ## The guard that can see it `test/config-completeness.test.js` (56 checks, **20 fail with `engine/cli.js` reverted**) declares **every** key `device.config` can hold, with the pattern the printer must produce for it — plus a stated reason for the two that are deliberately never printed (`gateway6Iface`, `motd`). A key it has not been taught fails the suite, so a new piece of state that nobody taught the printer ships as a test failure instead of a silent omission: ``` ✗ no config key exists without a declared way to print it [undeclared: newThing - add it to KEY_PRINTS] ``` It also asserts, per feature: the command is accepted, the config text **changes**, the printed line appears, a default device prints **none** of them (no invented defaults), each is removable again, and the whole lot replays with **zero rejected lines** into a byte-identical config on the ASR 1001-X, the ISR 4331 and the generic router. Printing order matters and is tested implicitly by the byte-identical replay: `ospf router-id` is emitted before the interface blocks whose `ip ospf …` lines require the process to exist. ## One level down: a DHCP pool's leaves `test/dhcp-pool-undo.test.js` (51 checks, **20 fail reverted**) — the parent level was #1278, the leaves were half missing and half silent: | leaf | before | |---|---| | `no network`, `no host <addr>` | missing outright → `% Unrecognized DHCP pool command` | | `no range` | deleted, then reported by the exit-time validation **as an error** — a deletion the operator asked for read like one the device refused | | `no default-router\|dns-server\|lease` | deleted in silence: "it worked" and "there was nothing to do" printed the same nothing | | `no excluded-address 10.5.0.5` | cleared the **whole list**, including `10.5.0.6` — how a box starts handing out an address that was reserved for a printer | Each now removes only its own leaf, says what it removed, and refuses — naming the pool and the leaf — when there is nothing there. `no range` still leaves the pool incomplete and now says so about the pool: ``` % Pool P1 is incomplete - DHCP pool P1: both rangeStart and rangeEnd are required. (E_DHCP_BAD_RANGE) ``` rather than a bare error code that looks like a rejection. `no host` works by address **or** by MAC. ## Docs `docs/CLI.md`: the "What the config contains" table gains all eight sections, and explains why the replay sweep cannot see a feature nobody configured, with the census that can. Suite: 154 suites, 6,487 assertions, 0 failed.
A backup now carries the routing configuration (#1279)
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 1m55s
CI / Test (Node 18) (pull_request) Successful in 2m0s
CI / Server smoke test (pull_request) Successful in 35s
CI / Docker build (pull_request) Successful in 38s
CI / Test (Node 22) (pull_request) Successful in 1m50s
0917b0c431
Eight layer-3 features were configurable, stored in `device.config`, and printed nowhere:

  ip name-server <addr>                    config.dnsServers
  scion <isd-as>                           config.scionAs
  ospf router-id / ospf area               config.ospf
  ip ospf cost|area|passive                config.ospf.interfaces[]
  router bgp / bgp router-id / neighbor    config.bgp
  ipv6 address <p>/<len>                   config.ip6[iface]
  ipv6 route / ipv6 gateway                config.routes6 / config.gateway6
  ipv6 nd ra|suppress-ra|prefix            config.ra

Show running-config on a router with all of them configured printed none of them. Restoring that backup gives
a different device - one that looks configured and is not. Same class as #1232 (VRRP printed nowhere), one
level out.

Each now prints in the exact spelling the parser takes back, in an order that replays: `ospf router-id` before
the interface blocks whose `ip ospf ...` lines require the process to exist, and only values that differ from
the defaults the device already assumes - a device that never touched `ipv6 nd` prints nothing.

Why the existing "nothing configurable is left out" sweep could not catch this: it prints each device's
config and reads it back, and a feature nobody configured in the sweep has nothing to be left out of. Both of
its assertions are trivially true of an absent feature.

So test/config-completeness.test.js guards it from the other side. It declares every key `device.config` can
hold, with the pattern the printer must produce for it (and a reason for the two that are deliberately not
printed), and fails on any key it has not been taught - a new piece of state that nobody taught the printer
fails the suite instead of shipping as a silent omission. It also asserts each feature changes the text when
set, prints nothing when unset, replays with zero rejected lines, and produces a byte-identical config on the
ASR 1001-X, the ISR 4331 and the generic router.

One level down, a DHCP pool's leaves were half missing and half silent (`test/dhcp-pool-undo.test.js`):

  no network, no host <addr>        missing outright -> "% Unrecognized DHCP pool command"
  no range                          deleted, then reported by the exit-time validation as an error, so a
                                    deletion the operator asked for read like one the device refused
  no default-router|dns-server|lease  deleted in silence - "it worked" and "there was nothing to do" printed
                                    the same nothing
  no excluded-address 10.5.0.5      cleared the WHOLE list, including 10.5.0.6 - how a box starts handing out
                                    an address that was reserved for a printer

Each now removes only its own leaf, says what it removed, and refuses - naming the pool and the leaf - when
there is nothing there. Removing the range still leaves the pool incomplete, and now says so about the pool
("Pool P1 is incomplete - ...") instead of emitting a bare E_DHCP_BAD_RANGE that looks like a rejection.

docs/CLI.md: the "What the config contains" table gains the eight sections, and explains why the replay sweep
cannot see a feature nobody configured, with the census that can.

Suite: 154 suites, 6,487 assertions, 0 failed. 20 checks in each new suite fail with engine/cli.js reverted.
jaylouisw scheduled this pull request to auto merge when all checks succeed 2026-11-09 21:52:04 +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!1280
No description provided.