Skip to content

@node-net/netconf/operations/base-notifications ​

RFC 6470 NETCONF base notifications: decode the events the NETCONF stream carries about the server itself into typed objects.

ts
import { notifications } from '@node-net/netconf/operations/notifications';
import { decodeBaseNotification } from '@node-net/netconf/operations/base-notifications';

const client = await connect({ transport, extensions: [notifications] });
await using sub = await client.ops.notifications.createSubscription();
for await (const n of sub) {
  const event = decodeBaseNotification(n);
  if (event?.type === 'netconf-config-change') console.log(event.changedBy, event.edits.map((e) => e.target));
}

These are pure functions, not a connect() extension: RFC 6470 adds no RPC and no capability, only the ietf-netconf-notifications YANG module.

An edit's target is an RFC 7951 instance-identifier with module names in place of the server's prefixes, such as /ietf-interfaces:interfaces/interface[name='eth0']. Pass the session's module lookup, { moduleOf: (ns) => client.content.moduleOf(ns) }, so a module the library doesn't know by heart is named rather than given by its namespace.

A notification that isn't one of the five base events decodes to undefined. A base event that breaks the YANG module (a required leaf missing, an unknown enumeration value, a target path that can't be parsed) throws a BaseNotificationError, which is a ProtocolError.

See Base notifications (RFC 6470).

Classes ​

Interfaces ​

Type Aliases ​

Variables ​

Functions ​

References ​

EditOperation ​

Re-exports EditOperation


Notification ​

Re-exports Notification

Released under the MIT Licence.