config: an interface stanza ends with !, the line a box prints #2087

Merged
jaylouisw merged 1 commit from rev/1119-0412 into main 2026-11-19 04:38:28 +00:00
Owner

The question

What line separates two interface stanzas in show running-config - and does the printed file need exit to replay?

Verdict

A bare !. Every published running-config separates two interface stanzas with one, and exit is a command that leaves a mode, not a line a box writes in this file:

What changed

engine/cli.js: the interface loop pushes ! instead of exit. The line was added by #1230, when the parser stayed inside interface mode; it no longer relies on it (a new interface line is a mode switch, and a global command at an interface prompt is applied in global config), so the terminator can be the character a box prints.

  • test/running-config-stanza-separator.test.js (17 checks): one ! per stanza, the empty stanza's two lines, the last block above end, no exit anywhere, byte-identical replay, and a vendor-shaped paste (! separators, no exit) landing on the right ports.
  • Three existing readers updated to treat ! as the end of a block; the old-shape replay test strips both.
  • docs/CLI.md, CHANGELOG.md, and research/running-config-stanza-separator.md (what is known, what is inferred, what is unresolved).

Still unresolved

Whether a bare ! typed at a real (config-if)# ends the mode. That is why the ip dhcp pool stanza still closes with exit here: ! is read as a comment, so the stanza after a pool would otherwise be read in pool mode. The note names the transcript that would settle it.

Tests

syntax-check OK; full suite 360 suites, 12,380 assertions, 0 failed.

## The question What line separates two `interface` stanzas in `show running-config` - and does the printed file need `exit` to replay? ## Verdict A bare `!`. Every published running-config separates two `interface` stanzas with one, and `exit` is a command that leaves a mode, not a line a box writes in this file: - [Cisco 4000 Series ISRs, Basic Router Configuration - Default Configuration](http://www.cisco.com/c/en/us/td/docs/routers/access/4400/software/configuration/guide/isr4400swcfg/bm_isr_4400_sw_config_guide_chapter_0110.html): `interface GigabitEthernet0/0/0` / `no ip address` / `negotiation auto` / `!` / `interface GigabitEthernet0/0/1` ..., no `exit` anywhere in the file. - [Cisco TAC `show running-config` reference (IOS 11.2)](https://www.cisco.com/E-Learning/bulk/public/tac/cim/cib/using_cisco_ios_software/cmdrefs/show_running-config.htm): `!` between stanzas, `end` last. - [Dynamically Configuring DHCP Server Options](https://www.cisco.com/c/en/us/support/docs/ip/dynamic-address-allocation-resolution/22920-dhcp-ser.html): pool stanza closed by `!`, then `interface FastEthernet0/0`, then `!`, `end`. - [Managing Configuration Files (IOS 15M&T)](https://www.cisco.com/c/en/us/td/docs/ios-xml/ios/config-mgmt/configuration/15mt/config-mgmt-15-mt-book/cm-config-files.html): `!` is a comment, stripped when the file is loaded. ## What changed `engine/cli.js`: the interface loop pushes `!` instead of `exit`. The line was added by #1230, when the parser stayed inside interface mode; it no longer relies on it (a new `interface` line is a mode switch, and a global command at an interface prompt is applied in global config), so the terminator can be the character a box prints. - `test/running-config-stanza-separator.test.js` (17 checks): one `!` per stanza, the empty stanza's two lines, the last block above `end`, no `exit` anywhere, byte-identical replay, and a vendor-shaped paste (`!` separators, no `exit`) landing on the right ports. - Three existing readers updated to treat `!` as the end of a block; the old-shape replay test strips both. - `docs/CLI.md`, `CHANGELOG.md`, and `research/running-config-stanza-separator.md` (what is known, what is inferred, what is unresolved). ## Still unresolved Whether a bare `!` typed at a real `(config-if)#` ends the mode. That is why the `ip dhcp pool` stanza still closes with `exit` here: `!` is read as a comment, so the stanza after a pool would otherwise be read in pool mode. The note names the transcript that would settle it. ## Tests `syntax-check` OK; full suite **360 suites, 12,380 assertions, 0 failed**.
config: an interface stanza ends with !, the line a box prints
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 9s
CI / Server smoke test (pull_request) Successful in 10s
CI / Test (Node 20) (pull_request) Successful in 55s
CI / Docker build (pull_request) Successful in 23s
CI / Test (Node 22) (pull_request) Successful in 58s
CI / Test (Node 18) (pull_request) Successful in 1m3s
CI / Arm auto-merge (pull_request) Successful in 4s
05033d891a
`show running-config` closed every interface block with `exit` - one per
port, empty or not. No box writes that line in this file: the Cisco 4000
Series ISRs' default configuration prints `interface GigabitEthernet0/0/0`
/ `no ip address` / `negotiation auto` / `!` / `interface
GigabitEthernet0/0/1` ..., the IOS 11.2 sample separates every stanza with
`!` and closes with `end`, and `exit` is documented as a command that leaves
a mode. The line was added by #1230 because the parser once stayed inside
interface mode; it no longer needs it (a new `interface` line is a mode
switch, and a global command at an interface prompt is applied in global
config), so the separator is now the character a box writes.

`test/running-config-stanza-separator.test.js` (17 checks) pins one `!` per
stanza, the empty stanza's two lines, the last block above `end`, the
byte-identical replay, and a vendor-shaped paste (`!` separators, no
`exit`) landing on the right ports. The `ip dhcp pool` stanza still closes
with `exit`; what a bare `!` does at a real submode prompt is unresolved and
recorded in research/running-config-stanza-separator.md.

Full suite: 360 suites, 12,380 assertions, 0 failed.
forgejo-actions scheduled this pull request to auto merge when all checks succeed 2026-11-19 04:30:27 +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!2087
No description provided.