commit | d33d3b48380a73fe93cc02eb699cbc24cbf77c28 | [log] [tgz] |
---|---|---|
author | Carmelo Cascone <carmelo@opennetworking.org> | Tue Jun 18 12:12:36 2019 -0700 |
committer | Ray Milkey <ray@opennetworking.org> | Tue Jun 18 22:26:33 2019 +0000 |
tree | a8d9c9327fb82ffd06ad60573bf32422e33d4ea6 | |
parent | 21eb042dba2fe99cb728e13621f0e47adfdd0dc6 [diff] |
Build ONOS exclusively with Bazel-provided remote JDK This change make it possible to build ONOS in a host system without JDK installed, or ignoring the one installed, instead relying exclusively on the "remote" JDK provided by Bazel. The JDK version, along with the toolchain configuration (language source and target values), are checked in as part of the build files (tools/build/bazel/BUILD), thus enabling deterministic builds that are less dependent of the host environment. To allow this, this change replaces all references to JDK-related tools expected to be on the host PATH, such as the jar command, with their counterpart from the remote JDK (now a sandboxed relative path). This is achieved by: * Creating a new "jdk_genrule" macro that exposes the remote JDK bin directory to the PATH visible by the genrule command. This is used for all genrule targets invoking for example `jar`; * Modifying custom Starlak rule implementations by replacing invocation to JDK tools with a path from the remote one. * Renaming the onos/lib directory to onos/deps as it clashes with the Bazel-provided JDK's lib directory (that for some strange reason is resolved on the ONOS workspace) Finally, this change is reflected on the Dockerfile which now builds ONOS from an Ubuntu image with no JDK installed. Change-Id: Ie7d990cfce6fef00ddb4ffffe4c6205b8530fb47
ONOS is the only SDN controller platform that supports the transition from legacy “brown field” networks to SDN “green field” networks. This enables exciting new capabilities, and disruptive deployment and operational cost points for network operators.
The following packages are reuqired:
To install Oracle JDK8, use following commands (Ubuntu):
$ sudo apt-get install software-properties-common -y && \ sudo add-apt-repository ppa:webupd8team/java -y && \ sudo apt-get update && \ echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | sudo debconf-set-selections && \ sudo apt-get install oracle-java8-installer oracle-java8-set-default -y
ONOS is built with Bazel, an open-source build tool developed by Google. ONOS supports Bazel 0.17 You can download it from official website or package manager (e.g. apt, brew...)
$ git clone https://gerrit.onosproject.org/onos
$ cd onos $ cat << EOF >> ~/.bash_profile export ONOS_ROOT="`pwd`" source $ONOS_ROOT/tools/dev/bash_profile EOF $ . ~/.bash_profile
$ cd $ONOS_ROOT
$ bazel build onos
To run ONOS locally on the development machine, simply run the following command:
$ bazel run onos-local [-- [clean] [debug]]
or simpler one:
$ ok [clean] [debug]
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 access ONOS UI, use browser to open http://localhost:8181/onos/ui or use onos-gui localhost
command
The default username and password is onos/rocks
To attach to the ONOS CLI console, run:
$ onos localhost
To run ONOS unit tests, including code Checkstyle validation, run the following command:
$ bazel query 'tests(//...)' | xargs bazel test
Or better yet, to run code Checkstyle and all unit tests use the following convenience alias:
$ ot
ONOS code is hosted and maintained using Gerrit.
Code on GitHub is only a mirror. The ONOS project does NOT accept code through pull requests on GitHub.
To contribute to ONOS, please refer to Sample Gerrit Workflow. It should includes most of the things you'll need to get your contribution started!
For more information, please check out our wiki page or mailing lists:
ONOS (Open Network Operating System) is published under Apache License 2.0