Skip to content

Quirks ​

A quirk is a named switch for a known way a device departs from the RFCs. Every quirk is implemented and tested in the protocol layer it affects. Profiles turn quirks on, but never supply code that runs inside framing or message handling.

All the defaults follow the RFCs. Turn a quirk on only for a device that's been seen to need it, and say why in the profile's notes.

Session quirks ​

maxInFlight ​

The most RPCs awaiting a reply at once. Set 1 for a device that mishandles pipelined requests.

forceBaseVersion ​

"1.0": advertise only base:1.0, for a device that advertises base:1.1 but gets chunked framing wrong. This applies before the hello, so it only takes effect when the profile is named explicitly.

replyWithoutMessageId ​

"strict" (default) or "oldest". A device that leaves message-id off its replies can't have them matched to requests. "oldest" matches such a reply to the oldest request still waiting. Use it together with maxInFlight: 1.

closeTimeout ​

Milliseconds to wait for the reply to <close-session> before closing anyway, at least 1. A timeouts.close passed to connect() takes precedence.

invalidXmlChars ​

"reject" (default) or "strip". Some devices copy raw CLI output, including control characters such as BEL (0x07), into <error-message>. XML 1.0 doesn't allow those characters. "strip" removes them before parsing and logs how many were removed, but never the content. With "reject", such a message closes the session, because a message-id recovered from broken XML can't be trusted.

paddedEmptyElements ​

"keep" (default) or "strip". Some devices write an empty element across two lines: <access>, a line break and indentation, then </access>. "strip" empties every element with no child elements whose text is only whitespace containing a line break. Without a schema a container and a string leaf look the same, so a string leaf whose value is only blank lines would also read as empty. That's why it's off by default.

Content quirks ​

These change only what the path API sends. Explicit get() and getConfig() calls are never changed.

subtreeFilter ​

How read() and readValue() may filter:

"supported" (default)send a subtree filter for the whole path
"unsupported"fetch the whole datastore and select the path locally
"containers"send a filter cut short at subtreeFilterDepth, then select the rest locally

subtreeFilterDepth ​

Required with "containers". The filter keeps the first subtreeFilterDepth steps of the path, then any keyed list entries right after them, and stops at the first step without keys after that. Keys are never cut, since a list entry without its keys is a different request.

For example, the Nokia 7210 turns subtree filters into CLI commands, and a filter must stop at a CLI context. With depth 2, @systemName (/configure/system/name/system-name) sends <configure><system/></configure>, about 400 lines instead of the whole configuration, and the result is the same.

Quirk names in code ​

QUIRK_NAMES lists every quirk name above, session quirks first. A tool that edits or checks profiles can use it to offer the names, or to refuse one it doesn't know, the way loading a profile does:

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

// 'maxInFlight', 'forceBaseVersion', … 'subtreeFilterDepth'
const known = new Set<string>(QUIRK_NAMES);

Needing a new quirk ​

A new quirk is a change to the library, reviewed as a protocol change. Open an issue with what the server sends (a trace from nnc is ideal) and what the RFC says it should send.

Released under the MIT Licence.