Skip to content

Try nnc ​

This page opens the real nnc in a terminal beside it, running in your browser against a simulated NETCONF device. Nothing is installed and nothing leaves your browser: the device runs in this page.

The device is a real NETCONF server, @node-net/netconf-server, emulating a small switch with two Ethernet ports. It has the IETF interface and system models, and a starter set of OpenConfig models: interfaces, Ethernet, aggregates, VLANs, LACP, LLDP and platform, with ports and transceivers. It checks every edit against them, and offers the candidate datastore, confirmed commit, notifications, with-defaults, NETCONF monitoring and its YANG modules. The IETF and OpenConfig interfaces are separate data: changing one leaves the other as it was.

The terminal docks at the bottom, left or right, or detaches into a window, with the buttons on its bar. Close it, and the Lab button in the header (or Ctrl+`) opens it again with the same session; it stays with you as you move between pages. Its TypeScript tab runs the library itself, for the guide's examples, against a simulated device of its own.

First commands ​

Each Run button types its command at the prompt; press Enter to run it. Tab completes commands, Up and Down step through history, and Ctrl-C cancels. With text selected, Ctrl-C copies it; Ctrl-V pastes (on a Mac, Cmd-C and Cmd-V).

Connect to the simulated device, and see what it offers:

nnc
nnc> connect lab
nnc lab> status
nnc lab> capabilities
nnc lab> modules

Read its configuration and state:

nnc
nnc lab> get-config running
nnc lab> get

Read OpenConfig state: the LLDP neighbour on eth0, and the readings of its transceiver:

nnc
nnc lab> get --filter subtree {"openconfig-lldp:lldp": {}}
nnc lab> get --filter subtree {"openconfig-platform:components": {}}

Change the configuration. set locks, edits the candidate, validates and commits, showing each step:

nnc
nnc lab> set /ietf-system:system/contact ops@example.net

The server refuses a value its YANG model doesn't allow, and set discards the change. Try an empty hostname:

nnc lab> set /ietf-system:system/hostname ""
...
set: failed at edit-config; the changes were discarded and the locks released
rpc-error: invalid-value
  type      application
  severity  error
  path      /ietf-system:system/ietf-system:hostname
  message   length 0 is outside the allowed lengths 1..253

Subscribe to notifications, and see one when the configuration changes:

nnc
nnc lab> create-subscription
nnc lab> set /ietf-system:system/location rack-1
nnc lab> notifications

Watch what crosses the wire. trace frames shows each message's framing, and trace xml the XML itself:

nnc
nnc lab> trace frames
nnc lab> get-config running
nnc lab> trace xml
nnc lab> lock running
nnc lab> unlock running
nnc lab> trace off

See every command, and what one does:

nnc
nnc lab> help
nnc lab> help get-config

Restart starts again with a fresh session. Your command history is kept in this browser, through restarts and reloads.

Next ​

  • Commands: everything you can type
  • Targets: name your own devices, and connect over SSH or TLS
  • Install nnc to use it with your devices: npm install -g @node-net/nnc

Released under the MIT Licence.