In this lesson, you will learn:

  • What is Batfish?
  • The use-case that this integration can be applied to.
  • A code walkthrough of the integration.

You can find the scripts and code for this lesson within the Pytest repo under the directory: 005_integrations/003_batfish.

Integration Overview

We will now cover integrating Pytest with Batfish. First of all:

What is Batfish?

Batfish is an open-source multi-vendor network analysis tool that allows you to validate your configuration data, query control plane state, verify ACL rule sets, analyse routing/flow paths, as well as simulating network failure.

The way that Batfish works is that you provide it with your device configurations. Batfish then builds a model of your network, which you then query to perform the necessary validation and analysis.


Key Points

Our Batfish integration will be based on the following (diagram below):

  • Our tests will be based on validating the MTU of our interfaces, along with testing for a range of routing issues such as:
    • duplicate router IDs
    • forwarding loops
    • unestablished BGP sessions
    • OSPF and BGP configuration issues.
  • Where possible Batfish assertions will be used. Batfish assertions take some of the heavy lifting out of building Batfish queries and also expose the DataFrame details clearly at the point of a failed assertion.
  • For any tests not using Batfish assertions, AssertError will be raised to clearly expose the Batfish DataFrame details within the Pytest traceback output. Further details on this point are below.
Ready to Master Network Automation? Start Your Journey Today!
Our membership provides:
  • Full deep-dive course library (inc. Batfish, pyATS, Netmiko)
  • Code repositories inc. full course code, scripts and examples
  • 24x7 multi-vendor labs (Arista, Cisco, Juniper)
  • Private online community
  • Live monthly tech sessions
  • Access to tech session library

Join Now ➜
Close You've successfully subscribed to Packet Coders.
Close Success! Your account is fully activated, you now have access to all content.
Close Welcome back! You've successfully signed in.
Close Nearly there! To activate your account, please click the link in the email we just sent you.