Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Reverted from v. 13
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 in your home directoryinside the ONOS+P4 Dev VM:

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" : []
     }
}

In segment routing config:

  • Name: Name name for segment routing device;

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

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

  • routerMac: Globally unique Mac address. It mac address this mac address will be used to reply ARP requests request 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:

Code Block
titleInterface config
"Device-id/port-number" : {
    "interfaces" : [
        {
            "name": "interface name",
            "ips" : [ "10.0.1.254/24" ],
            "vlan-untagged": 10
        }
    ]
}

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 the IPs of the interfaces as the IP from interface as 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

...