Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Info
titleUpdated Trellis+P4 tutorial material

The content of this page is for users who already have some experience with ONOS and Trellis and wish to learn how to use those with P4 devices.

If you are getting started with ONOS and Trellis we suggest you start with the following slides and exercises:

Trellis+P4 Tutorial (Presented at ONF Connect, Dec 2018): http://bit.ly/trellis-p4-slides.


Environment:

ONOS+P4 Dev VM

Before starting, download and run the ONOS-P4 Tutorial VM:

ONOS+P4 Development VM

This page includes also a walkthrough to run ONOS with BMv2. We suggest to complete those steps to make sure the VM works properlyTo try fabric.p4 you don't need a specific Virtual Machine, but you can use the P4Runtime-enabled Mininet Docker Image (p4mn) that contains Mininet and BMv2 already compiled with P4Runtime support. This image is available on Docker Hub, we strongly suggest to use the stable branch.

Get Trellis "routing" repository

To try fabric.p4 with BMv2, you will need a custom Mininet script distributed as part of the Trellis "routing" repository:.

To clone the repository, type the following commands in a terminal window inside the ONOS+P4 Dev VMin your home directory:

Code Block
languagebash
titleClone Trellis routing repository
cd ~
git clone https://github.com/opennetworkinglab/routing/

...

In Trellis, we run every switch as router, each router needs a mac address and multiple interface configurations.

Interface config:

Code Block
titleInterface config
"Device-id/port-number" : {
    "interfaces" : [
        {
            "name": "interface name",
            "ips" : [ "10.0.1.254/24" ],
            "vlan-untagged": 10
        }
    ]
}
  • Name: Interface name, can be empty or unset;

  • ips: List of IP addresses for this interface, it can be the default gateway of the host;

  • VLAN config, it can be: vlan-untagged only, vlan-tagged only or vlan-tagged + vlan-native.

    • vlan-untagged (integer): this interface consumes untagged packet only and it belongs to a specific vlan;

    • vlan-tagged (integer array): this interface can consumes specific tagged vlans;

    • vlan-native (integer): if an untagged consumes by this port, and this is an interface with vlan-tagged setup, device will use this vlan for internal use;

Example of Segment Routing device settingsSegment routing device setting:

Code Block
titledevice config
linenumberstrue
"Device-id" : {
    "segmentrouting" : {
        "name" : "Device name",
        "ipv4NodeSid" : 123,
        "ipv4Loopback" : "192.168.0.123",
        "ipv6NodeSid" : 223,
        "ipv6Loopback" : "2000::c0a8:0223",
        "routerMac" : "00:00:00:00:01:23",
        "isEdgeRouter" : true,
        "adjacencySids" : []
     }
}

...

  • Name:

...

  • Name : name for segment routing device;

  • ipv4(6)NodeSid: global Global unique id for IP loopback, which it is used for as MPLS lable label in forwarding;

  • ipv4(6)Loopback: Router loopback IP address, it should not be part of same same subnet defined on dataplace dataplane interface;

  • routerMac: Globally unique mac address this mac address Mac address. It will be used to reply ARP request requests for router IP or interface IP;

  • isEdgeRouter: true if this device is edge/leaf, otherwise false;

  • adjacencySids: Reserved, put empty array for now

Interface config:

...

titleInterface config

...

  • .

...

In interface config:

  • Name: interface name, can be empty or unset

  • ips: IP address for this interface, can be the default gateway of the host

  • VLAN config:

  • vlan-untagged (integer): this interface consumes untagged packet only, and this interface belongs to specific vlan

  • vlan-tagged (integer array): this interface can consumes specific tagged vlans

  • vlan-native (integer): if an untagged consumes by this port, and this is an interface with vlan-tagged setup, device will use this vlan for internal use
  • vlan config can be: vlan-untagged only, vlan-tagged only or vlan-tagged + vlan-native

Topology:

Host view:

In the demo mininet Mininet topology, we set IP from interface as the IPs of the interfaces as the default gateway of the hosts.

Steps:

In this tutorial, we need to create 3 terminal window for:

  • ONOS karaf process

  • ONOS shell

  • Mininet emulator (via Docker container)

And we run everything inside the virtual machine

...