Versions Compared

Key

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

This section section covers development and test environment setup and configuration. 

Table of Contents
maxLevel3

IDE Setup

We don't The project does not enforce the use of a specific IDE, but rather, a set of guidelines that can be configured in an IDE. As such, developers should consult the documentation for the IDE of choice for specific configuration steps. 

The examples used here, if any, are either for Eclipse and IntelliJ.

Importing ONOS Source

If your IDE supports the importing of projects, ONOS should be imported as a Maven project

In Eclipse, this amounts to:

  1. navigate to File > Import > Maven > Existing Maven Projects and 
  2. selecting the root directory of your source. 

 

Info

As ONOS is a multi-module project, it may appear as many (about 50 at the time of this writing) projects beginning with "onos-". This is normal for some IDEs such as Eclipse.

For a listing of the software modules that comprise ONOS, please refer to the [Javadocs], or Appendix C of this Guide.

Code Formatting

The formatting followed by the project are:

...

First make sure that you have the Copyright plugin enabled. Then, under Preferences, select Copyright section and create a new Copyright profile, call it something like Apache 2, and prime it with the text above, without any decorations. Then configure your copyright formatting options as shown:

...

Test Environment Setup

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 project engages primarily in testing on Ubuntu server distributions, specifically Ubuntu Server 14.04* LTS 64-bit, using the Oracle Java 8 JRE.

Additionally, in order to simplify testing and to make it more repeatable, a number of assets, including the aforementioned ONOS scripts, have been developed to make the developer’s  and tester’s lives easier. These are located under the ONOS_ROOT onos/tools/test/, and Appendix A of this Guide provides a listing of available utilities.

Overview

An ONOS developer's environment may include the following:

  • Development/build machine : for actual code development e.g. running the IDE and building/packaging/deploying ONOS. 
  • One or more test deployment VMs : for running ONOS instances
  • A Mininet VM : for emulating networks to test with ONOS

In the above case, the ONOS scripts are run from the development machine, and are directed towards VMs running on a hypervisor (which can also be on the same machine, or elsewhere). Since a developer may want to test different scenarios against different sets of VMs or servers, ONOS provides the notion of test cells

Test Cells

The notion of a 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 VMs running on developer’s laptop. Cell definition files are bash snippets that 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. This allows the scripts and test scenarios to be independent to a specific test bench setup.

...

Code Block
languagetext
$ cell local                                              
ONOS_CELL=local
OCI=192.168.56.101
OC1=192.168.56.101
OC2=192.168.56.102
OCN=192.168.56.103
ONOS_FEATURES=webconsole,onos-api,onos-core,onos-cli,onos-openflow,onos-gui,onos-rest,onos-app-fwd,onos-app-proxyarp,onos-app-tvue
ONOS_NIC=192.168.56.*

cell echoes back with the key variables:

  • OCI : the default target node IP. This is an alias for OC1. 
  • OC[1-3] : IP addresses of the VMs hosting ONOS instances. More OC instances may be set, if necessary.
  • OCN : IP address of the VM with Mininet
  • ONOS_FEATURES : a comma-separated list of bundle names, loaded at startup by an ONOS instance within this cell
  • ONOS_NIC : The address block used amongst ONOS instances for inter-controller (clustering) and OpenFlow communication 

Once a cell definition is exportedNow, utilities such as onos will fall back to using the value set in OCI (192.168.56.101 for above) if not given any parameters. 

...

Code Block
languagetext
# Default ONOS Controller VM instances 1,2,3 and a Mininet VM
export OC1="192.168.56.101"
export OC2="192.168.56.102"
export OC3="192.168.56.104"
export OCN="192.168.56.103"  # 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"

...

These files are located in ONOS_ROOT/tools/test/cells/.

Creating custom cell definitions

Custom cell definition files may be added to ONOS_ROOT/tools/test/cells/, which enables them to this directory and loaded as needed with cell.be loaded and listed with cell and cells.

Git/Gerrit Setup

Developers planning to contribute code should configure git with their username and email.

Code Block
languagetext
git config --global user.name "firstname lastname"
git config --global user.email "email@domain.com"

To streamline the code review process, it is highly recommended that contributors set up git-review, which integrates code submission with git. Refer to this link for instructions for setting up git-review.

Java and Maven

If not set during the Java installation process, The JAVA_HOME environment variable should be set to the JRE installation location for Java 8. The process varies with platform.

On OS X : 

export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)