Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added building ONOS via bazel

This page needs update to reflect building ONOS with Bazel!

YouTube Video

Overview

In this brief screencast, we will demonstrate how to check-out the ONOS codebase and how to build it. We will also show you how to tailor your shell environment to get access to a number of shell tools, aliases and other conveniences that aim to make working with ONOS very easy.

...

After saving the changes, we will source-in our new profile and we are now ready to build and package ONOS.

Building ONOS via Buck (OLD)

ONOS is built with Buck, which is a build tool developed by Facebook and which supports highly parallel and incremental builds. To build ONOS, we simply need to run the buck build onos command as follows. Please note that presently, ONOS is built using a custom version of Buck that contains a number of enhancements that will be upstreamed to the official version over time. When building the code-base for the first time, the buck program and ONOS build plugins will be automatically downloaded and installed before starting the build.

...

To execute ONOS tests, simply run buck test command. Note that this will run all unit tests, integration tests as well as Checkstyle code validation. As with the build steps, Buck will only execute tests for modules impacted by code changes upstream along the dependency graph.

Building ONOS via Bazel (New)

Newer versions of ONOS are build using Bazel, note that it as far as 2020 this may only work in the ubuntu desktop versions.

Use wget to get the latest version of Bazel (you can use other versions of bazel and other informations at this link)

$ wget https://github.com/bazelbuild/bazelisk/releases/download/v1.4.0/bazelisk-linux-amd64

Install Bazel with the appropriate permissions

$ chmod +x bazelisk-linux-amd64
$ sudo mv bazelisk-linux-amd64 /usr/local/bin/bazel

Check if Bazel was installed by verifying its version
$ bazel version

Clone ONOS project using git in the home directory

$ git clone https://gerrit.onosproject.org/onos

Set ONOS root folder

$ export ONOS_ROOT=~/onos

$ source $ONOS_ROOT/tools/dev/bash_profile

Move to ONOS main folder using ONOS_ROOT

$ cd $ONOS_ROOT

Use Bazel to build ONOS

$ bazel build onos


Running ONOS Locally

ONOS has been architected to run in a distributed configuration where multiple instances cooperate as a single cluster. However, there are times during the development when using a single ONOS instance is perfectly sufficient. This includes development of southbound providers, CLI, REST API and GUI among others.

...