show running-config now prints the whole config: VLANs, DHCP pools, DNS zones and VRRP (#1232) #1233

Merged
jaylouisw merged 1 commit from fix/running-config-complete into main 2026-11-09 16:42:06 +00:00
Owner

show running-config now prints the whole config, not most of it

Fixes #1232.

#1231 made the output replayable. It was still incomplete: the VLAN table, every DHCP pool, every DNS
zone and every VRRP group existed in the device state — show vlan, show vrrp and the rest reported
them — and appeared nowhere in the "backup". A config that omits the whole VLAN table is perfectly
replayable, which is exactly why the round-trip test could not see it.

How it was found

By asking the complementary question: configure a device through the CLI, then look for every
configured value in the printed text. The values that never appear are the omissions. (The same sweep
correctly ignores physical inventory — cage, speed caps, media — which is device spec, not config.)

What is printed now

vlan 42 omitcheck
ip dhcp pool OMITCHK
  network 10.70.0.0 255.255.0.0
  range 10.70.0.10 10.70.0.200
  default-router 10.70.0.1
  dns-server 10.70.0.53
  excluded-address 10.70.0.20
  lease 0 12 0
  host 10.70.0.99 00:11:22:33:44:55
exit
dns zone omitcheck.test
  dns add www A 10.1.2.50
  dns add @ MX mail.omitcheck.test

and, inside the interface that owns them:

interface Gi0/0/0
  ip address 10.1.2.3 255.255.255.0
  vrrp 42 ip 10.1.2.1
  vrrp 42 priority 120
  vrrp 42 advertise 3
exit

Details that matter for a faithful round trip:

  • VRRP goes inside its interface block — the only place the parser accepts it.
  • host <addr> <mac> is printed in that order. The state is keyed by hardware address and holds
    the pinned address, which is the reverse; printing the key first produced a reservation for a device
    whose MAC was an IP address.
  • A lease is stored in seconds and printed as lease <days> <hours> <minutes>, the form the
    command takes.
  • Defaults are printed only when they differ (VRRP preempt/advertise 1, switchport
    allowed vlan all), the same rule the rest of the config follows.

Two fields are deliberately not printed because no command can express them: a DNS zone's defaultTtl
and a per-record ttl. That is documented in docs/CLI.md rather than left as a silent hole.

Evidence

test/config-roundtrip.test.js grew the other half of the invariant — 45 checks now:

  • a battery covering all four families is accepted, and each printed line is asserted individually;
  • the VRRP group is asserted to be inside its interface block;
  • the printed config replays with zero rejections and reproduces itself;
  • vlans, dhcpPools, dnsZones and vrrp are deep-equal after the round trip;
  • a generic sweep over the whole config object asserts that no configured value is missing from
    the text
    , with an explicit, reasoned list of the few that are not printed — so a future config
    object added to the engine cannot be forgotten by the printer without this failing.

Reverting engine/cli.js fails it immediately:

✗ the VLAN table is printed     [vlan 42 omitcheck]
✗ the DHCP pool is printed      [ip dhcp pool OMITCHK]
✗ its reservation is printed    [host 10.70.0.99 00:11:22:33:44:55]

The repository's own exemption audit (test/skip-audit.test.js) flagged my new skip in the sweep; it
is now annotated as ordinary control flow with its reason, which is what that audit exists for.

docs/CLI.md gains a table of exactly what the config contains.

Suite: 132 suites, 5,780 assertions, 0 failed.

`show running-config` now prints the whole config, not most of it Fixes #1232. #1231 made the output *replayable*. It was still incomplete: the VLAN table, every DHCP pool, every DNS zone and every VRRP group existed in the device state — `show vlan`, `show vrrp` and the rest reported them — and appeared nowhere in the "backup". A config that omits the whole VLAN table is perfectly replayable, which is exactly why the round-trip test could not see it. ## How it was found By asking the complementary question: configure a device through the CLI, then look for every configured value in the printed text. The values that never appear are the omissions. (The same sweep correctly ignores physical inventory — cage, speed caps, media — which is device spec, not config.) ## What is printed now ``` vlan 42 omitcheck ip dhcp pool OMITCHK network 10.70.0.0 255.255.0.0 range 10.70.0.10 10.70.0.200 default-router 10.70.0.1 dns-server 10.70.0.53 excluded-address 10.70.0.20 lease 0 12 0 host 10.70.0.99 00:11:22:33:44:55 exit dns zone omitcheck.test dns add www A 10.1.2.50 dns add @ MX mail.omitcheck.test ``` and, inside the interface that owns them: ``` interface Gi0/0/0 ip address 10.1.2.3 255.255.255.0 vrrp 42 ip 10.1.2.1 vrrp 42 priority 120 vrrp 42 advertise 3 exit ``` Details that matter for a faithful round trip: * **VRRP goes inside its interface block** — the only place the parser accepts it. * **`host <addr> <mac>` is printed in that order.** The state is keyed by hardware address and holds the pinned address, which is the reverse; printing the key first produced a reservation for a device whose MAC was an IP address. * **A lease is stored in seconds and printed as `lease <days> <hours> <minutes>`**, the form the command takes. * **Defaults are printed only when they differ** (VRRP `preempt`/`advertise 1`, switchport `allowed vlan all`), the same rule the rest of the config follows. Two fields are deliberately not printed because no command can express them: a DNS zone's `defaultTtl` and a per-record `ttl`. That is documented in `docs/CLI.md` rather than left as a silent hole. ## Evidence `test/config-roundtrip.test.js` grew the other half of the invariant — 45 checks now: * a battery covering all four families is accepted, and each printed line is asserted individually; * the VRRP group is asserted to be **inside** its interface block; * the printed config replays with zero rejections and reproduces itself; * `vlans`, `dhcpPools`, `dnsZones` and `vrrp` are deep-equal after the round trip; * a generic sweep over the whole `config` object asserts that **no configured value is missing from the text**, with an explicit, reasoned list of the few that are not printed — so a future config object added to the engine cannot be forgotten by the printer without this failing. Reverting `engine/cli.js` fails it immediately: ``` ✗ the VLAN table is printed [vlan 42 omitcheck] ✗ the DHCP pool is printed [ip dhcp pool OMITCHK] ✗ its reservation is printed [host 10.70.0.99 00:11:22:33:44:55] ``` The repository's own exemption audit (`test/skip-audit.test.js`) flagged my new skip in the sweep; it is now annotated as ordinary control flow with its reason, which is what that audit exists for. `docs/CLI.md` gains a table of exactly what the config contains. Suite: 132 suites, 5,780 assertions, 0 failed.
show running-config now prints the whole config, not most of it
All checks were successful
CI / Classify the change (pull_request) Successful in 11s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 14s
CI / Test (Node 18) (pull_request) Successful in 1m37s
CI / Test (Node 20) (pull_request) Successful in 1m35s
CI / Server smoke test (pull_request) Successful in 37s
CI / Docker build (pull_request) Successful in 37s
CI / Test (Node 22) (pull_request) Successful in 1m31s
54decb6bc9
Fixes #1232.

#1231 made the output *replayable*. It was still incomplete: the VLAN table, every DHCP pool, every DNS
zone and every VRRP group existed in the device state — `show vlan`, `show vrrp` and the rest reported
them — and appeared nowhere in the "backup". A config that omits the whole VLAN table is perfectly
replayable, which is exactly why the round-trip test could not see it.

## How it was found

By asking the complementary question: configure a device through the CLI, then look for every
configured value in the printed text. The values that never appear are the omissions. (The same sweep
correctly ignores physical inventory — cage, speed caps, media — which is device spec, not config.)

## What is printed now

```
vlan 42 omitcheck
ip dhcp pool OMITCHK
  network 10.70.0.0 255.255.0.0
  range 10.70.0.10 10.70.0.200
  default-router 10.70.0.1
  dns-server 10.70.0.53
  excluded-address 10.70.0.20
  lease 0 12 0
  host 10.70.0.99 00:11:22:33:44:55
exit
dns zone omitcheck.test
  dns add www A 10.1.2.50
  dns add @ MX mail.omitcheck.test
```

and, inside the interface that owns them:

```
interface Gi0/0/0
  ip address 10.1.2.3 255.255.255.0
  vrrp 42 ip 10.1.2.1
  vrrp 42 priority 120
  vrrp 42 advertise 3
exit
```

Details that matter for a faithful round trip:

* **VRRP goes inside its interface block** — the only place the parser accepts it.
* **`host <addr> <mac>` is printed in that order.** The state is keyed by hardware address and holds
  the pinned address, which is the reverse; printing the key first produced a reservation for a device
  whose MAC was an IP address.
* **A lease is stored in seconds and printed as `lease <days> <hours> <minutes>`**, the form the
  command takes.
* **Defaults are printed only when they differ** (VRRP `preempt`/`advertise 1`, switchport
  `allowed vlan all`), the same rule the rest of the config follows.

Two fields are deliberately not printed because no command can express them: a DNS zone's `defaultTtl`
and a per-record `ttl`. That is documented in `docs/CLI.md` rather than left as a silent hole.

## Evidence

`test/config-roundtrip.test.js` grew the other half of the invariant — 45 checks now:

* a battery covering all four families is accepted, and each printed line is asserted individually;
* the VRRP group is asserted to be **inside** its interface block;
* the printed config replays with zero rejections and reproduces itself;
* `vlans`, `dhcpPools`, `dnsZones` and `vrrp` are deep-equal after the round trip;
* a generic sweep over the whole `config` object asserts that **no configured value is missing from
  the text**, with an explicit, reasoned list of the few that are not printed — so a future config
  object added to the engine cannot be forgotten by the printer without this failing.

Reverting `engine/cli.js` fails it immediately:

```
✗ the VLAN table is printed     [vlan 42 omitcheck]
✗ the DHCP pool is printed      [ip dhcp pool OMITCHK]
✗ its reservation is printed    [host 10.70.0.99 00:11:22:33:44:55]
```

The repository's own exemption audit (`test/skip-audit.test.js`) flagged my new skip in the sweep; it
is now annotated as ordinary control flow with its reason, which is what that audit exists for.

`docs/CLI.md` gains a table of exactly what the config contains.

Suite: 132 suites, 5,780 assertions, 0 failed.
jaylouisw scheduled this pull request to auto merge when all checks succeed 2026-11-09 16:42:03 +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!1233
No description provided.