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.

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 Week 4, and create unit tests to test your new code with a variety of invalid inputs.

Guest speaker

Will we talk about event-driven automation or do a deep dive into Continuous Integration? You'll find out in early summer...

Previous guest speakers

Pete Lumbis will explain how you can use the software concept of automated testing to bring a faster rate of change with a greater degree of success. He'll describe the tools required to make automated testing a reality, and how automated testing can be easily folded into a team-wide change management system.

More about Pete Lumbis

Self-study materials

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):

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

Useful tools:

Recording of the January 2017 session

Continuous Integration and Continuous Delivery (CI/CD) Basics

Debugging, Logging, Testing and Error Handling in Ansible Playbooks