Skip to content

@node-net/netconf/operations/compare ​

RFC 9144 NMDA datastore comparison: ask the server how two datastores differ, instead of fetching both and diffing them here.

ts
import { compare } from '@node-net/netconf/operations/compare';

const client = await connect({ transport, extensions: [compare] });
const diff = await client.ops.compare.datastores({
  source: 'running',
  target: 'candidate',
  filter: client.content.toXPath('/ietf-interfaces:interfaces'),
});
if (diff.noMatches) console.log('no differences');
for (const edit of diff.edits) console.log(edit.operation, edit.target, edit.value, edit.sourceValue);

The differences are a YANG Patch (RFC 8072) that would turn source into target: create for a node only in the target, delete (or remove) for one only in the source, replace for a changed one. value is the node as in the target and sourceValue the node as in the source. The server decides how to group edits (one replace of a container, or one per leaf), and how to write target: RFC 9144 doesn't fix its root, and Clixon makes it relative to the filter's selected node, so it is kept as the server's text.

<no-matches/> means nothing was compared. RFC 9144 defines it as "the filter matched nothing"; Clixon also sends it when the datastores are identical. Either way there are no differences to report.

The module (ietf-nmda-compare) is YANG 1.1, so it is found in the YANG library, not the hello: the first datastores() call reads the library (once per client) and refuses with CapabilityError if the module isn't there. client.ops.run('compare', …), which tools such as the CLI use, checks only the hello's capabilities and lets the server refuse.

RFC 9144 names no error tags. Clixon 7.9 refuses all, report-origin and subtree filters with operation-not-supported, and a datastore it doesn't have with operation-failed.

See compare.

Interfaces ​

Type Aliases ​

Variables ​

Functions ​

Released under the MIT Licence.