Every Network engineer would have used Ixia or Spirent for traffic generation. These are generally expensive. For majority of use cases, we need a simple protocol packet generator which can generate packet streams of various protocol types. The recent trend is to move traffic generation application into a VM formfactor. This is more suitable for virtual appliance testing. I recently came across this tool called “Ostinato” from Google and I found it very useful. Even Ixia and Spirent have their traffic generators in VM form factor. I will cover my Ostinato experiences in this blog.
I installed Ostinato in my Ubuntu 14.04 and 12.04 VM. For Ubuntu 14.04, Ostinato can be installed by:
sudo apt-get install ostinato
The above installs 0.5.1 version. To install later versions(0.6) or to install Ostinato in older Linux versions, use the procedure here.
Ostinato has a client, server model where servers can be run on multiple hosts and the client can connect to multiple servers. This allows a single client to manage ports present in multiple servers.
To start both client and server:
To start only the server:
Following is a screenshot when I started Ostinato in my first host.
- Start Ostinato in first host.
- Start drone server in second host.
- From Ostinato gui in first host, do File->New port group and enter IP address of second host. We need to make sure that the versions of Ostinato is the same, I was getting some crashes when the versions of Ostinato on both the hosts were different.
Following is a screenshot after adding the new port group. Below, we see the ports from both hosts.
Ostinato supports extensive feature set that includes different protocol types, stream and rate control, packet capture, exporting/importing traffic streams. Detailed list of features can be found from Ostanito documentation.
From version 0.6, Ostinato supports scripting where all features of the GUI can be invoked from a Python script. This makes it easier to do automation. Ostinato uses Google’s protobuf to define the data, we can think of protobuf as simplified form of XML for representing data. Following link covers the main proto file that has the format of major types like prococol, stream, ports, stats etc. Every protocol(like eth, ip, icmp, igmp) has its own “*.proto” file which can be found here. We can also write our own “*.proto” file to define a new protocol type. “*.py” files gets created from “*.proto” files and they are included in the “python-ostinato” package.
sudo pip install python-ostinato export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python2.7/dist-packages/ostinato
The sample script “example.py” generates 5 IP/UDP packets, captures the incoming packets and also displays packet statistics. Server ip address, tx and rx ports are received as input from the user. The script gives a good overview of common use cases and how to call define Python Drone apis.
To run the script:
sudo drone & -> this starts server cd /usr/local/lib/python2.7/dist-packages/ostinato python example.py
I took the example script as an example and modified the script to generate icmp packets with varying packet length. I used the “icmp.proto” header format to generate icmp packet. It was very straightforward to write the new script. My sample script can be found here.
I also tried importing and exporting pcap files from Ostanito. Once we import pcap file, we can also edit in Ostinato and export back. This can serve as pcap editor as well.
Overall, I am very impressed with Ostinato. I have used packeth tool for packet generation before. I found Ostinato to be a lot better in terms of features, ease of use and scripting. Also, we cannot beat the “free” part.