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 in a single VM - including a ONOS cluster, modeled control network, and data network.

...

We also hope that using onos.py will make ONOS development easier and more fun.

Getting Mininet

In order to use onos.py, you need Mininet.

...

Option 3: You can also download a pre-built Mininet VM.

Verifying Your Mininet Installation

Make sure you are running Mininet version 2.2.1 or later:

...

If Mininet doesn't work, consult the troubleshooting section below.

Running ONOS using onos.py and Mininet

Info
titleGive your VM enough memory for ONOS!

ONOS java processes tend to consume 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 2-4 GB (or more if you have it) 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
titlePay 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

...

--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 Mininet's 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 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

...

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:

...

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

...

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.

...

Info
titleUse 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!

What are the default user name and password for the GUI?

Usually karaf/karaf (or sometimes onos/rocks)

onos.py should also respect the values of ONOS_WEB_USER and ONOS_WEB_PASS.

Can I use onos.py to control an external hardware (or virtual) network?

Yes you can! Simply use --topo none ; for example,

...

onos.py will forward the ports (e.g. 6653, 6654, 6655) appropriately as described above. Your Mininet VM or server will have to be reachable from the switches' management network, and you will need to configure your switches to connect to you ONOS nodes: the address of each node will be the VM's IP address, and the port will be the appropriate forwarded OpenFlow port.

Troubleshooting

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

Here are some things you can try:

  • Make sure you've given your VM enough RAM - try using 2-4 GB for each ONOS node (so 6-12 GB for --controller onos,3)
  • 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:

...

This should complete without errors.

Why can s1 ping onos1, but onos1 can't ping s1 (it just pings its own loopback interface?)

Currently, all of the switches are in the root namespace. If you wish to test connectivity from a switch to a controller, try pinging nat0 instead. In the future we may add support for a more complex control network with separate IP addresses for the switch management interfaces.

Why is ONOS startup so slow?

On my laptop, a 3-node ONOS cluster typically takes about a minute to start up, and a single-node ONOS cluster takes up to 20 seconds to start up.

...