NETCONF client module.
The NETCONF client is compliant with RFC 4741 NETCONF Configuration Protocol and RFC 4742 Using the NETCONF Configuration Protocol over Secure SHell (SSH).
Connecting to a NETCONF server
NETCONF sessions can either be opened by a single call
to
The properties of the sessions will be exactly the same, except
that when
using
For each server to test against, the following entry can be added to a configuration file:
{server_id(),options()}.
The
If no configuration exists for a server,
use
Logging
The NETCONF server uses
suite() -> [{ct_hooks, [{cth_conn_log, [{, ct:conn_log_mod() }]}]}]. ct:conn_log_options()
Hook option
The sent and received NETCONF data is logged to a separate text file "as is" without any formatting. A link to the file is added to the test case HTML log.
The sent and received NETCONF data is logged to a separate text file with XML data nicely indented. A link to the file is added to the test case HTML log.
The sent and received NETCONF traffic is pretty printed directly in the test case HTML log.
NETCONF traffic is not logged.
By default, all NETCONF traffic is logged in one single log file.
However, different connections can be logged in separate files.
To do this, use hook option
Option
The hook options can also be specified in a configuration file with
configuration variable
{ct_conn_log,[{, ct:conn_log_mod() }]}. ct:conn_log_options()
For example:
{ct_conn_log,[{ct_netconfc,[{log_type,pretty}, {hosts,[]}]}]} ct:key_or_name()
Hook options specified in a configuration file overwrite the hard-coded hook options in the test suite.
Logging Example 1:
The following
suite() -> [{ct_hooks, [{cth_conn_log, [{ct_netconfc,[{log_type,pretty}}, {hosts,[nc_server1,nc_server2]}]} ]}]}].
Connections must be opened as follows:
open(nc_server1,[...]), open(nc_server2,[...]).
Logging Example 2:
The following configuration file causes raw logging of all NETCONF traffic in to one single text file:
{ct_conn_log,[{ct_netconfc,[{log_type,raw}]}]}.
The
suite() -> [{ct_hooks, [{cth_conn_log, []}]}].
The same
Notifications
The NETCONF client is also compliant with RFC 5277 NETCONF Event Notifications, which defines a mechanism for an asynchronous message notification delivery service for the NETCONF protocol.
Specific functions to support this are
Default Timeout
Most of the functions in this module have one variant with
a
Opaque reference for a connection to a NETCONF server or a NETCONF session.
Options used for setting up an SSH connection to a NETCONF server.
The identity of a server, specified in a configuration file.
This type is further described in application
For details about the data format for the string values, see "XML Schema for Event Notifications" in RFC 5277.
This date and time identifier has the same format as the XML type
[-]CCYY-MM-DDThh:mm:ss[.s][Z|(+|-)hh:mm]
Executes an action. If the return type is void,
Requests graceful termination of the session associated with the client.
When a NETCONF server receives a
Opens an SSH connection to a NETCONF server.
If the server options are specified in a configuration file, use
The opaque
Option
Open an SSH connection to a named NETCONF server.
If
Argument
If the server is not specified in a configuration file, use
The opaque
Option
Copies configuration data.
Which source and target options that can be issued depends on the
capabilities supported by the server. That is,
Creates a subscription for event notifications.
This function sets up a subscription for NETCONF event
notifications of the specified stream type, matching the specified
filter. The calling process receives notifications as messages of
type
Only a subset of the function clauses are show above. The full set of valid combinations of input parameters is as follows:
create_subscription(Client) create_subscription(Client, Timeout) create_subscription(Client, Stream) create_subscription(Client, Filter) create_subscription(Client, Stream, Timeout) create_subscription(Client, Filter, Timeout) create_subscription(Client, Stream, Filter) create_subscription(Client, StartTime, StopTime) create_subscription(Client, Stream, Filter, Timeout) create_subscription(Client, StartTime, StopTime, Timeout) create_subscription(Client, Stream, StartTime, StopTime) create_subscription(Client, Filter, StartTime, StopTime) create_subscription(Client, Stream, StartTime, StopTime, Timeout) create_subscription(Client, Stream, Filter, StartTime, StopTime) create_subscription(Client, Stream, Filter, StartTime, StopTime, Timeout)
Optional parameter that indicates which stream of event is of interest. If not present, events in the default NETCONF stream are sent.
Optional parameter that indicates which subset of all possible events is of interest. The parameter format is the same as that of the filter parameter in the NETCONF protocol operations. If not present, all events not precluded by other parameters are sent.
Optional parameter used to trigger the replay feature and
indicate that the replay is to start at the time specified.
If
It is not valid to specify start times that are later than
the current time. If
This parameter is of type
Optional parameter used with the optional replay feature
to indicate the newest notifications of interest. If
Must be used with and be later than
For more details about the event notification mechanism, see RFC 5277.
Deletes configuration data.
The running configuration cannot be deleted and
Closes the given SSH connection.
If there are open NETCONF sessions on the connection, these
will be brutally aborted. To avoid this, close each session
with
Edits configuration data.
By default only the running target is available, unless the server
includes
[{'default-operation', ["none"]}, {'error-option', ["rollback-on-error"]}]
If
Gets data.
This operation returns both configuration and state data from the server.
Filter type
Returns the server side capabilities.
The following capability identifiers, defined in RFC 4741 NETCONF Configuration Protocol, can be returned:
More identifiers can exist, for example, server-side namespace.
Gets configuration data.
To be able to access another source than
Filter type
Sends a request to get the specified event streams.
<netconf xmlns="urn:ietf:params:xml:ns:netmod:notification"> <streams> <stream> <name>StreamName1</name> </stream> <stream> <name>StreamName2</name> </stream> ... </streams> </netconf>
If
<netconf xmlns="urn:ietf:params:xml:ns:netmod:notification"> <streams/> </netconf>
If more complex filtering is needed, use
Returns the session Id associated with the specified client.
Exchanges
Adds optional capabilities and sends a
Forces termination of the session associated with the supplied session Id.
The server side must abort any ongoing operations, release any locks and resources associated with the session, and close any associated connections.
Only if the server is in the confirmed commit phase, the configuration is restored to its state before entering the confirmed commit phase. Otherwise, no configuration rollback is performed.
If the specified
Locks the configuration target.
Which target parameters that can be used depends on if
Operation
Opens a NETCONF session, but does not send
As
Opens a named NETCONF session, but does not send
As
Opens a NETCONF session and exchanges
If the server options are specified in a configuration file,
or if a named client is needed for logging purposes (see section
The opaque
Option
Opens a named NETCONF session and exchanges
If
Argument
If the server is not specified in a configuration file, use
The opaque
Option
See also
Sends an XML document to the server.
The specified XML document is sent "as is" to the server. This function can be used for sending XML documents that cannot be expressed by other interface functions in this module.
Sends a NETCONF
The specified XML document is wrapped in a valid NETCONF
This function can be used for sending
Opens a NETCONF session as a channel on the given SSH connection, and exchanges hello messages with the server.
The opaque
Unlocks the configuration target.
If the client earlier has acquired a lock through