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
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
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
moduleOf?
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
readonly serverCapabilities: CapabilitySet;Defined in: netconf/src/messages/session.ts:193
The server's capabilities, after any corrections from the device profile.
Inherited from
sessionId
readonly sessionId: number;Defined in: netconf/src/messages/session.ts:195
The session-id the server assigned.
Inherited from
sessionKey
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
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
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()
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
Returns
() => void
Inherited from
invoke()
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
options?
Returns
Promise<RpcReply>
onClosed()
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
onNotification()
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
rpc()
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?
Returns
Promise<RpcReply>