Skip to content

Batfish is a network configuration analysis tool that can find bugs and guarantee the correctness of (planned or current) network configurations. It enables network engineers to rapidly and safely evolve their network, without fear of outages or security breaches.

License

Notifications You must be signed in to change notification settings

yongzheng2024/batfish

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Install

Batfish/Minesweeper depend on the following software.

  • OpenJDK 11
  • Bazel
  • Z3
  • Pytbatfish (modified by yongzheng)

You can directly run the command ./install.sh to install these software in Ubuntu22.04 (tested) or macOS (TODO, error).

You must modified two directory pach according to your practical path.

  • /PATH-TO/batfish/.bazelrc
# Test targets are required to depend on our junit rather than using the one provided by Bazel
build --sandbox_writable_path=/home/deza/codes/batfish/smts/ \
      --action_env=SMT_DIRECTORY_PREFIX=/home/deza/codes/batfish/smts/ \
      --explicit_java_test_deps

# /home/deza/codes/batfish -> /PATH-TO/batfish
  • /PATH-TO/batfish/projects/allinone/src/test/java/org/batfish/minesweeper/smt/SmtReachabilityTest.java
/** Replace the path with your actual project path. */
Path path = Paths.get("/home/deza/codes/batfish/containers");
Batfish batfish = BatfishTestUtils.initBatfish(new TreeMap<>(), path);

// /home/deza/codes/batfish -> /PATH-TO/batfish

Test

PyBatfish usage document
PyBatfish interact with the Batfish service

Test Case 1 via Pybatfish

Open two terminals: one for running the Batfish service, and other for running a Pybatfish test case.

In the first terminal, start the Batfish service:

cd /PATH-TO/batfish
tools/bazel_run.sh

In the second terminal, run the Pybatfish test case:

cd /PATH-TO/tests/test
python3 test_routing_policies_0001.py

Test Case 2 SmtReachabilityTest

Just open one terminal, and run test case script.

cd /PATH-TO/batfish
tools/bazel_test_SmtReachabilityTest.sh

Partical Directory Structure

  • projects (source code)
  • tools (build and run scripts)
  • networks (network configuration files)
  • tests/test (test case files via pybatfish)
  • smts (smt encoding files)
  • install.sh (intall all required software dependencies)
  • .bazelversion (bazel configuration file)
  • .bazelrc (bazel configuration file)

Configure Intellij IDEA

IntelliJ IDEA configuration document

You can install plugins Bazel For Intellij and Bazel (EAP). Then import the batfish directory from file - import bazel project.

You can configure bazel command in Run/Debug configurations according to following steps (modify /PATH-TO/batfish to your root directory of batfish).

* Target expression (Java\_binary handled by Java Handler)
    - //projects/allinone:allinone\_main
* Bazel command
    - run
* Bazel flags
    - --jvmopt=-Xmx12g
    - --jvmopt=-Dlog4j2.configurationFile=tools/log4j2.yaml
    - --java\_runtime\_version=11
    - --run\_under="cd /PATH-TO/batfish &&"
* Executable flags
    - -runclient
    - false
    - -coordinatorargs
    - "-templatedirs ./questions"

About

Batfish is a network configuration analysis tool that can find bugs and guarantee the correctness of (planned or current) network configurations. It enables network engineers to rapidly and safely evolve their network, without fear of outages or security breaches.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • SMT 72.4%
  • Java 25.1%
  • ANTLR 2.1%
  • Starlark 0.2%
  • Python 0.1%
  • HCL 0.1%