Jump to: navigation, search

Group Based Policy (GBP)/Contribution Guidelines

This document describes setting of development environment for contribution to Group Based Policy project.

Gerrit Settings

Software Prerequisites

Git

For pushing changes to Gerrit, SSH keys need to be installed on your environment and on server side as well. The following Gerrit setup guide will walk you through all the necessary steps.

Dowload Project

To download source code, visit Opendaylight Gerrit web. Sign in and navigate to Projects -> List -> groupbasedpolicy . Copy the download link to clone the project into your local environment. In your terminal window navigate to directory where you prefer to download the project and paste the copied link. The code will be pulled from master branch.

Gbp download link.png


Git Settings

Pulling code from specific branch to new local branch might be done by using git commands:

   git branch -f remote_branch_name origin/remote_branch_name
   git checkout remote_branch_name
   git remote show origin

Set your username and email, when using Git for the first time.

   git config --global user.name "Tomas Cechvala"
   git config --global user.email tcechval@cisco.com
   git config --list

Development Environments

Setting Formatter in Eclipse

Open Eclipse and navigate to Window > Preferences > Java > Code Stype > Formatter. Import file groupbasedpolicy/eclipse-java-clean-code-style.xml and save.

Eclipse formatter setting.png

Gerrit Submissions

Publishing Changes

To push changes for review, you need to stage them for commit and push them to remote branch.

   git status
   git add <file-path>
   git status
   git commit -s
   git push origin HEAD:refs/for/<remote-branch-name>

In commit message, you should see your account settings.

Commit message.png

Creating Drafts

If you would like to push changes that could be later published for merging or discarded, use drafts on Gerrit. Here is a simple example of creating a draft submission.
   git status
   git add <file-path>
   git status
   git commit -s
   git push origin HEAD:refs/drafts/stable/lithium

Gerrrit web.png

Resubmitting Changes

If you need to resubmit your changes, copy the Checkout link from the review screen at Gerrit. Navigate the terminal window into your local repository and paste the copied command. You will be switched to detached branch. Switch to a new one, edit what you need and commit your changes with --amend option to load your previous commit message.

   git checkout -b <new-branch-name>
   git status
   git add <file-path>
   git status
   git commit -s --amend

When patching your previous commit, you need to have Change-Id in the commit message. If it is missing, you have to copy it from Gerrit review window. Otherwise Gerrit will consider this change as a new commit. When merging your modifications with the code base, changes and commit message of the last patch set will be used. There is no need to modify commit message when publishing new patch set.

Commit amend message.png

Running Sample Integration Application

GBP-SFC Ingerration Demo wraps integration efforts of Group Based Policy and Service Function Chaining.

GBP-Devstack Ingegration Demo wraps networking mapping from Devstack to Group Based Policy.

Suggested Reading

It is recommended to read information and development guide for Group Based Policy and Service Function Chaining project.

Information about third party software used for integrated demo applications:

Docker Engine

Vagrant

Open vSwitch

Devstack