Skip to content

editor workflow

Thomas Mangin edited this page Nov 15, 2026 · 12 revisions

Pre-Alpha. This page describes behavior that may change.

The config editor is the piece of Ze that turns "edit a text file and hope" into the network-OS workflow operators actually expect. You edit in a draft session, you run diff to see what you are about to change, you commit now atomically, and you rollback if you were wrong. commit confirmed is the safety net for changes that might lock you out.

This page covers the operational workflow: the commands, the draft-session model, the five operations, and the rollback story. The underlying YANG model is on YANG model. The archive story (how every committed config is kept) is on Archive and rollback.

Starting the editor

ze config edit                      # Edit the default config
ze config edit myconfig.conf        # Edit a specific file
ze config edit --backup ze-backup.zefs          # Edit a config inside a backup artifact

The editor starts an ephemeral Ze instance in the background that serves the schema validators and the completion engine. You do not need a running daemon to edit a file, and the background instance terminates when the editor exits.

Inside the interactive shell (ze cli), the editor runs against the live tree instead of a file. The draft lives in the daemon. The console that ze start --cli attaches to the daemon it starts opens at the operational prompt, and configure enters the same editor there; a commit now reloads the running daemon, as it does over SSH.

Backup mode. ze config edit --backup <artifact> [config-name] edits a config inside a backup artifact (the .zefs file ze data backup or request data backup wrote) with no daemon at all. The session has its own identity, draft and history, all kept inside the artifact, and a commit publishes a new version into it; the status line ends in "and published". ze data restore <artifact> config then applies the edited config to a device. The editor holds a <artifact>.lock sidecar for the whole session, so a second --backup command on the same file is refused. --backup cannot be combined with -f, --web or --insecure-web. ze config show, diff, set and list take the same flag. See Backup and restore.

To inspect a config that is not on disk, pipe it in: show config dump - reads the configuration from stdin, for example ze cli -c "show config dump - | json" < router.conf.

The draft-session model

Every user gets their own draft on top of the committed tree. You can disconnect, come back, and pick up where you left off. Other users see their own drafts and the last committed version. They do not see yours.

A draft is cheap. You can abandon it with discard if you change your mind. You can edit half a change, leave it open, and come back to it the next day. The editor persists the draft state between sessions.

The five operations

set and delete

ze[bgp peer upstream]# set timer hold-time 180
ze[bgp peer upstream]# delete md5-password

set writes a leaf value, delete removes one. Both validate against the YANG schema at the time of the command. If the value is invalid (wrong type, out of range, pattern mismatch), the command returns an error immediately and the change does not enter the draft.

set also creates missing containers and list entries on the way in. set bgp peer new-peer remote ip 10.0.0.1 creates the peer if it does not exist. delete walks back out: removing the last leaf of a container removes the container.

show

ze# show bgp peer upstream
peer upstream {
    connection { remote { ip 10.0.0.1; } }
    session    { asn { local 65000; remote 65001; } }
    timer      { hold-time 180; }
    ...
}

show without arguments prints the whole tree. show <path> prints one subtree. It prints the committed tree plus your draft changes applied, which is usually what you want: you see what the config would look like if you committed right now.

List entries print in the order the configuration records, not alphabetical key order. show, the set view, annotated and blame views, ze config fmt, and the web CLI use the same order. Copying an entry places the copy immediately after its source; renaming an entry keeps its position.

diff

ze# diff
+ bgp peer upstream timer hold-time 180
- bgp peer upstream timer hold-time 90

diff shows your draft against the committed tree. Additions are prefixed with +, removals with -, changes are shown as a remove plus an add. This is the command you run every time before you commit, because it is the one that catches "wait, I did not mean to touch that".

diff and show changes include the structural operations of the draft: a deleted list entry, a deleted container, a deleted list, a rename, an insert at a position, and a deactivate or activate. These live only in the per-user change file, not in the value tree, and on a blob-backed store they were previously invisible: the diff read empty while the operation still applied at commit. Both surfaces now read the same change file whichever backend holds it.

A leaf the schema marks as holding a secret is masked wherever it is displayed. diff reports a rotated credential as changed and shows neither the old value nor the new one. ze config show, ze config dump, the annotated view, the search results, and the blame view all mask the same set. One predicate answers the question for every surface, so a value one command hides is never published by another.

show | compare omits unchanged entries, except for context within a reordered ordered-by user list. A reorder alone is ignored for a plain list. For a list declared ordered-by user, such as firewall terms, moving an entry is a change: compare shows a removal at its old position and an addition at its new position. ze config diff also reports these ordered-list changes, including in files without a BGP block. Committing a plain-list reorder still saves the new display order even though compare is empty.

commit

ze# commit now
Commit successful.

commit always takes a subcommand. A bare commit, a bare force, or an unknown word is refused with the list of subcommands, so a typo never applies a configuration. The SSH editor, ze config edit and the web terminal share this grammar.

Subcommand Effect
commit now Validate, apply, and notify the daemon.
commit now force Commit even though validation reports warnings. force never commits over an error.
commit confirmed <N> Commit with an N-second auto-revert window (see below).
commit accept Make a pending confirmed commit permanent.
commit abort Roll back a pending confirmed commit immediately.
commit verify Validate the candidate and apply nothing.

With nothing pending, commit now answers "no changes to commit" and applies nothing, and commit confirmed <N> opens no window, because a window over no change would revert nothing.

A refused commit says on the status line how many errors and warnings block it. When only warnings block it, that line names the forced form of what you typed, and a forced commit reports how many warnings it skipped. The viewport shows the same header, then each issue on its own indented lines: the problem, why, and a fix: line you can type where you are. At the root the fix is set <full path> <value>; inside an edit context it is top set <full path> <value>, which works from any position. A refused member of a leaf-list gets delete <path> <member> instead, and a missing mandatory leaf names its set the same way. commit confirmed validates its candidate first and shows the same corrections. A commit refused because of an API-supplied value keeps that value and your other pending changes, and a stored candidate holding an invalid value stays readable and editable, so you repair it without discarding. show | errors runs the same checks on the current candidate, with line numbers referring to the hierarchical view, and applies nothing; run it again after a repair. Inline validation hints follow the highlighted configuration line rather than replacing it.

commit now runs every validator on the draft, applies the draft atomically to the committed tree, notifies every subsystem of the change, and writes an archive revision. If validation fails, the commit is rejected and the draft stays as it was. If application fails (which is rare, because the validators caught the common cases), the change is rolled back and the commit is rejected.

The whole-config validator (the cross-peer checks, for example) runs on the exact tree the commit is about to write: the committed config plus this session's changes. It does not check the shared draft instead, which can hold another session's saved but uncommitted edits, so the bytes that were checked and the bytes that land are one config. This holds for the web editor too.

A weak password is set, never refused. When a commit sets a plaintext-password shorter than 8 characters, or one of the handful of passwords an attacker tries first, the commit succeeds and its status line carries (warning: ...) naming the leaf and the rule. The warning never carries the password. See System: users and SSH.

Commit is atomic at the tree level. Either the entire draft applies or none of it does. You cannot land a half-applied config.

Refused values

A set or insert the schema refuses (a value outside an enumeration, a range, a length or a format), and a rename or copy whose new key the list refuses, names the setting path, lists what the leaf accepts, proposes the closest value when one is close, and ends with the command you typed, corrected, in the form you typed it: relative inside an edit context, and behind top when you typed it behind top. A range gives its bounds and a pattern its format in words, never a regular expression. Inside edit bgp peer peer1, a mistyped set session capability route-refresh requre ends with:

fix: set session capability route-refresh require

A refusal of several lines is shown whole in the viewport, and the line above the prompt keeps its first line. The web terminal and the web CLI bar give the same text. An offline ze config set <file> ... refuses an invalid value or a new list key before it writes the file, exits 2, and prints the same refusal on stderr, ending with the corrected set from the root.

Quoting

Command input in the SSH editor, the web terminal and the web CLI bar uses the config token codec. Double-quoted words decode \", \\, \n, \r and \t. Single-quoted words keep their contents raw, so 'C:\Users\test' keeps each backslash; the double-quoted form is "C:\\Users\\test". A quoted "|" is a literal key or value, while a bare | starts a pipe: show | match "|" shows only the lines holding a literal pipe. Printed fixes keep these boundaries, including behind top, so a group named "edge routers" keeps its name when you type the proposed correction.

Under the hood, a commit is a transaction over three named pointers: active (the config the running daemon considers live), candidate (the version staged for the in-flight commit), and rollback (the previous active version). The commit writes the proposed config as an immutable versioned blob, sets the candidate pointer, runs the per-plugin verify and apply phases, and only promotes candidate to active once the full subsystem reload succeeds. If any plugin rejects or the reload fails, the candidate is discarded and active is left untouched, so the running config never reflects a partial apply. A stale candidate left by a crash is ignored on the next boot, which loads active. See Archive and rollback for the persistence side of these pointers.

rollback

ze# rollback 1
Rolled back to revision N-1.

rollback <N> restores the tree to N commits ago. rollback 1 is "undo the last commit". rollback 5 jumps back five commits. The archive keeps every committed version and show archive lists what is available. See Archive and rollback for the archive model.

Editing list entries

Beyond set and delete, the editor has four verbs for manipulating list entries and ordered leaf-lists: insert, rename, copy, and the pair deactivate / activate.

insert for ordered leaf-lists

ze# insert bgp peer upstream filter import rpki:validate first
ze# insert bgp peer upstream filter import reject-bogons before rpki:validate
ze# insert bgp peer upstream filter import aspath:prepend last
ze# insert bgp peer upstream filter import community:scrub after rpki:validate

insert places a value into an ordered leaf-list at a specific position. The four position tokens are first, last, before <ref>, and after <ref>. Positions that reference a value not in the list are rejected.

Ambiguity gotcha. A value literally named first, last, before, or after collides with the position keywords. Quote the value if you are inserting one of those.

The canonical use case is the filter chain on a peer (see route filters), but the verb works on any YANG leaf-list marked as ordered.

rename for list entries

ze# rename bgp peer old-name to new-name

rename changes the key of an existing list entry in place, keeping every leaf and every child container attached, and preserving the entry's position in the list order. The syntax is JunOS-style: rename <path> <old-key> to <new-key> — the to keyword is mandatory and fixes ambiguity when a list key is literally to.

rename rejects attempts to overwrite an existing entry: if new-key already exists, the command fails and the draft is unchanged.

Note that rename is a config-tree operation. What happens to runtime state (session state, statistics) on a live peer is up to how the reactor reconciles the post-commit config against the running peer set — do not assume the daemon treats the post-rename peer as identical to the pre-rename one. Use rename during preparatory config edits, not as a way to rename a session mid-flight.

copy for list entries

ze# copy bgp peer template-peer to new-peer

copy is the mirror of rename: it creates a new list entry at <dst-key> that is a deep copy of <src-key>, leaving the source intact. Useful for spinning up a new peer off a template without retyping every leaf. Same to keyword syntax as rename.

deactivate and activate

ze# deactivate bgp peer special filter import no-self-as
ze# activate   bgp peer special filter import no-self-as

deactivate marks a specific value in a leaf-list as inactive, without removing it. The result in the committed config is the value with an inactive: prefix. activate clears the prefix. Neither verb reorders the list.

The main use is suppressing a default filter on one peer without disturbing its order in the chain — see route filters — deactivating a default filter.

Commit confirmed

ze# commit confirmed 60
Commit applied. Auto-rollback in 60s if not confirmed.

ze# commit accept           # Make the change permanent before the timer fires
ze#

commit confirmed <N> applies the change and starts a rollback timer. If you do not type commit accept within <N> seconds, Ze reverts the change automatically. <N> accepts values from 1 to 3600.

This is the safety net for changes you suspect might lock you out. Tightening authentication on the peer you are connected through. Restricting the SSH listener to a specific source IP. Rewriting firewall rules. If the change kills your connection, you wait, the timer fires, Ze reverts, and your connection comes back.

commit abort rolls back a pending confirmed commit immediately instead of waiting for the timer.

In an SSH session editor or the web editor of the daemon's own configuration, the daemon owns the window, not your session. Closing or losing the session leaves the countdown running. The window belongs to the user who opened it: from any session as that user, commit accept and commit abort answer it. While it is open, commit now and a second plain commit confirmed are refused, every other user's commit verbs are refused with "A confirmed commit by is pending: s left.", and the other config writers (a REST, gRPC or gNMI config session, request data restore of the daemon's config, update bgp config, the web raw-source editor, a managed hub push, and rollback <N> in a session editor) are refused for every user, because the revert would wipe what they wrote. Inside your own window, commit confirmed <N> force applies your new changes and restarts the countdown at <N>, counted from when they have applied; the revert still restores the configuration from before the first commit.

The daemon's countdown starts when the commit has applied, not when you typed it: validating and reloading a large change can take a while, and that time is not taken from your <N> seconds. A commit whose apply met a Ze defect keeps the deadline it was given before the apply began, so a part-applied commit reverts no later than the countdown you asked for.

The open window is recorded in the store before the commit applies, so no commit is applied without its revert. Once the commit has applied, the record is saved again with the deadline the countdown started at. If that save fails, the commit stays applied and its window stays open and counting down, the record saved before the apply still makes a restart revert the commit, and the commit answers with the store's error and says to run commit accept or commit abort. The SSH session editor and the web editor report such a commit as committed, with its countdown, and show that answer after it as one warning on the same line: the advice first, then the store's error. A daemon that stopped during a window reverts it when it starts. ze config rollback <N> <file> from the shell refuses while such a window is recorded and names ze start <file> to revert it first.

File mode (ze config edit -f) keeps the countdown in the editor itself, with the same nested commit confirmed <N> force form.

The command reference

Full list of editor commands:

Command Description
set <path> <value> Set a configuration value.
delete <path> Delete a value or a subtree.
insert <path> <value> <position> Insert into an ordered leaf-list at first, last, before <ref>, or after <ref>.
rename <path> <old-key> to <new-key> Rename a list entry in place, preserving all children and position.
copy <path> <src-key> to <dst-key> Deep-copy a list entry to a new key.
deactivate <path> <value> Mark a leaf-list value as inactive (adds inactive: prefix).
activate <path> <value> Re-activate a deactivated leaf-list value.
show Display the current configuration.
show <path> Display a specific subtree.
diff Show uncommitted changes.
show | changes [all] Pending changes (this session, or every session).
show | errors Validation issues of the current candidate.
commit now Apply the draft.
commit now force Apply over validation warnings (never errors).
commit confirmed <N> Commit with an N-second auto-revert timer (1 to 3600).
commit accept Make a pending confirmed commit permanent.
commit abort Roll back a pending confirmed commit immediately.
commit verify Validate and apply nothing.
rollback <N> Restore revision N.
top Navigate to the tree root.
top <command> Run one command as if at the root, and stay where you are unless the command moves you.
up Navigate up one level.
edit <path> Navigate into a subtree.
discard [all | <path> [<member>]] Throw away your pending changes, all of them or under one path.
exit Exit the editor.

Help at the prompt

Every command carries two help texts: a one-line summary shown in the completion menu, and a longer explanation. Tab and ? reach both.

Key What it shows
Tab, with more to complete Completes the command. Two candidates or more open the menu
Tab, with nothing left to complete The command's long explanation, in a box above the prompt
?, with a candidate highlighted That candidate's long explanation, in the same box. The menu stays open
?, on a config key in configuration mode The key's whole YANG description
?, with no candidate highlighted Completes, as Tab does

A command that declares no explanation says so: <command>: no explanation is declared.

A usage line shows a group where you must pick exactly one member as an alternation in round brackets, not as a row of optional square-bracketed words. The flowspec traffic action is the first: community, rate-limit and discard are three spellings of one choice, and the usage line says you supply exactly one.

The prompt reflects the current edit context: ze[bgp peer upstream]# means you are inside bgp/peer[name='upstream'], and set commands operate relative to that context.

Pasting a block of commands

The config commands of one session run one at a time, in the order you entered them. Paste a block of set lines followed by commit now over SSH and every set lands before the commit reads the draft. Nothing is dropped and nothing is refused for being too quick: each command waits for its turn instead of racing the one before it.

Draft conflicts

When two users edit the same leaf in parallel, the second commit detects the conflict and reports it. The conflict report names the path and shows both values. The user resolves the conflict (by accepting one of the two values, or by setting a third) and tries again.

Conflict detection happens at commit time, not at edit time. You can have an active draft on the same leaf as another user for as long as you like. The conflict only matters when you try to apply your draft.

There are two kinds of conflict. LIVE means another user has a pending change on the same path. STALE means a value was committed after you made your change. commit now is refused on either. A STALE conflict on a leaf-list member names your change (deactivate, activate or insert of that member) and follows it with a fix: line; discard <path> <member> drops your change to that one member and keeps your other edits pending.

commit now force applies your change anyway. Each pending change of another user that it overrides is removed from that user's change file, or from the shared draft when they had already saved it, and nothing else of theirs is touched. Every editor session of theirs, SSH or web, is told once: "Your change at was discarded by 's forced commit". The notice stays on disk until each of their sessions has shown it, and the log keeps their 64 newest discards. Validation errors still block a forced commit. If the commit applies but the discard fails, the answer says so with the cause: "commit applied, but the changes it overrode were not discarded and stay pending for their owners".

discard <path> drops your pending changes at or under a path and keeps every other change, and discard all drops every change of this session. In an editing session a bare discard is refused and names both forms. Without an editing session, a bare discard drops every change, and discard <path> puts back the committed content at the path, or removes what the path holds when the committed config has nothing there. A path holding none of your changes is refused with the command that lists them (show | changes).

Running one command from the root

top <command> runs any command the editor accepts once, with the position at the root, then leaves you where you were. Inside edit bgp peer peer1, top set bgp router-id 192.0.2.9 sets the root path, top show displays the whole configuration, and top show | errors lists every issue. Only a command that moves you keeps its move: top edit bgp goes to bgp. top run <cmd>, top exit, top clear, top stop and top restart do what they do without top, and top load terminal relative merge pastes at the root. History keeps the line as you typed it, and completion after top offers what the root offers. It works in the SSH editor and ze config edit. The help overlay, Tab completion and ze config edit --help read one command table, so their wording for a command is the same.

Importing a config file

ze config import router.conf
ze config import --name edge-01.conf ./edge.conf

ze config import lands a file in the store as a new active version, the previous one kept for ze config rollback. A name is a plain config name: not ., .., a path or -. While a running daemon owns the destination store, the import goes through that daemon. The name checks and the confirmation run first, over a reader of the store. Every input is then read and encoded before anything is sent, so an unreadable input, or one over 195,840 bytes (the most one command carries), stops the import with nothing sent; restore a larger config with request data restore path <file> config on the daemon's host. Each input goes to the daemon as update data config name <name> content <base64>: the daemon stages its own config and reloads, accepting it only when the reload does, or commits another name as a new version. The command prints the same imported or replaced lines and file count. The first refusal ends the import with the daemon's reason and fix, leaving the inputs before it imported. When no daemon answers, the command keeps the store's refusal, says why the daemon did not answer and names the fix. --dir naming a store no daemon owns stays offline.

Offline, an import into a config whose commit confirmed window a stopped daemon left open is refused, as ze config rollback is, naming ze start <config>: that daemon's next start reverts the commit and would undo the import. Backup and restore covers update data config and its refusals.

A newly created list entry is a pending change even when it holds no leaves, so an empty dummy interface survives save and commit without a placeholder leaf. Renaming and copying entries keep your pending child edits and their order, and string keys containing spaces or # keep their boundaries through save, rename, copy, commit and discard.

Web UI equivalence

Everything described above is available in the web UI too. The Finder-style column browser is the edit/up/top/show part. The pending-changes bar is diff. The Review and Commit button is commit now. The SSE notification banner is the multi-user awareness. The model is identical because both surfaces drive the same underlying editor.

See also

Adapted from main/docs/guide/config-editor.md.

Home

About

First Steps

Configuration

Operation

Interfaces

Plugins

Plugin Development

Chaos Testing

Blueprints

Development

Reference

Clone this wiki locally