Page tree

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added steps for demo applications


ONOS 1.6 comes with 2 demo applications that use a P4 data plane. These applications provide an example of how to program BMv2 with a specific P4 program and how to control it to provide different load balancing schemes, namely Equal-Cost Multi-Path (ECMP) via ecmp.p4 and Weighted-Cost Multi-Path (WCMP) via wcmp.p4. These applications can be found under apps/bmv2-demo. We also provide a python script to run a Mininet topology to test these 2 applications.

This section is still work in progress

  1. Start the Mininet demo script. In the Mininet VM shell type:

    Code Block
    $ cd ~/onos/tools/test/topos/
    $ sudo -E python

    This command will start a topology as the one depicted above along with a 3-node ONOS cluster.

  2. Make sure to activate the BMv2 drivers and deactivate any forwarding applications such as ReactiveForwarding. In the ONOS CLI, type

    Code Block
    onos> app activate org.onosproject.drivers.bmv2
    onos> app deactivate org.onosproject.fwd
  3. Activate the ECMP fabric app. In the ONOS CLI type:

    Code Block
    onos> app activate org.onosproject.bmv2-ecmp-fabric

    This app will program the data plane (i.e. set the BMv2 JSON configuration) with ecmp.p4 and install the necessary flow rules to provide connectivity between hosts. To check that there is connectivity, use the pingall command in the Mininet shell. If ping fails for some or all hosts, check the ONOS log for any error.

  4. Start multiple traffic flows between any 2 hosts. We recommend using iperf or iperf3. If you have iperf3 installed in your Mininet VM, the script will automatically start a iperf3 server on each host. In this case, to start iperf3 client traffic from h1 to h3, in the Mininet shell type:

    Code Block
    mininet> h1 iperf3 -c h3 -b200k -P100 -t1000 | grep SUM

    This will start 100 TCP flows from h1 to h3, each one capped at 200kbps, for 1000 seconds, showing a summary of traffic sent for each second.

  5. On the ONOS web GUI, activate the port stats traffic overlay by pressing the key ‘q’. You should be able to see the effect of ECMP with all flow being equally distributed (depending on the hash of each flow) among the 4 leaf-spine links.
  6. While traffic is flowing, you can “hot-swap” the ECMP app with the one using WCMP. This will re-program the data plane with wcmp.p4, update flow rules and deactivate the ECMP app. On the ONOS CLI type:

    Code Block
    onos> app activate org.onosproject.bmv2-wcmp-fabric
    titleModify flow rule poll frequency

    To reduce the down time due to the BMv2 JSON configuration swap and flow rule update, we suggest adjusting the flow rule polling frequency to 5 seconds. In the ONOS CLI type:

    Code Block
    onos> cfg set fallbackFlowPollFrequency 5
  7. To see the effects of WCMP, repeat step 5.

Known Issues

  • When running a cluster with multiple instances of ONOS, a stack overflow Java exception will be thrown by Bmv2TableEntryService. This is due to a known bug of the Kryo serializer. This issue has been already fixed and is available in the latest master and onos-1.6 branch.
  • The current Bmv2FlowRuleTranslator implementation is able to translate only a few types of criterions (IN_PORT, ETH_SRC, ETH_DST, ETH_TYPE) to BMv2 match keys of only ternary type. Seeking community help to implement translation for other criterion types and to other BMv2 match types (exact, LPM, valid, etc.). Get in touch if interested.