Skip to content

Notifications ​

A server sends notifications on a subscription: events from a stream, such as the base events of RFC 6470 when the configuration changes, or a datastore's contents with YANG-Push. nnc shows each as a line above the prompt as it arrives, and keeps them for notifications to list.

Subscribing to a stream ​

create-subscription (RFC 5277) subscribes the session to a stream, NETCONF by default. notification-streams lists the streams the server offers. Subscribe on the lab device, change something, and see the events:

nnc
nnc lab> notification-streams
nnc lab> create-subscription
nnc lab> set /ietf-system:system/location rack-1
nnc lab> notifications
nnc lab> notifications --json
Output
nnc lab> set /ietf-system:system/location rack-1
lock running: ok
...
commit candidate: ok
notification 1 · 2026-11-14T10:00:47.011Z · netconf-config-change
unlock candidate: ok
unlock running: ok
ok

A session has one RFC 5277 subscription, so a second create-subscription is refused with in-use. It lasts until the session ends.

What each event says ​

notifications --json shows each notification's content, and the library's decoding of the RFC 6470 events: who made a change, in which datastore, and which nodes it touched:

Output
[
  {
    "number": 1,
    "eventTime": "2026-11-14T10:00:47.011Z",
    "event": "netconf-config-change",
    "namespace": "urn:ietf:params:xml:ns:yang:ietf-netconf-notifications",
    "content": { … },
    "decoded": {
      "type": "netconf-config-change",
      "changedBy": { "username": "local", "sessionId": 1 },
      "datastore": "running",
      "edits": [ { "target": "…/location", "operation": "create" } ]
    }
  }
]

The base events are netconf-config-change, netconf-capability-change, netconf-session-start and netconf-session-end (another session connecting or leaving), and netconf-confirmed-commit, which a confirmed commit sends as it starts, is confirmed, cancelled or times out.

Filters and replay ​

--filter keeps only the notifications that match a subtree or XPath filter. On a stream with replay, --start-time first sends the stored events since that time, and --stop-time ends the subscription:

Output
nnc router1> create-subscription --filter subtree <netconf-config-change xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-notifications"/>
nnc router1> create-subscription --start-time 2026-11-14T09:00:00Z --stop-time 2026-11-14T10:00:00Z

The lab device's stream has no replay (replaySupport false).

Following ​

notifications --follow prints each notification in full as it arrives, until Ctrl-C; with --json, one JSON object per line. The prompt's lines keep arriving while you type too: the line you're typing is redrawn below each one.

Subscriptions (RFC 8639) ​

RFC 8639 subscriptions have ids, and a session can have several, changed and ended one at a time. subscription-support says what a server supports; the lab device doesn't, so these examples are from another server.

establish-subscription --stream subscribes to an event stream. nnc reads the subscription for as long as it is open, and each update is a line naming the subscription. --replay-start-time replays stored events first, on a stream that keeps them:

Output
nnc router1> establish-subscription --stream NETCONF
subscription 1 · stream NETCONF
notification 4 · 2026-11-14T10:00:00Z · subscription 1 · event · netconf-session-start
notification 5 · 2026-11-14T10:00:02Z · subscription 1 · suspended · insufficient-resources
notification 6 · 2026-11-14T10:00:04Z · subscription 1 · resumed
nnc router1> delete-subscription 1
subscription 1 ended · deleted
Command
modify-subscription <id>change a subscription's filter, stop time, period or dampening period
delete-subscription <id>end one of this session's subscriptions
kill-subscription <id>end any session's subscription
resync-subscription <id>ask an on-change subscription for a fresh full update
subscription-listevery session's subscriptions on the server
subscription-streamsthe streams offered for subscriptions
subscription-supportwhich subscription modules and features the server supports

status lists the session's open subscriptions.

YANG-Push (RFC 8641) ​

A subscription can be to a datastore's contents instead of a stream (RFC 8641): periodically, every --period centiseconds, or on change, sending what changed as a YANG Patch:

Output
nnc router1> establish-subscription --datastore operational --period 500 --filter subtree <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces"/>
nnc router1> establish-subscription --datastore running --on-change --dampening-period 100

--json on notifications includes each decoded update: a push-update with the data, or a push-change-update with its edits.

Next ​

Released under the MIT Licence.