Class: FakeServer
Defined in: netconf/src/testing/fake-server.ts:101
An in-process, scriptable NETCONF server for tests, with no network and no device. It speaks real RFC 6242 framing over an in-memory connection: pass server.transport() to connect(), answer requests with a RpcHandler, then check requests and problems. Each server serves one connection. See Testing your code.
Constructors
Constructor
new FakeServer(options?): FakeServer;Defined in: netconf/src/testing/fake-server.ts:124
Parameters
options?
FakeServerOptions = {}
Returns
FakeServer
Properties
capabilities
readonly capabilities: CapabilitySet;Defined in: netconf/src/testing/fake-server.ts:113
The capabilities the server advertises in its hello (unless hello replaces the hello).
clientHello
readonly clientHello: Promise<XmlElement>;Defined in: netconf/src/testing/fake-server.ts:109
Resolves with the client's <hello>.
connection
readonly connection: Connection;Defined in: netconf/src/testing/fake-server.ts:103
The client's end of the connection.
problems
readonly problems: Error[] = [];Defined in: netconf/src/testing/fake-server.ts:107
Problems the server hit (bad framing, bad XML). Tests can assert this stays empty.
requests
readonly requests: XmlElement[] = [];Defined in: netconf/src/testing/fake-server.ts:105
Every <rpc> received, in arrival order.
sessionId
readonly sessionId: number;Defined in: netconf/src/testing/fake-server.ts:111
The session id sent in the server hello.
Accessors
version
Get Signature
get version(): BaseVersion | undefined;Defined in: netconf/src/testing/fake-server.ts:164
The base version agreed after the client hello, if it has arrived.
Returns
BaseVersion | undefined
Methods
destroy()
destroy(err?): void;Defined in: netconf/src/testing/fake-server.ts:196
Abort the connection from the server side, as if the link dropped. err, if given, is recorded in problems.
Parameters
err?
Error
Returns
void
end()
end(): void;Defined in: netconf/src/testing/fake-server.ts:191
Close the connection cleanly from the server side.
Returns
void
notify()
notify(content, eventTime?): void;Defined in: netconf/src/testing/fake-server.ts:186
Send an RFC 5277 <notification>.
Parameters
content
eventTime?
string = ...
Returns
void
send()
send(message): void;Defined in: netconf/src/testing/fake-server.ts:174
Send a message in the framing agreed with the client. Until the client's hello arrives that framing isn't known (RFC 6242 §4.1), so a message sent earlier is held and sent, in order, once it is. Use sendRaw() to send before the hello on purpose.
Parameters
message
string | XmlElement
Returns
void
sendRaw()
sendRaw(bytes): void;Defined in: netconf/src/testing/fake-server.ts:181
Write bytes with no framing applied.
Parameters
bytes
string | Uint8Array<ArrayBufferLike>
Returns
void
transport()
transport(): ConnectionFactory;Defined in: netconf/src/testing/fake-server.ts:159
A transport factory for connect({ transport: server.transport() }). It can be used once, since the server serves a single connection.