Configure the Comments for Files similar to the following.
Remember to put a check on "Automatically add comments for new methods and types" to apply these templates on new files.
Setting up Git and Gerrit
The ONOS source code is stored at gerrit.onosproject.org. Setting up git and gerrit will allow you to easily fetch and test any version of ONOS, including releases, development versions, and patches that have been submitted for review. Setting up a gerrit account will also enable you to submit your own patches to ONOS and also to participate in the ONOS code review process.
There are two ways to clone the code from Gerrit, https:// or ssh://. Either way is fine for reading the code, but when it comes time to contribute the easiest and most secure way is to access Gerrit over SSH.
To make sure you're using the ssh:// remote, first check the URLs of the remotes in your ONOS repository:
$ git remote -v origin https://gerrit.onosproject.org/onos (fetch) origin https://gerrit.onosproject.org/onos (push)
If you see ssh:// URLs, everything is fine and you can move on to the next step (Configuring Gerrit). If you see https:// URLs, you should change them to ssh:// before continuing:
$ git remote set-url origin ssh://<username>@gerrit.onosproject.org:29418/onos
<username> with your Gerrit/Crowd username (the
<username> must be specifically provisioned in Gerrit Profile for git)
You can double-check the URL on Gerrit by logging in, going to Projects -> List, then clicking on 'onos', On the grey bar, click 'SSH', then just underneath the grey bar will appear 'git clone ssh://...'. This is the URL you should set your remote to in your local git repository.
<username> is configured in Settings->Profile->Username; the Username is not populated for new accounts by default.
Prospective contributors should configure their account to receive notifications about their code submissions. The Settings page is accessed from the user dropdown on the upper right of the page:
To configure contacts by going to Contact Information, and filling out the fields, and hitting Save Changes :
To subscribe to the project, go to Watched Projects and enter onos-next in the Project Name field of the page. Hitting return should add onos-next to a table under the search field:
As shown above, email notifications are also configured from here by checking off the types of notifications to receive.
Uploading SSH Public Keys
An SSH key should also be uploaded to the ONOS Gerrit server.
Generate a key. Keep the default file name and location. This will generate an id_rsa and id_rsa.pub file in ~/.ssh:
$ ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/home/onosuser/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/onosuser/.ssh/id_rsa. Your public key has been saved in /home/onosuser/.ssh/id_rsa.pub. ... $ ls ~/.ssh id_rsa id_rsa.pub known_hosts
|A key must be uploaded per host if checking code out to multiple hosts with |
Developers planning to contribute code should configure git with their username and email.
git config --global user.name "firstname lastname" git config --global user.email "email@example.com"
To streamline the code review process, it is highly recommended that contributors set up
git-review, which integrates code submission with git. Refer to this link for instructions for setting up
If you're using a Mac, you may need to manually upgrade the git-review package dependency. (git-review bug#1337701)
$ sudo pip install --upgrade setuptools
Building API Docs
To build a local set of the ONOS Java API documentation bundle, use the
onos-build-docs utility, which uses Maven to generate both internal and external documentation.