Skip to content

Interface: ExtensionContext ​

Defined in: netconf/src/operations/extension.ts:128

What an extension's code can use: the session's RpcContext, plus the client's capability-check policy and a helper that applies it.

Extends ​

Properties ​

capabilityCheck ​

ts
readonly capabilityCheck: CapabilityCheck;

Defined in: netconf/src/operations/extension.ts:130

The client's capabilityCheck policy, which invoke applies to each request's required capabilities.


logger ​

ts
readonly logger: Logger;

Defined in: netconf/src/messages/session.ts:197

The session's logger. Only enabled levels have a method, so call it as logger.debug?.(…).

Inherited from ​

RpcContext.logger


moduleOf? ​

ts
readonly moduleOf?: ModuleOf;

Defined in: netconf/src/operations/extension.ts:161

The module a namespace belongs to, as the session knows it (the namespaces given to connect(), the device profile, the hello, the YANG library once read), for module-qualified identities and paths in what a reader returns. Missing on a context not built by a client: the readers then fall back to well-known modules, then the namespace itself.


serverCapabilities ​

ts
readonly serverCapabilities: CapabilitySet;

Defined in: netconf/src/messages/session.ts:193

The server's capabilities, after any corrections from the device profile.

Inherited from ​

RpcContext.serverCapabilities


sessionId ​

ts
readonly sessionId: number;

Defined in: netconf/src/messages/session.ts:195

The session-id the server assigned.

Inherited from ​

RpcContext.sessionId


sessionKey ​

ts
readonly sessionKey: object;

Defined in: netconf/src/operations/extension.ts:136

The same object for every context on one session, and a different one for each session: a WeakMap key for state that modules on a session share (the YANG library read, for one). It gives no access to anything.


toJson ​

ts
readonly toJson: ToJson;

Defined in: netconf/src/operations/extension.ts:145

Convert YANG data in XML to RFC 7951 JSON with the client's YANG schemas, as format: 'json' does on the client's own reads. An extension whose operation returns datastore content offers format: 'json' through this. Missing on a context not built by a client (it then rejects with a TypeError).


toXml ​

ts
readonly toXml: ToXml;

Defined in: netconf/src/operations/extension.ts:153

Convert RFC 7951 JSON to XML (edit content, or with filter, subtree filter content) with the client's YANG schemas, as JSON config and filter are on the client's own operations. An extension whose operation takes datastore content accepts JSON through this. Missing on a context not built by a client (it then rejects with a TypeError).

Methods ​

addRpcGuard() ​

ts
addRpcGuard(guard): () => void;

Defined in: netconf/src/messages/session.ts:207

Check every operation before rpc() sends it. A guard refuses by throwing; rpc() then rejects with that error and sends nothing. <close-session> from close() is never guarded. Returns a function that removes the guard.

Parameters ​

guard ​

RpcGuard

Returns ​

() => void

Inherited from ​

RpcContext.addRpcGuard


invoke() ​

ts
invoke(request, options?): Promise<RpcReply>;

Defined in: netconf/src/operations/extension.ts:138

Check a request's required capabilities under capabilityCheck, then send it.

Parameters ​

request ​

OperationRequest

options? ​

RpcOptions

Returns ​

Promise<RpcReply>


onClosed() ​

ts
onClosed(listener): () => void;

Defined in: netconf/src/messages/session.ts:201

Call listener once when the session closes. Returns a function that stops it.

Parameters ​

listener ​

(event) => void

Returns ​

() => void

Inherited from ​

RpcContext.onClosed


onNotification() ​

ts
onNotification(listener): () => void;

Defined in: netconf/src/messages/session.ts:199

Call listener for every <notification> the session receives. Returns a function that stops it.

Parameters ​

listener ​

(notification) => void

Returns ​

() => void

Inherited from ​

RpcContext.onNotification


rpc() ​

ts
rpc(operation, options?): Promise<RpcReply>;

Defined in: netconf/src/messages/session.ts:191

Send an operation (the content of <rpc>, as an element or XML text) and wait for its reply. Rejects with RpcError if the reply has an error-severity <rpc-error>.

Parameters ​

operation ​

string | XmlElement

options? ​

RpcOptions

Returns ​

Promise<RpcReply>

Inherited from ​

RpcContext.rpc

Released under the MIT Licence.