To complete the exercises or run the sample code, you will need to either build a virtual machine or install several dependencies.
To build the virtual machine:
- Install Vagrant and VirtualBox
- Clone the repository
cd 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.*
To install dependencies by hand, please reference the vm installation scripts.
They contain the dependencies, versions, and installation procedure.
You should be able to run them directly on an Ubuntu 16.04 machine, although note that the scripts currently assume the existence of a directory /home/vagrant
:
sudo ./root-bootstrap.sh
sudo ./user-bootstrap.sh
Welcome to the P4 Tutorial! We've prepared a set of exercises to help you get started with P4 programming, organized into several modules. If you are a student from INF UFRGS you might also want to take a look at the sample code discussed in class.
- Introduction and Language Basics
- P4Runtime and the Control Plane
- Monitoring and Debugging
- Advanced Behavior
The slides are available online and in the P4_tutorial.pdf in the tutorial directory.
A P4 Cheat Sheet is also available online which contains various examples that you can refer to.