Skip to content

Playbooks

Mark Sibering edited this page Dec 9, 2020 · 1 revision

Task files in the roles are split into small files imported int the main.yml file. This allows for easy maintenance.

As soon as a change is made by Ansible on a device, an Ansible handler is triggered for that host, which entails that additional tasks are run for that host. These tasks are located in the handlers folder under the role directory. Normal conditions for the execution of handlers in Ansible apply.

When a handler is triggered, three things can happen:

  • A Behave test scenario is started for that host. These scenarios can be found under the files/features folder in the role directory. A files/steps folder contains the actual tests expressed in Python. The tests use Ansible ad-hoc commands to retrieve state from the device.
  • A native Ansible test or assertion
  • A PyATS test is run

The NetCICD container has a recent version of PyATS included.

The reachability information required for the ansible ad-hoc commands to run the tests is retrieved from the Ansible hosts file. The tests need to run without user interaction. This requires the server to login based on password-less certificates. If that is not possible, the tests wil fail (the Behave test framework will respond with "Assertion failed").

The templates are located in the templates directory and are expressed in Jinja2 format.

Tasks for a role are imported in main.yml in the tasks directory and import the tasks per subject from the tasks directory.

Role specific variables are located in the vars directory under the role.

Roles

NetCICD uses the following roles:

  • box
  • topology
  • reachability (IGP)
  • forwarding (P)
  • platform (PE)
  • user-domain

box

Box contains:

  • hostname
  • banners
  • timezone
  • clock (timezone, ntp)
  • hardening (disabling unused services)
  • Loopback0 (incl tftp source)
  • ssh
  • snmp
  • logging
  • AAA

The vars directory under the role contains skeleton vars files per stage. This allows to have a different number of log/snmp/aaa servers for each test stage.

topology

Currently supports configuring Ethernet based interfaces, bundles and subinterfaces. Testing is done with ping.

The vars directory under the role contains skeleton vars files per stage. This allows to have a different topology for each test stage.

Clone this wiki locally