Have questions? Stuck? Please check our FAQ for some common questions and answers.

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 125 Next »

Mininet is a lightweight container orchestration system for network emulation. With Mininet and onos.py, you can easily start up an ONOS cluster, and a modeled data network for any topology you might like, in a single VM or server. This is usually the most convenient way to create an ONOS development environment on your laptop, and you can be up and running in a matter of minutes (or seconds if you have already built ONOS and have already installed Mininet!)

Why use onos.py and Mininet?

If you are already running 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.

Additionally, onos.py models the control network as well as the data network; you can easily change the number of nodes in your ONOS cluster, as well as things like the delay or bandwidth between nodes in the control network. It's even possible to change the control network topology as well as the data network topology. (We hope to make this more convenient and powerful in the future.)

onos.py provides a single CLI prompt where you can enter both Mininet and ONOS commands - this can be very convenient!

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.

Getting Mininet

In order to use onos.py, you need Mininet. It's easy to install Mininet from source in an Ubuntu VM or server:

git clone http://github.com/mininet/mininet
mininet/util/install.sh -nv

You can also download a pre-built Mininet VM.

If you are running Ubuntu 16.04, you can easily install Mininet 2.2 using apt-get:

apt-get install mininet

Running ONOS using onos.py and Mininet

Give your VM enough memory for ONOS!

ONOS java processes tend to use a huge amount of memory. In order to run an ONOS cluster in a single VM, you should allocate a large amount of RAM to that VM. We recommend at least 4 GB for each ONOS node that you intend to run. You can see how much memory and CPU ONOS's java processes are using by running top - if you start using swap space, the performance of ONOS and Mininet will suffer greatly!

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 customized mininet CLI prompt:

mininet-onos>

At this point, you can enter mininet commands like pingall (all-to-all ping test) and help (find out about Mininet CLI commands.)

You can also enter ONOS commands like onos:apps or onos:balance-masters and they should be invoked via karaf's client command on onos1.

You can also invoke the ONOS client using the onos command - press control-D to exit.

To exit Mininet, use the exit command or press control-D.

Pay close attention to error messages!

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. Also check out the troubleshooting section below.

Questions and Answers

What do those mn command line options do?

--custom onos.py: uses onos.py to extend Mininet with new controller and switch types as well as a customized CLI

--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

What software switch does this use?

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.

How can I use the user switch (or CPqD switch if I have it installed?)

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.

How can I get more information on Mininet, the mn command, writing Mininet scripts, etc.?

There are lots of things you can do with Mininet, including customizing your data network topology, setting link parameters, etc..

For more information on Mininet, please check out http://docs.mininet.org

How can I specify the apps for ONOS to load?

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().

How is the IP address range/subnet of the ONOS cluster specified?

--controller onos and ONOSCluster() take an ipBase option; the default is 192.168.123.0/24

You can change it by passing in a new option to mn or to ONOSCluster():

sudo mn --custom onos.py --controller onos,3,ipBase=172.1.2.0/24 --topo tree,3,3

How can I connect to the ONOS console from the mininet-onos> prompt?

mininet-onos> onos

press control-D to return to the mininet-onos> prompt.

How can I run ONOS/karaf CLI commands from the mininet-onos> prompt?

There are several ways of doing it - you can use the one which works best for you. Here are four equivalent ways of invoking the onos:apps command:

mininet-onos> onos:apps
mininet-onos> onos :apps
mininet-onos> onos onos:apps
mininet-onos> onos1 client onos:apps

The first two methods can be used for executing any commands that begin with "onos:".

The last two methods can be used to execute any karaf command.

The final method can be used to run client on a specific ONOS instance (and connect to that instance.)

How can I connect to the ONOS console from a shell/bash prompt?

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  

How can I connect to the karaf console using ssh?

ssh -p 8101 karaf@192.168.123.1

In this example, 8101 is the karaf port, and 192.168.123.1 is the IP address of onos1.

Note that this is using ssh inside the Mininet VM itself - from another machine, you should use the VM's IP address and the appropriate forwarded port as described below.

How can I connect to the ONOS GUI if ONOS is running in a Mininet host inside a VM?

By default, onos.py automatically forwards connections to the Mininet VM/server to the appropriate ONOS instance.

ServiceVM port to connect to
GUI/REST8181 (onos1), 8182 (onos2) ...
Karaf/ssh8101 (onos1), 8102 (onos2) ...
OpenFlow6653 (onos1), 6654 (onos2) ...

So if you are using a VM whose IP address is 192.168.x.y, to connect to the GUI on ONOS1, you would use the URL http://192.168.x.y:8181/onos/ui/

Use the correct IP address!

You need to use the real, correct IP address for your VM - the address 192.168.x.y is obviously not a real IP address!

  • No labels