File: release-notes-0.6.0.rst

package info (click to toggle)
pyeapi 1.0.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,564 kB
  • sloc: python: 10,906; makefile: 197
file content (72 lines) | stat: -rw-r--r-- 1,867 bytes parent folder | download | duplicates (5)
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
######
v0.6.0
######

2016-02-22

New Modules
^^^^^^^^^^^
* None

Enhancements
^^^^^^^^^^^^

* Added support for multiline commands without having to pass them as a dictionary (`78 <https://github.com/arista-eosplus/pyeapi/pull/78>`_) [`dbarrosop <https://github.com/dbarrosop>`_]
    (See example below)

.. code-block:: python

  >>> import pyeapi
  >>> connection = pyeapi.client.connect(
  ...     transport='https',
  ...     host='192.168.56.201',
  ...     username='vagrant',
  ...     password='vagrant',
  ...     port=443,
  ...     timeout=60
  ... )
  >>> device = pyeapi.client.Node(connection)
  >>> device.run_commands('show hostname')
  [{u'hostname': u'localhost', u'fqdn': u'localhost'}]
  >>> device.run_commands('show banner login')
  [{u'loginBanner': u''}]
  >>> my_commands = [
  ...     'configure session whatever',
  ...     'hostname new-hostname',
  ...     'banner login MULTILINE:This is a new banner\nwith different lines!!!',
  ...     'end'
  ... ]
  >>>
  >>> device.run_commands(my_commands)
  [{}, {}, {}, {}]
  >>> print device.run_commands(['show session-config named whatever diffs'], encoding='text')[0]['output']
  --- system:/running-config
  +++ session:/whatever-session-config
  @@ -3,6 +3,8 @@
  ! boot system flash:/vEOS-lab.swi
  !
  transceiver qsfp default-mode 4x10G
  +!
  +hostname new-hostname
  !
  spanning-tree mode mstp
  !
  @@ -22,6 +24,11 @@
  !
  no ip routing
  !
  +banner login
  +This is a new banner
  +with different lines!!!
  +EOF
  +!
  management api http-commands
    no shutdown
  !
  >>> device.run_commands(['configure session whatever', 'commit'])
  [{}, {}]
  >>> device.run_commands('show hostname')
  [{u'hostname': u'new-hostname', u'fqdn': u'new-hostname'}]
  >>> device.run_commands('show banner login')
  [{u'loginBanner': u'This is a new banner\nwith different lines!!!\n'}]
  >>>