deployment needs.
2. From the features/ directory, execute "mvn clean install"
- This will generate a kar file such as "features/target/ovsdb-features-1.2.0-SNAPSHOT.kar"
+ This will generate a kar file such as "features/target/ovsdb-features-1.2.1-SNAPSHOT.kar"
3. Download (or build from controller project) the Karaf distribution :
http://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/org/opendaylight/controller/distribution.opendaylight-karaf/
opendaylight-user@root>kar:list
KAR Name
-----------------------------
- ovsdb-features-1.2.0-SNAPSHOT
+ ovsdb-features-1.2.1-SNAPSHOT
opendaylight-user@root>feature:list | grep ovsdb
- odl-ovsdb-all | 1.2.0-SNAPSHOT | x | ovsdb-1.2.0-SNAPSHOT | OpenDaylight :: OVSDB :: all
- odl-ovsdb-library | 1.0.0-SNAPSHOT | x | ovsdb-1.2.0-SNAPSHOT | OVSDB :: Library
- odl-ovsdb-schema-openvswitch | 1.0.0-SNAPSHOT | x | ovsdb-1.2.0-SNAPSHOT | OVSDB :: Schema :: Open_vSwitch
- odl-ovsdb-schema-hardwarevtep | 1.0.0-SNAPSHOT | x | ovsdb-1.2.0-SNAPSHOT | OVSDB :: Schema :: hardware_vtep
- odl-ovsdb-plugin | 1.0.0-SNAPSHOT | x | ovsdb-1.2.0-SNAPSHOT | OpenDaylight :: OVSDB :: Plugin
+ odl-ovsdb-all | 1.2.1-SNAPSHOT | x | ovsdb-1.2.1-SNAPSHOT | OpenDaylight :: OVSDB :: all
+ odl-ovsdb-library | 1.0.0-SNAPSHOT | x | ovsdb-1.2.1-SNAPSHOT | OVSDB :: Library
+ odl-ovsdb-schema-openvswitch | 1.0.0-SNAPSHOT | x | ovsdb-1.2.1-SNAPSHOT | OVSDB :: Schema :: Open_vSwitch
+ odl-ovsdb-schema-hardwarevtep | 1.0.0-SNAPSHOT | x | ovsdb-1.2.1-SNAPSHOT | OVSDB :: Schema :: hardware_vtep
+ odl-ovsdb-plugin | 1.0.0-SNAPSHOT | x | ovsdb-1.2.1-SNAPSHOT | OpenDaylight :: OVSDB :: Plugin
opendaylight-user@root>bundle:list | grep OVSDB
186 | Active | 80 | 1.0.0.SNAPSHOT | OVSDB Library
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
- <version>${propertymavenplugin.version}</version>
<executions>
<execution>
<goals>
<!-- Surefire/Failsafe Arguments -->
<argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
<!-- OVSDB Component Versions -->
- <openstack.netvirt.version>1.2.0-SNAPSHOT</openstack.netvirt.version>
- <openstack.netvirt.providers.version>1.2.0-SNAPSHOT</openstack.netvirt.providers.version>
- <ovsdb.features.version>1.2.0-SNAPSHOT</ovsdb.features.version>
- <ovsdb.library.version>1.2.0-SNAPSHOT</ovsdb.library.version>
+ <openstack.netvirt.version>1.2.1-SNAPSHOT</openstack.netvirt.version>
+ <openstack.netvirt.providers.version>1.2.1-SNAPSHOT</openstack.netvirt.providers.version>
+ <ovsdb.features.version>1.2.1-SNAPSHOT</ovsdb.features.version>
+ <ovsdb.library.version>1.2.1-SNAPSHOT</ovsdb.library.version>
<ovsdb.northbound.version>0.8.0-SNAPSHOT</ovsdb.northbound.version>
- <ovsdb.plugin.version>1.2.0-SNAPSHOT</ovsdb.plugin.version>
- <ovsdb.plugin.compatibility.layer.version>1.2.0-SNAPSHOT</ovsdb.plugin.compatibility.layer.version>
+ <ovsdb.plugin.version>1.2.1-SNAPSHOT</ovsdb.plugin.version>
+ <ovsdb.plugin.compatibility.layer.version>1.2.1-SNAPSHOT</ovsdb.plugin.compatibility.layer.version>
<ovsdb.ovssfc.version>0.2.0-SNAPSHOT</ovsdb.ovssfc.version>
- <ovsdb.utils.config.version>1.2.0-SNAPSHOT</ovsdb.utils.config.version>
- <ovsdb.utils.mdsal.node.version>1.2.0-SNAPSHOT</ovsdb.utils.mdsal.node.version>
- <ovsdb.utils.mdsal.openflow.version>1.2.0-SNAPSHOT</ovsdb.utils.mdsal.openflow.version>
- <ovsdb.utils.servicehelper.version>1.2.0-SNAPSHOT</ovsdb.utils.servicehelper.version>
- <plugin.shell.version>1.2.0-SNAPSHOT</plugin.shell.version>
- <schema.hardwarevtep.version>1.2.0-SNAPSHOT</schema.hardwarevtep.version>
- <schema.openvswitch.version>1.2.0-SNAPSHOT</schema.openvswitch.version>
+ <ovsdb.utils.config.version>1.2.1-SNAPSHOT</ovsdb.utils.config.version>
+ <ovsdb.utils.mdsal.node.version>1.2.1-SNAPSHOT</ovsdb.utils.mdsal.node.version>
+ <ovsdb.utils.mdsal.openflow.version>1.2.1-SNAPSHOT</ovsdb.utils.mdsal.openflow.version>
+ <ovsdb.utils.servicehelper.version>1.2.1-SNAPSHOT</ovsdb.utils.servicehelper.version>
+ <plugin.shell.version>1.2.1-SNAPSHOT</plugin.shell.version>
+ <schema.hardwarevtep.version>1.2.1-SNAPSHOT</schema.hardwarevtep.version>
+ <schema.openvswitch.version>1.2.1-SNAPSHOT</schema.openvswitch.version>
<!-- Skip Coverage and IT by default -->
<skip.coverage>true</skip.coverage>
<skip.distribution>false</skip.distribution>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
- <version>${jacoco.version}</version>
<configuration>
<skip>${skip.coverage}</skip>
</configuration>
</parent>
<artifactId>parents</artifactId>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.2.1-SNAPSHOT</version>
<name>${project.artifactId}</name>
<packaging>pom</packaging>
<description>The OVSDB Plugin integration project is a project for OpenDaylight that will implement the Open vSwitch Database RFC 7047 management protocol allowing the Southbound configuration of vSwitches and a network virtualization implementation.</description>
<groupId>org.opendaylight.ovsdb</groupId>
<artifactId>features-ovsdb</artifactId>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.2.1-SNAPSHOT</version>
<packaging>jar</packaging>
<description>The OVSDB Plugin integration project is a project for OpenDaylight that will implement the Open vSwitch Database RFC 7047 management protocol allowing the Southbound configuration of vSwitches and a network virtualization implementation.</description>
<url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
<mdsal.version>1.3.0-SNAPSHOT</mdsal.version>
<io.netty.version>3.8.0.Final</io.netty.version>
<networkconfig.neutron.version>0.6.0-SNAPSHOT</networkconfig.neutron.version>
- <ovsdb.library.version>1.2.0-SNAPSHOT</ovsdb.library.version>
- <openstack.netvirt.version>1.2.0-SNAPSHOT</openstack.netvirt.version>
- <openstack.netvirt.providers.version>1.2.0-SNAPSHOT</openstack.netvirt.providers.version>
- <ovsdb.plugin.version>1.2.0-SNAPSHOT</ovsdb.plugin.version>
- <ovsdb.plugin.compatibility.layer.version>1.2.0-SNAPSHOT</ovsdb.plugin.compatibility.layer.version>
- <ovsdb.utils.servicehelper.version>1.2.0-SNAPSHOT</ovsdb.utils.servicehelper.version>
- <plugin.shell.version>1.2.0-SNAPSHOT</plugin.shell.version>
- <schema.hardwarevtep.version>1.2.0-SNAPSHOT</schema.hardwarevtep.version>
- <schema.openvswitch.version>1.2.0-SNAPSHOT</schema.openvswitch.version>
+ <ovsdb.library.version>1.2.1-SNAPSHOT</ovsdb.library.version>
+ <openstack.netvirt.version>1.2.1-SNAPSHOT</openstack.netvirt.version>
+ <openstack.netvirt.providers.version>1.2.1-SNAPSHOT</openstack.netvirt.providers.version>
+ <ovsdb.plugin.version>1.2.1-SNAPSHOT</ovsdb.plugin.version>
+ <ovsdb.plugin.compatibility.layer.version>1.2.1-SNAPSHOT</ovsdb.plugin.compatibility.layer.version>
+ <ovsdb.utils.servicehelper.version>1.2.1-SNAPSHOT</ovsdb.utils.servicehelper.version>
+ <plugin.shell.version>1.2.1-SNAPSHOT</plugin.shell.version>
+ <schema.hardwarevtep.version>1.2.1-SNAPSHOT</schema.hardwarevtep.version>
+ <schema.openvswitch.version>1.2.1-SNAPSHOT</schema.openvswitch.version>
<openflowplugin.version>0.2.0-SNAPSHOT</openflowplugin.version>
<sal.version>0.10.0-SNAPSHOT</sal.version>
<yangtools.version>0.8.0-SNAPSHOT</yangtools.version>
<dlux.core.version>0.3.0-SNAPSHOT</dlux.core.version>
<ovsdb.ui.version>0.1.0-SNAPSHOT</ovsdb.ui.version>
+ <config.version>0.4.0-SNAPSHOT</config.version>
</properties>
<dependencyManagement>
<classifier>features</classifier>
<type>xml</type>
</dependency>
- <dependency>
- <groupId>org.opendaylight.ovsdb</groupId>
- <artifactId>library</artifactId>
- <version>${ovsdb.library.version}</version>
- </dependency>
<dependency>
<groupId>org.opendaylight.ovsdb</groupId>
<artifactId>openstack.net-virt</artifactId>
<type>xml</type>
<classifier>features</classifier>
</dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>library-features</artifactId>
+ <version>${ovsdb.library.version}</version>
+ <type>xml</type>
+ <classifier>features</classifier>
+ </dependency>
</dependencies>
</project>
<repository>mvn:org.opendaylight.openflowplugin/features-openflowplugin-extension/${openflowplugin.version}/xml/features</repository>
<repository>mvn:org.opendaylight.openflowplugin/features-openflowplugin/${openflowplugin.version}/xml/features</repository>
<repository>mvn:org.opendaylight.neutron/features-neutron/${networkconfig.neutron.version}/xml/features</repository>
- <repository>mvn:org.opendaylight.ovsdb/southbound-features/1.2.0-SNAPSHOT/xml/features</repository>
+ <repository>mvn:org.opendaylight.ovsdb/southbound-features/1.2.1-SNAPSHOT/xml/features</repository>
<repository>mvn:org.opendaylight.controller/features-mdsal/${mdsal.version}/xml/features</repository>
+ <repository>mvn:org.opendaylight.ovsdb/library-features/${ovsdb.library.version}/xml/features</repository>
<feature name="odl-ovsdb-all" description="OpenDaylight :: OVSDB :: all"
version='${project.version}'>
<feature version="${ovsdb.plugin.version}">odl-ovsdb-plugin</feature>
</feature>
- <feature name="odl-ovsdb-library" description="OVSDB :: Library"
- version='${ovsdb.library.version}'>
- <bundle>mvn:org.osgi/org.osgi.compendium/${osgi.compendium.version}</bundle>
- <bundle>mvn:org.apache.felix/org.apache.felix.dependencymanager/${felix.dependencymanager.version}</bundle>
- <bundle>mvn:org.apache.felix/org.apache.felix.dependencymanager.shell/${felix.dependencymanager.shell.version}</bundle>
- <bundle>mvn:org.opendaylight.controller/dummy-console/1.3.0-SNAPSHOT</bundle>
- <bundle start="true">mvn:com.fasterxml.jackson.core/jackson-annotations/${jackson.version}</bundle>
- <bundle start="true">mvn:com.fasterxml.jackson.core/jackson-core/${jackson.version}</bundle>
- <bundle start="true">mvn:com.fasterxml.jackson.core/jackson-databind/${jackson.version}</bundle>
- <bundle start="true">mvn:com.google.guava/guava/${guava.version}</bundle>
- <bundle>wrap:mvn:io.netty/netty-buffer/${netty.version}</bundle>
- <bundle>wrap:mvn:io.netty/netty-codec/${netty.version}</bundle>
- <bundle>wrap:mvn:io.netty/netty-transport/${netty.version}</bundle>
- <bundle>wrap:mvn:io.netty/netty-common/${netty.version}</bundle>
- <bundle>wrap:mvn:io.netty/netty-handler/${netty.version}</bundle>
- <bundle>wrap:mvn:io.netty/netty-codec-http/${netty.version}</bundle>
- <bundle>mvn:io.netty/netty/${io.netty.version}</bundle>
- <bundle>mvn:org.apache.commons/commons-lang3/${commons.lang3.version}</bundle>
- <bundle>mvn:org.osgi/org.osgi.core/${osgi.core.version}</bundle>
- <bundle>mvn:com.google.code.gson/gson/${gson.version}</bundle>
- <bundle>mvn:org.opendaylight.ovsdb/library/${ovsdb.library.version}</bundle>
- </feature>
-
<feature name="odl-ovsdb-schema-openvswitch" description="OVSDB :: Schema :: Open_vSwitch"
version='${schema.openvswitch.version}'>
<feature version="${ovsdb.library.version}">odl-ovsdb-library</feature>
<feature version="${ovsdb.library.version}">odl-ovsdb-library</feature>
<feature version="${schema.openvswitch.version}">odl-ovsdb-schema-openvswitch</feature>
<feature version="${schema.hardwarevtep.version}">odl-ovsdb-schema-hardwarevtep</feature>
+ <bundle>mvn:org.apache.felix/org.apache.felix.dependencymanager/${felix.dependencymanager.version}</bundle>
+ <bundle>mvn:org.apache.felix/org.apache.felix.dependencymanager.shell/${felix.dependencymanager.shell.version}</bundle>
+ <bundle>mvn:org.osgi/org.osgi.compendium/${osgi.compendium.version}</bundle>
<bundle>mvn:org.opendaylight.ovsdb/plugin/${ovsdb.plugin.version}</bundle>
<bundle>mvn:org.opendaylight.ovsdb/plugin-shell/${plugin.shell.version}</bundle>
</feature>
<feature version='${mdsal.version}'>odl-mdsal-broker</feature>
<feature version="${openflowplugin.version}">odl-openflowplugin-nsf-model</feature>
<feature version="${networkconfig.neutron.version}">odl-neutron-service</feature>
- <feature version="1.2.0-SNAPSHOT">odl-ovsdb-southbound-impl-ui</feature>
+ <feature version="1.2.1-SNAPSHOT">odl-ovsdb-southbound-impl-ui</feature>
<feature version="${openflowplugin.version}">odl-openflowplugin-flow-services</feature>
<feature version="${openflowplugin.version}">odl-openflowplugin-nxm-extensions</feature>
<bundle>mvn:org.opendaylight.ovsdb/utils.servicehelper/${ovsdb.utils.servicehelper.version}</bundle>
</parent>
<artifactId>features</artifactId>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.2.1-SNAPSHOT</version>
<name>${project.artifactId}</name>
<packaging>pom</packaging>
<description>The OVSDB Plugin integration project is a project for OpenDaylight that will implement the Open vSwitch Database RFC 7047 management protocol allowing the Southbound configuration of vSwitches and a network virtualization implementation.</description>
<!-- Should be in a parent POM -->
<version>4.4.0</version>
</dependency>
- <dependency>
- <groupId>org.opendaylight.ovsdb</groupId>
- <artifactId>library</artifactId>
- </dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
- <version>${failsafe.version}</version>
<executions>
<execution>
<id>failsafe-integration-tests</id>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-container-native</artifactId>
</dependency>
- <dependency>
- <groupId>org.ops4j.pax.exam</groupId>
- <artifactId>pax-exam-container-karaf</artifactId>
- <scope>compile</scope>
- </dependency>
</dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-failsafe-plugin</artifactId>
- <version>${failsafe.version}</version>
- <configuration>
- </configuration>
- <executions>
- <execution>
- <id>failsafe-integration-tests</id>
- <phase>integration-test</phase>
- <goals>
- <goal>integration-test</goal>
- </goals>
- <configuration>
- <classpathDependencyExcludes>
- <classpathDependencyExcludes>org.ops4j.pax.exam:pax-exam-container-karaf</classpathDependencyExcludes>
- </classpathDependencyExcludes>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
</profile>
<profile>
<id>karafit</id>
);
}
- public static Option controllerNorthboundBundles() {
- return new DefaultCompositeOption(
- mavenBundle("org.slf4j", "log4j-over-slf4j").versionAsInProject(),
-
- // setting default level. Jersey bundles will need to be started
- // earlier.
- systemProperty("osgi.bundles.defaultStartLevel").value("4"),
- mavenBundle("com.fasterxml.jackson.jaxrs", "jackson-jaxrs-base").versionAsInProject(),
- mavenBundle("com.fasterxml.jackson.jaxrs", "jackson-jaxrs-json-provider").versionAsInProject(),
- mavenBundle("com.fasterxml.jackson.module", "jackson-module-jaxb-annotations").versionAsInProject(),
- mavenBundle("com.sun.jersey", "jersey-client").versionAsInProject(),
- mavenBundle("com.sun.jersey", "jersey-core").versionAsInProject().startLevel(2),
- mavenBundle("com.sun.jersey", "jersey-server").versionAsInProject().startLevel(2),
- mavenBundle("commons-codec", "commons-codec").versionAsInProject(),
- mavenBundle("commons-fileupload", "commons-fileupload").versionAsInProject(),
- mavenBundle("commons-io", "commons-io").versionAsInProject(),
- mavenBundle("eclipselink", "javax.persistence").versionAsInProject(),
- mavenBundle("equinoxSDK381", "javax.servlet.jsp").versionAsInProject(),
- mavenBundle("equinoxSDK381", "org.eclipse.equinox.cm").versionAsInProject(),
- mavenBundle("equinoxSDK381", "org.eclipse.equinox.launcher").versionAsInProject(),
- mavenBundle("equinoxSDK381", "org.eclipse.osgi.services").versionAsInProject(),
- mavenBundle("geminiweb", "org.eclipse.gemini.web.core").versionAsInProject(),
- mavenBundle("geminiweb", "org.eclipse.gemini.web.extender").versionAsInProject(),
- mavenBundle("geminiweb", "org.eclipse.gemini.web.tomcat").versionAsInProject(),
- mavenBundle("geminiweb", "org.eclipse.virgo.kernel.equinox.extensions").versionAsInProject().noStart(),
- mavenBundle("geminiweb", "org.eclipse.virgo.util.common").versionAsInProject(),
- mavenBundle("geminiweb", "org.eclipse.virgo.util.io").versionAsInProject(),
- mavenBundle("geminiweb", "org.eclipse.virgo.util.math").versionAsInProject(),
- mavenBundle("geminiweb", "org.eclipse.virgo.util.osgi").versionAsInProject(),
- mavenBundle("geminiweb", "org.eclipse.virgo.util.osgi.manifest").versionAsInProject(),
- mavenBundle("geminiweb", "org.eclipse.virgo.util.parser.manifest").versionAsInProject(),
- mavenBundle("orbit", "javax.activation").versionAsInProject(),
- mavenBundle("orbit", "javax.annotation").versionAsInProject(),
- mavenBundle("orbit", "javax.ejb").versionAsInProject(),
- mavenBundle("orbit", "javax.el").versionAsInProject(),
- mavenBundle("orbit", "javax.mail.glassfish").versionAsInProject(),
- mavenBundle("orbit", "javax.servlet.jsp.jstl").versionAsInProject(),
- mavenBundle("orbit", "javax.servlet.jsp.jstl.impl").versionAsInProject(),
- mavenBundle("orbit", "javax.xml.rpc").versionAsInProject(),
- mavenBundle("orbit", "javax.xml.rpc").versionAsInProject(),
- mavenBundle("orbit", "org.apache.catalina").versionAsInProject(),
- mavenBundle("orbit", "org.apache.catalina.ha").versionAsInProject().noStart(),
- mavenBundle("orbit", "org.apache.catalina.tribes").versionAsInProject().noStart(),
- mavenBundle("orbit", "org.apache.coyote").versionAsInProject().noStart(),
- mavenBundle("orbit", "org.apache.el").versionAsInProject(),
- mavenBundle("orbit", "org.apache.jasper").versionAsInProject().noStart(),
- mavenBundle("orbit", "org.apache.juli.extras").versionAsInProject(),
- mavenBundle("orbit", "org.apache.tomcat.api").versionAsInProject(),
- mavenBundle("orbit", "org.apache.tomcat.util").versionAsInProject().noStart(),
- mavenBundle("org.aopalliance", "com.springsource.org.aopalliance").versionAsInProject(),
- mavenBundle("org.apache.felix", "org.apache.felix.fileinstall").versionAsInProject(),
- mavenBundle("org.codehaus.jettison", "jettison").versionAsInProject(),
- mavenBundle("org.jboss.spec.javax.transaction", "jboss-transaction-api_1.1_spec").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "clustering.services").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "clustering.services-implementation").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "configuration").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "containermanager").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "containermanager.it.implementation").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "sal").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "sal.implementation").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "bundlescanner").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "bundlescanner.implementation").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "commons.httpclient").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "commons.northbound").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "configuration.implementation").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "flowprogrammer.northbound").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "forwarding.staticrouting").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "forwarding.staticrouting.northbound").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "forwardingrulesmanager").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "hosttracker").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "hosttracker.implementation").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "hosttracker.northbound").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "logging.bridge").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "routing.dijkstra_implementation").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "security").versionAsInProject().noStart(),
- mavenBundle("org.opendaylight.controller", "statistics.northbound").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "statisticsmanager").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "subnets.northbound").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "switchmanager").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "switchmanager.implementation").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "switchmanager.northbound").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "topology.northbound").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "topologymanager").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "usermanager").versionAsInProject(),
- mavenBundle("org.opendaylight.controller", "usermanager.implementation").versionAsInProject(),
- mavenBundle("org.opendaylight.controller.thirdparty", "com.sun.jersey.jersey-servlet").versionAsInProject(),
- mavenBundle("org.opendaylight.controller.thirdparty", "net.sf.jung2").versionAsInProject(),
- mavenBundle("org.opendaylight.controller.thirdparty", "org.apache.catalina.filters.CorsFilter").versionAsInProject().noStart(),
- mavenBundle("org.ow2.asm", "asm-all").versionAsInProject(),
- mavenBundle("org.ow2.chameleon.management", "chameleon-mbeans").versionAsInProject(),
- mavenBundle("org.slf4j", "jcl-over-slf4j").versionAsInProject(),
- mavenBundle("org.slf4j", "slf4j-api").versionAsInProject(),
- mavenBundle("org.springframework", "org.springframework.aop").versionAsInProject(),
- mavenBundle("org.springframework", "org.springframework.asm").versionAsInProject(),
- mavenBundle("org.springframework", "org.springframework.beans").versionAsInProject(),
- mavenBundle("org.springframework", "org.springframework.context").versionAsInProject(),
- mavenBundle("org.springframework", "org.springframework.context.support").versionAsInProject(),
- mavenBundle("org.springframework", "org.springframework.core").versionAsInProject(),
- mavenBundle("org.springframework", "org.springframework.expression").versionAsInProject(),
- mavenBundle("org.springframework", "org.springframework.transaction").versionAsInProject(),
- mavenBundle("org.springframework", "org.springframework.web").versionAsInProject(),
- mavenBundle("org.springframework", "org.springframework.web.servlet").versionAsInProject(),
- mavenBundle("org.springframework.security", "spring-security-config").versionAsInProject(),
- mavenBundle("org.springframework.security", "spring-security-core").versionAsInProject(),
- mavenBundle("org.springframework.security", "spring-security-taglibs").versionAsInProject(),
- mavenBundle("org.springframework.security", "spring-security-web").versionAsInProject(),
- mavenBundle("virgomirror", "org.eclipse.jdt.core.compiler.batch").versionAsInProject(),
- mavenBundle("org.yaml", "snakeyaml").versionAsInProject()
- );
- }
-
- public static Option ovsdbLibraryBundles() {
+ public static Option ovsdbLibraryBundles() {
return new DefaultCompositeOption(
mavenBundle("io.netty", "netty-buffer").versionAsInProject(),
mavenBundle("io.netty", "netty-codec").versionAsInProject(),
);
}
- public static Option ovsdbNeutronBundles() {
- return new DefaultCompositeOption(
- mavenBundle("commons-net", "commons-net").versionAsInProject(),
- mavenBundle("org.opendaylight.neutron", "neutron-spi").versionAsInProject(),
- mavenBundle("org.opendaylight.ovsdb", "openstack.net-virt").versionAsInProject()
- );
- }
-
- public static Option mdsalBundles() {
+ public static Option mdsalBundles() {
return new DefaultCompositeOption(
TestHelper.configMinumumBundles(),
TestHelper.baseModelBundles(),
TestHelper.flowCapableModelBundles(),
- TestHelper.junitAndMockitoBundles()
+ TestHelper.junitAndMockitoBundles(),
+ TestHelper.bindingAwareSalBundles()
);
}
}
*/
package org.opendaylight.ovsdb.integrationtest;
-import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.IOException;
-import java.net.InetAddress;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
-import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.opendaylight.ovsdb.utils.servicehelper.ServiceHelper;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
-import org.opendaylight.ovsdb.lib.OvsdbClient;
-import org.opendaylight.ovsdb.lib.OvsdbConnection;
-import org.opendaylight.ovsdb.lib.OvsdbConnectionListener;
import org.opendaylight.ovsdb.plugin.api.ConnectionConstants;
import org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService;
protected final static String DEFAULT_SERVER_PORT = "6640";
private static boolean bundlesReady = false;
- public final static String OPEN_VSWITCH_SCHEMA = "Open_vSwitch";
- public final static String HARDWARE_VTEP = "hardware_vtep";
public Properties loadProperties() {
- Properties props = new Properties(System.getProperties());
- return props;
+ return System.getProperties();
}
public Node getPluginTestConnection() throws IOException, InterruptedException, ExecutionException, TimeoutException {
fail(usage());
}
- Map<ConnectionConstants, String> params = new HashMap<ConnectionConstants, String>();
+ Map<ConnectionConstants, String> params = new HashMap<>();
params.put(ConnectionConstants.ADDRESS, addressStr);
params.put(ConnectionConstants.PORT, portStr);
node = connection.connect(IDENTIFIER, params);
return node;
}
- public OvsdbClient getTestConnection() throws IOException, InterruptedException, ExecutionException, TimeoutException {
- Properties props = loadProperties();
- String addressStr = props.getProperty(SERVER_IPADDRESS);
- String portStr = props.getProperty(SERVER_PORT, DEFAULT_SERVER_PORT);
- String connectionType = props.getProperty(CONNECTION_TYPE, "active");
-
- // If the connection type is active, controller connects to the ovsdb-server
- if (connectionType.equalsIgnoreCase(CONNECTION_TYPE_ACTIVE)) {
- if (addressStr == null) {
- fail(usage());
- }
-
- InetAddress address;
- try {
- address = InetAddress.getByName(addressStr);
- } catch (Exception e) {
- System.out.println("Unable to resolve " + addressStr);
- e.printStackTrace();
- return null;
- }
-
- Integer port;
- try {
- port = Integer.parseInt(portStr);
- } catch (NumberFormatException e) {
- System.out.println("Invalid port number : " + portStr);
- e.printStackTrace();
- return null;
- }
-
- OvsdbConnection connection = (OvsdbConnection)ServiceHelper.getGlobalInstance(OvsdbConnection.class, this);
- return connection.connect(address, port);
- } else if (connectionType.equalsIgnoreCase(CONNECTION_TYPE_PASSIVE)) {
- ExecutorService executor = Executors.newFixedThreadPool(1);
- Future<OvsdbClient> passiveConnection = executor.submit(new PassiveListener());
- return passiveConnection.get(60, TimeUnit.SECONDS);
- }
- fail("Connection parameter ("+CONNECTION_TYPE+") must be either active or passive");
- return null;
- }
-
protected String usage() {
return "Integration Test needs a valid connection configuration as follows :\n" +
"active connection : mvn -Pintegrationtest -Dovsdbserver.ipaddress=x.x.x.x -Dovsdbserver.port=yyyy verify\n"+
"passive connection : mvn -Pintegrationtest -Dovsdbserver.connection=passive verify\n";
}
- public class PassiveListener implements Callable<OvsdbClient>, OvsdbConnectionListener {
- OvsdbClient client = null;
- @Override
- public OvsdbClient call() throws Exception {
- OvsdbConnection connection = (OvsdbConnection)ServiceHelper.getGlobalInstance(OvsdbConnection.class, this);
- connection.registerConnectionListener(this);
- while (client == null) {
- Thread.sleep(500);
- }
- return client;
- }
-
- @Override
- public void connected(OvsdbClient client) {
- this.client = client;
- }
-
- @Override
- public void disconnected(OvsdbClient client) {
- assertEquals(this.client.getConnectionInfo(), client.getConnectionInfo());
- this.client = null;
- }
- }
-
public String stateToString(int state) {
switch (state) {
case Bundle.ACTIVE:
import static org.ops4j.pax.exam.CoreOptions.systemProperty;
import org.junit.After;
+import org.junit.Ignore;
import org.opendaylight.ovsdb.integrationtest.ConfigurationBundles;
import org.opendaylight.ovsdb.integrationtest.OvsdbIntegrationTestBase;
import org.opendaylight.ovsdb.lib.OvsdbClient;
import javax.inject.Inject;
+@Ignore
@RunWith(PaxExam.class)
public class OvsdbPluginIT extends OvsdbIntegrationTestBase {
private static final Logger LOG = LoggerFactory.getLogger(OvsdbPluginIT.class);
import org.apache.felix.dm.Component;
import org.apache.felix.dm.DependencyManager;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Sets;
+@Ignore
@RunWith(PaxExam.class)
@ExamReactorStrategy(PerSuite.class)
public class OvsdbPluginV3IT extends OvsdbIntegrationTestBase {
<groupId>org.opendaylight.ovsdb</groupId>
<artifactId>karaf</artifactId>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.2.1-SNAPSHOT</version>
<name>${project.artifactId}</name>
<prerequisites>
<maven>3.1.1</maven>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright © 2015 Red Hat, Inc. and others. All rights reserved.
+
+This program and the accompanying materials are made available under the
+terms of the Eclipse Public License v1.0 which accompanies this distribution,
+and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.opendaylight.ovsdb</groupId>
+ <artifactId>library-artifacts</artifactId>
+ <version>1.2.1-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>library</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>library-features</artifactId>
+ <version>${project.version}</version>
+ <classifier>features</classifier>
+ <type>xml</type>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+</project>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright © 2015 Red Hat, Inc. and others. All rights reserved. and others. All rights reserved.
+This program and the accompanying materials are made available under the
+terms of the Eclipse Public License v1.0 which accompanies this distribution,
+and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.opendaylight.odlparent</groupId>
+ <artifactId>features-parent</artifactId>
+ <version>1.6.0-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+ <groupId>org.opendaylight.ovsdb</groupId>
+ <artifactId>library-features</artifactId>
+ <version>1.2.1-SNAPSHOT</version>
+ <name>${project.artifactId}</name>
+ <modelVersion>4.0.0</modelVersion>
+ <prerequisites>
+ <maven>3.1.1</maven>
+ </prerequisites>
+ <properties>
+ <mdsal.version>1.3.0-SNAPSHOT</mdsal.version>
+ <yangtools.version>0.8.0-SNAPSHOT</yangtools.version>
+ <dlux.version>0.3.0-SNAPSHOT</dlux.version>
+ <configfile.directory>etc/opendaylight/karaf</configfile.directory>
+ </properties>
+ <dependencyManagement>
+ <dependencies>
+ <!-- project specific dependencies -->
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>mdsal-artifacts</artifactId>
+ <version>${mdsal.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>features-yangtools</artifactId>
+ <classifier>features</classifier>
+ <version>${yangtools.version}</version>
+ <type>xml</type>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>features-mdsal</artifactId>
+ <classifier>features</classifier>
+ <version>${mdsal.version}</version>
+ <type>xml</type>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>features-restconf</artifactId>
+ <classifier>features</classifier>
+ <version>${mdsal.version}</version>
+ <type>xml</type>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.dlux</groupId>
+ <artifactId>features-dlux</artifactId>
+ <classifier>features</classifier>
+ <version>${dlux.version}</version>
+ <type>xml</type>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>library</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>library</artifactId>
+ <version>${project.version}</version>
+ <type>xml</type>
+ <classifier>config</classifier>
+ </dependency>
+ </dependencies>
+</project>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+Copyright © 2015 Red Hat, Inc. and others. All rights reserved.
+
+This program and the accompanying materials are made available under the
+terms of the Eclipse Public License v1.0 which accompanies this distribution,
+and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<features name="odl-ovsdb-library-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
+ <repository>mvn:org.opendaylight.yangtools/features-yangtools/${yangtools.version}/xml/features</repository>
+ <repository>mvn:org.opendaylight.controller/features-mdsal/${mdsal.version}/xml/features</repository>
+ <repository>mvn:org.opendaylight.controller/features-restconf/${mdsal.version}/xml/features</repository>
+ <repository>mvn:org.opendaylight.dlux/features-dlux/${dlux.version}/xml/features</repository>
+ <feature name='odl-ovsdb-library' version='${project.version}' description='OpenDaylight :: library'>
+ <feature version='${mdsal.version}'>odl-mdsal-broker</feature>
+ <feature version='${yangtools.version}'>odl-yangtools-models</feature>
+ <bundle>mvn:org.opendaylight.ovsdb/library/${project.version}</bundle>
+ <!-- Test only (move to another feature) -->
+ <bundle>mvn:org.opendaylight.ovsdb/utils.servicehelper/${project.version}</bundle>
+ <bundle>mvn:org.opendaylight.ovsdb/schema.openvswitch/${project.version}</bundle>
+ <!-- Test only ends -->
+ <bundle start="true">mvn:com.fasterxml.jackson.core/jackson-annotations/${jackson.version}</bundle>
+ <bundle start="true">mvn:com.fasterxml.jackson.core/jackson-core/${jackson.version}</bundle>
+ <bundle start="true">mvn:com.fasterxml.jackson.core/jackson-databind/${jackson.version}</bundle>
+ <configfile finalname="${configfile.directory}/library.xml">mvn:org.opendaylight.ovsdb/library/${project.version}/xml/config</configfile>
+ </feature>
+</features>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: --><!--
+Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+
+This program and the accompanying materials are made available under the
+terms of the Eclipse Public License v1.0 which accompanies this distribution,
+and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <parent>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>config-parent</artifactId>
+ <version>0.4.0-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.opendaylight.ovsdb</groupId>
+ <artifactId>library</artifactId>
+ <version>1.2.1-SNAPSHOT</version>
+ <packaging>bundle</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-all</artifactId>
+ <version>4.0.26.Final</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>config-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-api</artifactId>
+ </dependency>
+
+ <!-- Testing Dependencies -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <testResources>
+ <testResource>
+ <filtering>true</filtering>
+ <directory>src/test/resources</directory>
+ </testResource>
+ </testResources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.jacoco</groupId>
+ <artifactId>jacoco-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+Copyright © 2015 Red Hat, Inc. and others. All rights reserved.
+
+This program and the accompanying materials are made available under the
+terms of the Eclipse Public License v1.0 which accompanies this distribution,
+and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<snapshot>
+ <required-capabilities>
+ <capability>urn:opendaylight:params:xml:ns:yang:library:impl?module=library&revision=2014-12-10</capability>
+ <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding?module=opendaylight-md-sal-binding&revision=2013-10-28</capability>
+ </required-capabilities>
+ <configuration>
+
+ <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+ <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
+ <module>
+ <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:library:impl">prefix:library</type>
+ <name>library-default</name>
+ <broker>
+ <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-broker-osgi-registry</type>
+ <name>binding-osgi-broker</name>
+ </broker>
+ </module>
+ </modules>
+ </data>
+ </configuration>
+</snapshot>
--- /dev/null
+/*
+ * Copyright © 2015 Red Hat, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.ovsdb.lib;
+
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
+import org.opendaylight.ovsdb.lib.impl.OvsdbConnectionService;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * "Configuration" activator for the OVSDB library.
+ */
+public class ConfigActivator implements BundleActivator {
+ /**
+ * Logger.
+ */
+ private static final Logger LOG = LoggerFactory.getLogger(ConfigActivator.class);
+
+ /**
+ * Parent provider context.
+ */
+ private final BindingAwareBroker.ProviderContext providerContext;
+
+ /**
+ * Creates an instance of the activator.
+ *
+ * @param providerContext The parent provider context.
+ */
+ public ConfigActivator(BindingAwareBroker.ProviderContext providerContext) {
+ LOG.info("OVSDB library ConfigActivator created.");
+ this.providerContext = providerContext;
+ }
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ LOG.info("OVSDB library ConfigActivator starting.");
+ context.registerService(OvsdbConnection.class, new OvsdbConnectionService(), null);
+ // TODO Need to indicate that OvsdbConnectionListeners should register with the connection service
+ // (if I've understood correctly, the old dependency manager would call registerConnectionListener()
+ // whenever an instance of OvsdbConnection is retrieved, and unregisterConnectionListener() when it
+ // is no longer used)
+ // (All current users register manually...)
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ LOG.info("OVSDB library ConfigActivator stopping.");
+ }
+}
--- /dev/null
+/*
+ * Copyright © 2015 Red Hat, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.ovsdb.lib.impl;
+
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
+import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
+import org.opendaylight.ovsdb.lib.ConfigActivator;
+import org.opendaylight.ovsdb.lib.OvsdbConnection;
+import org.osgi.framework.BundleContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class LibraryProvider implements BindingAwareProvider, AutoCloseable {
+
+ private static final Logger LOG = LoggerFactory.getLogger(LibraryProvider.class);
+ private final BundleContext bundleContext;
+ private DataBroker dataBroker;
+ private ConfigActivator activator;
+
+ public LibraryProvider(BundleContext bundleContext) {
+ LOG.info("LibraryProvider: bundleContext: {}", bundleContext);
+ this.bundleContext = bundleContext;
+ }
+
+ @Override
+ public void onSessionInitiated(ProviderContext providerContext) {
+ LOG.info("LibraryProvider Session Initiated");
+ dataBroker = providerContext.getSALService(DataBroker.class);
+ LOG.info("LibraryProvider: onSessionInitiated dataBroker: {}", dataBroker);
+ this.activator = new ConfigActivator(providerContext);
+ try {
+ activator.start(bundleContext);
+ } catch (Exception e) {
+ LOG.warn("Failed to start LibraryProvider: ", e);
+ }
+ }
+
+ @Override
+ public void close() throws Exception {
+ LOG.info("LibraryProvider Closed");
+ if (activator != null) {
+ activator.stop(bundleContext);
+ }
+ }
+
+}
--- /dev/null
+/*
+ * Copyright © 2015 Red Hat, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.library.impl.rev141210;
+
+import org.opendaylight.controller.config.api.DependencyResolver;
+import org.opendaylight.controller.config.api.ModuleIdentifier;
+import org.opendaylight.ovsdb.lib.impl.LibraryProvider;
+import org.osgi.framework.BundleContext;
+
+import com.google.common.base.Preconditions;
+
+public class LibraryModule extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.library.impl.rev141210.AbstractLibraryModule {
+ private BundleContext bundleContext;
+
+ public LibraryModule(ModuleIdentifier identifier, DependencyResolver dependencyResolver) {
+ super(identifier, dependencyResolver);
+ }
+
+ public LibraryModule(ModuleIdentifier identifier, DependencyResolver dependencyResolver, LibraryModule oldModule, AutoCloseable oldInstance) {
+ super(identifier, dependencyResolver, oldModule, oldInstance);
+ }
+
+ @Override
+ public void customValidation() {
+ // add custom validation form module attributes here.
+ Preconditions.checkNotNull(bundleContext);
+ }
+
+ @Override
+ public java.lang.AutoCloseable createInstance() {
+ LibraryProvider provider = new LibraryProvider(bundleContext);
+ getBrokerDependency().registerProvider(provider);
+ return provider;
+ }
+
+ public void setBundleContext(BundleContext bundleContext) {
+ this.bundleContext = bundleContext;
+ }
+}
--- /dev/null
+/*
+ * Copyright © 2015 Red Hat, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+/*
+* Generated file
+*
+* Generated from: yang module name: library yang module local name: library
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Fri Jan 02 13:49:24 CST 2015
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.library.impl.rev141210;
+
+import org.opendaylight.controller.config.api.DependencyResolver;
+import org.osgi.framework.BundleContext;
+
+public class LibraryModuleFactory extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.library.impl.rev141210.AbstractLibraryModuleFactory {
+ @Override
+ public LibraryModule instantiateModule(String instanceName, DependencyResolver dependencyResolver, BundleContext bundleContext) {
+ LibraryModule module = super.instantiateModule(instanceName, dependencyResolver, bundleContext);
+ module.setBundleContext(bundleContext);
+ return module;
+ }
+
+ @Override
+ public LibraryModule instantiateModule(String instanceName, DependencyResolver dependencyResolver, LibraryModule oldModule, AutoCloseable oldInstance, BundleContext bundleContext) {
+ LibraryModule module = super.instantiateModule(instanceName, dependencyResolver, oldModule, oldInstance, bundleContext);
+ module.setBundleContext(bundleContext);
+ return module;
+ }
+}
--- /dev/null
+module library {
+ yang-version 1;
+ namespace "urn:opendaylight:params:xml:ns:yang:library:impl";
+ prefix "library";
+
+ import config { prefix config; revision-date 2013-04-05; }
+ import opendaylight-md-sal-binding { prefix md-sal-binding; revision-date 2013-10-28;}
+
+ description
+ "Service definition for library project";
+
+ revision "2014-12-10" {
+ description
+ "Initial revision";
+ }
+
+ identity library {
+ base config:module-type;
+ config:java-name-prefix Library;
+ }
+
+ augment "/config:modules/config:module/config:configuration" {
+ case library {
+ when "/config:modules/config:module/config:type = 'library'";
+ container broker {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity md-sal-binding:binding-broker-osgi-registry;
+ }
+ }
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright © 2015 Red Hat, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.library.impl.rev141210;
+
+import org.junit.Test;
+
+public class LibraryModuleFactoryTest {
+ @Test
+ public void testFactoryConstructor() {
+ // ensure no exceptions on construction
+ new LibraryModuleFactory();
+ }
+}
--- /dev/null
+/*
+ * Copyright © 2015 Red Hat, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.library.impl.rev141210;
+
+import org.junit.Test;
+import org.opendaylight.controller.config.api.DependencyResolver;
+import org.opendaylight.controller.config.api.JmxAttribute;
+import org.opendaylight.controller.config.api.ModuleIdentifier;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
+import org.opendaylight.ovsdb.lib.impl.LibraryProvider;
+import org.osgi.framework.BundleContext;
+
+import javax.management.ObjectName;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+public class LibraryModuleTest {
+ @Test
+ public void testCustomValidation() {
+ LibraryModule module = new LibraryModule(mock(ModuleIdentifier.class), mock(DependencyResolver.class));
+ module.setBundleContext(mock(BundleContext.class));
+
+ // ensure no exceptions on validation
+ // currently this method is empty
+ module.customValidation();
+ }
+
+ // TODO Need to migrate all users to SAL RPC
+ @Test
+ public void testCreateInstance() throws Exception {
+ // configure mocks
+ DependencyResolver dependencyResolver = mock(DependencyResolver.class);
+ BindingAwareBroker broker = mock(BindingAwareBroker.class);
+ when(dependencyResolver.resolveInstance(eq(BindingAwareBroker.class), any(ObjectName.class), any(JmxAttribute.class))).thenReturn(broker);
+
+ // create instance of module with injected mocks
+ LibraryModule module = new LibraryModule(mock(ModuleIdentifier.class), dependencyResolver);
+ module.setBundleContext(mock(BundleContext.class));
+
+ // getInstance calls resolveInstance to get the broker dependency and then calls createInstance
+ AutoCloseable closeable = module.getInstance();
+
+ // verify that the module registered the returned provider with the broker
+ verify(broker).registerProvider((LibraryProvider)closeable);
+
+ // ensure no exceptions on close
+ closeable.close();
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright © 2015 Red Hat, Inc. and others. All rights reserved.
+
+This program and the accompanying materials are made available under the
+terms of the Eclipse Public License v1.0 which accompanies this distribution,
+and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <parent>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>mdsal-it-parent</artifactId>
+ <version>1.3.0-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.opendaylight.ovsdb</groupId>
+ <artifactId>library-it</artifactId>
+ <version>1.2.1-SNAPSHOT</version>
+ <packaging>bundle</packaging>
+
+ <properties>
+ <karaf.distro.groupId>org.opendaylight.ovsdb</karaf.distro.groupId>
+ <karaf.distro.artifactId>library-karaf</karaf.distro.artifactId>
+ <karaf.distro.version>1.2.1-SNAPSHOT</karaf.distro.version>
+ <karaf.distro.type>zip</karaf.distro.type>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>library-features</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.ovsdb</groupId>
+ <artifactId>schema.openvswitch</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.ovsdb</groupId>
+ <artifactId>schema.hardwarevtep</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.ovsdb</groupId>
+ <artifactId>library</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.ovsdb</groupId>
+ <artifactId>utils.servicehelper</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <properties>
+ <skipITs>true</skipITs>
+ </properties>
+ </profile>
+ <profile>
+ <id>integrationtest</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <properties>
+ <skipITs>false</skipITs>
+ </properties>
+ </profile>
+ </profiles>
+
+</project>
\ No newline at end of file
import static org.junit.Assert.fail;
import static org.junit.Assume.assumeTrue;
import static org.opendaylight.ovsdb.lib.operations.Operations.op;
-import static org.ops4j.pax.exam.CoreOptions.junitBundles;
-import static org.ops4j.pax.exam.CoreOptions.options;
-import static org.ops4j.pax.exam.CoreOptions.propagateSystemProperty;
-import static org.ops4j.pax.exam.CoreOptions.systemProperty;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.opendaylight.ovsdb.integrationtest.ConfigurationBundles;
-import org.opendaylight.ovsdb.integrationtest.OvsdbIntegrationTestBase;
import org.opendaylight.ovsdb.lib.MonitorCallBack;
import org.opendaylight.ovsdb.lib.OvsdbClient;
+import org.opendaylight.ovsdb.lib.it.LibraryIntegrationTestBase;
+import org.opendaylight.ovsdb.lib.it.LibraryIntegrationTestUtils;
import org.opendaylight.ovsdb.lib.message.MonitorRequest;
import org.opendaylight.ovsdb.lib.message.MonitorRequestBuilder;
import org.opendaylight.ovsdb.lib.message.MonitorSelect;
import org.opendaylight.ovsdb.schema.hardwarevtep.Global;
import org.opendaylight.ovsdb.schema.hardwarevtep.Manager;
import org.opendaylight.ovsdb.schema.openvswitch.OpenVSwitch;
-import org.ops4j.pax.exam.Configuration;
-import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.PaxExam;
import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
import org.ops4j.pax.exam.spi.reactors.PerSuite;
-import org.ops4j.pax.exam.util.PathUtils;
import org.osgi.framework.BundleContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@RunWith(PaxExam.class)
@ExamReactorStrategy(PerSuite.class)
-public class HardwareVTEPIT extends OvsdbIntegrationTestBase {
+public class HardwareVTEPIT extends LibraryIntegrationTestBase {
private static final Logger LOG = LoggerFactory.getLogger(HardwareVTEPIT.class);
private static boolean monitorReady = false;
private static boolean schemaSupported = false;
@Inject
private BundleContext bc;
- @Configuration
- public Option[] config() throws Exception {
- return options(
- systemProperty("logback.configurationFile").value(
- "file:" + PathUtils.getBaseDir()
- + "/src/test/resources/logback.xml"
- ),
- // To start OSGi console for inspection remotely
- systemProperty("osgi.console").value("2401"),
-
- propagateSystemProperty("ovsdbserver.ipaddress"),
- propagateSystemProperty("ovsdbserver.port"),
-
- ConfigurationBundles.mdsalBundles(),
- ConfigurationBundles.controllerBundles(),
- ConfigurationBundles.ovsdbLibraryBundles(),
- ConfigurationBundles.ovsdbDefaultSchemaBundles()
- );
- }
-
@Before
- public void setUp () throws ExecutionException, InterruptedException, IOException {
- areWeReady(bc);
- assumeTrue(HARDWARE_VTEP + " is required.", checkSchema(HARDWARE_VTEP));
+ public void set() throws Exception {
+ super.setup();
+ assumeTrue(LibraryIntegrationTestUtils.HARDWARE_VTEP + " is required.", checkSchema(LibraryIntegrationTestUtils.HARDWARE_VTEP));
assertTrue("Failed to monitor tables", monitorTables());
- LOG.info("{} schema version = {}", OPEN_VSWITCH_SCHEMA,
- getClient().getDatabaseSchema(OPEN_VSWITCH_SCHEMA).getVersion());
+ LOG.info("{} schema version = {}", LibraryIntegrationTestUtils.OPEN_VSWITCH_SCHEMA,
+ getClient().getDatabaseSchema(LibraryIntegrationTestUtils.OPEN_VSWITCH_SCHEMA).getVersion());
}
public boolean checkSchema (String schema) {
return true;
}
try {
- ovsdbClient = getTestConnection();
+ ovsdbClient = LibraryIntegrationTestUtils.getTestConnection(this);
assertNotNull("Invalid Client. Check connection params", ovsdbClient);
//Thread.sleep(3000); // Wait for a few seconds to get the Schema exchange done
if (isSchemaSupported(ovsdbClient, schema)) {
ListenableFuture<List<String>> databases = client.getDatabases();
List<String> dbNames = databases.get();
assertNotNull(dbNames);
- if (dbNames.contains(schema)) {
- return true;
- } else {
- return false;
- }
+ return dbNames.contains(schema);
}
/**
*/
public void managerInsert () throws ExecutionException, InterruptedException {
//Ensure test only proceeds if HW VTEP is supported
- assumeTrue(isSchemaSupported(getClient(), HARDWARE_VTEP));
+ assumeTrue(isSchemaSupported(getClient(), LibraryIntegrationTestUtils.HARDWARE_VTEP));
//proceed only if schema was already retrieved successfully
Assert.assertNotNull(getDbSchema());
}
public void managerDelete () throws ExecutionException, InterruptedException {
- assumeTrue(isSchemaSupported(getClient(), HARDWARE_VTEP));
+ assumeTrue(isSchemaSupported(getClient(), LibraryIntegrationTestUtils.HARDWARE_VTEP));
Manager manager = getClient().getTypedRowWrapper(Manager.class, null);
Global global = getClient().getTypedRowWrapper(Global.class, null);
import static org.junit.Assert.fail;
import static org.junit.Assume.assumeTrue;
import static org.opendaylight.ovsdb.lib.operations.Operations.op;
-import static org.ops4j.pax.exam.CoreOptions.junitBundles;
-import static org.ops4j.pax.exam.CoreOptions.options;
-import static org.ops4j.pax.exam.CoreOptions.propagateSystemProperty;
-import static org.ops4j.pax.exam.CoreOptions.systemProperty;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.opendaylight.ovsdb.integrationtest.ConfigurationBundles;
-import org.opendaylight.ovsdb.integrationtest.OvsdbIntegrationTestBase;
import org.opendaylight.ovsdb.lib.MonitorCallBack;
import org.opendaylight.ovsdb.lib.OvsdbClient;
import org.opendaylight.ovsdb.lib.error.SchemaVersionMismatchException;
+import org.opendaylight.ovsdb.lib.it.LibraryIntegrationTestBase;
+import org.opendaylight.ovsdb.lib.it.LibraryIntegrationTestUtils;
import org.opendaylight.ovsdb.lib.message.MonitorRequest;
import org.opendaylight.ovsdb.lib.message.MonitorRequestBuilder;
import org.opendaylight.ovsdb.lib.message.MonitorSelect;
import org.opendaylight.ovsdb.schema.openvswitch.Queue;
import org.opendaylight.ovsdb.schema.openvswitch.SFlow;
import org.opendaylight.ovsdb.schema.openvswitch.SSL;
-import org.ops4j.pax.exam.Configuration;
-import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.PaxExam;
import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
import org.ops4j.pax.exam.spi.reactors.PerSuite;
-import org.ops4j.pax.exam.util.PathUtils;
+import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@RunWith(PaxExam.class)
@ExamReactorStrategy(PerSuite.class)
-public class OpenVSwitchIT extends OvsdbIntegrationTestBase {
+public class OpenVSwitchIT extends LibraryIntegrationTestBase {
private static final Logger LOG = LoggerFactory.getLogger(OpenVSwitchIT.class);
private static boolean monitorReady = false;
private static boolean schemaSupported = false;
@Inject
private BundleContext bc;
- @Configuration
- public Option[] config() throws Exception {
- return options(
- systemProperty("logback.configurationFile").value(
- "file:" + PathUtils.getBaseDir()
- + "/src/test/resources/logback.xml"
- ),
- // To start OSGi console for inspection remotely
- systemProperty("osgi.console").value("2401"),
-
- propagateSystemProperty("ovsdbserver.ipaddress"),
- propagateSystemProperty("ovsdbserver.port"),
-
- ConfigurationBundles.mdsalBundles(),
- ConfigurationBundles.controllerBundles(),
- ConfigurationBundles.ovsdbLibraryBundles(),
- ConfigurationBundles.ovsdbDefaultSchemaBundles()
- );
- }
-
@Before
- public void setUp () throws ExecutionException, InterruptedException, IOException {
- areWeReady(bc);
- assertTrue(OPEN_VSWITCH_SCHEMA + " is required.", checkSchema(OPEN_VSWITCH_SCHEMA));
+ public void areWeReady() throws InterruptedException, IOException, ExecutionException {
+ assertNotNull(bc);
+ boolean debugit = false;
+ Bundle b[] = bc.getBundles();
+ for (Bundle element : b) {
+ int state = element.getState();
+ if (state != Bundle.ACTIVE && state != Bundle.RESOLVED) {
+ LOG.info("Bundle: {} state: {}", element.getSymbolicName(),
+ LibraryIntegrationTestUtils.bundleStateToString(state));
+ debugit = true;
+ }
+ }
+ if (debugit) {
+ LOG.debug("Do some debugging because some bundle is unresolved");
+ Thread.sleep(600000);
+ }
+
+ // Assert if true, if false we are good to go!
+ assertFalse(debugit);
+
+ assertTrue(LibraryIntegrationTestUtils.OPEN_VSWITCH_SCHEMA + " is required.", checkSchema(LibraryIntegrationTestUtils.OPEN_VSWITCH_SCHEMA));
assertTrue("Failed to monitor tables", monitorTables());
- schemaVersion = getClient().getDatabaseSchema(OPEN_VSWITCH_SCHEMA).getVersion();
- LOG.info("{} schema version = {}", OPEN_VSWITCH_SCHEMA, schemaVersion);
+ schemaVersion = getClient().getDatabaseSchema(LibraryIntegrationTestUtils.OPEN_VSWITCH_SCHEMA).getVersion();
+ LOG.info("{} schema version = {}", LibraryIntegrationTestUtils.OPEN_VSWITCH_SCHEMA, schemaVersion);
}
public boolean checkSchema (String schema) {
return true;
}
try {
- ovsdbClient = getTestConnection();
+ ovsdbClient = LibraryIntegrationTestUtils.getTestConnection(this);
assertNotNull("Invalid Client. Check connection params", ovsdbClient);
//Thread.sleep(3000); // Wait for a few seconds to get the Schema exchange done
if (isSchemaSupported(ovsdbClient, schema)) {
ListenableFuture<List<String>> databases = client.getDatabases();
List<String> dbNames = databases.get();
assertNotNull(dbNames);
- if (dbNames.contains(schema)) {
- return true;
- } else {
- return false;
- }
+ return dbNames.contains(schema);
}
/**
.add(op.comment("Bridge: Mutating controller2 " + controller2.getTargetColumn().getData()));
operationResults = executeTransaction(transactionBuilder,
- new String("Controller: Insert & Mutate operation results for controller2"));
+ "Controller: Insert & Mutate operation results for controller2");
testController2Uuid = operationResults.get(0).getUuid();
assertNotNull(ASSERT_TRANS_UUID, testController2Uuid);
private void controllerDelete () throws ExecutionException, InterruptedException {
Controller controller = getClient().getTypedRowWrapper(Controller.class, null);
Bridge bridge = getClient().getTypedRowWrapper(Bridge.class, null);
- DatabaseSchema dbSchema = getClient().getSchema(OPEN_VSWITCH_SCHEMA).get();
+ DatabaseSchema dbSchema = getClient().getSchema(LibraryIntegrationTestUtils.OPEN_VSWITCH_SCHEMA).get();
TransactionBuilder transactionBuilder = getClient().transactBuilder(dbSchema)
.add(op.delete(controller.getSchema())
boolean isExceptionRaised = false;
try {
- FlowSampleCollectorSet flowSampleCollectorSet = getClient().createTypedRowWrapper(FlowSampleCollectorSet.class);
+ getClient().createTypedRowWrapper(FlowSampleCollectorSet.class);
} catch (SchemaVersionMismatchException e) {
isExceptionRaised = true;
}
FlowSampleCollectorSet flowSampleCollectorSet =
getClient().createTypedRowWrapper(FlowSampleCollectorSet.class);
- flowSampleCollectorSet.setId(Long.valueOf(1));
+ flowSampleCollectorSet.setId(1L);
flowSampleCollectorSet.setExternalIds(ImmutableMap.of("I <3", "ovs"));
flowSampleCollectorSet.setBridge(testBridgeUuid);
boolean isExceptionRaised = false;
try {
- FlowTable flowTable = getClient().createTypedRowWrapper(FlowTable.class);
+ getClient().createTypedRowWrapper(FlowTable.class);
} catch (SchemaVersionMismatchException e) {
isExceptionRaised = true;
}
boolean isExceptionRaised = false;
try {
- IPFIX ipfix = getClient().createTypedRowWrapper(IPFIX.class);
+ getClient().createTypedRowWrapper(IPFIX.class);
} catch (SchemaVersionMismatchException e) {
isExceptionRaised = true;
}
String mirrorUuidStr = "testMirror";
String mirrorName = "my_name_is_mirror";
Long outputVid = 1024L;
- Long selectVid = Long.valueOf(2048);
+ Long selectVid = 2048L;
Mirror mirror = getClient().createTypedRowWrapper(Mirror.class);
mirror.setName(ImmutableSet.of(mirrorName));
private void mirrorDelete () throws ExecutionException, InterruptedException {
Mirror mirror = getClient().getTypedRowWrapper(Mirror.class, null);
Bridge bridge = getClient().getTypedRowWrapper(Bridge.class, null);
- DatabaseSchema dbSchema = getClient().getSchema(OPEN_VSWITCH_SCHEMA).get();
+ DatabaseSchema dbSchema = getClient().getSchema(LibraryIntegrationTestUtils.OPEN_VSWITCH_SCHEMA).get();
TransactionBuilder transactionBuilder = getClient().transactBuilder(dbSchema)
.add(op.delete(mirror.getSchema())
private void netFlowDelete () throws ExecutionException, InterruptedException {
NetFlow netFlow = getClient().getTypedRowWrapper(NetFlow.class, null);
Bridge bridge = getClient().getTypedRowWrapper(Bridge.class, null);
- DatabaseSchema dbSchema = getClient().getSchema(OPEN_VSWITCH_SCHEMA).get();
+ DatabaseSchema dbSchema = getClient().getSchema(LibraryIntegrationTestUtils.OPEN_VSWITCH_SCHEMA).get();
TransactionBuilder transactionBuilder = getClient().transactBuilder(dbSchema)
.add(op.delete(netFlow.getSchema())
Port port = getClient().getTypedRowWrapper(Port.class, null);
Interface intf = getClient().getTypedRowWrapper(Interface.class, null);
Bridge bridge = getClient().getTypedRowWrapper(Bridge.class, null);
- DatabaseSchema dbSchema = getClient().getSchema(OPEN_VSWITCH_SCHEMA).get();
+ DatabaseSchema dbSchema = getClient().getSchema(LibraryIntegrationTestUtils.OPEN_VSWITCH_SCHEMA).get();
TransactionBuilder transactionBuilder = getClient().transactBuilder(dbSchema)
.add(op.delete(port.getSchema())
Interface intf = getClient().getTypedRowWrapper(Interface.class, null);
Qos qos = getClient().getTypedRowWrapper(Qos.class, null);
Bridge bridge = getClient().getTypedRowWrapper(Bridge.class, null);
- DatabaseSchema dbSchema = getClient().getSchema(OPEN_VSWITCH_SCHEMA).get();
+ DatabaseSchema dbSchema = getClient().getSchema(LibraryIntegrationTestUtils.OPEN_VSWITCH_SCHEMA).get();
TransactionBuilder transactionBuilder = getClient().transactBuilder(dbSchema)
.add(op.delete(port.getSchema())
* since it wouldn't add any conceivable value.
*/
String queueUuidStr = "queueUuidStr";
- Long dscpVal = Long.valueOf(4);
+ Long dscpVal = 4L;
Queue queue = getClient().createTypedRowWrapper(Queue.class);
// Example of explicit ImmutableSet/Map Attribute declaration
ImmutableSet<Long> dscp = ImmutableSet.of(dscpVal);
private void queueDelete () throws ExecutionException, InterruptedException {
Queue queue = getClient().getTypedRowWrapper(Queue.class, null);
Qos qos = getClient().getTypedRowWrapper(Qos.class, null);
- DatabaseSchema dbSchema = getClient().getSchema(OPEN_VSWITCH_SCHEMA).get();
+ DatabaseSchema dbSchema = getClient().getSchema(LibraryIntegrationTestUtils.OPEN_VSWITCH_SCHEMA).get();
TransactionBuilder transactionBuilder = getClient().transactBuilder(dbSchema)
.add(op.delete(queue.getSchema())
private void sFlowDelete () throws ExecutionException, InterruptedException {
SFlow sFlow = getClient().getTypedRowWrapper(SFlow.class, null);
Bridge bridge = getClient().getTypedRowWrapper(Bridge.class, null);
- DatabaseSchema dbSchema = getClient().getSchema(OPEN_VSWITCH_SCHEMA).get();
+ DatabaseSchema dbSchema = getClient().getSchema(LibraryIntegrationTestUtils.OPEN_VSWITCH_SCHEMA).get();
TransactionBuilder transactionBuilder = getClient().transactBuilder(dbSchema)
.add(op.delete(sFlow.getSchema())
/*
- * Copyright (c) 2014 Red Hat, Inc. and others. All rights reserved.
+ * Copyright © 2015 Red Hat, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Madhu Venugopal
*/
-package org.opendaylight.ovsdb.integrationtest.library;
+package org.opendaylight.ovsdb.lib.it;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail;
import static org.opendaylight.ovsdb.lib.operations.Operations.op;
-import static org.ops4j.pax.exam.CoreOptions.options;
-import static org.ops4j.pax.exam.CoreOptions.propagateSystemProperty;
-import static org.ops4j.pax.exam.CoreOptions.systemProperty;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.opendaylight.ovsdb.integrationtest.ConfigurationBundles;
-import org.opendaylight.ovsdb.integrationtest.OvsdbIntegrationTestBase;
import org.opendaylight.ovsdb.lib.OvsdbClient;
import org.opendaylight.ovsdb.lib.notation.Mutator;
import org.opendaylight.ovsdb.lib.notation.UUID;
import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
import org.opendaylight.ovsdb.schema.openvswitch.Bridge;
import org.opendaylight.ovsdb.schema.openvswitch.OpenVSwitch;
-import org.ops4j.pax.exam.Configuration;
-import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.PaxExam;
-import org.ops4j.pax.exam.util.PathUtils;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerSuite;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.slf4j.Logger;
import com.google.common.util.concurrent.ListenableFuture;
@RunWith(PaxExam.class)
-public class OvsdbLibraryIT extends OvsdbIntegrationTestBase {
- private static final Logger LOG = LoggerFactory.getLogger(OvsdbLibraryIT.class);
+@ExamReactorStrategy(PerSuite.class)
+public class LibraryIT extends LibraryIntegrationTestBase {
+ private static final Logger LOG = LoggerFactory.getLogger(LibraryIT.class);
+
@Inject
private BundleContext bc;
private OvsdbClient client = null;
- @Configuration
- public Option[] config() {
- return options(
- //
- systemProperty("logback.configurationFile").value(
- "file:" + PathUtils.getBaseDir()
- + "/src/test/resources/logback.xml"
- ),
- // To start OSGi console for inspection remotely
- systemProperty("osgi.console").value("2401"),
-
- propagateSystemProperty("ovsdbserver.ipaddress"),
- propagateSystemProperty("ovsdbserver.port"),
-
- ConfigurationBundles.mdsalBundles(),
- ConfigurationBundles.controllerBundles(),
- ConfigurationBundles.ovsdbLibraryBundles(),
- ConfigurationBundles.ovsdbDefaultSchemaBundles()
- );
- }
-
@Before
public void areWeReady() throws InterruptedException {
assertNotNull(bc);
for (Bundle element : b) {
int state = element.getState();
if (state != Bundle.ACTIVE && state != Bundle.RESOLVED) {
- LOG.info("Bundle: {} state: {}", element.getSymbolicName(), stateToString(state));
+ LOG.info("Bundle: {} state: {}", element.getSymbolicName(),
+ LibraryIntegrationTestUtils.bundleStateToString(state));
debugit = true;
}
}
// Assert if true, if false we are good to go!
assertFalse(debugit);
try {
- client = getTestConnection();
+ client = LibraryIntegrationTestUtils.getTestConnection(this);
} catch (Exception e) {
fail("Exception : "+e.getMessage());
}
private void createTypedBridge(DatabaseSchema dbSchema) throws IOException, InterruptedException, ExecutionException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
Bridge bridge = client.createTypedRowWrapper(Bridge.class);
bridge.setName(testBridgeName);
- bridge.setStatus(ImmutableMap.of("key","value"));
+ bridge.setStatus(ImmutableMap.of("key", "value"));
bridge.setFloodVlans(Sets.newHashSet(34L));
OpenVSwitch openVSwitch = client.createTypedRowWrapper(OpenVSwitch.class);
.and(bridge.getNameColumn().getSchema().opEqual(bridge.getName())).build())
.add(op.mutate(openVSwitch.getSchema())
.addMutation(openVSwitch.getBridgesColumn().getSchema(), Mutator.INSERT,
- openVSwitch.getBridgesColumn().getData()));
+ openVSwitch.getBridgesColumn().getData()));
ListenableFuture<List<OperationResult>> results = transactionBuilder.execute();
List<OperationResult> operationResults = results.get();
public void tableTest() throws Exception {
assertNotNull("Invalid Client. Check connection params", client);
Thread.sleep(3000); // Wait for a few seconds to get the Schema exchange done
- if (isSchemaSupported(OPEN_VSWITCH_SCHEMA)) {
- DatabaseSchema dbSchema = client.getSchema(OPEN_VSWITCH_SCHEMA).get();
+ if (isSchemaSupported(LibraryIntegrationTestUtils.OPEN_VSWITCH_SCHEMA)) {
+ DatabaseSchema dbSchema = client.getSchema(LibraryIntegrationTestUtils.OPEN_VSWITCH_SCHEMA).get();
assertNotNull(dbSchema);
- System.out.println(OPEN_VSWITCH_SCHEMA + " schema in "+ client.getConnectionInfo() +
- " with Tables : " + dbSchema.getTables());
+ System.out.println(LibraryIntegrationTestUtils.OPEN_VSWITCH_SCHEMA + " schema in "+ client.getConnectionInfo() +
+ " with Tables : " + dbSchema.getTables());
// A simple Typed Test to make sure a Typed wrapper bundle can coexist in an OSGi environment
createTypedBridge(dbSchema);
}
- if (isSchemaSupported(HARDWARE_VTEP)) {
- DatabaseSchema dbSchema = client.getSchema(HARDWARE_VTEP).get();
+ if (isSchemaSupported(LibraryIntegrationTestUtils.HARDWARE_VTEP)) {
+ DatabaseSchema dbSchema = client.getSchema(LibraryIntegrationTestUtils.HARDWARE_VTEP).get();
assertNotNull(dbSchema);
- System.out.println(HARDWARE_VTEP + " schema in "+ client.getConnectionInfo() +
- " with Tables : " + dbSchema.getTables());
+ System.out.println(LibraryIntegrationTestUtils.HARDWARE_VTEP + " schema in "+ client.getConnectionInfo() +
+ " with Tables : " + dbSchema.getTables());
}
}
public void tearDown() throws InterruptedException, ExecutionException {
Bridge bridge = client.getTypedRowWrapper(Bridge.class, null);
OpenVSwitch openVSwitch = client.getTypedRowWrapper(OpenVSwitch.class, null);
- DatabaseSchema dbSchema = client.getSchema(OPEN_VSWITCH_SCHEMA).get();
+ DatabaseSchema dbSchema = client.getSchema(LibraryIntegrationTestUtils.OPEN_VSWITCH_SCHEMA).get();
ListenableFuture<List<OperationResult>> results = client.transactBuilder(dbSchema)
.add(op.delete(bridge.getSchema())
.where(bridge.getNameColumn().getSchema().opEqual(testBridgeName))
--- /dev/null
+/*
+ * Copyright © 2015 Red Hat, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.ovsdb.lib.it;
+
+import static org.ops4j.pax.exam.CoreOptions.composite;
+import static org.ops4j.pax.exam.CoreOptions.maven;
+import static org.ops4j.pax.exam.CoreOptions.propagateSystemProperties;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
+
+import org.opendaylight.controller.mdsal.it.base.AbstractMdsalTestBase;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.karaf.options.LogLevelOption;
+import org.ops4j.pax.exam.options.MavenUrlReference;
+
+/**
+ * Base class for library IT.
+ */
+public abstract class LibraryIntegrationTestBase extends AbstractMdsalTestBase {
+ @Override
+ public String getModuleName() {
+ return "library";
+ }
+
+ @Override
+ public String getInstanceName() {
+ return "library-default";
+ }
+
+ @Override
+ public MavenUrlReference getFeatureRepo() {
+ return maven()
+ .groupId("org.opendaylight.ovsdb")
+ .artifactId("library-features")
+ .classifier("features")
+ .type("xml")
+ .versionAsInProject();
+ }
+
+ @Override
+ public String getFeatureName() {
+ return "odl-ovsdb-library";
+ }
+
+ @Configuration
+ @Override
+ public Option[] config() {
+ Option[] parentOptions = super.config();
+ Option[] propertiesOptions = getPropertiesOptions();
+ Option[] options = new Option[parentOptions.length + propertiesOptions.length];
+ System.arraycopy(parentOptions, 0, options, 0, parentOptions.length);
+ System.arraycopy(propertiesOptions, 0, options, parentOptions.length, propertiesOptions.length);
+ return options;
+ }
+
+ public Option[] getPropertiesOptions() {
+ return new Option[] {
+ propagateSystemProperties(
+ LibraryIntegrationTestUtils.SERVER_IPADDRESS,
+ LibraryIntegrationTestUtils.SERVER_PORT,
+ LibraryIntegrationTestUtils.CONNECTION_TYPE),
+ };
+ }
+
+ @Override
+ public Option getLoggingOption() {
+ Option option = editConfigurationFilePut(ORG_OPS4J_PAX_LOGGING_CFG,
+ logConfiguration(getClass()),
+ LogLevelOption.LogLevel.INFO.name());
+ option = composite(option, super.getLoggingOption());
+ return option;
+ }
+}
--- /dev/null
+/*
+ * Copyright © 2015 Red Hat, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.ovsdb.lib.it;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.util.Objects;
+import java.util.Properties;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
+import org.opendaylight.ovsdb.lib.OvsdbClient;
+import org.opendaylight.ovsdb.lib.OvsdbConnection;
+import org.opendaylight.ovsdb.lib.OvsdbConnectionListener;
+import org.opendaylight.ovsdb.utils.servicehelper.ServiceHelper;
+import org.osgi.framework.Bundle;
+
+/**
+ * Utilities for OVSDB integration tests.
+ */
+public final class LibraryIntegrationTestUtils {
+ public static final String SERVER_IPADDRESS = "ovsdbserver.ipaddress";
+ public static final String SERVER_PORT = "ovsdbserver.port";
+ public static final String CONNECTION_TYPE = "ovsdbserver.connection";
+ public final static String OPEN_VSWITCH_SCHEMA = "Open_vSwitch";
+ public final static String HARDWARE_VTEP = "hardware_vtep";
+ private static final String CONNECTION_TYPE_ACTIVE = "active";
+ private static final String CONNECTION_TYPE_PASSIVE = "passive";
+ private static final String DEFAULT_SERVER_PORT = "6640";
+
+ /**
+ * Prevent instantiation of a utility class.
+ */
+ private LibraryIntegrationTestUtils() {
+ // Nothing to do
+ }
+
+ public static OvsdbClient getTestConnection(BindingAwareProvider provider) throws IOException, InterruptedException, ExecutionException, TimeoutException {
+ Properties props = System.getProperties();
+ String addressStr = props.getProperty(SERVER_IPADDRESS);
+ String portStr = props.getProperty(SERVER_PORT, DEFAULT_SERVER_PORT);
+ String connectionType = props.getProperty(CONNECTION_TYPE, "active");
+
+ // If the connection type is active, controller connects to the ovsdb-server
+ if (connectionType.equalsIgnoreCase(CONNECTION_TYPE_ACTIVE)) {
+ if (addressStr == null) {
+ throw new IllegalArgumentException(usage());
+ }
+
+ InetAddress address;
+ try {
+ address = InetAddress.getByName(addressStr);
+ } catch (Exception e) {
+ System.out.println("Unable to resolve " + addressStr);
+ e.printStackTrace();
+ return null;
+ }
+
+ Integer port;
+ try {
+ port = Integer.parseInt(portStr);
+ } catch (NumberFormatException e) {
+ System.out.println("Invalid port number : " + portStr);
+ e.printStackTrace();
+ return null;
+ }
+
+ OvsdbConnection connection = (OvsdbConnection) ServiceHelper.getGlobalInstance(OvsdbConnection.class, provider);
+ return connection.connect(address, port);
+ } else if (connectionType.equalsIgnoreCase(CONNECTION_TYPE_PASSIVE)) {
+ ExecutorService executor = Executors.newFixedThreadPool(1);
+ Future<OvsdbClient> passiveConnection = executor.submit(new PassiveListener());
+ return passiveConnection.get(60, TimeUnit.SECONDS);
+ }
+ throw new IllegalArgumentException("Connection parameter (" + CONNECTION_TYPE + ") must be either active or passive");
+ }
+
+ public static String bundleStateToString(int state) {
+ switch (state) {
+ case Bundle.ACTIVE:
+ return "ACTIVE";
+ case Bundle.INSTALLED:
+ return "INSTALLED";
+ case Bundle.RESOLVED:
+ return "RESOLVED";
+ case Bundle.UNINSTALLED:
+ return "UNINSTALLED";
+ default:
+ return "Not CONVERTED";
+ }
+ }
+
+ private static String usage() {
+ return "Integration Test needs a valid connection configuration as follows :\n" +
+ "active connection : mvn -Pintegrationtest -Dovsdbserver.ipaddress=x.x.x.x -Dovsdbserver.port=yyyy verify\n"+
+ "passive connection : mvn -Pintegrationtest -Dovsdbserver.connection=passive verify\n";
+ }
+
+ private static class PassiveListener implements Callable<OvsdbClient>, OvsdbConnectionListener {
+ OvsdbClient client = null;
+ @Override
+ public OvsdbClient call() throws Exception {
+ OvsdbConnection connection = (OvsdbConnection)ServiceHelper.getGlobalInstance(OvsdbConnection.class, this);
+ connection.registerConnectionListener(this);
+ while (client == null) {
+ Thread.sleep(500);
+ }
+ return client;
+ }
+
+ @Override
+ public void connected(OvsdbClient client) {
+ this.client = client;
+ }
+
+ @Override
+ public void disconnected(OvsdbClient client) {
+ if (!Objects.equals(this.client.getConnectionInfo(), client.getConnectionInfo())) {
+ throw new IllegalStateException("disconnected unexpected client");
+ }
+ this.client = null;
+ }
+ }
+
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright © 2015 Red Hat, Inc. and others. All rights reserved. and others. All rights reserved.
+This program and the accompanying materials are made available under the
+terms of the Eclipse Public License v1.0 which accompanies this distribution,
+and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>karaf-parent</artifactId>
+ <version>1.6.0-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.opendaylight.ovsdb</groupId>
+ <artifactId>library-karaf</artifactId>
+ <version>1.2.1-SNAPSHOT</version>
+ <name>${project.artifactId}</name>
+ <prerequisites>
+ <maven>3.1.1</maven>
+ </prerequisites>
+ <properties>
+ <karaf.localFeature>odl-ovsdb-library</karaf.localFeature>
+ </properties>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>library-artifacts</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+ <dependencies>
+ <dependency>
+ <!-- scope is compile so all features (there is only one) are installed
+ into startup.properties and the feature repo itself is not installed -->
+ <groupId>org.apache.karaf.features</groupId>
+ <artifactId>framework</artifactId>
+ <type>kar</type>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>library-features</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+ <!-- DO NOT install or deploy the karaf artifact -->
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
<?xml version="1.0" encoding="UTF-8"?>
<!--
-Copyright (C) 2014 Red Hat, Inc. and others. All rights reserved.
-
+Copyright © 2014, 2015 Red Hat, Inc. and others. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v1.0 which accompanies this distribution,
and is available at http://www.eclipse.org/legal/epl-v10.html
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.opendaylight.ovsdb</groupId>
- <artifactId>commons</artifactId>
- <version>1.4.0-SNAPSHOT</version>
- <relativePath>../commons/parent</relativePath>
+ <groupId>org.opendaylight.odlparent</groupId>
+ <artifactId>odlparent</artifactId>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
- <artifactId>library</artifactId>
- <version>1.2.0-SNAPSHOT</version>
- <packaging>bundle</packaging>
+ <groupId>org.opendaylight.ovsdb</groupId>
+ <artifactId>library-aggregator</artifactId>
+ <version>1.2.1-SNAPSHOT</version>
+ <name>library</name>
+ <packaging>pom</packaging>
<description>The OVSDB Plugin integration project is a project for OpenDaylight that will implement the Open vSwitch Database RFC 7047 management protocol allowing the Southbound configuration of vSwitches and a network virtualization implementation.</description>
<url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
<licenses>
<url>http://www.eclipse.org/legal/epl-v10.html</url>
</license>
</licenses>
- <developers>
- <developer>
- <name>Sam Hague</name>
- <email>shague@gmail.com</email>
- <url>https://github.com/shague</url>
- </developer>
- </developers>
- <scm>
- <connection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</connection>
- <developerConnection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</developerConnection>
- <tag>HEAD</tag>
- <url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
- </scm>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.dependencymanager</artifactId>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-annotations</artifactId>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </dependency>
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-all</artifactId>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
+ <prerequisites>
+ <maven>3.1.1</maven>
+ </prerequisites>
+ <modules>
+ <module>impl</module>
+ <module>karaf</module>
+ <module>features</module>
+ <module>artifacts</module>
+ <module>it</module>
+ </modules>
+ <!-- DO NOT install or deploy the repo root pom as it's only needed to initiate a build -->
<build>
- <testResources>
- <testResource>
- <filtering>true</filtering>
- <directory>src/test/resources</directory>
- </testResource>
- </testResources>
<plugins>
<plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <version>2.4.0</version>
- <extensions>true</extensions>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
<configuration>
- <instructions>
- <Import-Package>org.apache.commons.lang3.builder,
- org.apache.commons.lang3.tuple,
- org.apache.felix.dm,
- org.slf4j,
- org.eclipse.osgi.framework.console,
- org.osgi.framework,
- javax.net.ssl,
- *</Import-Package>
- <Embed-Transitive>true</Embed-Transitive>
- <Bundle-Activator>org.opendaylight.ovsdb.lib.osgi.Activator</Bundle-Activator>
- <Export-Package>
- org.opendaylight.ovsdb.lib,
- org.opendaylight.ovsdb.lib.impl,
- org.opendaylight.ovsdb.lib.error,
- org.opendaylight.ovsdb.lib.jsonrpc,
- org.opendaylight.ovsdb.lib.notation,
- org.opendaylight.ovsdb.lib.operations,
- org.opendaylight.ovsdb.lib.message,
- org.opendaylight.ovsdb.lib.schema,
- org.opendaylight.ovsdb.lib.schema.typed</Export-Package>
- </instructions>
- <manifestLocation>${project.basedir}/META-INF</manifestLocation>
+ <skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-failsafe-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.jacoco</groupId>
- <artifactId>jacoco-maven-plugin</artifactId>
+ <artifactId>maven-install-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
</plugin>
</plugins>
</build>
+
+ <scm>
+ <connection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</connection>
+ <developerConnection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</developerConnection>
+ <tag>HEAD</tag>
+ <url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
+ </scm>
</project>
+++ /dev/null
-/*
- * Copyright (c) 2013, 2015 Red Hat, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.ovsdb.lib.osgi;
-
-import org.apache.felix.dm.DependencyActivatorBase;
-import org.apache.felix.dm.DependencyManager;
-import org.opendaylight.ovsdb.lib.OvsdbConnection;
-import org.opendaylight.ovsdb.lib.OvsdbConnectionListener;
-import org.opendaylight.ovsdb.lib.impl.OvsdbConnectionService;
-import org.osgi.framework.BundleContext;
-
-/**
- * OVSDB Library OSGi Activator
- */
-public class Activator extends DependencyActivatorBase {
-
- @Override
- public void init(BundleContext context, DependencyManager manager) throws Exception {
- manager.add(createComponent()
- .setInterface(OvsdbConnection.class.getName(), null)
- .setImplementation(OvsdbConnectionService.class)
- .add(createServiceDependency()
- .setService(OvsdbConnectionListener.class)
- .setCallbacks("registerConnectionListener", "unregisterConnectionListener")
- .setRequired(false)
- )
- );
- }
-
- @Override
- public void destroy(BundleContext context, DependencyManager manager) throws Exception {}
-}
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>${bundle.plugin.version}</version>
<extensions>true</extensions>
<configuration>
<instructions>
- <Export-Package></Export-Package>
<Import-Package>org.opendaylight.controller.sal.utils,
org.opendaylight.controller.northbound.commons,
org.opendaylight.controller.northbound.commons.exception,
org.slf4j,
org.apache.catalina.filters,
!org.codehaus.enunciate.jaxrs,*</Import-Package>
- <Export-Package></Export-Package>
+ <Export-Package/>
<Web-ContextPath>/ovsdb/nb</Web-ContextPath>
<Jaxrs-Resources>,${classes;ANNOTATION;javax.ws.rs.Path}</Jaxrs-Resources>
</instructions>
<parent>
<groupId>org.opendaylight.controller</groupId>
- <artifactId>config-parent</artifactId>
- <version>0.4.0-SNAPSHOT</version>
+ <artifactId>mdsal-it-parent</artifactId>
+ <version>1.3.0-SNAPSHOT</version>
<relativePath/>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.opendaylight.ovsdb</groupId>
<artifactId>openstack.net-virt-it</artifactId>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.2.1-SNAPSHOT</version>
<packaging>jar</packaging>
<description>The OVSDB Plugin integration project is a project for OpenDaylight that will implement the Open vSwitch Database RFC 7047 management protocol allowing the Southbound configuration of vSwitches and a network virtualization implementation.</description>
<url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>features-ovsdb</artifactId>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.2.1-SNAPSHOT</version>
<classifier>features</classifier>
<type>xml</type>
</dependency>
+++ /dev/null
-/*
- * Copyright (C) 2015 Red Hat, Inc. and others
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.ovsdb.openstack.netvirt.it;
-
-import static org.ops4j.pax.exam.CoreOptions.maven;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder;
-
-import com.google.common.collect.ObjectArrays;
-import java.io.File;
-import java.lang.management.ManagementFactory;
-import java.util.Calendar;
-import javax.management.InstanceNotFoundException;
-import org.junit.Rule;
-import org.junit.internal.AssumptionViolatedException;
-import org.junit.rules.TestRule;
-import org.junit.rules.TestWatcher;
-import org.junit.runner.Description;
-import org.opendaylight.controller.config.api.ConfigRegistry;
-import org.opendaylight.controller.config.util.ConfigRegistryJMXClient;
-import org.ops4j.pax.exam.Configuration;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.karaf.options.LogLevelOption.LogLevel;
-import org.ops4j.pax.exam.options.MavenArtifactUrlReference;
-import org.ops4j.pax.exam.options.MavenUrlReference;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-//import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features;
-
-/**
- * @author Sam Hague (shague@redhat.com)
- */
-public abstract class AbstractConfigTestBase {
- private static final Logger LOG = LoggerFactory.getLogger(AbstractConfigTestBase.class);
-
- /*
- * Wait up to 10s for our configured module to come up
- */
- private static final int MODULE_TIMEOUT = 10000;
- private static int configTimes = 0;
-
- public abstract String getModuleName();
-
- public abstract String getInstanceName();
-
- public abstract MavenUrlReference getFeatureRepo();
-
- public abstract String getFeatureName();
-
- public Option[] getLoggingOptions() {
- Option[] options = new Option[] {
- editConfigurationFilePut(NetvirtITConstants.ORG_OPS4J_PAX_LOGGING_CFG,
- logConfiguration(AbstractConfigTestBase.class),
- LogLevel.INFO.name())
- };
- return options;
- }
-
- public String logConfiguration(Class<?> klazz) {
- return "log4j.logger." + klazz.getPackage().getName();
- }
-
- public Option[] getFeaturesOptions() {
- return new Option[]{};
- }
-
- public Option[] getPropertiesOptions() {
- return new Option[]{};
- }
-
- public MavenArtifactUrlReference getKarafDistro() {
- MavenArtifactUrlReference karafUrl;
- /*karafUrl = maven()
- .groupId("org.opendaylight.controller")
- .artifactId("opendaylight-karaf-empty")
- .version("1.5.0-SNAPSHOT")
- .type("zip");*/
-
- karafUrl = maven()
- .groupId("org.opendaylight.ovsdb")
- .artifactId("karaf")
- .versionAsInProject()
- .type("zip");
-
- return karafUrl;
- }
-
- @Configuration
- public Option[] config() {
- LOG.info("Calling config, configTimes: {}", configTimes);
- configTimes++;
- Option[] options = new Option[] {
- //KarafDistributionOption.debugConfiguration("5005", true),
- karafDistributionConfiguration()
- .frameworkUrl(getKarafDistro())
- .unpackDirectory(new File("target/exam"))
- .useDeployFolder(false),
- keepRuntimeFolder(),
- //features(getFeatureRepo() , getFeatureName())
- };
- options = ObjectArrays.concat(options, getFeaturesOptions(), Option.class);
- options = ObjectArrays.concat(options, getLoggingOptions(), Option.class);
- options = ObjectArrays.concat(options, getPropertiesOptions(), Option.class);
- return options;
- }
-
- public void setup() throws Exception {
- LOG.info("Module: {} Instance: {} attempting to configure.",
- getModuleName(),getInstanceName());
- Calendar start = Calendar.getInstance();
- ConfigRegistry configRegistryClient = new ConfigRegistryJMXClient(ManagementFactory
- .getPlatformMBeanServer());
- for (int timer = 0;timer < MODULE_TIMEOUT;timer++) {
- try {
- configRegistryClient.lookupConfigBean(getModuleName(), getInstanceName());
- Thread.sleep(100);
- } catch (InstanceNotFoundException e) {
- if (timer >= MODULE_TIMEOUT) {
- throw e;
- }
- } catch (InterruptedException e) {
- LOG.error("Exception: ",e);
- }
- }
- Calendar stop = Calendar.getInstance();
- LOG.info("Module: {} Instance: {} configured after {} ms",
- getModuleName(),getInstanceName(),
- stop.getTimeInMillis() - start.getTimeInMillis());
- }
-
- @Rule
- public TestRule watcher = new TestWatcher() {
- @Override
- protected void starting(Description description) {
- LOG.info("TestWatcher: Starting test:\n{}", description.getDisplayName());
- }
-
- @Override
- protected void finished(Description description) {
- LOG.info("TestWatcher: Finished test:\n{}", description.getDisplayName());
- }
-
- @Override
- protected void succeeded(Description description) {
- LOG.info("TestWatcher: Test succeeded:\n{}", description.getDisplayName());
- }
-
- @Override
- protected void failed(Throwable ex, Description description) {
- LOG.info("TestWatcher: Test failed:\n{} ", description.getDisplayName(), ex);
- }
-
- @Override
- protected void skipped(AssumptionViolatedException ex, Description description) {
- LOG.info("TestWatcher: Test skipped:\n{} ", description.getDisplayName(), ex);
- }
- };
-}
+++ /dev/null
-/*
- * Copyright (C) 2015 Red Hat, Inc. and others
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.ovsdb.openstack.netvirt.it;
-
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
-
-import com.google.common.collect.ObjectArrays;
-import java.util.Calendar;
-import javax.inject.Inject;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
-import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.karaf.options.LogLevelOption.LogLevel;
-import org.ops4j.pax.exam.util.Filter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public abstract class AbstractMdsalTestBase extends AbstractConfigTestBase implements BindingAwareProvider {
-
- private static final Logger LOG = LoggerFactory.getLogger(AbstractMdsalTestBase.class);
- private static final int REGISTRATION_TIMEOUT = 10000;
- @Inject @Filter(timeout = 120000)
- private BindingAwareBroker broker;
- private ProviderContext session = null;
-
- public ProviderContext getSession() {
- return session;
- }
-
- @Override
- public void onSessionInitiated(ProviderContext session) {
- LOG.info("Session Initiated: {}",session);
- this.session = session;
- }
-
- @Override
- public void setup() throws Exception {
- super.setup();
- Calendar start = Calendar.getInstance();
- broker.registerProvider(this);
- for (int timer = 0;timer < REGISTRATION_TIMEOUT;timer++) {
- if (session != null) {
- Calendar stop = Calendar.getInstance();
- LOG.info("Registered with the MD-SAL after {} ms",
- stop.getTimeInMillis() - start.getTimeInMillis());
- return;
- } else {
- Thread.sleep(1);
- }
- }
- throw new RuntimeException("Session not initiated after " + REGISTRATION_TIMEOUT + " ms");
- }
-
- @Override
- public Option[] getLoggingOptions() {
- Option[] options = new Option[] {
- editConfigurationFilePut(NetvirtITConstants.ORG_OPS4J_PAX_LOGGING_CFG,
- logConfiguration(AbstractMdsalTestBase.class),
- LogLevel.INFO.name()),
- };
- options = ObjectArrays.concat(options, super.getLoggingOptions(), Option.class);
- return options;
- }
-
-}
package org.opendaylight.ovsdb.openstack.netvirt.it;
import static org.junit.Assert.fail;
+import static org.ops4j.pax.exam.CoreOptions.composite;
import static org.ops4j.pax.exam.CoreOptions.maven;
+import static org.ops4j.pax.exam.CoreOptions.when;
import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder;
import com.google.common.collect.ImmutableBiMap;
import com.google.common.collect.Lists;
import com.google.common.collect.ObjectArrays;
+
+import java.io.File;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.UnknownHostException;
import org.junit.runner.RunWith;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.mdsal.it.base.AbstractMdsalTestBase;
import org.opendaylight.ovsdb.openstack.netvirt.api.Southbound;
import org.opendaylight.ovsdb.utils.servicehelper.ServiceHelper;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
import org.ops4j.pax.exam.Configuration;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.karaf.options.KarafDistributionOption;
import org.ops4j.pax.exam.karaf.options.LogLevelOption;
import org.ops4j.pax.exam.options.MavenUrlReference;
import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
private static final String NETVIRT = "org.opendaylight.ovsdb.openstack.net-virt";
private static final String NETVIRTPROVIDERS = "org.opendaylight.ovsdb.openstack.net-virt-providers";
+ // TODO Constants copied frmo AbstractConfigTestBase, need to be removed (see TODO below)
+ private static final String PAX_EXAM_UNPACK_DIRECTORY = "target/exam";
+ private static final String KARAF_DEBUG_PORT = "5005";
+ private static final String KARAF_DEBUG_PROP = "karaf.debug";
+ private static final String KEEP_UNPACK_DIRECTORY_PROP = "karaf.keep.unpack";
+
@Inject
private BundleContext bundleContext;
@Configuration
public Option[] config() {
- return super.config();
+ // TODO Figure out how to use the parent Karaf setup, then just use super.config()
+ Option[] options = new Option[] {
+ when(Boolean.getBoolean(KARAF_DEBUG_PROP))
+ .useOptions(KarafDistributionOption.debugConfiguration(KARAF_DEBUG_PORT, true)),
+ karafDistributionConfiguration().frameworkUrl(getKarafDistro())
+ .unpackDirectory(new File(PAX_EXAM_UNPACK_DIRECTORY))
+ .useDeployFolder(false),
+ when(Boolean.getBoolean(KEEP_UNPACK_DIRECTORY_PROP)).useOptions(keepRuntimeFolder()),
+ // Works only if we don't specify the feature repo and name
+ getLoggingOption()};
+ Option[] propertyOptions = getPropertiesOptions();
+ Option[] combinedOptions = new Option[options.length + propertyOptions.length];
+ System.arraycopy(options, 0, combinedOptions, 0, options.length);
+ System.arraycopy(propertyOptions, 0, combinedOptions, options.length, propertyOptions.length);
+ return combinedOptions;
+ }
+
+ @Override
+ public String getKarafDistro() {
+ return maven()
+ .groupId("org.opendaylight.ovsdb")
+ .artifactId("karaf")
+ .versionAsInProject()
+ .type("zip")
+ .getURL();
}
@Override
}
@Override
- public Option[] getFeaturesOptions() {
- return new Option[]{};
- }
-
- @Override
- public Option[] getLoggingOptions() {
- Option[] options;
-
- options = new Option[] {
- editConfigurationFilePut(NetvirtITConstants.ORG_OPS4J_PAX_LOGGING_CFG,
- "log4j.logger.org.opendaylight.ovsdb",
- LogLevelOption.LogLevel.DEBUG.name()),
- editConfigurationFilePut(NetvirtITConstants.ORG_OPS4J_PAX_LOGGING_CFG,
- "log4j.logger.org.opendaylight.ovsdb.lib",
- LogLevelOption.LogLevel.INFO.name()),
+ public Option getLoggingOption() {
+ return composite(
+ editConfigurationFilePut(NetvirtITConstants.ORG_OPS4J_PAX_LOGGING_CFG,
+ "log4j.logger.org.opendaylight.ovsdb",
+ LogLevelOption.LogLevel.DEBUG.name()),
+ editConfigurationFilePut(NetvirtITConstants.ORG_OPS4J_PAX_LOGGING_CFG,
+ "log4j.logger.org.opendaylight.ovsdb.lib",
+ LogLevelOption.LogLevel.INFO.name()),
+ super.getLoggingOption());
/*editConfigurationFilePut(NetvirtITConstants.ORG_OPS4J_PAX_LOGGING_CFG,
"log4j.logger.org.opendaylight.ovsdb.openstack.net-virt",
LogLevelOption.LogLevel.DEBUG.name())*/
- };
-
- options = ObjectArrays.concat(options, super.getLoggingOptions(), Option.class);
- return options;
}
- @Override
- public Option[] getPropertiesOptions() {
+ private Option[] getPropertiesOptions() {
Properties props = new Properties(System.getProperties());
String addressStr = props.getProperty(NetvirtITConstants.SERVER_IPADDRESS,
NetvirtITConstants.DEFAULT_SERVER_IPADDRESS);
}
@Before
- public void setUp() throws InterruptedException {
+ @Override
+ public void setup() throws InterruptedException {
if (setup.get()) {
LOG.info("Skipping setUp, already initialized");
return;
<groupId>org.opendaylight.ovsdb</groupId>
<artifactId>openstack.net-virt-providers</artifactId>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.2.1-SNAPSHOT</version>
<packaging>bundle</packaging>
<description>The OVSDB Plugin integration project is a project for OpenDaylight that will implement the Open vSwitch Database RFC 7047 management protocol allowing the Southbound configuration of vSwitches and a network virtualization implementation.</description>
<url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
<networkconfig.neutron.version>0.6.0-SNAPSHOT</networkconfig.neutron.version>
<openflowjava-nicira.version>0.2.0-SNAPSHOT</openflowjava-nicira.version>
<openflowplugin.version>0.2.0-SNAPSHOT</openflowplugin.version>
- <ovsdb.utils.config.version>1.2.0-SNAPSHOT</ovsdb.utils.config.version>
- <ovsdb.utils.mdsal.openflow.version>1.2.0-SNAPSHOT</ovsdb.utils.mdsal.openflow.version>
- <ovsdb.utils.servicehelper.version>1.2.0-SNAPSHOT</ovsdb.utils.servicehelper.version>
+ <ovsdb.utils.config.version>1.2.1-SNAPSHOT</ovsdb.utils.config.version>
+ <ovsdb.utils.mdsal.openflow.version>1.2.1-SNAPSHOT</ovsdb.utils.mdsal.openflow.version>
+ <ovsdb.utils.servicehelper.version>1.2.1-SNAPSHOT</ovsdb.utils.servicehelper.version>
<powermock.version>1.5.2</powermock.version>
<sonar-jacoco-listeners.version>2.4</sonar-jacoco-listeners.version>
<liblldp.version>0.9.1-SNAPSHOT</liblldp.version>
package org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
import java.util.List;
import java.util.Map;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
-import org.opendaylight.ovsdb.openstack.netvirt.api.Southbound;
+
import org.opendaylight.ovsdb.openstack.netvirt.api.Action;
import org.opendaylight.ovsdb.openstack.netvirt.api.NodeCacheListener;
import org.opendaylight.ovsdb.openstack.netvirt.api.NodeCacheManager;
+import org.opendaylight.ovsdb.openstack.netvirt.api.Southbound;
import org.opendaylight.ovsdb.openstack.netvirt.providers.ConfigInterface;
import org.opendaylight.ovsdb.utils.servicehelper.ServiceHelper;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
public class PipelineOrchestratorImpl implements ConfigInterface, NodeCacheListener, PipelineOrchestrator {
private static final Logger LOG = LoggerFactory.getLogger(PipelineOrchestratorImpl.class);
private List<Service> staticPipeline = Lists.newArrayList(
try {
while (true) {
Node node = queue.take();
- /*
- * Since we are hooking on OpendaylightInventoryListener and as observed in
- * Bug 1997 multiple Threads trying to write to a same table at the same time
- * causes programming issues. Hence delaying the programming by a second to
- * avoid the clash. This hack/workaround should be removed once Bug 1997 is resolved.
- */
LOG.info(">>>>> dequeue: {}", node);
- Thread.sleep(1000);
for (Service service : staticPipeline) {
AbstractServiceInstance serviceInstance = getServiceInstance(service);
//LOG.info("pipeline: {} - {}", service, serviceInstance);
package org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.services;
import java.math.BigInteger;
+import java.net.Inet6Address;
import java.net.InetAddress;
import java.util.List;
//import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.common.collect.Lists;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
public class ArpResponderService extends AbstractServiceInstance implements ArpProvider, ConfigInterface {
+ private static final Logger LOG = LoggerFactory.getLogger(ArpResponderService.class);
+
public ArpResponderService() {
super(Service.ARP_RESPONDER);
}
}
}
+ if (ipAddress instanceof Inet6Address) {
+ // WORKAROUND: For now ipv6 is not supported
+ // TODO: implement ipv6 case
+ LOG.debug("ipv6 address case is not implemented yet. dpid {} segmentationId {} macAddressStr, ipAddress {} action {}",
+ dpid, segmentationId, macAddressStr, ipAddress, action);
+ return new Status(StatusCode.NOTIMPLEMENTED);
+ }
+
MatchUtils.createEtherTypeMatch(matchBuilder, new EtherType(Constants.ARP_ETHERTYPE));
MatchUtils.createArpDstIpv4Match(matchBuilder, MatchUtils.iPv4PrefixFromIPv4Address(ipAddress.getHostAddress()));
package org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.services;
import java.math.BigInteger;
+import java.net.Inet6Address;
import java.net.InetAddress;
import java.util.List;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.common.collect.Lists;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
public class L3ForwardingService extends AbstractServiceInstance implements L3ForwardingProvider, ConfigInterface {
+ private static final Logger LOG = LoggerFactory.getLogger(L3ForwardingService.class);
+
public L3ForwardingService() {
super(Service.L3_FORWARDING);
}
List<Instruction> instructions = Lists.newArrayList();
InstructionBuilder ib = new InstructionBuilder();
+ if (ipAddress instanceof Inet6Address) {
+ // WORKAROUND: For now ipv6 is not supported
+ // TODO: implement ipv6 case
+ LOG.debug("ipv6 address is not implemented yet. dpid {} segmentationId {} ipAddress {} macAddress {} Action {}",
+ dpid, segmentationId, ipAddress, macAddress, action);
+ return new Status(StatusCode.NOTIMPLEMENTED);
+ }
+
MatchUtils.createTunnelIDMatch(matchBuilder, new BigInteger(segmentationId));
MatchUtils.createDstL3IPv4Match(matchBuilder, MatchUtils.iPv4PrefixFromIPv4Address(ipAddress.getHostAddress()));
// TODO: implement ipv6 case
LOG.debug("ipv6 address is not implemented yet. address {}",
address);
- new Status(StatusCode.NOTIMPLEMENTED);
+ return new Status(StatusCode.NOTIMPLEMENTED);
}
final String prefixString = address.getHostAddress() + "/" + mask;
MatchUtils.createDstL3IPv4Match(matchBuilder, new Ipv4Prefix(prefixString));
<groupId>org.opendaylight.ovsdb</groupId>
<artifactId>openstack.net-virt</artifactId>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.2.1-SNAPSHOT</version>
<packaging>bundle</packaging>
<description>The OVSDB Plugin integration project is a project for OpenDaylight that will implement the Open vSwitch Database RFC 7047 management protocol allowing the Southbound configuration of vSwitches and a network virtualization implementation.</description>
<url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
<properties>
<networkconfig.neutron.version>0.6.0-SNAPSHOT</networkconfig.neutron.version>
- <ovsdb.utils.config.version>1.2.0-SNAPSHOT</ovsdb.utils.config.version>
- <ovsdb.utils.servicehelper.version>1.2.0-SNAPSHOT</ovsdb.utils.servicehelper.version>
+ <ovsdb.utils.config.version>1.2.1-SNAPSHOT</ovsdb.utils.config.version>
+ <ovsdb.utils.servicehelper.version>1.2.1-SNAPSHOT</ovsdb.utils.servicehelper.version>
<powermock.version>1.5.2</powermock.version>
<sonar-jacoco-listeners.version>2.4</sonar-jacoco-listeners.version>
<root.directory>${env.PWD}</root.directory>
<dependency>
<groupId>org.opendaylight.ovsdb</groupId>
<artifactId>southbound-api</artifactId>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.2.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.opendaylight.ovsdb</groupId>
import java.util.List;
import java.util.Map;
+
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbNodeAugmentation;
Long getOFPort(OvsdbTerminationPointAugmentation port);
Long getOFPort(Node bridgeNode, String portName);
DataBroker getDatabroker();
+ OvsdbBridgeAugmentation getBridgeFromConfig(Node ovsdbNode, String bridgeName);
}
import org.opendaylight.neutron.spi.NeutronNetwork;
import org.opendaylight.ovsdb.openstack.netvirt.ConfigInterface;
+import org.opendaylight.ovsdb.openstack.netvirt.MdsalHelper;
import org.opendaylight.ovsdb.openstack.netvirt.NetworkHandler;
import org.opendaylight.ovsdb.openstack.netvirt.api.BridgeConfigurationManager;
import org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService;
*/
private boolean addBridge(Node ovsdbNode, String bridgeName) throws Exception {
boolean rv = true;
- if (!southbound.isBridgeOnOvsdbNode(ovsdbNode, bridgeName)) {
+ if ((!southbound.isBridgeOnOvsdbNode(ovsdbNode, bridgeName)) ||
+ (southbound.getBridgeFromConfig(ovsdbNode, bridgeName) == null)) {
rv = southbound.addBridge(ovsdbNode, bridgeName, getControllerTarget(ovsdbNode));
}
return rv;
}
return ofPort;
}
+ public OvsdbBridgeAugmentation getBridgeFromConfig(Node node, String bridge) {
+ OvsdbBridgeAugmentation ovsdbBridgeAugmentation = null;
+ InstanceIdentifier<Node> bridgeIid =
+ MdsalHelper.createInstanceIdentifier(node.getKey(), bridge);
+ Node bridgeNode = mdsalUtils.read(LogicalDatastoreType.CONFIGURATION, bridgeIid);
+ if (bridgeNode != null) {
+ ovsdbBridgeAugmentation = bridgeNode.getAugmentation(OvsdbBridgeAugmentation.class);
+ }
+ return ovsdbBridgeAugmentation;
+ }
}
</parent>
<artifactId>openstack</artifactId>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.2.1-SNAPSHOT</version>
<name>${project.artifactId}</name>
<packaging>pom</packaging>
<description>The OVSDB Plugin integration project is a project for OpenDaylight that will implement the Open vSwitch Database RFC 7047 management protocol allowing the Southbound configuration of vSwitches and a network virtualization implementation.</description>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>${bundle.plugin.version}</version>
<extensions>true</extensions>
<configuration>
<instructions>
<groupId>org.opendaylight.ovsdb</groupId>
<artifactId>ovsdb-artifacts</artifactId>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.2.1-SNAPSHOT</version>
<packaging>pom</packaging>
<description>The OVSDB Plugin integration project is a project for OpenDaylight that will implement the Open vSwitch Database RFC 7047 management protocol allowing the Southbound configuration of vSwitches and a network virtualization implementation.</description>
<url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
</parent>
<artifactId>ovsdb-plugin-compatibility-layer</artifactId>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.2.1-SNAPSHOT</version>
<name>${project.artifactId}</name>
<packaging>bundle</packaging>
<description>The OVSDB Plugin integration project is a project for OpenDaylight that will implement the Open vSwitch Database RFC 7047 management protocol allowing the Southbound configuration of vSwitches and a network virtualization implementation.</description>
</parent>
<artifactId>plugin-mdsal-adapter</artifactId>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.2.1-SNAPSHOT</version>
<packaging>bundle</packaging>
<dependencies>
</parent>
<artifactId>plugin-shell</artifactId>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.2.1-SNAPSHOT</version>
<packaging>bundle</packaging>
<description>The OVSDB Plugin integration project is a project for OpenDaylight that will implement the Open vSwitch Database RFC 7047 management protocol allowing the Southbound configuration of vSwitches and a network virtualization implementation.</description>
<url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
</parent>
<artifactId>plugin</artifactId>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.2.1-SNAPSHOT</version>
<packaging>bundle</packaging>
<description>The OVSDB Plugin integration project is a project for OpenDaylight that will implement the Open vSwitch Database RFC 7047 management protocol allowing the Southbound configuration of vSwitches and a network virtualization implementation.</description>
<url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
</parent>
<artifactId>ovsdb</artifactId>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.2.1-SNAPSHOT</version>
<name>${project.artifactId}</name> <!-- Used by Sonar to set project name -->
<packaging>pom</packaging>
<description>The OVSDB Plugin integration project is a project for OpenDaylight that will implement the Open vSwitch Database RFC 7047 management protocol allowing the Southbound configuration of vSwitches and a network virtualization implementation.</description>
<!-- Parent POM files -->
<module>commons</module>
+ <module>library</module>
+ <!-- Aggregations -->
<module>features</module>
<module>karaf</module>
<!-- OVSDB Components -->
- <module>library</module>
<module>southbound</module>
<module>northbound</module>
<module>openstack</module>
</parent>
<artifactId>schema.hardwarevtep</artifactId>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.2.1-SNAPSHOT</version>
<packaging>bundle</packaging>
<description>The OVSDB Plugin integration project is a project for OpenDaylight that will implement the Open vSwitch Database RFC 7047 management protocol allowing the Southbound configuration of vSwitches and a network virtualization implementation.</description>
<url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
</parent>
<artifactId>schema.openvswitch</artifactId>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.2.1-SNAPSHOT</version>
<packaging>bundle</packaging>
<description>The OVSDB Plugin integration project is a project for OpenDaylight that will implement the Open vSwitch Database RFC 7047 management protocol allowing the Southbound configuration of vSwitches and a network virtualization implementation.</description>
<url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
</parent>
<artifactId>schemas</artifactId>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.2.1-SNAPSHOT</version>
<name>${project.artifactId}</name>
<packaging>pom</packaging>
<description>The OVSDB Plugin integration project is a project for OpenDaylight that will implement the Open vSwitch Database RFC 7047 management protocol allowing the Southbound configuration of vSwitches and a network virtualization implementation.</description>
-<?xml version="1.0" encoding="UTF-8"?>\r
-<!--\r
-Copyright (c) 2014 Cisco Systems and others. All rights reserved.\r
-This program and the accompanying materials are made available under the\r
-terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
-and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL\r
--->\r
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">\r
- <groupId>org.opendaylight.ovsdb</groupId>\r
- <parent>\r
- <artifactId>commons</artifactId>\r
- <groupId>org.opendaylight.ovsdb</groupId>\r
- <version>1.4.0-SNAPSHOT</version>\r
- <relativePath>../commons/parent</relativePath>\r
- </parent>\r
- <artifactId>southbound-aggregator</artifactId>\r
- <version>1.2.0-SNAPSHOT</version>\r
- <name>${project.artifactId}</name>\r
- <packaging>pom</packaging>\r
- <description>The OVSDB Plugin integration project is a project for OpenDaylight that will implement the Open vSwitch Database RFC 7047 management protocol allowing the Southbound configuration of vSwitches and a network virtualization implementation.</description>\r
- <url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>\r
- <licenses>\r
- <license>\r
- <name>Eclipse Public License v1.0</name>\r
- <url>http://www.eclipse.org/legal/epl-v10.html</url>\r
- </license>\r
- </licenses>\r
- <developers>\r
- <developer>\r
- <name>Sam Hague</name>\r
- <email>shague@gmail.com</email>\r
- <url>https://github.com/shague</url>\r
- </developer>\r
- </developers>\r
- <scm>\r
- <connection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</connection>\r
- <developerConnection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</developerConnection>\r
- <tag>HEAD</tag>\r
- <url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>\r
- </scm>\r
- <modelVersion>4.0.0</modelVersion>\r
- <prerequisites>\r
- <maven>3.1.1</maven>\r
- </prerequisites>\r
- <modules>\r
- <module>southbound-api</module>\r
- <module>southbound-impl</module>\r
- <module>southbound-karaf</module>\r
- <module>southbound-features</module>\r
- <module>southbound-artifacts</module>\r
- <module>southbound-it</module>\r
- </modules>\r
-</project>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright (c) 2014 Cisco Systems and others. All rights reserved.
+This program and the accompanying materials are made available under the
+terms of the Eclipse Public License v1.0 which accompanies this distribution,
+and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <groupId>org.opendaylight.ovsdb</groupId>
+ <parent>
+ <artifactId>commons</artifactId>
+ <groupId>org.opendaylight.ovsdb</groupId>
+ <version>1.4.0-SNAPSHOT</version>
+ <relativePath>../commons/parent</relativePath>
+ </parent>
+ <artifactId>southbound-aggregator</artifactId>
+ <version>1.2.1-SNAPSHOT</version>
+ <name>${project.artifactId}</name>
+ <packaging>pom</packaging>
+ <description>The OVSDB Plugin integration project is a project for OpenDaylight that will implement the Open vSwitch Database RFC 7047 management protocol allowing the Southbound configuration of vSwitches and a network virtualization implementation.</description>
+ <url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
+ <licenses>
+ <license>
+ <name>Eclipse Public License v1.0</name>
+ <url>http://www.eclipse.org/legal/epl-v10.html</url>
+ </license>
+ </licenses>
+ <developers>
+ <developer>
+ <name>Sam Hague</name>
+ <email>shague@gmail.com</email>
+ <url>https://github.com/shague</url>
+ </developer>
+ </developers>
+ <scm>
+ <connection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</connection>
+ <developerConnection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</developerConnection>
+ <tag>HEAD</tag>
+ <url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
+ </scm>
+ <modelVersion>4.0.0</modelVersion>
+ <prerequisites>
+ <maven>3.1.1</maven>
+ </prerequisites>
+ <modules>
+ <module>southbound-api</module>
+ <module>southbound-impl</module>
+ <module>southbound-karaf</module>
+ <module>southbound-features</module>
+ <module>southbound-artifacts</module>
+ <module>southbound-it</module>
+ </modules>
+</project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.opendaylight.ovsdb</groupId>
<artifactId>southbound-api</artifactId>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.2.1-SNAPSHOT</version>
<packaging>bundle</packaging>
<description>The OVSDB Plugin integration project is a project for OpenDaylight that will implement the Open vSwitch Database RFC 7047 management protocol allowing the Southbound configuration of vSwitches and a network virtualization implementation.</description>
<url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
<modelVersion>4.0.0</modelVersion>
<groupId>org.opendaylight.ovsdb</groupId>
<artifactId>southbound-artifacts</artifactId>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.2.1-SNAPSHOT</version>
<packaging>pom</packaging>
<description>The OVSDB Plugin integration project is a project for OpenDaylight that will implement the Open vSwitch Database RFC 7047 management protocol allowing the Southbound configuration of vSwitches and a network virtualization implementation.</description>
<url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
</parent>
<groupId>org.opendaylight.ovsdb</groupId>
<artifactId>southbound-features</artifactId>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.2.1-SNAPSHOT</version>
<name>${project.artifactId}</name>
<modelVersion>4.0.0</modelVersion>
<description>The OVSDB Plugin integration project is a project for OpenDaylight that will implement the Open vSwitch Database RFC 7047 management protocol allowing the Southbound configuration of vSwitches and a network virtualization implementation.</description>
<modelVersion>4.0.0</modelVersion>
<groupId>org.opendaylight.ovsdb</groupId>
<artifactId>southbound-impl</artifactId>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.2.1-SNAPSHOT</version>
<packaging>bundle</packaging>
<description>The OVSDB Plugin integration project is a project for OpenDaylight that will implement the Open vSwitch Database RFC 7047 management protocol allowing the Southbound configuration of vSwitches and a network virtualization implementation.</description>
<url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
--- /dev/null
+package org.opendaylight.ovsdb.southbound;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.opendaylight.ovsdb.lib.EchoServiceCallbackFilters;
+import org.opendaylight.ovsdb.lib.LockAquisitionCallback;
+import org.opendaylight.ovsdb.lib.LockStolenCallback;
+import org.opendaylight.ovsdb.lib.MonitorCallBack;
+import org.opendaylight.ovsdb.lib.MonitorHandle;
+import org.opendaylight.ovsdb.lib.OvsdbClient;
+import org.opendaylight.ovsdb.lib.OvsdbConnectionInfo;
+import org.opendaylight.ovsdb.lib.message.MonitorRequest;
+import org.opendaylight.ovsdb.lib.message.MonitorRequestBuilder;
+import org.opendaylight.ovsdb.lib.message.MonitorSelect;
+import org.opendaylight.ovsdb.lib.message.TableUpdates;
+import org.opendaylight.ovsdb.lib.operations.OperationResult;
+import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
+import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+import org.opendaylight.ovsdb.southbound.ovsdb.transact.TransactCommand;
+import org.opendaylight.ovsdb.southbound.ovsdb.transact.TransactInvoker;
+import org.opendaylight.ovsdb.southbound.transactions.md.TransactionInvoker;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.ConnectionInfo;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.api.support.membermodification.MemberMatcher;
+import org.powermock.api.support.membermodification.MemberModifier;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.powermock.reflect.Whitebox;
+
+import com.google.common.util.concurrent.ListenableFuture;
+
+@PrepareForTest({OvsdbConnectionInstance.class, MonitorRequestBuilder.class})
+@RunWith(PowerMockRunner.class)
+
+public class OvsdbConnectionInstanceTest {
+ @Mock private OvsdbConnectionInstance ovsdbConnectionInstance;
+ @Mock private OvsdbClient client;
+ @Mock private ConnectionInfo connectionInfo;
+ @Mock private TransactionInvoker txInvoker;
+ @Mock private MonitorCallBack callback;
+ @Mock private ConnectionInfo key;
+ @Mock private InstanceIdentifier<Node> instanceIdentifier;
+ private Map<DatabaseSchema,TransactInvoker> transactInvokers;
+
+ @Before
+ public void setUp() throws Exception {
+ ovsdbConnectionInstance = PowerMockito.mock(OvsdbConnectionInstance.class, Mockito.CALLS_REAL_METHODS);
+ MemberModifier.field(OvsdbConnectionInstance.class, "txInvoker").set(ovsdbConnectionInstance, txInvoker);
+ MemberModifier.field(OvsdbConnectionInstance.class, "key").set(ovsdbConnectionInstance, key);
+ MemberModifier.field(OvsdbConnectionInstance.class, "connectionInfo").set(ovsdbConnectionInstance, key);
+ MemberModifier.field(OvsdbConnectionInstance.class, "instanceIdentifier").set(ovsdbConnectionInstance, instanceIdentifier);
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Test
+ public void testTransact() throws Exception {
+ TransactCommand command = mock(TransactCommand.class);
+ transactInvokers = new HashMap();
+
+ //init instance variables
+ TransactInvoker transactInvoker1 = mock(TransactInvoker.class);
+ TransactInvoker transactInvoker2 = mock(TransactInvoker.class);
+ transactInvokers.put(mock(DatabaseSchema.class), transactInvoker1);
+ transactInvokers.put(mock(DatabaseSchema.class), transactInvoker2);
+ MemberModifier.field(OvsdbConnectionInstance.class, "transactInvokers").set(ovsdbConnectionInstance , transactInvokers);
+
+ ovsdbConnectionInstance.transact(command);
+ verify(transactInvoker1).invoke(any(TransactCommand.class));
+ verify(transactInvoker2).invoke(any(TransactCommand.class));
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testRegisterCallbacks() throws Exception {
+
+ //callback not null case
+ MemberModifier.field(OvsdbConnectionInstance.class, "callback").set(ovsdbConnectionInstance , callback);
+ ovsdbConnectionInstance.registerCallbacks();
+ verify(ovsdbConnectionInstance, times(0)).getDatabases();
+
+ //callback null case
+ MemberModifier.field(OvsdbConnectionInstance.class, "callback").set(ovsdbConnectionInstance , null);
+ ListenableFuture<List<String>> listenableFuture = mock(ListenableFuture.class);
+ List<String> databases = new ArrayList<String>();
+ databases.add("Open_vSwitch");
+ databases.add("");
+ doReturn(listenableFuture).when(ovsdbConnectionInstance).getDatabases();
+ when(listenableFuture.get()).thenReturn(databases);
+
+ ListenableFuture<DatabaseSchema> listenableDbSchema = mock(ListenableFuture.class);
+ DatabaseSchema dbSchema= mock(DatabaseSchema.class);
+ doReturn(listenableDbSchema).when(ovsdbConnectionInstance).getSchema(anyString());
+ when(listenableDbSchema.get()).thenReturn(dbSchema);
+
+ MemberModifier.suppress(MemberMatcher.method(OvsdbConnectionInstance.class, "monitorAllTables", String.class,DatabaseSchema.class));
+ ovsdbConnectionInstance.registerCallbacks();
+ PowerMockito.verifyPrivate(ovsdbConnectionInstance, times(2)).invoke("monitorAllTables", anyString(), any(DatabaseSchema.class));
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Test
+ public void testCreateTransactInvokers() throws Exception {
+ //transactInvokers not null case
+ transactInvokers = new HashMap();
+ MemberModifier.field(OvsdbConnectionInstance.class, "transactInvokers").set(ovsdbConnectionInstance , transactInvokers);
+ ovsdbConnectionInstance.createTransactInvokers();
+ verify(ovsdbConnectionInstance, times(0)).getDatabases();
+
+ //transactInvokers null case
+ MemberModifier.field(OvsdbConnectionInstance.class, "transactInvokers").set(ovsdbConnectionInstance , null);
+ ListenableFuture<List<String>> listenableFuture = mock(ListenableFuture.class);
+ List<String> databases = new ArrayList<String>();
+ databases.add("database1");
+ databases.add("database2");
+ doReturn(listenableFuture).when(ovsdbConnectionInstance).getDatabases();
+ when(listenableFuture.get()).thenReturn(databases);
+
+ ListenableFuture<DatabaseSchema> listenableDbSchema = mock(ListenableFuture.class);
+ DatabaseSchema dbSchema= mock(DatabaseSchema.class);
+ DatabaseSchema dbSchema1= mock(DatabaseSchema.class);
+ doReturn(listenableDbSchema).when(ovsdbConnectionInstance).getSchema(anyString());
+ when(listenableDbSchema.get()).thenReturn(dbSchema).thenReturn(dbSchema1);
+
+ ovsdbConnectionInstance.createTransactInvokers();
+ verify(ovsdbConnectionInstance).getDatabases();
+ verify(ovsdbConnectionInstance, times(2)).getSchema(anyString());
+
+ Map<DatabaseSchema,TransactInvoker> testTransactInvokers = Whitebox.getInternalState(ovsdbConnectionInstance, "transactInvokers");
+ assertEquals("Error, size of the hashmap is incorrect", 2, testTransactInvokers.size());
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testMonitorAllTables() throws Exception {
+ Set<String> tables = new HashSet<String>();
+ tables.add("tableName1");
+ tables.add("tableName2");
+ DatabaseSchema dbSchema = mock(DatabaseSchema.class);
+ when(dbSchema.getTables()).thenReturn(tables);
+ GenericTableSchema tableSchema = mock(GenericTableSchema.class);
+ when(dbSchema.table(anyString(), eq(GenericTableSchema.class))).thenReturn(tableSchema);
+
+ Set<String> columns = new HashSet<String>();
+ columns.add("columnName1");
+ columns.add("columnName2");
+ when(tableSchema.getColumns()).thenReturn(columns);
+ MonitorRequestBuilder<GenericTableSchema> monitorBuilder = mock(MonitorRequestBuilder.class);
+ PowerMockito.mockStatic(MonitorRequestBuilder.class);
+ when(MonitorRequestBuilder.builder(any(GenericTableSchema.class))).thenReturn(monitorBuilder);
+ when(monitorBuilder.addColumn(anyString())).thenReturn(monitorBuilder);
+ MonitorRequest<GenericTableSchema> monitorReq = mock(MonitorRequest.class);
+ when(monitorBuilder.with(any(MonitorSelect.class))).thenReturn(monitorBuilder);
+ when(monitorBuilder.build()).thenReturn(monitorReq);
+
+ MemberModifier.suppress(MemberMatcher.method(OvsdbConnectionInstance.class, "monitor", DatabaseSchema.class, List.class, MonitorCallBack.class));
+ TableUpdates tableUpdates = mock(TableUpdates.class);
+ when(ovsdbConnectionInstance.monitor(any(DatabaseSchema.class), any(List.class), any(MonitorCallBack.class))).thenReturn(tableUpdates);
+ MemberModifier.field(OvsdbConnectionInstance.class, "callback").set(ovsdbConnectionInstance, callback);
+ doNothing().when(callback).update(any(TableUpdates.class), any(DatabaseSchema.class));
+
+ Whitebox.invokeMethod(ovsdbConnectionInstance, "monitorAllTables", "database", dbSchema);
+ PowerMockito.verifyPrivate(ovsdbConnectionInstance, times(1)).invoke("monitorAllTables", anyString(), any(DatabaseSchema.class));
+
+ verify(monitorBuilder, times(4)).addColumn(anyString());
+ }
+
+ @SuppressWarnings({ "unchecked" })
+ @Test
+ public void testOvsdbConnectionInstance() throws Exception {
+ MemberModifier.field(OvsdbConnectionInstance.class, "client").set(ovsdbConnectionInstance, client);
+ DatabaseSchema databaseSchema = mock(DatabaseSchema.class);
+
+ //test getDatabases()
+ ListenableFuture<List<String>> listenableFuture = mock(ListenableFuture.class);
+ when(client.getDatabases()).thenReturn(listenableFuture);
+ assertEquals("Error, did not return correct ListenableFuture<List<String>> object", listenableFuture, ovsdbConnectionInstance.getDatabases());
+ verify(client).getDatabases();
+
+ //test getSchema()
+ ListenableFuture<DatabaseSchema> futureDatabaseSchema = mock(ListenableFuture.class);
+ when(client.getSchema(anyString())).thenReturn(futureDatabaseSchema);
+ assertEquals("Error, did not return correct ListenableFuture<DatabaseSchema> object", futureDatabaseSchema, ovsdbConnectionInstance.getSchema(anyString()));
+ verify(client).getSchema(anyString());
+
+ //test transactBuilder()
+ TransactionBuilder transactionBuilder = mock(TransactionBuilder.class);
+ when(client.transactBuilder(any(DatabaseSchema.class))).thenReturn(transactionBuilder);
+ assertEquals("Error, did not return correct TransactionBuilder object", transactionBuilder, ovsdbConnectionInstance.transactBuilder(any(DatabaseSchema.class)));
+ verify(client).transactBuilder(any(DatabaseSchema.class));
+
+ //test transact()
+ ListenableFuture<List<OperationResult>> futureOperationResult = mock(ListenableFuture.class);
+ when(client.transact(any(DatabaseSchema.class), any(List.class))).thenReturn(futureOperationResult);
+ assertEquals("Error, did not return correct ListenableFuture<List<OperationResult>> object", futureOperationResult, ovsdbConnectionInstance.transact(any(DatabaseSchema.class), any(List.class)));
+ verify(client).transact(any(DatabaseSchema.class), any(List.class));
+
+ //test monitor()
+ TableUpdates tableUpdates = mock(TableUpdates.class);
+ when(client.monitor(any(DatabaseSchema.class), any(List.class), any(MonitorCallBack.class))).thenReturn(tableUpdates);
+ assertEquals("Error, did not return correct TableUpdates object", tableUpdates, ovsdbConnectionInstance.monitor(any(DatabaseSchema.class), any(List.class), any(MonitorCallBack.class)));
+ verify(client).monitor(any(DatabaseSchema.class), any(List.class), any(MonitorCallBack.class));
+
+ //test cancelMonitor()
+ doNothing().when(client).cancelMonitor(any(MonitorHandle.class));
+ MonitorHandle monitorHandle = mock(MonitorHandle.class);
+ ovsdbConnectionInstance.cancelMonitor(monitorHandle);
+ verify(client).cancelMonitor(any(MonitorHandle.class));
+
+ //test lock()
+ doNothing().when(client).lock(anyString(), any(LockAquisitionCallback.class), any(LockStolenCallback.class));
+ LockAquisitionCallback lockAquisitionCallback = mock(LockAquisitionCallback.class);
+ LockStolenCallback lockStolenCallback = mock(LockStolenCallback.class);
+ ovsdbConnectionInstance.lock("lockId", lockAquisitionCallback, lockStolenCallback);
+ verify(client).lock(anyString(), any(LockAquisitionCallback.class), any(LockStolenCallback.class));
+
+ //test steal()
+ ListenableFuture<Boolean> futureBoolean = mock(ListenableFuture.class);
+ when(client.steal(anyString())).thenReturn(futureBoolean);
+ assertEquals("Error, did not return correct ListenableFuture<Boolean> object", futureBoolean, ovsdbConnectionInstance.steal(anyString()));
+ verify(client).steal(anyString());
+
+ //test unLock()
+ when(client.unLock(anyString())).thenReturn(futureBoolean);
+ assertEquals("Error, did not return correct ListenableFuture<Boolean> object", futureBoolean, ovsdbConnectionInstance.unLock(anyString()));
+ verify(client).unLock(anyString());
+
+ //test startEchoService()
+ EchoServiceCallbackFilters echoServiceCallbackFilters = mock(EchoServiceCallbackFilters.class);
+ doNothing().when(client).startEchoService(any(EchoServiceCallbackFilters.class));
+ ovsdbConnectionInstance.startEchoService(echoServiceCallbackFilters);
+ verify(client).startEchoService(any(EchoServiceCallbackFilters.class));
+
+ //test stopEchoService()
+ doNothing().when(client).stopEchoService();
+ ovsdbConnectionInstance.stopEchoService();
+ verify(client).stopEchoService();
+
+ //test isActive()
+ when(client.isActive()).thenReturn(true);
+ assertEquals("Error, does not match isActive()", true, ovsdbConnectionInstance.isActive());
+ verify(client).isActive();
+
+ //test disconnect()
+ doNothing().when(client).disconnect();
+ ovsdbConnectionInstance.disconnect();
+ verify(client).disconnect();
+
+ //test getDatabaseSchema()
+ when(client.getDatabaseSchema(anyString())).thenReturn(databaseSchema);
+ assertEquals("Error, did not return correct DatabaseSchema object", databaseSchema, ovsdbConnectionInstance.getDatabaseSchema(anyString()));
+ verify(client).getDatabaseSchema(anyString());
+
+ //test getConnectionInfo()
+ OvsdbConnectionInfo ovsdbConnectionInfo = mock(OvsdbConnectionInfo.class);
+ when(client.getConnectionInfo()).thenReturn(ovsdbConnectionInfo);
+ assertEquals("Error, did not return correct OvsdbConnectionInfo object", ovsdbConnectionInfo, ovsdbConnectionInstance.getConnectionInfo());
+ verify(client).getConnectionInfo();
+
+ //test getMDConnectionInfo()
+ assertEquals("Error, incorrect connectionInfo", key, ovsdbConnectionInstance.getMDConnectionInfo());
+
+ //test setMDConnectionInfo()
+ ovsdbConnectionInstance.setMDConnectionInfo(key);
+ assertEquals("Error, incorrect ConnectionInfo", key, Whitebox.getInternalState(ovsdbConnectionInstance, "key"));
+
+ //test getInstanceIdentifier()
+ assertEquals("Error, incorrect instanceIdentifier", instanceIdentifier, ovsdbConnectionInstance.getInstanceIdentifier());
+
+ //test getNodeId()
+ NodeKey nodeKey = mock(NodeKey.class);
+ NodeId nodeId = mock(NodeId.class);
+ MemberModifier.suppress(MemberMatcher.method(OvsdbConnectionInstance.class, "getNodeKey"));
+ when(ovsdbConnectionInstance.getNodeKey()).thenReturn(nodeKey);
+ when(nodeKey.getNodeId()).thenReturn(nodeId);
+ assertEquals("Error, incorrect NodeId object", nodeId, ovsdbConnectionInstance.getNodeId());
+
+ //test setInstanceIdentifier()
+ ovsdbConnectionInstance.setInstanceIdentifier(instanceIdentifier);
+ assertEquals("Error, incorrect instanceIdentifier", instanceIdentifier, Whitebox.getInternalState(ovsdbConnectionInstance, "instanceIdentifier"));
+
+ //test monitor()
+ MemberModifier.suppress(MemberMatcher.method(OvsdbConnectionInstance.class, "monitor", DatabaseSchema.class, List.class, MonitorHandle.class, MonitorCallBack.class));
+ when(ovsdbConnectionInstance.monitor(any(DatabaseSchema.class), any(List.class), any(MonitorHandle.class), any(MonitorCallBack.class))).thenReturn(null);
+ assertNull(ovsdbConnectionInstance.monitor(any(DatabaseSchema.class), any(List.class), any(MonitorHandle.class), any(MonitorCallBack.class)));
+ }
+}
--- /dev/null
+package org.opendaylight.ovsdb.southbound;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.opendaylight.ovsdb.lib.message.TableUpdates;
+import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
+import org.opendaylight.ovsdb.southbound.transactions.md.OvsdbOperationalCommandAggregator;
+import org.opendaylight.ovsdb.southbound.transactions.md.TransactionInvoker;
+
+@RunWith(MockitoJUnitRunner.class)
+
+public class OvsdbMonitorCallbackTest {
+ @InjectMocks private OvsdbMonitorCallback ovsdbMonitorCallback = mock(OvsdbMonitorCallback.class, Mockito.CALLS_REAL_METHODS);
+ @Mock private TransactionInvoker txInvoker;
+ @Mock private OvsdbConnectionInstance key;
+
+ @Test
+ public void testUpdate() {
+ ovsdbMonitorCallback.update(mock(TableUpdates.class), mock(DatabaseSchema.class));
+ verify(txInvoker).invoke(any(OvsdbOperationalCommandAggregator.class));
+ }
+
+ @Test
+ public void testException() {
+ ovsdbMonitorCallback.exception(mock(Throwable.class));
+ verify(ovsdbMonitorCallback).exception(any(Throwable.class));
+ }
+}
<parent>
<groupId>org.opendaylight.controller</groupId>
- <artifactId>config-parent</artifactId>
- <version>0.4.0-SNAPSHOT</version>
+ <artifactId>mdsal-it-parent</artifactId>
+ <version>1.3.0-SNAPSHOT</version>
<relativePath/>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.opendaylight.ovsdb</groupId>
<artifactId>southbound-it</artifactId>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.2.1-SNAPSHOT</version>
<packaging>jar</packaging>
<description>The OVSDB Plugin integration project is a project for OpenDaylight that will implement the Open vSwitch Database RFC 7047 management protocol allowing the Southbound configuration of vSwitches and a network virtualization implementation.</description>
<url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
+++ /dev/null
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.ovsdb.southbound.it;
-
-import static org.ops4j.pax.exam.CoreOptions.maven;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder;
-
-import java.io.File;
-import java.lang.management.ManagementFactory;
-import java.util.Calendar;
-
-import javax.management.InstanceNotFoundException;
-
-import org.junit.Rule;
-import org.junit.internal.AssumptionViolatedException;
-import org.junit.rules.TestRule;
-import org.junit.rules.TestWatcher;
-import org.junit.runner.Description;
-import org.opendaylight.controller.config.api.ConfigRegistry;
-import org.opendaylight.controller.config.util.ConfigRegistryJMXClient;
-import org.ops4j.pax.exam.Configuration;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.karaf.options.LogLevelOption.LogLevel;
-import org.ops4j.pax.exam.options.MavenArtifactUrlReference;
-import org.ops4j.pax.exam.options.MavenUrlReference;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.collect.ObjectArrays;
-
-public abstract class AbstractConfigTestBase {
- private static final Logger LOG = LoggerFactory.getLogger(AbstractConfigTestBase.class);
-
- /*
- * Wait up to 10s for our configured module to come up
- */
- private static final int MODULE_TIMEOUT = 10000;
- private static int configTimes = 0;
-
- public abstract String getModuleName();
-
- public abstract String getInstanceName();
-
- public abstract MavenUrlReference getFeatureRepo();
-
- public abstract String getFeatureName();
-
- public Option[] getLoggingOptions() {
- Option[] options = new Option[] {
- editConfigurationFilePut(SouthboundITConstants.ORG_OPS4J_PAX_LOGGING_CFG,
- logConfiguration(AbstractConfigTestBase.class),
- LogLevel.INFO.name())
- };
- return options;
- }
-
- public String logConfiguration(Class<?> klazz) {
- return "log4j.logger." + klazz.getPackage().getName();
- }
-
- public Option[] getFeaturesOptions() {
- return new Option[]{};
- }
-
- public Option[] getPropertiesOptions() {
- return new Option[]{};
- }
-
- public MavenArtifactUrlReference getKarafDistro() {
- MavenArtifactUrlReference karafUrl;
- karafUrl = maven()
- // karaf-empty is busted
- //.groupId("org.opendaylight.controller")
- //.artifactId("opendaylight-karaf-empty")
- //.version("1.5.0-SNAPSHOT")
- .groupId("org.opendaylight.ovsdb")
- .artifactId("southbound-karaf")
- .versionAsInProject()
- .type("zip");
- return karafUrl;
- }
-
- @Configuration
- public Option[] config() {
- LOG.info("Calling config, configTimes: {}", configTimes);
- configTimes++;
- Option[] options = new Option[] {
- //KarafDistributionOption.debugConfiguration("5005", true),
- karafDistributionConfiguration()
- .frameworkUrl(getKarafDistro())
- .unpackDirectory(new File("target/exam"))
- .useDeployFolder(false),
- keepRuntimeFolder(),
- //debugConfiguration("5005", true),
- //features(getFeatureRepo() , getFeatureName())
- };
- options = ObjectArrays.concat(options, getFeaturesOptions(), Option.class);
- options = ObjectArrays.concat(options, getLoggingOptions(), Option.class);
- options = ObjectArrays.concat(options, getPropertiesOptions(), Option.class);
- return options;
- }
-
- public void setup() throws Exception {
- LOG.info("Module: {} Instance: {} attempting to configure.",
- getModuleName(),getInstanceName());
- Calendar start = Calendar.getInstance();
- ConfigRegistry configRegistryClient = new ConfigRegistryJMXClient(ManagementFactory
- .getPlatformMBeanServer());
- for (int timer = 0;timer < MODULE_TIMEOUT;timer++) {
- try {
- configRegistryClient.lookupConfigBean(getModuleName(), getInstanceName());
- Thread.sleep(1);
- } catch (InstanceNotFoundException e) {
- if (timer >= MODULE_TIMEOUT) {
- throw e;
- }
- } catch (InterruptedException e) {
- LOG.error("Exception: ",e);
- }
- }
- Calendar stop = Calendar.getInstance();
- LOG.info("Module: {} Instance: {} configured after {} ms",
- getModuleName(),getInstanceName(),
- stop.getTimeInMillis() - start.getTimeInMillis());
- }
-
- @Rule
- public TestRule watcher = new TestWatcher() {
- @Override
- protected void starting(Description description) {
- LOG.info("TestWatcher: Starting test:\n{}", description.getDisplayName());
- }
-
- @Override
- protected void finished(Description description) {
- LOG.info("TestWatcher: Finished test:\n{}", description.getDisplayName());
- }
-
- @Override
- protected void succeeded(Description description) {
- LOG.info("TestWatcher: Test succeeded:\n{}", description.getDisplayName());
- }
-
- @Override
- protected void failed(Throwable ex, Description description) {
- LOG.info("TestWatcher: Test failed:\n{} ", description.getDisplayName(), ex);
- }
-
- @Override
- protected void skipped(AssumptionViolatedException ex, Description description) {
- LOG.info("TestWatcher: Test skipped:\n{} ", description.getDisplayName(), ex);
- }
- };
-}
+++ /dev/null
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.ovsdb.southbound.it;
-
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
-
-import java.util.Calendar;
-
-import javax.inject.Inject;
-
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
-import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.karaf.options.LogLevelOption.LogLevel;
-import org.ops4j.pax.exam.util.Filter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.collect.ObjectArrays;
-
-public abstract class AbstractMdsalTestBase extends AbstractConfigTestBase implements BindingAwareProvider {
-
- private static final Logger LOG = LoggerFactory.getLogger(AbstractMdsalTestBase.class);
- private static final int REGISTRATION_TIMEOUT = 10000;
- @Inject @Filter(timeout = 60000)
- private BindingAwareBroker broker;
- private ProviderContext session = null;
-
- public ProviderContext getSession() {
- return session;
- }
-
- @Override
- public void onSessionInitiated(ProviderContext session) {
- LOG.info("Session Initiated: {}",session);
- this.session = session;
- }
-
- @Override
- public void setup() throws Exception {
- super.setup();
- Calendar start = Calendar.getInstance();
- broker.registerProvider(this);
- for (int timer = 0;timer < REGISTRATION_TIMEOUT;timer++) {
- if (session != null) {
- Calendar stop = Calendar.getInstance();
- LOG.info("Registered with the MD-SAL after {} ms",
- stop.getTimeInMillis() - start.getTimeInMillis());
- return;
- } else {
- Thread.sleep(1);
- }
- }
- throw new RuntimeException("Session not initiated after " + REGISTRATION_TIMEOUT + " ms");
- }
-
- @Override
- public Option[] getLoggingOptions() {
- Option[] options = new Option[] {
- editConfigurationFilePut(SouthboundITConstants.ORG_OPS4J_PAX_LOGGING_CFG,
- logConfiguration(AbstractMdsalTestBase.class),
- LogLevel.INFO.name()),
- };
- options = ObjectArrays.concat(options, super.getLoggingOptions(), Option.class);
- return options;
- }
-
-}
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
+import static org.ops4j.pax.exam.CoreOptions.composite;
import static org.ops4j.pax.exam.CoreOptions.maven;
+import static org.ops4j.pax.exam.CoreOptions.when;
import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder;
import com.google.common.collect.ImmutableBiMap;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
-import com.google.common.collect.ObjectArrays;
import com.google.common.collect.Sets;
+import java.io.File;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import org.junit.runner.RunWith;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.mdsal.it.base.AbstractMdsalTestBase;
import org.opendaylight.ovsdb.southbound.SouthboundConstants;
import org.opendaylight.ovsdb.southbound.SouthboundMapper;
import org.opendaylight.ovsdb.southbound.SouthboundProvider;
import org.ops4j.pax.exam.Configuration;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.karaf.options.KarafDistributionOption;
import org.ops4j.pax.exam.karaf.options.LogLevelOption;
import org.ops4j.pax.exam.options.MavenUrlReference;
import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
private static Boolean setup = false;
private static MdsalUtils mdsalUtils = null;
+ // TODO Constants copied frmo AbstractConfigTestBase, need to be removed (see TODO below)
+ private static final String PAX_EXAM_UNPACK_DIRECTORY = "target/exam";
+ private static final String KARAF_DEBUG_PORT = "5005";
+ private static final String KARAF_DEBUG_PROP = "karaf.debug";
+ private static final String KEEP_UNPACK_DIRECTORY_PROP = "karaf.keep.unpack";
+
@Inject
private BundleContext bundleContext;
@Configuration
public Option[] config() {
- return super.config();
+ // TODO Figure out how to use the parent Karaf setup, then just use super.config()
+ Option[] options = new Option[] {
+ when(Boolean.getBoolean(KARAF_DEBUG_PROP))
+ .useOptions(KarafDistributionOption.debugConfiguration(KARAF_DEBUG_PORT, true)),
+ karafDistributionConfiguration().frameworkUrl(getKarafDistro())
+ .unpackDirectory(new File(PAX_EXAM_UNPACK_DIRECTORY))
+ .useDeployFolder(false),
+ when(Boolean.getBoolean(KEEP_UNPACK_DIRECTORY_PROP)).useOptions(keepRuntimeFolder()),
+ // Works only if we don't specify the feature repo and name
+ getLoggingOption()};
+ Option[] propertyOptions = getPropertiesOptions();
+ Option[] combinedOptions = new Option[options.length + propertyOptions.length];
+ System.arraycopy(options, 0, combinedOptions, 0, options.length);
+ System.arraycopy(propertyOptions, 0, combinedOptions, options.length, propertyOptions.length);
+ return combinedOptions;
+ }
+
+ @Override
+ public String getKarafDistro() {
+ return maven()
+ .groupId("org.opendaylight.ovsdb")
+ .artifactId("southbound-karaf")
+ .versionAsInProject()
+ .type("zip")
+ .getURL();
}
@Override
}
@Override
- public Option[] getFeaturesOptions() {
- return new Option[]{};
- }
-
- @Override
- public Option[] getLoggingOptions() {
- Option[] options = new Option[] {
+ public Option getLoggingOption() {
+ return composite(
editConfigurationFilePut(SouthboundITConstants.ORG_OPS4J_PAX_LOGGING_CFG,
"log4j.logger.org.opendaylight.ovsdb",
- LogLevelOption.LogLevel.TRACE.name())
- };
-
- options = ObjectArrays.concat(options, super.getLoggingOptions(), Option.class);
- return options;
+ LogLevelOption.LogLevel.TRACE.name()),
+ super.getLoggingOption());
}
- @Override
- public Option[] getPropertiesOptions() {
+ private Option[] getPropertiesOptions() {
Properties props = new Properties(System.getProperties());
String addressStr = props.getProperty(SouthboundITConstants.SERVER_IPADDRESS,
SouthboundITConstants.DEFAULT_SERVER_IPADDRESS);
}
@Before
- public void setUp() throws InterruptedException {
- if (setup == true) {
+ @Override
+ public void setup() throws InterruptedException {
+ if (setup) {
LOG.info("Skipping setUp, already initialized");
return;
}
<modelVersion>4.0.0</modelVersion>
<groupId>org.opendaylight.ovsdb</groupId>
<artifactId>southbound-karaf</artifactId>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.2.1-SNAPSHOT</version>
<name>${project.artifactId}</name>
<prerequisites>
<maven>3.1.1</maven>
<artifactId>utils.config</artifactId>
<name>${project.artifactId}</name>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.2.1-SNAPSHOT</version>
<packaging>jar</packaging>
<description>The OVSDB Plugin integration project is a project for OpenDaylight that will implement the Open vSwitch Database RFC 7047 management protocol allowing the Southbound configuration of vSwitches and a network virtualization implementation.</description>
<url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
<artifactId>utils.mdsal-node</artifactId>
<name>${project.artifactId}</name>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.2.1-SNAPSHOT</version>
<packaging>jar</packaging>
<description>The OVSDB Plugin integration project is a project for OpenDaylight that will implement the Open vSwitch Database RFC 7047 management protocol allowing the Southbound configuration of vSwitches and a network virtualization implementation.</description>
<url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
<artifactId>utils.mdsal-openflow</artifactId>
<name>${project.artifactId}</name>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.2.1-SNAPSHOT</version>
<packaging>jar</packaging>
<description>The OVSDB Plugin integration project is a project for OpenDaylight that will implement the Open vSwitch Database RFC 7047 management protocol allowing the Southbound configuration of vSwitches and a network virtualization implementation.</description>
<url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
</parent>
<artifactId>utils.servicehelper</artifactId>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.2.1-SNAPSHOT</version>
<packaging>bundle</packaging>
<description>The OVSDB Plugin integration project is a project for OpenDaylight that will implement the Open vSwitch Database RFC 7047 management protocol allowing the Southbound configuration of vSwitches and a network virtualization implementation.</description>
<url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>