root / docs / build / latex / ncclient.tex @ 216bb34c
History | View | Annotate | Download (56.3 kB)
1 |
% Generated by Sphinx. |
---|---|
2 |
\documentclass[a4paper,10pt,english]{manual} |
3 |
\usepackage[utf8]{inputenc} |
4 |
\usepackage[T1]{fontenc} |
5 |
\usepackage{babel} |
6 |
\usepackage{times} |
7 |
\usepackage[Bjarne]{fncychap} |
8 |
\usepackage{sphinx} |
9 |
|
10 |
|
11 |
\title{NCClient Documentation} |
12 |
\date{May 17, 2009} |
13 |
\release{0.1.1a} |
14 |
\author{Shikhar Bhushan} |
15 |
\newcommand{\sphinxlogo}{} |
16 |
\renewcommand{\releasename}{Release} |
17 |
\makeindex |
18 |
\makemodindex |
19 |
\newcommand\PYGZat{@} |
20 |
\newcommand\PYGZlb{[} |
21 |
\newcommand\PYGZrb{]} |
22 |
\newcommand\PYGaz[1]{\textcolor[rgb]{0.00,0.63,0.00}{#1}} |
23 |
\newcommand\PYGax[1]{\textcolor[rgb]{0.84,0.33,0.22}{\textbf{#1}}} |
24 |
\newcommand\PYGay[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{#1}}} |
25 |
\newcommand\PYGar[1]{\textcolor[rgb]{0.73,0.38,0.84}{#1}} |
26 |
\newcommand\PYGas[1]{\textcolor[rgb]{0.25,0.44,0.63}{\textit{#1}}} |
27 |
\newcommand\PYGap[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{#1}}} |
28 |
\newcommand\PYGaq[1]{\textcolor[rgb]{0.38,0.68,0.84}{#1}} |
29 |
\newcommand\PYGav[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{#1}}} |
30 |
\newcommand\PYGaw[1]{\textcolor[rgb]{0.13,0.50,0.31}{#1}} |
31 |
\newcommand\PYGat[1]{\textcolor[rgb]{0.73,0.38,0.84}{#1}} |
32 |
\newcommand\PYGau[1]{\textcolor[rgb]{0.32,0.47,0.09}{#1}} |
33 |
\newcommand\PYGaj[1]{\textcolor[rgb]{0.00,0.44,0.13}{#1}} |
34 |
\newcommand\PYGak[1]{\textcolor[rgb]{0.14,0.33,0.53}{#1}} |
35 |
\newcommand\PYGah[1]{\textcolor[rgb]{0.00,0.13,0.44}{\textbf{#1}}} |
36 |
\newcommand\PYGai[1]{\textcolor[rgb]{0.73,0.38,0.84}{#1}} |
37 |
\newcommand\PYGan[1]{\textcolor[rgb]{0.13,0.50,0.31}{#1}} |
38 |
\newcommand\PYGao[1]{\textcolor[rgb]{0.25,0.44,0.63}{\textbf{#1}}} |
39 |
\newcommand\PYGal[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{#1}}} |
40 |
\newcommand\PYGam[1]{\textbf{#1}} |
41 |
\newcommand\PYGab[1]{\textit{#1}} |
42 |
\newcommand\PYGac[1]{\textcolor[rgb]{0.25,0.44,0.63}{#1}} |
43 |
\newcommand\PYGaa[1]{\textcolor[rgb]{0.19,0.19,0.19}{#1}} |
44 |
\newcommand\PYGaf[1]{\textcolor[rgb]{0.25,0.50,0.56}{\textit{#1}}} |
45 |
\newcommand\PYGag[1]{\textcolor[rgb]{0.13,0.50,0.31}{#1}} |
46 |
\newcommand\PYGad[1]{\textcolor[rgb]{0.00,0.25,0.82}{#1}} |
47 |
\newcommand\PYGae[1]{\textcolor[rgb]{0.13,0.50,0.31}{#1}} |
48 |
\newcommand\PYGaZ[1]{\textcolor[rgb]{0.25,0.44,0.63}{#1}} |
49 |
\newcommand\PYGbf[1]{\textcolor[rgb]{0.00,0.44,0.13}{#1}} |
50 |
\newcommand\PYGaX[1]{\textcolor[rgb]{0.25,0.44,0.63}{#1}} |
51 |
\newcommand\PYGaY[1]{\textcolor[rgb]{0.00,0.44,0.13}{#1}} |
52 |
\newcommand\PYGbc[1]{\textcolor[rgb]{0.78,0.36,0.04}{#1}} |
53 |
\newcommand\PYGbb[1]{\textcolor[rgb]{0.00,0.00,0.50}{\textbf{#1}}} |
54 |
\newcommand\PYGba[1]{\textcolor[rgb]{0.02,0.16,0.45}{\textbf{#1}}} |
55 |
\newcommand\PYGaR[1]{\textcolor[rgb]{0.25,0.44,0.63}{#1}} |
56 |
\newcommand\PYGaS[1]{\textcolor[rgb]{0.13,0.50,0.31}{#1}} |
57 |
\newcommand\PYGaP[1]{\textcolor[rgb]{0.05,0.52,0.71}{\textbf{#1}}} |
58 |
\newcommand\PYGaQ[1]{\textcolor[rgb]{0.78,0.36,0.04}{\textbf{#1}}} |
59 |
\newcommand\PYGaV[1]{\textcolor[rgb]{0.25,0.50,0.56}{\textit{#1}}} |
60 |
\newcommand\PYGaW[1]{\textcolor[rgb]{0.05,0.52,0.71}{\textbf{#1}}} |
61 |
\newcommand\PYGaT[1]{\textcolor[rgb]{0.73,0.38,0.84}{#1}} |
62 |
\newcommand\PYGaU[1]{\textcolor[rgb]{0.13,0.50,0.31}{#1}} |
63 |
\newcommand\PYGaJ[1]{\textcolor[rgb]{0.56,0.13,0.00}{#1}} |
64 |
\newcommand\PYGaK[1]{\textcolor[rgb]{0.25,0.44,0.63}{#1}} |
65 |
\newcommand\PYGaH[1]{\textcolor[rgb]{0.50,0.00,0.50}{\textbf{#1}}} |
66 |
\newcommand\PYGaI[1]{\fcolorbox[rgb]{1.00,0.00,0.00}{1,1,1}{#1}} |
67 |
\newcommand\PYGaN[1]{\textcolor[rgb]{0.73,0.73,0.73}{#1}} |
68 |
\newcommand\PYGaO[1]{\textcolor[rgb]{0.00,0.44,0.13}{#1}} |
69 |
\newcommand\PYGaL[1]{\textcolor[rgb]{0.02,0.16,0.49}{#1}} |
70 |
\newcommand\PYGaM[1]{\colorbox[rgb]{1.00,0.94,0.94}{\textcolor[rgb]{0.25,0.50,0.56}{#1}}} |
71 |
\newcommand\PYGaB[1]{\textcolor[rgb]{0.25,0.44,0.63}{#1}} |
72 |
\newcommand\PYGaC[1]{\textcolor[rgb]{0.33,0.33,0.33}{\textbf{#1}}} |
73 |
\newcommand\PYGaA[1]{\textcolor[rgb]{0.00,0.44,0.13}{#1}} |
74 |
\newcommand\PYGaF[1]{\textcolor[rgb]{0.63,0.00,0.00}{#1}} |
75 |
\newcommand\PYGaG[1]{\textcolor[rgb]{1.00,0.00,0.00}{#1}} |
76 |
\newcommand\PYGaD[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{#1}}} |
77 |
\newcommand\PYGaE[1]{\textcolor[rgb]{0.25,0.50,0.56}{\textit{#1}}} |
78 |
\newcommand\PYGbg[1]{\textcolor[rgb]{0.44,0.63,0.82}{\textit{#1}}} |
79 |
\newcommand\PYGbe[1]{\textcolor[rgb]{0.40,0.40,0.40}{#1}} |
80 |
\newcommand\PYGbd[1]{\textcolor[rgb]{0.25,0.44,0.63}{#1}} |
81 |
\newcommand\PYGbh[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{#1}}} |
82 |
\begin{document} |
83 |
|
84 |
\maketitle |
85 |
\tableofcontents |
86 |
|
87 |
|
88 |
|
89 |
\resetcurrentobjects |
90 |
\hypertarget{--doc-intro}{} |
91 |
|
92 |
\chapter{Introduction} |
93 |
|
94 |
NCClient is a Python library for NETCONF clients. NETCONF is a network management protocol defined in \index{RFC!RFC 4741}\href{http://tools.ietf.org/html/rfc4741.html}{\textbf{RFC 4741}}. It is meant for Python 2.6+ (not Python 3 yet, though). |
95 |
|
96 |
The features of NCClient include: |
97 |
\begin{itemize} |
98 |
\item {} |
99 |
Request pipelining. |
100 |
|
101 |
\item {} |
102 |
(A)synchronous RPC requests. |
103 |
|
104 |
\item {} |
105 |
Keeps XML out of the way unless really needed. |
106 |
|
107 |
\item {} |
108 |
Supports all operations and capabilities defined in \index{RFC!RFC 4741}\href{http://tools.ietf.org/html/rfc4741.html}{\textbf{RFC 4741}}. |
109 |
|
110 |
\item {} |
111 |
Extensible. New transport mappings and capabilities/operations can be easily added. |
112 |
|
113 |
\end{itemize} |
114 |
|
115 |
The best way to introduce is of course, through a simple code example: |
116 |
|
117 |
\begin{Verbatim}[commandchars=@\[\]] |
118 |
@PYGal[from] @PYGaW[ncclient] @PYGal[import] manager |
119 |
|
120 |
@PYGay[with] manager@PYGbe[.]connect@_ssh(@PYGaB[']@PYGaB[host]@PYGaB['], @PYGaB[']@PYGaB[username]@PYGaB[']) @PYGay[as] m: |
121 |
@PYGay[assert](@PYGaB["]@PYGaB[:url]@PYGaB["] @PYGav[in] manager@PYGbe[.]server@_capabilities) |
122 |
@PYGay[with] m@PYGbe[.]locked(@PYGaB[']@PYGaB[running]@PYGaB[']): |
123 |
m@PYGbe[.]copy@_config(source@PYGbe[=]@PYGaB["]@PYGaB[running]@PYGaB["], target@PYGbe[=]@PYGaB["]@PYGaB[file://new@_checkpoint.conf]@PYGaB["]) |
124 |
m@PYGbe[.]copy@_config(source@PYGbe[=]@PYGaB["]@PYGaB[file://old@_checkpoint.conf]@PYGaB["], target@PYGbe[=]@PYGaB["]@PYGaB[running]@PYGaB["]) |
125 |
\end{Verbatim} |
126 |
|
127 |
It is recommended to use the high-level \code{Manager} API where possible. It exposes almost all of the functionality. |
128 |
|
129 |
\resetcurrentobjects |
130 |
\hypertarget{--doc-userdoc}{} |
131 |
|
132 |
\hypertarget{userdoc}{}\chapter{User documentation} |
133 |
|
134 |
\resetcurrentobjects |
135 |
\hypertarget{--doc-userdoc/manager}{} |
136 |
|
137 |
\section{\texttt{manager} module} |
138 |
\index{ncclient.manager (module)} |
139 |
\hypertarget{module-ncclient.manager}{} |
140 |
\declaremodule[ncclient.manager]{}{ncclient.manager} |
141 |
\modulesynopsis{} |
142 |
|
143 |
\subsection{Dealing with RPC errors} |
144 |
|
145 |
These constants define what \hyperlink{ncclient.manager.Manager}{\code{Manager}} does when an \emph{\textless{}rpc-error\textgreater{}} element is encountered in a reply. |
146 |
\index{RAISE\_ALL (in module ncclient.manager)} |
147 |
|
148 |
\hypertarget{ncclient.manager.RAISE_ALL}{}\begin{datadesc}{RAISE\_ALL} |
149 |
Raise all \hyperlink{ncclient.operations.rpc.RPCError}{\code{RPCError}} |
150 |
\end{datadesc} |
151 |
\index{RAISE\_ERR (in module ncclient.manager)} |
152 |
|
153 |
\hypertarget{ncclient.manager.RAISE_ERR}{}\begin{datadesc}{RAISE\_ERR} |
154 |
Only raise when \emph{error-severity} is ``error'' i.e. no warnings |
155 |
\end{datadesc} |
156 |
\index{RAISE\_NONE (in module ncclient.manager)} |
157 |
|
158 |
\hypertarget{ncclient.manager.RAISE_NONE}{}\begin{datadesc}{RAISE\_NONE} |
159 |
Don't raise any |
160 |
\end{datadesc} |
161 |
|
162 |
|
163 |
\subsection{Manager instances} |
164 |
|
165 |
\hyperlink{ncclient.manager.Manager}{\code{Manager}} instances are created by the \hyperlink{ncclient.manager.connect}{\code{connect()}} family of factory functions. Currently only \hyperlink{ncclient.manager.connect_ssh}{\code{connect\_ssh()}} is available. |
166 |
\index{connect() (in module ncclient.manager)} |
167 |
|
168 |
\hypertarget{ncclient.manager.connect}{}\begin{funcdesc}{connect}{*args, **kwds} |
169 |
Same as \hyperlink{ncclient.manager.connect_ssh}{\code{connect\_ssh()}} |
170 |
\end{funcdesc} |
171 |
\index{connect\_ssh() (in module ncclient.manager)} |
172 |
|
173 |
\hypertarget{ncclient.manager.connect_ssh}{}\begin{funcdesc}{connect\_ssh}{*args, **kwds} |
174 |
Connect to NETCONF server over SSH. See \hyperlink{ncclient.transport.SSHSession.connect}{\code{SSHSession.connect()}} for function signature. |
175 |
\end{funcdesc} |
176 |
\index{Manager (class in ncclient.manager)} |
177 |
|
178 |
\hypertarget{ncclient.manager.Manager}{}\begin{classdesc}{Manager}{session} |
179 |
API for NETCONF operations. Currently only supports making synchronous |
180 |
RPC requests. |
181 |
|
182 |
It is also a context manager, so a \hyperlink{ncclient.manager.Manager}{\code{Manager}} instance can be used |
183 |
with the \emph{with} statement. The session is closed when the context ends. |
184 |
\index{set\_rpc\_error\_action() (ncclient.manager.Manager method)} |
185 |
|
186 |
\hypertarget{ncclient.manager.Manager.set_rpc_error_action}{}\begin{methoddesc}{set\_rpc\_error\_action}{action} |
187 |
Specify the action to take when an \emph{\textless{}rpc-error\textgreater{}} element is encountered. |
188 |
\begin{quote}\begin{description} |
189 |
\item[Parameter] |
190 |
\emph{action} -- one of \hyperlink{ncclient.manager.RAISE_ALL}{\code{RAISE\_ALL}}, \hyperlink{ncclient.manager.RAISE_ERR}{\code{RAISE\_ERR}}, \hyperlink{ncclient.manager.RAISE_NONE}{\code{RAISE\_NONE}} |
191 |
|
192 |
\end{description}\end{quote} |
193 |
\end{methoddesc} |
194 |
\index{get() (ncclient.manager.Manager method)} |
195 |
|
196 |
\hypertarget{ncclient.manager.Manager.get}{}\begin{methoddesc}{get}{*args, **kwds}~\begin{quote}\begin{description} |
197 |
\item[See] |
198 |
\hyperlink{ncclient.operations.Get.request}{\code{Get.request()}} |
199 |
|
200 |
\end{description}\end{quote} |
201 |
\end{methoddesc} |
202 |
\index{get\_config() (ncclient.manager.Manager method)} |
203 |
|
204 |
\hypertarget{ncclient.manager.Manager.get_config}{}\begin{methoddesc}{get\_config}{*args, **kwds}~\begin{quote}\begin{description} |
205 |
\item[See] |
206 |
\hyperlink{ncclient.operations.GetConfig.request}{\code{GetConfig.request()}} |
207 |
|
208 |
\end{description}\end{quote} |
209 |
\end{methoddesc} |
210 |
\index{edit\_config() (ncclient.manager.Manager method)} |
211 |
|
212 |
\hypertarget{ncclient.manager.Manager.edit_config}{}\begin{methoddesc}{edit\_config}{*args, **kwds}~\begin{quote}\begin{description} |
213 |
\item[See] |
214 |
\hyperlink{ncclient.operations.EditConfig.request}{\code{EditConfig.request()}} |
215 |
|
216 |
\end{description}\end{quote} |
217 |
\end{methoddesc} |
218 |
\index{copy\_config() (ncclient.manager.Manager method)} |
219 |
|
220 |
\hypertarget{ncclient.manager.Manager.copy_config}{}\begin{methoddesc}{copy\_config}{*args, **kwds}~\begin{quote}\begin{description} |
221 |
\item[See] |
222 |
\hyperlink{ncclient.operations.CopyConfig.request}{\code{CopyConfig.request()}} |
223 |
|
224 |
\end{description}\end{quote} |
225 |
\end{methoddesc} |
226 |
\index{validate() (ncclient.manager.Manager method)} |
227 |
|
228 |
\hypertarget{ncclient.manager.Manager.validate}{}\begin{methoddesc}{validate}{*args, **kwds}~\begin{quote}\begin{description} |
229 |
\item[See] |
230 |
\hyperlink{ncclient.operations.Validate.request}{\code{GetConfig.request()}} |
231 |
|
232 |
\end{description}\end{quote} |
233 |
\end{methoddesc} |
234 |
\index{commit() (ncclient.manager.Manager method)} |
235 |
|
236 |
\hypertarget{ncclient.manager.Manager.commit}{}\begin{methoddesc}{commit}{*args, **kwds}~\begin{quote}\begin{description} |
237 |
\item[See] |
238 |
\hyperlink{ncclient.operations.Commit.request}{\code{Commit.request()}} |
239 |
|
240 |
\end{description}\end{quote} |
241 |
\end{methoddesc} |
242 |
\index{discard\_changes() (ncclient.manager.Manager method)} |
243 |
|
244 |
\hypertarget{ncclient.manager.Manager.discard_changes}{}\begin{methoddesc}{discard\_changes}{*args, **kwds}~\begin{quote}\begin{description} |
245 |
\item[See] |
246 |
\hyperlink{ncclient.operations.DiscardChanges.request}{\code{DiscardChanges.request()}} |
247 |
|
248 |
\end{description}\end{quote} |
249 |
\end{methoddesc} |
250 |
\index{delete\_config() (ncclient.manager.Manager method)} |
251 |
|
252 |
\hypertarget{ncclient.manager.Manager.delete_config}{}\begin{methoddesc}{delete\_config}{*args, **kwds}~\begin{quote}\begin{description} |
253 |
\item[See] |
254 |
\hyperlink{ncclient.operations.DeleteConfig.request}{\code{DeleteConfig.request()}} |
255 |
|
256 |
\end{description}\end{quote} |
257 |
\end{methoddesc} |
258 |
\index{lock() (ncclient.manager.Manager method)} |
259 |
|
260 |
\hypertarget{ncclient.manager.Manager.lock}{}\begin{methoddesc}{lock}{*args, **kwds}~\begin{quote}\begin{description} |
261 |
\item[See] |
262 |
\hyperlink{ncclient.operations.Lock.request}{\code{Lock.request()}} |
263 |
|
264 |
\end{description}\end{quote} |
265 |
\end{methoddesc} |
266 |
\index{unlock() (ncclient.manager.Manager method)} |
267 |
|
268 |
\hypertarget{ncclient.manager.Manager.unlock}{}\begin{methoddesc}{unlock}{*args, **kwds}~\begin{quote}\begin{description} |
269 |
\item[See] |
270 |
\hyperlink{ncclient.operations.Unlock.request}{\code{DiscardChanges.request()}} |
271 |
|
272 |
\end{description}\end{quote} |
273 |
\end{methoddesc} |
274 |
\index{close\_session() (ncclient.manager.Manager method)} |
275 |
|
276 |
\hypertarget{ncclient.manager.Manager.close_session}{}\begin{methoddesc}{close\_session}{*args, **kwds}~\begin{quote}\begin{description} |
277 |
\item[See] |
278 |
\code{CloseSession.request()} |
279 |
|
280 |
\end{description}\end{quote} |
281 |
\end{methoddesc} |
282 |
\index{kill\_session() (ncclient.manager.Manager method)} |
283 |
|
284 |
\hypertarget{ncclient.manager.Manager.kill_session}{}\begin{methoddesc}{kill\_session}{*args, **kwds}~\begin{quote}\begin{description} |
285 |
\item[See] |
286 |
\code{KillSession.request()} |
287 |
|
288 |
\end{description}\end{quote} |
289 |
\end{methoddesc} |
290 |
\index{locked() (ncclient.manager.Manager method)} |
291 |
|
292 |
\hypertarget{ncclient.manager.Manager.locked}{}\begin{methoddesc}{locked}{target} |
293 |
Returns a context manager for the \emph{with} statement. |
294 |
\begin{quote}\begin{description} |
295 |
\item[Parameter] |
296 |
\emph{target} (\href{http://docs.python.org/library/string.html\#string}{\code{string}}) -- name of the datastore to lock |
297 |
|
298 |
\item[Return type] |
299 |
\code{operations.LockContext} |
300 |
|
301 |
\end{description}\end{quote} |
302 |
\end{methoddesc} |
303 |
\index{close() (ncclient.manager.Manager method)} |
304 |
|
305 |
\hypertarget{ncclient.manager.Manager.close}{}\begin{methoddesc}{close}{} |
306 |
Closes the NETCONF session. First does \emph{\textless{}close-session\textgreater{}} RPC. |
307 |
\end{methoddesc} |
308 |
\index{client\_capabilities (ncclient.manager.Manager attribute)} |
309 |
|
310 |
\hypertarget{ncclient.manager.Manager.client_capabilities}{}\begin{memberdesc}{client\_capabilities} |
311 |
\hyperlink{ncclient.capabilities.Capabilities}{\code{Capabilities}} object for client |
312 |
\end{memberdesc} |
313 |
\index{server\_capabilities (ncclient.manager.Manager attribute)} |
314 |
|
315 |
\hypertarget{ncclient.manager.Manager.server_capabilities}{}\begin{memberdesc}{server\_capabilities} |
316 |
\hyperlink{ncclient.capabilities.Capabilities}{\code{Capabilities}} object for server |
317 |
\end{memberdesc} |
318 |
\index{session\_id (ncclient.manager.Manager attribute)} |
319 |
|
320 |
\hypertarget{ncclient.manager.Manager.session_id}{}\begin{memberdesc}{session\_id} |
321 |
\emph{\textless{}session-id\textgreater{}} as assigned by NETCONF server |
322 |
\end{memberdesc} |
323 |
\index{connected (ncclient.manager.Manager attribute)} |
324 |
|
325 |
\hypertarget{ncclient.manager.Manager.connected}{}\begin{memberdesc}{connected} |
326 |
Whether currently connected to NETCONF server |
327 |
\end{memberdesc} |
328 |
\end{classdesc} |
329 |
|
330 |
\resetcurrentobjects |
331 |
\hypertarget{--doc-userdoc/capabilities}{} |
332 |
|
333 |
\section{\texttt{capabilities} module} |
334 |
\index{ncclient.capabilities (module)} |
335 |
\hypertarget{module-ncclient.capabilities}{} |
336 |
\declaremodule[ncclient.capabilities]{}{ncclient.capabilities} |
337 |
\modulesynopsis{}\index{CAPABILITIES (in module ncclient.capabilities)} |
338 |
|
339 |
\hypertarget{ncclient.capabilities.CAPABILITIES}{}\begin{datadesc}{CAPABILITIES} |
340 |
\hyperlink{ncclient.capabilities.Capabilities}{\code{Capabilities}} object representing the capabilities currently supported by NCClient |
341 |
\end{datadesc} |
342 |
\index{Capabilities (class in ncclient.capabilities)} |
343 |
|
344 |
\hypertarget{ncclient.capabilities.Capabilities}{}\begin{classdesc}{Capabilities}{capabilities} |
345 |
Represents the set of capabilities for a NETCONF client or server. |
346 |
Initialised with a list of capability URI's. |
347 |
|
348 |
Presence of a capability can be checked with the \emph{in} operations. In addition |
349 |
to the URI, for capabilities of the form |
350 |
\emph{urn:ietf:params:netconf:capability:\$name:\$version} their shorthand can be |
351 |
used as a key. For example, for |
352 |
\emph{urn:ietf:params:netconf:capability:candidate:1.0} the shorthand would be |
353 |
\emph{:candidate}. If version is significant, use \emph{:candidate:1.0} as key. |
354 |
\index{add() (ncclient.capabilities.Capabilities method)} |
355 |
|
356 |
\hypertarget{ncclient.capabilities.Capabilities.add}{}\begin{methoddesc}{add}{uri} |
357 |
Add a capability |
358 |
\end{methoddesc} |
359 |
\index{check() (ncclient.capabilities.Capabilities method)} |
360 |
|
361 |
\hypertarget{ncclient.capabilities.Capabilities.check}{}\begin{methoddesc}{check}{key} |
362 |
Whether specified capability is present. |
363 |
\begin{quote}\begin{description} |
364 |
\item[Parameter] |
365 |
\emph{key} -- URI or shorthand |
366 |
|
367 |
\end{description}\end{quote} |
368 |
\end{methoddesc} |
369 |
\index{remove() (ncclient.capabilities.Capabilities method)} |
370 |
|
371 |
\hypertarget{ncclient.capabilities.Capabilities.remove}{}\begin{methoddesc}{remove}{uri} |
372 |
Remove a capability |
373 |
\end{methoddesc} |
374 |
\end{classdesc} |
375 |
|
376 |
\resetcurrentobjects |
377 |
\hypertarget{--doc-userdoc/content}{} |
378 |
|
379 |
\section{\texttt{content} module} |
380 |
\index{ncclient.content (module)} |
381 |
\hypertarget{module-ncclient.content}{} |
382 |
\declaremodule[ncclient.content]{}{ncclient.content} |
383 |
\modulesynopsis{Content layer} |
384 |
The \code{content} module provides methods for creating XML documents, parsing XML, and converting between different XML representations. It uses \href{http://docs.python.org/library/xml.etree.elementtree.html\#module-xml.etree.ElementTree}{\code{ElementTree}} internally. |
385 |
|
386 |
|
387 |
\subsection{Namespaces} |
388 |
|
389 |
The following namespace is defined in this module. |
390 |
\index{BASE\_NS (in module ncclient.content)} |
391 |
|
392 |
\hypertarget{ncclient.content.BASE_NS}{}\begin{datadesc}{BASE\_NS} |
393 |
Base NETCONf namespace |
394 |
\end{datadesc} |
395 |
|
396 |
Namespaces are handled just the same way as \href{http://docs.python.org/library/xml.etree.elementtree.html\#module-xml.etree.ElementTree}{\code{ElementTree}}. So a qualified name takes the form \emph{\{namespace\}tag}. There are some utility functions for qualified names: |
397 |
\index{qualify() (in module ncclient.content)} |
398 |
|
399 |
\hypertarget{ncclient.content.qualify}{}\begin{funcdesc}{qualify}{tag, {[}ns=BASE\_NS{]}}~\begin{quote}\begin{description} |
400 |
\item[Returns] |
401 |
qualified name |
402 |
|
403 |
\end{description}\end{quote} |
404 |
\end{funcdesc} |
405 |
\index{unqualify() (in module ncclient.content)} |
406 |
|
407 |
\hypertarget{ncclient.content.unqualify}{}\begin{funcdesc}{unqualify}{tag}~\begin{quote}\begin{description} |
408 |
\item[Returns] |
409 |
unqualified name |
410 |
|
411 |
\end{description}\end{quote} |
412 |
|
413 |
\begin{notice}{note}{Note:} |
414 |
It is strongly recommended to compare qualified names. |
415 |
\end{notice} |
416 |
\end{funcdesc} |
417 |
\hypertarget{dtree}{} |
418 |
|
419 |
\subsection{DictTree XML representation} |
420 |
|
421 |
\begin{notice}{note}{Note:} |
422 |
Where this representation is stipulated, an XML literal or \href{http://docs.python.org/library/xml.etree.elementtree.html\#xml.etree.ElementTree.Element}{\code{Element}} is just fine as well. |
423 |
\end{notice} |
424 |
|
425 |
\code{ncclient} can make use of a special syntax for XML based on Python dictionaries. It is best illustrated through an example: |
426 |
|
427 |
\begin{Verbatim}[commandchars=@\[\]] |
428 |
dtree @PYGbe[=] { |
429 |
@PYGaB[']@PYGaB[tag]@PYGaB[']: qualify(@PYGaB[']@PYGaB[a]@PYGaB['], @PYGaB[']@PYGaB[some@_namespace]@PYGaB[']), |
430 |
@PYGaB[']@PYGaB[attrib]@PYGaB[']: {@PYGaB[']@PYGaB[attr]@PYGaB[']: @PYGaB[']@PYGaB[val]@PYGaB[']}, |
431 |
@PYGaB[']@PYGaB[subtree]@PYGaB[']: @PYGZlb[] { @PYGaB[']@PYGaB[tag]@PYGaB[']: @PYGaB[']@PYGaB[child1]@PYGaB['] }, { @PYGaB[']@PYGaB[tag]@PYGaB[']: @PYGaB[']@PYGaB[child2]@PYGaB['], @PYGaB[']@PYGaB[text]@PYGaB[']: @PYGaB[']@PYGaB[some text]@PYGaB['] } @PYGZrb[] |
432 |
} |
433 |
\end{Verbatim} |
434 |
|
435 |
Calling \hyperlink{ncclient.content.dtree2xml}{\code{dtree2xml()}} on \emph{dtree} would return |
436 |
|
437 |
\begin{Verbatim}[commandchars=@\[\]] |
438 |
@PYGaO[@textless[]?xml version="1.0" encoding="UTF-8"?@textgreater[]] |
439 |
@PYGba[@textless[]ns0:a] @PYGaR[attr=]@PYGaB["val"] @PYGaR[xmlns:ns0=]@PYGaB["some@_namespace"]@PYGba[@textgreater[]] |
440 |
@PYGba[@textless[]child1] @PYGba[/@textgreater[]] |
441 |
@PYGba[@textless[]child2]@PYGba[@textgreater[]]some text@PYGba[@textless[]/child2@textgreater[]] |
442 |
@PYGba[@textless[]/ns0:a@textgreater[]] |
443 |
\end{Verbatim} |
444 |
|
445 |
In addition to a `pure' dictionary representation a DictTree node (including the root) may be an XML literal or an \href{http://docs.python.org/library/xml.etree.elementtree.html\#xml.etree.ElementTree.Element}{\code{Element}} instance. The above example could thus be equivalently written as: |
446 |
|
447 |
\begin{Verbatim}[commandchars=@\[\]] |
448 |
dtree2 @PYGbe[=] { |
449 |
@PYGaB[']@PYGaB[tag]@PYGaB[']: @PYGaB[']@PYGaB[{ns}a]@PYGaB['], |
450 |
@PYGaB[']@PYGaB[attrib]@PYGaB[']: {@PYGaB[']@PYGaB[attr]@PYGaB[']: @PYGaB[']@PYGaB[val]@PYGaB[']}, |
451 |
@PYGaB[']@PYGaB[subtree]@PYGaB[']: @PYGZlb[] ET@PYGbe[.]Element(@PYGaB[']@PYGaB[child1]@PYGaB[']), @PYGaB[']@PYGaB[@textless[]child2@textgreater[]some text@textless[]/child2@textgreater[]]@PYGaB['] @PYGZrb[] |
452 |
} |
453 |
\end{Verbatim} |
454 |
|
455 |
|
456 |
\subsection{Converting between different representations} |
457 |
|
458 |
Conversions \emph{to} DictTree representation are guaranteed to be entirely dictionaries. In converting \emph{from} DictTree representation, the argument may be any valid representation as specified. |
459 |
\index{dtree2ele() (in module ncclient.content)} |
460 |
|
461 |
\hypertarget{ncclient.content.dtree2ele}{}\begin{funcdesc}{dtree2ele}{spec} |
462 |
DictTree -\textgreater{} Element |
463 |
\begin{quote}\begin{description} |
464 |
\item[Return type] |
465 |
\href{http://docs.python.org/library/xml.etree.elementtree.html\#xml.etree.ElementTree.Element}{\code{Element}} |
466 |
|
467 |
\end{description}\end{quote} |
468 |
\end{funcdesc} |
469 |
\index{dtree2xml() (in module ncclient.content)} |
470 |
|
471 |
\hypertarget{ncclient.content.dtree2xml}{}\begin{funcdesc}{dtree2xml}{spec, {[}encoding="UTF-8"{]}} |
472 |
DictTree -\textgreater{} XML |
473 |
\begin{quote}\begin{description} |
474 |
\item[Parameter] |
475 |
\emph{encoding} -- chraracter encoding |
476 |
|
477 |
\item[Return type] |
478 |
string |
479 |
|
480 |
\end{description}\end{quote} |
481 |
\end{funcdesc} |
482 |
\index{ele2dtree() (in module ncclient.content)} |
483 |
|
484 |
\hypertarget{ncclient.content.ele2dtree}{}\begin{funcdesc}{ele2dtree}{ele} |
485 |
DictTree -\textgreater{} Element |
486 |
\begin{quote}\begin{description} |
487 |
\item[Return type] |
488 |
\href{http://docs.python.org/library/stdtypes.html\#dict}{\code{dict}} |
489 |
|
490 |
\end{description}\end{quote} |
491 |
\end{funcdesc} |
492 |
\index{ele2xml() (in module ncclient.content)} |
493 |
|
494 |
\hypertarget{ncclient.content.ele2xml}{}\begin{funcdesc}{ele2xml}{ele} |
495 |
Element -\textgreater{} XML |
496 |
\begin{quote}\begin{description} |
497 |
\item[Parameter] |
498 |
\emph{encoding} -- character encoding |
499 |
|
500 |
\item[Return type] |
501 |
\href{http://docs.python.org/library/string.html\#string}{\code{string}} |
502 |
|
503 |
\end{description}\end{quote} |
504 |
\end{funcdesc} |
505 |
\index{xml2dtree() (in module ncclient.content)} |
506 |
|
507 |
\hypertarget{ncclient.content.xml2dtree}{}\begin{funcdesc}{xml2dtree}{xml} |
508 |
XML -\textgreater{} DictTree |
509 |
\begin{quote}\begin{description} |
510 |
\item[Return type] |
511 |
\href{http://docs.python.org/library/stdtypes.html\#dict}{\code{dict}} |
512 |
|
513 |
\end{description}\end{quote} |
514 |
\end{funcdesc} |
515 |
\index{xml2ele() (in module ncclient.content)} |
516 |
|
517 |
\hypertarget{ncclient.content.xml2ele}{}\begin{funcdesc}{xml2ele}{xml} |
518 |
XML -\textgreater{} Element |
519 |
\begin{quote}\begin{description} |
520 |
\item[Return type] |
521 |
\href{http://docs.python.org/library/xml.etree.elementtree.html\#xml.etree.ElementTree.Element}{\code{Element}} |
522 |
|
523 |
\end{description}\end{quote} |
524 |
\end{funcdesc} |
525 |
|
526 |
|
527 |
\subsection{Other utility functions} |
528 |
\index{iselement() (in module ncclient.content)} |
529 |
|
530 |
\hypertarget{ncclient.content.iselement}{}\begin{funcdesc}{iselement}{obj}~\begin{quote}\begin{description} |
531 |
\item[See] |
532 |
\href{http://docs.python.org/library/xml.etree.elementtree.html\#xml.etree.ElementTree.iselement}{\code{xml.etree.ElementTree.iselement()}} |
533 |
|
534 |
\end{description}\end{quote} |
535 |
\end{funcdesc} |
536 |
\index{find() (in module ncclient.content)} |
537 |
|
538 |
\hypertarget{ncclient.content.find}{}\begin{funcdesc}{find}{ele, tag, {[}nslist=, {[}{]}{]}} |
539 |
If \emph{nslist} is empty, same as \href{http://docs.python.org/library/xml.etree.elementtree.html\#xml.etree.ElementTree.Element.find}{\code{xml.etree.ElementTree.Element.find()}}. If it is not, \emph{tag} is interpreted as an unqualified name and qualified using each item in \emph{nslist} (with a \href{http://docs.python.org/library/constants.html\#None}{\code{None}} item in \emph{nslit} meaning no qualification is done). The first match is returned. |
540 |
\begin{quote}\begin{description} |
541 |
\item[Parameter] |
542 |
\emph{nslist} -- optional list of namespaces |
543 |
|
544 |
\end{description}\end{quote} |
545 |
\end{funcdesc} |
546 |
\index{parse\_root() (in module ncclient.content)} |
547 |
|
548 |
\hypertarget{ncclient.content.parse_root}{}\begin{funcdesc}{parse\_root}{raw} |
549 |
Efficiently parses the root element of an XML document. |
550 |
\begin{quote}\begin{description} |
551 |
\item[Parameter] |
552 |
\emph{raw} (string) -- XML document |
553 |
|
554 |
\item[Returns] |
555 |
a tuple of \code{(tag, attributes)}, where \code{tag} is the (qualified) name of the element and \code{attributes} is a dictionary of its attributes. |
556 |
|
557 |
\item[Return type] |
558 |
\href{http://docs.python.org/library/functions.html\#tuple}{\code{tuple}} |
559 |
|
560 |
\end{description}\end{quote} |
561 |
\end{funcdesc} |
562 |
\index{validated\_element() (in module ncclient.content)} |
563 |
|
564 |
\hypertarget{ncclient.content.validated_element}{}\begin{funcdesc}{validated\_element}{rep, tag=None, attrs=None, text=None} |
565 |
Checks if the root element meets the supplied criteria. Returns a \href{http://docs.python.org/library/xml.etree.elementtree.html\#xml.etree.ElementTree.Element}{\code{Element}} instance if so, otherwise raises \hyperlink{ncclient.content.ContentError}{\code{ContentError}}. |
566 |
\begin{quote}\begin{description} |
567 |
\item[Parameters]\begin{itemize} |
568 |
\item {} |
569 |
\emph{tag} -- tag name or a list of allowable tag names |
570 |
|
571 |
\item {} |
572 |
\emph{attrs} -- list of required attribute names, each item may be a list of allowable alternatives |
573 |
|
574 |
\item {} |
575 |
\emph{text} -- textual content to match |
576 |
|
577 |
\end{itemize} |
578 |
|
579 |
\end{description}\end{quote} |
580 |
\end{funcdesc} |
581 |
|
582 |
|
583 |
\subsection{Errors} |
584 |
\index{ContentError} |
585 |
|
586 |
\hypertarget{ncclient.content.ContentError}{}\begin{excdesc}{ContentError} |
587 |
Bases: \code{ncclient.NCClientError} |
588 |
|
589 |
Raised by methods of the \code{content} module in case of an error. |
590 |
\end{excdesc} |
591 |
|
592 |
\resetcurrentobjects |
593 |
\hypertarget{--doc-userdoc/transport}{} |
594 |
|
595 |
\section{\texttt{transport} module} |
596 |
\index{ncclient.transport (module)} |
597 |
\hypertarget{module-ncclient.transport}{} |
598 |
\declaremodule[ncclient.transport]{}{ncclient.transport} |
599 |
\modulesynopsis{Transport protocol layer} |
600 |
|
601 |
\subsection{Base types} |
602 |
\index{Session (class in ncclient.transport)} |
603 |
|
604 |
\hypertarget{ncclient.transport.Session}{}\begin{classdesc}{Session}{capabilities} |
605 |
Base class for use by transport protocol implementations. |
606 |
\index{add\_listener() (ncclient.transport.Session method)} |
607 |
|
608 |
\hypertarget{ncclient.transport.Session.add_listener}{}\begin{methoddesc}{add\_listener}{listener} |
609 |
Register a listener that will be notified of incoming messages and |
610 |
errors. |
611 |
\begin{quote}\begin{description} |
612 |
\end{description}\end{quote} |
613 |
\end{methoddesc} |
614 |
\index{remove\_listener() (ncclient.transport.Session method)} |
615 |
|
616 |
\hypertarget{ncclient.transport.Session.remove_listener}{}\begin{methoddesc}{remove\_listener}{listener} |
617 |
Unregister some listener; ignore if the listener was never |
618 |
registered. |
619 |
\begin{quote}\begin{description} |
620 |
\end{description}\end{quote} |
621 |
\end{methoddesc} |
622 |
\index{get\_listener\_instance() (ncclient.transport.Session method)} |
623 |
|
624 |
\hypertarget{ncclient.transport.Session.get_listener_instance}{}\begin{methoddesc}{get\_listener\_instance}{cls} |
625 |
If a listener of the specified type is registered, returns the |
626 |
instance. |
627 |
\begin{quote}\begin{description} |
628 |
\end{description}\end{quote} |
629 |
\end{methoddesc} |
630 |
\index{client\_capabilities (ncclient.transport.Session attribute)} |
631 |
|
632 |
\hypertarget{ncclient.transport.Session.client_capabilities}{}\begin{memberdesc}{client\_capabilities} |
633 |
Client's \code{Capabilities} |
634 |
\end{memberdesc} |
635 |
\index{server\_capabilities (ncclient.transport.Session attribute)} |
636 |
|
637 |
\hypertarget{ncclient.transport.Session.server_capabilities}{}\begin{memberdesc}{server\_capabilities} |
638 |
Server's \code{Capabilities} |
639 |
\end{memberdesc} |
640 |
\index{connected (ncclient.transport.Session attribute)} |
641 |
|
642 |
\hypertarget{ncclient.transport.Session.connected}{}\begin{memberdesc}{connected} |
643 |
Connection status of the session. |
644 |
\end{memberdesc} |
645 |
\index{id (ncclient.transport.Session attribute)} |
646 |
|
647 |
\hypertarget{ncclient.transport.Session.id}{}\begin{memberdesc}{id} |
648 |
A \href{http://docs.python.org/library/string.html\#string}{\code{string}} representing the \code{session-id}. If the session has not |
649 |
been initialized it will be \href{http://docs.python.org/library/constants.html\#None}{\code{None}} |
650 |
\end{memberdesc} |
651 |
\index{can\_pipeline (ncclient.transport.Session attribute)} |
652 |
|
653 |
\hypertarget{ncclient.transport.Session.can_pipeline}{}\begin{memberdesc}{can\_pipeline} |
654 |
Whether this session supports pipelining |
655 |
\end{memberdesc} |
656 |
\end{classdesc} |
657 |
\index{SessionListener (class in ncclient.transport)} |
658 |
|
659 |
\hypertarget{ncclient.transport.SessionListener}{}\begin{classdesc}{SessionListener}{} |
660 |
Base class for \hyperlink{ncclient.transport.Session}{\code{Session}} listeners, which are notified when a new |
661 |
NETCONF message is received or an error occurs. |
662 |
|
663 |
\begin{notice}{note}{Note:} |
664 |
Avoid time-intensive tasks in a callback's context. |
665 |
\end{notice} |
666 |
\index{callback() (ncclient.transport.SessionListener method)} |
667 |
|
668 |
\hypertarget{ncclient.transport.SessionListener.callback}{}\begin{methoddesc}{callback}{root, raw} |
669 |
Called when a new XML document is received. The \code{root} argument |
670 |
allows the callback to determine whether it wants to further process the |
671 |
document. |
672 |
\begin{quote}\begin{description} |
673 |
\item[Parameters]\begin{itemize} |
674 |
\item {} |
675 |
\emph{root} (\href{http://docs.python.org/library/functions.html\#tuple}{\code{tuple}}) -- is a tuple of \code{(tag, attributes)} where \code{tag} is the qualified name of the root element and \code{attributes} is a dictionary of its attributes (also qualified names) |
676 |
|
677 |
\item {} |
678 |
\emph{raw} (\href{http://docs.python.org/library/string.html\#string}{\code{string}}) -- XML document |
679 |
|
680 |
\end{itemize} |
681 |
|
682 |
\end{description}\end{quote} |
683 |
\end{methoddesc} |
684 |
\index{errback() (ncclient.transport.SessionListener method)} |
685 |
|
686 |
\hypertarget{ncclient.transport.SessionListener.errback}{}\begin{methoddesc}{errback}{ex} |
687 |
Called when an error occurs. |
688 |
\begin{quote}\begin{description} |
689 |
\end{description}\end{quote} |
690 |
\end{methoddesc} |
691 |
\end{classdesc} |
692 |
|
693 |
|
694 |
\subsection{SSH session implementation} |
695 |
\index{default\_unknown\_host\_cb() (ncclient.transport.ssh static method)} |
696 |
|
697 |
\hypertarget{ncclient.transport.ssh.default_unknown_host_cb}{}\begin{staticmethoddesc}[ssh]{default\_unknown\_host\_cb}{host, key} |
698 |
An \code{unknown host callback} returns \href{http://docs.python.org/library/constants.html\#True}{\code{True}} if it finds the key |
699 |
acceptable, and \href{http://docs.python.org/library/constants.html\#False}{\code{False}} if not. |
700 |
|
701 |
This default callback always returns \href{http://docs.python.org/library/constants.html\#False}{\code{False}}, which would lead to |
702 |
\code{connect()} raising a \code{SSHUnknownHost} exception. |
703 |
|
704 |
Supply another valid callback if you need to verify the host key |
705 |
programatically. |
706 |
\begin{quote}\begin{description} |
707 |
\item[Parameters]\begin{itemize} |
708 |
\item {} |
709 |
\emph{host} (string) -- the host for whom key needs to be verified |
710 |
|
711 |
\item {} |
712 |
\emph{key} (string) -- a hex string representing the host key fingerprint |
713 |
|
714 |
\end{itemize} |
715 |
|
716 |
\end{description}\end{quote} |
717 |
\end{staticmethoddesc} |
718 |
\index{SSHSession (class in ncclient.transport)} |
719 |
|
720 |
\hypertarget{ncclient.transport.SSHSession}{}\begin{classdesc}{SSHSession}{capabilities} |
721 |
Bases: \code{ncclient.transport.session.Session} |
722 |
|
723 |
Implements a \index{RFC!RFC 4742}\href{http://tools.ietf.org/html/rfc4742.html}{\textbf{RFC 4742}} NETCONF session over SSH. |
724 |
\index{connect() (ncclient.transport.SSHSession method)} |
725 |
|
726 |
\hypertarget{ncclient.transport.SSHSession.connect}{}\begin{methoddesc}{connect}{host, {[}port=830, timeout=None, username=None, password=None, key\_filename=None, allow\_agent=True, look\_for\_keys=True{]}} |
727 |
Connect via SSH and initialize the NETCONF session. First attempts |
728 |
the publickey authentication method and then password authentication. |
729 |
|
730 |
To disable attemting publickey authentication altogether, call with |
731 |
\emph{allow\_agent} and \emph{look\_for\_keys} as \href{http://docs.python.org/library/constants.html\#False}{\code{False}}. This may be needed |
732 |
for Cisco devices which immediately disconnect on an incorrect |
733 |
authentication attempt. |
734 |
\begin{quote}\begin{description} |
735 |
\item[Parameters]\begin{itemize} |
736 |
\item {} |
737 |
\emph{host} (\href{http://docs.python.org/library/string.html\#string}{\code{string}}) -- the hostname or IP address to connect to |
738 |
|
739 |
\item {} |
740 |
\emph{port} (\href{http://docs.python.org/library/functions.html\#int}{\code{int}}) -- by default 830, but some devices use the default SSH port of 22 so this may need to be specified |
741 |
|
742 |
\item {} |
743 |
\emph{timeout} (\href{http://docs.python.org/library/functions.html\#int}{\code{int}}) -- an optional timeout for the TCP handshake |
744 |
|
745 |
\item {} |
746 |
\emph{unknown\_host\_cb} (see \hyperlink{ncclient.transport.ssh.default_unknown_host_cb}{\code{signature}}) -- called when a host key is not recognized |
747 |
|
748 |
\item {} |
749 |
\emph{username} (\href{http://docs.python.org/library/string.html\#string}{\code{string}}) -- the username to use for SSH authentication |
750 |
|
751 |
\item {} |
752 |
\emph{password} (\href{http://docs.python.org/library/string.html\#string}{\code{string}}) -- the password used if using password authentication, or the passphrase to use for unlocking keys that require it |
753 |
|
754 |
\item {} |
755 |
\emph{key\_filename} (\href{http://docs.python.org/library/string.html\#string}{\code{string}}) -- a filename where a the private key to be used can be found |
756 |
|
757 |
\item {} |
758 |
\emph{allow\_agent} (\href{http://docs.python.org/library/functions.html\#bool}{\code{bool}}) -- enables querying SSH agent (if found) for keys |
759 |
|
760 |
\item {} |
761 |
\emph{look\_for\_keys} (\href{http://docs.python.org/library/functions.html\#bool}{\code{bool}}) -- enables looking in the usual locations for ssh keys (e.g. \code{\textasciitilde{}/.ssh/id\_*}) |
762 |
|
763 |
\end{itemize} |
764 |
|
765 |
\end{description}\end{quote} |
766 |
\end{methoddesc} |
767 |
\index{load\_known\_hosts() (ncclient.transport.SSHSession method)} |
768 |
|
769 |
\hypertarget{ncclient.transport.SSHSession.load_known_hosts}{}\begin{methoddesc}{load\_known\_hosts}{filename=None} |
770 |
Load host keys from a \code{known\_hosts}-style file. Can be called multiple |
771 |
times. |
772 |
|
773 |
If \emph{filename} is not specified, looks in the default locations i.e. |
774 |
\code{\textasciitilde{}/.ssh/known\_hosts} and \code{\textasciitilde{}/ssh/known\_hosts} for Windows. |
775 |
\end{methoddesc} |
776 |
\index{transport (ncclient.transport.SSHSession attribute)} |
777 |
|
778 |
\hypertarget{ncclient.transport.SSHSession.transport}{}\begin{memberdesc}{transport} |
779 |
Underlying \href{http://www.lag.net/paramiko/docs/paramiko.Transport-class.html}{paramiko.Transport} |
780 |
object. This makes it possible to call methods like set\_keepalive on it. |
781 |
\end{memberdesc} |
782 |
\end{classdesc} |
783 |
|
784 |
|
785 |
\subsection{Errors} |
786 |
\index{TransportError} |
787 |
|
788 |
\hypertarget{ncclient.transport.TransportError}{}\begin{excdesc}{TransportError} |
789 |
Bases: \code{ncclient.NCClientError} |
790 |
\end{excdesc} |
791 |
\index{SessionCloseError} |
792 |
|
793 |
\hypertarget{ncclient.transport.SessionCloseError}{}\begin{excdesc}{SessionCloseError} |
794 |
Bases: \code{ncclient.transport.errors.TransportError} |
795 |
\end{excdesc} |
796 |
\index{SSHError} |
797 |
|
798 |
\hypertarget{ncclient.transport.SSHError}{}\begin{excdesc}{SSHError} |
799 |
Bases: \code{ncclient.transport.errors.TransportError} |
800 |
\end{excdesc} |
801 |
\index{AuthenticationError} |
802 |
|
803 |
\hypertarget{ncclient.transport.AuthenticationError}{}\begin{excdesc}{AuthenticationError} |
804 |
Bases: \code{ncclient.transport.errors.TransportError} |
805 |
\end{excdesc} |
806 |
\index{SSHUnknownHostError} |
807 |
|
808 |
\hypertarget{ncclient.transport.SSHUnknownHostError}{}\begin{excdesc}{SSHUnknownHostError} |
809 |
Bases: \code{ncclient.transport.errors.SSHError} |
810 |
\end{excdesc} |
811 |
|
812 |
\resetcurrentobjects |
813 |
\hypertarget{--doc-userdoc/operations}{} |
814 |
|
815 |
\section{\texttt{operations} module} |
816 |
\index{ncclient.operations (module)} |
817 |
\hypertarget{module-ncclient.operations}{} |
818 |
\declaremodule[ncclient.operations]{}{ncclient.operations} |
819 |
\modulesynopsis{RPC and Operation layers} |
820 |
|
821 |
\subsection{Base types} |
822 |
\index{RPC (class in ncclient.operations.rpc)} |
823 |
|
824 |
\hypertarget{ncclient.operations.rpc.RPC}{}\begin{classdesc}{RPC}{session, {[}async=False, timeout=None{]}} |
825 |
Base class for all operations. |
826 |
|
827 |
Directly corresponds to \emph{\textless{}rpc\textgreater{}} requests. Handles making the request, and |
828 |
taking delivery of the reply. |
829 |
\index{set\_async() (ncclient.operations.rpc.RPC method)} |
830 |
|
831 |
\hypertarget{ncclient.operations.rpc.RPC.set_async}{}\begin{methoddesc}{set\_async}{async=True} |
832 |
Set asynchronous mode for this RPC. |
833 |
\end{methoddesc} |
834 |
\index{set\_timeout() (ncclient.operations.rpc.RPC method)} |
835 |
|
836 |
\hypertarget{ncclient.operations.rpc.RPC.set_timeout}{}\begin{methoddesc}{set\_timeout}{timeout} |
837 |
Set the timeout for synchronous waiting defining how long the RPC |
838 |
request will block on a reply before raising an error. |
839 |
\end{methoddesc} |
840 |
\index{reply (ncclient.operations.rpc.RPC attribute)} |
841 |
|
842 |
\hypertarget{ncclient.operations.rpc.RPC.reply}{}\begin{memberdesc}{reply} |
843 |
\hyperlink{ncclient.operations.rpc.RPCReply}{\code{RPCReply}} element if reply has been received or \href{http://docs.python.org/library/constants.html\#None}{\code{None}} |
844 |
\end{memberdesc} |
845 |
\index{error (ncclient.operations.rpc.RPC attribute)} |
846 |
|
847 |
\hypertarget{ncclient.operations.rpc.RPC.error}{}\begin{memberdesc}{error} |
848 |
\href{http://docs.python.org/library/exceptions.html\#exceptions.Exception}{\code{Exception}} type if an error occured or \href{http://docs.python.org/library/constants.html\#None}{\code{None}}. |
849 |
|
850 |
This attribute should be checked if the request was made asynchronously, |
851 |
so that it can be determined if \hyperlink{ncclient.operations.rpc.RPC.event}{\code{event}} being set is because of a |
852 |
reply or error. |
853 |
|
854 |
\begin{notice}{note}{Note:} |
855 |
This represents an error which prevented a reply from being |
856 |
received. An \emph{\textless{}rpc-error\textgreater{}} does not fall in that category -- see |
857 |
\hyperlink{ncclient.operations.rpc.RPCReply}{\code{RPCReply}} for that. |
858 |
\end{notice} |
859 |
\end{memberdesc} |
860 |
\index{event (ncclient.operations.rpc.RPC attribute)} |
861 |
|
862 |
\hypertarget{ncclient.operations.rpc.RPC.event}{}\begin{memberdesc}{event} |
863 |
\href{http://docs.python.org/library/threading.html\#threading.Event}{\code{Event}} that is set when reply has been received or |
864 |
error occured. |
865 |
\end{memberdesc} |
866 |
\index{async (ncclient.operations.rpc.RPC attribute)} |
867 |
|
868 |
\hypertarget{ncclient.operations.rpc.RPC.async}{}\begin{memberdesc}{async} |
869 |
Whether this RPC is asynchronous |
870 |
\end{memberdesc} |
871 |
\index{timeout (ncclient.operations.rpc.RPC attribute)} |
872 |
|
873 |
\hypertarget{ncclient.operations.rpc.RPC.timeout}{}\begin{memberdesc}{timeout} |
874 |
Timeout for synchronous waiting |
875 |
\end{memberdesc} |
876 |
\index{id (ncclient.operations.rpc.RPC attribute)} |
877 |
|
878 |
\hypertarget{ncclient.operations.rpc.RPC.id}{}\begin{memberdesc}{id} |
879 |
The \emph{message-id} for this RPC |
880 |
\end{memberdesc} |
881 |
\index{session (ncclient.operations.rpc.RPC attribute)} |
882 |
|
883 |
\hypertarget{ncclient.operations.rpc.RPC.session}{}\begin{memberdesc}{session} |
884 |
The \hyperlink{ncclient.transport.Session}{\code{Session}} object associated with this |
885 |
RPC |
886 |
\end{memberdesc} |
887 |
\end{classdesc} |
888 |
\index{RPCReply (class in ncclient.operations.rpc)} |
889 |
|
890 |
\hypertarget{ncclient.operations.rpc.RPCReply}{}\begin{classdesc}{RPCReply}{raw} |
891 |
Represents an \emph{\textless{}rpc-reply\textgreater{}}. Only concerns itself with whether the |
892 |
operation was successful. |
893 |
|
894 |
\begin{notice}{note}{Note:} |
895 |
If the reply has not yet been parsed there is an implicit, one-time |
896 |
parsing overhead to accessing the attributes defined by this class and |
897 |
any subclasses. |
898 |
\end{notice} |
899 |
\index{ok (ncclient.operations.rpc.RPCReply attribute)} |
900 |
|
901 |
\hypertarget{ncclient.operations.rpc.RPCReply.ok}{}\begin{memberdesc}{ok} |
902 |
Boolean value indicating if there were no errors. |
903 |
\end{memberdesc} |
904 |
\index{error (ncclient.operations.rpc.RPCReply attribute)} |
905 |
|
906 |
\hypertarget{ncclient.operations.rpc.RPCReply.error}{}\begin{memberdesc}{error} |
907 |
Short for \hyperlink{ncclient.operations.rpc.RPCReply.errors}{\code{errors}} {[}0{]}; \href{http://docs.python.org/library/constants.html\#None}{\code{None}} if there were no errors. |
908 |
\end{memberdesc} |
909 |
\index{errors (ncclient.operations.rpc.RPCReply attribute)} |
910 |
|
911 |
\hypertarget{ncclient.operations.rpc.RPCReply.errors}{}\begin{memberdesc}{errors} |
912 |
\href{http://docs.python.org/library/functions.html\#list}{\code{list}} of \hyperlink{ncclient.operations.rpc.RPCError}{\code{RPCError}} objects. Will be empty if there were no |
913 |
\emph{\textless{}rpc-error\textgreater{}} elements in reply. |
914 |
\end{memberdesc} |
915 |
\end{classdesc} |
916 |
\index{RPCError (class in ncclient.operations.rpc)} |
917 |
|
918 |
\hypertarget{ncclient.operations.rpc.RPCError}{}\begin{classdesc}{RPCError}{err\_dict} |
919 |
Bases: \code{ncclient.operations.errors.OperationError} |
920 |
|
921 |
Represents an \emph{\textless{}rpc-error\textgreater{}}. It is an instance of \code{OperationError} |
922 |
so it can be raised like any other exception. |
923 |
\index{type (ncclient.operations.rpc.RPCError attribute)} |
924 |
|
925 |
\hypertarget{ncclient.operations.rpc.RPCError.type}{}\begin{memberdesc}{type} |
926 |
\href{http://docs.python.org/library/string.html\#string}{\code{string}} represeting \emph{error-type} element |
927 |
\end{memberdesc} |
928 |
\index{severity (ncclient.operations.rpc.RPCError attribute)} |
929 |
|
930 |
\hypertarget{ncclient.operations.rpc.RPCError.severity}{}\begin{memberdesc}{severity} |
931 |
\href{http://docs.python.org/library/string.html\#string}{\code{string}} represeting \emph{error-severity} element |
932 |
\end{memberdesc} |
933 |
\index{tag (ncclient.operations.rpc.RPCError attribute)} |
934 |
|
935 |
\hypertarget{ncclient.operations.rpc.RPCError.tag}{}\begin{memberdesc}{tag} |
936 |
\href{http://docs.python.org/library/string.html\#string}{\code{string}} represeting \emph{error-tag} element |
937 |
\end{memberdesc} |
938 |
\index{path (ncclient.operations.rpc.RPCError attribute)} |
939 |
|
940 |
\hypertarget{ncclient.operations.rpc.RPCError.path}{}\begin{memberdesc}{path} |
941 |
\href{http://docs.python.org/library/string.html\#string}{\code{string}} or \href{http://docs.python.org/library/constants.html\#None}{\code{None}}; represeting \emph{error-path} element |
942 |
\end{memberdesc} |
943 |
\index{message (ncclient.operations.rpc.RPCError attribute)} |
944 |
|
945 |
\hypertarget{ncclient.operations.rpc.RPCError.message}{}\begin{memberdesc}{message} |
946 |
\href{http://docs.python.org/library/string.html\#string}{\code{string}} or \href{http://docs.python.org/library/constants.html\#None}{\code{None}}; represeting \emph{error-message} element |
947 |
\end{memberdesc} |
948 |
\index{info (ncclient.operations.rpc.RPCError attribute)} |
949 |
|
950 |
\hypertarget{ncclient.operations.rpc.RPCError.info}{}\begin{memberdesc}{info} |
951 |
\href{http://docs.python.org/library/string.html\#string}{\code{string}} or \href{http://docs.python.org/library/constants.html\#None}{\code{None}}, represeting \emph{error-info} element |
952 |
\end{memberdesc} |
953 |
\end{classdesc} |
954 |
|
955 |
|
956 |
\subsection{NETCONF Operations} |
957 |
|
958 |
|
959 |
\subsubsection{Dependencies} |
960 |
|
961 |
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 \hyperlink{ncclient.operations.MissingCapabilityError}{\code{MissingCapabilityError}} is raised if the server does not support the relevant capability. |
962 |
\hypertarget{return}{} |
963 |
|
964 |
\subsubsection{Return type} |
965 |
|
966 |
The return type for the \code{request()} method depends of an operation on whether it is synchronous or asynchronous (see base class \code{RPC}). |
967 |
\begin{itemize} |
968 |
\item {} |
969 |
For synchronous requests, it will block waiting for the reply, and once it has been received an \code{RPCReply} object is returned. If an error occured while waiting for the reply, it will be raised. |
970 |
|
971 |
\item {} |
972 |
For asynchronous requests, it will immediately return an \href{http://docs.python.org/library/threading.html\#threading.Event}{\code{Event}} object. This event is set when a reply is received, or an error occurs that prevents a reply from being received. The \code{reply} and \code{error} attributes can then be accessed to determine which of the two it was :-) |
973 |
|
974 |
\end{itemize} |
975 |
|
976 |
|
977 |
\subsubsection{General notes on parameters} |
978 |
|
979 |
|
980 |
\hypertarget{source-target}{}\paragraph{Source / target parameters} |
981 |
|
982 |
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 \emph{:url} capability and whether the capability supports the specific schema of the URL. Either must be specified as a \href{http://docs.python.org/library/string.html\#string}{\code{string}}. |
983 |
|
984 |
If the source may be a \emph{\textless{}config\textgreater{}} element, e.g. for \hyperlink{ncclient.operations.Validate}{\code{Validate}}, specify in \hyperlink{dtree}{\emph{DictTree XML representation}} with the root element as \emph{\textless{}config\textgreater{}}. |
985 |
\hypertarget{filter}{} |
986 |
|
987 |
\paragraph{Filter parameters} |
988 |
|
989 |
Filter parameters, where applicable, can take one of the following types: |
990 |
\begin{itemize} |
991 |
\item {} \begin{description} |
992 |
\item[A \href{http://docs.python.org/library/functions.html\#tuple}{\code{tuple}} of \emph{(type, criteria)}.] |
993 |
Here type has to be one of ``xpath'' or ``subtree''. For type ``xpath'', the criteria should be a \href{http://docs.python.org/library/string.html\#string}{\code{string}} that is a valid XPath expression. For type ``subtree'', criteria should be in \hyperlink{dtree}{\emph{DictTree XML representation}} representing a valid subtree filter. |
994 |
|
995 |
\end{description} |
996 |
|
997 |
\item {} |
998 |
A valid \emph{\textless{}filter\textgreater{}} element in \hyperlink{dtree}{\emph{DictTree XML representation}}. |
999 |
|
1000 |
\end{itemize} |
1001 |
|
1002 |
|
1003 |
\subsubsection{Retrieval operations} |
1004 |
|
1005 |
The reply object for these operations will be a \hyperlink{ncclient.operations.GetReply}{\code{GetReply}} instance. |
1006 |
\index{Get (class in ncclient.operations)} |
1007 |
|
1008 |
\hypertarget{ncclient.operations.Get}{}\begin{classdesc}{Get}{session, async=False, timeout=None} |
1009 |
Bases: \hyperlink{ncclient.operations.rpc.RPC}{\code{ncclient.operations.rpc.RPC}} |
1010 |
|
1011 |
The \emph{\textless{}get\textgreater{}} RPC |
1012 |
\index{request() (ncclient.operations.Get method)} |
1013 |
|
1014 |
\hypertarget{ncclient.operations.Get.request}{}\begin{methoddesc}{request}{filter=None}~\begin{quote}\begin{description} |
1015 |
\item[Parameter] |
1016 |
\emph{filter} -- optional; see \hyperlink{filter}{\emph{Filter parameters}} |
1017 |
|
1018 |
\item[Seealso] |
1019 |
\hyperlink{return}{\emph{Return type}} |
1020 |
|
1021 |
\end{description}\end{quote} |
1022 |
\end{methoddesc} |
1023 |
\end{classdesc} |
1024 |
\index{GetConfig (class in ncclient.operations)} |
1025 |
|
1026 |
\hypertarget{ncclient.operations.GetConfig}{}\begin{classdesc}{GetConfig}{session, async=False, timeout=None} |
1027 |
Bases: \hyperlink{ncclient.operations.rpc.RPC}{\code{ncclient.operations.rpc.RPC}} |
1028 |
|
1029 |
The \emph{\textless{}get-config\textgreater{}} RPC |
1030 |
\index{request() (ncclient.operations.GetConfig method)} |
1031 |
|
1032 |
\hypertarget{ncclient.operations.GetConfig.request}{}\begin{methoddesc}{request}{source, filter=None}~\begin{quote}\begin{description} |
1033 |
\item[Parameters]\begin{itemize} |
1034 |
\item {} |
1035 |
\emph{source} -- See \hyperlink{source-target}{\emph{Source / target parameters}} |
1036 |
|
1037 |
\item {} |
1038 |
\emph{filter} -- optional; see \hyperlink{filter}{\emph{Filter parameters}} |
1039 |
|
1040 |
\end{itemize} |
1041 |
|
1042 |
\item[Seealso] |
1043 |
\hyperlink{return}{\emph{Return type}} |
1044 |
|
1045 |
\end{description}\end{quote} |
1046 |
\end{methoddesc} |
1047 |
\end{classdesc} |
1048 |
\index{GetReply (class in ncclient.operations)} |
1049 |
|
1050 |
\hypertarget{ncclient.operations.GetReply}{}\begin{classdesc}{GetReply}{raw} |
1051 |
Bases: \hyperlink{ncclient.operations.rpc.RPCReply}{\code{ncclient.operations.rpc.RPCReply}} |
1052 |
|
1053 |
Adds attributes for the \emph{\textless{}data\textgreater{}} element to \code{RPCReply}, which |
1054 |
pertains to the \hyperlink{ncclient.operations.Get}{\code{Get}} and \hyperlink{ncclient.operations.GetConfig}{\code{GetConfig}} operations. |
1055 |
\index{data (ncclient.operations.GetReply attribute)} |
1056 |
|
1057 |
\hypertarget{ncclient.operations.GetReply.data}{}\begin{memberdesc}{data} |
1058 |
Same as \hyperlink{ncclient.operations.GetReply.data_ele}{\code{data\_ele}} |
1059 |
\end{memberdesc} |
1060 |
\index{data\_xml (ncclient.operations.GetReply attribute)} |
1061 |
|
1062 |
\hypertarget{ncclient.operations.GetReply.data_xml}{}\begin{memberdesc}{data\_xml} |
1063 |
\emph{\textless{}data\textgreater{}} element as an XML string |
1064 |
\end{memberdesc} |
1065 |
\index{data\_dtree (ncclient.operations.GetReply attribute)} |
1066 |
|
1067 |
\hypertarget{ncclient.operations.GetReply.data_dtree}{}\begin{memberdesc}{data\_dtree} |
1068 |
\emph{\textless{}data\textgreater{}} element in \hyperlink{dtree}{\emph{DictTree XML representation}} |
1069 |
\end{memberdesc} |
1070 |
\index{data\_ele (ncclient.operations.GetReply attribute)} |
1071 |
|
1072 |
\hypertarget{ncclient.operations.GetReply.data_ele}{}\begin{memberdesc}{data\_ele} |
1073 |
\emph{\textless{}data\textgreater{}} element as an \href{http://docs.python.org/library/xml.etree.elementtree.html\#xml.etree.ElementTree.Element}{\code{Element}} |
1074 |
\end{memberdesc} |
1075 |
\end{classdesc} |
1076 |
|
1077 |
|
1078 |
\subsubsection{Locking operations} |
1079 |
\index{Lock (class in ncclient.operations)} |
1080 |
|
1081 |
\hypertarget{ncclient.operations.Lock}{}\begin{classdesc}{Lock}{session, async=False, timeout=None} |
1082 |
Bases: \hyperlink{ncclient.operations.rpc.RPC}{\code{ncclient.operations.rpc.RPC}} |
1083 |
|
1084 |
\emph{\textless{}lock\textgreater{}} RPC |
1085 |
\index{request() (ncclient.operations.Lock method)} |
1086 |
|
1087 |
\hypertarget{ncclient.operations.Lock.request}{}\begin{methoddesc}{request}{target}~\begin{quote}\begin{description} |
1088 |
\item[Parameter] |
1089 |
\emph{target} (string) -- see \hyperlink{source-target}{\emph{Source / target parameters}} |
1090 |
|
1091 |
\item[Return type] |
1092 |
\hyperlink{return}{\emph{Return type}} |
1093 |
|
1094 |
\end{description}\end{quote} |
1095 |
\end{methoddesc} |
1096 |
\end{classdesc} |
1097 |
\index{Unlock (class in ncclient.operations)} |
1098 |
|
1099 |
\hypertarget{ncclient.operations.Unlock}{}\begin{classdesc}{Unlock}{session, async=False, timeout=None} |
1100 |
Bases: \hyperlink{ncclient.operations.rpc.RPC}{\code{ncclient.operations.rpc.RPC}} |
1101 |
|
1102 |
\emph{\textless{}unlock\textgreater{}} RPC |
1103 |
\index{request() (ncclient.operations.Unlock method)} |
1104 |
|
1105 |
\hypertarget{ncclient.operations.Unlock.request}{}\begin{methoddesc}{request}{target}~\begin{quote}\begin{description} |
1106 |
\item[Parameter] |
1107 |
\emph{target} (string) -- see \hyperlink{source-target}{\emph{Source / target parameters}} |
1108 |
|
1109 |
\item[Return type] |
1110 |
\hyperlink{return}{\emph{Return type}} |
1111 |
|
1112 |
\end{description}\end{quote} |
1113 |
\end{methoddesc} |
1114 |
\end{classdesc} |
1115 |
|
1116 |
|
1117 |
\subsubsection{Configuration operations} |
1118 |
\index{EditConfig (class in ncclient.operations)} |
1119 |
|
1120 |
\hypertarget{ncclient.operations.EditConfig}{}\begin{classdesc}{EditConfig}{session, async=False, timeout=None} |
1121 |
Bases: \hyperlink{ncclient.operations.rpc.RPC}{\code{ncclient.operations.rpc.RPC}} |
1122 |
|
1123 |
\emph{\textless{}edit-config\textgreater{}} RPC |
1124 |
\index{request() (ncclient.operations.EditConfig method)} |
1125 |
|
1126 |
\hypertarget{ncclient.operations.EditConfig.request}{}\begin{methoddesc}{request}{target, config, default\_operation=None, test\_option=None, error\_option=None}~\begin{quote}\begin{description} |
1127 |
\item[Parameters]\begin{itemize} |
1128 |
\item {} |
1129 |
\emph{target} (string) -- see \hyperlink{source-target}{\emph{Source / target parameters}} |
1130 |
|
1131 |
\item {} |
1132 |
\emph{config} (\href{http://docs.python.org/library/string.html\#string}{\code{string}} or \href{http://docs.python.org/library/stdtypes.html\#dict}{\code{dict}} or \href{http://docs.python.org/library/xml.etree.elementtree.html\#xml.etree.ElementTree.Element}{\code{Element}}) -- a config element in \hyperlink{dtree}{\emph{DictTree XML representation}} |
1133 |
|
1134 |
\item {} |
1135 |
\emph{default\_operation} (\href{http://docs.python.org/library/string.html\#string}{\code{string}}) -- optional; one of \{`merge', `replace', `none'\} |
1136 |
|
1137 |
\item {} |
1138 |
\emph{test\_option} (string) -- optional; one of \{`stop-on-error', `continue-on-error', `rollback-on-error'\}. Last option depends on the \emph{:rollback-on-error} capability |
1139 |
|
1140 |
\end{itemize} |
1141 |
|
1142 |
\item[Seealso] |
1143 |
\hyperlink{return}{\emph{Return type}} |
1144 |
|
1145 |
\end{description}\end{quote} |
1146 |
\end{methoddesc} |
1147 |
\end{classdesc} |
1148 |
\index{CopyConfig (class in ncclient.operations)} |
1149 |
|
1150 |
\hypertarget{ncclient.operations.CopyConfig}{}\begin{classdesc}{CopyConfig}{session, async=False, timeout=None} |
1151 |
Bases: \hyperlink{ncclient.operations.rpc.RPC}{\code{ncclient.operations.rpc.RPC}} |
1152 |
|
1153 |
\emph{\textless{}copy-config\textgreater{}} RPC |
1154 |
\index{request() (ncclient.operations.CopyConfig method)} |
1155 |
|
1156 |
\hypertarget{ncclient.operations.CopyConfig.request}{}\begin{methoddesc}{request}{source, target}~\begin{quote}\begin{description} |
1157 |
\item[Parameters]\begin{itemize} |
1158 |
\item {} |
1159 |
\emph{source} (\href{http://docs.python.org/library/string.html\#string}{\code{string}} or \href{http://docs.python.org/library/stdtypes.html\#dict}{\code{dict}} or \href{http://docs.python.org/library/xml.etree.elementtree.html\#xml.etree.ElementTree.Element}{\code{Element}}) -- See \hyperlink{source-target}{\emph{Source / target parameters}} |
1160 |
|
1161 |
\item {} |
1162 |
\emph{target} (\href{http://docs.python.org/library/string.html\#string}{\code{string}} or \href{http://docs.python.org/library/stdtypes.html\#dict}{\code{dict}} or \href{http://docs.python.org/library/xml.etree.elementtree.html\#xml.etree.ElementTree.Element}{\code{Element}}) -- See \hyperlink{source-target}{\emph{Source / target parameters}} |
1163 |
|
1164 |
\end{itemize} |
1165 |
|
1166 |
\item[Seealso] |
1167 |
\hyperlink{return}{\emph{Return type}} |
1168 |
|
1169 |
\end{description}\end{quote} |
1170 |
\end{methoddesc} |
1171 |
\end{classdesc} |
1172 |
\index{DeleteConfig (class in ncclient.operations)} |
1173 |
|
1174 |
\hypertarget{ncclient.operations.DeleteConfig}{}\begin{classdesc}{DeleteConfig}{session, async=False, timeout=None} |
1175 |
Bases: \hyperlink{ncclient.operations.rpc.RPC}{\code{ncclient.operations.rpc.RPC}} |
1176 |
|
1177 |
\emph{\textless{}delete-config\textgreater{}} RPC |
1178 |
\index{request() (ncclient.operations.DeleteConfig method)} |
1179 |
|
1180 |
\hypertarget{ncclient.operations.DeleteConfig.request}{}\begin{methoddesc}{request}{target}~\begin{quote}\begin{description} |
1181 |
\item[Parameter] |
1182 |
\emph{target} (\href{http://docs.python.org/library/string.html\#string}{\code{string}} or \href{http://docs.python.org/library/stdtypes.html\#dict}{\code{dict}} or \href{http://docs.python.org/library/xml.etree.elementtree.html\#xml.etree.ElementTree.Element}{\code{Element}}) -- See \hyperlink{source-target}{\emph{Source / target parameters}} |
1183 |
|
1184 |
\item[Seealso] |
1185 |
\hyperlink{return}{\emph{Return type}} |
1186 |
|
1187 |
\end{description}\end{quote} |
1188 |
\end{methoddesc} |
1189 |
\end{classdesc} |
1190 |
\index{Validate (class in ncclient.operations)} |
1191 |
|
1192 |
\hypertarget{ncclient.operations.Validate}{}\begin{classdesc}{Validate}{session, async=False, timeout=None} |
1193 |
Bases: \hyperlink{ncclient.operations.rpc.RPC}{\code{ncclient.operations.rpc.RPC}} |
1194 |
|
1195 |
\emph{\textless{}validate\textgreater{}} RPC. Depends on the \emph{:validate} capability. |
1196 |
\index{request() (ncclient.operations.Validate method)} |
1197 |
|
1198 |
\hypertarget{ncclient.operations.Validate.request}{}\begin{methoddesc}{request}{source}~\begin{quote}\begin{description} |
1199 |
\item[Parameter] |
1200 |
\emph{source} (\href{http://docs.python.org/library/string.html\#string}{\code{string}} or \href{http://docs.python.org/library/stdtypes.html\#dict}{\code{dict}} or \href{http://docs.python.org/library/xml.etree.elementtree.html\#xml.etree.ElementTree.Element}{\code{Element}}) -- See \hyperlink{source-target}{\emph{Source / target parameters}} |
1201 |
|
1202 |
\item[Seealso] |
1203 |
\hyperlink{return}{\emph{Return type}} |
1204 |
|
1205 |
\end{description}\end{quote} |
1206 |
\end{methoddesc} |
1207 |
\end{classdesc} |
1208 |
\index{Commit (class in ncclient.operations)} |
1209 |
|
1210 |
\hypertarget{ncclient.operations.Commit}{}\begin{classdesc}{Commit}{session, async=False, timeout=None} |
1211 |
Bases: \hyperlink{ncclient.operations.rpc.RPC}{\code{ncclient.operations.rpc.RPC}} |
1212 |
|
1213 |
\emph{\textless{}commit\textgreater{}} RPC. Depends on the \emph{:candidate} capability. |
1214 |
\index{request() (ncclient.operations.Commit method)} |
1215 |
|
1216 |
\hypertarget{ncclient.operations.Commit.request}{}\begin{methoddesc}{request}{confirmed=False, timeout=None} |
1217 |
Requires \emph{:confirmed-commit} capability if \emph{confirmed} argument is |
1218 |
\href{http://docs.python.org/library/constants.html\#True}{\code{True}}. |
1219 |
\begin{quote}\begin{description} |
1220 |
\item[Parameters]\begin{itemize} |
1221 |
\item {} |
1222 |
\emph{confirmed} (\href{http://docs.python.org/library/functions.html\#bool}{\code{bool}}) -- optional; request a confirmed commit |
1223 |
|
1224 |
\item {} |
1225 |
\emph{timeout} (\href{http://docs.python.org/library/functions.html\#int}{\code{int}}) -- specify timeout for confirmed commit |
1226 |
|
1227 |
\end{itemize} |
1228 |
|
1229 |
\item[Seealso] |
1230 |
\hyperlink{return}{\emph{Return type}} |
1231 |
|
1232 |
\end{description}\end{quote} |
1233 |
\end{methoddesc} |
1234 |
\end{classdesc} |
1235 |
\index{DiscardChanges (class in ncclient.operations)} |
1236 |
|
1237 |
\hypertarget{ncclient.operations.DiscardChanges}{}\begin{classdesc}{DiscardChanges}{session, async=False, timeout=None} |
1238 |
Bases: \hyperlink{ncclient.operations.rpc.RPC}{\code{ncclient.operations.rpc.RPC}} |
1239 |
|
1240 |
\emph{\textless{}discard-changes\textgreater{}} RPC. Depends on the \emph{:candidate} capability. |
1241 |
\index{request() (ncclient.operations.DiscardChanges method)} |
1242 |
|
1243 |
\hypertarget{ncclient.operations.DiscardChanges.request}{}\begin{methoddesc}{request}{*args, **kwds} |
1244 |
Subclasses implement this method. Here, the operation is constructed |
1245 |
in \hyperlink{dtree}{\emph{DictTree XML representation}}, and the result of \code{\_request()} returned. |
1246 |
\end{methoddesc} |
1247 |
\end{classdesc} |
1248 |
|
1249 |
|
1250 |
\subsubsection{Session management operations} |
1251 |
\index{CloseSession (class in ncclient.operations)} |
1252 |
|
1253 |
\hypertarget{ncclient.operations.CloseSession}{}\begin{classdesc}{CloseSession}{session, async=False, timeout=None} |
1254 |
Bases: \hyperlink{ncclient.operations.rpc.RPC}{\code{ncclient.operations.rpc.RPC}} |
1255 |
|
1256 |
\emph{\textless{}close-session\textgreater{}} RPC. The connection to NETCONF server is also closed. |
1257 |
\end{classdesc} |
1258 |
\index{KillSession (class in ncclient.operations)} |
1259 |
|
1260 |
\hypertarget{ncclient.operations.KillSession}{}\begin{classdesc}{KillSession}{session, async=False, timeout=None} |
1261 |
Bases: \hyperlink{ncclient.operations.rpc.RPC}{\code{ncclient.operations.rpc.RPC}} |
1262 |
|
1263 |
\emph{\textless{}kill-session\textgreater{}} RPC. |
1264 |
\end{classdesc} |
1265 |
|
1266 |
|
1267 |
\subsubsection{Also useful} |
1268 |
\index{LockContext (class in ncclient.operations)} |
1269 |
|
1270 |
\hypertarget{ncclient.operations.LockContext}{}\begin{classdesc}{LockContext}{session, target} |
1271 |
A context manager for the \hyperlink{ncclient.operations.Lock}{\code{Lock}} / \hyperlink{ncclient.operations.Unlock}{\code{Unlock}} pair of RPC's. |
1272 |
|
1273 |
Initialise with session instance (\hyperlink{ncclient.transport.Session}{\code{Session}}) and lock target (\hyperlink{source-target}{\emph{Source / target parameters}}) |
1274 |
\end{classdesc} |
1275 |
|
1276 |
|
1277 |
\subsection{Errors} |
1278 |
\index{OperationError} |
1279 |
|
1280 |
\hypertarget{ncclient.operations.OperationError}{}\begin{excdesc}{OperationError} |
1281 |
Bases: \code{ncclient.NCClientError} |
1282 |
\end{excdesc} |
1283 |
\index{TimeoutExpiredError} |
1284 |
|
1285 |
\hypertarget{ncclient.operations.TimeoutExpiredError}{}\begin{excdesc}{TimeoutExpiredError} |
1286 |
Bases: \code{ncclient.NCClientError} |
1287 |
\end{excdesc} |
1288 |
\index{MissingCapabilityError} |
1289 |
|
1290 |
\hypertarget{ncclient.operations.MissingCapabilityError}{}\begin{excdesc}{MissingCapabilityError} |
1291 |
Bases: \code{ncclient.NCClientError} |
1292 |
\end{excdesc} |
1293 |
|
1294 |
\resetcurrentobjects |
1295 |
\hypertarget{--doc-extending}{} |
1296 |
|
1297 |
\hypertarget{extending}{}\chapter{Extending NCClient} |
1298 |
|
1299 |
This is written in a `how-to' style through code examples. |
1300 |
|
1301 |
\emph{Forthcoming} |
1302 |
|
1303 |
|
1304 |
\renewcommand{\indexname}{Module Index} |
1305 |
\printmodindex |
1306 |
\renewcommand{\indexname}{Index} |
1307 |
\printindex |
1308 |
\end{document} |