Have questions? Stuck? Please check our FAQ for some common questions and answers.

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

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

Requirements

  • 1 or more Tofino based switches
  • 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.

Start switchd
bf_switchd --install-dir $SDE_INSTALL --conf-file /root/dummy.conf --skip-p4

It's worth noting the --skip.p4 option that makes the switchd start with no P4 program deployed. The program will be later deployed through a specific call from ONOS.

Create a Pipeconf for your P4 program. 


Run ONOS and bring a Pipeconf

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

Run ONOS

You need to run it:

Start ONOS
$ buck run onos-local -- clean debug

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

Login into the ONOS CLI

Having Started ONOS we need to login in it's CLI.


onos localhost

Start the Pipeconf

Having Started ONOS we need to start the pipeconf.

Start ONOS
onos> app activate <pipeconf_app_name>

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

Start the Barefoot driver

Having Started ONOS we need to start the toxin drivers.

Activate Drivers
onos> app activate org.onosproject.drivers.barefoot

This command brings in all the needed applications to interact with the switch.

Verify the active applications

please type

apps -s -a

and verify that these app at least are active in your ONOS environment:

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

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 device, it's ports and the pipeconf we want to deploy.

{
  "devices": {
    "device:<name>": {
      "generalprovider": {
        "p4runtime": {
          "ip": "<ip>",
          "port": "<port>",
          "deviceId": <id_of_device>
        }
      },
      "piPipeconf": {
        "piPipeconfId": "<name of your pipeconf>"
      },
      "ports": {
        <ports of 
      },
      "basic": {
        "name": "<freindly_name>",
        "latitude": 41,
        "driver": "tofino",
        "longitude": -107
      }
    }

A working example is in $ONOS_ROOT/tools/test/topos/tofino-demo-simple.json. Change the IP both in the DeviceId at the top and in the devices array. The port number by default on gRPC is 50051, so unless you made any changes to that leave it as is. 
Please not that you need to add the driver as "tofino" and the the piPipeconfId as the name of you pipeconf.

 Upload the configuration you just wrote to the instance of ONOS you are running:

$ curl -X POST -H "content-type:application/json" http://localhost:8181/onos/v1/network/configuration -d @<path_to_your_json_configuration_file> --user onos:rocks

or 

<your_machine>~$ onos-netcfg localhost <path_to_your_json_configuration_file>

Check if the device is present in ONOS:

onos> devices

Configure ports on the device

The last step to perform is to configure the ports on the switch.

Please repeat the following command for all the ports that you need on your device. This needs to be done after having pushed the pipeline config. 

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

Use

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

  • No labels