Skip to content

Server data ​

Extensions to NETCONF let a client ask the server about itself: its sessions and counters, its YANG modules and their source, its datastores. Each is a command when the server has the capability for it, and help lists the rest under "not available". These commands only read, so they work on read-only targets too.

Monitoring ​

With RFC 6022 monitoring, the server reports its open sessions, the schemas it offers, its datastores and who has them locked, and its counters. nnc prints each as JSON:

nnc
nnc lab> monitoring-sessions
nnc lab> monitoring-statistics
nnc lab> monitoring-datastores
nnc lab> monitoring-schemas
Output
nnc lab> monitoring-sessions
[
  {
    "sessionId": 3,
    "transport": "ietf-netconf-monitoring:netconf-ssh",
    "username": "netconf",
    "sourceHost": "192.0.2.50",
    "loginTime": "2026-11-14T10:00:32Z",
    "inRpcs": 41,
    "inBadRpcs": 0,
    "outRpcErrors": 2,
    "outNotifications": 0
  }
]

monitoring-datastores shows a lock's holder and when it was taken, which is how to find the session to kill-session:

nnc
nnc lab> lock running
nnc lab> monitoring-datastores
nnc lab> unlock running

Fetching a module ​

get-schema fetches a module's source from the server, as YANG or YIN:

nnc
nnc lab> get-schema ietf-system
nnc lab> get-schema ietf-system --format yin

get-schema ietf-system > ietf-system.yang saves it to a file, to read or to compile your own tools against.

The YANG library ​

A server with a YANG library (RFC 8525, or RFC 7895's /modules-state) lists the modules each datastore implements, with their features and deviations. modules shows it as a table, and yang-library in full:

nnc
nnc lab> modules
nnc lab> yang-library

nnc reads the YANG library once per session. Its content-id, which the server also gives in its hello, changes when the modules do; yang-library --refresh reads it again.

NMDA datastores ​

A server with the Network Management Datastore Architecture (RFC 8342) has the intended and operational datastores as well as running and candidate. datastores lists them, and get-data reads any of them (RFC 8526):

nnc
nnc lab> datastores
nnc lab> get-data intended --filter subtree {"ietf-system:system": {}}
nnc lab> get-data operational --filter xpath /ietf-interfaces:interfaces

operational holds the configuration in use and the state data together.

Option
--config-filter / --no-config-filterconfiguration nodes only, or state nodes only
--max-depth <n>levels below each selected node
--with-originwhere each configuration value came from (operational only)
--origin-filter <origin>, --negated-origin-filter <origin>keep, or drop, nodes with that origin
--with-defaults <mode>as for get-config

edit-data changes an NMDA datastore, and always rolls back if any part fails:

nnc
nnc lab> edit-data running {"ietf-system:system": {"location": "rack-1"}}
nnc lab> get-data running --filter subtree {"ietf-system:system": {}}

Origins ​

--with-origin shows where each value in the operational datastore came from: intended (your configuration), learned (a protocol, such as LLDP), system, default, dynamic or unknown. nnc shows it as one line per leaf, including the origins leaves inherit from their parents:

nnc
nnc lab> get-data operational --filter xpath /ietf-system:system --with-origin
Output
/ietf-system:system/contact    tutorial@example.net   intended
/ietf-system:system/hostname   lab1                   intended
2 leaves: 2 intended

--json gives [{ "path", "value", "origin" }], and --xml the reply with its or:origin attributes.

Comparing on the server ​

A server with RFC 9144 compares two NMDA datastores itself. compare shows the differences as a short diff:

Output
nnc router1> compare running operational
- delete   /ietf-interfaces:interfaces/interface[name=eth1]
~ replace  /ietf-interfaces:interfaces/interface[name=eth0]/mtu   1500 → 9000
+ create   /ietf-interfaces:interfaces/interface[name=eth2]
3 differences (running → operational)

--all compares every node, not only those both datastores can hold, --report-origin adds the origins from operational, and --filter compares part of them. On any server, nnc's own diff compares running, candidate and startup.

Partial locks ​

RFC 5717 partial locks lock part of the running configuration, chosen by XPath, instead of all of it:

Output
nnc router1> partial-lock /ietf-interfaces:interfaces/interface[name='eth0']
nnc router1> partial-unlock 1

A part already locked by another session is refused, naming the session. Few servers implement it; the lab device doesn't.

Next ​

Released under the MIT Licence.