Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
03a3096
add salt_api_wrapper.py from osr project
MatthiasGabriel Jan 25, 2017
9233964
add settings.py which uses PyYAML and a config.yaml file
MatthiasGabriel Jan 25, 2017
1873674
Change salt_api_wrapper to meet our criterias
MatthiasGabriel Jan 25, 2017
f0942a6
Add possibility to get the job result
MatthiasGabriel Jan 25, 2017
bb5d6a2
Add synchron possibiltiy to start a task
MatthiasGabriel Jan 25, 2017
a5dee86
Change runner to use the api-wrapper
MatthiasGabriel Jan 25, 2017
e028c80
Change connectivity of nuts salt-module
MatthiasGabriel Jan 25, 2017
b7ece21
Change traceroute to work with the new requirements
MatthiasGabriel Jan 25, 2017
b08133d
Refactoring traceroute
MatthiasGabriel Jan 25, 2017
3cc41b0
Remove bandwidth
MatthiasGabriel Jan 25, 2017
be586a6
Refactor dnscheck, dhcpcheck, webresponse, portresponse
MatthiasGabriel Jan 25, 2017
29961d4
Change checkuser to use napalm
MatthiasGabriel Jan 25, 2017
c857813
Change checkversion to use napalm
MatthiasGabriel Jan 25, 2017
878f20d
Set all methods that we cant implement with salt-napalm to notImpleme…
MatthiasGabriel Jan 25, 2017
1637d9e
Change interfacestatus, interfacespeed, arp to use salt-napalm
MatthiasGabriel Jan 25, 2017
68881b5
Remove devices
MatthiasGabriel Jan 25, 2017
ef64b9d
Change _extractReturn
MatthiasGabriel Jan 31, 2017
bbd42a2
Add first tests for Runner
MatthiasGabriel Jan 31, 2017
8e84608
Add more tests for Runner
MatthiasGabriel Jan 31, 2017
035cbc2
Add test for Runner.runAll
MatthiasGabriel Jan 31, 2017
208d097
Refactoring Runner to match CodeGuidelines
MatthiasGabriel Jan 31, 2017
4155c48
Add simple test for taskcreation
MatthiasGabriel Jan 31, 2017
e01c626
Change Validator-Mechanism
MatthiasGabriel Jan 31, 2017
ae0bb13
Add validation before executing a testsuite
MatthiasGabriel Jan 31, 2017
f1e1db6
Update imports
MatthiasGabriel Feb 1, 2017
3cf5b38
Change salt_api_wrapper
MatthiasGabriel Feb 23, 2017
d56cc50
Change the way how 'multiple' gets compared
MatthiasGabriel Feb 24, 2017
306e520
Add processing of resultlist to traceroute
MatthiasGabriel Feb 24, 2017
66e93b5
Change output of evaluator
MatthiasGabriel Feb 24, 2017
163958b
Added parts of async processing
MatthiasGabriel Feb 24, 2017
abb18d2
Extend the output of the runner
MatthiasGabriel Mar 2, 2017
aba8d58
Change Runner to support async aswell as sync calls
MatthiasGabriel Mar 2, 2017
0f25047
Change mockedData to match the changes of napalm_ios
MatthiasGabriel Mar 2, 2017
6a259a1
Add basic tests for async execution
MatthiasGabriel Mar 2, 2017
9513caa
Add possibility to define timeout and sleeptimer yourself
MatthiasGabriel Mar 2, 2017
7365b9f
Enforce basic naming convention
MatthiasGabriel Mar 3, 2017
99b824a
Refactoring based on PEP 8
MatthiasGabriel Mar 3, 2017
3cef24a
Add pytest config for pep8
MatthiasGabriel Mar 9, 2017
50c14d8
Change the language of the output to english
MatthiasGabriel Mar 9, 2017
cef7678
Add possibility to rerun tests
MatthiasGabriel Mar 9, 2017
46a3c37
Fix a small logic bug
MatthiasGabriel Mar 9, 2017
1513c91
Refactor code to prevent doubled negation
MatthiasGabriel Mar 9, 2017
5faf510
Add colorama for coloring on windows
MatthiasGabriel Mar 9, 2017
f3eb9e6
Change manual color coding to color coding of colorama
MatthiasGabriel Mar 9, 2017
98689eb
Codestyling
MatthiasGabriel Mar 9, 2017
983f2af
Add functionality to handle the return of multiple devices
MatthiasGabriel Mar 10, 2017
5554de4
Add additional functionality to handle multiple devices (comparison)
MatthiasGabriel Mar 10, 2017
2b7a1e9
Add new classes Evaluation and EvaluationResult for better tracking o…
MatthiasGabriel Mar 10, 2017
25035c4
Fix a small bug in the test
MatthiasGabriel Mar 10, 2017
f56181e
Refactor some classes that had class attributes
MatthiasGabriel Mar 10, 2017
67465c1
Refactor code to pass pep-8 tests
MatthiasGabriel Mar 10, 2017
66a135f
Change output to include more information when the test failed
MatthiasGabriel Mar 10, 2017
1d1c1af
Remove unused import
MatthiasGabriel Mar 10, 2017
49a5cc6
Add config file to repo
MatthiasGabriel Mar 10, 2017
18d1546
Change iteration count default and add parameter
MatthiasGabriel Mar 10, 2017
267a468
Add yml examples
MatthiasGabriel Mar 10, 2017
27a3b04
Update Readme
MatthiasGabriel Mar 10, 2017
07de3cd
Add setup.py
MatthiasGabriel Mar 10, 2017
0dbaf67
Change Readme
MatthiasGabriel Mar 16, 2017
7a902db
Change argument to be only one letter
MatthiasGabriel Mar 16, 2017
5d304e1
Change readme
MatthiasGabriel Mar 16, 2017
b5c512f
Update README.rst
MatthiasGabriel Mar 16, 2017
6ba21c8
Rename TestClass
MatthiasGabriel Mar 16, 2017
c2bd5f0
Add basic tests for Evaluation class
MatthiasGabriel Mar 16, 2017
03b3008
Change test_evaluator to use fixtures
MatthiasGabriel Mar 16, 2017
f3ba9cb
Change test_TestSuite to use fixtures
MatthiasGabriel Mar 16, 2017
192b450
Set default-value in the testcontroller
MatthiasGabriel Mar 16, 2017
4948965
Rename variable
MatthiasGabriel Mar 16, 2017
e1b0fba
Handle all output over the logging mechanism
MatthiasGabriel Mar 16, 2017
130aa4a
Reformat code to match pep8 checks
MatthiasGabriel Mar 16, 2017
71d7f04
Update README.rst
MatthiasGabriel Mar 16, 2017
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
93 changes: 72 additions & 21 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,23 +1,34 @@
Nuts - Network Unit Testing System
#############
##################################
Nuts is a network unit testing system, that automates tests in the network similar to unit tests you might know from programming.
The project uses saltstack and napalm for the communication with the network devices.
This project is currently under construction and we can't guarantee you that this code works.
If you have any question please reach out to mgabriel@hsr.ch or join https://networktocode.slack.com/

Ein Network Unit Testing System das Netzwerke automatisch Testes. Bis jetzt werden Arista, Cisco und Linux Geräte unterstützt.


Installation
============
Installation of nuts
====================

The following Python versions are fully supported:

- Python 2.7


Install on arch linux
Pre-requirements
----------------
- Salt master
Because nuts is fully based on saltstack you have to install and configure a salt master first.
For the full installation guide please visit the `installation guide <https://docs.saltstack.com/en/latest/topics/installation/>`_.
- Salt api
To use nuts you also need salt-api which enables nuts to connect to the salt master over Http. For the installation guide visit `cherrypy documentation <https://docs.saltstack.com/en/latest/ref/netapi/all/salt.netapi.rest_cherrypy.html/>`_.
- Napalm salt
To create a connection from the salt master to your network device of choice there's a fantastic library called NAPALM which got an integration into saltstack. For the installation guide head to `napalm-salt repository <https://github.com/napalm-automation/napalm-salt/>`_.

Install on arch linux
---------------------
TODO

Install on ubuntu
----------------
-----------------
TODO

Install with pip
Expand All @@ -34,6 +45,7 @@ Index <https://pypi.python.org/pypi/nuts/>`__.

Manual Installation
-------------------
TODO UPDATE

Get code::

Expand All @@ -48,27 +60,66 @@ Install::
Usage
=======

usage: nuts.py [-h] [-i INPUT INPUT] [-v VALIDATE VALIDATE] [-vt VALIDATETEST]
[-vd VALIDATEDEVICE]
usage: nuts.py [-h] [-i INPUT] [-v VALIDATE] [-m ITERATIONS]

optional arguments:
-h, --help show this help message and exit
-i INPUT INPUT, --input INPUT INPUT
Start with a Testfile and a Devicefile
-v VALIDATE VALIDATE, --validate VALIDATE VALIDATE
Creates local account
-vt VALIDATETEST, --validatetest VALIDATETEST
Creates local account
-vd VALIDATEDEVICE, --validatedevice VALIDATEDEVICE
Creates local account

-h, --help show this help message and exit
-i INPUT, --input INPUT Validates the testfile and starts the tests afterwards
-v VALIDATE, --validate VALIDATE Validates a testfile
-m ITERATIONS, --iterations ITERATIONS Defines the maximum iterations that nuts waits for a response of saltstack

Testfiles
=========
The structure of the testfile has to be compliant with the testschema found in the folder nuts/src/service/testSchema.yaml.
An example could be:

.. code:: yaml

- name: example_arp
command: arp
devices: cisco.csr.1000v
parameter: [192.168.16.128]
operator: '='
expected: '00:0C:29:EA:D1:68'

Please note that the devices attribute gets directly passed to the salt master which determines the targeted minions with so called globbing. For more information what's globbing head to `saltstack globbing <https://docs.saltstack.com/en/latest/topics/targeting/globbing.html#globbing>`_.
If multiple minions are targeted each of them has to satisify the expected value for the test to pass.

The following commands are currently available with napalm-salt if this command is available on your device is also dependent on the availability of der underlying functions of napalm:
- connectivity - checks the connectivity to a certain IP address with a simple ping. Takes the target IP address as a parameter
- traceroute - checks the connectivity to a certain IP address with a traceroute. Takes the target IP address as a parameter
- interfacestatus - checks if a specific interface is available. Takes the interface name as a parameter
- interfacespeed - checks the speed of a specific interface. Takes the interface name as a parameter
- arp - checks the mac address of a specific IP address. Takes the IP address as a parameter
- checkversion - checks the version of the device. Takes no parameter
- checkuser - checks which users are available on the device. Takes no parameter

For more information about the availability visit `napalm docs <https://napalm.readthedocs.io/en/latest/support/index.html>`_.

The following commands are currently available for debian systems:
- connectivity
- traceroute
- dnscheck
- dhcpcheck
- webresponse
- portresponse

There are the following operators available:
- =
- <
- >
- not

Examples
========
There are a few more examples of test files available in the example folder.

License
=======

The MIT License (MIT)

Copyright (c) 2016 Andreas Stalder, David Meister
Copyright (c) 2016 Andreas Stalder, David Meister, Matthias Gabriel

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Loading