Feature

CLI Commands

Every command starts with its verb

show, clear, monitor, request, set, and delete are the six verbs. The words after the verb are the YANG path. A bare form with no verb is not in the command tree, and the dispatcher answers unknown command for it. daemon reload is now request reload, daemon status is show status, daemon quit is request halt, daemon shutdown is request shutdown, and bgp summary is show bgp.

stop, restart, and reboot retain their bare SSH exec spelling as controls. The adapter sends their canonical request shutdown, request restart and request reboot commands through the authenticated session executor. Interactive stop/restart controls require confirmation before that same dispatch.

Every subcommand of ze show, ze clear, ze monitor, ze request, ze set, and ze delete resolves against the daemon's own registrations. The verb-relative tree is built from the same registration set the dispatcher is keyed on, so the client and the daemon cannot disagree about which words are a command.

A local in-process handler is refused for any argv that reaches a declared command below it. show interface is registered at two words and takes an interface name, so brief, scan, type, errors, rate, and the two name <name> ... forms all go to the daemon rather than being read as interface names.

Peer selectors on a destructive command

One resolver answers the peer selector for every peer-scoped command. It accepts a name, an address, an ASN (as65001), or a prefix, so a selector that works on one verb works on all of them.

A command that acts on ONE peer refuses a wildcard (* or empty), refuses an exclusion selector (!edge1, !as65001, !10.0.0.0/24), and refuses a selector that matches more than one peer. It never guesses which peer was meant. An unresolvable selector is an error with the selector quoted, rather than a no-op reported as success. A show command that narrows a list still accepts an exclusion, because a complement is a good answer when the command filters rather than acts.

Positional arguments

Every declared argument kind takes part in positional matching, typed kinds included, and mandatory definitions are offered a token before optional ones. A uint16 port no longer skips its token and then fails with required argument missing, and an optional string can no longer starve a required argument of its value. One spare token becomes the peer selector when the command declares that it requires one, no selector arrived out of band, and exactly one token is spare, which is what makes delete bgp peer 127.0.0.1 work, and create bgp peer 127.0.0.1 asn 65001 with it: the keyword-value pairs are consumed first, so the address is the one token left over.

A SECOND fault in the tail (a keyword with no value, a value its leaf refuses, a word no leaf takes) leaves the selector unbound, and the answer names that fault: create bgp peer 192.0.2.7 asn 65002 router-id says router-id requires a value. The selector guard speaks only when the selector is the one thing missing. A line with several faults is refused once, with each fault on a line of its own and the fix last, so fixing the first fault does not lead to a second refusal for the next one. Each mandatory argument the line leaves out is one of those faults, named with the words that supply it, so create bgp peer alone is told both that the selector and that asn are missing, and, because nothing else is wrong, is given the whole command to type:

this command has 2 faults, so Ze did not run it
Ze runs a command only when every word of it is valid, and each line below is one fault:
- create bgp peer requires a selector: create bgp peer <selector> (Address of the peer to create)
- required argument missing: asn, as in 'asn <asn>'
fix: create bgp peer <selector> asn <asn>

Every route gives the same fix: a plugin's command, a subsystem's, and a command answered in the ze process itself (ze <verb> writes the command with its ze prefix). A single missing mandatory argument follows the same correction path, without a count of faults:

required argument missing: asn
This command needs asn: The value is 1 to 4294967295, in asplain or asdot notation. Ze stores the
decimal form whichever notation you typed. AS 0 is refused, because RFC 7607 reserves it.
fix: create bgp peer 192.0.2.7 asn <asn>

A line with a fault in a word it typed keeps the general fix:

this command has 2 faults, so Ze did not run it
Ze runs a command only when every word of it is valid, and each line below is one fault:
- invalid value "x", expected unsigned integer
- router-id requires a value: it is the last word, so nothing follows it to read as its value; write the value right after the keyword, as in 'router-id <router-id>'
fix: correct each fault listed above, then type the command again

A value that sits BETWEEN two keywords reaches the leaf the model anchored to the first of them. A leaf declared on a grouping container carries that container's name. That name is the word the operator types the value after, so send bgp <selector> unicast <prefix> binds the selector and leaves the prefix to the handler. The shape-based fallback stays for a command that anchors nothing, and both refuse ambiguity: two candidates name none.

A command declares what its answer holds

A command declares whether its answer holds rows or one document, and which of its fields hold an IP address. The CLI refuses an operator that declaration cannot support, by name, before the command runs:

show bgp rib status | count
count cannot apply here: this command answers one document, and count acts on rows

ze help command "<path>" --json lists the operators a declared command supports, and it reads the same declaration, so the published list and the runtime cannot disagree. | resolve and | origin are listed only where the command declares a field that holds an address.

Every show bgp command declares one. Go compiled into the daemon declares twenty paths. A plugin process declares the other eleven in its startup message: six under show bgp rpki, two under show bgp rs, two under show bgp adj-rib-in, and show bgp healthcheck. An undeclared command still refuses what it cannot support, from the answer it has in hand, after it runs. No operator selects one list out of an answer that holds several, so that refusal names the route the CLI does offer: a row operator placed after | text acts on the rendered lines.

match needs rows, and this answer has none: it holds several lists (edges, nodes)
no pipe operator selects one of these lists, but after '| text' match acts on the rendered lines instead
fix: | text | match peer/upstream

Protocol Tools

Command Description
ze bgp decode Decode BGP message from hex to JSON
ze bgp encode Encode text route command to BGP wire hex

Configuration Management

Command Description
ze config validate <file> Validate configuration file
ze config edit Interactive configuration editor
ze config migrate Rewrite a config in the set or hierarchical form
ze config fmt Format and normalize config file
ze config dump Dump parsed configuration tree
ze config diff <a> <b> Compare two configuration files
ze config set Set a configuration value programmatically
ze config import Import a configuration file into ze
ze config rename Rename a configuration element
ze config archive <name> Archive config to a named destination (guide)
ze config history List rollback revisions
ze config rollback <N> Restore revision N

ze config diff compares every root of the two configurations: the bgp block as resolved values after template expansion, every other root as written (for example, ~ plugin/hub/client/edge-01/host: 10.0.0.1 -> 10.0.0.2). It also reports entry-order changes for every YANG ordered-by user list, including nested lists outside BGP. Plain-list reorder alone reports No differences. Comparisons need no BGP block. Ordered sequences use the existing @<list-name> metadata key at their full config path: text shows, for example, ~ firewall/table/wan/chain/input/@term: [b a] -> [a b]; JSON puts that path under changed with old and new arrays. Inserting or deleting entries changes the sequence too; adding or removing the whole list uses added or removed. Files, stored sources and rollback revisions use the same comparison, and changed secret values remain masked in both output shapes.

Interactive ze config edit and ze cli run their models in the daemon over SSH. The daemon owns their drafts, commits, and command history. A named stored config selects that config, not another config with the daemon's active path. Invalid or missing selections are refused.

ze config edit -f <file> edits a loose file offline. It does not bypass an active writer's store lock. For a running daemon, omit -f.

Schema Discovery

Command Description
ze schema list List all registered YANG schemas
ze schema show <module> Show YANG content for a module
ze schema handlers List handler→module mapping
ze schema methods [module] List RPCs from YANG modules
ze schema events List notifications from YANG
ze schema protocol Show protocol version and format info

Daemon Control

Command Description
ze <config-file> Start daemon with configuration
ze signal reload Send SIGHUP and reload configuration
ze signal stop Graceful shutdown (no GR marker)
ze signal restart Graceful restart (writes GR marker, then shuts down)
ze signal status Dump process status (SIGUSR1 equivalent)
ze signal quit Send SIGQUIT, dump goroutines, and halt
ze status Check if daemon is running

Each ze signal subcommand sends one SSH exec command to the daemon. reload sends request reload, status sends show status, and quit sends request halt. stop, restart, and reboot keep their bare spelling on the SSH wire; the adapter maps them to the canonical lifecycle request before authorization, accounting and response completion.

Runtime Interaction

Command Description
ze cli Interactive CLI (with -c <cmd> for single command)
ze show <command> Read-only daemon commands

Ping and traceroute: show ping and show traceroute run one-shot ICMP checks from the router itself using ze's internal engine -- no daemon required, they work as local handlers. monitor ping and monitor traceroute open a live, continuously-updating view (Ctrl-C to stop); pipe either through | log for scrollback, or add | resolve / | origin to enrich traceroute hops with reverse DNS or ASN info. size sets the ICMP payload length (1-65507), not the total packet: unlike ping(8)'s "64 bytes" (56 payload + 8 header), size 1400 sends 1400 payload bytes on top of the ICMP and IP headers. Both show ping and monitor ping take count (1-100) and size; omitting count on monitor ping is what makes it stream until Ctrl-C, and it additionally takes interval (100ms-30s).

ze show ping 8.8.8.8 count 5 timeout 3s
ze show ping 8.8.8.8 size 1400
ze show traceroute 8.8.8.8 max-hops 10 probes 1
ze cli -c "monitor ping 8.8.8.8 interval 500ms"
ze cli -c "monitor ping 8.8.8.8 count 5 size 1400"
ze cli -c "monitor traceroute 8.8.8.8 | log | resolve"

Live peer dashboard: monitor bgp in the interactive CLI opens a live dashboard showing router identity, a sortable colour-coded peer table with update rates, and a drill-down detail view. It refreshes every second. Use j/k to move, s/S to sort, Enter for detail, and Esc to exit. The state column renders green for established, yellow for the transitional states, and red for stopped, idle, and idle-hold. idle-hold is the state a prefix limit leaves a peer in when the family that overflowed asked for no reconnect, so it needs an operator and is coloured like the other down states.

Ze terminal lab

Operate BGP from the live dashboard

Connect to Ze over SSH, open the live BGP dashboard, sort peers, and inspect one session.

Reproducible
Ze 26.11.2037 secondsmacOS and LinuxTerminalZe recorder Plain-text transcript
Read the demonstration transcript
$ ssh ze-demo
ze# exit
ze> monitor bgp

The dashboard polls three local BGP sessions. Press "s" to sort by the next column, use the arrow keys to select a peer, and press Enter for live session details. Press Escape to return and "q" to leave the dashboard.

Commit confirmed: The editor supports commit confirmed <seconds> for safe remote changes. The config is applied immediately but auto-reverts if commit accept is not issued within the timeout window (1-3600 seconds). Use commit abort to revert manually. A plain commit is commit now; commit verify validates without applying. Modeled after Junos commit confirmed.

Command history persistence: Both ze config edit and ze cli persist command history to the database/ store. History survives graceful session close and application restarts, is stored per-mode (config vs operational) and per-user, with consecutive dedup and a configurable rolling window (default 100, max 10000). Accepted commands are immediately browsable; storage publication runs on one session-owned worker rather than blocking input, timers or command results. Waiting whole snapshots coalesce to the newest for each mode. Graceful model shutdown drains them before releasing the store; abrupt process death can lose queued history. With no store, history stays in memory. This does not change draft, configuration or commit durability, and independent sessions retain their existing whole-snapshot overwrite behavior rather than merging histories. The SSH model owner's Server.Stop waits for admitted model cleanup before its caller may release the store, including disconnected channels. Its network shutdown timeout does not discard accepted history. Concurrent terminal channels on one SSH connection each close their own model. The daemon retains hook-built SSH through the plugin server's OnStop callbacks. runYANGConfig owns one immediately deferred sync.OnceFunc stop, so normal shutdown and startup failure both join SSH cleanup before its caller releases the store. Hook admission seals and joins an in-flight constructor; callback order does not matter.

History publication failures reach the model's close error. The latest completed write outcome is retained separately for each mode; a successful later write clears that mode's failure. Configuration and operational recall follow the same eligibility policy on browser and SSH entry: automatic configuration entry records under configuration mode, while mode/exit and lifecycle controls do not add entries. Browser HTTP adapters use the same History producer and keys, with bounded owners that survive editor discard; independently opened SSH and browser owners keep the documented whole-snapshot overwrite behavior.

Login warnings: When an operator connects via SSH, ze checks for conditions requiring attention and displays warnings in the welcome area. Each warning includes a message and an actionable command. Currently checks for stale prefix data (peers with prefix-updated older than 6 months); run update bgp peer * prefix to refresh from PeeringDB.

Plugin debug shell: ze bgp plugin cli connects to the daemon via SSH, runs the 5-stage plugin handshake, and enters interactive command mode. Developers can test plugin protocol interactions by hand -- sending dispatch-command, subscribe-events, decode-nlri, etc. Accepts defaults (Enter through Q&A) or custom registration parameters (families, plugin name).

Other

Command Description
ze plugin <name> Run a registered plugin
ze exabgp plugin Run ExaBGP plugin with ze bridge
ze exabgp migrate Convert ExaBGP config to ze
ze completion bash/zsh/fish/nushell Generate shell completion scripts
ze show plugin list List the plugins compiled into this binary