ToMaTo - Programmable Devices

ToMaTo, Topology Management Tool

ToMaTo is topology-oriented, i.e. users build topologies for their experiments.

Devices

Connectors

Three kinds of devices

Two kinds of connectors

Programmable devices

Programmable devices run scripts written in Repy, a sandboxed Python dialect. Using these devices, networking data can be read and written as raw Ethernet packages.

Difference between Repy and Python

Script library: tomatolib

The library is part of the ToMaTo source code and located at Github. It contains the following:

Library files can be found in the lib directrory and can be included like in the C programming language

Build your final output script using these steps:

  1. Put your code in the src directory
  2. Call make in the base directory
  3. Find your output script in the build directory

Packet reading

Reading from one device

Timeout values

Reading from all devices at once

Default reading loop

Packet sending

Sending on one device

Sending on all devices

Sending and receiving (simple switch example)

Working with protocols - dissecting headers

Packets are strings

Example: IP

Packing and unpacking binary data using struct

Decoding binary data

Encoding binary data

Struct codes

See the python struct documentation for more info.

Tips & Tricks

Code sharing: Share your code with others on Github to improve the library and to get feedback.
Performance: Code that uses struct to convert binary data to numbers is a faster but the fastest code avoids convertions.
Exception handling: Wrap the per-packet code in a try-except block, otherwise the script will abort on an error.
80-20 rule: 80% of the functionality of a protocol is implemented in 20% of its code, and vice versa. Most protocols have optional features that are not needed in most cases.
Arguments: Scripts can take arguments, no need to write different scripts just to have different addresses.

Obtaining and contributing

How to get ToMaTo

ToMaTo is Open-Source! It can be simply downloaded from the Github page. There is also a step-by-step tutorial on how to setup ToMaTo in a testbed. ToMaTo includes some nice features that make it pretty easy to install it in an experimental facility:

How to contribute to ToMaTo

As an Open-Source project ToMaTo is open for hints and contributions.

/

#