Date: Fri, 29 Mar 2024 06:51:38 +0000 (UTC) Message-ID: <904391203.1009.1711695098054@ip-10-30-146-46.us-west-2.compute.internal> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_1008_1904456538.1711695098050" ------=_Part_1008_1904456538.1711695098050 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
DEPRECATED
The content of this page is outdated. Please check the NG-SDN Tutorial f= or a reference ONOS+P4 development environment:
P4 is a programming language to define the behavior o=
f the data plane, it can be used to =
;program targets such as software switches, reconfigurable ASICs or F=
PGAs, or it can be used to formally specify the behavior of a fixed-functio=
n switch. P4Runtime is a protocol to control at runtime a P4-defined=
pipeline, for example, to install entries in a match+action table defined =
in the P4 program. This page provides steps to set up an environment to try=
ONOS with theBehavioral Model v2 (BMv2) (the reference P4 s=
oftware switch). Support for P4Runtime has been included in ONOS starting f=
rom the 1.11 (Loon) release.
This document assumes you are already familiar with ONOS, P4, P4Runti= me and BMv2. If this is not the case, here's a list= of pointers to get started:
ONOS+P4 tutorial for beginners
If this is the first time working with ONOS and/or P4, we strongly sugge= st you start from this tutorial:
For an overview of how P4 and P4Runtime are supported in ONOS, please re= fer to this presentation (ONF Connect, December 2018):
Click here to open the slides in a new window=
By using ONOS, you'll be able to program and control a network comp= rising P4Runtime-enabled devices with all the benefits of a logically centr= alized SDN platform. The following features are currently supported:
Device discovery
P4 pipeline provisioning (at device connect= ion)
Controller packet-in and packet-out
Counter reads
We have created a special VM with all you need to test P4Runtime support= in ONOS.
You can use the following link to download an Open Virtual Appliance (OV= A) package to be imported using VirtualBox or any other x86 virtualization = system that supports this format.
Click here to download the ONOS+P4 Develop= er VM (approx. 2.5 GB) (last updated 2019-05-16)
Alternatively, you can use these instructions to build a VM locally using Vagrant.
VM login credentials
The VM comes with one user with sudo privileges. Use these credentials t= o log in:
Username: sdn
Password: rocks
The VM is based on Ubuntu 18.04 (cloud image) and contains the following= software pre-installed:
The VM is configured with 4 GB of RAM and 2 CPU cores, while the disk ha= s size of approx. 8 GB. For a flawless experience, we recommend running the= VM on a host system that has at least the double of resources.
These are the recommended minimum requirements to be able to run a Minin= et network with 1-10 BMv2 devices controlled by 1 ONOS instance. To emulate= larger networks with multiple instances of ONOS (for example using onos.py), we recommend configuring the VM t= o use at least 4 CPU cores.
The VM comes with two network interfaces: a NATed interface that provide=
s access to internet (eth0
), and a host-only one (eth1=
code>). Once you are able to access the VM, use
ifconfig
(or y=
our command of choice) to get the IP address of the host-only interface. Yo=
u will need that later to SSH or access the ONOS GUI from your host system.=
Alternatively, if your host system supp=
orts zeroconf networking via mDNS (e.g. Bonjour in OS X, or Avahi=
in Linux) then you can use the hostname onos-p4-dev.local to access the VM. F=
or example, to SSH into the =
VM's guest system:
$ ssh s= dn@onos-p4-dev.local
Important
Interface naming inside the VM is not guaranteed, please use your linux/n=
etworking/VirtualBox skills to figure out which interface is the host-only =
one. It should be the one named eth1
, but that's not guar=
anteed. Similarly, make sure that VirtualBox is configured correctly such t=
hat the host-only interface can ping your host system.
Important 2
VirtualBox shared folders are not mounted on startup on Ubuntu 18.04= even if "auto-mount" flag is set. To fix it
$ sudo = systemctl edit --full vboxadd-service
and remove systemd-timesync.service
from the
This walkthrough demonstrates the necessary steps and commands to run a = network of BMv2 devices in Mininet, controlled by ONOS using P4Runtime.
In this example, the BMv2 devices will be configured with a sample P4 pr=
ogram that is provided by ONOS, named basic.p4
.=
If not differently specified, the following commands have to be exec= uted in a terminal shell of the VM.
Build ONOS master
$ cd ~/= onos $ git pull origin master $ bazel build onos
Run ONOS
$ expor= t ONOS_APPS=3Ddrivers.bmv2,proxyarp,lldpprovider,hostprovider,fwd $ bazel run onos-local -- clean
The variable ONOS_APPS
indicates which ONOS appl=
ications to execute at ONOS boot. The list includes the BMv2 drivers (based=
on P4Runtime), the Proxy ARP application, the LLDP Link Provider, the Host=
Location Provider, and the Reactive Forwarding application. These applicat=
ions combined together provide ONOS with capabilities to discover the topol=
ogy (via injection of LLDP packets), the hosts (by intercepting and handlin=
g ARP requests) and to provide basic point-to-point connectivity.
=
p>
On a second terminal shell, access the ONOS command li= ne:
$ onos = localhost
Check that all applications have been loaded successfully. On the ONOS command line, type:
onos>= ; apps -s -a
You should see an output similar to this (depending on your startu= p apps defined in $ONOS_APPS)
|
Start Mininet. On third VM terminal shell, typ= e:
$ sudo = -E mn --custom $BMV2_MN_PY --switch onosbmv2 --controller remote
This will run a simple Mininet topology with 2 hosts connected to =
a BMv2 switch, to use a different topology please refer to the Mininet guide. The -E argument in sudo ensures that all environment variables are export=
ed to the root user. $BMV2_MN_PY is used to point to the location=
of the Mininet custom file bmv2.py provided in ONOS. If successful, the outpu=
t of the previous command should be similar to this:
*** Creating network *** Starting CLI: |
bmv2.py custom Mininet script
When using the bmv2.py custom Mininet script, files related to the execu=
tion of the BMv2 switch are stored under /
tmp. The name of the=
se files depends on the switch name used in Mininet, e.g. s1, s2, etc. Exam=
ple of these files are:
bmv2-s1-
grpc-port
: contains the port used by t=
he P4Runtime server executed by the BMv2 simple_switch_grpc instance named =
's1'bmv2-s1-log
: contains the BMv2 logbmv2-s1-=
code>netcfg
.json
: netcfg blob pushed to ONOS to discover the s=
witch
bm-* commands
The VM comes with a number command aliases to aid in the debugging of BM= v2 when executed as part of Mininet. These commands all take one parameter,= the switch name used in Mininet, e.g. s1, s2, etc.
Command | Description |
---|---|
bm-log |
Shows a live scrolling view of the given BMv2 sw= itch instance log |
bm-cli |
Access the BMv2 CLI, useful to dump table entrie=
s, etc. WARNING: this CLI uses the BMv2 Thrift-base= d APIs which capabilities overlap wit= h P4Runtime (e.g. a table management is provided by both). For this reason,= there could be inconsistency issues when using both APIs to write state to= the switch. For example, if one tries to insert a table entry using Thrift= , the same cannot be read using P4Runtime. In general, to avoid such issues= , we suggest using this CLI only to read state, or to write state that is n= ot managed by P4Runtime. |
bm-dbg |
Starts the BMv2 debugger |
bm-nmsg |
Start the BMv2 nanomsg event logger client |
Check that the BMv2 switch has successfully connected to ONO= S. On the ONOS command line, check the output of the following com= mand.
|
From the output, we can see that the BMv2 switch is connected (driver=3Dbmv2:org.onosproject.pipelines.basic=
span>
) and on the protocol used to control the switch (p=
rotocol=3D[p4runtime]
).
Check that the 2 hosts can ping each other. On the =
Mininet command line, use the pingall
command check =
the output:
mininet= > pingall *** Ping: testing ping reachability h1 -> h2 h2 -> h1 *** Results: 0% dropped (2/2 received)
Since P4Runtime is a work-in-progress effort, we frequently update ONOS = to support the most recent capabilities. Similarly, we update the version o= f the P4 tools (BMv2, P4Runtime, and p4c) in the VM. Use the following comm= ands to update ONOS and the P4 tools to the latest version:
$ cd ~/= onos/ $ git pull origin master $ onos-setup-p4-dev
The onos-setup-p4-dev
command will download and build th=
e most recent version of the P4 tools. In case of errors, please remove any=
build artifact from previous executions:
$ rm -r= f ~/p4tools $ onos-setup-p4-dev