Skip to content

Getting Started

Jurij Nota edited this page Sep 10, 2021 · 14 revisions

Clone this repository into your machine

If you have already installed the requirements and 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 and simple_switch_grpc).
  • P4C is a reference compiler for the P4 programming language that 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.

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. Take a look at this installation script and make sure you use the same commits.

Since the installation process can be a bit tedious and cumbersome, please check out the P4-Utils installation guide. Indeed, since P4-Learning is simply a compilation of examples and exercises for P4-Utils, their software requirements are the same. You can choose among different ways of installing the P4-Tools suite (including P4-Learning and P4-Utils): you can use a VM or an installation script.