...
Build ONOS master
Code Block language bash $ cd ~/onos $ git pull origin master $ buck build onos
Run ONOS
Code Block language bash $ export ONOS_APPS=drivers.bmv2,proxyarp,lldpprovider,hostprovider,fwd $ buck run onos-local -- clean
The variable
ONOS_APPS
indicates which ONOS applications 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 applications combined together provide ONOS with capabilities to discover the topology (via injection of LLDP packets), the hosts (by intercepting and handling ARP requests) and to provide basic point-to-point connectivity.On a second terminal shell, access the ONOS command line:
Code Block language bash $ onos localhost
Check that all applications have been loaded successfully. On the ONOS command line, type:
Code Block language bash onos> apps -s -a
You should see an output similar to this (depending on your startup apps defined in $ONOS_APPS)
* 10 org.onosproject.drivers 1.13.0.SNAPSHOT Default Drivers
* 35 org.onosproject.generaldeviceprovider 1.13.0.SNAPSHOT General Device Provider
* 36 org.onosproject.protocols.grpc 1.13.0.SNAPSHOT gRPC Protocol Subsystem
* 37 org.onosproject.protocols.p4runtime 1.13.0.SNAPSHOT P4Runtime Protocol Subsystem
* 38 org.onosproject.p4runtime 1.13.0.SNAPSHOT P4Runtime Provider
* 39 org.onosproject.drivers.p4runtime 1.13.0.SNAPSHOT P4Runtime Drivers
* 42 org.onosproject.proxyarp 1.13.0.SNAPSHOT Proxy ARP/NDP
* 44 org.onosproject.hostprovider 1.13.0.SNAPSHOT Host Location Provider
* 45 org.onosproject.lldpprovider 1.13.0.SNAPSHOT LLDP Link Provider
* 73 org.onosproject.pipelines.basic 1.13.0.SNAPSHOT Basic Pipelines
* 119 org.onosproject.drivers.bmv2 1.13.0.SNAPSHOT BMv2 Drivers
* 146 org.onosproject.fwd 1.13.0.SNAPSHOT Reactive Forwarding
Start
Mininet. On
third
VM
terminal
shell,
type:
Code Block language bash $ 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
The
E argument-
E
argument insudo
ensures
that
all
environment
variables
are
exported
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
output
of
the
previous
command
should
be similar to
this:
*** Creating network
*** Adding controller
*** Adding hosts:
h1 h2
*** Adding switches:
s1
*** Adding links:
(h1, s1) (h2, s1)
*** Configuring hosts
h1 h2
*** Starting controller
c0
*** Starting 1 switches
s1
Starting BMv2 target: simple_switch_grpc --device-id 1 -i 1@s1-eth1 -i 2@s1-eth2 --log-console -Lwarn --thrift-port 38148 --no-p4 -- --cpu-port 255 --grpc-server-addr 0.0.0.0:37346
[1] 2370*** Starting CLI:
mininet>Check that the BMv2 switch has successfully connected to ONOS. On the ONOS command line, check the output of the following command.
onos> devices
id=device:bmv2:1, available=false, local-status=connected 9m33s ago, role=NONE, type=SWITCH, mfr=p4.org, hw=master, sw=master, serial=unknown, driver=bmv2:org.onosproject.pipelines.basic, locType=geo, name=device:bmv2:1, protocol=[p4runtime]
From the output, we can see that the BMv2 switch is connected (
available=true
), along with information on the P4 program (pipeconf) deployed (driver=bmv2:org.onosproject.pipelines.basic
) and on the protocol used to control the switch (protocol=[p4runtime]
).Check that the 2 hosts can ping each other. On the Mininet command line, use the
pingall
command check the output:Code Block language text 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 of the P4 tools (BMv2, P4Runtime, and p4c) in the VM. Use the following commands to update ONOS and the P4 tools to the latest version:
Code Block | ||
---|---|---|
| ||
$ cd ~/onos/ $ git pull origin master $ onos-setup-p4-dev |
The onosThe onos-setup-p4-dev
command will download and build the most recent version of the P4 tools. In case of errors, please remove any previsouly build artifactsbuild artifact from previous executions:
Code Block | ||
---|---|---|
| ||
$ rm -rf ~/p4tools
$ onos-setup-p4-dev |