.TH ct_netconfc 3erl "common_test 1.19.1" "Ericsson AB" "Erlang Module Definition" .SH NAME ct_netconfc \- NETCONF client module. .SH DESCRIPTION .LP NETCONF client module compliant with RFC 6241, NETCONF Configuration Protocol, and RFC 6242, Using the NETCONF Configuration Protocol over Secure SHell (SSH), and with support for RFC 5277, NETCONF Event Notifications\&. .LP \fIConnecting to a NETCONF server\fR\& .LP Call \fIconnect/1,2\fR\& to establish a connection to a server, then pass the returned handle to \fIsession/1-3\fR\& to establish a NETCONF session on a new SSH channel\&. Each call to \fIsession/1-3\fR\& establishes a new session on the same connection, and results in a hello message to the server\&. .LP Alternately, \fIopen/1,2\fR\& can be used to establish a single session on a dedicated connection\&. (Or, equivalently, \fIonly_open/1,2\fR\& followed by \fIhello/1-3\fR\&\&.) .LP Connect/session options can be specified in a configuration file with entries like the following\&. .LP .nf {server_id(), [option()]}. .fi .LP The \fIserver_id()\fR\& or an associated \fIct:target_name()\fR\& can then be passed to the aforementioned functions to use the referenced configuration\&. .LP \fISignaling\fR\& .LP Protocol operations in the NETCONF protocol are realized as remote procedure calls (RPCs) from client to server and a corresponding reply from server to client\&. RPCs are sent using like-named functions (eg\&. \fIedit_config/3-5\fR\& to send an edit-config RPC), with the server reply as return value\&. There are functions for each RPC defined in RFC 6241 and the create-subscription RPC from RFC 5277, all of which are wrappers on \fIsend_rpc/2,3\fR\&, that can be used to send an arbitrary RPC not defined in RFC 6241 or RFC 5277\&. .LP All of the signaling functions have one variant with a \fITimeout\fR\& argument and one without, corresponding to an infinite timeout\&. The latter is inappropriate in most cases since a non-response by the server or a missing message-id causes the call to hang indefinitely\&. .LP \fILogging\fR\& .LP The NETCONF server uses \fIerror_logger\fR\& for logging of NETCONF traffic\&. A special purpose error handler is implemented in \fIct_conn_log_h\fR\&\&. To use this error handler, add the \fIcth_conn_log\fR\& hook in the test suite, for example: .LP .nf suite() -> [{ct_hooks, [{cth_conn_log, [{\fIct:conn_log_mod()\fR\&, \fIct:conn_log_options()\fR\&}]}]}]. .fi .LP \fIconn_log_mod()\fR\& is the name of the \fICommon Test\fR\& module implementing the connection protocol, for example, \fIct_netconfc\fR\&\&. .LP Hook option \fIlog_type\fR\& specifies the type of logging: .RS 2 .TP 2 .B \fIraw\fR\&: 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\&. .TP 2 .B \fIpretty\fR\&: 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\&. .TP 2 .B \fIhtml (default)\fR\&: The sent and received NETCONF traffic is pretty printed directly in the test case HTML log\&. .TP 2 .B \fIsilent\fR\&: NETCONF traffic is not logged\&. .RE .LP 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 \fIhosts\fR\& and list the names of the servers/connections to be used in the suite\&. The connections must be named for this to work, that is, they must be opened with \fIopen/2\fR\&\&. .LP Option \fIhosts\fR\& has no effect if \fIlog_type\fR\& is set to \fIhtml\fR\& or \fIsilent\fR\&\&. .LP The hook options can also be specified in a configuration file with configuration variable \fIct_conn_log\fR\&: .LP .nf {ct_conn_log,[{\fIct:conn_log_mod()\fR\&, \fIct:conn_log_options()\fR\&}]}. .fi .LP For example: .LP .nf {ct_conn_log,[{ct_netconfc,[{log_type,pretty}, {hosts,[\fIct:key_or_name()\fR\&]}]}]} .fi .LP .RS -4 .B Note: .RE Hook options specified in a configuration file overwrite the hard-coded hook options in the test suite\&. .LP \fILogging Example 1:\fR\& .LP The following \fIct_hooks\fR\& statement causes pretty printing of NETCONF traffic to separate logs for the connections named \fInc_server1\fR\& and \fInc_server2\fR\&\&. Any other connections are logged to default NETCONF log\&. .LP .nf suite() -> [{ct_hooks, [{cth_conn_log, [{ct_netconfc,[{log_type,pretty}}, {hosts,[nc_server1,nc_server2]}]} ]}]}]. .fi .LP Connections must be opened as follows: .LP .nf open(nc_server1,[...]), open(nc_server2,[...]). .fi .LP \fILogging Example 2:\fR\& .LP The following configuration file causes raw logging of all NETCONF traffic in to one single text file: .LP .nf {ct_conn_log,[{ct_netconfc,[{log_type,raw}]}]}. .fi .LP The \fIct_hooks\fR\& statement must look as follows: .LP .nf suite() -> [{ct_hooks, [{cth_conn_log, []}]}]. .fi .LP The same \fIct_hooks\fR\& statement without the configuration file would cause HTML logging of all NETCONF connections in to the test case HTML log\&. .SH DATA TYPES .nf \fBclient()\fR\& = handle() | server_id() | ct:target_name() .br .fi .RS .LP Handle to a NETCONF session, as required by signaling functions\&. .RE .nf \fBhandle()\fR\& .br .fi .RS .LP Handle to a connection to a NETCONF server as returned by \fIconnect/1,2\fR\&, or to a session as returned by \fIsession/1-3\fR\&, \fIopen/1,2\fR\&, or \fIonly_open/1,2\fR\&\&. .RE .nf \fBxs_datetime()\fR\& = string() .br .fi .RS .LP Date and time of a startTime/stopTime element in an RFC 5277 create-subscription request\&. Of XML primitive type \fIdateTime\fR\&, which has the (informal) form .LP .nf [-]YYYY-MM-DDThh:mm:ss[.s][Z|(+|-)hh:mm] .fi .LP where \fIT\fR\& and \fIZ\fR\& are literal and \fI\&.s\fR\& is one or more fractional seconds\&. .RE .nf \fBevent_time()\fR\& = {eventTime, xml_attributes(), [xs_datetime()]} .br .fi .nf \fBnotification_content()\fR\& = [event_time() | simple_xml()] .br .fi .nf \fBnotification()\fR\& = .br {notification, xml_attributes(), notification_content()} .br .fi .RS .LP Event notification messages sent as a result of calls to \fIcreate_subscription/2,3\fR\&\&. .RE .nf \fBoption()\fR\& = .br {host | ssh, host()} | .br {port, inet:port_number()} | .br {timeout, timeout()} | .br {capability, string() | [string()]} | .br ssh:client_option() .br .fi .RS .LP Options \fIhost\fR\& and \fIport\fR\& specify the server endpoint to which to connect, and are passed directly to \fIssh:connect/4\fR\&, as are arbitrary ssh options\&. Common options are \fIuser\fR\&, \fIpassword\fR\& and \fIuser_dir\fR\&\&. .LP Option \fItimeout\fR\& specifies the number of milliseconds to allow for connection establishment and, if the function in question results in an outgoing hello message, reception of the server hello\&. The timeout applies to connection and hello independently; one timeout for connection establishment, another for hello reception\&. .LP Option \fIcapability\fR\& specifies the content of a corresponding element in an outgoing hello message, each option specifying the content of a single element\&. If no base NETCONF capability is configured then the RFC 4741 1\&.0 capability, "urn:ietf:params:netconf:base:1\&.0", is added, otherwise not\&. In particular, the RFC 6241 1\&.1 capability must be explicitly configured\&. NETCONF capabilities can be specified using the shorthand notation defined in RFC 6241, any capability string starting with a colon being prefixed by either "urn:ietf:params:netconf" or "urn:ietf:params:netconf:capability", as appropriate\&. .LP Capability options are ignored by connect/1-3 and only_open/1-2, which don\&'t result in an outgoing hello message\&. .RE .nf \fBserver_id()\fR\& = atom() .br .fi .RS .LP Identity of connection or session configuration in a configuration file\&. .RE .nf \fBstream_data()\fR\& = .br {description, string()} | .br {replaySupport, string()} | .br {replayLogCreationTime, string()} | .br {replayLogAgedTime, string()} .br .fi .nf \fBstream_name()\fR\& = string() .br .fi .nf \fBstreams()\fR\& = [{stream_name(), [stream_data()]}] .br .fi .RS .LP Stream information as returned by \fIget_event_streams/1-3\fR\&\&. See RFC 5277, "XML Schema for Event Notifications", for detail on the format of the string values\&. .RE .nf \fBxml_attribute_tag()\fR\& = atom() .br .fi .nf \fBxml_attribute_value()\fR\& = string() .br .fi .nf \fBxml_attributes()\fR\& = .br [{xml_attribute_tag(), xml_attribute_value()}] .br .fi .nf \fBxml_content()\fR\& = [simple_xml() | iolist()] .br .fi .nf \fBxml_tag()\fR\& = atom() .br .fi .nf \fBsimple_xml()\fR\& = .br {xml_tag(), xml_attributes(), xml_content()} | .br {xml_tag(), xml_content()} | .br xml_tag() .br .fi .RS .LP Representation of XML, as described in application \fIxmerl\fR\&\&. .RE .nf \fBxpath()\fR\& = {xpath, string()} .br .fi .nf \fBerror_reason()\fR\& = term() .br .fi .nf \fBhost()\fR\& = inet:hostname() | inet:ip_address() .br .fi .nf \fBnetconf_db()\fR\& = running | startup | candidate .br .fi .SH EXPORTS .LP .nf .B action(Client, Action) -> Result .br .fi .br .nf .B action(Client, Action, Timeout) -> Result .br .fi .br .RS .LP Types: .RS 3 Client = client() .br Action = simple_xml() .br Timeout = timeout() .br Result = ok | {ok, [simple_xml()]} | {error, error_reason()} .br .RE .RE .RS .LP Executes an action\&. If the return type is void, \fIok\fR\& is returned instead of \fI{ok,[simple_xml()]}\fR\&\&. .RE .LP .nf .B close_session(Client) -> Result .br .fi .br .nf .B close_session(Client, Timeout) -> Result .br .fi .br .RS .LP Types: .RS 3 Client = client() .br Timeout = timeout() .br Result = ok | {error, error_reason()} .br .RE .RE .RS .LP Requests graceful termination of the session associated with the client\&. .LP When a NETCONF server receives a \fIclose-session\fR\& request, it gracefully closes the session\&. The server releases any locks and resources associated with the session and gracefully closes any associated connections\&. Any NETCONF requests received after a \fIclose-session\fR\& request are ignored\&. .RE .LP .nf .B connect(Options) -> Result .br .fi .br .RS .LP Types: .RS 3 Options = [option()] .br Result = {ok, handle()} | {error, error_reason()} .br .RE .RE .RS .LP Opens an SSH connection to a NETCONF server\&. .LP If the server options are specified in a configuration file, use \fIconnect/2\fR\& instead\&. .LP The opaque \fIhandle()\fR\& reference returned from this function is required as connection identifier when opening sessions over this connection, see \fIsession/1-3\fR\&\&. .RE .LP .nf .B connect(KeyOrName, ExtraOptions) -> Result .br .fi .br .RS .LP Types: .RS 3 KeyOrName = ct:key_or_name() .br ExtraOptions = [option()] .br Result = {ok, handle()} | {error, error_reason()} .br .RE .RE .RS .LP Open an SSH connection to a named NETCONF server\&. .LP If \fIKeyOrName\fR\& is a configured \fIserver_id()\fR\& or a \fItarget_name()\fR\& associated with such an Id, then the options for this server are fetched from the configuration file\&. .LP The options list is added to those of the configuration file\&. If an option is specified in both lists, the configuration file takes precedence\&. .LP If the server is not specified in a configuration file, use \fIconnect/1\fR\& instead\&. .LP The opaque \fIhandle()\fR\& reference returned from this function can be used as connection identifier when opening sessions over this connection, see \fIsession/1-3\fR\&\&. However, if \fIKeyOrName\fR\& is a \fItarget_name()\fR\&, that is, if the server is named through a call to \fIct:require/2\fR\& or a \fIrequire\fR\& statement in the test suite, then this name can be used instead of \fIhandle()\fR\&\&. .RE .LP .nf .B copy_config(Client, Target, Source) -> Result .br .fi .br .nf .B copy_config(Client, Target, Source, Timeout) -> Result .br .fi .br .RS .LP Types: .RS 3 Client = client() .br Target = Source = netconf_db() .br Timeout = timeout() .br Result = ok | {error, error_reason()} .br .RE .RE .RS .LP Copies configuration data\&. .LP Which source and target options that can be issued depends on the capabilities supported by the server\&. That is, \fI:candidate\fR\& and/or \fI:startup\fR\& are required\&. .RE .LP .nf .B create_subscription(Client, Values) -> Result .br .fi .br .nf .B create_subscription(Client, Values, Timeout) -> Result .br .fi .br .RS .LP Types: .RS 3 Client = client() .br Values = .br #{stream => Stream, .br filter => Filter, .br start => StartTime, .br stop => StopTime} .br Stream = stream_name() .br Filter = simple_xml() | [simple_xml()] .br StartTime = StopTime = xs_datetime() .br Timeout = timeout() .br Result = ok | {error, error_reason()} .br .RE .RE .RS .LP Creates a subscription for event notifications by sending an RFC 5277 create-subscription RPC to the server\&. The calling process receives events as messages of type \fInotification()\fR\&\&. .LP From RFC 5722, 2\&.1 Subscribing to Receive Event Notifications: .RS 2 .TP 2 .B \fIStream\fR\&: Indicates which stream of event is of interest\&. If not present, events in the default NETCONF stream are sent\&. .TP 2 .B \fIFilter\fR\&: 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\&. .TP 2 .B \fIStartTime\fR\&: Used to trigger the replay feature and indicate that the replay is to start at the time specified\&. If \fIStartTime\fR\& is not present, this is not a replay subscription\&. It is not valid to specify start times that are later than the current time\&. If \fIStartTime\fR\& is specified earlier than the log can support, the replay begins with the earliest available notification\&. This parameter is of type \fIdateTime\fR\& and compliant to RFC 3339\&. Implementations must support time zones\&. .TP 2 .B \fIStopTime\fR\&: Used with the optional replay feature to indicate the newest notifications of interest\&. If \fIStopTime\fR\& is not present, the notifications continues until the subscription is terminated\&. Must be used with and be later than \fIStartTime\fR\&\&. Values of \fIStopTime\fR\& in the future are valid\&. This parameter is of type \fIdateTime\fR\& and compliant to RFC 3339\&. Implementations must support time zones\&. .RE .LP See RFC 5277 for more details\&. The requirement that \fIStopTime\fR\& must only be used with \fIStartTime\fR\& is not enforced, to allow an invalid request to be sent to the server\&. .LP Prior to OTP 22\&.1, this function was documented as having 15 variants in 6 arities\&. These are still exported for backwards compatibility, but no longer documented\&. The map-based variants documented above provide the same functionality with simpler arguments\&. .RE .LP .nf .B delete_config(Client, Target) -> Result .br .fi .br .nf .B delete_config(Client, Target, Timeout) -> Result .br .fi .br .RS .LP Types: .RS 3 Client = client() .br Target = startup | candidate .br Timeout = timeout() .br Result = ok | {error, error_reason()} .br .RE .RE .RS .LP Deletes configuration data\&. .LP The running configuration cannot be deleted and \fI:candidate\fR\& or \fI:startup\fR\& must be advertised by the server\&. .RE .LP .nf .B disconnect(Conn) -> ok | {error, error_reason()} .br .fi .br .RS .LP Types: .RS 3 Conn = handle() .br .RE .RE .RS .LP Closes the given SSH connection\&. .LP If there are open NETCONF sessions on the connection, these will be brutally aborted\&. To avoid this, close each session with \fIclose_session/1,2\fR\& .RE .LP .nf .B edit_config(Client, Target, Config) -> Result .br .fi .br .nf .B edit_config(Client, Target, Config, OptParams) -> Result .br .fi .br .nf .B edit_config(Client, Target, Config, Timeout) -> Result .br .fi .br .nf .B edit_config(Client, Target, Config, OptParams, Timeout) -> Result .br .fi .br .RS .LP Types: .RS 3 Client = client() .br Target = netconf_db() .br Config = simple_xml() | [simple_xml()] .br OptParams = [simple_xml()] .br Timeout = timeout() .br Result = ok | {error, error_reason()} .br .RE .RE .RS .LP Edits configuration data\&. .LP By default only the running target is available, unless the server includes \fI:candidate\fR\& or \fI:startup\fR\& in its list of capabilities\&. .LP \fIOptParams\fR\& can be used for specifying optional parameters (\fIdefault-operation\fR\&, \fItest-option\fR\&, or \fIerror-option\fR\&) to be added to the \fIedit-config\fR\& request\&. The value must be a list containing valid simple XML, for example: .LP .nf [{'default-operation', ["none"]}, {'error-option', ["rollback-on-error"]}] .fi .LP If \fIOptParams\fR\& is not given, the default value \fI[]\fR\& is used\&. .RE .LP .nf .B get(Client, Filter) -> Result .br .fi .br .nf .B get(Client, Filter, Timeout) -> Result .br .fi .br .RS .LP Types: .RS 3 Client = client() .br Filter = simple_xml() | xpath() .br Timeout = timeout() .br Result = {ok, [simple_xml()]} | {error, error_reason()} .br .RE .RE .RS .LP Gets data\&. .LP This operation returns both configuration and state data from the server\&. .LP Filter type \fIxpath\fR\& can be used only if the server supports \fI:xpath\fR\&\&. .RE .LP .nf .B get_capabilities(Client) -> Result .br .fi .br .nf .B get_capabilities(Client, Timeout) -> Result .br .fi .br .RS .LP Types: .RS 3 Client = client() .br Timeout = timeout() .br Result = [string()] | {error, error_reason()} .br .RE .RE .RS .LP Returns the server capabilities as received in its hello message\&. .RE .LP .nf .B get_config(Client, Source, Filter) -> Result .br .fi .br .nf .B get_config(Client, Source, Filter, Timeout) -> Result .br .fi .br .RS .LP Types: .RS 3 Client = client() .br Source = netconf_db() .br Filter = simple_xml() | xpath() .br Timeout = timeout() .br Result = {ok, [simple_xml()]} | {error, error_reason()} .br .RE .RE .RS .LP Gets configuration data\&. .LP To be able to access another source than \fIrunning\fR\&, the server must advertise \fI:candidate\fR\& and/or \fI:startup\fR\&\&. .LP Filter type \fIxpath\fR\& can be used only if the server supports \fI:xpath\fR\&\&. .RE .LP .nf .B get_event_streams(Client) -> Result .br .fi .br .nf .B get_event_streams(Client, Timeout) -> Result .br .fi .br .nf .B get_event_streams(Client, Streams) -> Result .br .fi .br .nf .B get_event_streams(Client, Streams, Timeout) -> Result .br .fi .br .RS .LP Types: .RS 3 Client = client() .br Streams = [stream_name()] .br Timeout = timeout() .br Result = {ok, streams()} | {error, error_reason()} .br .RE .RE .RS .LP Sends a request to get the specified event streams\&. .LP \fIStreams\fR\& is a list of stream names\&. The following filter is sent to the NETCONF server in a \fIget\fR\& request: .LP .nf StreamName1 StreamName2 ... .fi .LP If \fIStreams\fR\& is an empty list, \fIall\fR\& streams are requested by sending the following filter: .LP .nf .fi .LP If more complex filtering is needed, use \fIct_netconfc:get/2,3\fR\& and specify the exact filter according to "XML Schema for Event Notifications" in RFC 5277\&. .RE .LP .nf .B get_session_id(Client) -> Result .br .fi .br .nf .B get_session_id(Client, Timeout) -> Result .br .fi .br .RS .LP Types: .RS 3 Client = client() .br Timeout = timeout() .br Result = integer() >= 1 | {error, error_reason()} .br .RE .RE .RS .LP Returns the session Id associated with the specified client\&. .RE .LP .nf .B hello(Client) -> Result .br .fi .br .nf .B hello(Client, Timeout) -> Result .br .fi .br .nf .B hello(Client, Options, Timeout) -> Result .br .fi .br .RS .LP Types: .RS 3 Client = handle() .br Options = [{capability, [string()]}] .br Timeout = timeout() .br Result = ok | {error, error_reason()} .br .RE .RE .RS .LP Exchanges \fIhello\fR\& messages with the server\&. Returns when the server hello has been received or after the specified timeout\&. .LP Note that capabilities for an outgoing hello can be passed directly to \fIopen/2\fR\&\&. .RE .LP .nf .B kill_session(Client, SessionId) -> Result .br .fi .br .nf .B kill_session(Client, SessionId, Timeout) -> Result .br .fi .br .RS .LP Types: .RS 3 Client = client() .br SessionId = integer() >= 1 .br Timeout = timeout() .br Result = ok | {error, error_reason()} .br .RE .RE .RS .LP Forces termination of the session associated with the supplied session Id\&. .LP The server side must abort any ongoing operations, release any locks and resources associated with the session, and close any associated connections\&. .LP 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\&. .LP If the specified \fISessionId\fR\& is equal to the current session Id, an error is returned\&. .RE .LP .nf .B lock(Client, Target) -> Result .br .fi .br .nf .B lock(Client, Target, Timeout) -> Result .br .fi .br .RS .LP Types: .RS 3 Client = client() .br Target = netconf_db() .br Timeout = timeout() .br Result = ok | {error, error_reason()} .br .RE .RE .RS .LP Locks the configuration target\&. .LP Which target parameters that can be used depends on if \fI:candidate\fR\& and/or \fI:startup\fR\& are supported by the server\&. If successfull, the configuration system of the device is unavailable to other clients (NETCONF, CORBA, SNMP, and so on)\&. Locks are intended to be short-lived\&. .LP Operation \fIkill_session/2,3\fR\& can be used to force the release of a lock owned by another NETCONF session\&. How this is achieved by the server side is implementation-specific\&. .RE .LP .nf .B only_open(Options) -> Result .br .fi .br .RS .LP Types: .RS 3 Options = [option()] .br Result = {ok, handle()} | {error, error_reason()} .br .RE .RE .RS .LP Opens a NETCONF session, but does not send \fIhello\fR\&\&. .LP As \fIopen/1\fR\&, but does not send a \fIhello\fR\& message\&. .RE .LP .nf .B only_open(KeyOrName, ExtraOptions) -> Result .br .fi .br .RS .LP Types: .RS 3 KeyOrName = ct:key_or_name() .br ExtraOptions = [option()] .br Result = {ok, handle()} | {error, error_reason()} .br .RE .RE .RS .LP Opens a named NETCONF session, but does not send \fIhello\fR\&\&. .LP As \fIopen/2\fR\&, but does not send a \fIhello\fR\& message\&. .RE .LP .nf .B open(Options) -> Result .br .fi .br .RS .LP Types: .RS 3 Options = [option()] .br Result = {ok, handle()} | {error, error_reason()} .br .RE .RE .RS .LP Opens a NETCONF session and exchanges \fIhello\fR\& messages\&. .LP If the server options are specified in a configuration file, or if a named client is needed for logging purposes (see section Logging in this module), use \fIopen/2\fR\& instead\&. .LP The opaque \fIhandle()\fR\& reference returned from this function is required as client identifier when calling any other function in this module\&. .RE .LP .nf .B open(KeyOrName, ExtraOption) -> Result .br .fi .br .RS .LP Types: .RS 3 KeyOrName = ct:key_or_name() .br ExtraOption = [option()] .br Result = {ok, handle()} | {error, error_reason()} .br .RE .RE .RS .LP Opens a named NETCONF session and exchanges \fIhello\fR\& messages\&. .LP If \fIKeyOrName\fR\& is a configured \fIserver_id()\fR\& or a \fItarget_name()\fR\& associated with such an Id, then the options for this server are fetched from the configuration file\&. .LP The options list is added to those of the configuration file\&. If an option is specified in both lists, the configuration file take precedence\&. .LP If the server is not specified in a configuration file, use \fIopen/1\fR\& instead\&. .LP The opaque \fIhandle()\fR\& reference returned from this function can be used as client identifier when calling any other function in this module\&. However, if \fIKeyOrName\fR\& is a \fItarget_name()\fR\&, that is, if the server is named through a call to \fIct:require/2\fR\& or a \fIrequire\fR\& statement in the test suite, then this name can be used instead of \fIhandle()\fR\&\&. .LP See also \fIct:require/2\fR\&\&. .RE .LP .nf .B send(Client, SimpleXml) -> Result .br .fi .br .nf .B send(Client, SimpleXml, Timeout) -> Result .br .fi .br .RS .LP Types: .RS 3 Client = client() .br SimpleXml = simple_xml() .br Timeout = timeout() .br Result = simple_xml() | {error, error_reason()} .br .RE .RE .RS .LP Sends an XML document to the server\&. .LP 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\&. .RE .LP .nf .B send_rpc(Client, SimpleXml) -> Result .br .fi .br .nf .B send_rpc(Client, SimpleXml, Timeout) -> Result .br .fi .br .RS .LP Types: .RS 3 Client = client() .br SimpleXml = simple_xml() .br Timeout = timeout() .br Result = [simple_xml()] | {error, error_reason()} .br .RE .RE .RS .LP Sends a NETCONF \fIrpc\fR\& request to the server\&. .LP The specified XML document is wrapped in a valid NETCONF \fIrpc\fR\& request and sent to the server\&. The \fImessage-id\fR\& and namespace attributes are added to element \fIrpc\fR\&\&. .LP This function can be used for sending \fIrpc\fR\& requests that cannot be expressed by other interface functions in this module\&. .RE .LP .nf .B session(Conn) -> Result .br .fi .br .nf .B session(Conn, Options) -> Result .br .fi .br .nf .B session(KeyOrName, Conn) -> Result .br .fi .br .nf .B session(KeyOrName, Conn, Options) -> Result .br .fi .br .RS .LP Types: .RS 3 Conn = handle() .br Options = [session_option()] .br KeyOrName = ct:key_or_name() .br Result = {ok, handle()} | {error, error_reason()} .br .nf \fBsession_option()\fR\& = .br {timeout, timeout()} | {capability, string() | [string()]} .fi .br .RE .RE .RS .LP Opens a NETCONF session as a channel on the given SSH connection, and exchanges hello messages with the server\&. .LP The opaque \fIhandle()\fR\& reference returned from this function can be used as client identifier when calling any other function in this module\&. However, if \fIKeyOrName\fR\& is used and it is a \fItarget_name()\fR\&, that is, if the server is named through a call to \fIct:require/2\fR\& or a \fIrequire\fR\& statement in the test suite, then this name can be used instead of \fIhandle()\fR\&\&. .RE .LP .nf .B unlock(Client, Target) -> Result .br .fi .br .nf .B unlock(Client, Target, Timeout) -> Result .br .fi .br .RS .LP Types: .RS 3 Client = client() .br Target = netconf_db() .br Timeout = timeout() .br Result = ok | {error, error_reason()} .br .RE .RE .RS .LP Unlocks the configuration target\&. .LP If the client earlier has acquired a lock through \fIlock/2,3\fR\&, this operation releases the associated lock\&. To access another target than \fIrunning\fR\&, the server must support \fI:candidate\fR\& and/or \fI:startup\fR\&\&. .RE