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;
- 6 week course spread across ~2 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 section will describe 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 Week 4, and create unit tests to test your new code with a variety of invalid inputs.
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.
Previous guest speakers
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.
- Start with the Continuous Integration and Continuous Delivery presentation by Pete Lumbis.
- Learn how to test and debug your Ansible playbooks in the Validation, Error Handling and Unit Tests section of Januar 2017 course.
- You'll find the Ansible actions you need to check data validity, assert conditions, or fail playbooks in the Advanced Ansible Topics parts of the Ansible for Networking Engineers online course.
More to explore
If you haven't read the Validating deployments with NAPALM blog post, please do it now.
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:
Recording of the January 2017 session
Continuous Integration and Continuous Delivery (CI/CD) Basics
- Network CI-CD (PDF)
- Change Management Today and Tomorrow
- Continuous Integration with GitLab
- NetDevOps Toolbox