Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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

Table of Contents

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.

...

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/

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:

...

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

Info

VM Configuration Note: ONOS java processes tend to use a large 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!

...

Info

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

...

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

...

In the future, there should be an option to --controller onos and/or ONOSCluster().

How are IP addresses of the ONOS cluster specified?

ONOSCluster takes an ipBase option; default is 192.168.123.0/24

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:

...

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.

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

One way is to use ssh port forwarding, e.g.

...

We hope to make it easier and more automatic in the future.

How can I look at the karaf log file for (which usually contains ONOS's log messages) for onos1?

There are many ways to do it, including:

...

The first few methods work when you are at the mininet-onos> prompt. The last one is for when you are at a shell prompt.

How can I look at the onos-service log file (which usually doesn't contain much of anything unless there are errors starting karaf) for onos1? 

mininet-onos> sh tail -f /tmp/onos1/onos.log
$ tail -f /tmp/onos1/onos.log

Can I ssh into the ONOS cluster?

Not directly with this version of onos.py, since the nodes are not running ssh by default.

...

And you can also start up a new shell (use exit or control-d to exit):

mininet-onos> onos1 bash

Can I use the onos-* scripts from tools/test/bin with this environment?

Not currently, but you should not need to use them for the most part.

Troubleshooting

onos.py doesn't work - what should I do?

Here are some things you can try:

  • Make sure you are running the latest version of Mininet (see below)
  • Look at the log file(s) and make sure no errors are occurring: more /tmp/onos1/log; more /tmp/onos1/onos.log
  • Look at the output from running mn or onos.py and carefully examine and try to understand any error or exception messages - usually they will tell you what is going wrong
  • Reset your environment using: sudo pkill -f  karaf.jar; sudo mn -c
  • Make sure you have built onos: cd ~/onos; buck build onos 
  • Make sure you can run Mininet: sudo mn --test pingall 

Mininet doesn't work - what should I do?

First, make sure you are running Mininet 2.2.1 or later:

...