Tutorials To Get Started

Some hands-on introductions to the P4 Language, where the reader is introduced to P4 using popular applications such as a firewall and In-band Telemetry. Every tutorial comes with step-by-step instructions. The topics covered include:

  • Basic applications in P4
  • Advanced structures in P4
  • Augmenting P4 with C

Building a Custom Tunnel with P4

By David George

The goal of this tutorial is the implement a custom tunnel protocol in P4.  We will show how to define a header, augment parsing rules to parse the header, create actions to add XLAN headers, modify table rules to invoke actions, run and debug.

Wire Net-Host - NIC in a Nutshell

By Johann Tönsing

A hands-on tutorial lab implementing a wire (a NIC) connecting network and host and the host back to the network.  The NIC seems small but it is the first step you need in order for the processor to be able to run P4 and C in the middle. It’s simply a matter of writing code on the NIC to make it more intelligent.

Building a Custom Action with a C Sandbox in P4

By Edwin Peer

This hands-on lab will augment P4 processing with custom C actions.  The work is going to utilize the primitive actions construct that will achieve an action call back that we can process C code on.

Telemetry and VNFs

By Edwin Peer

A core strength of P4 is its ability to define new data plane protocols. This lab demonstrates how this capability is leveraged to implement In-band Network Telemetry (INT) for transparently capturing latency statistics for any TCP based packet forwarding Virtual Network Function (VNF). Learn how to declaratively define a new TCP option to store ingress timestamp metadata within packets destined to the VNF, while maintaining L4 checksums within the Agilio SmartNIC. An example mock-up of the VNF hosted in a virtual machine allows participants to inspect and verify that the incoming traffic comprises valid TCP packets containing the optional INT header extension. This INT header is later extracted by the P4 pipeline at egress before being removed so that pristine packets are sent on to the attached network. Extending the P4 pipeline capabilities with C code that calculates and logs the desired latency statistics is also shown.