Class NetConfClient
Contains operation for working with NetConf server.
public class NetConfClient : BaseClient, IBaseClient, IDisposable
- Inheritance
-
NetConfClient
- Implements
- Inherited Members
Constructors
NetConfClient(ConnectionInfo)
Initializes a new instance of the NetConfClient class.
public NetConfClient(ConnectionInfo connectionInfo)
Parameters
connectionInfo
ConnectionInfoThe connection info.
Exceptions
- ArgumentNullException
connectionInfo
is null.
NetConfClient(string, int, string, params IPrivateKeySource[])
Initializes a new instance of the NetConfClient class.
public NetConfClient(string host, int port, string username, params IPrivateKeySource[] keyFiles)
Parameters
host
stringConnection host.
port
intConnection port.
username
stringAuthentication username.
keyFiles
IPrivateKeySource[]Authentication private key file(s) .
Exceptions
- ArgumentNullException
keyFiles
is null.- ArgumentException
host
is invalid, -or-username
is null or contains only whitespace characters.- ArgumentOutOfRangeException
NetConfClient(string, int, string, string)
Initializes a new instance of the NetConfClient class.
public NetConfClient(string host, int port, string username, string password)
Parameters
host
stringConnection host.
port
intConnection port.
username
stringAuthentication username.
password
stringAuthentication password.
Exceptions
- ArgumentNullException
password
is null.- ArgumentException
host
is invalid, orusername
is null or contains only whitespace characters.- ArgumentOutOfRangeException
NetConfClient(string, string, params IPrivateKeySource[])
Initializes a new instance of the NetConfClient class.
public NetConfClient(string host, string username, params IPrivateKeySource[] keyFiles)
Parameters
host
stringConnection host.
username
stringAuthentication username.
keyFiles
IPrivateKeySource[]Authentication private key file(s) .
Exceptions
- ArgumentNullException
keyFiles
is null.- ArgumentException
host
is invalid, -or-username
is null or contains only whitespace characters.
NetConfClient(string, string, string)
Initializes a new instance of the NetConfClient class.
public NetConfClient(string host, string username, string password)
Parameters
host
stringConnection host.
username
stringAuthentication username.
password
stringAuthentication password.
Exceptions
- ArgumentNullException
password
is null.- ArgumentException
host
is invalid, orusername
is null or contains only whitespace characters.
Properties
AutomaticMessageIdHandling
Gets or sets a value indicating whether automatic message id handling is enabled.
public bool AutomaticMessageIdHandling { get; set; }
Property Value
ClientCapabilities
Gets the NetConf client capabilities.
public XmlDocument ClientCapabilities { get; }
Property Value
- XmlDocument
The NetConf client capabilities.
Exceptions
- SshConnectionException
Client is not connected.
OperationTimeout
Gets or sets the operation timeout.
public TimeSpan OperationTimeout { get; set; }
Property Value
- TimeSpan
The timeout to wait until an operation completes. The default value is negative one (-1) milliseconds, which indicates an infinite time-out period.
Exceptions
- ArgumentOutOfRangeException
value
represents a value that is less than -1 or greater than MaxValue milliseconds.
ServerCapabilities
Gets the NetConf server capabilities.
public XmlDocument ServerCapabilities { get; }
Property Value
- XmlDocument
The NetConf server capabilities.
Exceptions
- SshConnectionException
Client is not connected.
Methods
Dispose(bool)
Releases unmanaged and - optionally - managed resources.
protected override void Dispose(bool disposing)
Parameters
disposing
booltrue to release both managed and unmanaged resources; false to release only unmanaged resources.
OnConnected()
Called when client is connected to the server.
protected override void OnConnected()
OnDisconnecting()
Called when client is disconnecting from the server.
protected override void OnDisconnecting()
SendCloseRpc()
Sends the close RPC.
public XmlDocument SendCloseRpc()
Returns
- XmlDocument
Reply message to closing RPC request.
Exceptions
- SshConnectionException
Client is not connected.
SendReceiveRpc(string)
Sends the receive RPC.
public XmlDocument SendReceiveRpc(string xml)
Parameters
xml
stringThe XML.
Returns
- XmlDocument
Reply message to RPC request.
Examples
var rpcXmlTemplate = "{0}"'
var rpcResponse = client.SendReceiveRpc(String.Format(rpcXmlTemplate, ""));
SendReceiveRpc(XmlDocument)
Sends the receive RPC.
public XmlDocument SendReceiveRpc(XmlDocument rpc)
Parameters
rpc
XmlDocumentThe RPC.
Returns
- XmlDocument
Reply message to RPC request.
Examples
var rpcXmlTemplate = "{0}"'
rpc.LoadXml(String.Format(rpcXmlTemplate, ""));
var rpcResponse = client.SendReceiveRpc(rpc);
Exceptions
- SshConnectionException
Client is not connected.