This file is indexed.

/usr/share/doc/python-ncclient/html/manager.html is in python-ncclient-doc 0.5.3-4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>manager – High-level API &#8212; ncclient 0.4.4 documentation</title>
    
    <link rel="stylesheet" href="_static/classic.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    './',
        VERSION:     '0.4.4',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true,
        SOURCELINK_SUFFIX: '.txt'
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="next" title="Complete API documentation" href="api.html" />
    <link rel="prev" title="Welcome" href="index.html" /> 
  </head>
  <body role="document">
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="api.html" title="Complete API documentation"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="index.html" title="Welcome"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="index.html">ncclient 0.4.4 documentation</a> &#187;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="module-ncclient.manager">
<span id="manager-high-level-api"></span><h1><a class="reference internal" href="#module-ncclient.manager" title="ncclient.manager: High-level API"><code class="xref py py-mod docutils literal"><span class="pre">manager</span></code></a> &#8211; High-level API<a class="headerlink" href="#module-ncclient.manager" title="Permalink to this headline"></a></h1>
<p>This module is a thin layer of abstraction around the library.
It exposes all core functionality.</p>
<div class="section" id="customizing">
<h2>Customizing<a class="headerlink" href="#customizing" title="Permalink to this headline"></a></h2>
<p>These attributes control what capabilties are exchanged with the NETCONF server and what operations are available through the <a class="reference internal" href="#ncclient.manager.Manager" title="ncclient.manager.Manager"><code class="xref py py-class docutils literal"><span class="pre">Manager</span></code></a> API.</p>
<dl class="data">
<dt id="ncclient.manager.OPERATIONS">
<code class="descclassname">ncclient.manager.</code><code class="descname">OPERATIONS</code><em class="property"> = {'create_subscription': &lt;class 'ncclient.operations.subscribe.CreateSubscription'&gt;, 'delete_config': &lt;class 'ncclient.operations.edit.DeleteConfig'&gt;, 'get_schema': &lt;class 'ncclient.operations.retrieve.GetSchema'&gt;, 'get': &lt;class 'ncclient.operations.retrieve.Get'&gt;, 'lock': &lt;class 'ncclient.operations.lock.Lock'&gt;, 'copy_config': &lt;class 'ncclient.operations.edit.CopyConfig'&gt;, 'close_session': &lt;class 'ncclient.operations.session.CloseSession'&gt;, 'dispatch': &lt;class 'ncclient.operations.retrieve.Dispatch'&gt;, 'poweroff_machine': &lt;class 'ncclient.operations.flowmon.PoweroffMachine'&gt;, 'unlock': &lt;class 'ncclient.operations.lock.Unlock'&gt;, 'get_config': &lt;class 'ncclient.operations.retrieve.GetConfig'&gt;, 'kill_session': &lt;class 'ncclient.operations.session.KillSession'&gt;, 'discard_changes': &lt;class 'ncclient.operations.edit.DiscardChanges'&gt;, 'commit': &lt;class 'ncclient.operations.edit.Commit'&gt;, 'edit_config': &lt;class 'ncclient.operations.edit.EditConfig'&gt;, 'validate': &lt;class 'ncclient.operations.edit.Validate'&gt;, 'reboot_machine': &lt;class 'ncclient.operations.flowmon.RebootMachine'&gt;}</em><a class="headerlink" href="#ncclient.manager.OPERATIONS" title="Permalink to this definition"></a></dt>
<dd><p>Dictionary of base method names and corresponding <a class="reference internal" href="operations.html#ncclient.operations.RPC" title="ncclient.operations.RPC"><code class="xref py py-class docutils literal"><span class="pre">RPC</span></code></a>
subclasses. It is used to lookup operations, e.g. <cite>get_config</cite> is mapped to
<a class="reference internal" href="operations.html#ncclient.operations.GetConfig" title="ncclient.operations.GetConfig"><code class="xref py py-class docutils literal"><span class="pre">GetConfig</span></code></a>. It is thus possible to add additional
operations to the <a class="reference internal" href="#ncclient.manager.Manager" title="ncclient.manager.Manager"><code class="xref py py-class docutils literal"><span class="pre">Manager</span></code></a> API.</p>
</dd></dl>

</div>
<div class="section" id="factory-functions">
<h2>Factory functions<a class="headerlink" href="#factory-functions" title="Permalink to this headline"></a></h2>
<p>A <a class="reference internal" href="#ncclient.manager.Manager" title="ncclient.manager.Manager"><code class="xref py py-class docutils literal"><span class="pre">Manager</span></code></a> instance is created using a factory function.</p>
<dl class="function">
<dt id="ncclient.manager.connect_ssh">
<code class="descclassname">ncclient.manager.</code><code class="descname">connect_ssh</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwds</em><span class="sig-paren">)</span><a class="headerlink" href="#ncclient.manager.connect_ssh" title="Permalink to this definition"></a></dt>
<dd><p>Initialize a <a class="reference internal" href="#ncclient.manager.Manager" title="ncclient.manager.Manager"><code class="xref py py-class docutils literal"><span class="pre">Manager</span></code></a> over the SSH transport.
For documentation of arguments see <a class="reference internal" href="transport.html#ncclient.transport.SSHSession.connect" title="ncclient.transport.SSHSession.connect"><code class="xref py py-meth docutils literal"><span class="pre">ncclient.transport.SSHSession.connect()</span></code></a>.</p>
<dl class="docutils">
<dt>The underlying <a class="reference internal" href="transport.html#ncclient.transport.SSHSession" title="ncclient.transport.SSHSession"><code class="xref py py-class docutils literal"><span class="pre">ncclient.transport.SSHSession</span></code></a> is created with</dt>
<dd><code class="xref py py-data docutils literal"><span class="pre">CAPABILITIES</span></code>. It is first instructed to
<a class="reference internal" href="transport.html#ncclient.transport.SSHSession.load_known_hosts" title="ncclient.transport.SSHSession.load_known_hosts"><code class="xref py py-meth docutils literal"><span class="pre">load_known_hosts()</span></code></a> and then
all the provided arguments are passed directly to its implementation
of <a class="reference internal" href="transport.html#ncclient.transport.SSHSession.connect" title="ncclient.transport.SSHSession.connect"><code class="xref py py-meth docutils literal"><span class="pre">connect()</span></code></a>.</dd>
<dt>To invoke advanced vendor related operation add device_params =</dt>
<dd>{&#8216;name&#8217;:&#8217;&lt;vendor_alias&gt;&#8217;} in connection paramerers. For the time,
&#8216;junos&#8217; and &#8216;nexus&#8217; are supported for Juniper and Cisco Nexus respectively.</dd>
</dl>
</dd></dl>

<dl class="data">
<dt id="ncclient.manager.connect">
<code class="descclassname">ncclient.manager.</code><code class="descname">connect</code><em class="property"> = &lt;function connect&gt;</em><a class="headerlink" href="#ncclient.manager.connect" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

</div>
<div class="section" id="manager">
<h2>Manager<a class="headerlink" href="#manager" title="Permalink to this headline"></a></h2>
<p>Exposes an API for RPC operations as method calls. The return type of these methods depends on whether we are in <a class="reference internal" href="#ncclient.manager.Manager.async_mode" title="ncclient.manager.Manager.async_mode"><code class="xref py py-attr docutils literal"><span class="pre">asynchronous</span> <span class="pre">or</span> <span class="pre">synchronous</span> <span class="pre">mode</span></code></a>.</p>
<p>In synchronous mode replies are awaited and the corresponding <a class="reference internal" href="operations.html#ncclient.operations.RPCReply" title="ncclient.operations.RPCReply"><code class="xref py py-class docutils literal"><span class="pre">RPCReply</span></code></a> object is returned. Depending on the <a class="reference internal" href="#ncclient.manager.Manager.raise_mode" title="ncclient.manager.Manager.raise_mode"><code class="xref py py-attr docutils literal"><span class="pre">exception</span> <span class="pre">raising</span> <span class="pre">mode</span></code></a>, an <cite>rpc-error</cite> in the reply may be raised as an <a class="reference internal" href="operations.html#ncclient.operations.RPCError" title="ncclient.operations.RPCError"><code class="xref py py-exc docutils literal"><span class="pre">RPCError</span></code></a> exception.</p>
<p>However in asynchronous mode, operations return immediately with the corresponding <a class="reference internal" href="operations.html#ncclient.operations.RPC" title="ncclient.operations.RPC"><code class="xref py py-class docutils literal"><span class="pre">RPC</span></code></a> object. Error handling and checking for whether a reply has been received must be dealt with manually. See the <a class="reference internal" href="operations.html#ncclient.operations.RPC" title="ncclient.operations.RPC"><code class="xref py py-class docutils literal"><span class="pre">RPC</span></code></a> documentation for details.</p>
<p>Note that in case of the <a class="reference internal" href="#ncclient.manager.Manager.get" title="ncclient.manager.Manager.get"><code class="xref py py-meth docutils literal"><span class="pre">get()</span></code></a> and <a class="reference internal" href="#ncclient.manager.Manager.get_config" title="ncclient.manager.Manager.get_config"><code class="xref py py-meth docutils literal"><span class="pre">get_config()</span></code></a> operations, the reply is an instance of <a class="reference internal" href="operations.html#ncclient.operations.GetReply" title="ncclient.operations.GetReply"><code class="xref py py-class docutils literal"><span class="pre">GetReply</span></code></a> which exposes the additional attributes <a class="reference internal" href="operations.html#ncclient.operations.GetReply.data" title="ncclient.operations.GetReply.data"><code class="xref py py-attr docutils literal"><span class="pre">data</span></code></a> (as <code class="xref py py-class docutils literal"><span class="pre">Element</span></code>) and <a class="reference internal" href="operations.html#ncclient.operations.GetReply.data_xml" title="ncclient.operations.GetReply.data_xml"><code class="xref py py-attr docutils literal"><span class="pre">data_xml</span></code></a> (as a string), which are of primary interest in case of these operations.</p>
<p>Presence of capabilities is verified to the extent possible, and you can expect a <a class="reference internal" href="operations.html#ncclient.operations.MissingCapabilityError" title="ncclient.operations.MissingCapabilityError"><code class="xref py py-exc docutils literal"><span class="pre">MissingCapabilityError</span></code></a> if something is amiss. In case of transport-layer errors, e.g. unexpected session close, <a class="reference internal" href="transport.html#ncclient.transport.TransportError" title="ncclient.transport.TransportError"><code class="xref py py-exc docutils literal"><span class="pre">TransportError</span></code></a> will be raised.</p>
<dl class="class">
<dt id="ncclient.manager.Manager">
<em class="property">class </em><code class="descclassname">ncclient.manager.</code><code class="descname">Manager</code><span class="sig-paren">(</span><em>session</em>, <em>device_handler</em>, <em>timeout=30</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#ncclient.manager.Manager" title="Permalink to this definition"></a></dt>
<dd><dl class="docutils">
<dt>For details on the expected behavior of the operations and their</dt>
<dd>parameters refer to <span class="target" id="index-0"></span><a class="rfc reference external" href="https://tools.ietf.org/html/rfc4741.html"><strong>RFC 4741</strong></a>.</dd>
</dl>
<p>Manager instances are also context managers so you can use it like this:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="k">with</span> <span class="n">manager</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="s2">&quot;host&quot;</span><span class="p">)</span> <span class="k">as</span> <span class="n">m</span><span class="p">:</span>
    <span class="c1"># do your stuff</span>
</pre></div>
</div>
<p>... or like this:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">m</span> <span class="o">=</span> <span class="n">manager</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="s2">&quot;host&quot;</span><span class="p">)</span>
<span class="k">try</span><span class="p">:</span>
    <span class="c1"># do your stuff</span>
<span class="k">finally</span><span class="p">:</span>
    <span class="n">m</span><span class="o">.</span><span class="n">close_session</span><span class="p">()</span>
</pre></div>
</div>
<dl class="method">
<dt id="ncclient.manager.Manager.get_config">
<code class="descname">get_config</code><span class="sig-paren">(</span><em>source</em>, <em>filter=None</em><span class="sig-paren">)</span><a class="headerlink" href="#ncclient.manager.Manager.get_config" title="Permalink to this definition"></a></dt>
<dd><p>Retrieve all or part of a specified configuration.</p>
<p><em>source</em> name of the configuration datastore being queried</p>
<p><em>filter</em> specifies the portion of the configuration to retrieve (by default entire configuration is retrieved)</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Seealso:</th><td class="field-body"><a class="reference internal" href="#filter-params"><span class="std std-ref">Filter parameters</span></a></td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="ncclient.manager.Manager.edit_config">
<code class="descname">edit_config</code><span class="sig-paren">(</span><em>target</em>, <em>config</em>, <em>default_operation=None</em>, <em>test_option=None</em>, <em>error_option=None</em><span class="sig-paren">)</span><a class="headerlink" href="#ncclient.manager.Manager.edit_config" title="Permalink to this definition"></a></dt>
<dd><p>Loads all or part of the specified <em>config</em> to the <em>target</em> configuration datastore.</p>
<p><em>target</em> is the name of the configuration datastore being edited</p>
<p><em>config</em> is the configuration, which must be rooted in the <cite>config</cite> element. It can be specified either as a string or an <code class="xref py py-class docutils literal"><span class="pre">Element</span></code>.</p>
<p><em>default_operation</em> if specified must be one of { <cite>&#8220;merge&#8221;</cite>, <cite>&#8220;replace&#8221;</cite>, or <cite>&#8220;none&#8221;</cite> }</p>
<p><em>test_option</em> if specified must be one of { <cite>&#8220;test_then_set&#8221;</cite>, <cite>&#8220;set&#8221;</cite> }</p>
<p><em>error_option</em> if specified must be one of { <cite>&#8220;stop-on-error&#8221;</cite>, <cite>&#8220;continue-on-error&#8221;</cite>, <cite>&#8220;rollback-on-error&#8221;</cite> }</p>
<p>The <cite>&#8220;rollback-on-error&#8221;</cite> <em>error_option</em> depends on the <cite>:rollback-on-error</cite> capability.</p>
</dd></dl>

<dl class="method">
<dt id="ncclient.manager.Manager.copy_config">
<code class="descname">copy_config</code><span class="sig-paren">(</span><em>source</em>, <em>target</em><span class="sig-paren">)</span><a class="headerlink" href="#ncclient.manager.Manager.copy_config" title="Permalink to this definition"></a></dt>
<dd><p>Create or replace an entire configuration datastore with the contents of another complete
configuration datastore.</p>
<p><em>source</em> is the name of the configuration datastore to use as the source of the copy operation or <cite>config</cite> element containing the configuration subtree to copy</p>
<p><em>target</em> is the name of the configuration datastore to use as the destination of the copy operation</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Seealso:</th><td class="field-body"><a class="reference internal" href="#srctarget-params"><span class="std std-ref">Source and target parameters</span></a></td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="ncclient.manager.Manager.delete_config">
<code class="descname">delete_config</code><span class="sig-paren">(</span><em>target</em><span class="sig-paren">)</span><a class="headerlink" href="#ncclient.manager.Manager.delete_config" title="Permalink to this definition"></a></dt>
<dd><p>Delete a configuration datastore.</p>
<p><em>target</em> specifies the  name or URL of configuration datastore to delete</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Seealso:</th><td class="field-body"><a class="reference internal" href="#srctarget-params"><span class="std std-ref">Source and target parameters</span></a></td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="ncclient.manager.Manager.dispatch">
<code class="descname">dispatch</code><span class="sig-paren">(</span><em>rpc_command</em>, <em>source=None</em>, <em>filter=None</em><span class="sig-paren">)</span><a class="headerlink" href="#ncclient.manager.Manager.dispatch" title="Permalink to this definition"></a></dt>
<dd><p><em>rpc_command</em> specifies rpc command to be dispatched either in plain text or in xml element format (depending on command)</p>
<p><em>source</em> name of the configuration datastore being queried</p>
<p><em>filter</em> specifies the portion of the configuration to retrieve (by default entire configuration is retrieved)</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Seealso:</th><td class="field-body"><a class="reference internal" href="#filter-params"><span class="std std-ref">Filter parameters</span></a></td>
</tr>
</tbody>
</table>
<p>Examples of usage:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">dispatch</span><span class="p">(</span><span class="s1">&#39;clear-arp-table&#39;</span><span class="p">)</span>
</pre></div>
</div>
<p>or dispatch element like</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">xsd_fetch</span> <span class="o">=</span> <span class="n">new_ele</span><span class="p">(</span><span class="s1">&#39;get-xnm-information&#39;</span><span class="p">)</span>
<span class="n">sub_ele</span><span class="p">(</span><span class="n">xsd_fetch</span><span class="p">,</span> <span class="s1">&#39;type&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">text</span><span class="o">=</span><span class="s2">&quot;xml-schema&quot;</span>
<span class="n">sub_ele</span><span class="p">(</span><span class="n">xsd_fetch</span><span class="p">,</span> <span class="s1">&#39;namespace&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">text</span><span class="o">=</span><span class="s2">&quot;junos-configuration&quot;</span>
<span class="n">dispatch</span><span class="p">(</span><span class="n">xsd_fetch</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="ncclient.manager.Manager.lock">
<code class="descname">lock</code><span class="sig-paren">(</span><em>target</em><span class="sig-paren">)</span><a class="headerlink" href="#ncclient.manager.Manager.lock" title="Permalink to this definition"></a></dt>
<dd><p>Allows the client to lock the configuration system of a device.</p>
<p><em>target</em> is the name of the configuration datastore to lock</p>
</dd></dl>

<dl class="method">
<dt id="ncclient.manager.Manager.unlock">
<code class="descname">unlock</code><span class="sig-paren">(</span><em>target</em><span class="sig-paren">)</span><a class="headerlink" href="#ncclient.manager.Manager.unlock" title="Permalink to this definition"></a></dt>
<dd><p>Release a configuration lock, previously obtained with the lock operation.</p>
<p><em>target</em> is the name of the configuration datastore to unlock</p>
</dd></dl>

<dl class="method">
<dt id="ncclient.manager.Manager.locked">
<code class="descname">locked</code><span class="sig-paren">(</span><em>target</em><span class="sig-paren">)</span><a class="headerlink" href="#ncclient.manager.Manager.locked" title="Permalink to this definition"></a></dt>
<dd><p>Returns a context manager for a lock on a datastore, where
<em>target</em> is the name of the configuration datastore to lock, e.g.:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="k">with</span> <span class="n">m</span><span class="o">.</span><span class="n">locked</span><span class="p">(</span><span class="s2">&quot;running&quot;</span><span class="p">):</span>
    <span class="c1"># do your stuff</span>
</pre></div>
</div>
<p>... instead of:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">m</span><span class="o">.</span><span class="n">lock</span><span class="p">(</span><span class="s2">&quot;running&quot;</span><span class="p">)</span>
<span class="k">try</span><span class="p">:</span>
    <span class="c1"># do your stuff</span>
<span class="k">finally</span><span class="p">:</span>
    <span class="n">m</span><span class="o">.</span><span class="n">unlock</span><span class="p">(</span><span class="s2">&quot;running&quot;</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="ncclient.manager.Manager.get">
<code class="descname">get</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#ncclient.manager.Manager.get" title="Permalink to this definition"></a></dt>
<dd><p>Retrieve running configuration and device state information.</p>
<p><em>filter</em> specifies the portion of the configuration to retrieve (by default entire configuration is retrieved)</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Seealso:</th><td class="field-body"><a class="reference internal" href="#filter-params"><span class="std std-ref">Filter parameters</span></a></td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="ncclient.manager.Manager.close_session">
<code class="descname">close_session</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#ncclient.manager.Manager.close_session" title="Permalink to this definition"></a></dt>
<dd><p>Request graceful termination of the NETCONF session, and also close the transport.</p>
</dd></dl>

<dl class="method">
<dt id="ncclient.manager.Manager.kill_session">
<code class="descname">kill_session</code><span class="sig-paren">(</span><em>session_id</em><span class="sig-paren">)</span><a class="headerlink" href="#ncclient.manager.Manager.kill_session" title="Permalink to this definition"></a></dt>
<dd><p>Force the termination of a NETCONF session (not the current one!)</p>
<p><em>session_id</em> is the session identifier of the NETCONF session to be terminated as a string</p>
</dd></dl>

<dl class="method">
<dt id="ncclient.manager.Manager.commit">
<code class="descname">commit</code><span class="sig-paren">(</span><em>confirmed=False</em>, <em>timeout=None</em>, <em>persist=None</em><span class="sig-paren">)</span><a class="headerlink" href="#ncclient.manager.Manager.commit" title="Permalink to this definition"></a></dt>
<dd><p>Commit the candidate configuration as the device&#8217;s new current configuration. Depends on the <cite>:candidate</cite> capability.</p>
<p>A confirmed commit (i.e. if <em>confirmed</em> is <cite>True</cite>) is reverted if there is no followup commit within the <em>timeout</em> interval. If no timeout is specified the confirm timeout defaults to 600 seconds (10 minutes). A confirming commit may have the <em>confirmed</em> parameter but this is not required. Depends on the <cite>:confirmed-commit</cite> capability.</p>
<p><em>confirmed</em> whether this is a confirmed commit</p>
<p><em>timeout</em> specifies the confirm timeout in seconds</p>
<p><em>persist</em> make the confirmed commit survive a session termination, and set a token on the ongoing confirmed commit</p>
</dd></dl>

<dl class="method">
<dt id="ncclient.manager.Manager.discard_changes">
<code class="descname">discard_changes</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#ncclient.manager.Manager.discard_changes" title="Permalink to this definition"></a></dt>
<dd><p>Revert the candidate configuration to the currently running configuration. Any uncommitted changes are discarded.</p>
</dd></dl>

<dl class="method">
<dt id="ncclient.manager.Manager.validate">
<code class="descname">validate</code><span class="sig-paren">(</span><em>source</em><span class="sig-paren">)</span><a class="headerlink" href="#ncclient.manager.Manager.validate" title="Permalink to this definition"></a></dt>
<dd><p>Validate the contents of the specified configuration.</p>
<p><em>source</em> is the name of the configuration datastore being validated or <cite>config</cite> element containing the configuration subtree to be validated</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Seealso:</th><td class="field-body"><a class="reference internal" href="#srctarget-params"><span class="std std-ref">Source and target parameters</span></a></td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="attribute">
<dt id="ncclient.manager.Manager.async_mode">
<code class="descname">async_mode</code><a class="headerlink" href="#ncclient.manager.Manager.async_mode" title="Permalink to this definition"></a></dt>
<dd><p>Specify whether operations are executed asynchronously (<cite>True</cite>) or
synchronously (<cite>False</cite>) (the default).</p>
</dd></dl>

<dl class="attribute">
<dt id="ncclient.manager.Manager.timeout">
<code class="descname">timeout</code><a class="headerlink" href="#ncclient.manager.Manager.timeout" title="Permalink to this definition"></a></dt>
<dd><p>Specify the timeout for synchronous RPC requests.</p>
</dd></dl>

<dl class="attribute">
<dt id="ncclient.manager.Manager.raise_mode">
<code class="descname">raise_mode</code><a class="headerlink" href="#ncclient.manager.Manager.raise_mode" title="Permalink to this definition"></a></dt>
<dd><p>Specify which errors are raised as <a class="reference internal" href="operations.html#ncclient.operations.RPCError" title="ncclient.operations.RPCError"><code class="xref py py-exc docutils literal"><span class="pre">RPCError</span></code></a>
exceptions. Valid values are the constants defined in
<a class="reference internal" href="operations.html#ncclient.operations.RaiseMode" title="ncclient.operations.RaiseMode"><code class="xref py py-class docutils literal"><span class="pre">RaiseMode</span></code></a>.
The default value is <a class="reference internal" href="operations.html#ncclient.operations.RaiseMode.ALL" title="ncclient.operations.RaiseMode.ALL"><code class="xref py py-attr docutils literal"><span class="pre">ALL</span></code></a>.</p>
</dd></dl>

<dl class="attribute">
<dt id="ncclient.manager.Manager.client_capabilities">
<code class="descname">client_capabilities</code><a class="headerlink" href="#ncclient.manager.Manager.client_capabilities" title="Permalink to this definition"></a></dt>
<dd><p><a class="reference internal" href="capabilities.html#ncclient.capabilities.Capabilities" title="ncclient.capabilities.Capabilities"><code class="xref py py-class docutils literal"><span class="pre">Capabilities</span></code></a> object representing
the client&#8217;s capabilities.</p>
</dd></dl>

<dl class="attribute">
<dt id="ncclient.manager.Manager.server_capabilities">
<code class="descname">server_capabilities</code><a class="headerlink" href="#ncclient.manager.Manager.server_capabilities" title="Permalink to this definition"></a></dt>
<dd><p><a class="reference internal" href="capabilities.html#ncclient.capabilities.Capabilities" title="ncclient.capabilities.Capabilities"><code class="xref py py-class docutils literal"><span class="pre">Capabilities</span></code></a> object representing
the server&#8217;s capabilities.</p>
</dd></dl>

<dl class="attribute">
<dt id="ncclient.manager.Manager.session_id">
<code class="descname">session_id</code><a class="headerlink" href="#ncclient.manager.Manager.session_id" title="Permalink to this definition"></a></dt>
<dd><p><cite>session-id</cite> assigned by the NETCONF server.</p>
</dd></dl>

<dl class="attribute">
<dt id="ncclient.manager.Manager.connected">
<code class="descname">connected</code><a class="headerlink" href="#ncclient.manager.Manager.connected" title="Permalink to this definition"></a></dt>
<dd><p>Whether currently connected to the NETCONF server.</p>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="special-kinds-of-parameters">
<h2>Special kinds of parameters<a class="headerlink" href="#special-kinds-of-parameters" title="Permalink to this headline"></a></h2>
<p>Some parameters can take on different types to keep the interface simple.</p>
<div class="section" id="source-and-target-parameters">
<span id="srctarget-params"></span><h3>Source and target parameters<a class="headerlink" href="#source-and-target-parameters" title="Permalink to this headline"></a></h3>
<p>Where an method takes a <em>source</em> or <em>target</em> argument, usually a datastore name or URL is expected. The latter depends on the <cite>:url</cite> capability and on whether the specific URL scheme is supported. Either must be specified as a string. For example, <cite>&#8220;running&#8221;</cite>, <cite>&#8220;ftp://user:pass&#64;host/config&#8221;</cite>.</p>
<p>If the source may be a <cite>config</cite> element, e.g. as allowed for the <cite>validate</cite> RPC, it can also be specified as an XML string or an <code class="xref py py-class docutils literal"><span class="pre">Element</span></code> object.</p>
</div>
<div class="section" id="filter-parameters">
<span id="filter-params"></span><h3>Filter parameters<a class="headerlink" href="#filter-parameters" title="Permalink to this headline"></a></h3>
<p>Where a method takes a <em>filter</em> argument, it can take on the following types:</p>
<ul>
<li><p class="first">A tuple of <em>(type, criteria)</em>.</p>
<blockquote>
<div><p>Here <em>type</em> has to be one of <cite>&#8220;xpath&#8221;</cite> or <cite>&#8220;subtree&#8221;</cite>.</p>
<ul class="simple">
<li>For <cite>&#8220;xpath&#8221;</cite> the <em>criteria</em> should be a string containing the XPath expression.</li>
<li>For <cite>&#8220;subtree&#8221;</cite> the <em>criteria</em> should be an XML string or an <code class="xref py py-class docutils literal"><span class="pre">Element</span></code> object containing the criteria.</li>
</ul>
</div></blockquote>
</li>
<li><p class="first">A <cite>&lt;filter&gt;</cite> element as an XML string or an <code class="xref py py-class docutils literal"><span class="pre">Element</span></code> object.</p>
</li>
</ul>
</div>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
<p align="center">
  <a href="http://oss.schmizz.net/ncclient">
    <img src="_static/logo.png" width="125" height="125"/>
  </a>
</p>

  <h3><a href="index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#"><code class="docutils literal"><span class="pre">manager</span></code> &#8211; High-level API</a><ul>
<li><a class="reference internal" href="#customizing">Customizing</a></li>
<li><a class="reference internal" href="#factory-functions">Factory functions</a></li>
<li><a class="reference internal" href="#manager">Manager</a></li>
<li><a class="reference internal" href="#special-kinds-of-parameters">Special kinds of parameters</a><ul>
<li><a class="reference internal" href="#source-and-target-parameters">Source and target parameters</a></li>
<li><a class="reference internal" href="#filter-parameters">Filter parameters</a></li>
</ul>
</li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="index.html"
                        title="previous chapter">Welcome</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="api.html"
                        title="next chapter">Complete API documentation</a></p>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="_sources/manager.rst.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3>Quick search</h3>
    <form class="search" action="search.html" method="get">
      <div><input type="text" name="q" /></div>
      <div><input type="submit" value="Go" /></div>
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="api.html" title="Complete API documentation"
             >next</a> |</li>
        <li class="right" >
          <a href="index.html" title="Welcome"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="index.html">ncclient 0.4.4 documentation</a> &#187;</li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright 2017, Shikhar Bhushan; 2011-2014, Leonidas Poulopoulos.
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.5.6.
    </div>
  </body>
</html>