1 ************************
2 :mod:`operations` module
3 ************************
5 .. automodule:: ncclient.operations
6 :synopsis: RPC and Operation layers
11 .. currentmodule:: ncclient.operations.rpc
13 .. autoclass:: RPC(session[, async=False, timeout=None])
14 :members: set_async, set_timeout, reply, error, event, async, timeout, id, session
16 .. autoclass:: RPCReply
17 :members: ok, error, errors
19 .. autoclass:: RPCError
20 :members: type, severity, tag, path, message, info
26 .. currentmodule:: ncclient.operations
31 Operations may have a hard dependency on some capability, or the dependency may arise at request-time due to an optional argument. In any case, a :exc:`MissingCapabilityError` is raised if the server does not support the relevant capability.
38 The return type for the :meth:`request` method depends of an operation on whether it is synchronous or asynchronous (see base class :class:`RPC`).
40 * For synchronous requests, it will block waiting for the reply, and once it has been received an :class:`RPCReply` object is returned. If an error occured while waiting for the reply, it will be raised.
42 * For asynchronous requests, it will immediately return an :class:`~threading.Event` object. This event is set when a reply is received, or an error occurs that prevents a reply from being received. The :attr:`~RPC.reply` and :attr:`~RPC.error` attributes can then be accessed to determine which of the two it was :-)
44 General notes on parameters
45 ----------------------------
49 Source / target parameters
50 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
52 Where an operation takes a source or target parameter, it is mainly the case that it can be a datastore name or a URL. The latter, of course, depends on the *:url* capability and whether the capability supports the specific schema of the URL. Either must be specified as a `string`.
54 If the source may be a *<config>* element, e.g. for :class:`Validate`, specify in :ref:`dtree` with the root element as *<config>*.
61 Filter parameters, where applicable, can take one of the following types:
63 * A `tuple` of *(type, criteria)*.
64 Here type has to be one of "xpath" or "subtree". For type "xpath", the criteria should be a `string` that is a valid XPath expression. For type "subtree", criteria should be in :ref:`dtree` representing a valid subtree filter.
65 * A valid *<filter>* element in :ref:`dtree`.
70 The reply object for these operations will be a :class:`GetReply` instance.
76 .. autoclass:: GetConfig
80 .. autoclass:: GetReply
82 :members: data, data_xml, data_dtree, data_ele
95 Configuration operations
96 -------------------------
98 .. autoclass:: EditConfig
102 .. autoclass:: CopyConfig
106 .. autoclass:: DeleteConfig
110 .. autoclass:: Validate
114 .. autoclass:: Commit
118 .. autoclass:: DiscardChanges
122 Session management operations
123 ------------------------------
125 .. autoclass:: CloseSession
129 .. autoclass:: KillSession
136 .. autoclass:: LockContext
142 .. autoexception:: OperationError
146 .. autoexception:: TimeoutExpiredError
150 .. autoexception:: MissingCapabilityError