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.
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.
The guest speakers in this module include:
When you automate, you do want to make sure that you are not automating bugs and mistakes too, thereby making them spread across your environment. That is why you want to have a proper testing pipeline in place! In his presentation, Gabriele Gerbino will give you some practical examples on how to build a simple testing pipeline by using Travis-CI and VMs/containers to make sure that you can sleep better once you hit the DEPLOY red button.
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.
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.
- Learn how to test and debug your Ansible playbooks;
- Set up continuous integration pipeline;
- Find the Ansible actions you need to check data validity, assert conditions, or fail playbooks.
More to explore
You should also listen to these Software Gone Wild episodes (each one is ~1 hour long):
- Test-Driven Network Development with Michael Kashin
- Distributed On-Demand Network Testing with Matt Oswalt
Finally, here's a list of interesting blog posts and other resources: