Ask is moving to Stack Overflow and Serverfault.com! Please use the "opendaylight" tag on either of these sites. This site is now in Read-Only mode

0

How to make my own module known to ODL?

asked 2016-05-18 05:44:49 -0800

Gamuto gravatar image

updated 2016-05-24 05:29:54 -0800

Hey guys,

I'm pretty new to ODL development and can't figure out how to add my own module into the ODL environment.

I'm running Windows, Eclipse Mars and the Lithium Distribution and do the following steps:

  • Creating a new Maven Project in Eclipse using the Quickstart-Archetype
  • Building the project inside Eclipse (everything working so far)
  • Now I start Karaf

That's where I'm stuck. In all the development tutorials they are using preconfigured VMs where they just start Karaf after building their project in the shell and it magically finds their new hello- or example-Project but I don't know how to show Karaf where to find my new module and install it.

EDIT (24.05.2016):

I discovered, that the startup-Archetype, which is mostly used in Dev-Tutorials, creates it's own internal karaf which is why the created module is automatically loaded.

EDIT ENDS

Can you explain to me how to do it?

Thanks in advance and have a great day!

edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted
1

answered 2016-07-20 06:15:08 -0800

Gamuto gravatar image

Technically, karthik330's answer as well as jdavid's are correct. But since I had a lot of trouble figuring out what to do with the information I got from here, I want to write up what I learned and did to finally get it to work.

If you want to use a stable OpenDaylight release, such as Beryllium-SR2, and integrate your own module, located on your local machine, you need to do and understand the following:

You have to make sure, that the version of the archetype you are using for creating your project matches the version of the OpenDaylight you want to integrate your project into. In this link you can find all the ressources your OpenDaylight downloads on build. If you want to use a OpenDaylight release (without SNAPSHOTs) you can find a list of archetypes to use from here

Next you need to know, that you can't/shouldn't use the pre-build version of OpenDaylight you can find on their website, if you want to integrate your own project into it, because you have to edit the OpenDaylight BEFORE it is build.

Therefore, you can go to here, select your preferred release version (for example Beryllium-SR2) and download the source code of what is called "integration-distribution".

Now comes the time to follow the steps karthik330 and jdavid described.

Step 1: go to integration-distribution/features-index/pom.xml and add a dependency to your project.

For example:

<dependency< p="">

<dependency>
  <groupId>org.opendaylight.welcome</groupId>
  <artifactId>welcome-features</artifactId>
  <version>1.0.0-SNAPSHOT</version>
  <classifier>features</classifier>
  <type>xml</type>
</dependency>

Step 2: go to integration-distribution/features-index/src/main/resources/features.xml and add the repository location of your project to the list.

In our example:

< repository > mvn:org.opendaylight.welcome/welcome-features/1.0.0-SNAPSHOT/xml/features < /repository >

After that, you run mvn clean install in the integration-distribution-Folder after which you can start your karaf by running ./karaf in integration-distribution/distribution-karaf/target/assembly/bin.

Now the last thing you have to do is installing your feature by running feature:install odl-welcome in your karaf-shell.

If you run into any version mismatches now you did not use the correct combination of archetype and OpenDaylight-Version.

Good luck!

edit flag offensive delete publish link more
0

answered 2016-05-18 09:06:26 -0800

jdavid gravatar image

Hello Gamuto,

The karaf you start after building your code is empty. To do stuff, you'll need to install the features you need to support your solution.

And this is were your "features" project takes part. In the /src folder of that project, there is a features.xml where you define your own features and their dependencies. Because you used the archetype, you should already have some features (api, global, rest, ui) that you can install on karaf using "feature:install" command.

You may need to update the feature file to add the features you need. You can check that tutorial if you need more information: https://wiki.opendaylight.org/view/OpenDaylightController:MD-SAL:ToasterStep-By-Step

Good luck for the rest, and welcome to the community !

edit flag offensive delete publish link more

Comments

Hey jdavid, thanks for the warm welcome! I'm having difficulties with what you're explaining to me since the quickstart-archetype does not create any feature.xml in the scr-folder of my project. Here's a screencap of what my project looks like: http://i.imgur.com/sS9UgzB.jpg

Gamuto ( 2016-05-20 01:23:18 -0800 )edit
0

answered 2016-05-19 02:46:03 -0800

karthik330 gravatar image

Hi , From your question , i understand that you have created Quickstart-Archetype project(Hello). And you want to install hello feature in ODL(Lithium Distribution) . Isn't it? whatever jdavid said is correct.

You could use repo:add command to add hello project to ODL at run time. But everytime adding is like waste of time.simply follow below steps.

Step 1 : integration-distribution/features-index/pom.xml . You have to add the dependency of hello Project

Step 2 : integration-distribution/features-index/src/main/resources/features.xml . you have to add the feature details of hello Project. Plz make sure you are giving right path and right versions after mvn:org.opendaylight.hello ! .

Once you build your ODL , and when you launch karaf plz check feature:list | grep hello . If it is coming then you have done! . Simple install feature:install odl-hello or whatever ..

Note : If you get any error(version miss match) when you are installing ,It is because conflict between the versions in ODl and Hello. Always make sure both the projects have same versions. For ex ,In ODL if yang tools version is 0.8.3-SNAPSHOT then it should be same in Hello . Tip : If you use stable/berylium-Distribution , and create new hello project(It will download latest ODL parent).And simply add the dependency in pom and feature.xml .It will work.You wont face could not install error.

edit flag offensive delete publish link more

Comments

I can't even use "repo:add" since it says "Error resolving artifact". "Feature:repo-add" prompts the same error. My distribution-karaf/ has no "features-index/pom.xml". I can't find any "features/pom.xml" in my ODL-Distribution nor in my project.

Gamuto ( 2016-05-20 01:31:58 -0800 )edit

I cloned from github , Integration-Distribution Stable/Berylium .

https://github.com/opendaylight/integration-distribution/tree/stable/beryllium

karthik330 ( 2016-05-23 00:53:44 -0800 )edit

Welp, now I'm confused. What's the difference between the ODL-Distribution I downloaded from the official page and the Integration-Distribution you can clone from GitHub?

Gamuto ( 2016-05-24 05:47:27 -0800 )edit

I dont know the exact difference.After downloading Pre-Build ODL-Distribution,are you launching karaf without maven install?.I think both are almost similar. Github is the place where the developers commit their open source project code

karthik330 ( 2016-05-24 06:05:21 -0800 )edit

I dont download the zip from their site.i do the following commands. git clone https://github.com/opendaylight/integration-distribution.git(It will download the project) git checkout stable/beryllium your ODL code will be downloaded. Only thing is you have to do mvn clean install

karthik330 ( 2016-05-24 06:06:52 -0800 )edit
Login/Signup to Answer

Stats

Asked: 2016-05-18 05:44:49 -0800

Seen: 477 times

Last updated: Jul 20 '16