2

I am trying to set up Opendaylight controller. Actually my intention is to connect it with mininet vm and have communication with Internet. (with mininet embedded controller communication to internet is possible). To perform this, from what I have understood, I have to write an application for Opendaylight controller in order to handle incoming and outgoing flows. Just connecting mininet with ODL controller, seems not enough for communication of the testbed with the Internet. Correct me if I miss something but downloading the distribution in order to write an application for Opendaylight controller, is also not enough. A new project needs to be created, right?

I downloaded Carbon 0.6.2 (Carbon SR2) from the official website, and based on this and following the tutorials: https://wiki.opendaylight.org/view/GettingStarted:Development_Environment_Setup#Edit_your_.7E.2F.m2.2Fsettings.xml and https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL:Startup_Project_Archetype

I try to create my project. The user guide seem to be outdated. I use Snapshot-Type=opendaylight.snapshot and Archetype-Version=1.5.0-SNAPSHOT. Archetype versions have not been updated in the user guide and I am not sure whether I use the proper one.

So I use maven command in the following way:

mvn archetype:generate -DarchetypeGroupId=org.opendaylight.controller -DarchetypeArtifactId=opendaylight-startup-archetype -DarchetypeRepository=http://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/ -DarchetypeCatalog=remote -DarchetypeVersion=1.5.0-SNAPSHOT

(I used that archetype version based on the archetype-catalog.xml:

<groupId>org.opendaylight.controller</groupId>
<artifactId>opendaylight-startup-archetype</artifactId>
<version>1.5.0-SNAPSHOT</version>)

Then I create my project and execute:

mvn clean install -DskipTests -Dcheckstyle.skip=true

Project is created successfully (no errors), but when I start the controller from this project, it seems that l2-switch related features are not listed and as a result cannot be installed.

Is this implemented to work as such? I would expect that every feature listed in the main distribution would be available also in the projects created based on this specific distribution. This feature is needed for communication of ODL controller with mininet over Openflow protocol. I use java 1.8 and maven 3.5.2

Could anybody help me clarify this? Opendaylight seems so promising but it's a pity documentation is not straight forward with so many dependencies. Thanks in advance for your help!

Ale
  • 946
  • 4
  • 17
  • 28
Jimaras
  • 21
  • 4

3 Answers3

2

Executive summary:

If you would like the ability to install the l2-switch feature, just add the l2-switch dependecy to Karaf's pom.xml before you build the project.

Detailed workflow:

  • Pre-requisites
    • Install Java SDK and MVN source
    • Configure M2_HOME, MAVEN_OPTS and JAVA_HOME env variables
  • Generate ODL Maven project
    • Delete your old maven repository
    • Copy settings.xml from odlparent into ~/.m2/settings.xml
    • Execute your Maven archetype generation command
  • Build and run ODL w/ the l2-switch feature
    • Edit karaf/pom.xml to include l2-switch
    • Build and install ODL
    • Install the l2-switch feature

Generate ODL Maven project

Delete your existing repository

[workdir]$ rm -rf ~/.m2/repository/

Copy settings.xml from odlparent into ~/.m2/settings.xml

[workdir]$ curl https://raw.githubusercontent.com/opendaylight/odlparent/master/settings.xml --create-dirs -o ~/.m2/settings.xml

Execute your Maven archetype generation command

[workdir]$ mvn archetype:generate -DarchetypeGroupId=org.opendaylight.controller -DarchetypeArtifactId=opendaylight-startup-archetype -DarchetypeRepository=http://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/ -DarchetypeCatalog=remote -DarchetypeVersion=1.5.0-SNAPSHOT
Define value for property 'groupId': org.opendaylight.example
Define value for property 'artifactId': example
Define value for property 'version' 0.1.0-SNAPSHOT: : 
Define value for property 'package' org.opendaylight.example: : 
Define value for property 'classPrefix' Example: : ${artifactId.substring(0,1).toUpperCase()}${artifactId.substring(1)}
Define value for property 'copyright': FreshLEX, LLC
Define value for property 'copyrightYear' 2017: : 2018

Edit karaf/pom.xml to include l2-switch

[workdir]$ cd example/
[example]$ vim karaf/pom.xml

Add this right under the dependencies tag:

<dependency>
      <groupId>org.opendaylight.l2switch</groupId>
      <artifactId>features-l2switch</artifactId>
      <version>0.7.0-SNAPSHOT</version>
      <classifier>features</classifier>
      <type>xml</type>
      <scope>runtime</scope>
</dependency>

Build and run ODL w/ the l2-switch feature

[example]$ mvn clean install -DskipTests
[example]$ cd karaf/target/assembly/bin/
[bin]$ ./karaf
opendaylight-user@root>feature:install odl-l2switch-switch
opendaylight-user@root>
John Sobanski
  • 147
  • 1
  • 11
1

The distro under the project's karaf directory is generated based on the project feature(s). The archetype doesn't know about every project in ODL. It's just a starting point - you add dependent bundles or features as you need them. So if you need an l2-switch feature then you would include that feature with your project's feature.

Tom Pantelis
  • 1,349
  • 1
  • 7
  • 6
  • Thanks for your quick reply. Is there any documentation I could follow in order to install l2-switch feature in my project features? I thought that the archetype would include the basic features but those would not be installed unless the user would do that. Thanks in advance for your help! – Jimaras Jan 04 '18 at 18:58
  • It's standard karaf features stuff - you just need to specify the correct feature repo and feature to include in your features.xml. You can find that in he l2switch project. The repo would be mvn:org.opendaylight.l2switch/odl-l2switch-switch//xml/features and probably the odl-l2switch-switch feature. – Tom Pantelis Jan 04 '18 at 19:42
  • The distribution from the ODL download page includes all of the features that are available to be installed. The archetype is built and part of the distribution so it doesn't know every project and future release version at build time. Also the archetype is a starter for a new project so you wouldn't want every other ODL project included with yours anyway. – Tom Pantelis Jan 04 '18 at 19:52
  • Could you please elaborate on this? Where is the features.xml file located? Cannot find it under my project's directories. – Jimaras Jan 05 '18 at 14:17
  • There should be a features directory with a feature(s).xml file somewhere under src. – Tom Pantelis Jan 05 '18 at 14:34
  • Unfortunately no features.xml file. Output for src path: ubuntu@ubuntu-VirtualBox:~/distribution-karaf-0.6.2-Carbon/vupf/src/main/resources$ ll total 20 drwxrwxr-x 2 ubuntu ubuntu 4096 Îαν 4 17:42 ./ drwxrwxr-x 3 ubuntu ubuntu 4096 Îαν 4 17:42 ../ -rw-rw-r-- 1 ubuntu ubuntu 11140 Îαν 4 17:42 stylesheet.css Just the stylesheet.css is there. – Jimaras Jan 05 '18 at 15:01
  • I'm not sure what you're doing. Aren't you installing the feature that was generated by the startup archetype. That is the feature you need to modify to also install l2-switch etc. The archetype should generate a features directory in addition to api, impl etc (or whatever they're called - I haven't used the archetype in a long time). Under that features directory there should be a features.xml file which installs the bundles and whatever else for the new project that was generated. – Tom Pantelis Jan 05 '18 at 19:55
  • The procedure I follow is listed step by step in the initial post. Under my project directory there is a features directory containing the following: ubuntu@ubuntu-VirtualBox:~/distribution-karaf-0.6.2-Carbon/vupf/features$ ll drwxrwxr-x 3 ubuntu ubuntu 4096 Îαν 6 13:52 features-X/ drwxrwxr-x 3 ubuntu ubuntu 4096 Îαν 6 13:54 odl-X/ drwxrwxr-x 3 ubuntu ubuntu 4096 Îαν 6 13:52 odl-X-api/ drwxrwxr-x 3 ubuntu ubuntu 4096 Îαν 6 13:54 odl-X-cli/ drwxrwxr-x 3 ubuntu ubuntu 4096 Îαν 6 13:55 odl-X-rest/ -rw-rw-r-- 1 ubuntu ubuntu 1164 Îαν 5 23:04 pom.xml – Jimaras Jan 07 '18 at 15:56
  • Those directories contain some paths below, some features.xml files but I am not sure if I have to modify them: ubuntu@ubuntu-VirtualBox:~/distribution-karaf-0.6.2-Carbon/vupf/features/features-X/target/feature$ ll -rw-rw-r-- 1 ubuntu ubuntu 665 Îαν 6 13:52 feature.xml No features.xml file is located under src subdirectories. Is the exact procedure for configuring features in projects listed somewhere in opendaylight community? Struggling with this for a month without any clue from documentation. – Jimaras Jan 07 '18 at 15:56
0

To use OpenDaylight you dont need to build it from the source so you dont need Maven. Just get java 8 installed and your java home is set. Then download the tar file (https://www.opendaylight.org/technical-community/getting-started-for-developers/downloads-and-documentation) and extract it.

For the applications, activate restconf, netconf, openflow, and l2switch as described and your instance is ready to use.

Running mininet, you can set the contoller using ovs-vsctl set-controller bridge tcp::

and use ovs-vsctl show to see if the controller is connected.

bilucent
  • 108
  • 1
  • 10
  • Some features are not avaliable, for example odl-vtn-manager. If i want, i need to build odl with maven? – Ivan Alex Jun 17 '18 at 19:07