Validation, Error Handling and Unit Tests


Home » Courses » Building Network Automation Solutions » Validation, Error Handling and Unit Tests

Validation, Error Handling and Unit Tests

The fifth module of the network automation online course covers testing, debugging, error handling, and continuous integration.

Understanding Ansible

Have you completed the Ansible Deep Dive module of the Ansible for Networking Engineers online course? If haven't, please do it now, or you'll have problems understanding the material discussed in this module.

56:11 Validation, Error Handling and Unit Tests

In this section you’ll learn how to:

  • Write fail-safe playbooks
  • Recover from Ansible module failures and report them
  • Use Ansible logging and debugging tools
  • Debug individual components of your Ansible playbooks (tasks, plays or modules/plugins)
  • Build and automate unit tests
  • Validate input data and device state
Debugging, Testing and Input Data Validation 2.9M 2017-02-07
Writing Fail-Safe Playbooks 15:25 2017-02-08
Debugging, Logging and Testing 23:23 2017-02-08
Input Data Validation 17:23 2017-02-08

56:15 Network Continuous Integration

In his Network Continuous Integration presentation Pete Lumbis explained the basics of Continuous Integration and Continuous Delivery (CI/CD) concepts and demonstrated how you can use GitLab and virtual labs to test network device configurations prior to production deployment.

Network CI-CD 2.5M 2017-02-07
Change Management Today and Tomorrow 9:05 2017-02-08
Continuous Integration with GitLab 24:40 2017-02-08
NetDevOps Toolbox 22:30 2017-02-08

1:10:17 Continuous Integration with GitLab CI

GitLab CI is one of the commonly-used networking-focused continuous integration tools due to its agent-based architecture.

In this section Pete Lumbis explained how he uses GitLab CI to test his network automation scripts and device configurations.

Continuous Integration Concepts 24:03 2017-11-08
GitLab CI 22:36 2017-11-08
GitLab Demo 23:38 2017-11-08
Slide deck 837K 2017-11-04

Hands-on exercises

You’ll add data validation and error handling to the service deployment playbook you created during Week 4, and create unit tests to test your new code with a variety of invalid inputs.

Homework: Add logging, testing and validation to your solution
Submit your homework

Additional resources

Explore validation with NAPALM, test-driven development and distributed testing tools. You might also be interested in tools that make your Ansible development less error-prone.

You started this section on %started% Mark completed