How to Setup Environment for OpenDaylight Applications Development

Setting up environment with Java, Maven and Git

In this article I will explain process of installation all prerequisites needed for start developing applications for OpenDaylight controller. When we have all prerequisites installed we can start with OpenDaylight application development. OS we will use is Ubuntu Desktop installed on VirtualBox virtualization platform. In my article „How to install Ubuntu on VirtualBox“ I explained Ubuntu installation on VirtualBox so here we will see additional steps needed for setting our environment for OpenDaylight application development.

First prerequisite is to have java because OpenDaylight is nothing else then Java application. To install Java execute next command at Ubuntu terminal:

sudo apt-get install openjdk-8-jdk

Next step is installing Maven tool because OpenDaylight project use maven as building automation tool for building applicatrions. Maven is Java tool for automation of Java project building. It is also java application which is used for building source Java code to native code which is executed on java virtual machine. Maven helps developers in the way that it takes care of project dependencies and documentation. It can download some dependencies from internet and include it in your project. It is based on POM model which use pom.xml file for project configuration. In this file are all configuration data related to project (dependencies, build directory, test directory etc.). So, to install Maven execute next command:

sudo apt-get install maven

Next step is to install Git client on development machine because OpenDaylight uses Git as code repository. To install Git use this command:

sudo apt-get install git-core

Now, we have Java, Maven and Git client installed.

Next step is to do some configuration changes on Maven because Opendaylight repository of artifacts (build projects, jars…) are not stored at central Maven repository. So, to get maven aware of Opendaylight artifacts we need to do some additional configuration on Maven. To do that configuration use next two commands:

cp -n ~/.m2/settings.xml{,.orig}

wget -q -O – https://raw.githubusercontent.com/opendaylight/odlparent/master/settings.xml > ~/.m2/settings.xml

With firs commend you copy original settings.xml file in Maven installation. With second command you copy settings.xml file from online OpenDaylight repository at Maven configuration folder and after that Maven will be aware of OpenDaylight artifacts.

In case you do not have .m2 folder in your Ubuntu(I did not have it) you can add it manually and execute only second(wget) command.

Next step is optional. You can increase amount memory used by Maven by setting the MAVEN_OPTS environment variable and it can be done by editing .bashrc file. So, open .bachrc file:

vi ~/.bashrc

add this line and save the file:

export MAVEN_OPTS=’-Xmx1048m -XX:MaxPermSize=512m’

Now, after previous installation performing we have environment set for OpenDaylight application development. With this environment we can develop new applications and modify existing.
Another way to develop ODL applications is to use Eclipse IDE (Integrated Development Environment) environment. It enables all development functionalities as previously described setup and some additional. So, I will describe Eclipse IDE setup.

Eclipse IDE environment setup

Eclipse is well known application development tool for java. It enables creating complex projects, manipulating with Java code and develop it, building java code and creating jar files for executing applications. Eclipse also enables importing OpenDaylight projects, reviewing and changing the code and building your own projects for OpenDaylight. It enables fully automated environment setup for ODL application development. You do not have to think about Maven installation, about downloading code from Git repositories, about prerequisites etc. Eclipse setup do all this stuff for you. This setup I will show is based on Eclipse Oomph installer. Let’s start.

First step is to download Eclipse installation. It can be done from this link:

https://www.eclipse.org/downloads/

From above link download file eclipse-inst-linux.64tar.gz and extract it. Go to extracted folder and run eclipse-inst file. Opens first window:

1

Click on the icon at top right corner and choose Advanced mode.

2.png

On the product list choose Eclipse IDE for Java Developers and product version (at the time of writing this article last stable version is Neon):

3

Click on Next.

On the next window you will get list off all projects you can include in the environment during Eclipse installation. Among all projects are OpenDayligt projects which are included in Eclipse setup. So, to choose ODL projects expand Opendaylight.org and choose project you want to include:

4

Click on Next.
At the next window type or browse installation folder:

5.png

On this window you can also configure some variables related to your development environment such your Gerrit username. To do that click on “Show all variables” check box and you will get windows for variables setting. When you finish click on Next.

At the next windows Eclipse show you tasks it will perform:

6.png

Click on Finish to start. From this moment Eclipse will take some time to setup environment. When it is finished Click on Finish again and you will have Eclipse environment for OpenDaylight application development ready.

Note: If you have red sign at some or all of projects included in Eclipse wait some time or if there is no changes after some time go to project in workspace do right click and go to Maven->Update Projects. Then uncheck “Offline” and click on OK. This will update all dependencies in project and everything should be fine. Enjoy in ODL applications development!

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s