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