Guide

Configuration Editor

Ze includes an interactive configuration editor with YANG-driven tab completion, rollback history, and live validation.

Usage

ze config edit                      # Edit default config
ze config edit myconfig.conf        # Edit specific file

The editor starts an ephemeral ze instance in the background for live YANG validation and completion suggestions.

Editor Commands

Command Description
set <path> <value> Set a configuration value
delete <path> Delete a configuration value or section
show Display current configuration
show <path> Display a specific section
show \| blame Annotate with authorship
show \| changes [all] Pending changes (session or all)
show \| compare Diff against committed config — shows only the parts that differ
show \| errors Validation issues
show \| history List rollback revisions
commit Save changes and notify daemon
commit confirmed <N> Commit with N-second auto-revert window (1-3600)
confirm Make a pending confirmed commit permanent
confirm abort Roll back a pending confirmed commit immediately
rollback <N> Restore revision N
top Navigate to config root
up Navigate up one level
edit <path> Navigate into a section
exit Exit editor

Other Config Subcommands

Command Description
ze config validate <file> Validate configuration file
ze config migrate <file> Convert ExaBGP config to ze format
ze config fmt <file> Normalize formatting (output to stdout)
ze config dump <file> Dump parsed config as JSON tree
ze config diff <a> <b> Compare two config files
ze config diff <N> <file> Compare rollback revision N against current
ze config set <file> <path> <value> Set a single value programmatically
ze config history <file> List available rollback revisions
ze config rollback <N> <file> Restore revision N
ze config archive <name> <file> Archive config to named destination (details)
ze config completion <file> Query YANG completion engine (debugging)

Every <file> above accepts - for stdin. The read-modify commands ze config set, ze config deactivate, and ze config activate become pipeline stages when given -: they read the config from stdin, apply the change, and emit the modified config to stdout instead of writing back, so they compose (ze config show - | ze config set - bgp session asn local 65001). ze config edit -, ze config rollback <N> -, and ze config history - are rejected with a clear error: an interactive editor needs a TTY, and rollback/history need on-disk revision history that a piped config does not have.

Editing Modes

The editor operates in one of two modes depending on the storage backend.

File mode (ze config edit -f or when no zefs database exists): the editor works directly on a config file. commit writes the full configuration tree to disk. All operations (set, delete, load) modify the in-memory tree and the commit serializes the result. This is the simplest path: no change tracking, no conflict detection, no draft files.

Session mode (zefs blob store): each editing session gets an identity (user@origin%timestamp) and a per-user change file that records every edit with metadata (who, when, previous value). commit applies only the current session's tracked changes to the committed config, enabling concurrent multi-user editing with conflict detection, blame, and crash recovery. See the concurrent editing reference for the full protocol.

Some commands are not yet supported in session mode because they replace the tree wholesale and cannot be expressed as tracked change entries. These return an error when attempted:

Blocked command Reason
load Replaces tree without generating per-leaf change entries
copy Creates structure without write-through
insert Creates structure without write-through
deactivate Requires metadata write-through
activate Requires metadata write-through
commit confirmed Needs session-aware rollback
commit force Needs session-aware rollback

Use file mode (ze config edit -f) for these operations.

Feature File mode Session mode (zefs)
Commit Writes full tree Applies tracked changes
Multi-user
Conflict detection Live and stale
Blame / authorship
Crash recovery .edit file Change files + draft
Draft / discard path

YANG Completion

Tab completion is driven by registered YANG schemas. The editor suggests: - Valid config keys at the current level - Enum values for leaf nodes - Address family names from registered plugins

Commit Confirmed

commit confirmed <seconds> writes the configuration and notifies the daemon, but starts a countdown timer. If confirm is not issued before the timer expires, the configuration automatically reverts to the previous version. This prevents lockouts when making changes remotely -- if a bad config breaks connectivity, the auto-revert restores access.

Step What happens
commit confirmed 60 Config saved, daemon notified, 60-second timer starts
Verify the change works BGP sessions come up, routes propagate, etc.
confirm Timer stops, config is permanent
or confirm abort Config reverts immediately
or timer expires Config reverts automatically

The seconds parameter accepts values from 1 to 3600 (one hour).

Replayable Ze terminal lab

Watch an unconfirmed change roll back

Commit a hostname change in the interactive editor, leave the confirmation window unanswered, and verify Ze restores the previous configuration.

Reproducible
Ze 26.07.181 minute 31 secondsmacOS and LinuxTerminalVHS 0.11.0 Plain-text transcript
Read the demonstration transcript
$ ze config edit -f ze.conf
ze# show system host
host edge-original
ze# set system host edge-trial
ze# show | compare
ze# commit confirmed 8
Committed. Confirm within 8s or auto-revert. Use 'confirm' or 'confirm abort'.
ze# show system host
host edge-trial
Timeout: configuration automatically rolled back.
ze# show system host
host edge-original

ze# set system host edge-confirmed
ze# commit confirmed 8
Committed. Confirm within 8s or auto-revert. Use 'confirm' or 'confirm abort'.
ze# confirm
Configuration confirmed and saved permanently.
ze# show system host
host edge-confirmed

The first change is left unconfirmed and rolls back. The second receives `confirm`; after waiting beyond the same deadline, the editor still reports edge-confirmed.

Rollback

The editor automatically saves a rollback revision before each commit. Inside the editor, use show | history to list revisions and rollback <N> to restore. From the shell: ze config history <file> and ze config rollback <N> <file>.

Exit Codes

Code Meaning
0 Success
1 Configuration has errors (from validate command)
2 Error (file not found, parse failure)

Example Workflow

ze config validate config.conf      # Pre-flight validation
ze config edit config.conf          # Interactive editing
ze config diff 3 config.conf       # Compare with revision 3
ze config rollback 3 config.conf   # Restore revision 3
ze config archive prod config.conf # Archive to named destination