Skip to content

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.

Shell
npm install -g @node-net/nnc

This 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 frames and trace xml show 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 --framed session leaves the hello, message-ids and framing to you. A --raw session 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 -c or a script file, with exit codes for CI.

Session kinds ​

KindConnect withnnc handlesYou handle
Client (default)connect <target>Everything: a full client with its device profileOperations
Framedconnect <target> --framedSSH or TLS, and framingThe hello, message-ids, <rpc> wrappers, switching to chunked framing
Rawconnect <target> --rawSSH and the netconf subsystem, or TLSEverything, 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
ConnectingSSH passwords, keys and the agent, host keys, jump hosts, TLS, call home, read-only sessions
The sessionthe hello, capabilities and modules, any RPC, errors, timeouts, closing
Configurationreading with filters, editing, locks, validate, commit, confirmed commit
Pathsreading and changing values by YANG path, resolving paths, comparing datastores
Transactionsseveral changes applied as one, confirmed or reverted
Notificationsevent streams, the base events, RFC 8639 subscriptions, YANG-Push
Server datamonitoring, schemas, the YANG library, NMDA datastores and origins, compare
Device profileshow a profile is chosen, its quirks, workflow, named paths and operations
Watching the wiretracing bytes, frames and XML; framed and raw sessions
Output and inputformats, files, history, completion and help

The reference pages: Targets, Commands, and Scripts and exit codes.

Released under the MIT Licence.