Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 0.4.0 #60

Merged
merged 100 commits into from
Nov 6, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
a1b7241
version bump
Jul 31, 2015
417021f
Fix #22
phil-dileo Aug 10, 2015
db1a458
Fix peer-link parsing regex
phil-dileo Aug 13, 2015
97b891a
Merge pull request #26 from arista-eosplus/fix-mlag_peer_link
devrobo Aug 17, 2015
12fab19
Fix #28
phil-dileo Aug 26, 2015
9da726e
Merge pull request #29 from arista-eosplus/fix-28-get_members
phil-dileo Aug 26, 2015
4214e68
Add sshkey support to users API
phil-dileo Sep 4, 2015
d75d5b8
Fix users unit test
phil-dileo Sep 4, 2015
cc75028
Add tests for empty string and None
phil-dileo Sep 8, 2015
46525df
Merge pull request #34 from arista-eosplus/feature-user-sshkey
devrobo Sep 8, 2015
880f0fd
Add BGP maximum-paths support
phil-dileo Sep 16, 2015
d90fc67
Fix unit test
phil-dileo Sep 16, 2015
10ebb14
Fix variable type
phil-dileo Sep 16, 2015
535de13
Add check for missing argument
phil-dileo Sep 16, 2015
fe4fe20
Add negate case to unit test
phil-dileo Sep 16, 2015
ca51832
Fix docstring
phil-dileo Sep 18, 2015
711b4e4
Merge pull request #36 from arista-eosplus/feature-bgp_knobs
devrobo Sep 18, 2015
c539798
Fix typos
phil-dileo Oct 5, 2015
9556dca
Fix getall method
phil-dileo Oct 5, 2015
b42e0f2
Fix getall method
phil-dileo Oct 5, 2015
09be4f6
Merge pull request #39 from arista-eosplus/users_fix-docstings
devrobo Oct 5, 2015
1c9f896
Add routemap support
phil-dileo Oct 8, 2015
acaeca4
Update docstring
phil-dileo Oct 8, 2015
acb340f
Fix typo in unittest
phil-dileo Oct 8, 2015
638e30c
Fix typo in unittest
phil-dileo Oct 8, 2015
807d098
Added support to specify timeout
dbarrosop Oct 8, 2015
dbfba32
Add support for description
phil-dileo Oct 8, 2015
bdf275f
Modify regex
phil-dileo Oct 8, 2015
77bb81a
Update description logic to remove old entries
phil-dileo Oct 8, 2015
fdc12c0
Fixed tests to include the timeout kwarg
dbarrosop Oct 11, 2015
5411f7c
Merge pull request #41 from dbarrosop/develop
devrobo Oct 13, 2015
1e2e6af
Remove value checks
phil-dileo Oct 13, 2015
836d2d3
Merge pull request #40 from arista-eosplus/feature-routemaps
phil-dileo Oct 13, 2015
133f8af
Add support for Varp API
phil-dileo Oct 13, 2015
000ffe1
initial file commit
grybak-arista Oct 13, 2015
0b002fe
update
grybak-arista Oct 14, 2015
c1eb13f
update
grybak-arista Oct 14, 2015
5c3d4ae
Add next_hop_ip value to unique route id string, other fixes
grybak-arista Oct 15, 2015
75f5e87
Close #46
phil-dileo Oct 15, 2015
98bd949
use a tuple for the dict key instead of formatted string
grybak-arista Oct 15, 2015
e9fd938
cast distance in key tuple to int
grybak-arista Oct 16, 2015
a47f3dc
add file placeholders to branch
grybak-arista Oct 16, 2015
4825105
test that distance value can be cast as int, clean up documentation
grybak-arista Oct 16, 2015
6e5c24d
test that distance value can be cast as int, clean up documentation
grybak-arista Oct 16, 2015
bd914a1
add set_tag and set_route_name methods
grybak-arista Oct 16, 2015
3e3888a
fix ValueError handling
grybak-arista Oct 16, 2015
b821f9a
Modify API to reset channel-group members
phil-dileo Oct 20, 2015
05111f7
additional tests for coverage; fix documentation
grybak-arista Oct 20, 2015
cd7432d
testing changes
grybak-arista Oct 20, 2015
7ffbcdb
test cases
grybak-arista Oct 20, 2015
daa47b1
Update set_members to use set_lacp_mode
phil-dileo Oct 20, 2015
d6d318e
Add more unit tests
phil-dileo Oct 20, 2015
c0ce04b
Merge pull request #47 from arista-eosplus/feature-lacp_mode
phil-dileo Oct 20, 2015
6088eff
Add unittests
phil-dileo Oct 21, 2015
64f7a46
Merge pull request #43 from arista-eosplus/feature-varp
phil-dileo Oct 21, 2015
064baca
Update routemaps object
phil-dileo Oct 21, 2015
dd5312a
Fix key name
phil-dileo Oct 21, 2015
438393d
use **kwargs instead of named parameters
grybak-arista Oct 21, 2015
2033504
Merge pull request #50 from arista-eosplus/feature_routemap-update
phil-dileo Oct 21, 2015
2750dcb
Update enable return dict
phil-dileo Oct 21, 2015
18a268a
Update tests
phil-dileo Oct 21, 2015
e413b70
Merge pull request #52 from arista-eosplus/fix_routemap_tests
phil-dileo Oct 21, 2015
a96c7a5
Merge pull request #51 from arista-eosplus/fix-35
phil-dileo Oct 21, 2015
c8e4e20
Add autogenerator script to list all modules
phil-dileo Oct 22, 2015
a3afd49
fix get() to take single 'name' parameter; reformat output from get()…
grybak-arista Oct 22, 2015
2741130
Fix docstrings for readthedocs
phil-dileo Oct 22, 2015
c1cb593
remove top level key from get() result
grybak-arista Oct 22, 2015
502081a
Doc updates
phil-dileo Oct 22, 2015
34f00bf
Add sys to setup.py
phil-dileo Oct 22, 2015
6756b8d
Add os.environ to import
phil-dileo Oct 22, 2015
d45cab6
remove unnecessary code
grybak-arista Oct 22, 2015
7b6ee8f
Add path to command
phil-dileo Oct 22, 2015
96e4254
Change to relative paths
phil-dileo Oct 22, 2015
f4e2655
Change path for RTD
phil-dileo Oct 22, 2015
c27790f
Add check to see if dir exists
phil-dileo Oct 22, 2015
0955471
Update Quickstart
phil-dileo Oct 23, 2015
27e3fa7
Making configure RADIUS compatible
Oct 23, 2015
bf05ede
Doc updates
phil-dileo Oct 23, 2015
049d884
Sort modules alpha
phil-dileo Oct 23, 2015
036d910
Merge pull request #45 from arista-eosplus/staticroute
devrobo Oct 26, 2015
418e933
Merge pull request #53 from GaryCarneiro/develop
devrobo Oct 26, 2015
db8eb63
Update _parse_shutdown method
phil-dileo Oct 26, 2015
18ec7e1
add vrrp functionality to pyeapi
grybak-arista Oct 27, 2015
f34d89b
update documentation
grybak-arista Oct 27, 2015
e46a5e3
fix regex matches
grybak-arista Oct 28, 2015
2cc73cd
fix track property format; fix variable names; fix regex handling
grybak-arista Oct 28, 2015
6b5f13e
remove degugging lines
grybak-arista Oct 28, 2015
ad09df8
Merge pull request #56 from arista-eosplus/fix_bgp_shutdown
devrobo Oct 29, 2015
77713ac
add setters; update track and secondary_ip format
grybak-arista Oct 30, 2015
70a0791
fix python3 errors
grybak-arista Oct 30, 2015
9813956
fix long lines
grybak-arista Oct 30, 2015
9579860
remove redundant commands.append lines; remove authentication placeho…
grybak-arista Nov 2, 2015
93934a4
remove update method from api and fix affected test cases
grybak-arista Nov 2, 2015
68eee06
documentation
grybak-arista Nov 2, 2015
6a26a0e
Merge pull request #57 from arista-eosplus/feature-vrrp
devrobo Nov 2, 2015
eda5673
Add new docs
phil-dileo Nov 2, 2015
59a69e4
Add Release notes
phil-dileo Nov 2, 2015
3db0b08
Update release notes link
phil-dileo Nov 2, 2015
06be3c5
Merge pull request #54 from arista-eosplus/feature-rtdocs
phil-dileo Nov 2, 2015
66d91f0
Bump to version 0.4.0
phil-dileo Nov 5, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ coverage.xml

# Sphinx documentation
docs/_build/
docs/*_modules/

# PyBuilder
target/
Expand Down
63 changes: 2 additions & 61 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,66 +1,7 @@
Python Client for eAPI
======================

## v0.3.2, 7/16/2015
Full [release notes] [rns] hosted at readthedocs

- fixes a problem with parsing the hostname value in the system module

## v0.3.1, 6/14/2015

- make pyeapi compatible under Python 3.4 with all unit tests passing ok
- added socket_error property to connection to capture socket errors
- adds function to create per vlan vtep flood lists

## v0.3.0, 5/4/2015

- fixes an issue with configuring stp portfast edge correctly
- fixes #13
- fixes #11
- added initial support for system api module
- added initial support for acl api module (standard)
- added initial api support for mlag configuration
- added tag feature to eapi.conf

## v0.2.4, 4/30/2015

- adds required docs/description.rst for setup.py

## v0.2.3, 4/29/2015

- fixes issue with importing syslog module on Windows

## v0.2.2, 04/15/2015

- fixes an issue with eAPI error messages that do not return a data key

## v0.2.1, 03/28/2015

- restores default certificate validation behavior for py2.7.9

## v0.2.0, 3/19/2015

- adds udp_port, vlans and flood_list attributes to vxlan interfaces
- renames spanningtree api module to stp for consistency
- depreciated spanningtree api module in favor of stp
- interfaces module now properly responds to hasattr calls
- fixes an issue with collecting the vxlan global flood list from the config
- fixes an issue with properly parsing portchannel configurations
- adds portfast_type attribute to stp interfaces resource

## v0.1.1, 2/17/2015

- adds introspection properties to CommandError for more details (#4)
- changed the default transport from HTTP to HTTPS to align with EOS
- updates the message returned if the connection profile name is not found
- fixes connection name not copied to host parameter if host not configured
- fixes an issue where an ipinterface wasnt properly recognized
- fixes an issue where a switchport interface was propertly recognized

## v0.1.0, 1/23/2015

- initial public release of pyeapi
- initial support for vlans
- initial support for interfaces
- initial support for spanningtree
- initial support for switchports
- initial support for ipinterfaces
[rns]: http://pyeapi.readthedocs.org/en/master/release-notes.html
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ VERSION := $(shell cat VERSION)

########################################################

all: clean check pep8 pyflakes tests
all: clean check pep8 pyflakes tests

pep8:
-pep8 -r --ignore=E501,E221,W291,W391,E302,E251,E203,W293,E231,E303,E201,E225,E261,E241 pyeapi/ test/
Expand Down Expand Up @@ -62,3 +62,5 @@ unittest: clean
systest: clean
$(COVERAGE) run -m unittest discover test/system -v

coverage_report:
$(COVERAGE) report -m
221 changes: 26 additions & 195 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,220 +1,43 @@
# Arista eAPI Python Library

[![Build Status](https://travis-ci.org/arista-eosplus/pyeapi.svg?branch=develop)](https://travis-ci.org/arista-eosplus/pyeapi) [![Coverage Status](https://coveralls.io/repos/arista-eosplus/pyeapi/badge.svg?branch=develop)](https://coveralls.io/r/arista-eosplus/pyeapi?branch=develop)
[![Build Status](https://travis-ci.org/arista-eosplus/pyeapi.svg?branch=develop)](https://travis-ci.org/arista-eosplus/pyeapi) [![Coverage Status](https://coveralls.io/repos/arista-eosplus/pyeapi/badge.svg?branch=develop)](https://coveralls.io/r/arista-eosplus/pyeapi?branch=develop) [![Documentation Status](https://readthedocs.org/projects/pyeapi/badge/?version=latest)](http://readthedocs.org/docs/pyeapi/en/latest/?badge=latest)

The Python library for Arista's eAPI command API implementation provides a
client API work using eAPI and communicating with EOS nodes. The Python
library can be used to communicate with EOS either locally (on-box) or remotely
(off-box). It uses a standard INI-style configuration file to specify one or
more nodes and connection properites.
more nodes and connection properties.

The pyeapi library also provides an API layer for building native Python
objects to interact with the destination nodes. The API layer is a convienent
objects to interact with the destination nodes. The API layer is a convenient
implementation for working with the EOS configuration and is extensible for
developing custom implemenations.
developing custom implementations.

This library is freely provided to the open source community for building
robust applications using Arista EOS. Support is provided as best effort
through Github issues.

## Requirements

* Arista EOS 4.12 or later
* Arista eAPI enabled for at least one transport (see Official EOS Config Guide
at arista.com for details)
* Python 2.7 / 3.4+ (Python 3 support is work in progress)

# Getting Started
In order to use pyeapi, the EOS command API must be enabled using ``management
api http-commands`` configuration mode. This library supports eAPI calls over
both HTTP and UNIX Domain Sockets. Once the command API is enabled on the
destination node, create a configuration file with the node properities.

**Note:** The default search path for the conf file is ``~/.eapi.conf``
followed by ``/mnt/flash/eapi.conf``. This can be overridden by setting
``EAPI_CONF=<path file conf file>`` in your environment.

## Example eapi.conf File
Below is an example of an eAPI conf file. The conf file can contain more than
one node. Each node section must be prefaced by **connection:\<name\>** where
\<name\> is the name of the connection.

The following configuration options are available for defining node entries:

* **host** - The IP address or FQDN of the remote device. If the host
parameter is omitted then the connection name is used
* **username** - The eAPI username to use for authentication (only required for
http or https connections)
* **password** - The eAPI password to use for authentication (only required for
http or https connections)
* **enablepwd** - The enable mode password if required by the destination node
* **transport** - Configures the type of transport connection to use. The
default value is _https_. Valid values are:
* socket (available in EOS 4.14.5 or later)
* http_local (available in EOS 4.14.5 or later)
* http
* https
* **port** - Configures the port to use for the eAPI connection. A default
port is used if this parameter is absent, based on the transport setting
using the following values:
* transport: http, default port: 80
* transport: https, deafult port: 443
* transport: https_local, default port: 8080
* transport: socket, default port: n/a


_Note:_ See the EOS User Manual found at arista.com for more details on
configuring eAPI values.

All configuration values are optional.

```
[connection:veos01]
username: eapi
password: password
transport: http

[connection:veos02]
transport: http

[connection:veos03]
transport: socket

[connection:veos04]
host: 172.16.10.1
username: eapi
password: password
enablepwd: itsasecret
port: 1234
transport: https

[connection:localhost]
transport: http_local
```

The above example shows different ways to define EOS node connections. All
configuration options will attempt to use default values if not explicitly
defined. If the host parameter is not set for a given entry, then the
connection name will be used as the host address.

### Configuring \[connection:localhost]

The pyeapi library automatically installs a single default configuration entry
for connecting to localhost host using a transport of sockets. If using the
pyeapi library locally on an EOS node, simply enable the command API to use
sockets and no further configuration is needed for pyeapi to function. If you
specify an entry in a conf file with the name ``[connection:localhost]``, the
values in the conf file will overwrite the default.

## Using pyeapi
The Python client for eAPI was designed to be easy to use and implement for
writing tools and applications that interface with the Arista EOS management
plane.

### Creating a connection and sending commands
Once EOS is configured properly and the config file created, getting started
with a connection to EOS is simple. Below demonstrates a basic connection
using pyeapi. For more examples, please see the examples folder.

```
# start by importing the library
import pyeapi

# create a node object by specifying the node to work with
node = pyeapi.connect_to('veos01')

# send one or more commands to the node
node.enable('show hostname')
[{'command': 'show hostname', 'result': {u'hostname': u'veos01', u'fqdn':
u'veos01.arista.com'}, 'encoding': 'json'}]

# use the config method to send configuration commands
node.config('hostname veos01')
[{}]

# multiple commands can be sent by using a list (works for both enable or
config)
node.config(['interface Ethernet1', 'description foo'])
[{}, {}]

# return the running or startup configuration from the node (output omitted for
brevity)
node.running_config

node.startup_config
```

### Using the API

The pyeapi library provides both a client for send and receiving commands over
eAPI as well as an API for working directly with EOS resources. The API is
designed to be easy and straightforward to use yet also extensible. Below is
an example of working with the ``vlans`` API

```
# create a connection to the node
import pyeapi
node = pyeapi.connect_to('veos01')

# get the instance of the API (in this case vlans)
vlans = node.api('vlans')
## Documentation

# return all vlans from the node
vlans.getall()
{'1': {'state': 'active', 'name': 'default', 'vlan_id': 1, 'trunk_groups': []},
'10': {'state': 'active', 'name': 'VLAN0010', 'vlan_id': 10, 'trunk_groups':
[]}}

# return a specific vlan from the node
vlans.get(1)
{'state': 'active', 'name': 'default', 'vlan_id': 1, 'trunk_groups': []}

# add a new vlan to the node
vlans.create(100)
True

# set the new vlan name
vlans.set_name(100, 'foo')
True
```

All API implementations developed by Arista EOS+ CS are found in the pyeapi/api
folder. See the examples folder for additional examples.

# Installation

The source code for pyeapi is provided on Github at
http://github.com/arista-eosplus/pyeapi. All current development is done in
the develop branch. Stable released versions are tagged in the master branch
and uploaded to PyPi.
* [Quickstart] [quickstart]
* [Installation] [install]
* [Modules] [modules]
* [Release Notes] [rns]
* [Contribute] [contribute]

* To install the latest stable version of pyeapi, simply run ``pip install
pyeapi`` (or ``pip install --upgrade pyeapi``)
* To install the latest development version from Github, simply clone the
develop branch and run ``python setup.py install``

# Testing
The pyeapi library provides both unit tests and system tests. The unit tests
can be run without an EOS node. To run the system tests, you will need to
update the ``dut.conf`` file found in test/fixtures.
### Building Local Documentation

* To run the unit tests, simply run ``make unittest`` from the root of the
pyeapi source folder
* To run the system tests, simply run ``make systest`` from the root of the
pyeapi source fodler
* To run all tests, use ``make tests`` from the root of the pyeapi source
folder
If you cannot access readthedocs.org you have the option of building the
documentation locally.


# Contributing

Contributing pull requests are gladly welcomed for this repository. Please
note that all contributions that modify the library behavior require
corresponding test cases otherwise the pull request will be rejected.
1. ``pip install -r dev-requirements.txt``
2. ``cd docs``
3. ``make html``
4. ``open _build/html/index.html``

# License

Copyright (c) 2014, Arista Networks EOS+
Copyright (c) 2015, Arista Networks EOS+
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -242,3 +65,11 @@ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


[pyeapi]: https://github.com/arista-eosplus/pyeapi
[quickstart]: http://pyeapi.readthedocs.org/en/master/quickstart.html
[install]: http://pyeapi.readthedocs.org/en/master/install.html
[contribute]: http://pyeapi.readthedocs.org/en/master/contribute.html
[modules]: http://pyeapi.readthedocs.org/en/master/modules.html
[support]: http://pyeapi.readthedocs.org/en/master/support.html
[rns]: http://pyeapi.readthedocs.org/en/master/release-notes.html
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.3
0.4.0
10 changes: 10 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build
APIDIR = api_modules
CLIENTDIR = client_modules
CWD := $(shell pwd)

# User-friendly check for sphinx-build
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
Expand Down Expand Up @@ -48,12 +51,19 @@ help:

clean:
rm -rf $(BUILDDIR)/*
rm -rf $(CLIENTDIR)/*
rm -rf $(APIDIR)/*

html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."

modules:
python $(CWD)/generate_modules.py

docs: clean modules html

dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
Expand Down
2 changes: 2 additions & 0 deletions docs/conf.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
'sphinx.ext.autodoc',
'sphinx.ext.coverage',
'sphinx.ext.viewcode',
'sphinx.ext.doctest',
'sphinxcontrib.napoleon'
]

# Add any paths that contain templates here, relative to this directory.
Expand Down
Loading