Bat-Q is a Streamlit app that lets you run various network analysis queries using Batfish, an open source network configuration analysis tool. You can upload your network configuration files as snapshots and analyze different scenarios or states. You can also select from a wide range of Batfish questions to get insights into your network's behavior and security. Bat-Q displays the answers in tables and diagrams for easy interpretation.
Bat-Q is designed to be simple, interactive, and flexible. You can use it for quick network configuration checks or for network troubleshooting and optimization tasks. Bat-Q is not a replacement for pyBatfish, the Python API for Batfish, but rather a complementary tool that can help you get started with network analysis using Batfish.
To learn more about Bat-Q and how to use it, please watch these YouTube tutorials (work in progress).
No installation needed! Click the badge above to launch Bat-Q in a ready-to-use GitHub Codespace. Batfish and Streamlit start automatically; once the Codespace is ready, a browser tab will open with the app running. Use the abc_net.zip example provided to try out Bat-Q.
Version v0.2 introduces key architectural updates, interactive visualization, improved snapshot management, and enhanced user feedback:
- Improved navigation
- Interactive topology visualization
- Enhanced snapshot management
- DataFrame & schema optimization
- Report and spreadsheet generation
To use Bat-Q, you will need:
- A Batfish server capable of running Docker: See the recommended requirements for Batfish.
- A host to run the Bat-Q app.
Note that for training purposes with small networks, you can use one computer to run both Batfish and Bat-Q (a reasonable laptop will work).
To use the app, follow these steps (assuming Ubuntu Linux, but Windows also works):
-
Install Docker: There are multiple methods, but I recommend using the apt repository method.
-
To use Docker as a non-privileged user, add the user to the Docker group:
$ sudo usermod -aG docker $USER -
Install Batfish and run the Batfish services:
$ docker pull batfish/allinone $ docker run --name batfish -d --restart unless-stopped -v batfish-data:/data -p 9997:9997 -p 9996:9996 batfish/allinone
or, to run on local host:
$ docker run --name batfish -d --net host -v batfish-data:/data batfish/allinone
This is all that is needed for Bat-Q, but you can consult the Batfish installation instructions for other details.
-
Check Python version and install pip3. Bat-Q needs Python 3.11+[cite: 1, 2]:
$ python3 --version $ sudo apt-get install python3-pip
-
Clone this repository:
$ git clone https://github.com/martimy/Bat-Q $ cd Bat-Q -
Install requirements[cite: 1, 2]:
$ pip3 install -r requirements.txt
-
Set the environment variable (skip this step if Docker and Streamlit are running on the same machine):
$ export BATFISH_SERVER=<Batfish server IP address> $ echo $BATFISH_SERVER
for Windows:
Bat-Q>set BATFISH_SERVER=<Batfish server IP address>
-
Start the Streamlit app (you may need to re-login before this step)[cite: 1, 2]:
$ streamlit run Home.py
Here is how to get started using Bat-Q
Created by Maen Artimy - Personal Blog