Skip to main content

A Network Unit Test System

Project description

Nuts - Network Unit Testing System

.. image::
:alt: Build status

.. image::
:alt: PyPi Version

.. image::
:alt: PyPi Python Versions

.. image::
:alt: PyPi wheel

.. image::
:alt: PyPi Licence

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 to communicate with network devices. Regular Salt minions are used for Linux devices.
This project is currently under heavy construction and we can't guarantee you that this code works. But we do our best.
If you have any questions, feature request or use cases please reach out to us at or


**Vagrant Project:**

Installation of nuts

The following Python versions are supported:

- Python 2.7
- Python 3.6

- Salt master
Because nuts is fully based on saltstack you have to install and configure a salt master first.
For the full installation guide head over to the `installation guide <>`_.
- 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 <>`_.
- 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 <>`_.

Install with pip

The recommended way to install nuts is using `pip <>`_:


$ sudo pip install -U nuts

This will automatically install the latest version from the `Python Package
Index <>`__.

Manual Installation

Get code::

$ git clone
$ cd Nuts


$ sudo python install


usage: [-h] [-v] [-m ITERATIONS] [-r RETRIES] [-c CONFIG] testfile

positional arguments:
testfile Start with a Testfile

optional arguments:
-h, --help show this help message and exit
-v, --validate Validates Testfile
-m ITERATIONS, --iterations ITERATIONS Changes the number of iterations that nuts waits for a result
-r RETRIES, --retries RETRIES Set the max retries for failed tests
-c CONFIG, --config CONFIG Config file formatted as YAML. Settings will be merged with ENVVARs

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: []
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 <>`_.
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 <>`_.

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

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

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

You can use a YAML formatted configuration file and/or set environment variables
Configuration options:

config.yml example:

.. code:: yaml

NUTS_SALT_REST_API_URL: 'http://salt-master.lab:8000'

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for nuts, version 1.2.1
Filename, size File type Python version Upload date Hashes
Filename, size nuts-1.2.1-py2.py3-none-any.whl (19.8 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size nuts-1.2.1.tar.gz (16.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page