1 Pulling and Pushing the Code from the CLI
2 =========================================
4 OpenDayligh is a collection of projects, each with their own code
5 repository. This section provides a general guide for to pulling,
6 hacking, and pushing the code for each project. For project specific
7 detail, refer to the project’s section in this guide.
9 Code reviews are enabled through Gerrit. For setting up Gerrit see the
10 section on Getting started with Git and Gerrit.
14 You will need to perform the Gerrit Setup before you can access git
15 via ssh as described below.
17 Pulling code via Git CLI
18 ------------------------
20 Pull the code by cloning the project’s repository.
24 git clone ssh://<username>@git.opendaylight.org:29418/<project_repo_name>.git
26 where <username> is your OpenDaylight username, and
27 <project\_repo\_name> is the name of the repository for project you are
28 trying to pull. Here is the current list of project repository names:
30 aaa, affinity, bgpcep, controller, defense4all, dlux, docs,
31 groupbasedpolicy, integration, l2switch, lispflowmapping, odlparent,
32 opendove, openflowjava, openflowplugin, opflex, ovsdb, packetcable,
33 reservation, sdninterfaceapp, sfc, snbi, snmp4sdn, toolkit, ttp, vtn,
36 For an anonymous git clone, you can use:
40 git clone https://git.opendaylight.org/gerrit/p/<project_repo_name>.git
42 Setting up Gerrit Change-id Commit Message Hook
43 -----------------------------------------------
45 - This command inserts a unique Change-Id tag in the footer of a commit
46 message. This step is optional but highly recommended for tracking
51 cd <project_repo_name>
52 scp -p -P 29418 <username>@git.opendaylight.org:hooks/commit-msg .git/hooks/
53 chmod 755 .git/hooks/commit-msg
55 - Install and setup Git-review. Git-review is a great tool to simplify
56 the hassle of using several git commands to submit a patch for
57 review. Refer to `How to install and push codes with
58 git-review <http://www.mediawiki.org/wiki/Gerrit/git-review#Installation%7Chere>`__
59 for instructions. After initializing git-review, both commit-msg hook
60 and a remote repo named gerrit will be created and a patch can be
61 submitted to Gerrit with a single "git review" command.
63 - Now you can start making your code changes.
68 While you are in the <project\_repo\_name> directory, run
74 To run without unitests you can skip building those tests running the
79 mvn clean install -DskipTests
80 /* instead of "mvn clean install" */
82 Runing OpenDaylight from local build
83 ------------------------------------
85 Change to the karaf distribution sub-directory, and run
89 ./target/assembly/bin/karaf
91 At this point the OpenDaylight controller is running. You can now open a
92 web browser and point your browser at http://localhost:8080/
94 .. figure:: ./images/800p_OpenDaylight_Login.jpg
95 :alt: OpenDaylight Main Page
97 OpenDaylight Main Page
99 Commit the code using Git CLI
100 -----------------------------
104 To be accepted, all code mustcome with a `developer certificate of
105 origin <http://elinux.org/Developer_Certificate_Of_Origin>`__ as
106 expressed by having a Signed-off-by. This means that you are
107 asserting that you have made the change and you understand that the
108 work was done as part of an open-source license.
112 Developer's Certificate of Origin 1.1
114 By making a contribution to this project, I certify that:
116 (a) The contribution was created in whole or in part by me and I
117 have the right to submit it under the open source license
118 indicated in the file; or
120 (b) The contribution is based upon previous work that, to the best
121 of my knowledge, is covered under an appropriate open source
122 license and I have the right under that license to submit that
123 work with modifications, whether created in whole or in part
124 by me, under the same open source license (unless I am
125 permitted to submit under a different license), as indicated
128 (c) The contribution was provided directly to me by some other
129 person who certified (a), (b) or (c) and I have not modified
132 (d) I understand and agree that this project and the contribution
133 are public and that a record of the contribution (including all
134 personal information I submit with it, including my sign-off) is
135 maintained indefinitely and may be redistributed consistent with
136 this project or the open source license(s) involved.
138 **Mechanically you do it this way**:
144 You will be prompted for a commit message. If you are fixing a buzilla
145 bug you can add the associated bug number to your commit message and it
146 will get linked from Gerrit:
154 Signed-off-by: Ed Warnicke <eaw@cisco.com>
155 # Please enter the commit message for your changes. Lines starting
156 # with '#' will be ignored, and an empty message aborts the commit.
158 # Changes to be committed:
159 # (use "git reset HEAD <file>..." to unstage)
164 Pulling the Code changes via Git CLI
165 ------------------------------------
167 Pull the latest changes from the remote repository
172 git rebase origin/<project_main_branch_name>
174 where <project\_main\_branch\_name> is the the branch you want to commit
175 to. For most projects this is master branch. For some projects such as
176 lispflowmapping, a different branch name (develop in the case of
177 lispflowmapping) should be used.
179 Pushing the Code via Git CLI
180 ----------------------------
182 Use git review to push your changes back to the remote repository using:
188 You can set a topic for your patch by:
192 git review -t <topic>
194 You will get a message pointing you to your gerrit request like:
198 ==========================
199 remote: Resolving deltas: 100% (2/2) +
200 remote: Processing changes: new: 1, refs: 1, done +
202 remote: New Changes: +
203 remote: http://git.opendaylight.org/gerrit/64 +
205 ==========================
207 The Jenkins Controller User will verify your code and post the result on
208 the your gerrit request.
210 Viewing your Changes in Gerrit
211 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
213 Follow the link you got above to see your commit in Gerrit:
215 .. figure:: ./images/gerrit_code_review.jpg
216 :alt: Gerritt Code Review Sample
218 Gerritt Code Review Sample
220 Note that the Jenkins Controller User has verified your code and at the
221 bottom is a link to the Jenkins build.
223 Once your code has been reviewed and submitted by a committer it will be
224 merged into the authoritative repo, which would look like this:
226 .. figure:: ./images/gerrit_merged.jpg
227 :alt: Gerritt Code Merge Sample
229 Gerritt Code Merge Sample
234 1. **What to do if your Firewall blocks port 29418**
236 There have been reports that many corporate firewalls block port 29418.
237 If that’s the case, please follow the `Setting up HTTP in
238 Gerrit <https://wiki.opendaylight.org/view/OpenDaylight_Controller:Setting_up_HTTP_in_Gerrit>`__
239 instructions and use git URL:
243 git clone https://<your_username>@git.opendaylight.org/gerrit/p/<project_repo_name>.git
245 You will be prompted for the password you generated in `Setting up HTTP
247 Gerrit <https://wiki.opendaylight.org/view/OpenDaylight_Controller:Setting_up_HTTP_in_Gerrit>`__.
249 All other instructions on this page remain unchanged.
251 To download pre-built images with ODP bootstraps see the following
254 `Pre-Built OpenDaylight VM
255 Images <https://github.com/nerdalert/OpenDaylight-Lab>`__