Welcome to the SIGCOMM 2019 P4 Tutorial! We've prepared a few exercises to help you refine your P4 programming skills. These exercises are organized into two sections:
- Introduction and Language Basics
- Stateful Packet Processing
A P4 cheat sheet as well as introductory P4 language slides are available in PDF format in the same directory as this README file.
We will use a virtual machine to run the exercises listed above. We ask that you please try to install the VM before arriving at the tutorial. We do not want to spend too much time setting up everyone's environment because we prefer to spend the time helping you to learn P4 :)
The current configuration of the VM is 2 GB of RAM and 2 CPUs. These are the recommended minimum system requirements to complete the exercises. When imported, the VM takes approximately 8 GB of disk space. For the best experience, we recommend running the VM on a host system that has at least twice as many resources.
To install the VM, you have two options (1) directly download the VM image and import it into your virtualization software, or (2) build the VM yourself.
- Install VirtualBox
- If you are outside China download the image from here
- If you are inside China dowload the image from here
MD5 (P4 Tutorial 2019-08-15.ova) = 3dd7a6e5f0df7a5b9a94b695d1111b81
- See here for instructions on how to import the image.
- Install VirtualBox
- Install Vagrant
- Clone this repository onto your laptop and run
vagrant up
:
$ git clone -b sigcomm19 --single-branch https://github.com/p4lang/tutorials
$ cd tutorials/vm
$ vagrant up
- Log in with username
p4
and passwordp4
and issue the commandsudo shutdown -r now
- When the machine reboots, you should have a graphical desktop machine with the required software pre-installed.
Note: Before running the vagrant up
command, make sure you have enabled virtualization in your environment; otherwise you may get a "VT-x is disabled in the BIOS for both all CPU modes" error. Check this for enabling it in virtualbox and/or BIOS for different system configurations.
You will need the script to execute to completion before you can see the p4
login on your virtual machine's GUI. In some cases, the vagrant up
command brings up only the default vagrant
login with the password vagrant
. Dependencies may or may not have been installed for you to proceed with running P4 programs. Please refer the existing issues to help fix your problem or create a new one if your specific problem isn't addressed there.
If you do arrive at the tutorial and have not yet installed the VM, the instructors will have some USB sticks with a copy of the image. Please ask an instructor for one of these USB sticks so you can copy the image onto your laptop. Please return the USB to the instructor after you have copied the image. We do not have enough for everyone.
If you need to increase the size of the xterm terminal created by mininet
, enter the following commands into your terminal:
$ echo "XTerm*faceName: BitStream Vera Sans Mono" >> ~/.Xresources
$ echo "XTerm*faceSize: 16" >> ~/.Xresources
$ xrdb -merge ~/.Xresources