Page tree

Versions Compared


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


We don't enforce the use of a specific IDE, but rather, a set of guidelines that can be configured in an IDE. The examples in this section are on IntelliJ. 

Code Formatting

The formatting followed by the project are:

  • Indentation using four spaces
  • no No trailing whitespaces, including in empty lines
  • spaces Spaces after keywords such as if, for, while, and casts

The whitespace formatting, among other code styling, is enforced via Checkstyle, which is run against the code during each Maven build. The build will fail if formatting violations are found.


Testing a distributed platform like ONOS can become a cumbersome task. ONOS, being an SDN controller authored in Java, can run on a variety of platforms. However, in the interest of focus, the ONOS team project engages primarily in testing on Ubuntu server distributions, specifically Ubuntu Server 14.04* LTS 64-bit, using the the Oracle Java 8 JRE.

Additionally, in order to simplify testing and to make it more repeatable, a number of assets have been developed to make the developer’s  and tester’s lives easier. These are located under the ONOS_ROOT/tools/test/.


An ONOS developer's environment may include the following:

  • Development/build machine
  • One or more test deployment VMs
  • A Mininet VM

Test Cells

The notion of a test cell refers to a specific controller cluster environment designated for testing. This can mean a set of bare-metal servers, or a set of virtual machines running on developer’s laptop. Cell definition files are essentially bash snippets that define export a few environment variables into the developer’s (or tester’s) shell. These variables are then used by a number of the ONOS test and utility scripts and recipes. This allows the scripts and test scenarios to be independent of to a specific test bench setup.

Using cells

Cell definitions are loaded into the shell environment with the cell utility. This utility takes the name of a cell definition file as the argument. For example:

Code Block
$ cell local                                              

Now, utilities such as onos will fall back to using the value set in OCI ( for above) if not given any parameters. 

The utility script cells can be used to view all available cell definitions. Without parameters, cell will list the values associated with the current cell in use.

Cell Definition Files

A cell definition file defines values for a set of environment variables understood by the ONOS scripts. A cell definition file may look like the following:

Code Block
# Default ONOS Controller VM instances 1,2,3 and a Mininet VM
export OC1=""
export OC2=""
export OC3=""
export OCN=""  # Mininet VM
# for node clustering
export ONOS_NIC=”192.168.56.*”    

# ONOS features to load
export ONOS_FEATURES="webconsole,onos-api,onos-core-trivial,onos-cli"

ONOS ships with several cell definitions, with the default being the local definition. Available cells, along with their descriptions, may be listed with the cells utility:

Code Block
$ cells
 cbench # Local VirtualBox-based single ONOS instance & ONOS mininet box
 local * # Local VirtualBox-based ONOS instances 1,2 & ONOS mininet box
 office # ProxMox-based cell of ONOS instance; no mininet-box
 prox # ProxMox-based cell of ONOS instances 1,2 & ONOS mininet box
 single # Local VirtualBox-based single ONOS instance & ONOS mininet box
 single_optical # Local VirtualBox-based single ONOS instance & ONOS mininet box
 triple # Local VirtualBox-based ONOS instances 1,2,3 & ONOS mininet box


  • OC1, 2, and 3 : IP addresses of the VMs hosting ONOS instances
  • OCN : IP address of the VM used to emulate a network with Mininet
  • ONOS_NIC : The address block used amongst ONOS instances for inter-controller (clustering) and OpenFlow communication 
  • ONOS_FEATURES : a comma-separated list of bundle names, loaded at startup by an ONOS instance within this cell

These files are located in ONOS_ROOT/tools/test/cells/. Custom cell definition files may be added to this directory and loaded as needed with cell.