Package: pybatfish
Got questions, feedback, or feature requests? Join our community onSlack!PybatfishPybatfish is a Python client forBatfish.What is Batfish?Batfish is a network validation tool that provides correctness guarantees for security, reliability, and compliance by analyzing the configuration of network devices. It builds complete models of network behavior from device configurations and finds violations of network policies (built-in, user-defined, and best-practices).A primary use case for Batfish is to validate configuration changesbeforedeployment (though it can be used to validate deployed configurations as well). Pre-deployment validation is a critical gap in existing network automation workflows. By  Batfish in automation workflows, network engineers can close this gap and ensure that only correct changes are deployed.Batfish does NOT require direct access to network devices.The core analysis requires only the configuration of network devices. This analysis may be enhanced using additional information from the network such as:BGP routes received from external peersTopology information represented by LLDP/CDPSeewww.batfish.orgfor technical information on how it works.What kinds of correctness checks does Batfish support?TheBatfish YouTube channel(which you can subscribe to for new content) illustrates many types of checks. These checks span a range of network behaviors and device configuration attributes.Configuration ComplianceFlag undefined-but-referenced or defined-but-unreferenced structures (e.g., ACLs, route maps)Configuration settings for MTUs, AAA, NTP, logging, etc. match templatesDevices can only be accessed using SSHv2 and password is not nullReliabilityEnd-to-end reachability is not impacted for any flow after any single-link or single-device failureCertain services (e.g., DNS) are globally reachableSecuritySensitive services can be reached only from specific subnets or devicesPaths between endpoints are as expected (e.g., traverse a firewall, have at least 2 way ECMP, etc...)Change AnalysisEnd-to-end reachability is identical across the current and a planned configurationPlanned ACL or firewall changes are provably correct and causes no collateral damage for other trafficTwo configurations, potentially from different vendors, are functionally equivalentHow do I get started?If you haven't already installed Batfish, follow the instructions listed in thebatfish github repositoryto do so.Install PybatfishWe highly recommend that you install Pybatfish in a Python 3 virtual environment. Details on how to set one up can be foundhere. Once your virtual environment is setup and activated, upgrade pip and then install pybatfish.python3 -m pip install --upgrade pip
python3 -m pip install --upgrade pybatfishNow, you are ready to evaluate your own network with Batfish. We encourage you to use Jupyter notebooks as your starting point, but you can use other methods that you are a comfortable with, e.g., an IDE like PyCharm or an interactive Python shell. If you choose to use Jupyter notebooks as your starting point, you need to install Jupyter in your virtual environment. Jupyter documentation can be foundhere- but the commands below will get you going.python3 -m pip install jupyter
jupyter notebookOur notebooks provide a quick start guide for different use cases. Beyond that, the complete documentation is available onreadthedocs.Pybatfish documentationComplete documentation of pybatfish APIs ishere.