First Steps with NUTS ===================== This tutorial guides you through a minimal setup of the NetTowel Unit Testing System (NUTS, or nuts). A showcase is included in nuts' code that allows you to learn the basic mechanics of nuts without the need for an actual network -- find those details at the end of this tutorial. Two major components are needed for nuts: #. A network inventory #. Test bundles Here's an overview of how to organize your files so that NUTS can find everything it needs. The root folder also contains the virtual environment with the :doc:`nuts installation <../installation/install>`. This example uses the Nornir SimpleInventory, but all inventory plugins are supported. .. code:: shell . # NUTS root ├── inventory # your inventory │   └── hosts.yaml # information on hosts ├── nr-config.yaml # nornir configuration └── tests # your test bundles └── test-definition-ping.yaml NOTE: If you already have an existing nornir configuration including an inventory you do not need to copy it into your NUTS test setup. Instead, you can directly refer to it `when executing the tests`__. __ customInventory_ 1. Network Inventory -------------------- You must provide information on your network configuration so that nuts can interact with it. Currently, the implemented test cases in NUTS use `nornir `__ and a config file ``nr-config.yaml`` (default) which provides the inventory. A sample ``hosts.yaml`` (Nornir SampleInventory) might look like this: .. code:: yaml R1: hostname: 10.0.0.42 platform: ios username: Cisco password: cisco interfaces: - name: GigabitEthernet2 ipv4_address: 172.16.0.42 - name: Loopback0 ipv4_address: 172.16.255.1 R2: hostname: 10.20.0.24 platform: ios username: Cisco password: cisco interfaces: - name: GigabitEthernet2 ipv4_address: 172.16.0.24 - name: Loopback0 ipv4_address: 172.16.255.2 We provide the most basic example here with sample IP addresses and credentials. Please see `nornir's documentation `__ on how to structure the inventory according to your needs. A sample ``nr-config.yaml`` might look like this: .. code:: yaml inventory: plugin: SimpleInventory options: host_file: "inventory/hosts.yaml" runner: plugin: threaded options: num_workers: 100 If you set up the above folders and files, you are ready to write test bundles. 2. Test Bundle -------------- A test bundle is a collection of tests that are logically related to each other, for example, tests that all revolve around "information on BGP neighbors". The test bundle describes which test definition should be collected and executed and provides data for those tests. The bundles are written as individual entries in a YAML file. Currently, only YAML files are supported as test bundle format, but other data sources could be integrated with later versions of nuts. Structure of a Test Bundle ************************** Each test bundle contains the following structure: .. code:: yaml - test_module: # optional test_class: label: