Importing OpenDaylight Into Eclipse
This is a quick video for importing OpenDaylight into Eclipse for development. You need to build OpenDaylight with Maven prior to importing it into Eclipse. Once you build ODL from the CLI, you can either run it from there for learning OpenFlow or getting to know the OpenDaylight controller or go on to importing the controller into Eclipse. For those new to Eclipse, it is a free and open source (FOSS) integrated development environment (IDE) that supports Windows, Mac and Linux. Once imported and built in Eclipse, you can run the project from within the IDE for test/dev.
Here is a recording from ONS 2013. This was a Q&A session with the technical steering committee (TSC). The recording is pretty grainy since it was just a pocket recorder. You can’t hear David Meyer very well in the audio but you can hear the panel well enough. The ONS does a nice job of getting a lot of the content on their YouTube channel. I will replace this with a link to that once it posts.OpenDaylight TSC Q&A from ONS 2013
Video: Importing OpenDaylight Into Eclipse
I will keep this page or some pointer to a page updated as the project matures. Make sure you use JDK7 and not JDK6. See this thread on the ODL Listserv. The audio is very low, I will remix it in the next day or two and upload it.
OpenDaylight Mac OSX CLI Build
If you don’t build ODL from the CLI prior to importing it into Eclipse you will end up with thousands of errors. This sort of thing seems easier to follow along a video rather then following 30 steps of instructions. If you have never used Eclipse, keep an eye in the bottom right of the main window for its progress bar. It is always best to leave Eclipse alone while it is downloading dependences or project code.
1 2 3 4 5 |
git clone http://git.opendaylight.org/gerrit/p/controller.git cd controller/opendaylight/distribution/opendaylight/ mvn clean install |
If you want to just run the controller from the CLI the following will start it up. First you need to set the $JAVA_HOME ENV variable and then run the shell script to start the controller.
1 2 3 4 5 6 7 8 |
export JAVA_HOME=$(/usr/libexec/java_home) #Verify with: echo $JAVA_HOME #Replace 0.1.0 with the current version that is built. cd target/distribution.opendaylight-0.1.0-SNAPSHOT-osgipackage/opendaylight ./run.sh |
Then point your browser at IP addr on port 8080 or use the REST API (API subject to change) along with everything else since this is in its infancy.
1 2 3 4 5 6 |
cd target/distribution.opendaylight-0.1.0-SNAPSHOT-osgipackage/opendaylight http://127.0.0.1:8080 Login: admin Password: admin |
Building OpenDaylight Into Eclipse
- It is probably best to use Eclipse IDE for Java EE Developers – Eclipse IDE for Java EE Developers
- I used this Wiki entry for the m2e (Maven Integration for Eclipse) dependencies I was getting tripped up on: OpenDaylight – Eclipse CLI Setup
- Make sure you use m2e v1.2 rather then v1.3. If you are using an existing Eclipse install it is probably running the latest. Just uninstall it under Eclipse-> About Eclipse -> Installation Details and remove the two m2e dependencies. Then go to help -> install new software and plug in the URI http://download.eclipse.org/technology/m2e/releases
- You may get 40-50 errors or so after you import ODL as an existing Maven project. That is a missing dependency, Tycho. Eclipse will downloaded Tycho automatically, just click “auto select” as shown in the video.
- Prior to being able to run the controller within Eclipse you need to run the configuration /distribution.opendaylight/opendaylight-assembleit.launch with “run-as” opendaylight-assembleit.launch to finish the build. There is probably be a better way, but this was where I ended up after poking around for a while to get it working.
- The pom.xml (Project Object Model) instructs maven to create a jar file and basically contains everything that is significant about the project. The pom.xml file is located in distribution.opendaylight/pom.xml.
Building OpenDaylight In Linux
If you are using Linux, the following will cover the CLI Maven build.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
apt-get update apt-get install maven git openjdk-7-jre openjdk-7-jdk git clone http://git.opendaylight.org/gerrit/p/controller.git cd controller/opendaylight/distribution/opendaylight/ mvn clean install cd target/distribution.opendaylight-0.1.0-SNAPSHOT-osgipackage/opendaylight export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64 echo JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64 >> ~/.bashrc #From the directory ~/controller/opendaylight/distribution/opendaylight/target/distribution.opendaylight-0.1.0-SNAPSHOT-osgipackage/opendaylight ./run.sh will start the controller. |
OpenDaylight Maven Build Error
If your Maven build fails with a ” OutOfMemory: PermGen Space ” Re-run Maven using the -X switch to enable full debug logging. This is due to a memory leak somewhere in the Maven build and is being tracked as a bug.
1 2 3 4 5 6 7 8 |
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.15:integration-test (default) on project northbound.integrationtest: Execution default of goal org.apache.maven.plugins:maven-failsafe-plugin:2.15:integration-test failed: The forked VM terminated without saying properly goodbye. VM crash or System.exit called ? [ERROR] Command was/bin/sh -c cd /Users/brent/Downloads/controller/opendaylight/northbound/integrationtest && /Library/Java/JavaVirtualMachines/jdk1.7.0_07.jdk/Contents/Home/jre/bin/java -jar /Users/brent/Downloads/controller/opendaylight/northbound/integrationtest/target/surefire/surefirebooter4405430530997069603.jar /Users/brent/Downloads/controller/opendaylight/northbound/integrationtest/target/surefire/surefire1749047358112582031tmp /Users/brent/Downloads/controller/opendaylight/northbound/integrationtest/target/surefire/surefire_66025253661421325818tmp 20:24:00.137 [http-bio-8080-exec-9] ERROR o.o.c.l.b.i.UncaughtExceptionHandler - Uncaught ExceptionHandler: java.lang.OutOfMemoryError: PermGen space 20:24:03.594 [Timer-2,ISPN,brents-MacBook-Pro-2-567] ERROR o.o.c.l.b.i.UncaughtExceptionHandler - Uncaught ExceptionHandler: java.lang.OutOfMemoryError: PermGen space |
In the meantime run the following instead of “mvn clean install” and it will skip the integration tests that seem to be the source of the GC leak. Also increase memory allocation for Maven.
1 2 3 4 |
MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=256m" mvn clean install -DskipTests |
You will need at least around 1.5GB of memory or you may run out of memory during the Maven build. The error will look like this:
1 2 3 4 5 6 |
Compilation failure Failure executing javac, but could not parse the error: The system is out of resources. Consult the following stack trace for details. |
I started hacking on a module, by just copying an existing module and adding it to pom.xml file. I am more familiar with Floodlight then Beacon.
I did a screencast of installing OpenDaylight and installing some flowmods with Mininet and the link to the ODL Eclipse install Wiki entry:
- OpenDaylight – Eclipse CLI Setup
- OpenDaylight OpenFlow Tutorial
- Packet Pushers – Talking With OpenDaylight Leadership
Good stuff. This is a unique time to say the least. Its probably one of those 15-20 year disruption cycles, last one was the Internet in the late 90’s. Jump in and shape its direction.
Thanks for stopping by.
Hi Brent,
Thanks a ton for the video. It was very helpful. Could you access controller CLI commands mentioned at https://wiki.opendaylight.org/view/OpenDaylight_Command-Line_Interface_(CLI):
Main
Thanks again!
Hi Anna, glad it helped! The CLI is just starting to get fleshed out.
You can track the status on the controller-dev lsv:
https://lists.opendaylight.org/pipermail/controller-dev/2013-April/000198.html
Hi Brent,
Thank you so much for the video! It was really helpful! I just had a couple of small questions since I am a newbie to SDN. The Open Daylight web page has some links related to sample Applications. but it does not mention anywhere as to how to run these Applications. It would be really great if you could direct me to a link which shows that or just give me a hint regarding the same.
Regards,
Vinay Pai B.H.
Hi Vinay!
Here are some sample apps https://wiki.opendaylight.org/view/OpenDaylight_Controller:Sample_Applications
I think the quickest way to hack together a new bundle would be to copy one of the sample apps and paste it back into the project.
Modify the pom.xml from the old bundle to the new one. Do the same in the distribution pom.xml to load the new module in controller/opendaylight/distribution/opendaylight/pom.xml
Modify the the Activator.java file.
That will get the copied bundle into the project.
Cheers!
-Brent
Hi Brent,
I met a problem after typing “mvn clean install -X”. It shows some information like this:
[INFO] sal-broker-impl …………………………….. SUCCESS [2.931s]
[INFO] sal-binding-api …………………………….. SUCCESS [0.347s]
[INFO] yang-jmx-generator ………………………….. SUCCESS [8.490s]
[INFO] yang-jmx-generator-plugin ……………………. FAILURE [11.087s]
[INFO] sal-binding-config ………………………….. SKIPPED
[INFO] model-parent ……………………………….. SKIPPED
[INFO] model-flow-base …………………………….. SKIPPED
It stops at yang-jmx-generator-plugin and skip all the projects below. Would you please give some advice how to fix it?
Hi Brent,
I’m trying to debug in eclipse, the more I receive the following error log:
!SESSION Wed Nov 20 08:32:05 PST 2013 ——————————————
!ENTRY org.eclipse.equinox.launcher 4 0 2013-11-20 08:32:06.003
!MESSAGE Exception launching the Eclipse Platform:
!STACK
java.lang.ClassNotFoundException: org.eclipse.core.runtime.adaptor.EclipseStarter
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:626)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
at org.eclipse.equinox.launcher.Main.main(Main.java:1414)
do you know the reason for the error?
My intention was to find out which class need to insert the breakpoint and capture the command entered in the command line interface and change the Mininet runtime command
h1 ping h2 for h1 ping h3
Regards,
Fabio
Hello Brent, I was learning to build the code by following the steps in your blog and youyube video. Everything works fine until “mvn clean install”.
My setup is Vbox+Ubuntu1204+openJDK7+Maven3. I have tried “mvn install”, “mvn clean install -U” and “mvn3 clean install” and the same errors I got are:
[ERROR] Failed to execute goal on project distribution.opendaylight: Could not resolve dependencies for project org.opendaylight.controller:distribution.opendaylight:pom:0.1.2-SNAPSHOT: Failed to collect dependencies at org.opendaylight.controller:sal-common:jar:1.1-SNAPSHOT: Failed to read artifact descriptor for org.opendaylight.controller:sal-common:jar:1.1-SNAPSHOT: Could not find artifact org.opendaylight.controller:sal-parent:pom:1.1-SNAPSHOT in opendaylight-snapshot (http://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/) -> [Help 1]
If you happen to see the same issue, would you please let me know the solution via Email? I have asked this in the freenode IRC#opendaylight and mailing list but no reply so far.
Thank you,
Yuqing
Hi Brent, I’m getting the following error while running mvn clean install.
[INFO] ————————————————————————
[INFO] BUILD FAILURE
[INFO] ————————————————————————
[INFO] Total time: 7:18.544s
[INFO] Finished at: Mon Mar 31 14:02:11 PDT 2014
[INFO] Final Memory: 25M/59M
[INFO] ————————————————————————
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.10:check (default) on project distribution.opendaylight: Unable to create output stream: /home/adisarun/controller/opendaylight/distribution/opendaylight/target/checkstyle-result.xml: /home/adisarun/controller/opendaylight/distribution/opendaylight/target/checkstyle-result.xml (No such file or directory) -> [Help 1]
Could not debug as I am new to Maven & ODL.
I would appreciate your help