Statistics
| Branch: | Tag: | Revision:

root / docs / source / userdoc / operations.rst @ bbd4ce54

History | View | Annotate | Download (4 kB)

1 216bb34c Shikhar Bhushan
************************
2 216bb34c Shikhar Bhushan
:mod:`operations` module
3 216bb34c Shikhar Bhushan
************************
4 216bb34c Shikhar Bhushan
5 216bb34c Shikhar Bhushan
.. automodule:: ncclient.operations
6 216bb34c Shikhar Bhushan
    :synopsis: RPC and Operation layers
7 216bb34c Shikhar Bhushan
8 216bb34c Shikhar Bhushan
Base types
9 216bb34c Shikhar Bhushan
==========
10 216bb34c Shikhar Bhushan
11 216bb34c Shikhar Bhushan
.. currentmodule:: ncclient.operations.rpc
12 216bb34c Shikhar Bhushan
13 216bb34c Shikhar Bhushan
.. autoclass:: RPC(session[, async=False, timeout=None])
14 216bb34c Shikhar Bhushan
    :members: set_async, set_timeout, reply, error, event, async, timeout, id, session
15 216bb34c Shikhar Bhushan
16 216bb34c Shikhar Bhushan
.. autoclass:: RPCReply
17 216bb34c Shikhar Bhushan
    :members: ok, error, errors
18 216bb34c Shikhar Bhushan
19 216bb34c Shikhar Bhushan
.. autoclass:: RPCError
20 216bb34c Shikhar Bhushan
    :members: type, severity, tag, path, message, info
21 216bb34c Shikhar Bhushan
    :show-inheritance:
22 216bb34c Shikhar Bhushan
23 216bb34c Shikhar Bhushan
NETCONF Operations
24 216bb34c Shikhar Bhushan
==================
25 216bb34c Shikhar Bhushan
26 216bb34c Shikhar Bhushan
.. currentmodule:: ncclient.operations
27 216bb34c Shikhar Bhushan
28 216bb34c Shikhar Bhushan
Dependencies
29 216bb34c Shikhar Bhushan
-------------
30 216bb34c Shikhar Bhushan
31 216bb34c Shikhar Bhushan
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.
32 216bb34c Shikhar Bhushan
33 216bb34c Shikhar Bhushan
.. _return:
34 216bb34c Shikhar Bhushan
35 216bb34c Shikhar Bhushan
Return type
36 216bb34c Shikhar Bhushan
-----------
37 216bb34c Shikhar Bhushan
38 216bb34c Shikhar Bhushan
The return type for the :meth:`request` method depends of an operation on whether it is synchronous or asynchronous (see base class :class:`RPC`).
39 216bb34c Shikhar Bhushan
40 216bb34c Shikhar Bhushan
* 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.
41 216bb34c Shikhar Bhushan
42 216bb34c Shikhar Bhushan
* 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 :-)
43 216bb34c Shikhar Bhushan
44 216bb34c Shikhar Bhushan
General notes on parameters
45 216bb34c Shikhar Bhushan
----------------------------
46 216bb34c Shikhar Bhushan
47 216bb34c Shikhar Bhushan
.. _source_target:
48 216bb34c Shikhar Bhushan
49 216bb34c Shikhar Bhushan
Source / target parameters
50 216bb34c Shikhar Bhushan
^^^^^^^^^^^^^^^^^^^^^^^^^^^
51 216bb34c Shikhar Bhushan
52 216bb34c Shikhar Bhushan
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`.
53 216bb34c Shikhar Bhushan
54 216bb34c Shikhar Bhushan
If the source may be a *<config>* element, e.g. for :class:`Validate`, specify in :ref:`dtree` with the root element as *<config>*.
55 216bb34c Shikhar Bhushan
56 216bb34c Shikhar Bhushan
.. _filter:
57 216bb34c Shikhar Bhushan
58 216bb34c Shikhar Bhushan
Filter parameters
59 216bb34c Shikhar Bhushan
^^^^^^^^^^^^^^^^^^
60 216bb34c Shikhar Bhushan
61 216bb34c Shikhar Bhushan
Filter parameters, where applicable, can take one of the following types:
62 216bb34c Shikhar Bhushan
63 216bb34c Shikhar Bhushan
* A `tuple` of *(type, criteria)*.
64 216bb34c Shikhar Bhushan
    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 216bb34c Shikhar Bhushan
* A valid *<filter>* element in :ref:`dtree`.
66 216bb34c Shikhar Bhushan
67 216bb34c Shikhar Bhushan
Retrieval operations
68 216bb34c Shikhar Bhushan
--------------------
69 216bb34c Shikhar Bhushan
70 216bb34c Shikhar Bhushan
The reply object for these operations will be a :class:`GetReply` instance.
71 216bb34c Shikhar Bhushan
72 216bb34c Shikhar Bhushan
.. autoclass:: Get
73 216bb34c Shikhar Bhushan
    :show-inheritance:
74 216bb34c Shikhar Bhushan
    :members: request
75 216bb34c Shikhar Bhushan
76 216bb34c Shikhar Bhushan
.. autoclass:: GetConfig
77 216bb34c Shikhar Bhushan
    :show-inheritance:
78 216bb34c Shikhar Bhushan
    :members: request
79 216bb34c Shikhar Bhushan
80 216bb34c Shikhar Bhushan
.. autoclass:: GetReply
81 216bb34c Shikhar Bhushan
    :show-inheritance:
82 216bb34c Shikhar Bhushan
    :members: data, data_xml, data_dtree, data_ele
83 216bb34c Shikhar Bhushan
84 216bb34c Shikhar Bhushan
Locking operations
85 216bb34c Shikhar Bhushan
------------------
86 216bb34c Shikhar Bhushan
87 216bb34c Shikhar Bhushan
.. autoclass:: Lock
88 216bb34c Shikhar Bhushan
    :show-inheritance:
89 216bb34c Shikhar Bhushan
    :members: request
90 216bb34c Shikhar Bhushan
91 216bb34c Shikhar Bhushan
.. autoclass:: Unlock
92 216bb34c Shikhar Bhushan
    :show-inheritance:
93 216bb34c Shikhar Bhushan
    :members: request
94 216bb34c Shikhar Bhushan
95 216bb34c Shikhar Bhushan
Configuration operations
96 216bb34c Shikhar Bhushan
-------------------------
97 216bb34c Shikhar Bhushan
98 216bb34c Shikhar Bhushan
.. autoclass:: EditConfig
99 216bb34c Shikhar Bhushan
    :show-inheritance:
100 216bb34c Shikhar Bhushan
    :members: request
101 216bb34c Shikhar Bhushan
102 216bb34c Shikhar Bhushan
.. autoclass:: CopyConfig
103 216bb34c Shikhar Bhushan
    :show-inheritance:
104 216bb34c Shikhar Bhushan
    :members: request
105 216bb34c Shikhar Bhushan
106 216bb34c Shikhar Bhushan
.. autoclass:: DeleteConfig
107 216bb34c Shikhar Bhushan
    :show-inheritance:
108 216bb34c Shikhar Bhushan
    :members: request
109 216bb34c Shikhar Bhushan
110 216bb34c Shikhar Bhushan
.. autoclass:: Validate
111 216bb34c Shikhar Bhushan
    :show-inheritance:
112 216bb34c Shikhar Bhushan
    :members: request
113 216bb34c Shikhar Bhushan
114 216bb34c Shikhar Bhushan
.. autoclass:: Commit
115 216bb34c Shikhar Bhushan
    :show-inheritance:
116 216bb34c Shikhar Bhushan
    :members: request
117 216bb34c Shikhar Bhushan
118 216bb34c Shikhar Bhushan
.. autoclass:: DiscardChanges
119 216bb34c Shikhar Bhushan
    :show-inheritance:
120 216bb34c Shikhar Bhushan
    :members: request
121 216bb34c Shikhar Bhushan
122 216bb34c Shikhar Bhushan
Session management operations
123 216bb34c Shikhar Bhushan
------------------------------
124 216bb34c Shikhar Bhushan
125 216bb34c Shikhar Bhushan
.. autoclass:: CloseSession
126 216bb34c Shikhar Bhushan
    :show-inheritance:
127 216bb34c Shikhar Bhushan
    :members: request
128 216bb34c Shikhar Bhushan
129 216bb34c Shikhar Bhushan
.. autoclass:: KillSession
130 216bb34c Shikhar Bhushan
    :show-inheritance:
131 216bb34c Shikhar Bhushan
    :members: request
132 216bb34c Shikhar Bhushan
133 216bb34c Shikhar Bhushan
Also useful
134 216bb34c Shikhar Bhushan
-----------
135 216bb34c Shikhar Bhushan
136 216bb34c Shikhar Bhushan
.. autoclass:: LockContext
137 216bb34c Shikhar Bhushan
138 216bb34c Shikhar Bhushan
139 216bb34c Shikhar Bhushan
Errors
140 216bb34c Shikhar Bhushan
=======
141 216bb34c Shikhar Bhushan
142 216bb34c Shikhar Bhushan
.. autoexception:: OperationError
143 216bb34c Shikhar Bhushan
    :show-inheritance:
144 216bb34c Shikhar Bhushan
    :members:
145 216bb34c Shikhar Bhushan
146 216bb34c Shikhar Bhushan
.. autoexception:: TimeoutExpiredError
147 216bb34c Shikhar Bhushan
    :show-inheritance:
148 216bb34c Shikhar Bhushan
    :members:
149 216bb34c Shikhar Bhushan
150 216bb34c Shikhar Bhushan
.. autoexception:: MissingCapabilityError
151 216bb34c Shikhar Bhushan
    :show-inheritance:
152 216bb34c Shikhar Bhushan
    :members: