Page tree

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.

In this tutorial, you will learn how to set up and ONOS environment capable of controlling P4Runtime-enabled Tofino-based devices. The following set of instructions have been tested with the EdgeCore Wedge-100BF.

Table of Contents


  • 1 or more Tofino based switches with Barefoot SDE 6.0.0 or later installed
  • 1 server with the latest ONOS master downloaded. the version has to be 1.12-SNAPSHOT or later.

Prepare the switch

With the SDE and all necessary tools installed the switch process can be started.


It's worth noting the configuration file (skip_p4.conf). This configuration option makes switchd start with no P4 program deployed. The program will be later deployed by ONOS using P4Runtime.  Please also note that the skip_p4.conf file will only be installed if the SDE is built & installed with the p4_examples. Otherwise, this file can be found in the p4_examples tarball in the SDE package with the name

Create a pipeconf for your P4 program

In ONOS we use the term pipeconf (short of pipeline configuration) to describe the ensemble of P4 compiler artifacts and ONOS driver for a specific P4 program. A pipeconf is the entity that allows ONOS to deploy and control a given P4 program. A pipeconf is defined as an ONOS application that can be loaded at runtime. Example of pipeconfs can be found under onos/pipelines/.

We suggest starting by looking at the basic pipeconf. This one provides basic forwarding capabilities along with packet-in/out support, counters, etc. Among others, this pipeconf defines two important classes, an interpreter implementation, and a pipeconf loader.


The interpreter is what enables ONOS to understand the specific constructs of your P4 Program. For example, the Interpreter enables the translation from ONOS traffic treatments to P4-defined actions.

The interpreter implementation for the basic pipeconf can be found here

Pipeconf loader

This class is usually defined as an OSGi runtime component and is used to register the pipeconf at runtime. As part of this operation, this class is responsible for putting together all the pieces of a pipeconf, such as:


Looking at the pipeconf loader implementation, you can see we can also add driver behaviors specific to that P4 program/pipeline, such as the Pipeliner and the PortStatisticsDiscovery. We also need to set a pipeconf ID, which has to be globally unique as it will be used to refer to that pipeconf in the netcfg JSON later.


Moving to the ONOS controller on the server, assuming you downloaded it and placed your pipeconf in it.


  • org.onosproject.generaldeviceprovider (General Device Provider)

  • org.onosproject.drivers (Default Drivers)

  • org.onosproject.protocols.grpc (gRPC Protocol Subsystem)

  • org.onosproject.protocols.p4runtime (P4Runtime Protocol Subsystem)

  • org.onosproject.p4runtime (P4Runtime Provider)

  • org.onosproject.drivers.p4runtime (P4Runtime Drivers)

  • (Barefoot Drivers)

  • your own pipeconf app.

Build and push a configuration json

Having all the needed components in ONOS in place we can now tell ONOS about the device(s) and let the interaction begin.


Code Block
bf-sde> pm> show> port-add 1/0 100G NONE> port-enb 1/0


At this point if everything went well you should be able to push flow rules defined with PiCriterion and PiInstruction according to the P4 program deployed on the device.