Repository navigation
gnmi
Pre-Alpha. This page describes behavior that may change.
Ze includes a gNMI (gRPC Network Management Interface) server that exposes the YANG-modeled configuration over the industry-standard gNMI protocol. This lets tools that speak gNMI manage Ze, including gnmic, Ansible, and network controllers.
The server is gated by an environment variable (ze.gnmi.enabled), disabled by default, and listens on port 9339 by default.
Enable via environment variables or YANG config.
Environment variables:
ze.gnmi.enabled=true
ze.gnmi.listen=0.0.0.0:9339
ze.gnmi.token=your-secret-token
YANG config (under environment):
environment {
gnmi {
enabled true;
token your-secret-token;
server default {
ip 0.0.0.0;
port 9339;
}
}
}
| RPC | Description |
|---|---|
| Capabilities | Returns supported YANG models, encodings (JSON and JSON_IETF), and gNMI version. |
| Get | Reads config state from the running tree by path. |
| Set | Applies config modifications atomically (update, replace, delete). Uses segment-based paths that preserve IP list keys. |
| Subscribe ONCE | Snapshot of current config for the requested paths. |
| Subscribe STREAM | Continuous change notifications from gNMI Set and external commits. |
A leaf the YANG model marks ze:sensitive (a BGP MD5 password, a TACACS+ or RADIUS shared key, the gNMI token) never reaches a client in clear. Get, Subscribe ONCE and the STREAM notification that echoes a Set all carry it in its reversible $9$ form, the form ze config fmt and the CLI write to the config file. The echo goes to every subscriber, so the key one client sent is never shown to another.
Set accepts a sensitive value either in clear or in the $9$ form a Get returned. A $9$ value is decoded to the key the daemon uses, and the config keeps the $9$ text exactly as written, so a value read with Get and sent back with Set leaves the config file unchanged.
An update the session refuses (a path the schema does not hold, a list key outside its type) ends the Set with status InvalidArgument, and nothing it carried is applied. The message is the refusal Ze prints on every surface, so its last line is the fix.
A value the schema refuses (outside an enumeration, a range, a length or a format) is refused when the Set commits: the status is Aborted, the message starts commit: config validation failed:, and each refusal follows as its own block, ending with the set command from the root that fixes it.
Every call and every Subscribe stream runs behind a panic boundary. If a Ze defect is reached while one is served, only that call or stream ends, with status Internal and a message naming the ze show crashes command that finds its crash record. A Set that ends this way discards its uncommitted edits, so nothing it changed is applied. The listener and every other call keep running, and the panic is counted in ze_task_panics_total{component="gnmi",task="rpc"} and ze_gnmi_errors_total{code="Internal"}.
When ze.gnmi.token is set, every gNMI request must include a Bearer token in the authorization gRPC metadata header. The token is compared using constant-time comparison (SHA-256 hash with subtle.ConstantTimeCompare) to prevent timing attacks.
When no token is configured, the server accepts unauthenticated requests. This is only appropriate for loopback or trusted-network deployments.
TLS is optional. To enable it on the gNMI gRPC transport, set both cert and key.
Environment variables:
ze.gnmi.tls.cert=/path/to/cert.pem
ze.gnmi.tls.key=/path/to/key.pem
YANG config:
environment {
gnmi {
tls {
cert /path/to/cert.pem;
key /path/to/key.pem;
}
}
}
TLS certificates are loaded once at startup. Certificate rotation requires restarting the gNMI server.
Naming either file asks for TLS, and gNMI then serves TLS or nothing: it never falls back to clear text. When only one of the two files is set, when a file cannot be read, or when the certificate and key are not a valid pair, gNMI does not start. Nothing listens on its port, and Ze logs an error with the code doctor-gnmi-tls-material naming the file, why, and the fix. The rest of the daemon keeps running. Restore the file or correct environment gnmi tls cert / key (or ze.gnmi.tls.cert / ze.gnmi.tls.key), then run ze signal restart: a reload does not restart gNMI.
ze doctor reports the same cause before the daemon starts. Its gnmi-tls-material check loads the pair gNMI would serve, environment overrides included, and also reports a certificate that is expired or not yet valid as an error, and one within 30 days of expiry as a warning. It reports nothing when gNMI does not start or names no TLS file. ze show diagnostic doctor-gnmi-tls-material explains the code.
Config commits that originate outside gNMI (the web UI, the CLI, and the managed component) notify Subscribe STREAM subscribers. These external commits send a generic config-changed notification rather than per-path diffs.
Check gNMI server status from the SSH CLI:
show gnmi
This returns JSON with: enabled, listen address, token configured, TLS configured, and the active subscriber count.
| Metric | Type | Labels | Description |
|---|---|---|---|
ze_gnmi_requests_total |
counter | rpc | Total gNMI RPC requests. |
ze_gnmi_subscribe_active |
gauge | none | Active Subscribe STREAM connections. |
ze_gnmi_errors_total |
counter | rpc, code | gNMI RPC errors by gRPC status code. |
Get the full config tree:
gnmic -a 192.0.2.1:9339 --token your-secret-token get --path /Subscribe to config changes:
gnmic -a 192.0.2.1:9339 --token your-secret-token subscribe --path / --mode stream- Subscribe POLL mode is not implemented.
- Telemetry SAMPLE mode (periodic counter streaming) is not supported.
- The gNMI path target field (multi-target) is not supported.
- TLS certificates are loaded at startup only; no hot rotation.
- External config commits (web, CLI) send a generic config-changed notification, not per-path diffs.
Adapted from main/docs/guide/gnmi.md.
Unreviewed draft. This wiki was authored in bulk and has not been reviewed. File corrections on the issue tracker.
- Install
- Docker
- netlab
- Appliance
- Quick Start
- Use Ze with an AI agent
- ExaBGP Migration
- CLI Tour
- Web UI Tour
- Overview
- YANG Model
- Editor Workflow
- Archive and Rollback
- Backup and Restore
- System
- Interfaces
- VRRP
- BFD
- FIB
- OSPF
- IS-IS
- MPLS / LDP / RSVP-TE
- RSVP-TE
- SRv6
- Static Routes
- Policy Routing
- Firewall
- Traffic Control
- Class of Service
- L2TP/PPP
- PPPoE
- VPP Data Plane
- RPKI
- IPsec VPN
- Path MTU
- TACACS+ AAA
- RADIUS AAA
- AS112 DNS
- DNS
- Authorization
- Fleet
- BGP
- Starting and Stopping
- Show Commands
- Monitoring
- Telemetry
- Flow Export
- DDoS Mitigation
- Anomaly Detection
- Health Checks
- Audit Trail
- Production Diagnostics
- Logging
- Operational Reports
- Healthcheck
- Self-Update
- Zero-Touch Provisioning
- MRT Analysis
- Upgrade and Restart
- Storage
- Policy
- Core
- Resilience
- Validation
- Link State
- Capabilities
- Address Families
- Protocol
- Subsystems
- Infrastructure
- Route Server at an IXP
- Transit Edge with RPKI
- Public Looking Glass
- ExaBGP Migration Walkthrough
- FlowSpec Injection
- Chaos-Tested Peering
- AS Path Topology