Skip to content

Commit

Permalink
Merge pull request #348 from arista-eosplus/release-1.5
Browse files Browse the repository at this point in the history
Release 1.5
  • Loading branch information
jerearista authored May 9, 2017
2 parents 29ce127 + d3ed978 commit d0185f4
Show file tree
Hide file tree
Showing 27 changed files with 667 additions and 34 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ nosetests.xml

# OSX crud
.DS_STORE
.DS_Store

# Sphinx crud
_build
Expand All @@ -49,3 +50,6 @@ _templates
*.spec
rpm/rpmbuild
rpm/rpms

# virtualenv
venv
14 changes: 13 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
include README.md INSTALL.md VERSION
include requirements.txt
include Makefile
include LICENSE
include .pylintrc
include *.md
recursive-include docs *
prune docs/_build
prune docs/.DS_Store
recursive-include actions *
recursive-include plugins *
recursive-include client *
recursive-include conf *
include Makefile
recursive-include rpm *.spec
recursive-include rpm Makefile
recursive-include test *.md
recursive-include test *.py
recursive-include test *.yml
include test/client/*
recursive-include utils *
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4.1
1.5.0
17 changes: 17 additions & 0 deletions actions/install_image
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ def main(attributes):
Attributes:
url: path to source image file
version: EOS version of new image file
downgrade: Boolean - Should EOS images be downgraded to match?
(Default: True)
Special_attributes:
NODE: API object - see documentation for details
Expand All @@ -59,6 +61,7 @@ def main(attributes):
attributes:
url: files/images/vEOS.swi
version: 4.13.5F
downgrade: true
name: "validate image"
onstart: "Starting to install image"
onsuccess: "SUCCESS: 4.13.5F installed"
Expand All @@ -72,14 +75,28 @@ def main(attributes):
if not url:
raise Exception('Missing attribute(\'url\')')

downgrade = attributes.get('downgrade', True)

version = attributes.get('version')
if not version:
raise Exception('Missing attribute(\'version\')')

# Return if version matches
current_version = node.api_enable_cmds(['show version'])[0]['version']
if current_version == version:
node.log_msg('install_image: nothing to do: '
'already running the configured version')
return

# Don't downgrade images if flag is set
if downgrade is not True:
from pkg_resources import parse_version
if parse_version(version) < parse_version(current_version):
node.log_msg('install_image: nothing to do: '
'downgrade disabled')
return

# In all other cases, copy the image
image = 'EOS-%s.swi' % version
try:
node.retrieve_url(url, '%s/%s' % (node.flash(), image))
Expand Down
2 changes: 2 additions & 0 deletions client/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,8 @@ class Server(object):
payload=None, files=None):
if headers is None:
headers = {}
# Disable gzip, deflate so we can safely determine if space is available
headers[u'Accept-Encoding'] = None
if files is None:
files = []

Expand Down
2 changes: 1 addition & 1 deletion docs/ReleaseNotes1.4.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Enhancements
- Plugin infrastructure for resource pool allocation (`121 <https://github.com/arista-eosplus/ztpserver/issues/121>`_)

Bug fixes
^^^^^^^^
^^^^^^^^^

* Starting ZTPServer fails because ``pkg_resources.DistributionNotFound: mock`` (`318 <https://github.com/arista-eosplus/ztpserver/issues/318>`_)

Expand Down
29 changes: 29 additions & 0 deletions docs/ReleaseNotes1.5.0.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Release 1.5
-----------

New Modules
^^^^^^^^^^^


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

* Booststrap client - use unix:sockets by default on images with support (`344 <https://github.com/arista-eosplus/ztpserver/pull/344>`_) [`jerearista <https://github.com/jerearista>`_]
.. comment
* Action install_image - support for disabling downgrade (`343 <https://github.com/arista-eosplus/ztpserver/pull/343>`_) [`jerearista <https://github.com/jerearista>`_]
.. comment
* Resolve file download issues - disable gzip, deflate in HTTP requests (`342 <https://github.com/arista-eosplus/ztpserver/pull/342>`_) [`jerearista <https://github.com/jerearista>`_]
.. comment
Fixed
^^^^^

* Fix "resource file missing" error on validate (`339 <https://github.com/arista-eosplus/ztpserver/issues/339>`_) [`urvishpanchal <https://github.com/urvishpanchal>`_]
.. comment
* Docs - Fix setup.py install paths when on ReadTheDocs (`328 <https://github.com/arista-eosplus/ztpserver/pull/328>`_) [`jerearista <https://github.com/jerearista>`_]
.. comment
Known Caveats
^^^^^^^^^^^^^


Binary file added docs/_static/arista_logo_11-trans-w.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
# of the sidebar.
#html_logo = None
#html_logo = '_static/AristaLogo.png'
html_logo = '_static/arista_logo_jpg-11.jpg'
html_logo = '_static/arista_logo_11-trans-w.png'

# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
Expand Down
2 changes: 2 additions & 0 deletions docs/cookbook.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ ZTPServer Cookbook
cookbook/actions
cookbook/resourcePools
cookbook/advanced
cookbook/puppet
cookbook/ansible
cookbook/ztpsVMonEOS
65 changes: 65 additions & 0 deletions docs/cookbook/actions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,71 @@ script.
Install a Specific EOS Image without downgrading newer systems
--------------------------------------------------------------

Objective
^^^^^^^^^

I want a specific (v)EOS version to be automatically installed when I provision
my node but I don't want systems with newer EOS versions to be downgraded

.. note:: This assumes that you've already downloaded the desired (v)EOS image
from `Arista <https://www.arista.com/en/support/software-download>`_.

Solution
^^^^^^^^

Let's create a place on the ZTPServer to host some SWIs:

.. code-block:: console
# Go to your data_root - by default it's /usr/share/ztpserver
admin@ztpserver:~# cd /usr/share/ztpserver
# Create an images directory
admin@ztpserver:~# mkdir -p files/images
# SCP your SWI into the images directory, name it whatever you like
admin@ztpserver:~# scp admin@otherhost:/tmp/vEOS.swi files/images/vEOS_4.14.5F.swi
Now let's create a definition that performs the ``install_image`` action:

.. code-block:: console
# Go to your data_root - by default it's /usr/share/ztpserver
admin@ztpserver:~# cd /usr/share/ztpserver
# Create a definition file
admin@ztpserver:~# vi definitions/tor-definition
Add the following lines to your definition, changing values where needed. Specifically note the ``downgrade: false`` attribute.

.. code-block:: yaml
---
name: static node definition
actions:
-
action: install_image
attributes:
downgrade: false
url: files/images/vEOS_4.17.1F.swi
version: 4.17.1F
name: "Install 4.17.1F"
.. note:: The definition uses YAML syntax

Explanation
^^^^^^^^^^^

The difference between this recipe and the one, above, is setting the ``downgrade`` attribute to ``false``. When downgrades are disabled, an image will only be copied if the running image is older than the image in the ZTP configuration.

.. end of Install a specific EOS image
Install an Extension
--------------------

Expand Down
33 changes: 27 additions & 6 deletions docs/cookbook/advanced.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Advanced
.. contents:: :local:
:depth: 1

Configuration Management and ZTR
--------------------------------
Configuration Management and prep for ZTR
-----------------------------------------

Objective
^^^^^^^^^
Expand Down Expand Up @@ -80,10 +80,31 @@ Copy and paste the option text into a new template in:
! For serial number, non-default VRF:
action bash export SERIAL=`FastCli -p 15 -c 'show ver' | grep Serial | tr -s ' ' | cut -d ' ' -f 3 | tr -d '\r'`; sudo ip netns exec ns-$vrf_name curl http://$ztpserver:$port/nodes/$SERIAL/startup-config -H "content-type: text/plain" --data-binary @/mnt/flash/startup-config -X PUT
Zero-touch replatement (ZTR)
----------------------------

Explanation
^^^^^^^^^^^
Objective
^^^^^^^^^

I replaced a switch with a new one and want it to provision with the same
configuration and, optionally, EOS version as the node it replaced.

Solution
^^^^^^^^

ZTPServer first looks for a pre-existing definition for a node in the
``<configdir>/nodes/<node-id>`` directory before trying to match through neighbordb, etc.
Thus, you can make ZTPServer think it has already seen this node by
renaming, linking or copying the old-node's directory to the new-node's
unique-id before powering the switch on for the first time.

Moving (renaming) or linking are most commonly used, however, making a
recursive copy will ensure that the last-known configuration of the previous
node remains stored as a backup.

.. code-block:: console
(add explanation here)
cd /usr/share/ztpserver/nodes
ln -s <old-node_id> <new-node_id>
.. End of <RECIPE TITLE>
.. End of ZTR
Loading

0 comments on commit d0185f4

Please sign in to comment.