Contra is a language taking high-level policy as input and generating distributed switch programs which follow the path constraints and performance preference.
This repository includes all the things you need to run mininet emulation with Contra.
Note: Instead of cloning this repository, please just download the
P4-mininet-cluster/cloudLabSetup.py scripts and follow the following instructions to setup the environment with them automatically which includes the cloning of this repository.
- Use the
cloudLabSetup.pyto construct the cluster in CloudLab
- Append public keys of all nodes to each others'
csshto control all of them at once, and create the ssh key pair
ssh-keygen -t rsa
- Back to your own machine, collect all public keys (in this Readme, we assumed the nodes are named as
~/.ssh/configof your own machine)
ssh CL00 cat .ssh/id_rsa.pub >> tmp.tmp; \ ssh CL01 cat .ssh/id_rsa.pub >> tmp.tmp; \ ... ssh CL20 cat .ssh/id_rsa.pub >> tmp.tmp
- Append these public keys to all machines. On your own machine:
cat tmp.tmp | ssh CL00 "cat >> .ssh/authorized_keys"; \ cat tmp.tmp | ssh CL01 "cat >> .ssh/authorized_keys"; \ ... cat tmp.tmp | ssh CL20 "cat >> .ssh/authorized_keys"
- Copy the
P4-mininet-cluster/packages.shfile to all machine
scp packages.sh CL00: ; \ scp packages.sh CL01: ; \ ... scp packages.sh CL20:
packages.shon each machine separately (at least 10 secs away to avoid connection fail)
Build Contra compiler
Under the repo directory on each cluster node (Use
cssh to control all of them at once)
- Install Contra's dependency and compile Contra compiler:
Note: You may want to re-login to make the alias on hula command take effect
We have generated several workloads (
P4-mininet-cluster/*_Conga_*/) and converted them to the format (a bunch of shell scripts) we used in mininet scripts (
The calling of these workload scripts are currently hardcoded in the compiler codes so that the compiler will generate corresponding commands in
p4app.json to initiate traffic in mininet.
Currently, the used workload scripts are
To use different workloads for other setups, please modify the Contra compiler codes (
src/CodeGen.fs) and recompile the compiler with
Compile Policy and Topo with Contra compiler
In addition to the
topoarguments, we also have to specify
topotypein order to tell the compiler how to generate the switch/host placement in mininet cluster and the traffic commands. This
topotypeis only needed in this mininet emulation experiment. In practice, we don't need to tell the compiler anything about the type of topology. To compile policy and topo into P4 program, under the repo directory on each cluster node:
hula --policy <policy file> --topo <topo file> --topotype <ABILENE/FATTREE>
hula --policy examples/util/util.hula --topo realDataTest/xmlData/Abilene.xml.edge --topotype ABILENE --output ./P4-mininet-cluster/abilene/
The p4 programs and other necessary files (including workloads and probes applications) for bmv2 and mininet will be in
Note: All related commands in the following instructions are using the above
Compile P4 program into json for simple_switch: In
./compile-p4.sh --output ./abilene/app/
Run the Emulation
- Only on the first cluster node (CL00), change directory to
Then, the emulation is run!
Note: In case some mininet jobs were not correctly finished last time, please use the following commands to clear the environment before running
sudo mn -c sudo pkill simple_switch sudo pkill sudo # if no other sudo commands were run sudo rm /tmp/bm* sudo rm app/build/logs/*.log # in abilene sudo rm app/build/*.pcap # in abilene
Check the FCT output
The output will be on the machines which hold the end hosts (according to the host/switch placement in the
p4app.json file generated by the compiler based on the
They will have names like