Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Update to work with ONOS 2.1+ and BF SDE 8.9+

...

  • 1 or more Tofino based switches with Barefoot SDE 68.09.0 or later installed
  • 1 server with the latest ONOS master downloaded. the version has to be 1.12-SNAPSHOT version 2.1 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 makes bf_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 tofino_skip_p4.conf.in

...

Moving to the ONOS controller on the server, assuming you downloaded it are building ONOS and you placed your pipeconf in itits source tree.

Run ONOS

Code Block
languagebash
titleStart ONOS
$ buckbazel run onos-local -- clean debug

It's worth noting that this start ONOS in a single instance cluster. The command also build builds ONOS and purges any previous state. The debug option offers the possibility to attach the JVM debugger on port 5005. 

Login into the ONOS CLI

...

  • 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)

  • org.onosproject.drivers.barefoot (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.

First, we need to create a .json file containing all the needed information such as IP/port of the P4Runtime server running on the device, its data plane ports and the pipeconf we want to deploy.

Code Block
{
  "devices": {
    "device:my-tofino:1-switch": {
      "generalproviderbasic": {
        "p4runtimemanagementAddress": {
          "ip": "ip.of.the.p4runtime.server",
          "deviceKeyId": "p4runtime:device:tofino:1"grpc://10.0.0.1:28000?device_id=0",
          "portdriver": 50051,
          "deviceId": 0
        }
      }"barefoot",
      "piPipeconf": {
        "piPipeconfIdpipeconf": "my.sample.pipeconf<your-pipeconf-id>"
      },
      "ports": {
        "1/0": {
          "name": "1/0",
          "speed": 100000,
          "enabled": true,
          "number": XXX,
          "removed": false,
          "type": "copper"
        },
        "2/0": {
          "name": "2/0",
          "speed": 100000,
          "enabled": true,
          "number": XXX,
          "removed": false,
          "type": "copper"
        },
        "3/2": {
          "name": "3/0",
          "speed": 40000,
          "enabled": true,
          "number": XXX,
          "removed": false,
          "type": "copper"
        }
      },
      "basic": {
        "driver": "barefoot"
      }
    }
  }
}

In this example, we assumed the device has been configured with 3 data plane ports, for each port the "number" value corresponds to the DP value in the Barefoot SDE port manager (see section below). The port number by default for the gRPC/P4Runtime server is 5005128000, so unless you made any changes to that leave it as is.

...