Giter Club home page Giter Club logo

metha's Introduction

Metha: Automated Testing of Network Analyzers

Installation

Docker Installation

  • Install GNS3 by following the install instructions appropriate for your system
  • Plug in router images in the GNS3 folder of your installation, on Linux, by default this is the directory ~/GNS3/images
  • Run docker_setup.sh to generate the necessary docker images.
  • Run the GNS3 server, by default this can be done by simply running gns3server in a terminal
  • Then run run_batfish.sh if you want to run tests using Batfish. This uses the batfish docker image, it can later be resumed by using docker start batfish.
  • Finally, run run_docker.sh to run the Metha docker image. By default, this will mount this directory into ~/metha inside the docker image for easy access to files there. This docker container can be resumed by running docker start metha-system after the initial generation.

Manual Installation

  • Install GNS3 by following the install instructions appropriate for your system
  • Plug in router images in the GNS3 folder of your installation
  • There are some scripts available for the installation of the following programs in the scripts folder. However, all prerequisites need to be installed first.
  • Install PICT
  • Install Batfish
  • Install NV
  • Install the NV fork of Batfish
  • Install C-BPG
  • Finally clone ntc-templates, and, if you did not clone it to ~, set the following environment variable:
export NET_TEXTFSM=/path/to/ntc-templates/templates/
  • Clone this git repository and run
pip install -r requirements.txt
  • Finally adjust config.json to point to your manually installed files

Setup to run Metha:

  • Systems to be tested needs to be properly installed
  • To test Batfish, additionally the Batfish server needs to be up and running. This can be done by running scripts/run_batfish.sh.
  • The GNS3 Server needs to be properly installed and running
    • The router image used should be installed to the GNS3 image directory. By default, Metha supports the Cisco c7200-adventerprisek9-mz.124-24.T8.image image and Juniper VMX which requires junos-vmx-x86-64-18.2R1.9.qcow2, vmxhdd.img, metadata-usb-re.img, and vFPC-20180605.img to be installed in GNS3, i.e. to be placed in the images directory of GNS3.
    • Password protection of the GNS3 server needs to be disabled

Running full Metha

To generate new test cases, run

python3 metha.py -p path run -s system

where path is the directory where the new test cases will be saved to after generation, and system is the system which is being tested, by default the supported systems are batfish, nv, cbgp. The GNS3 server needs to be running, by default Metha expects a local GNS3 server. In addition, to test Batfish the Batfish server also needs to be running locally. This will generate a results directory on the same level as path. In this directory, a summary of results will be saved as well as reports for any discrepancies found. In the folder passed by path, Metha will generate a subdirectory for every test case which includes all configurations as well as the computed routing tables in csv format.

Running a single comparison:

Both the Batfish and GNS3 Servers must be running locally, then run

python3 metha.py -p path single-test -s system

where path is a directory containing at least a folder config of configs used for the routers, plus possibly a topology file (can be generated as well). If C-BGP is used, additionally there must also be a file called cbgp_config.txt in the folder at path.

Additional documentation

More detailed documentation can be found in the documentation folder in this git repository. Specifically, the following documentation files are available:

  • Command-Line-Options.md: Describes all different command-line options to running Metha, including how to run different evaluation configurations
  • Configuration.md: Describes the Metha configuration in the config.json file. This sets up a lot of base configurations such as the location of external executables.
  • Extensions.md: Describes how to extend Metha, in particular to different routers and to testing different systems.
  • Network-Configuration-Features.md: Describes how to restrict the set of configuration features used by Metha.
  • Topology.md: Describes how to define new topologies to run Metha on.

Team

Metha is a project at the ICE Center at ETH Zurich, comprising researchers from the Networked Systems Group and the Secure, Reliable, and Intelligent Systems Lab:

metha's People

Contributors

rbirkner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

metha's Issues

AttributeError: 'Cisco7200Node' object has no attribute 'telnet_connection'

I have GNS# docker running. I have the metha docker running. I have the Cisco and Juniper images listed in the READMe in the images folder.

command: python3 metha.py -p example-tests/batfish-tests/ run -s batfish

output:
Traceback (most recent call last):
File "metha.py", line 366, in
main()
File "metha.py", line 362, in main
args.func(args)
File "metha.py", line 291, in run
test_coordinator.generate_metha_tests(
File "/home/pvarkhedi/Metha/test_coordinator.py", line 203, in generate_metha_tests
generate_tests(topos, init, test_gen, get_kwargs)
File "/home/pvarkhedi/Metha/test_coordinator.py", line 144, in generate_tests
runner, features, possible_args = init(t, test_num)
File "/home/pvarkhedi/Metha/test_coordinator.py", line 201, in init
return system.init_runner(path, t, num, allowed_features)
File "/home/pvarkhedi/Metha/Systems/systems.py", line 36, in init_runner
runner = TestRunner(path, topo, self, router_features)
File "/home/pvarkhedi/Metha/test_runner.py", line 91, in init
self.gp = self.set_up_testbed()
File "/home/pvarkhedi/Metha/test_runner.py", line 109, in set_up_testbed
gp = gns3_interface.setup_gns_from_topology(f'{self.path}base_configs/topology.json')
File "/home/pvarkhedi/Metha/GNS3/gns3_interface.py", line 265, in setup_gns_from_topology
nodes[node['name']] = gp.create_node(node['name'], router_type, node['config'])
File "/home/pvarkhedi/Metha/GNS3/gns3_interface.py", line 90, in create_node
node = node_types[router_type](name, self, config)
File "/home/pvarkhedi/Metha/GNS3/Nodes/cisco7200_node.py", line 21, in init
super().init(jdata['node_id'], jdata['console'], name, 'show run', 'show ip route', 'clear ip route *')
KeyError: 'node_id'
Exception ignored in: <function NetmikoNode.del at 0x7f930803ec10>
Traceback (most recent call last):
File "/home/pvarkhedi/Metha/GNS3/Nodes/netmiko_node.py", line 26, in del
if self.telnet_connection is not None:
AttributeError: 'Cisco7200Node' object has no attribute 'telnet_connection'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.