Table of Contents | ||
---|---|---|
|
Setting
...
Up Your Development Environment
Start by following the page Setting Up Your Development Environment.
Downloading the Source Code
Creating Your Linux Foundation Account
If you already have a Linux Foundation account, you can skip this section.
You will need linux foundation account to submit code change to ONAP projects repos. If you only want to read the code, you can skip this step.
To create your linux foundation account, go to Linux Foundation Identity page, and select I need to create a Linux Foundation ID, the following page will be shown:
Filling the information and click on Create new account to proceed account creation.this covers items such as signing up for a linux foundation account, configuring git, installing gerrit and IDE recommendations.
Downloading the Source Code
Downloading SDN-C Projects
...
Project Name | Project Description | has code |
---|---|---|
ccsdk/dashboard | Opeations Manager Dashboard | |
ccsdk/distribution | CCSDK distribution packaging (e.g. docker containers) | |
ccsdk/parent | Parent POMs to be used by CCSDK clients | |
ccsdk/platform/blueprints | Blueprints. not in Amesterdam release | |
ccsdk/platform/nbapi | Northbound API | |
ccsdk/platform/plugins | Platform plugins | |
ccsdk/sli/adaptors | Common adaptors for use by directed graphs | |
ccsdk/sli/core | Core Service Logic Interpreter classes | |
ccsdk/sli/northbound | Common northbound APIS related to service logic interpreter | |
ccsdk/sli/plugins | Common plugins used by direcged graphs | python |
ccsdk/storage/esaas | Elastic Storage as a Service. not in Amesterdam release | |
ccsdk/storage/pgaas | PGAAS (PostgreSQL as a Service) | java, python, bash |
ccsdk/utils | Utilities | bash, yaml |
Anchor | |||
---|---|---|---|
|
|
The below instructions explain how to clone a repository from gerrit with the commit message hook included and it will be configured to use HTTPS. SSH is still the recommended protocol, these instructions serve as a workaround for users behind restrictive networking rules.
If you have worked on other projects in gerrit and are already familiar with cloning from gerrit you can ignore these instructions!
Info | ||
---|---|---|
| ||
This should have been done as part of IDE setting up following "Setting Up Your Development Environment. Just in case you have missed it" and is only needed if you are behind a proxy and plan to use HTTP. If behind proxy, ensure git config has set http.proxy and https.proxy NVPs, check with the following command:
if not no http/https proxies exist add the them with the following commands:
here's an example:
|
...
Get Project list by entering the project key name in the Filter, for example sdnc, this list of projects under sdnc will be shown as below:
Click on the wanted project from the list, the General page of the selected project will be shown. the following is the General page of sdnc/adaptors:
Now click on Clone with commit-msg hook, then click on http, then click on the notepad icon.
The git clone command for the selected project is now copied into your clipboard. You do paste to use it at where-ever you want to.
...
ONAP code can also be viewed from gerrit web site as below (sdnc/adaptors project is used as the example here):
To view the coce through gerrit client, first follow steps in Get git command from ONAP gerrit to get the Projects list page.
...
In the project list page, click on the gitweb under the Repository Browser column of your project row.
The master branch's summary page will be shown up. Click on the tree option.
Now, the repo details page will be shown and you can view the code in master branch from there.
...
In the project list page, click the project under the Project Name column. (using sdnc/adaptors project as example here)
It takes you to the project General page, click on the Branches option.
The project page will be switched to Branches page. Check out the Branch Name column, click the gitweb on the same row of the desired branch.
The project Summary page of the selected branch will be shown up. Click on the tree option.
Now, the repo details page will be shown and you can view the code in master branch from there.
...
Ensure your maven is installed / set up as per instruction from Maven section of Setting Up Your Development Environment page.
...
Following instruction from Maven Example settings.xml section of Setting Up Your Development Environment page to get your settingsettings.xml file.
Info | ||
---|---|---|
| ||
If behind proxy,
|
Configure settings file in IntelliJ
If you are going to do compiling in your compile with intelliJ, follow steps in this section to configure settings.xml file in your interlliJintelliJ.
If you did not make your Maven Project by default shown, do the following:
In your interlliJintelliJ, Select View -> Tool Windows -> Maven Project
The maven project will shown on the right side of your the intelliJ window.
Click the Maven Settings wrench to bring up the Settings window:
Select the Override of the User settings file, add the settings.xml file full path, the Apply button will be enabled. click on Apply to apply the change.
...
Projects Build Order
The SDN-C projects repos repositories should be built in the following order:
...
mvn clean install -s <the settings.xml file with full path>
Build Within
...
IntelliJ
From interlliJ intelliJ Maven Projects window, find the module marked with (root), expand it by clicking on the triange triangle on the left side or double clicking the text. It will then show two folders : Lifecycle and Plugins. Use the same way to expand the Lifecycle folder, the build options are now shown:
To run the build, double click the Install or select install and then click on the Run Maven Build triange triangle icon.
To do clean, double click the clean or select clean and then click on the Run Maven Build triange triangle icon.
Tips
Skip Maven Javadoc Build
...
In anywhere of this class editor, do Ctrl+Shift+T or right click to bring up right click menu, then select Go To, then Test in the cascaded menu:
This will bring up the Choose Test for... window as below.
Choose Create New Test... for creating brand new JUnit Test, or just choose the test class to go to the existing tests.
When Create New Test... is selected, the Create Test window will be brough brought up:
The test Class name is automatically generated and shown in the window. Ensure the Testing library is selected with JUnit4.
...
If the Junit and mockito dependencies are not in the module and its parent pom file, add them to the module's pom.xml file as the following. A sample snippet is below:
Info | ||||
---|---|---|---|---|
| ||||
<dependency> |
Mock Class Level Attributes
...
To commit code to ONAP, you must have git-review installed. The steps in this section only need to be done one time, except the Tips . This should have been done already during Setting Up Your Development Environment.
On Linux
run the following command to check if git-review is installed as part of your OS image.
...
- download the Git for Windows installer
- start installer and follow Git Setup wizard screen Next until Finish prompts to complete the installation.
must have python installed
...
GIT Config Key | Expected Value | Setting Command |
---|---|---|
core.eol | lf | git config --global core.eol lf |
core.autocrlf | true | git config --global core.autocrlf true |
user.name | your name | git config --global user.name <your name> |
user.email | your email address | git config --global user.email <your email address> |
Anchor | ||||
---|---|---|---|---|
|
...
Steps | Command | Notes | |||||||
---|---|---|---|---|---|---|---|---|---|
1 | git commit -sam <comment summary> | Commit summary should not exceed 50 char. See ONAP Commit Messages for more details. | |||||||
2 | git log --shortstat | To ensure change lines are properly done and your commit has the following:
Here's an example:
If the Change-Id does not exist, do not proceed. You need to following Fix no change-id to fix it before proceeding further. | |||||||
3 | git commit --amend | Use this command to do the following:
| |||||||
4 | git review | This command will create the review at Gerrit. Once this command is completed, your newly created review can be found from Outgoing reviews in Gerrit self dashboard . |
...
Click the Add button in the Reviewers section, to add reviewers (who is going to review your code) and committers (who is going to review your code as well as approve and commit your code).
Note:
- The ONAP Jobbuilder will be added automatically within one or two minutes after the review created, and a verfiy build will also be automatically triggered for your review in ONAP jenkins server.
- The committer can be found from Software Defined Newtork Controller secion in Resources and Repositories (Deprecated) page.
By now, you will just wait and check your email for information of
...
Steps | Command | Notes |
---|---|---|
1 | git commit --amend | update the comment as desired |
2 | git log --shortstat | validate your commit now has the updated comments, as well as the Change-Id as the one in the gerrit review |
3 | git review | push the changed comment to the review again. Once the command is completed, go to your review, you will see
|
How to Update the Code in a Review
...
Steps | command | notes |
---|---|---|
1 | git commit -sam "my updated code" | To create a new commit with your updated code |
2 | git log --shortstat | you will see the most 2 recent commits are from
|
3 | git rebase -i HEAD~2 | To run rebase interactively for the most recent 2 commits In the interactive mode, it will bring up the text which contains pick for your last 2 commits along with the following content: Do the following:
Once this command is completed, 2 commits will be merged into 1 commit. |
4 | git log --shortstat | you will see there's only 1 commit which replaces the 2 commit you have seen in step 2. validate your commit has the Change-Id as the one in the gerrit review |
5 | git review | push the changed comment to the review again. Once the command is completed, go to your review, you will see
|
Anchor | ||||
---|---|---|---|---|
|
...
Steps | Command | Notes |
---|---|---|
1 | git reset HEAD~1 | to undo the commit |
2 | from github helper page, download download commit-msg, and place it under your <repo>/.git/hooks directory if your O/S adds and extension to the file, remove. It must be named "commit-msg, and place it under your <repo>/.git/hook directory " | set the proper commit-msg hook this will set the Change-Id properly in your commit |
3 | Use your previous command to create the commit again | |
4 | git log --shortstat | to check the existence of Change-Id |
...
To find all of your changes, you can type in "is:closed(owner:self)" in the Search field at Gerrit self dashboard, then click on the Search button.
Deployment
Deploying a Minimal ONAP SDN-C Environment
...
There is an settings.yaml.development under integration\bootstrap\vagrant-onap\etc etc (deprecated - /etc directory has been moved to project integration/devtool)used for different deployment scenarios.
...
Gliffy | ||||
---|---|---|---|---|
|
Tip | ||
---|---|---|
| ||
Once the vagrant has completed running it will still take some time for SDNC to come up. Have patience. |
...
Connecting to
...
your deployment
Basic Usage of Vagrant
Vagrant is commags commands are executed on the Base OS.
...
From the Base OS use the following command to see the running Guess guest VM ' ID id and name.
vagrant global-status
Port Forwarding
The Guess guest VM is running in its own private network and is using the NAT to get the the Base OS network. To see the port forwarding run the following command.
...
If you don't see any ports Oops. Configuring port-forwarding should have been configured earlier when editing the [integration.git] / bootstrap / vagrant-onap / Vagrantfile. Something must of went wrong. Here is the example of a snipet snippet that can be added to teh the Vagrant file.
Vagrant.configure("2") do |config|
if provider == :virtualbox && "sdnc".eql?(requested_machine)
config.vm.network "forwarded_port", guest: 8282, host: 8282, protocol: "tcp", auto_correct: true
config.vm.network "forwarded_port", guest: 8281, host: 8202, protocol: "tcp", auto_correct: true
end
...
Port forwarding can also be configured in the Virtual Box Gui. Here Here is an example
ssh to the
...
Guest OS
The follow command will open a ssh terminal to the running guess vm. The guess guest vm name or id can be used.
...
Basic Usage of Docker
docker commands are excuted executed on the guess guest OS
Get Detail about the dockerCommands
...
List the running docker containers
The follwing following command will list the running docker containers. The containterscontainer's id, name and whihc which ports are forwarded to the Guess OS can be found in this list.
...
Use the docker container id or name use the follwing following command to open a terminal to that container.
...
OpenDaylight RestConf API Web GUI
To connect to the runing sdnc Port running sdnc port forwarding must be configured correctly. The The port forwaded forwarded in the instruction above was 8282.
...
[3] ONAP SDC setup: Using Vagrant-Onap for local deployment of SDC project - WIP!!!#OnapforlocaldeploymentofSDCproject-WIP!!!-InitialSetup
[4] Virtualbox Download link: https://www.virtualbox.org/wiki/Linux_Downloads
...
Code Block |
---|
... rpc haok-sdnc-test { output { leaf hello-world { type string; mandatory true; } } } ... |
Use Maven to Build Project
...
It takes a miniute to restart the karaf platform which really depends on the performance of your host machine.
Remote Debugging
...
After the docker instances fully started, you should see the karaf log information below with 5005 port open.