This section covers development and test environment setup and configuration.
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.
The formatting followed by the project are:
- Indentation using four spaces
- no trailing whitespaces, including in empty lines
- spaces after keywords such as
while, and casts
The whitespace formatting is enforced via Checkstyle, which is run against the code during each build. The build will fail if formatting violations are found.
Prior to contributing code to ONOS, all developers should set-up their IDE to appropriately tag the code with the Apache 2 license header text. The bare text is checked in under tools/dev/header.txt, and the orginal can be found at:
Example: Copyright setup on IntelliJ
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:
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 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 have been developed to make the developer’s and tester’s lives easier. These are located under the ONOS_ROOT/tools/test/.
The notion of 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 a few environment variables into the developer’s (or tester’s) shell. These variables are then used by a number of test scripts and recipes. This allows the scripts and test scenarios to be independent of a specific test bench setup.
A cell definition file may look like the following:
ONOS ships with several cell definitions, with the default being the local definition. Available cells, along with their descriptions, may be listed with the
where the asterisk denotes the current cell definition being used. The