This Quick Start describes a simple "local" workflow where you build and run ONOS on a single development machine.
First of all, you should install software dependencies, starting with Java. You can download, extract, and install Oracle Java 8 on most platforms.
On Ubuntu/Debian, you can do the following:
Some other dependencies are required as well. Use your package manager of choice to install these:
ONOS is built with Buck, an open-source build tool created by Facebook and inspired by Google. It is also in use by number of well-known projects, including all Facebook’s mobile apps, Gerrit, etc. By relying on explicit dependencies between targets and SHA hashes of files (rather than on timestamps), Buck 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.
Building with buck makes use of "shasum" for signatures. CentOS systems do not provide this command; but rather those for the direct algorithms. Just symlink the default algorithm (sha1sum) to the expected command:
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):
This will compile all source code assemble the installable
onos.tar.gz, which is located in the buck-out 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:
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 attach to the ONOS CLI console, run:
Once connected, you can run various ONOS CLI and Apache Karaf commands. For example, to start up OpenFlow and reactive forwarding, you could do the following:
To open your default browser on the ONOS GUI page, simply type:
or alternatively visit http://localhost:8181/onos/ui
To start up a Mininet network controlled by an ONOS instance that is already running on your development machine, you can use a command like:
Note that you should replace
<ONOS IP address> with the IP address of your development machine where ONOS is running.
To execute ONOS unit tests, including code Checkstyle validation, run the following command:
If you want to import the project into IntelliJ, you can generate the hierarchical module structure via the following command:
Then simply open the
onos directory from IntelliJ IDEA.
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.