Versions Compared

Key

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

...

Code Block
languagebash
titleOther dependencies
git
zip
curl
unzip # CentOS installations only
python # Version 2.7 is required

ONOS is built with BuckBazel, an open-source build tool created by Facebook and inspired developed by Google. It is also in use by number of well-known projects, including all Facebook’s mobile apps, Gerrit, etcBy relying on explicit dependencies between targets and SHA hashes of files (rather than on timestamps), Buck Bazel avoids unnecessary work by recognizing whether or not a target artifact requires a rebuild. This also helps to increase reproducibility of builds.

...

ONOS currently uses a modified version of Buck, which has been packaged with ONOS. Please use this version until our changes have been upstreamed and released as part of an official Buck release. 

...

titleRedHat installations

...

.

...

sudo ln -s /usr/bin/sha1sum /usr/bin/shasum

To get the source code and build ONOS, all you need to do it run the following commands from Unix-like terminal (e.g. Linux, MacOS):

Code Block
languagebash
titleDownload ONOS code & Build ONOS
git clone https://gerrit.onosproject.org/onos
cd onos
export ONOS_ROOT=$(pwd)
source $ONOS_ROOT/tools/dev/bash_profile
tools/bazel build/onos-buck build onos --show-output onos		# or use 'op' alias

This will compile all source code assemble the installable onos.tar.gz, which is located in the buckbazel-out bin directory. Note the --show-output option, which can be omitted, will display the path to this file.

To run ONOS locally on the development machine, simply run the following command:

Code Block
languagebash
titleRun ONOS
tools/build/onos-buckbazel run onos-local -- clean debug  # or use 'ok' alias
# 'clean' to delete all previous running status;
# 'debug' to enable Remoteremote Debug functiondebugging

The above command will create a local installation from the onos.tar.gz file (re-building it if necessary) and will start the ONOS server in the background. In the foreground, it will display a continuous view of the ONOS (Apache Karaf) log file. Options following the double-dash (–) are passed through to the ONOS Apache Karaf and can be omitted. Here, the clean option forces a clean installation of ONOS and the debug option means that the default debug port 5005 will be available for attaching a remote debugger.

...

To execute ONOS unit tests, including code Checkstyle validation, run the following command:


Code Block
languagebash
titleRun unit tests for ONOS
tools/build/onos-buck testbazel query '\''tests(//...)'\'' | xargs bazel test		# or use 'ot' alias


If you want to import the project into IntelliJ, you can generate the hierarchical module structure via the following command:please install the Bazel plugin and then import the project using File → Import Bazel Project... option.


To get access to a number of aliases (such as those mentioned above) and in general to make your development environment setup more conveniently for ONOS development, please put the following two lines in your ~/.bash_profile or ~/.bash_aliases


Code Block
languagebash
export ONOS_ROOT=~/onos
source $ONOS_ROOT/tools/build/onos-buck project

...

dev/bash_profile

The above should be enough to get you started. If you like more detailed instructions for importing the ONOS project into an IDE or contributing your changes back to the ONOS project, please consult the Development Environment Setup section.