Mininet is a container orchestration system for network emulation. With Mininet and onos.py
, you can easily start up an ONOS cluster in a single VM.
Getting Mininet
In order to use onos.py
, you need Mininet. It's easy to install Mininet in an Ubuntu VM or server using apt-get
:
apt-get install mininet
or from source:
git clone http://github.com/mininet/mininet
mininet/util/install.sh -nfv
You can also download a pre-built Mininet VM.
onos.py
and MininetIf you are using Mininet in a VM or on a physical server, it is easy to use onos.py
to start up a complete emulated ONOS network, including ONOS cluster, modeled control network, and data network.
This simplifies development on a laptop, because you can run a single development VM (or no VM at all if you are running on a Linux machine!) Moreover, it is more efficient than a multi-VM setup because the entire emulated network lives in a single VM and shares a single Linux kernel.
Chances are you're already using Mininet, so it's nice to be able to start an ONOS cluster using Mininet itself without installing or configuring additional software.
Note: This is work in progress - if you wish to try it now, you will need to get onos.py from the following patch: https://gerrit.onosproject.org/#/c/9143/ |
First, make sure that you have built ONOS in your Mininet VM or server using buck
:
cd ~/onos
buck build onos
Next, use Mininet and onos.py
to start up a virtual ONOS cluster and data network:
cd ~/onos/tools/dev/mininet
sudo mn --custom onos.py --controller onos,3 --topo torus,4,4
You should see a bunch of output showing the startup of the control network and the data network.
After ONOS starts up and the switches connect, you should see the mininet CLI prompt:
mininet>
At this point, you can enter mininet commands like pingall
(all-to-all ping test) and help
(find out about Mininet CLI commands.)
To exit Mininet, use the exit command or press control-D
.
If things don't start up correctly, look carefully at any error messages or exceptions which may have been generated - usually they give you important information which will enable you to figure out what is going wrong and to fix the issue. |
mn
command line options do?--custom onos.py
: uses onos.py
to extend Mininet with new controller and switch types
--controller onos,3
: tells Mininet to start up an ONOS controller cluster with 3 ONOS nodes
--topo torus,4,4
: tells Mininet to use a 4x4 torus topology for the data network
By default, it uses Open vSwitch. onos.py replaces the default
switch with a new switch class called ONOSOVSSwitch
or --switch onosovs
. This switch class knows how to connect to an ONOS cluster with multiple IP addresses.
In order to select the user switch (either Stanford reference switch or CPqD switch, depending on which one you have installed), you can use --switch onosuser
.
mn
command, writing Mininet scripts, etc.?For more information on Mininet, please check out http://docs.mininet.org
For now, try using ONOS_APPS
or connecting to the karaf
console and using ONOS CLI commands. As root:
ONOS_APPS=drivers,openflow,fwd,proxyarp,mobility mn --custom onos.py --controller onos,3 --topo tree,3,3
or (with sudo
):
sudo env ONOS_APPS=drivers,openflow,fwd,proxyarp,mobility mn --custom onos.py --controller onos,3 --topo tree,3,3
or
ONOS_APPS=drivers,openflow,fwd,proxyarp,mobility sudo -E mn --custom onos.py --controller onos,3 --topo tree,3,3
Note that sudo
clears environment variables by default, but the ONOS_APPS
environment variable must be set in order for mn
to read it.
In the future, there should be an option to --controller onos
and/or ONOSCluster()
.
ONOSCluster
takes an ipBase
option; default is 192.168.123.0/24
Make sure karaf's bin
directory is in your path, then:
client -h 192.168.123.1 # or the address of the ONOS node you wish to connect to
ssh
?ssh -p 8101 karaf@192.168.123.1
One way is to use ssh port forwarding, e.g.
ssh -L 8101:192.168.123.1:8101 mininet-vm
Then open up http://localhost:8101/onos/ui/ in your browser.
Another way is to run a browser such as Firefox or Chromium in your development VM or server.
firefox &
We hope to make it easier and more automatic in the future.
tail -f /tmp/onos1/log
onos-service
log file (which usually doesn't contain much of anything unless there are errors starting karaf) for onos1? tail -f /tmp/onos1/onos.log
ssh
into the ONOS cluster?Not directly with this version of onos.py
, since the nodes are not running ssh
by default. However, if you have a Mininet source tree, you can attach to it using mininet/util/m
:
~/mininet/util/mn 192.168.123.1
onos-*
scripts from tools/test/bin with this environment?Not currently, but you should not need to use them for the most part.
onos.py
doesn't work - what should I do?Here are some things you can try:
more /tmp/onos1/log; more /tmp/onos1/onos.log
sudo pkill -f karaf.jar; sudo mn -c
cd ~/onos; buck build onos
sudo mn --test pingall
Make sure that the following command works:
sudo mnexec -n ifconfig -a
It should show a single loopback interface and no other interfaces.