Validation, Error Handling and Unit Tests

From Building Network Automation Solutions

At a Glance

  • High-intensity interactive online course;
  • Jump-start your network automation career;
  • Hands-on experience working on a solution to your own problem;
  • 9 module course spread across ~3 months;
  • Live discussion and guest speaker sessions;
  • Design and coding assignments and group work;
  • Final course completion certificate.

GIGO (Garbage-In-Garbage-Out) is one of the major sources of automation failures. A good automation solution should always validate the input data before starting automation tasks. It should also check the actual device state before making changes to the device configuration unless you’ve fully automated the configuration deployments.

This module describes various approaches to data validation and error handling. We’ll also focus on unit tests - simple tests that verify the correctness of your code, and stress-test it using as many invalid inputs as possible - and figure out how to automate them as part of your deployment process.

Hands-on Exercises

In the hands-on part of this section you’ll add data validation and error handling to the configuration-generation playbook you created during the previous module, and create unit tests to test your new code with a variety of invalid inputs.

Guest speakers

The guest speakers in this module include:

Spring 2018

In a prequel to the Spring 2018 course on February 6th, David Barroso explained how you can use NAPALM to validate whether the actual state of a network device meets its desired state.

More about David Barroso

Spring and Autumn 2017

In March 2017 Pete Lumbis explained how you can use the software concept of automated testing to bring a faster rate of change with a greater degree of success. He described the tools required to make automated testing a reality, and how automated testing can be easily folded into a team-wide change management system.

The attendees of spring 2017 session wanted to get more details about the Continuous Integration pipeline Pete Lumbis set up with GitLab and Vagrant, and he agreed to come back and do a deep dive into CI with GitLab in autumn 2017 course.

More about Pete Lumbis

Self-study materials

With the help of materials in this module (hint: use self-paced guidance) you'll:

More to explore

If you haven't read the Validating deployments with NAPALM blog post, please do it now. There's also a corresponding section in the Ansible course.

You should also listen to these Software Gone Wild episodes (each one is ~1 hour long):

Finally, here's a list of interesting blog posts and other resources:

Useful tools:

Recordings of live sessions

Continuous Integration and Continuous Delivery (CI/CD) Basics (January 2017)

Continuous Integration with GitLab (October 2017)

Debugging, Logging, Testing and Error Handling in Ansible Playbooks (January 2017)

Q&A: Validation and Testing