nnc: the NETCONF CLI
nnc is an interactive NETCONF client for people. It connects to one device and lets you send operations and watch what crosses the wire. Use it to see how a device answers, to reproduce device defects, and to check a device profile before you write code against it.
npm install -g @node-net/nncThis installs two commands for the same program: nnc, and @node-net/netconf as a longer name for scripts and CI, or for a PATH where nnc is already taken. The examples use nnc.
$ nnc
nnc> connect router1
connected to router1 (10.1.2.3:830) · session-id 57 · base:1.0 · profile nokia-7210-sas · read-only
nnc router1 [ro]> value @systemName
core-rtr-01
nnc router1 [ro]> trace xml
nnc router1 [ro]> get-config running --filter subtree <configure><system/></configure>It's built on the @node-net/netconf library's public API, and has the same host-key checks, profiles and extensions.
To see it before installing anything, try nnc in your browser against a simulated device. The Lab button in the header opens a terminal beside the page, on every page of this site but the API reference, and examples with Run buttons type their commands into it. The terminal keeps its session as you move between pages. Its TypeScript tab does the same for the library's examples in the guide.
What it does
- Shows every layer.
trace bytes,trace framesandtrace xmlshow what's sent and received, with secrets hidden. Tracing never changes what's sent. - Lets you choose how deep to go. A normal session gives you every operation. A
--framedsession leaves the hello,message-ids and framing to you. A--rawsession leaves everything, framing included, to you, for reproducing framing bugs. - Builds its commands from data. Every base operation, extension operation and device profile operation is a command, with help and Tab completion, and none of them needed CLI code.
- Is safe on production devices. Read-only targets refuse anything that could change state before it's sent. Credentials never appear in commands, history or traces.
- Scripts. The same commands run from
-cor a script file, with exit codes for CI.
Session kinds
| Kind | Connect with | nnc handles | You handle |
|---|---|---|---|
| Client (default) | connect <target> | Everything: a full client with its device profile | Operations |
| Framed | connect <target> --framed | SSH or TLS, and framing | The hello, message-ids, <rpc> wrappers, switching to chunked framing |
| Raw | connect <target> --raw | SSH and the netconf subsystem, or TLS | Everything, framing included |
The prompt always shows the kind: nnc lab1 [framed eom]>, nnc lab1 [raw]>.
Using nnc
Each page shows a part of nnc at work, with examples that run against the simulated lab device in the terminal at the bottom of the page:
| Page | |
|---|---|
| Connecting | SSH passwords, keys and the agent, host keys, jump hosts, TLS, call home, read-only sessions |
| The session | the hello, capabilities and modules, any RPC, errors, timeouts, closing |
| Configuration | reading with filters, editing, locks, validate, commit, confirmed commit |
| Paths | reading and changing values by YANG path, resolving paths, comparing datastores |
| Transactions | several changes applied as one, confirmed or reverted |
| Notifications | event streams, the base events, RFC 8639 subscriptions, YANG-Push |
| Server data | monitoring, schemas, the YANG library, NMDA datastores and origins, compare |
| Device profiles | how a profile is chosen, its quirks, workflow, named paths and operations |
| Watching the wire | tracing bytes, frames and XML; framed and raw sessions |
| Output and input | formats, files, history, completion and help |
The reference pages: Targets, Commands, and Scripts and exit codes.