Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents
maxLevel4

Setting up the IDE

You can set up the SDNC IDE by following instructions from 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.

...

Filling the information and click on Create new account to proceed account creation.

...

Downloading SDN-C Projects

Follow steps in Get git command from ONAP gerrit to get the git clone command and clone each of the following SDNC projects:

...

Note: The ONAP SDNC projects are more like a demo version of ECOMP's SDN-GC.

...

Downloading CCSDK Projects

Follow steps in Get git command from ONAP gerrit to get the git clone command and clone each of the following CCSDK projects:

Project NameProject Descriptionhas code
ccsdk/dashboardOpeations Manager Dashboard(tick)
ccsdk/distributionCCSDK distribution packaging (e.g. docker containers)(minus)
ccsdk/parentParent POMs to be used by CCSDK clients(minus)
ccsdk/platform/blueprintsBlueprints. not in Amesterdam release(minus)
 ccsdk/platform/nbapiNorthbound API(tick)
 ccsdk/platform/pluginsPlatform plugins(tick)
 ccsdk/sli/adaptorsCommon adaptors for use by directed graphs(tick)
ccsdk/sli/coreCore Service Logic Interpreter classes(tick)
 ccsdk/sli/northboundCommon northbound APIS related to service logic interpreter(tick)
 ccsdk/sli/pluginsCommon plugins used by direcged graphs (tick) python
ccsdk/storage/esaasElastic Storage as a Service.  not in Amesterdam release(minus)
ccsdk/storage/pgaasPGAAS (PostgreSQL as a Service)(tick) java, python, bash
ccsdk/utilsUtilities(tick) bash, yaml


Anchor
Get git clone command from ONAP gerrit
Get git clone command from ONAP gerrit
Get git clone Command

...

from ONAP gerrit

Use your linux foundation account to login onto ONAP projects.

...

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.


View Code

...

on gerrit Website

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 SDNC - Development Environment SetupGet git command from ONAP gerrit to get the Projects list page.

Then, choose either one of the following option to view the code of the desired project.

Option 1:

...

View Through "gitweb"

...

Option in Project List Page

Note: this option will bring you to, and only to, the HEAD branch which is the master branch.

...

Now, the repo details page will be shown and you can view the code in master branch from there.


Option 2:

...

View from "Branches"

...

Option in

...

Project Page

Note: this This option allows you to select a particular branch to view it code.

...

In this tutorial, we recommend to use Junit4 and Mockito for writing the junit test.

Add

...

Dependency

Add Junit and mockito dependency in the pom.xml if they are not there.

...

For more information about how to use Mockito, refer to https://www.tutorialspoint.com/mockito/.

Mock

...

Class Level Attributes

Since we don't recommend to use Powermockito, however, if sometimes you do want to set/get class level attributes to satisfy complex test code and still keep the test coverage in sonar achievable.

...

static ObjectgetInternalState(Object target, String field) 
static voidsetInternalState(Object target, String field, Object value) 

Issue of

...

Using Powermockito

There are multiple advantages of using Powermock to easily write the junit test, but it does break the design of the code and even sometimes, the written Junit doesn't contain any real test value.

...

https://static.javadoc.io/org.mockito/mockito-core/2.0.10-beta/org/mockito/internal/util/reflection/Whitebox.html

...

Commiting Code

Install git-review

To commit code to ONAP, you must have git-review installed.

...

GIT Config KeyExpected ValueSetting Command
core.eollfgit config --global core.eol lf

core.autocrlf

truegit config --global core.autocrlf true
user.nameyour namegit config --global user.name <your name>
user.emailyour email addressgit config --global user.email <your email address>


Anchor
Create A Review
Create A Review

...

Creating A Review

Checkout the master branch, work on your changes, once you are ready for submission, do the following to create a review.

...

StepsCommandNotes
1git commit -sam <comment summary>Commit summary should not exceed 50 char. See ONAP Commit Messages for more details.
2git log --shortstat

To ensure change lines are properly done and your commit has the following:

    • Change-Id
    • Signed-off-by

Here's an example:

Info
iconfalse
titlegit log --shortstat

C:\workspace\onap_sdnc\northbound>git log --shortstat
commit 4728eada855f9162030f5b46a2513e3dbffa757c
Author: beili.zhou <beili.zhou@amdocs.com>
Date: Fri Oct 13 19:19:11 2017 -0400

Sonar coverage vnfapi -VNFSDNSvcLogicServiceClient

Add Junit test case for VNFSDNSvcLogicServiceClient
In VNFSDNSvcLogicServiceClient:
- Fix sonarlint issues (remove un-used import and etc)
- Changed tab to 4 spaces as per ONAP Java code style

Issue-Id: SDNC-123
Change-Id: Id176e915f17ef5fabc6805415f92d60b4c8e95b2
Signed-off-by: beili.zhou <beili.zhou@amdocs.com>

2 files changed, 580 insertions(+), 240 deletions(-)


If the Change-Id does not exist, do not proceed. You need to following SDNC - Development Environment Setup Fix no change-id to fix it before proceeding further.

3git commit --amend

Use this command to do the following:

    • add more desciption about this commit (refer to Commit Messages for how to organize commit description)
    • insert Issue-Id: <your ONAP issue id> before the Change-Id
4git 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 .

...

  • If the verify jenkins build is passed for your review
    • If it is passed, ONAP Jobbuilder will add a +1 to the Verified field in your review.
  • If there's any comments in your review
    • the comments details can be view from the History section by clicking on the description or Expand All button
  • If your review has been merged
    • If your review is merged or in process to be merged, you will see in the Code-Review field, you have a +2 from one of the committer you have added in your Reviewers.


Tips

How to Change the Comments in

...

a Review

Oops, I made a mistake in my review comments. It cannot be changed in the gerrit review. (sad)

...

StepsCommandNotes
1git commit --amendupdate the comment as desired
2git log --shortstatvalidate your commit now has the updated comments, as well as the Change-Id as the one in the gerrit review
3git review

push the changed comment to the review again.

Once the command is completed, go to your review, you will see

  • the comments content adjust to your new ones
  • the Patch Sets is now increased by one, such as from (1/1) to (2/2). here's an example:


How to Update the Code in

...

a Review

Now, I got comments in my view, and I have made the code adjustment in my workspace and tested.

...

Stepscommandnotes
1git commit -sam "my updated code"To create a new commit with your updated code
2git log --shortstat

you will see the most 2 recent commits are from

  • your commit from step 1
  • your original commit of the existing review
3git 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:

  • replace the pick in the start line of your commit from step 1 (marked with "my updated code") with s or squash,
  • remove any other text line related to this commit in the line below.
  • save the change by entering :wq


Once this command is completed, 2 commits will be merged into 1 commit.

4git 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 

5git review

push the changed comment to the review again.

Once the command is completed, go to your review, you will see

  • the comments content adjust to your new ones
  • the Patch Sets is now increased by one, such as from (1/1) to (2/2). here's an example:


Anchor
Fix no change-id
Fix no change-id
How to Fix

...

a Commit which Does Not

...

have a Change-Id

The would only happen when you are creating your very first review in a repo. It mainly because your workspace might have some mis-config which lead your repo clone was not done properly with the Clone with commit-msg hook option.

...

StepsCommandNotes
1git reset HEAD~1to undo the commit
2

from github helper page, download 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

3Use your previous command to create the commit again
4git log --shortstatto check the existence of Change-Id


How to Find All of

...

Your Merged Changes

You can find your recent merged changes from Gerrit self dashboard, however, it only works for Recent changes.

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.

...



Deploying a

...

Minimal ONAP SDN-C Environment

This tutorial is based on ONAP-integration project[1] which utilizes Vagrant[2], a deployment tool to build an ONAP environment.

...

Windows: Open Gitbash As Administrator

Convert Line

...

Endings 

cd integration/bootstrap/vagrant-onap/lib

...

Code Block
themeDJango
...
configuration = {
	...
	'docker_version' => '1.2-STAGING-latest',
	...
}
...

Modify

...

the SDN-C Deployment Script

vim integration/bootstrap/vagrant-onap/lib/sdnc

...

cd integration/bootstrap/vagrant-onap
./tools/run.sh sdnc

Configure Port

...

Forwarding

This could be replaced by adding scripts in Vagrantfile.

...

Credentials: admin/Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U

Basic

...

Usage of

...

Vagrant and

...

Docker

// check running vm instances

...

[4] Virtualbox Download link: https://www.virtualbox.org/wiki/Linux_Downloads

...

Deploying New Code (based on the standard ONAP lab setup)

coming soon

Remote Debugging

...