action(Client,Action)->Resultaction(Client,Action,Timeout)->Result
Types:
Client = client()
Action = simple_xml()
Timeout = timeout()
Result = ok | {ok, [simple_xml()]} | {error, error_reason()}
Executes an action. If the return type is void, ok is returned instead of {ok,[simple_xml()]}.
close_session(Client)->Resultclose_session(Client,Timeout)->Result
Types:
Client = client()
Timeout = timeout()
Result = ok | {error, error_reason()}
Requests graceful termination of the session associated with the client.
When a NETCONF server receives a close-session 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 close-session request are ignored.
connect(Options)->Result
Types:
Options = [option()]
Result = {ok, handle()} | {error, error_reason()}
Opens an SSH connection to a NETCONF server.
If the server options are specified in a configuration file, use connect/2 instead.
The opaque handle() reference returned from this function is required as connection identifier
when opening sessions over this connection, see session/1-3.
connect(KeyOrName,ExtraOptions)->Result
Types:
KeyOrName = ct:key_or_name()
ExtraOptions = [option()]
Result = {ok, handle()} | {error, error_reason()}
Open an SSH connection to a named NETCONF server.
If KeyOrName is a configured server_id() or a target_name() associated with such an Id, then the
options for this server are fetched from the configuration file.
The options list is added to those of the configuration file. If an option is specified in both
lists, the configuration file takes precedence.
If the server is not specified in a configuration file, use connect/1 instead.
The opaque handle() reference returned from this function can be used as connection identifier
when opening sessions over this connection, see session/1-3. However, if KeyOrName is a
target_name(), that is, if the server is named through a call to ct:require/2 or a require
statement in the test suite, then this name can be used instead of handle().
copy_config(Client,Target,Source)->Resultcopy_config(Client,Target,Source,Timeout)->Result
Types:
Client = client()
Target = Source = netconf_db()
Timeout = timeout()
Result = ok | {error, error_reason()}
Copies configuration data.
Which source and target options that can be issued depends on the capabilities supported by the
server. That is, :candidate and/or :startup are required.
create_subscription(Client,Values)->Resultcreate_subscription(Client,Values,Timeout)->Result
Types:
Client = client()
Values =
#{stream => Stream,
filter => Filter,
start => StartTime,
stop => StopTime}
Stream = stream_name()
Filter = simple_xml() | [simple_xml()]
StartTime = StopTime = xs_datetime()
Timeout = timeout()
Result = ok | {error, error_reason()}
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 notification().
From RFC 5722, 2.1 Subscribing to Receive Event Notifications:
Stream:
Indicates which stream of event is of interest. If not present, events in the default NETCONF
stream are sent.
Filter:
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.
StartTime:
Used to trigger the replay feature and indicate that the replay is to start at the time
specified. If StartTime 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 StartTime is specified earlier
than the log can support, the replay begins with the earliest available notification. This
parameter is of type dateTime and compliant to RFC 3339. Implementations must support time
zones.
StopTime:
Used with the optional replay feature to indicate the newest notifications of interest. If
StopTime is not present, the notifications continues until the subscription is terminated.
Must be used with and be later than StartTime. Values of StopTime in the future are valid.
This parameter is of type dateTime and compliant to RFC 3339. Implementations must support
time zones.
See RFC 5277 for more details. The requirement that StopTime must only be used with StartTime is
not enforced, to allow an invalid request to be sent to the server.
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.
Note:
create-subscription is no longer the only RPC with which NETCONF notifications can be ordered: RFC
8639 adds establish-subscription and future RFCs may add other methods. Specify a receiver option
at session creation to provide a destination for incoming notifications independently of a call to
create_subscription/2,3, and use send_rpc/2,3 to send establish-subscription and other arbirary
RPCs.
delete_config(Client,Target)->Resultdelete_config(Client,Target,Timeout)->Result
Types:
Client = client()
Target = startup | candidate
Timeout = timeout()
Result = ok | {error, error_reason()}
Deletes configuration data.
The running configuration cannot be deleted and :candidate or :startup must be advertised by the
server.
disconnect(Conn)->ok|{error,error_reason()}
Types:
Conn = handle()
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 close_session/1,2edit_config(Client,Target,Config)->Resultedit_config(Client,Target,Config,OptParams)->Resultedit_config(Client,Target,Config,Timeout)->Resultedit_config(Client,Target,Config,OptParams,Timeout)->Result
Types:
Client = client()
Target = netconf_db()
Config = simple_xml() | [simple_xml()]
OptParams = [simple_xml()]
Timeout = timeout()
Result = ok | {error, error_reason()}
Edits configuration data.
By default only the running target is available, unless the server includes :candidate or :startup
in its list of capabilities.
OptParams can be used for specifying optional parameters (default-operation, test-option, or
error-option) to be added to the edit-config request. The value must be a list containing valid
simple XML, for example:
[{'default-operation', ["none"]},
{'error-option', ["rollback-on-error"]}]
If OptParams is not given, the default value [] is used.
get(Client,Filter)->Resultget(Client,Filter,Timeout)->Result
Types:
Client = client()
Filter = simple_xml() | xpath()
Timeout = timeout()
Result = {ok, [simple_xml()]} | {error, error_reason()}
Gets data.
This operation returns both configuration and state data from the server.
Filter type xpath can be used only if the server supports :xpath.
get_capabilities(Client)->Resultget_capabilities(Client,Timeout)->Result
Types:
Client = client()
Timeout = timeout()
Result = [string()] | {error, error_reason()}
Returns the server capabilities as received in its hello message.
get_config(Client,Source,Filter)->Resultget_config(Client,Source,Filter,Timeout)->Result
Types:
Client = client()
Source = netconf_db()
Filter = simple_xml() | xpath()
Timeout = timeout()
Result = {ok, [simple_xml()]} | {error, error_reason()}
Gets configuration data.
To be able to access another source than running, the server must advertise :candidate and/or
:startup.
Filter type xpath can be used only if the server supports :xpath.
get_event_streams(Client)->Resultget_event_streams(Client,Timeout)->Resultget_event_streams(Client,Streams)->Resultget_event_streams(Client,Streams,Timeout)->Result
Types:
Client = client()
Streams = [stream_name()]
Timeout = timeout()
Result = {ok, streams()} | {error, error_reason()}
Sends a request to get the specified event streams.
Streams is a list of stream names. The following filter is sent to the NETCONF server in a get
request:
<netconf xmlns="urn:ietf:params:xml:ns:netmod:notification">
<streams>
<stream>
<name>StreamName1</name>
</stream>
<stream>
<name>StreamName2</name>
</stream>
...
</streams>
</netconf>
If Streams is an empty list, all streams are requested by sending the following filter:
<netconf xmlns="urn:ietf:params:xml:ns:netmod:notification">
<streams/>
</netconf>
If more complex filtering is needed, use ct_netconfc:get/2,3 and specify the exact filter
according to "XML Schema for Event Notifications" in RFC 5277.
get_session_id(Client)->Resultget_session_id(Client,Timeout)->Result
Types:
Client = client()
Timeout = timeout()
Result = integer() >= 1 | {error, error_reason()}
Returns the session Id associated with the specified client.
hello(Client)->Resulthello(Client,Timeout)->Resulthello(Client,Options,Timeout)->Result
Types:
Client = handle()
Options = [{capability, [string()]}]
Timeout = timeout()
Result = ok | {error, error_reason()}
Exchanges hello messages with the server. Returns when the server hello has been received or after
the specified timeout.
Note that capabilities for an outgoing hello can be passed directly to open/2.
kill_session(Client,SessionId)->Resultkill_session(Client,SessionId,Timeout)->Result
Types:
Client = client()
SessionId = integer() >= 1
Timeout = timeout()
Result = ok | {error, error_reason()}
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 SessionId is equal to the current session Id, an error is returned.
lock(Client,Target)->Resultlock(Client,Target,Timeout)->Result
Types:
Client = client()
Target = netconf_db()
Timeout = timeout()
Result = ok | {error, error_reason()}
Locks the configuration target.
Which target parameters that can be used depends on if :candidate and/or :startup 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.
Operation kill_session/2,3 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.
only_open(Options)->Result
Types:
Options = [option()]
Result = {ok, handle()} | {error, error_reason()}
Opens a NETCONF session, but does not send hello.
As open/1, but does not send a hello message.
only_open(KeyOrName,ExtraOptions)->Result
Types:
KeyOrName = ct:key_or_name()
ExtraOptions = [option()]
Result = {ok, handle()} | {error, error_reason()}
Opens a named NETCONF session, but does not send hello.
As open/2, but does not send a hello message.
open(Options)->Result
Types:
Options = [option()]
Result = {ok, handle()} | {error, error_reason()}
Opens a NETCONF session and exchanges hello messages.
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 open/2 instead.
The opaque handle() reference returned from this function is required as client identifier when
calling any other function in this module.
open(KeyOrName,ExtraOption)->Result
Types:
KeyOrName = ct:key_or_name()
ExtraOption = [option()]
Result = {ok, handle()} | {error, error_reason()}
Opens a named NETCONF session and exchanges hello messages.
If KeyOrName is a configured server_id() or a target_name() associated with such an Id, then the
options for this server are fetched from the configuration file.
The options list is added to those of the configuration file. If an option is specified in both
lists, the configuration file take precedence.
If the server is not specified in a configuration file, use open/1 instead.
The opaque handle() reference returned from this function can be used as client identifier when
calling any other function in this module. However, if KeyOrName is a target_name(), that is, if
the server is named through a call to ct:require/2 or a require statement in the test suite, then
this name can be used instead of handle().
See also ct:require/2.
send(Client,SimpleXml)->Resultsend(Client,SimpleXml,Timeout)->Result
Types:
Client = client()
SimpleXml = simple_xml()
Timeout = timeout()
Result = simple_xml() | {error, error_reason()}
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.
send_rpc(Client,SimpleXml)->Resultsend_rpc(Client,SimpleXml,Timeout)->Result
Types:
Client = client()
SimpleXml = simple_xml()
Timeout = timeout()
Result = [simple_xml()] | {error, error_reason()}
Sends a NETCONF rpc request to the server.
The specified XML document is wrapped in a valid NETCONF rpc request and sent to the server. The
message-id and namespace attributes are added to element rpc.
This function can be used for sending rpc requests that cannot be expressed by other interface
functions in this module.
session(Conn)->Resultsession(Conn,Options)->Resultsession(KeyOrName,Conn)->Resultsession(KeyOrName,Conn,Options)->Result
Types:
Conn = handle()
Options = [session_option()]
KeyOrName = ct:key_or_name()
Result = {ok, handle()} | {error, error_reason()}
session_option() =
{timeout, timeout()} |
{receiver, term()} |
{capability, string() | [string()]}
Opens a NETCONF session as a channel on the given SSH connection, and exchanges hello messages
with the server.
The opaque handle() reference returned from this function can be used as client identifier when
calling any other function in this module. However, if KeyOrName is used and it is a
target_name(), that is, if the server is named through a call to ct:require/2 or a require
statement in the test suite, then this name can be used instead of handle().
unlock(Client,Target)->Resultunlock(Client,Target,Timeout)->Result
Types:
Client = client()
Target = netconf_db()
Timeout = timeout()
Result = ok | {error, error_reason()}
Unlocks the configuration target.
If the client earlier has acquired a lock through lock/2,3, this operation releases the associated
lock. To access another target than running, the server must support :candidate and/or :startup.
Ericsson AB common_test 1.22 ct_netconfc(3erl)