Skip to content

Commit

Permalink
major rewrite of the eos modules to support a common code base
Browse files Browse the repository at this point in the history
This is a major re-write of the Arista EOS modules in preparing for 1.0
release.  This re-write introduces a common code module that is derived
from AnsbileModule.   It also removes all complex arguments in favor of
more friendly arguments that are delimited.

NOTE: This commit will most likely break current playbooks.  Please test
your playbooks throughly.

This update allows addes a new system test harness for testing the modules
against existing EOS nodes.  You will need the latest version of pyeapi from
source to execute the test cases.
  • Loading branch information
Peter Sprygada committed Apr 29, 2015
1 parent b63ac54 commit e4e202c
Show file tree
Hide file tree
Showing 55 changed files with 8,182 additions and 3,378 deletions.
60 changes: 2 additions & 58 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,61 +1,5 @@
Arista EOS role for Ansible
Arista EOS Role for Ansible
===========================

## v0.2.1 (under development)
## 1.0.0, IN PROGRESS

- added connection, config attribute to all modules
- fixes an issue with switchport trunks being set to none (issue #7)
- support added for using enable_password over eAPI (thanks rsolomo)


Updated Modules:

* eos_vlan
* eos_vxlan
* eos_switchport
* eos_portchannel
* eos_ipinterface

New Modules:

* eos_ethernet
* eos_stp_interface
* eos_vxlan_vlan
* eos_vxlan_vtep
* eos_ethernet


## v0.1.2

- fixes a minor issue with eos_vlan trying to set a nonexistent vni
- fixes an issue where the wrong state was being set for configured resources
- documentation updates

Updated Modules:

* eos_eapi


## v0.1.1

- fixes a major bug with eos_command using an old variable name
- added additional details and new examples to README


## v0.1.0

- first release of role to Ansible Galaxy
- all modules initially released

New Modules:

* eos_command
* eos_interface
* eos_ipv4interface
* eos_portchannel
* eos_switchport
* eos_vlan
* eos_vxlan
* eos_purge (beta)
* eos_eapi (alpha)
* eos_facts (on-box connections only)
38 changes: 38 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/make
# WARN: gmake syntax
########################################################
# Makefile for ansible-eos
#
# useful targets:
# make flake8 -- flake8 checkes
# make tests -- run all of the tests
# make clean -- clean distutils
#
########################################################
# variable section

NAME = "ansible-eos"

PYTHON=python
BUILDER=build_modules.py

VERSION := $(shell cat VERSION)

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

all: clean flake8 build tests

flake8:
flake8 --ignore=E265,E302,E303,F401,F403 library/ test/ common/

clean:
@echo "Cleaning up byte compiled python stuff"
find . -type f -regex ".*\.py[co]$$" -delete

tests: clean
nosetests -v

build:
$(PYTHON) $(BUILDER)


1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0.0
56 changes: 56 additions & 0 deletions build_modules.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/usr/bin/python
#
# Copyright (c) 2015, Arista Networks, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# Neither the name of Arista Networks nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ARISTA NETWORKS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER 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.
#
import glob
import re

common = open('common/eos.py').read()

start_re = re.compile(r'#<<EOS_COMMON_MODULE_START>>', re.M)
stop_re = re.compile(r'#<<EOS_COMMON_MODULE_END>>', re.M)

def main():
for name in glob.glob('library/*.py'):
if not name.startswith('library/__') and name.endswith('.py'):
print 'processing', name
mod = open(name).read()

start = start_re.search(mod, re.M)
stop = stop_re.search(mod, re.M)

with open(name, 'w') as f:
f.write(mod[:start.start()])
f.write(common)
f.write(mod[stop.end():])

if __name__ == '__main__':
main()
Loading

0 comments on commit e4e202c

Please sign in to comment.