Clone this repository into your machine
If you want to solve the exercises, run the examples or simply download the content get a local copy of this repository in your machine:
git clone https://github.com/nsg-ethz/p4-learning.git
We will periodically add new content to this repository (specially documentation and new examples), so make sure to check it regularly or git pull
it from your machine.
Required Software
In order to be able to compile P4 code, run it in a software switch and create virtual topologies with hosts, several dependencies and open source tools need to be installed first. In particular, the following packages (and their dependencies) need to be installed on the machine.
- PI provides an implementation framework for a P4Runtime server. It is required only for topologies involving P4Runtime switches.
-
Behavioral Model (BMv2) contains the software implementation several variations of the behavioral model (e.g.
simple_switch
andsimple_switch_grpc
). - P4C is a reference compiler for the P4 programming language and supports both P4-14 and P4-16.
- Mininet allows to create a realistic virtual network, running real kernel, switch and application code, on a single machine (VM, cloud or native).
- FRRouting is a free and open source Internet routing protocol suite for Linux and Unix platforms. It implements BGP, OSPF, RIP, IS-IS, PIM, LDP, BFD, Babel, PBR, OpenFabric and VRRP, with alpha support for EIGRP and NHRP. Router nodes in P4-Utils are based on FRRouting. It is not required for topologies without routers.
- P4-Utils is an extension to Mininet that supports P4 devices. It was strongly inspired by the original p4app from the p4lang repository.
Since the installation process can be a bit tedious and cumbersome we provide you with a Vagrant script that automatically builds a virtual machine with all required software already installed. You can find the VM setup instructions in the P4 Virtual Machine Installation document.
Important
Some exercises or examples will only work (due to bug fixes) if you use the same version of BMv2 and P4C that we provide. See the following installation script and use the samecommits
.
Virtual Machine (VM)
If you build the VM from the vagrant script we provide or directly download the OVA package you will have P4-Utils already installed, however if you already have the required software and use your own machine/VM you can manally install it:
git clone https://github.com/nsg-ethz/p4-utils.git
cd p4-utils
sudo ./install.sh
To update you just simply run:
cd /home/p4/p4-tools/p4-utils
git pull