<configfile finalname="configuration/initial/module-shards.conf">mvn:org.opendaylight.controller/sal-clustering-config/${project.version}/xml/moduleshardconf</configfile>
<configfile finalname="configuration/initial/modules.conf">mvn:org.opendaylight.controller/sal-clustering-config/${project.version}/xml/moduleconf</configfile>
</feature>
+
+ <feature name='odl-clustering-test-app' version='${project.version}'>
+ <feature version='${yangtools.version}'>odl-yangtools-models</feature>
+ <feature version='${project.version}'>odl-mdsal-broker</feature>
+ <bundle>mvn:org.opendaylight.controller.samples/clustering-it-model/${project.version}</bundle>
+ <bundle>mvn:org.opendaylight.controller.samples/clustering-it-provider/${project.version}</bundle>
+ <configfile finalname="${config.configfile.directory}/20-clustering-test-app.xml">mvn:org.opendaylight.controller.samples/clustering-it-config/${project.version}/xml/config</configfile>
+ </feature>
+
</features>
-->
<feature version='${aaa.version}'>odl-aaa-netconf-plugin</feature>
<bundle>mvn:org.opendaylight.controller/netconf-ssh/${netconf.version}</bundle>
- <bundle>mvn:org.bouncycastle/bcpkix-jdk15on/${bouncycastle.version}</bundle>
- <bundle>mvn:org.bouncycastle/bcprov-jdk15on/${bouncycastle.version}</bundle>
</feature>
<feature name='odl-netconf-tcp' version='${netconf.version}' description="OpenDaylight :: Netconf Connector :: TCP">
<feature version='${netconf.version}'>odl-netconf-impl</feature>
<feature version='${project.version}'>odl-netconf-mapping-api</feature>
<feature version='${project.version}'>odl-netconf-util</feature>
<bundle>mvn:org.opendaylight.controller/netconf-netty-util/${project.version}</bundle>
+ <bundle>mvn:org.bouncycastle/bcpkix-jdk15on/${bouncycastle.version}</bundle>
+ <bundle>mvn:org.bouncycastle/bcprov-jdk15on/${bouncycastle.version}</bundle>
<bundle>mvn:org.apache.sshd/sshd-core/${sshd-core.version}</bundle>
<bundle>mvn:org.openexi/nagasena/${exi.nagasena.version}</bundle>
<bundle>mvn:io.netty/netty-codec/${netty.version}</bundle>
<maven>3.0</maven>
</prerequisites>
<modules>
- <module>base</module>
- <module>controller</module>
- <module>adsal</module>
- <module>nsf</module>
- <module>extras</module>
<module>config</module>
<module>config-persister</module>
<module>config-netty</module>
<module>flow</module>
<module>netconf</module>
<module>protocol-framework</module>
- <module>adsal-compatibility</module>
<module>akka</module>
<module>netconf-connector</module>
<module>restconf</module>
-->
<feature version='${project.version}'>odl-restconf</feature>
<feature version='${project.version}'>odl-mdsal-apidocs</feature>
- <feature version='${project.version}'>odl-clustering-test-app</feature>
</feature>
<!--
Necessary TODO: Define your features. It is useful to list then in order of dependency. So if A depends on B, list A first.
<bundle>wrap:mvn:org.json/json/${org.json.version}</bundle>
</feature>
- <feature name='odl-clustering-test-app' version='${project.version}'>
- <feature version='${project.version}'>odl-mdsal-clustering</feature>
- <feature version='${project.version}'>odl-restconf</feature>
- <feature version='${yangtools.version}'>odl-yangtools-models</feature>
- <bundle>mvn:org.opendaylight.controller.samples/clustering-it-model/${project.version}</bundle>
- <bundle>mvn:org.opendaylight.controller.samples/clustering-it-provider/${project.version}</bundle>
- <configfile finalname="${config.configfile.directory}/20-clustering-test-app.xml">mvn:org.opendaylight.controller.samples/clustering-it-config/${project.version}/xml/config</configfile>
- <configfile finalname="configuration/initial/module-shards.conf" override="true" >mvn:org.opendaylight.controller.samples/clustering-it-config/${project.version}/xml/testmoduleshardconf</configfile>
- <configfile finalname="configuration/initial/modules.conf" override="true">mvn:org.opendaylight.controller.samples/clustering-it-config/${project.version}/xml/testmoduleconf</configfile>
- </feature>
-
<feature name='odl-toaster-rest' version='${project.version}'>
<feature version='${project.version}'>odl-restconf</feature>
<feature version='${project.version}'>odl-toaster</feature>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../commons/opendaylight</relativePath>
+ <relativePath>../../commons/opendaylight</relativePath>
</parent>
<artifactId>appauth</artifactId>
<version>0.5.0-SNAPSHOT</version>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../commons/opendaylight</relativePath>
+ <relativePath>../../commons/opendaylight</relativePath>
</parent>
<artifactId>arphandler</artifactId>
<version>0.6.0-SNAPSHOT</version>
<artifactId>clustering.services.integrationtest</artifactId>
<version>0.5.0-SNAPSHOT</version>
<properties>
- <sonar.jacoco.itReportPath>../implementation/target/jacoco-it.exec</sonar.jacoco.itReportPath>
+ <sonar.jacoco.itReportPath>../../implementation/target/jacoco-it.exec</sonar.jacoco.itReportPath>
<!-- Sonar jacoco plugin to get integration test coverage info -->
- <sonar.jacoco.reportPath>../implementation/target/jacoco.exec</sonar.jacoco.reportPath>
+ <sonar.jacoco.reportPath>../../implementation/target/jacoco.exec</sonar.jacoco.reportPath>
</properties>
<dependencies>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<configuration>
- <destFile>../implementation/target/jacoco-it.exec</destFile>
+ <destFile>../../implementation/target/jacoco-it.exec</destFile>
<includes>
<include>org.opendaylight.controller.*</include>
</includes>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>clustering.services</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>clustering.services-implementation</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>clustering.stub</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>clustering.test</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>commons.httpclient</artifactId>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>${checkstyle.version}</version>
<configuration>
<failsOnError>true</failsOnError>
<configLocation>controller/checkstyle.xml</configLocation>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>commons.integrationtest</artifactId>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>${checkstyle.version}</version>
<configuration>
<failsOnError>true</failsOnError>
<configLocation>controller/checkstyle.xml</configLocation>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
- <version>${surefire.version}</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>configuration</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>configuration.implementation</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>connectionmanager</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>connectionmanager.implementation</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>containermanager</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>containermanager.implementation</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>containermanager.it.implementation</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>containermanager.shell</artifactId>
<version>${containermanager.shell.version}</version>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../commons/opendaylight</relativePath>
+ <relativePath>../../commons/opendaylight</relativePath>
</parent>
<artifactId>dummy-console</artifactId>
<version>1.2.0-SNAPSHOT</version>
<groupId>org.opendaylight.controller</groupId>\r
<artifactId>commons.opendaylight</artifactId>\r
<version>1.5.0-SNAPSHOT</version>\r
- <relativePath>../../opendaylight/commons/opendaylight</relativePath>\r
+ <relativePath>../../../../opendaylight/commons/opendaylight</relativePath>\r
</parent>\r
<artifactId>features-adsal-compatibility</artifactId>\r
<packaging>jar</packaging>\r
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../opendaylight/commons/opendaylight</relativePath>
+ <relativePath>../../../../opendaylight/commons/opendaylight</relativePath>
</parent>
<artifactId>features-adsal</artifactId>
<version>${sal.version}</version>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../opendaylight/commons/opendaylight</relativePath>
+ <relativePath>../../../../opendaylight/commons/opendaylight</relativePath>
</parent>
<artifactId>features-base</artifactId>
<packaging>jar</packaging>
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>features-test</artifactId>
- <version>0.7.0-SNAPSHOT</version>
</dependency>
<!-- dependency for opendaylight-karaf-empty for use by testing -->
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../opendaylight/commons/opendaylight</relativePath>
+ <relativePath>../../../../opendaylight/commons/opendaylight</relativePath>
</parent>
<artifactId>controller-features</artifactId>
<packaging>pom</packaging>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../opendaylight/commons/opendaylight</relativePath>
+ <relativePath>../../../../opendaylight/commons/opendaylight</relativePath>
</parent>
<artifactId>extras-features</artifactId>
<packaging>kar</packaging>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../opendaylight/commons/opendaylight</relativePath>
+ <relativePath>../../../../opendaylight/commons/opendaylight</relativePath>
</parent>
<artifactId>features-nsf</artifactId>
<version>${nsf.version}</version>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>forwarding.staticrouting</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>forwardingrulesmanager</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>forwardingrulesmanager.implementation</artifactId>
<artifactId>forwardingrulesmanager.integrationtest</artifactId>
<version>0.5.0-SNAPSHOT</version>
<properties>
- <sonar.jacoco.itReportPath>../implementation/target/jacoco-it.exec</sonar.jacoco.itReportPath>
+ <sonar.jacoco.itReportPath>../../implementation/target/jacoco-it.exec</sonar.jacoco.itReportPath>
<!-- Sonar jacoco plugin to get integration test coverage info -->
- <sonar.jacoco.reportPath>../implementation/target/jacoco.exec</sonar.jacoco.reportPath>
+ <sonar.jacoco.reportPath>../../implementation/target/jacoco.exec</sonar.jacoco.reportPath>
</properties>
<dependencies>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<configuration>
- <destFile>../implementation/target/jacoco-it.exec</destFile>
+ <destFile>../../implementation/target/jacoco-it.exec</destFile>
<includes>
<include>org.opendaylight.controller.*</include>
</includes>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>hosttracker</artifactId>
<version>0.6.0-SNAPSHOT</version>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>hosttracker.implementation</artifactId>
<version>0.6.0-SNAPSHOT</version>
<artifactId>hosttracker.integrationtest</artifactId>
<version>0.6.0-SNAPSHOT</version>
<properties>
- <sonar.jacoco.itReportPath>../implementaiton/target/jacoco-it.exec</sonar.jacoco.itReportPath>
+ <sonar.jacoco.itReportPath>../../implementaiton/target/jacoco-it.exec</sonar.jacoco.itReportPath>
<!-- Sonar jacoco plugin to get integration test coverage info -->
- <sonar.jacoco.reportPath>../implementation/target/jacoco.exec</sonar.jacoco.reportPath>
+ <sonar.jacoco.reportPath>../../implementation/target/jacoco.exec</sonar.jacoco.reportPath>
</properties>
<dependencies>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<configuration>
- <destFile>../implementation/target/jacoco-it.exec</destFile>
+ <destFile>../../implementation/target/jacoco-it.exec</destFile>
<includes>
<include>org.opendaylight.controller.*</include>
</includes>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>hosttracker.shell</artifactId>
<version>${hosttracker.shell.version}</version>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>hosttracker_new</artifactId>
<version>0.5.0-SNAPSHOT</version>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>hosttracker_new.implementation</artifactId>
<version>0.5.0-SNAPSHOT</version>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../commons/opendaylight</relativePath>
+ <relativePath>../../commons/opendaylight</relativePath>
</parent>
<artifactId>karaf-tomcat-security</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>logging.bridge</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>${artifactId}</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../../commons/opendaylight</relativePath>
+ <relativePath>../../../../commons/opendaylight</relativePath>
</parent>
<artifactId>bundlescanner</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../../commons/opendaylight</relativePath>
+ <relativePath>../../../../commons/opendaylight</relativePath>
</parent>
<artifactId>bundlescanner.implementation</artifactId>
if (classes == null || classes.size() == 0) return;
Map<String,String> names = new HashMap<String,String>();
StringBuilder conflictsMsg = new StringBuilder();
- for (Class c : classes) {
- XmlRootElement root = (XmlRootElement) c.getAnnotation(XmlRootElement.class);
+ for (Class<?> c : classes) {
+ XmlRootElement root = c.getAnnotation(XmlRootElement.class);
if (root == null) continue;
String rootName = root.name();
if ("##default".equals(rootName)) {
}
@Override
- public Enumeration findEntries(String path, String filePattern, boolean recurse) {
+ public Enumeration<URL> findEntries(String path, String filePattern, boolean recurse) {
return Collections.enumeration(classes);
}
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>commons.northbound</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>connectionmanager.northbound</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>containermanager.northbound</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>controllermanager.northbound</artifactId>
<version>0.1.0-SNAPSHOT</version>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>flowprogrammer.northbound</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>hosttracker.northbound</artifactId>
<version>0.5.0-SNAPSHOT</version>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>httpservice-bridge</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>northbound.client</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>jolokia-bridge</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../../commons/opendaylight</relativePath>
+ <relativePath>../../../../commons/opendaylight</relativePath>
</parent>
<artifactId>networkconfig.bridgedomain.northbound</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>forwarding.staticrouting.northbound</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>statistics.northbound</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>subnets.northbound</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>swagger-ui</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>usermanager.northbound</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>networkconfig.neutron.northbound</artifactId>
+ </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</fileset>
<mapper>
<regexpmapper from="^(.*)/([^/]+)/*/target/enunciate/generate/swagger/ui/(.*Northbound).*$$" to="\3"></regexpmapper>
+ <regexpmapper from="^(.*)/neutron/([^/]+)/*/target/enunciate/generate/swagger/ui/(.*resource-list.json)$$" to="neutron-\3"></regexpmapper>
<regexpmapper from="^(.*)/([^/]+)/*/target/enunciate/generate/swagger/ui/(.*resource-list.json)$$" to="\2-\3"></regexpmapper>
</mapper>
</copy>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>switchmanager.northbound</artifactId>
<version>0.5.0-SNAPSHOT</version>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>topology.northbound</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>usermanager.northbound</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../../opendaylight/commons/opendaylight</relativePath>
+ <relativePath>../../../../opendaylight/commons/opendaylight</relativePath>
</parent>
<scm>
<connection>scm:git:ssh://git.opendaylight.org:29418/controller.git</connection>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<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.controller</groupId>
+ <artifactId>commons.parent</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <relativePath>../commons/parent</relativePath>
+ </parent>
+
+ <artifactId>adsal-parent</artifactId>
+ <packaging>pom</packaging>
+ <modules>
+ <module>forwarding/staticrouting</module>
+ <module>clustering/services</module>
+ <module>clustering/services_implementation</module>
+ <module>clustering/stub</module>
+ <module>clustering/test</module>
+ <module>configuration/api</module>
+ <module>configuration/implementation</module>
+ <module>routing/dijkstra_implementation</module>
+ <module>arphandler</module>
+ <module>forwardingrulesmanager/api</module>
+ <module>forwardingrulesmanager/implementation</module>
+ <module>hosttracker/api</module>
+ <module>hosttracker/implementation</module>
+ <module>hosttracker/shell</module>
+ <module>hosttracker_new/api</module>
+ <module>hosttracker_new/implementation</module>
+ <module>containermanager/api</module>
+ <module>containermanager/implementation</module>
+ <module>containermanager/shell</module>
+ <module>appauth</module>
+ <module>switchmanager/api</module>
+ <module>switchmanager/implementation</module>
+ <module>statisticsmanager/api</module>
+ <module>statisticsmanager/implementation</module>
+ <module>topologymanager/implementation</module>
+ <module>topologymanager/shell</module>
+ <module>usermanager/api</module>
+ <module>usermanager/implementation</module>
+ <module>connectionmanager/api</module>
+ <module>connectionmanager/implementation</module>
+ <module>security</module>
+ <module>karaf-tomcat-security</module>
+
+ <!-- SAL bundles -->
+ <module>sal/api</module>
+ <module>sal/implementation</module>
+
+ <!-- SAL Extension bundles -->
+ <module>sal/connection/api</module>
+ <module>sal/connection/implementation</module>
+ <module>sal/networkconfiguration/api</module>
+ <module>sal/networkconfiguration/implementation</module>
+
+ <!-- Web bundles -->
+ <module>web/root</module>
+ <module>web/flows</module>
+ <module>web/devices</module>
+ <module>web/troubleshoot</module>
+ <module>web/topology</module>
+ <module>web/osgi-brandfragment</module>
+
+ <!-- Northbound bundles -->
+ <module>northbound/commons</module>
+ <module>northbound/bundlescanner/api</module>
+ <module>northbound/bundlescanner/implementation</module>
+ <module>northbound/topology</module>
+ <module>northbound/staticrouting</module>
+ <module>northbound/statistics</module>
+ <module>northbound/flowprogrammer</module>
+ <module>northbound/hosttracker</module>
+ <module>northbound/subnets</module>
+ <module>northbound/switchmanager</module>
+ <module>northbound/containermanager</module>
+ <module>northbound/networkconfiguration/bridgedomain</module>
+ <module>northbound/httpservice-bridge</module>
+ <module>northbound/jolokia</module>
+ <module>northbound/connectionmanager</module>
+ <module>northbound/usermanager</module>
+ <module>northbound/controllermanager</module>
+
+ <!-- Debug and logging -->
+ <module>logging/bridge</module>
+
+ <!-- Southbound bundles -->
+ <module>protocol_plugins/openflow</module>
+ <module>protocol_plugins/stub</module>
+
+ <!-- Samples -->
+ <module>samples/simpleforwarding</module>
+ <module>samples/loadbalancer</module>
+ <module>samples/northbound/loadbalancer</module>
+
+ <module>dummy-console</module>
+
+ <!-- features -->
+ <module>features/base</module>
+ <module>features/controller</module>
+ <module>features/adsal</module>
+ <module>features/nsf</module>
+ <module>features/extras</module>
+ <module>features/adsal-compatibility</module>
+ </modules>
+ <profiles>
+ <profile>
+ <id>integrationtests</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <modules>
+ <module>clustering/integrationtest</module>
+ <module>configuration/integrationtest</module>
+ <module>forwardingrulesmanager/integrationtest</module>
+ <module>hosttracker/integrationtest</module>
+ <module>switchmanager/integrationtest</module>
+ <module>topologymanager/integrationtest</module>
+ <!-- Northbound integration tests -->
+ <module>northbound/integrationtest</module>
+ <module>statisticsmanager/integrationtest</module>
+ <module>containermanager/it.implementation</module>
+ <module>commons/integrationtest</module>
+
+ <module>commons/httpclient</module>
+ </modules>
+ </profile>
+ <profile>
+ <id>docs</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <modules>
+ <module>northbound/java-client</module>
+ <module>northbound/swagger-ui</module>
+ </modules>
+ </profile>
+ </profiles>
+</project>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>protocol_plugins.openflow</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>protocol_plugins.stub</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>routing.dijkstra_implementation</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>sal</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../../commons/opendaylight</relativePath>
+ <relativePath>../../../../commons/opendaylight</relativePath>
</parent>
<artifactId>sal.connection</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../../commons/opendaylight</relativePath>
+ <relativePath>../../../../commons/opendaylight</relativePath>
</parent>
<artifactId>sal.connection.implementation</artifactId>
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
-
import org.opendaylight.controller.sal.connection.ConnectionConstants;
import org.opendaylight.controller.sal.connection.ConnectionLocality;
import org.opendaylight.controller.sal.connection.IConnectionListener;
private ConcurrentMap<String, IPluginInConnectionService> pluginService =
new ConcurrentHashMap<String, IPluginInConnectionService>();
- void setPluginService (Map props, IPluginInConnectionService s) {
+ void setPluginService (Map<?, ?> props, IPluginInConnectionService s) {
String type = null;
Object value = props.get(GlobalConstants.PROTOCOLPLUGINTYPE.toString());
if (value instanceof String) {
}
}
- void unsetPluginService(Map props, IPluginInConnectionService s) {
+ void unsetPluginService(Map<?, ?> props, IPluginInConnectionService s) {
String type = null;
Object value = props.get(GlobalConstants.PROTOCOLPLUGINTYPE.toString());
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>sal.implementation</artifactId>
}
}
- void setPluginInDataService(Map props, IPluginInDataPacketService s) {
+ void setPluginInDataService(Map<?, ?> props, IPluginInDataPacketService s) {
ProtocolService.set(this.pluginInDataService, props, s, logger);
}
- void unsetPluginInDataService(Map props, IPluginInDataPacketService s) {
+ void unsetPluginInDataService(Map<?, ?> props, IPluginInDataPacketService s) {
ProtocolService.unset(this.pluginInDataService, props, s, logger);
}
- void setListenDataPacket(Map props, IListenDataPacket s) {
+ void setListenDataPacket(Map<?, ?> props, IListenDataPacket s) {
if (this.listenDataPacket == null || this.indexDataPacket == null) {
logger.error("data structure to store data is NULL");
return;
}
logger.trace("Received setListenDataPacket request");
- for (Object e : props.entrySet()) {
- Map.Entry entry = (Map.Entry) e;
- logger.trace("Prop key:({}) value:({})",entry.getKey(), entry.getValue());
+ for (Map.Entry<?, ?> e : props.entrySet()) {
+ logger.trace("Prop key:({}) value:({})",e.getKey(), e.getValue());
}
String listenerName = null;
}
}
- void unsetListenDataPacket(Map props, IListenDataPacket s) {
+ void unsetListenDataPacket(Map<?, ?> props, IListenDataPacket s) {
if (this.listenDataPacket == null || this.indexDataPacket == null) {
logger.error("data structure to store data is NULL");
return;
}
logger.trace("Received UNsetListenDataPacket request");
- for (Object e : props.entrySet()) {
- Map.Entry entry = (Map.Entry) e;
- logger.trace("Prop key:({}) value:({})",entry.getKey(), entry.getValue());
+ for (Map.Entry<?, ?> e : props.entrySet()) {
+ logger.trace("Prop key:({}) value:({})",e.getKey(), e.getValue());
}
String listenerName = null;
return false;
}
- ProtocolService plugin = (ProtocolService)o;
+ ProtocolService<?> plugin = (ProtocolService<?>)o;
return (service.equals(plugin.service) && priority == plugin.priority);
}
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../../commons/opendaylight</relativePath>
+ <relativePath>../../../../commons/opendaylight</relativePath>
</parent>
<artifactId>sal.networkconfiguration</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../../commons/opendaylight</relativePath>
+ <relativePath>../../../../commons/opendaylight</relativePath>
</parent>
<artifactId>sal.networkconfiguration.implementation</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<groupId>org.opendaylight.controller</groupId>
<artifactId>clustersession</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>samples.loadbalancer</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../../commons/opendaylight</relativePath>
+ <relativePath>../../../../commons/opendaylight</relativePath>
</parent>
<artifactId>samples.loadbalancer.northbound</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>samples.simpleforwarding</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../commons/opendaylight</relativePath>
+ <relativePath>../../commons/opendaylight</relativePath>
</parent>
<artifactId>security</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>statisticsmanager</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>statisticsmanager.implementation</artifactId>
<artifactId>statisticsmanager.integrationtest</artifactId>
<version>0.5.0-SNAPSHOT</version>
<properties>
- <sonar.jacoco.itReportPath>../implementation/target/jacoco-it.exec</sonar.jacoco.itReportPath>
+ <sonar.jacoco.itReportPath>../../implementation/target/jacoco-it.exec</sonar.jacoco.itReportPath>
<!-- Sonar jacoco plugin to get integration test coverage info -->
- <sonar.jacoco.reportPath>../implementation/target/jacoco.exec</sonar.jacoco.reportPath>
+ <sonar.jacoco.reportPath>../../implementation/target/jacoco.exec</sonar.jacoco.reportPath>
</properties>
<dependencies>
<dependency>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<configuration>
- <destFile>../implementation/target/jacoco-it.exec</destFile>
+ <destFile>../../implementation/target/jacoco-it.exec</destFile>
<includes>
<include>org.opendaylight.controller.*</include>
</includes>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>switchmanager</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>switchmanager.implementation</artifactId>
<artifactId>switchmanager.integrationtest</artifactId>
<version>0.5.0-SNAPSHOT</version>
<properties>
- <sonar.jacoco.itReportPath>../implementation/target/jacoco-it.exec</sonar.jacoco.itReportPath>
+ <sonar.jacoco.itReportPath>../../implementation/target/jacoco-it.exec</sonar.jacoco.itReportPath>
<!-- Sonar jacoco plugin to get integration test coverage info -->
- <sonar.jacoco.reportPath>../implementation/target/jacoco.exec</sonar.jacoco.reportPath>
+ <sonar.jacoco.reportPath>../../implementation/target/jacoco.exec</sonar.jacoco.reportPath>
</properties>
<dependencies>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<configuration>
- <destFile>../implementation/target/jacoco-it.exec</destFile>
+ <destFile>../../implementation/target/jacoco-it.exec</destFile>
<includes>
<include>org.opendaylight.controller.*</include>
</includes>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>topologymanager</artifactId>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>${bundle.plugin.version}</version>
<extensions>true</extensions>
<configuration>
<instructions>
<artifactId>topologymanager.integrationtest</artifactId>
<version>0.5.0-SNAPSHOT</version>
<properties>
- <sonar.jacoco.itReportPath>../implementaiton/target/jacoco-it.exec</sonar.jacoco.itReportPath>
+ <sonar.jacoco.itReportPath>../../implementaiton/target/jacoco-it.exec</sonar.jacoco.itReportPath>
<!-- Sonar jacoco plugin to get integration test coverage info -->
- <sonar.jacoco.reportPath>../implementation/target/jacoco.exec</sonar.jacoco.reportPath>
+ <sonar.jacoco.reportPath>../../implementation/target/jacoco.exec</sonar.jacoco.reportPath>
</properties>
<dependencies>
<dependency>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<configuration>
- <destFile>../implementation/target/jacoco-it.exec</destFile>
+ <destFile>../../implementation/target/jacoco-it.exec</destFile>
<includes>
<include>org.opendaylight.controller.*</include>
</includes>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>topologymanager.shell</artifactId>
<version>${topologymanager.shell.version}</version>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>topologymanager</artifactId>
- <version>${topologymanager.version}</version>
</dependency>
</dependencies>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>${bundle.plugin.version}</version>
<configuration>
<instructions>
<Import-Package>org.apache.felix.service.command,
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>usermanager</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>usermanager.implementation</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<scm>
<connection>scm:git:ssh://git.opendaylight.org:29418/controller.git</connection>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>devices.web</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>flows.web</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>osgi-brandfragment.web</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>web</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>topology.web</artifactId>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
+ <relativePath>../../../commons/opendaylight</relativePath>
</parent>
<artifactId>troubleshoot.web</artifactId>
final String jspFilter = "jspFilter";
final String exactMatch = "/somePath";
final String prefixFilter = "prefixFilter";
- LinkedHashMap<String, String> patternMap = new LinkedHashMap<String, String>() {
- {
- put(exactMatch, exactMatchFilter);
- put("/*", defaultFilter);
- put("*.jsp", jspFilter);
- put("/foo/*", prefixFilter);
- }
- };
+ LinkedHashMap<String, String> patternMap = new LinkedHashMap<>();
+ patternMap.put(exactMatch, exactMatchFilter);
+ patternMap.put("/*", defaultFilter);
+ patternMap.put("*.jsp", jspFilter);
+ patternMap.put("/foo/*", prefixFilter);
urlMatcher = new UrlMatcher<>(patternMap);
assertMatches("/abc", defaultFilter);
assertMatches(exactMatch, exactMatchFilter, defaultFilter);
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>${checkstyle.version}</version>
<configuration>
<failsOnError>true</failsOnError>
<configLocation>controller/checkstyle.xml</configLocation>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
- <version>${surefire.version}</version>
<configuration>
<argLine>${testvm.argLine} ${jacoco.agent.ut.arg}</argLine>
<systemProperties>
Object serviceTypeRaw = args[0];
Object serviceInstance = args[1];
- Dictionary<String, ?> props = (Dictionary) args[2];
+ Dictionary<String, ?> props = (Dictionary<String, ?>) args[2];
if (serviceTypeRaw instanceof Class) {
Class<?> serviceType = (Class<?>) serviceTypeRaw;
import org.opendaylight.controller.config.persist.api.PropertiesProvider;
public class PropertiesProviderTest implements PropertiesProvider {
- private final Map<String,String> properties = new HashMap();
+ private final Map<String,String> properties = new HashMap<>();
public void addProperty(String key,String value){
properties.put(key,value);
}
}
assertEquals("Expected identities not found " + copyOfExpectedNames,
- Collections.EMPTY_MAP, copyOfExpectedNames);
+ Collections.emptyMap(), copyOfExpectedNames);
}
@Test
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>${checkstyle.version}</version>
<configuration>
<excludes>**\/target\/,**\/bin\/,**\/target-ide\/,**\/configuration\/initial\/</excludes>
</configuration>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>${checkstyle.version}</version>
<configuration>
<excludes>**\/target\/,**\/bin\/,**\/target-ide\/,**\/configuration\/initial\/</excludes>
</configuration>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>${checkstyle.version}</version>
<configuration>
<excludes>**\/target\/,**\/bin\/,**\/target-ide\/,**\/configuration\/initial\/</excludes>
</configuration>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
- <version>2.4</version>
</dependency>
<dependency>
<groupId>org.apache.servicemix.bundles</groupId>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>sal-inmemory-datastore</artifactId>
- <version>1.2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<dependency>
<groupId>org.opendaylight.controller.model</groupId>
<artifactId>model-topology</artifactId>
- <version>1.2.0-SNAPSHOT</version>
</dependency>
<!-- toaster example I'm pretty sure we should trim -->
<dependency>
<groupId>org.opendaylight.controller.samples</groupId>
<artifactId>sample-toaster</artifactId>
- <version>${mdsal.version}</version>
</dependency>
<dependency>
<groupId>org.opendaylight.controller.samples</groupId>
<artifactId>sample-toaster-consumer</artifactId>
- <version>${mdsal.version}</version>
</dependency>
<dependency>
<groupId>org.opendaylight.controller.samples</groupId>
<artifactId>sample-toaster-provider</artifactId>
- <version>${mdsal.version}</version>
</dependency>
<dependency>
<groupId>org.apache.sshd</groupId>
<dependency>
<groupId>org.opendaylight.yangtools.thirdparty</groupId>
<artifactId>antlr4-runtime-osgi-nohead</artifactId>
- <version>4.0</version>
</dependency>
<dependency>
<groupId>org.opendaylight.yangtools.thirdparty</groupId>
<artifactId>xtend-lib-osgi</artifactId>
- <version>2.4.3</version>
</dependency>
<dependency>
<groupId>org.openexi</groupId>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType">
-<booleanAttribute key="M2_DEBUG_OUTPUT" value="false"/>
-<stringAttribute key="M2_GOALS" value="clean org.reficio:p2-maven-plugin:site"/>
-<booleanAttribute key="M2_NON_RECURSIVE" value="false"/>
-<booleanAttribute key="M2_OFFLINE" value="false"/>
-<stringAttribute key="M2_PROFILES" value=""/>
-<listAttribute key="M2_PROPERTIES"/>
-<stringAttribute key="M2_RUNTIME" value="EMBEDDED"/>
-<booleanAttribute key="M2_SKIP_TESTS" value="false"/>
-<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/>
-<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="true"/>
-<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${project}"/>
-<stringAttribute key="org.eclipse.debug.core.source_locator_id" value="org.eclipse.m2e.launching.MavenSourceLocator"/>
-<stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <sourceLookupDirector> <sourceContainers duplicates="false"/> </sourceLookupDirector> "/>
-<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
-<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
-<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
-</listAttribute>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx768m -XX:MaxPermSize=256m"/>
-<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:/distribution.p2site}"/>
-</launchConfiguration>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
- <prerequisites>
- <maven>3.0</maven>
- </prerequisites>
-
- <!-- p2site distribution is created with the intention of providing a -->
- <!-- target platform that could be use for PDE to create an OSGi -->
- <!-- launcher, this should allow to enable the hot code replacement on -->
- <!-- the controller. -->
-
- <parent>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>commons.opendaylight</artifactId>
- <version>1.5.0-SNAPSHOT</version>
- <relativePath>../../commons/opendaylight</relativePath>
- </parent>
- <scm>
- <connection>scm:git:ssh://git.opendaylight.org:29418/controller.git</connection>
- <developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>
- <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:Main</url>
- </scm>
-
- <pluginRepositories>
- <pluginRepository>
- <id>reficio</id>
- <url>${nexusproxy}/repositories/reficioplugin/</url>
- </pluginRepository>
- </pluginRepositories>
-
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>distribution.p2site</artifactId>
- <version>0.2.0-SNAPSHOT</version>
- <packaging>pom</packaging>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.reficio</groupId>
- <artifactId>p2-maven-plugin</artifactId>
- <version>1.0.0</version>
- <executions>
- <execution>
- <id>default-cli</id>
- <configuration>
- <pedantic>true</pedantic>
- <artifacts>
- <artfiact>
- <id>org.slf4j:jcl-over-slf4j:${slf4j.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.slf4j:slf4j-api:${slf4j.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.slf4j:log4j-over-slf4j:${slf4j.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>ch.qos.logback:logback-core:${logback.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>ch.qos.logback:logback-classic:${logback.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.codehaus.jackson:jackson-mapper-asl:${jackson.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.codehaus.jackson:jackson-core-asl:${jackson.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.codehaus.jackson:jackson-jaxrs:${jackson.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.codehaus.jettison:jettison:1.3.3</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>commons-io:commons-io:2.4</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>commons-fileupload:commons-fileupload:1.2.2</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>equinoxSDK381:javax.servlet:3.0.0.v201112011016</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>equinoxSDK381:javax.servlet.jsp:2.2.0.v201112011158</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>equinoxSDK381:org.eclipse.equinox.ds:1.4.0.v20120522-1841</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>equinoxSDK381:org.eclipse.equinox.util:1.0.400.v20120522-2049</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>equinoxSDK381:org.eclipse.osgi.services:3.3.100.v20120522-1822</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>equinoxSDK381:org.eclipse.osgi:3.8.1.v20120830-144521</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>equinoxSDK381:org.apache.felix.gogo.command:0.8.0.v201108120515</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>equinoxSDK381:org.apache.felix.gogo.runtime:0.8.0.v201108120515</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>equinoxSDK381:org.apache.felix.gogo.shell:0.8.0.v201110170705</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>equinoxSDK381:org.eclipse.equinox.cm:1.0.400.v20120522-1841</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>equinoxSDK381:org.eclipse.equinox.console:1.0.0.v20120522-1841</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>equinoxSDK381:org.eclipse.equinox.launcher:1.3.0.v20120522-1813</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>geminiweb:org.eclipse.gemini.web.core:${geminiweb.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>geminiweb:org.eclipse.gemini.web.extender:${geminiweb.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>geminiweb:org.eclipse.gemini.web.tomcat:${geminiweb.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>geminiweb:org.eclipse.virgo.kernel.equinox.extensions:${virgo.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>geminiweb:org.eclipse.virgo.util.common:${virgo.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>geminiweb:org.eclipse.virgo.util.io:${virgo.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>geminiweb:org.eclipse.virgo.util.math:${virgo.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>geminiweb:org.eclipse.virgo.util.osgi:${virgo.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>geminiweb:org.eclipse.virgo.util.osgi.manifest:${virgo.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>geminiweb:org.eclipse.virgo.util.parser.manifest:${virgo.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.apache.felix:org.apache.felix.dependencymanager:3.1.0</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.apache.felix:org.apache.felix.dependencymanager.shell:3.0.1</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>com.google.code.gson:gson:2.1</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.jboss.spec.javax.transaction:jboss-transaction-api_1.1_spec:1.0.1.Final</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.apache.commons:commons-lang3:3.1</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>virgomirror:org.eclipse.jdt.core.compiler.batch:3.8.0.I20120518-2145</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>eclipselink:javax.persistence:2.0.4.v201112161009</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>orbit:javax.activation:1.1.0.v201211130549</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>orbit:javax.annotation:1.1.0.v201209060031</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>orbit:javax.ejb:3.1.1.v201204261316</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>orbit:javax.el:2.2.0.v201108011116</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>orbit:javax.mail.glassfish:1.4.1.v201108011116</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>orbit:javax.xml.rpc:1.1.0.v201005080400</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>orbit:org.apache.catalina:7.0.32.v201211201336</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>orbit:org.apache.catalina.ha:7.0.32.v201211201952</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>orbit:org.apache.catalina.tribes:7.0.32.v201211201952</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>orbit:org.apache.coyote:7.0.32.v201211201952</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>orbit:org.apache.el:7.0.32.v201211081135</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>orbit:org.apache.jasper:7.0.32.v201211201952</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>orbit:org.apache.juli.extras:7.0.32.v201211081135</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>orbit:org.apache.tomcat.api:7.0.32.v201211081135</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>orbit:org.apache.tomcat.util:7.0.32.v201211201952</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>orbit:javax.servlet.jsp.jstl:1.2.0.v201105211821</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>orbit:javax.servlet.jsp.jstl.impl:1.2.0.v201210211230</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.springframework:org.springframework.asm:${spring.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.springframework:org.springframework.aop:${spring.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.springframework:org.springframework.context:${spring.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.springframework:org.springframework.context.support:${spring.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.springframework:org.springframework.core:${spring.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.springframework:org.springframework.beans:${spring.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.springframework:org.springframework.expression:${spring.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.springframework:org.springframework.web:${spring.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.aopalliance:com.springsource.org.aopalliance:1.0.0</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.springframework:org.springframework.web.servlet:${spring.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.springframework.security:spring-security-config:${spring-security.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.springframework.security:spring-security-core:${spring-security.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.springframework.security:spring-security-web:${spring-security.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.springframework.security:spring-security-taglibs:${spring-security.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.springframework:org.springframework.transaction:${spring-security.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>org.ow2.chameleon.management:chameleon-mbeans:1.0.0</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>com.sun.jersey:jersey-core:${jersey.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>com.sun.jersey:jersey-server:${jersey.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>com.sun.jersey:jersey-client:${jersey.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- <artfiact>
- <id>com.sun.jersey:jersey-json:${jersey.version}</id>
- <transitive>false</transitive>
- <override>false</override>
- </artfiact>
- </artifacts>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty-maven-plugin</artifactId>
- <version>8.1.5.v20120716</version>
- <configuration>
- <scanIntervalSeconds>10</scanIntervalSeconds>
- <webAppSourceDirectory>${basedir}/target/repository/</webAppSourceDirectory>
- <webApp>
- <contextPath>/site</contextPath>
- </webApp>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
import org.opendaylight.controller.sal.action.SwPath;
import org.opendaylight.controller.sal.core.ConstructionException;
import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.controller.sal.core.Node.NodeIDType;
import org.opendaylight.controller.sal.core.NodeConnector;
import org.opendaylight.controller.sal.flowprogrammer.Flow;
import org.opendaylight.controller.sal.match.Match;
Uri nodeConnector = ((OutputActionCase) sourceAction).getOutputAction().getOutputNodeConnector();
if (nodeConnector != null) {
- //for (Uri uri : nodeConnectors) {
- Uri fullNodeConnector = new Uri(node.getType()+":"+node.getID()+":"+nodeConnector.getValue());
+ // TODO: We should really have a bi-directional map from AD-SAL node types to
+ // MD-SAL node types, but lets fix that later.
+ String type = node.getType();
+ if( type.equals(NodeIDType.OPENFLOW) ){
+ type = NodeMapping.OPENFLOW_ID_PREFIX;
+ }else{
+ type = type + ":";
+ }
+ Uri fullNodeConnector = new Uri(type+node.getID()+":"+nodeConnector.getValue());
targetAction.add(new Output(fromNodeConnectorRef(fullNodeConnector, node)));
- //}
}
} else if (sourceAction instanceof PopMplsActionCase) {
// TODO: define maping
package org.opendaylight.controller.sal.compatibility.test;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.CRUDP;
import static org.opendaylight.controller.sal.compatibility.ProtocolConstants.ETHERNET_ARP;
assertEquals("OF|1@OF|00:00:00:00:00:00:00:2a", nodeConnector.toString());
}
+ @Test
+ public void testActionFrom() throws ConstructionException {
+ // Bug 2021: Convert AD-SAL notation into MD-SAL notation before calling NodeConnector
+ Node node = new Node(NodeIDType.OPENFLOW, 42L);
+ List<Action> odActions = new ArrayList<>();
+
+ OutputActionBuilder outputActionBuilder = new OutputActionBuilder();
+ outputActionBuilder.setOutputNodeConnector(new Uri("CONTROLLER"));
+ OutputActionCaseBuilder outputActionCaseBuilder = new OutputActionCaseBuilder();
+ outputActionCaseBuilder.setOutputAction(outputActionBuilder.build());
+ odActions.add(new ActionBuilder().setAction(outputActionCaseBuilder.build()).build());
+
+ List<org.opendaylight.controller.sal.action.Action> targetAction =
+ ToSalConversionsUtils.actionFrom(odActions, node);
+ assertNotNull(targetAction);
+ assertTrue( Output.class.isInstance(targetAction.get(0)) );
+ Output targetActionOutput = (Output) targetAction.get(0);
+ NodeConnector port = targetActionOutput.getPort();
+ assertNotNull(port);
+ assertEquals(port.getType(), NodeConnectorIDType.CONTROLLER);
+ assertEquals(port.getID(), org.opendaylight.controller.sal.core.NodeConnector.SPECIALNODECONNECTORID);
+ }
+
private void checkSalMatch(org.opendaylight.controller.sal.match.Match match, MtchType mt) throws ConstructionException {
switch (mt) {
case other:
-/**ab
+/**
* Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
builder.setFlowRef(new FlowRef(identifier));
builder.setNode(new NodeRef(nodeIdent.firstIdentifierOf(Node.class)));
builder.setFlowTable(new FlowTableRef(nodeIdent.child(Table.class, tableKey)));
- builder.setTransactionUri(new Uri(provider.getNewTransactionId()));
+
+ // This method is called only when a given flow object has been
+ // removed from datastore. So FRM always needs to set strict flag
+ // into remove-flow input so that only a flow entry associated with
+ // a given flow object is removed.
+ builder.setTransactionUri(new Uri(provider.getNewTransactionId())).
+ setStrict(Boolean.TRUE);
provider.getSalFlowService().removeFlow(builder.build());
}
}
builder.setNode(new NodeRef(nodeIdent.firstIdentifierOf(Node.class)));
builder.setFlowRef(new FlowRef(identifier));
builder.setTransactionUri(new Uri(provider.getNewTransactionId()));
- builder.setUpdatedFlow((new UpdatedFlowBuilder(update)).build());
- builder.setOriginalFlow((new OriginalFlowBuilder(original)).build());
+
+ // This method is called only when a given flow object in datastore
+ // has been updated. So FRM always needs to set strict flag into
+ // update-flow input so that only a flow entry associated with
+ // a given flow object is updated.
+ builder.setUpdatedFlow((new UpdatedFlowBuilder(update)).setStrict(Boolean.TRUE).build());
+ builder.setOriginalFlow((new OriginalFlowBuilder(original)).setStrict(Boolean.TRUE).build());
provider.getSalFlowService().updateFlow(builder.build());
}
assertEquals(1, updateFlowCalls.size());
assertEquals("DOM-1", updateFlowCalls.get(0).getTransactionUri().getValue());
assertEquals(flowII, updateFlowCalls.get(0).getFlowRef().getValue());
+ assertEquals(Boolean.TRUE, updateFlowCalls.get(0).getOriginalFlow().isStrict());
+ assertEquals(Boolean.TRUE, updateFlowCalls.get(0).getUpdatedFlow().isStrict());
forwardingRulesManager.close();
}
assertEquals(1, removeFlowCalls.size());
assertEquals("DOM-1", removeFlowCalls.get(0).getTransactionUri().getValue());
assertEquals(flowII, removeFlowCalls.get(0).getFlowRef().getValue());
+ assertEquals(Boolean.TRUE, removeFlowCalls.get(0).isStrict());
forwardingRulesManager.close();
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
-import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.InstanceIdentifierBuilder;
import org.slf4j.Logger;
InstanceIdentifierBuilder<Node> builder = ((InstanceIdentifier<Node>) ref.getValue()).builder();
InstanceIdentifierBuilder<FlowCapableNode> augmentation = builder.augmentation(FlowCapableNode.class);
final InstanceIdentifier<FlowCapableNode> path = augmentation.build();
- CheckedFuture readFuture = tx.read(LogicalDatastoreType.OPERATIONAL, path);
- Futures.addCallback(readFuture, new FutureCallback<Optional<? extends DataObject>>() {
+ CheckedFuture<Optional<FlowCapableNode>, ?> readFuture = tx.read(LogicalDatastoreType.OPERATIONAL, path);
+ Futures.addCallback(readFuture, new FutureCallback<Optional<FlowCapableNode>>() {
@Override
- public void onSuccess(Optional<? extends DataObject> optional) {
+ public void onSuccess(Optional<FlowCapableNode> optional) {
enqueueWriteNodeDataTx(node, flowNode, path);
if (!optional.isPresent()) {
enqueuePutTable0Tx(ref);
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>sal-clustering-commons</artifactId>
- <version>1.2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
- <version>${slf4j.version}</version>
<scope>test</scope>
</dependency>
public static Props props(final ActorRef target){
return Props.create(new Creator<ClientActor>(){
+ private static final long serialVersionUID = 1L;
@Override public ClientActor create() throws Exception {
return new ClientActor(target);
public static Props props(final String id, final Map<String, String> peerAddresses,
final Optional<ConfigParams> configParams){
return Props.create(new Creator<ExampleActor>(){
+ private static final long serialVersionUID = 1L;
@Override public ExampleActor create() throws Exception {
return new ExampleActor(id, peerAddresses, configParams);
@Override protected void applySnapshot(final ByteString snapshot) {
state.clear();
try {
- state.putAll((HashMap) toObject(snapshot));
+ state.putAll((Map<String, String>) toObject(snapshot));
} catch (Exception e) {
LOG.error(e, "Exception in applying snapshot");
}
if(LOG.isDebugEnabled()) {
- LOG.debug("Snapshot applied to state : {}", ((HashMap) state).size());
+ LOG.debug("Snapshot applied to state : {}", ((Map<?, ?>) state).size());
}
}
import java.util.Map;
public class KeyValue extends Payload implements Serializable {
+ private static final long serialVersionUID = 1L;
private String key;
private String value;
import java.io.Serializable;
public class KeyValueSaved implements Serializable {
+ private static final long serialVersionUID = 1L;
}
import java.io.Serializable;
public class PrintRole implements Serializable {
+ private static final long serialVersionUID = 1L;
}
import java.io.Serializable;
public class PrintState implements Serializable {
+ private static final long serialVersionUID = 1L;
}
}
static class DeleteEntries implements Serializable {
+ private static final long serialVersionUID = 1L;
private final int fromIndex;
-
public DeleteEntries(int fromIndex) {
this.fromIndex = fromIndex;
}
}
static class UpdateElectionTerm implements Serializable {
+ private static final long serialVersionUID = 1L;
private final long currentTerm;
private final String votedFor;
public class ReplicatedLogImplEntry implements ReplicatedLogEntry,
Serializable {
+ private static final long serialVersionUID = 1L;
private final long index;
private final long term;
public class Snapshot implements Serializable {
+ private static final long serialVersionUID = 1L;
private final byte[] state;
private final List<ReplicatedLogEntry> unAppliedEntries;
private final long lastIndex;
*
*/
public class ApplyLogEntries implements Serializable {
+ private static final long serialVersionUID = 1L;
private final int toIndex;
public ApplyLogEntries(int toIndex) {
* Internal message, issued by follower to its actor
*/
public class ApplySnapshot implements Serializable {
+ private static final long serialVersionUID = 1L;
private final Snapshot snapshot;
public ApplySnapshot(Snapshot snapshot) {
import java.io.Serializable;
public class ApplyState implements Serializable {
+ private static final long serialVersionUID = 1L;
private final ActorRef clientActor;
private final String identifier;
private final ReplicatedLogEntry replicatedLogEntry;
* Message sent to commit an entry to the log
*/
public class CommitEntry implements Serializable {
+ private static final long serialVersionUID = 1L;
}
import java.io.Serializable;
public class ElectionTimeout implements Serializable {
+ private static final long serialVersionUID = 1L;
}
* Message sent to Persist an entry into the transaction journal
*/
public class PersistEntry implements Serializable {
+ private static final long serialVersionUID = 1L;
}
import java.io.Serializable;
public class Replicate implements Serializable {
+ private static final long serialVersionUID = 1L;
private final ActorRef clientActor;
private final String identifier;
private final ReplicatedLogEntry replicatedLogEntry;
* it and use it to save it's state
*/
public class SaveSnapshot implements Serializable {
+ private static final long serialVersionUID = 1L;
}
* Typically the Leader to itself on a schedule
*/
public class SendHeartBeat implements Serializable {
+ private static final long serialVersionUID = 1L;
}
public class Leader extends AbstractRaftActorBehavior {
- protected final Map<String, FollowerLogInformation> followerToLog = new HashMap();
+ protected final Map<String, FollowerLogInformation> followerToLog = new HashMap<>();
protected final Map<String, FollowerToSnapshot> mapFollowerToSnapshot = new HashMap<>();
private final Set<String> followers;
import java.io.Serializable;
public class FindLeader implements Serializable{
+ private static final long serialVersionUID = 1L;
}
import java.io.Serializable;
public class FindLeaderReply implements Serializable {
+ private static final long serialVersionUID = 1L;
private final String leaderActor;
public FindLeaderReply(String leaderActor) {
package org.opendaylight.controller.cluster.raft.messages;
public class AbstractRaftRPC implements RaftRPC {
+ private static final long serialVersionUID = 1L;
// term
protected long term;
* heartbeat (§5.2).
*/
public class AppendEntries extends AbstractRaftRPC {
-
- public static final Class SERIALIZABLE_CLASS = AppendEntriesMessages.AppendEntries.class;
+ public static final Class<AppendEntriesMessages.AppendEntries> SERIALIZABLE_CLASS = AppendEntriesMessages.AppendEntries.class;
private static final org.slf4j.Logger LOG = org.slf4j.LoggerFactory.getLogger(AppendEntries.class);
+ private static final long serialVersionUID = 1L;
// So that follower can redirect clients
private final String leaderId;
* Reply for the AppendEntriesRpc message
*/
public class AppendEntriesReply extends AbstractRaftRPC {
+ private static final long serialVersionUID = 1L;
// true if follower contained entry matching
// prevLogIndex and prevLogTerm
public class InstallSnapshot extends AbstractRaftRPC {
- public static final Class SERIALIZABLE_CLASS = InstallSnapshotMessages.InstallSnapshot.class;
+ public static final Class<InstallSnapshotMessages.InstallSnapshot> SERIALIZABLE_CLASS = InstallSnapshotMessages.InstallSnapshot.class;
+ private static final long serialVersionUID = 1L;
private final String leaderId;
private final long lastIncludedIndex;
package org.opendaylight.controller.cluster.raft.messages;
public class InstallSnapshotReply extends AbstractRaftRPC {
+ private static final long serialVersionUID = 1L;
// The followerId - this will be used to figure out which follower is
// responding
* Invoked by candidates to gather votes (§5.2).
*/
public class RequestVote extends AbstractRaftRPC {
+ private static final long serialVersionUID = 1L;
// candidate requesting vote
private String candidateId;
package org.opendaylight.controller.cluster.raft.messages;
public class RequestVoteReply extends AbstractRaftRPC {
+ private static final long serialVersionUID = 1L;
// true means candidate received vot
private final boolean voteGranted;
private long lastApplied = 0;
private final ElectionTerm electionTerm;
private ReplicatedLog replicatedLog;
- private Map<String, String> peerAddresses = new HashMap();
+ private Map<String, String> peerAddresses = new HashMap<>();
private ConfigParams configParams;
public MockRaftActorContext(){
}
public static class MockPayload extends Payload implements Serializable {
+ private static final long serialVersionUID = 1L;
private String value = "";
public MockPayload(){
}
public static class MockReplicatedLogEntry implements ReplicatedLogEntry, Serializable {
+ private static final long serialVersionUID = 1L;
private final long term;
private final long index;
private final RaftActor delegate;
public static final class MockRaftActorCreator implements Creator<MockRaftActor> {
+ private static final long serialVersionUID = 1L;
private final Map<String, String> peerAddresses;
private final String id;
private final Optional<ConfigParams> config;
Object data = toObject(snapshot);
System.out.println("!!!!!applyRecoverySnapshot: "+data);
if (data instanceof List) {
- state.addAll((List) data);
+ state.addAll((List<?>) data);
}
} catch (Exception e) {
e.printStackTrace();
super(actorSystem);
raftActor = this.getSystem().actorOf(MockRaftActor.props(actorName,
- Collections.EMPTY_MAP, Optional.<ConfigParams>absent()), actorName);
+ Collections.<String,String>emptyMap(), Optional.<ConfigParams>absent()), actorName);
}
return raftActor;
}
- public boolean waitForLogMessage(final Class logEventClass, String message){
+ public boolean waitForLogMessage(final Class<?> logEventClass, String message){
// Wait for a specific log message to show up
return
new JavaTestKit.EventFilter<Boolean>(logEventClass
config.setHeartBeatInterval(new FiniteDuration(1, TimeUnit.DAYS));
ActorRef followerActor = getSystem().actorOf(MockRaftActor.props(persistenceId,
- Collections.EMPTY_MAP, Optional.<ConfigParams>of(config)), persistenceId);
+ Collections.<String,String>emptyMap(), Optional.<ConfigParams>of(config)), persistenceId);
watch(followerActor);
//reinstate the actor
TestActorRef<MockRaftActor> ref = TestActorRef.create(getSystem(),
- MockRaftActor.props(persistenceId, Collections.EMPTY_MAP,
+ MockRaftActor.props(persistenceId, Collections.<String,String>emptyMap(),
Optional.<ConfigParams>of(config)));
ref.underlyingActor().waitForRecoveryComplete();
config.setHeartBeatInterval(new FiniteDuration(1, TimeUnit.DAYS));
TestActorRef<MockRaftActor> mockActorRef = TestActorRef.create(getSystem(), MockRaftActor.props(persistenceId,
- Collections.EMPTY_MAP, Optional.<ConfigParams>of(config)), persistenceId);
+ Collections.<String,String>emptyMap(), Optional.<ConfigParams>of(config)), persistenceId);
MockRaftActor mockRaftActor = mockActorRef.underlyingActor();
config.setHeartBeatInterval(new FiniteDuration(1, TimeUnit.DAYS));
TestActorRef<MockRaftActor> mockActorRef = TestActorRef.create(getSystem(), MockRaftActor.props(persistenceId,
- Collections.EMPTY_MAP, Optional.<ConfigParams>of(config), new DataPersistenceProviderMonitor()), persistenceId);
+ Collections.<String,String>emptyMap(), Optional.<ConfigParams>of(config), new DataPersistenceProviderMonitor()), persistenceId);
MockRaftActor mockRaftActor = mockActorRef.underlyingActor();
dataPersistenceProviderMonitor.setPersistLatch(persistLatch);
TestActorRef<MockRaftActor> mockActorRef = TestActorRef.create(getSystem(), MockRaftActor.props(persistenceId,
- Collections.EMPTY_MAP, Optional.<ConfigParams>of(config), dataPersistenceProviderMonitor), persistenceId);
+ Collections.<String,String>emptyMap(), Optional.<ConfigParams>of(config), dataPersistenceProviderMonitor), persistenceId);
MockRaftActor mockRaftActor = mockActorRef.underlyingActor();
DataPersistenceProvider dataPersistenceProvider = mock(DataPersistenceProvider.class);
TestActorRef<MockRaftActor> mockActorRef = TestActorRef.create(getSystem(), MockRaftActor.props(persistenceId,
- Collections.EMPTY_MAP, Optional.<ConfigParams>of(config), dataPersistenceProvider), persistenceId);
+ Collections.<String,String>emptyMap(), Optional.<ConfigParams>of(config), dataPersistenceProvider), persistenceId);
MockRaftActor mockRaftActor = mockActorRef.underlyingActor();
DataPersistenceProvider dataPersistenceProvider = mock(DataPersistenceProvider.class);
TestActorRef<MockRaftActor> mockActorRef = TestActorRef.create(getSystem(), MockRaftActor.props(persistenceId,
- Collections.EMPTY_MAP, Optional.<ConfigParams>of(config), dataPersistenceProvider), persistenceId);
+ Collections.<String,String>emptyMap(), Optional.<ConfigParams>of(config), dataPersistenceProvider), persistenceId);
MockRaftActor mockRaftActor = mockActorRef.underlyingActor();
DataPersistenceProvider dataPersistenceProvider = mock(DataPersistenceProvider.class);
TestActorRef<MockRaftActor> mockActorRef = TestActorRef.create(getSystem(), MockRaftActor.props(persistenceId,
- Collections.EMPTY_MAP, Optional.<ConfigParams>of(config), dataPersistenceProvider), persistenceId);
+ Collections.<String,String>emptyMap(), Optional.<ConfigParams>of(config), dataPersistenceProvider), persistenceId);
MockRaftActor mockRaftActor = mockActorRef.underlyingActor();
DataPersistenceProvider dataPersistenceProvider = mock(DataPersistenceProvider.class);
TestActorRef<MockRaftActor> mockActorRef = TestActorRef.create(getSystem(),
- MockRaftActor.props(persistenceId,Collections.EMPTY_MAP,
+ MockRaftActor.props(persistenceId,Collections.<String,String>emptyMap(),
Optional.<ConfigParams>of(config), dataPersistenceProvider), persistenceId);
MockRaftActor mockRaftActor = mockActorRef.underlyingActor();
DataPersistenceProvider dataPersistenceProvider = mock(DataPersistenceProvider.class);
TestActorRef<MockRaftActor> mockActorRef = TestActorRef.create(getSystem(), MockRaftActor.props(persistenceId,
- Collections.EMPTY_MAP, Optional.<ConfigParams>of(config), dataPersistenceProvider), persistenceId);
+ Collections.<String,String>emptyMap(), Optional.<ConfigParams>of(config), dataPersistenceProvider), persistenceId);
MockRaftActor mockRaftActor = mockActorRef.underlyingActor();
DataPersistenceProvider dataPersistenceProvider = mock(DataPersistenceProvider.class);
TestActorRef<MockRaftActor> mockActorRef = TestActorRef.create(getSystem(), MockRaftActor.props(persistenceId,
- Collections.EMPTY_MAP, Optional.<ConfigParams>of(config), dataPersistenceProvider), persistenceId);
+ Collections.<String,String>emptyMap(), Optional.<ConfigParams>of(config), dataPersistenceProvider), persistenceId);
MockRaftActor mockRaftActor = mockActorRef.underlyingActor();
DataPersistenceProviderMonitor dataPersistenceProviderMonitor = new DataPersistenceProviderMonitor();
TestActorRef<MockRaftActor> mockActorRef = TestActorRef.create(getSystem(), MockRaftActor.props(persistenceId,
- Collections.EMPTY_MAP, Optional.<ConfigParams>of(config), dataPersistenceProviderMonitor), persistenceId);
+ Collections.<String,String>emptyMap(), Optional.<ConfigParams>of(config), dataPersistenceProviderMonitor), persistenceId);
MockRaftActor mockRaftActor = mockActorRef.underlyingActor();
DataPersistenceProviderMonitor dataPersistenceProviderMonitor = new DataPersistenceProviderMonitor();
TestActorRef<MockRaftActor> mockActorRef = TestActorRef.create(getSystem(), MockRaftActor.props(persistenceId,
- Collections.EMPTY_MAP, Optional.<ConfigParams>of(config), dataPersistenceProviderMonitor), persistenceId);
+ Collections.<String,String>emptyMap(), Optional.<ConfigParams>of(config), dataPersistenceProviderMonitor), persistenceId);
MockRaftActor mockRaftActor = mockActorRef.underlyingActor();
import org.opendaylight.controller.cluster.raft.DefaultConfigParamsImpl;
import org.opendaylight.controller.cluster.raft.MockRaftActorContext;
import org.opendaylight.controller.cluster.raft.RaftActorContext;
+import org.opendaylight.controller.cluster.raft.ReplicatedLogEntry;
import org.opendaylight.controller.cluster.raft.base.messages.ElectionTimeout;
import org.opendaylight.controller.cluster.raft.messages.AppendEntries;
import org.opendaylight.controller.cluster.raft.messages.AppendEntriesReply;
import org.opendaylight.controller.cluster.raft.messages.RequestVote;
import org.opendaylight.controller.cluster.raft.messages.RequestVoteReply;
import org.opendaylight.controller.cluster.raft.utils.DoNothingActor;
-
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
-
import static org.junit.Assert.assertEquals;
public class CandidateTest extends AbstractRaftActorBehaviorTest {
Candidate candidate = new Candidate(createActorContext(getTestActor()));
- candidate.handleMessage(getTestActor(), new AppendEntries(0, "test", 0,0,Collections.EMPTY_LIST, 0));
+ candidate.handleMessage(getTestActor(), new AppendEntries(0, "test", 0,0,Collections.<ReplicatedLogEntry>emptyList(), 0));
final Boolean out = new ExpectMsg<Boolean>(duration("1 seconds"), "AppendEntriesResponse") {
// do not put code outside this method, will run afterwards
MockRaftActorContext actorContext = (MockRaftActorContext) createActorContext();
- Map<String, String> peerAddresses = new HashMap();
+ Map<String, String> peerAddresses = new HashMap<>();
peerAddresses.put(followerActor.path().toString(),
followerActor.path().toString());
MockRaftActorContext actorContext =
(MockRaftActorContext) createActorContext();
- Map<String, String> peerAddresses = new HashMap();
+ Map<String, String> peerAddresses = new HashMap<>();
peerAddresses.put(followerActor.path().toString(),
followerActor.path().toString());
new JavaTestKit(getSystem()) {{
ActorRef followerActor = getSystem().actorOf(Props.create(MessageCollectorActor.class));
- Map<String, String> peerAddresses = new HashMap();
+ Map<String, String> peerAddresses = new HashMap<>();
peerAddresses.put(followerActor.path().toString(),
followerActor.path().toString());
ActorRef followerActor = getTestActor();
- Map<String, String> peerAddresses = new HashMap();
+ Map<String, String> peerAddresses = new HashMap<>();
peerAddresses.put(followerActor.path().toString(),
followerActor.path().toString());
ActorRef followerActor = getTestActor();
- Map<String, String> peerAddresses = new HashMap();
+ Map<String, String> peerAddresses = new HashMap<>();
peerAddresses.put(followerActor.path().toString(),
followerActor.path().toString());
ActorRef followerActor = getTestActor();
- Map<String, String> peerAddresses = new HashMap();
+ Map<String, String> peerAddresses = new HashMap<>();
peerAddresses.put(followerActor.path().toString(),
followerActor.path().toString());
ActorRef followerActor = getTestActor();
- Map<String, String> peerAddresses = new HashMap();
+ Map<String, String> peerAddresses = new HashMap<>();
peerAddresses.put(followerActor.path().toString(),
followerActor.path().toString());
ForwardMessageToBehaviorActor.setBehavior(follower);
- Map<String, String> peerAddresses = new HashMap();
+ Map<String, String> peerAddresses = new HashMap<>();
peerAddresses.put(followerActor.path().toString(),
followerActor.path().toString());
ForwardMessageToBehaviorActor.setBehavior(follower);
- Map<String, String> peerAddresses = new HashMap();
+ Map<String, String> peerAddresses = new HashMap<>();
peerAddresses.put(followerActor.path().toString(),
followerActor.path().toString());
MockRaftActorContext leaderActorContext =
new MockRaftActorContext("leader", getSystem(), leaderActor);
- Map<String, String> peerAddresses = new HashMap();
+ Map<String, String> peerAddresses = new HashMap<>();
peerAddresses.put("follower-1",
followerActor.path().toString());
leaderActorContext.setReplicatedLog(
new MockRaftActorContext.MockReplicatedLogBuilder().createEntries(0, 3, 1).build());
- Map<String, String> peerAddresses = new HashMap();
+ Map<String, String> peerAddresses = new HashMap<>();
peerAddresses.put("follower-1",
followerActor.path().toString());
* @param clazz
* @return
*/
- public static Object getFirstMatching(ActorRef actor, Class clazz) throws Exception {
+ public static Object getFirstMatching(ActorRef actor, Class<?> clazz) throws Exception {
List<Object> allMessages = getAllMessages(actor);
for(Object message : allMessages){
return null;
}
- public static List<Object> getAllMatching(ActorRef actor, Class clazz) throws Exception {
+ public static List<Object> getAllMatching(ActorRef actor, Class<?> clazz) throws Exception {
List<Object> allMessages = getAllMessages(actor);
List<Object> output = Lists.newArrayList();
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>binding-data-codec</artifactId>
- <version>0.7.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
*/
package org.opendaylight.controller.config.yang.md.sal.binding.impl;
-import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import java.util.Hashtable;
-import java.util.Map.Entry;
-import java.util.Set;
import javassist.ClassPool;
import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec;
import org.opendaylight.controller.sal.binding.codegen.impl.SingletonHolder;
import org.opendaylight.yangtools.binding.data.codec.gen.impl.StreamWriterGenerator;
import org.opendaylight.yangtools.binding.data.codec.impl.BindingNormalizedNodeCodecRegistry;
-import org.opendaylight.yangtools.concepts.Delegator;
import org.opendaylight.yangtools.sal.binding.generator.impl.GeneratedClassLoadingStrategy;
import org.opendaylight.yangtools.sal.binding.generator.impl.RuntimeGeneratedMappingServiceImpl;
-import org.opendaylight.yangtools.yang.binding.DataContainer;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.RpcService;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.impl.codec.BindingIndependentMappingService;
-import org.opendaylight.yangtools.yang.data.impl.codec.CodecRegistry;
-import org.opendaylight.yangtools.yang.data.impl.codec.DeserializationException;
import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
*
*/
public final class RuntimeMappingModule extends AbstractRuntimeMappingModule {
- private static final Logger LOG = LoggerFactory.getLogger(RuntimeMappingModule.class);
-
private BundleContext bundleContext;
public RuntimeMappingModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
public java.lang.AutoCloseable createInstance() {
final GeneratedClassLoadingStrategy classLoading = getGlobalClassLoadingStrategy();
final BindingIndependentMappingService legacyMapping = getGlobalLegacyMappingService(classLoading);
- BindingNormalizedNodeCodecRegistry codecRegistry = new BindingNormalizedNodeCodecRegistry(new StreamWriterGenerator(SingletonHolder.JAVASSIST));
+ BindingNormalizedNodeCodecRegistry codecRegistry = new BindingNormalizedNodeCodecRegistry(StreamWriterGenerator.create(SingletonHolder.JAVASSIST));
BindingToNormalizedNodeCodec instance = new BindingToNormalizedNodeCodec(classLoading, legacyMapping, codecRegistry);
bundleContext.registerService(SchemaContextListener.class, instance, new Hashtable<String,String>());
return instance;
public void setBundleContext(final BundleContext bundleContext) {
this.bundleContext = bundleContext;
}
-
- private static final class RuntimeGeneratedMappingServiceProxy implements //
- BindingIndependentMappingService, //
- Delegator<BindingIndependentMappingService>, //
- AutoCloseable {
-
- private BindingIndependentMappingService delegate;
- private ServiceReference<BindingIndependentMappingService> reference;
- private BundleContext bundleContext;
-
- public RuntimeGeneratedMappingServiceProxy(final BundleContext bundleContext,
- final ServiceReference<BindingIndependentMappingService> serviceRef,
- final BindingIndependentMappingService delegate) {
- this.bundleContext = Preconditions.checkNotNull(bundleContext);
- this.reference = Preconditions.checkNotNull(serviceRef);
- this.delegate = Preconditions.checkNotNull(delegate);
- }
-
- @Override
- public CodecRegistry getCodecRegistry() {
- return delegate.getCodecRegistry();
- }
-
- @Override
- public CompositeNode toDataDom(final DataObject data) {
- return delegate.toDataDom(data);
- }
-
- @Override
- public Entry<YangInstanceIdentifier, CompositeNode> toDataDom(
- final Entry<InstanceIdentifier<? extends DataObject>, DataObject> entry) {
- return delegate.toDataDom(entry);
- }
-
- @Override
- public YangInstanceIdentifier toDataDom(final InstanceIdentifier<? extends DataObject> path) {
- return delegate.toDataDom(path);
- }
-
- @Override
- public DataObject dataObjectFromDataDom(
- final InstanceIdentifier<? extends DataObject> path,
- final CompositeNode result) throws DeserializationException {
- return delegate.dataObjectFromDataDom(path, result);
- }
-
- @Override
- public InstanceIdentifier<?> fromDataDom(final YangInstanceIdentifier entry)
- throws DeserializationException {
- return delegate.fromDataDom(entry);
- }
-
- @Override
- public Set<QName> getRpcQNamesFor(final Class<? extends RpcService> service) {
- return delegate.getRpcQNamesFor(service);
- }
-
- @Override
- public Optional<Class<? extends RpcService>> getRpcServiceClassFor(final String namespace, final String revision) {
- return delegate.getRpcServiceClassFor(namespace,revision);
- }
-
- @Override
- public DataContainer dataObjectFromDataDom(final Class<? extends DataContainer> inputClass, final CompositeNode domInput) {
- return delegate.dataObjectFromDataDom(inputClass, domInput);
- }
-
- @Override
- public void close() {
- if(delegate != null) {
- delegate = null;
-
- try {
- bundleContext.ungetService(reference);
- } catch (IllegalStateException e) {
- // Indicates the BundleContext is no longer valid which can happen normally on shutdown.
- LOG.debug( "Error unregistering service", e );
- }
-
- bundleContext= null;
- reference = null;
- }
- }
-
- @Override
- public BindingIndependentMappingService getDelegate() {
- return delegate;
- }
- }
}
if (path.isWildcarded()) {
return Optional.absent();
}
- return (Optional) getCodec().deserializeFunction(path).apply(Optional.<NormalizedNode<?, ?>> of(data));
+ return (Optional<DataObject>) getCodec().deserializeFunction(path).apply(Optional.<NormalizedNode<?, ?>> of(data));
}
private class TranslatingDataChangeInvoker implements DOMDataChangeListener {
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>sal-test-model</artifactId>
- <version>1.2.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
- <version>2.0.1</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<dependency>
<groupId>xmlunit</groupId>
<artifactId>xmlunit</artifactId>
- <version>1.5</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
- <version>${slf4j.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<dependency>
<groupId>xmlunit</groupId>
<artifactId>xmlunit</artifactId>
- <version>1.5</version>
</dependency>
<dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
- <version>${slf4j.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
- <version>2.0.1</version>
</dependency>
<dependency>
<groupId>com.codahale.metrics</groupId>
public T mailboxCapacity(int capacity) {
Preconditions.checkArgument(capacity > 0, "mailbox capacity must be >0");
- Map<String, Object> boundedMailbox = (Map) configHolder.get(TAG_MAILBOX);
+ Map<String, Object> boundedMailbox = (Map<String, Object>) configHolder.get(TAG_MAILBOX);
boundedMailbox.put(TAG_MAILBOX_CAPACITY, capacity);
return (T)this;
}
Duration pushTimeout = Duration.create(timeout);
Preconditions.checkArgument(pushTimeout.isFinite(), "invalid value for mailbox push timeout");
- Map<String, Object> boundedMailbox = (Map) configHolder.get(TAG_MAILBOX);
+ Map<String, Object> boundedMailbox = (Map<String, Object>) configHolder.get(TAG_MAILBOX);
boundedMailbox.put(TAG_MAILBOX_PUSH_TIMEOUT, timeout);
return (T)this;
}
return; //there's no actor to monitor
}
String actorName = owner.get().path().toStringWithoutAddress();
- String metricName = registry.name(actorName, QUEUE_SIZE);
+ String metricName = MetricRegistry.name(actorName, QUEUE_SIZE);
if (registry.getMetrics().containsKey(metricName))
return; //already registered
- Gauge queueSize = getQueueSizeGuage(monitoredQueue);
+ Gauge<Integer> queueSize = getQueueSizeGuage(monitoredQueue);
registerQueueSizeMetric(metricName, queueSize);
}
public static class MeteredMessageQueue extends BoundedDequeBasedMailbox.MessageQueue {
+ private static final long serialVersionUID = 1L;
public MeteredMessageQueue(int capacity, FiniteDuration pushTimeOut) {
super(capacity, pushTimeOut);
}
}
- private Gauge getQueueSizeGuage(final MeteredMessageQueue monitoredQueue ){
+ private Gauge<Integer> getQueueSizeGuage(final MeteredMessageQueue monitoredQueue ){
return new Gauge<Integer>() {
@Override
public Integer getValue() {
};
}
- private void registerQueueSizeMetric(String metricName, Gauge metric){
+ private void registerQueueSizeMetric(String metricName, Gauge<Integer> metric){
try {
registry.register(metricName,metric);
} catch (IllegalArgumentException e) {
import java.io.Serializable;
public class Monitor implements Serializable {
+ private static final long serialVersionUID = 1L;
private final ActorRef actorRef;
public Monitor(ActorRef actorRef){
public class NormalizedNodeGetter implements
NormalizedNodeVisitor {
private final String path;
- NormalizedNode output;
+ NormalizedNode<?, ?> output;
public NormalizedNodeGetter(String path){
Preconditions.checkNotNull(path);
}
@Override
- public void visitNode(int level, String parentPath, NormalizedNode normalizedNode) {
+ public void visitNode(int level, String parentPath, NormalizedNode<?, ?> normalizedNode) {
String nodePath = parentPath + "/"+ PathUtils.toString(normalizedNode.getIdentifier());
if(nodePath.toString().equals(path)){
}
}
- public NormalizedNode getOutput(){
+ public NormalizedNode<?, ?> getOutput(){
return output;
}
}
String newParentPath = parentPath + "/" + node.getIdentifier().toString();
final Iterable<? extends NormalizedNode<?, ?>> value = node.getValue();
- for(NormalizedNode normalizedNode : value){
+ for(NormalizedNode<?, ?> normalizedNode : value){
if(normalizedNode instanceof MixinNode && normalizedNode instanceof NormalizedNodeContainer){
navigateNormalizedNodeContainerMixin(level + 1, newParentPath, (NormalizedNodeContainer) normalizedNode);
} else {
private void navigateNormalizedNode(int level, String parentPath, NormalizedNode<?,?> normalizedNode){
if(normalizedNode instanceof DataContainerNode){
- final DataContainerNode<?> dataContainerNode = (DataContainerNode) normalizedNode;
+ final DataContainerNode<?> dataContainerNode = (DataContainerNode<?>) normalizedNode;
navigateDataContainerNode(level + 1, parentPath, dataContainerNode);
} else {
}
@Override
- public void visitNode(int level, String parentPath, NormalizedNode normalizedNode) {
+ public void visitNode(int level, String parentPath, NormalizedNode<?, ?> normalizedNode) {
System.out.println(spaces((level) * 4) + normalizedNode.getClass().toString() + ":" + normalizedNode.getIdentifier());
if(normalizedNode instanceof LeafNode || normalizedNode instanceof LeafSetEntryNode){
System.out.println(spaces((level) * 4) + " parentPath = " + parentPath);
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
public interface NormalizedNodeVisitor {
- public void visitNode(int level, String parentPath, NormalizedNode normalizedNode);
+ public void visitNode(int level, String parentPath, NormalizedNode<?, ?> normalizedNode);
}
* @param node
* @return
*/
- public static NormalizedNodeMessages.Node serialize(NormalizedNode node){
+ public static NormalizedNodeMessages.Node serialize(NormalizedNode<?, ?> node){
Preconditions.checkNotNull(node, "node should not be null");
return new Serializer(node).serialize();
}
- public static Serializer newSerializer(NormalizedNode node) {
+ public static Serializer newSerializer(NormalizedNode<?, ?> node) {
Preconditions.checkNotNull(node, "node should not be null");
return new Serializer(node);
}
* @param node
* @return
*/
- public static NormalizedNode deSerialize(NormalizedNodeMessages.Node node) {
+ public static NormalizedNode<?, ?> deSerialize(NormalizedNodeMessages.Node node) {
Preconditions.checkNotNull(node, "node should not be null");
return new DeSerializer(null, node).deSerialize();
}
public static class Serializer extends QNameSerializationContextImpl
implements NormalizedNodeSerializationContext {
- private final NormalizedNode node;
+ private final NormalizedNode<?, ?> node;
private NormalizedNodeMessages.InstanceIdentifier serializedPath;
- private Serializer(NormalizedNode node) {
+ private Serializer(NormalizedNode<?, ?> node) {
this.node = node;
}
}
private NormalizedNodeMessages.Node.Builder serialize(
- NormalizedNode node) {
+ NormalizedNode<?, ?> node) {
NormalizedNodeMessages.Node.Builder builder =
NormalizedNodeMessages.Node.newBuilder();
for (Object o : iterable) {
if (o instanceof NormalizedNode) {
- builder.addChild(serialize((NormalizedNode) o));
+ builder.addChild(serialize((NormalizedNode<?, ?>) o));
}
}
} else if (value instanceof NormalizedNode) {
- builder.addChild(serialize((NormalizedNode) value));
+ builder.addChild(serialize((NormalizedNode<?, ?>) value));
} else {
static {
deSerializationFunctions.put(CONTAINER_NODE_TYPE,
new DeSerializationFunction() {
- @Override public NormalizedNode apply(
+ @Override public NormalizedNode<?, ?> apply(
DeSerializer deSerializer,
NormalizedNodeMessages.Node node) {
DataContainerNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, ContainerNode>
deSerializationFunctions.put(LEAF_NODE_TYPE,
new DeSerializationFunction() {
- @Override public NormalizedNode apply(
+ @Override public NormalizedNode<?, ?> apply(
DeSerializer deSerializer,
NormalizedNodeMessages.Node node) {
NormalizedNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, Object, LeafNode<Object>>
deSerializationFunctions.put(MAP_NODE_TYPE,
new DeSerializationFunction() {
- @Override public NormalizedNode apply(
+ @Override public NormalizedNode<?, ?> apply(
DeSerializer deSerializer,
NormalizedNodeMessages.Node node) {
CollectionNodeBuilder<MapEntryNode, MapNode>
deSerializationFunctions.put(MAP_ENTRY_NODE_TYPE,
new DeSerializationFunction() {
- @Override public NormalizedNode apply(
+ @Override public NormalizedNode<?, ?> apply(
DeSerializer deSerializer,
NormalizedNodeMessages.Node node) {
DataContainerNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode>
deSerializationFunctions.put(AUGMENTATION_NODE_TYPE,
new DeSerializationFunction() {
- @Override public NormalizedNode apply(
+ @Override public NormalizedNode<?, ?> apply(
DeSerializer deSerializer,
NormalizedNodeMessages.Node node) {
DataContainerNodeBuilder<YangInstanceIdentifier.AugmentationIdentifier, AugmentationNode>
deSerializationFunctions.put(LEAF_SET_NODE_TYPE,
new DeSerializationFunction() {
- @Override public NormalizedNode apply(
+ @Override public NormalizedNode<?, ?> apply(
DeSerializer deSerializer,
NormalizedNodeMessages.Node node) {
ListNodeBuilder<Object, LeafSetEntryNode<Object>>
deSerializationFunctions.put(LEAF_SET_ENTRY_NODE_TYPE,
new DeSerializationFunction() {
- @Override public NormalizedNode apply(
+ @Override public NormalizedNode<?, ?> apply(
DeSerializer deSerializer,
NormalizedNodeMessages.Node node) {
NormalizedNodeAttrBuilder<YangInstanceIdentifier.NodeWithValue, Object, LeafSetEntryNode<Object>>
deSerializationFunctions.put(CHOICE_NODE_TYPE,
new DeSerializationFunction() {
- @Override public NormalizedNode apply(
+ @Override public NormalizedNode<?, ?> apply(
DeSerializer deSerializer,
NormalizedNodeMessages.Node node) {
DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifier, ChoiceNode>
deSerializationFunctions.put(ORDERED_LEAF_SET_NODE_TYPE,
new DeSerializationFunction() {
- @Override public NormalizedNode apply(
+ @Override public NormalizedNode<?, ?> apply(
DeSerializer deSerializer,
NormalizedNodeMessages.Node node) {
ListNodeBuilder<Object, LeafSetEntryNode<Object>>
deSerializationFunctions.put(ORDERED_MAP_NODE_TYPE,
new DeSerializationFunction() {
- @Override public NormalizedNode apply(
+ @Override public NormalizedNode<?, ?> apply(
DeSerializer deSerializer,
NormalizedNodeMessages.Node node) {
CollectionNodeBuilder<MapEntryNode, OrderedMapNode>
deSerializationFunctions.put(UNKEYED_LIST_NODE_TYPE,
new DeSerializationFunction() {
- @Override public NormalizedNode apply(
+ @Override public NormalizedNode<?, ?> apply(
DeSerializer deSerializer,
NormalizedNodeMessages.Node node) {
CollectionNodeBuilder<UnkeyedListEntryNode, UnkeyedListNode>
deSerializationFunctions.put(UNKEYED_LIST_ENTRY_NODE_TYPE,
new DeSerializationFunction() {
- @Override public NormalizedNode apply(
+ @Override public NormalizedNode<?, ?> apply(
DeSerializer deSerializer,
NormalizedNodeMessages.Node node) {
DataContainerNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, UnkeyedListEntryNode>
deSerializationFunctions.put(ANY_XML_NODE_TYPE,
new DeSerializationFunction() {
- @Override public NormalizedNode apply(
+ @Override public NormalizedNode<?, ?> apply(
DeSerializer deSerializer,
NormalizedNodeMessages.Node node) {
NormalizedNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, Node<?>, AnyXmlNode>
return deserializedPath;
}
- public NormalizedNode deSerialize() {
- NormalizedNode deserializedNode = deSerialize(node);
+ public NormalizedNode<?, ?> deSerialize() {
+ NormalizedNode<?, ?> deserializedNode = deSerialize(node);
if(path != null) {
deserializedPath = InstanceIdentifierUtils.fromSerializable(path, this);
}
return deserializedNode;
}
- private NormalizedNode deSerialize(NormalizedNodeMessages.Node node){
+ private NormalizedNode<?, ?> deSerialize(NormalizedNodeMessages.Node node){
Preconditions.checkNotNull(node, "node should not be null");
DeSerializationFunction deSerializationFunction = deSerializationFunctions.get(
}
- private NormalizedNode buildCollectionNode(
+ private NormalizedNode<?, ?> buildCollectionNode(
CollectionNodeBuilder builder,
NormalizedNodeMessages.Node node) {
}
- private NormalizedNode buildListNode(
+ private NormalizedNode<?, ?> buildListNode(
ListNodeBuilder<Object, LeafSetEntryNode<Object>> builder,
NormalizedNodeMessages.Node node) {
builder.withNodeIdentifier(toNodeIdentifier(node.getPathArgument()));
return builder.build();
}
- private NormalizedNode buildDataContainer(DataContainerNodeBuilder builder, NormalizedNodeMessages.Node node){
+ private NormalizedNode<?, ?> buildDataContainer(DataContainerNodeBuilder builder, NormalizedNodeMessages.Node node){
for(NormalizedNodeMessages.Node child : node.getChildList()){
builder.withChild((DataContainerChild<?, ?>) deSerialize(child));
return builder.build();
}
- private NormalizedNode buildNormalizedNode(NormalizedNodeAttrBuilder builder, NormalizedNodeMessages.Node node){
+ private NormalizedNode<?, ?> buildNormalizedNode(NormalizedNodeAttrBuilder builder, NormalizedNodeMessages.Node node){
builder.withValue(ValueSerializer.deSerialize(this, node));
}
private static interface DeSerializationFunction {
- NormalizedNode apply(DeSerializer deserializer, NormalizedNodeMessages.Node node);
+ NormalizedNode<?, ?> apply(DeSerializer deserializer, NormalizedNodeMessages.Node node);
}
}
}
UNKEYED_LIST_ENTRY_NODE_TYPE,
ANY_XML_NODE_TYPE;
- public static NormalizedNodeType getSerializableNodeType(NormalizedNode node){
+ public static NormalizedNodeType getSerializableNodeType(NormalizedNode<?, ?> node){
Preconditions.checkNotNull(node, "node should not be null");
if(node instanceof LeafNode){
package org.opendaylight.controller.cluster.datastore.node.utils.serialization;
import com.google.protobuf.ByteString;
-import org.opendaylight.controller.cluster.datastore.node.utils.QNameFactory;
-import org.opendaylight.controller.cluster.datastore.util.InstanceIdentifierUtils;
-import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.HashSet;
import java.util.Set;
+import org.opendaylight.controller.cluster.datastore.node.utils.QNameFactory;
+import org.opendaylight.controller.cluster.datastore.util.InstanceIdentifierUtils;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
public class ValueSerializer {
public static void serialize(NormalizedNodeMessages.Node.Builder builder,
builder.setInstanceIdentifierValue(
InstanceIdentifierUtils.toSerializable((YangInstanceIdentifier) value, context));
} else if(value instanceof Set) {
- Set set = (Set) value;
+ Set<?> set = (Set<?>) value;
if (!set.isEmpty()) {
for (Object o : set) {
if (o instanceof String) {
QNameSerializationContext context, Object value){
builder.setType(ValueType.getSerializableType(value).ordinal());
- builder.setValue(value.toString());
+
+ if(value instanceof YangInstanceIdentifier) {
+ builder.setInstanceIdentifierValue(
+ InstanceIdentifierUtils.toSerializable((YangInstanceIdentifier) value, context));
+ } else if(value instanceof Set) {
+ Set<?> set = (Set<?>) value;
+ if (!set.isEmpty()) {
+ for (Object o : set) {
+ if (o instanceof String) {
+ builder.addBitsValue(o.toString());
+ } else {
+ throw new IllegalArgumentException("Expected value type to be Bits but was : " +
+ value.toString());
+ }
+ }
+ }
+ } else if(value instanceof byte[]){
+ builder.setBytesValue(ByteString.copyFrom((byte[]) value));
+ } else {
+ builder.setValue(value.toString());
+ }
}
public static Object deSerialize(QNameDeSerializationContext context,
return InstanceIdentifierUtils.fromSerializable(
node.getInstanceIdentifierValue(), context);
} else if(node.getIntValueType() == ValueType.BITS_TYPE.ordinal()){
- return new HashSet(node.getBitsValueList());
+ return new HashSet<>(node.getBitsValueList());
} else if(node.getIntValueType() == ValueType.BINARY_TYPE.ordinal()){
return node.getBytesValue().toByteArray();
}
public static Object deSerialize(QNameDeSerializationContext context,
NormalizedNodeMessages.PathArgumentAttribute attribute) {
+
+ if(attribute.getType() == ValueType.YANG_IDENTIFIER_TYPE.ordinal()){
+ return InstanceIdentifierUtils.fromSerializable(
+ attribute.getInstanceIdentifierValue(), context);
+ } else if(attribute.getType() == ValueType.BITS_TYPE.ordinal()){
+ return new HashSet<>(attribute.getBitsValueList());
+ } else if(attribute.getType() == ValueType.BINARY_TYPE.ordinal()){
+ return attribute.getBytesValue().toByteArray();
+ }
return deSerializeBasicTypes(attribute.getType(), attribute.getValue());
}
BIG_DECIMAL_TYPE,
BINARY_TYPE;
- private static Map<Class, ValueType> types = new HashMap<>();
+ private static Map<Class<?>, ValueType> types = new HashMap<>();
static {
types.put(String.class, STRING_TYPE);
case NodeTypes.ANY_XML_NODE :
LOG.debug("Read xml node");
- Node value = (Node) readObject();
+ Node<?> value = (Node<?>) readObject();
return Builders.anyXmlBuilder().withValue(value).build();
case NodeTypes.MAP_NODE :
}
}
- private void writeObjSet(Set set) throws IOException {
+ private void writeObjSet(Set<?> set) throws IOException {
if(!set.isEmpty()){
writer.writeInt(set.size());
for(Object o : set){
writer.writeShort((Short) value);
break;
case ValueTypes.BITS_TYPE:
- writeObjSet((Set) value);
+ writeObjSet((Set<?>) value);
break;
case ValueTypes.YANG_IDENTIFIER_TYPE:
writeYangInstanceIdentifier((YangInstanceIdentifier) value);
public static final byte BIG_INTEGER_TYPE = 10;
public static final byte BIG_DECIMAL_TYPE = 11;
- private static Map<Class, Byte> types = new HashMap<>();
+ private static Map<Class<?>, Byte> types = new HashMap<>();
static {
types.put(String.class, Byte.valueOf(STRING_TYPE));
public class CompositeModificationPayload extends Payload implements
Serializable {
+ private static final long serialVersionUID = 1L;
private final PersistentMessages.CompositeModification modification;
* <code>optional int32 type = 3;</code>
*/
int getType();
+
+ // optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 4;
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 4;</code>
+ *
+ * <pre>
+ * Specific values
+ * </pre>
+ */
+ boolean hasInstanceIdentifierValue();
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 4;</code>
+ *
+ * <pre>
+ * Specific values
+ * </pre>
+ */
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierValue();
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 4;</code>
+ *
+ * <pre>
+ * Specific values
+ * </pre>
+ */
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierValueOrBuilder();
+
+ // repeated string bitsValue = 5;
+ /**
+ * <code>repeated string bitsValue = 5;</code>
+ *
+ * <pre>
+ * intValueType = Bits
+ * </pre>
+ */
+ java.util.List<java.lang.String>
+ getBitsValueList();
+ /**
+ * <code>repeated string bitsValue = 5;</code>
+ *
+ * <pre>
+ * intValueType = Bits
+ * </pre>
+ */
+ int getBitsValueCount();
+ /**
+ * <code>repeated string bitsValue = 5;</code>
+ *
+ * <pre>
+ * intValueType = Bits
+ * </pre>
+ */
+ java.lang.String getBitsValue(int index);
+ /**
+ * <code>repeated string bitsValue = 5;</code>
+ *
+ * <pre>
+ * intValueType = Bits
+ * </pre>
+ */
+ com.google.protobuf.ByteString
+ getBitsValueBytes(int index);
+
+ // optional bytes bytesValue = 6;
+ /**
+ * <code>optional bytes bytesValue = 6;</code>
+ */
+ boolean hasBytesValue();
+ /**
+ * <code>optional bytes bytesValue = 6;</code>
+ */
+ com.google.protobuf.ByteString getBytesValue();
}
/**
* Protobuf type {@code org.opendaylight.controller.mdsal.PathArgumentAttribute}
type_ = input.readInt32();
break;
}
+ case 34: {
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder subBuilder = null;
+ if (((bitField0_ & 0x00000008) == 0x00000008)) {
+ subBuilder = instanceIdentifierValue_.toBuilder();
+ }
+ instanceIdentifierValue_ = input.readMessage(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.PARSER, extensionRegistry);
+ if (subBuilder != null) {
+ subBuilder.mergeFrom(instanceIdentifierValue_);
+ instanceIdentifierValue_ = subBuilder.buildPartial();
+ }
+ bitField0_ |= 0x00000008;
+ break;
+ }
+ case 42: {
+ if (!((mutable_bitField0_ & 0x00000010) == 0x00000010)) {
+ bitsValue_ = new com.google.protobuf.LazyStringArrayList();
+ mutable_bitField0_ |= 0x00000010;
+ }
+ bitsValue_.add(input.readBytes());
+ break;
+ }
+ case 50: {
+ bitField0_ |= 0x00000010;
+ bytesValue_ = input.readBytes();
+ break;
+ }
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
+ if (((mutable_bitField0_ & 0x00000010) == 0x00000010)) {
+ bitsValue_ = new com.google.protobuf.UnmodifiableLazyStringList(bitsValue_);
+ }
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
return type_;
}
+ // optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 4;
+ public static final int INSTANCEIDENTIFIERVALUE_FIELD_NUMBER = 4;
+ private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierValue_;
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 4;</code>
+ *
+ * <pre>
+ * Specific values
+ * </pre>
+ */
+ public boolean hasInstanceIdentifierValue() {
+ return ((bitField0_ & 0x00000008) == 0x00000008);
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 4;</code>
+ *
+ * <pre>
+ * Specific values
+ * </pre>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierValue() {
+ return instanceIdentifierValue_;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 4;</code>
+ *
+ * <pre>
+ * Specific values
+ * </pre>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierValueOrBuilder() {
+ return instanceIdentifierValue_;
+ }
+
+ // repeated string bitsValue = 5;
+ public static final int BITSVALUE_FIELD_NUMBER = 5;
+ private com.google.protobuf.LazyStringList bitsValue_;
+ /**
+ * <code>repeated string bitsValue = 5;</code>
+ *
+ * <pre>
+ * intValueType = Bits
+ * </pre>
+ */
+ public java.util.List<java.lang.String>
+ getBitsValueList() {
+ return bitsValue_;
+ }
+ /**
+ * <code>repeated string bitsValue = 5;</code>
+ *
+ * <pre>
+ * intValueType = Bits
+ * </pre>
+ */
+ public int getBitsValueCount() {
+ return bitsValue_.size();
+ }
+ /**
+ * <code>repeated string bitsValue = 5;</code>
+ *
+ * <pre>
+ * intValueType = Bits
+ * </pre>
+ */
+ public java.lang.String getBitsValue(int index) {
+ return bitsValue_.get(index);
+ }
+ /**
+ * <code>repeated string bitsValue = 5;</code>
+ *
+ * <pre>
+ * intValueType = Bits
+ * </pre>
+ */
+ public com.google.protobuf.ByteString
+ getBitsValueBytes(int index) {
+ return bitsValue_.getByteString(index);
+ }
+
+ // optional bytes bytesValue = 6;
+ public static final int BYTESVALUE_FIELD_NUMBER = 6;
+ private com.google.protobuf.ByteString bytesValue_;
+ /**
+ * <code>optional bytes bytesValue = 6;</code>
+ */
+ public boolean hasBytesValue() {
+ return ((bitField0_ & 0x00000010) == 0x00000010);
+ }
+ /**
+ * <code>optional bytes bytesValue = 6;</code>
+ */
+ public com.google.protobuf.ByteString getBytesValue() {
+ return bytesValue_;
+ }
+
private void initFields() {
name_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.getDefaultInstance();
value_ = "";
type_ = 0;
+ instanceIdentifierValue_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+ bitsValue_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+ bytesValue_ = com.google.protobuf.ByteString.EMPTY;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized != -1) return isInitialized == 1;
+ if (hasInstanceIdentifierValue()) {
+ if (!getInstanceIdentifierValue().isInitialized()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ }
memoizedIsInitialized = 1;
return true;
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
output.writeInt32(3, type_);
}
+ if (((bitField0_ & 0x00000008) == 0x00000008)) {
+ output.writeMessage(4, instanceIdentifierValue_);
+ }
+ for (int i = 0; i < bitsValue_.size(); i++) {
+ output.writeBytes(5, bitsValue_.getByteString(i));
+ }
+ if (((bitField0_ & 0x00000010) == 0x00000010)) {
+ output.writeBytes(6, bytesValue_);
+ }
getUnknownFields().writeTo(output);
}
size += com.google.protobuf.CodedOutputStream
.computeInt32Size(3, type_);
}
+ if (((bitField0_ & 0x00000008) == 0x00000008)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeMessageSize(4, instanceIdentifierValue_);
+ }
+ {
+ int dataSize = 0;
+ for (int i = 0; i < bitsValue_.size(); i++) {
+ dataSize += com.google.protobuf.CodedOutputStream
+ .computeBytesSizeNoTag(bitsValue_.getByteString(i));
+ }
+ size += dataSize;
+ size += 1 * getBitsValueList().size();
+ }
+ if (((bitField0_ & 0x00000010) == 0x00000010)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(6, bytesValue_);
+ }
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
getNameFieldBuilder();
+ getInstanceIdentifierValueFieldBuilder();
}
}
private static Builder create() {
bitField0_ = (bitField0_ & ~0x00000002);
type_ = 0;
bitField0_ = (bitField0_ & ~0x00000004);
+ if (instanceIdentifierValueBuilder_ == null) {
+ instanceIdentifierValue_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+ } else {
+ instanceIdentifierValueBuilder_.clear();
+ }
+ bitField0_ = (bitField0_ & ~0x00000008);
+ bitsValue_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+ bitField0_ = (bitField0_ & ~0x00000010);
+ bytesValue_ = com.google.protobuf.ByteString.EMPTY;
+ bitField0_ = (bitField0_ & ~0x00000020);
return this;
}
to_bitField0_ |= 0x00000004;
}
result.type_ = type_;
+ if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
+ to_bitField0_ |= 0x00000008;
+ }
+ if (instanceIdentifierValueBuilder_ == null) {
+ result.instanceIdentifierValue_ = instanceIdentifierValue_;
+ } else {
+ result.instanceIdentifierValue_ = instanceIdentifierValueBuilder_.build();
+ }
+ if (((bitField0_ & 0x00000010) == 0x00000010)) {
+ bitsValue_ = new com.google.protobuf.UnmodifiableLazyStringList(
+ bitsValue_);
+ bitField0_ = (bitField0_ & ~0x00000010);
+ }
+ result.bitsValue_ = bitsValue_;
+ if (((from_bitField0_ & 0x00000020) == 0x00000020)) {
+ to_bitField0_ |= 0x00000010;
+ }
+ result.bytesValue_ = bytesValue_;
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
if (other.hasType()) {
setType(other.getType());
}
+ if (other.hasInstanceIdentifierValue()) {
+ mergeInstanceIdentifierValue(other.getInstanceIdentifierValue());
+ }
+ if (!other.bitsValue_.isEmpty()) {
+ if (bitsValue_.isEmpty()) {
+ bitsValue_ = other.bitsValue_;
+ bitField0_ = (bitField0_ & ~0x00000010);
+ } else {
+ ensureBitsValueIsMutable();
+ bitsValue_.addAll(other.bitsValue_);
+ }
+ onChanged();
+ }
+ if (other.hasBytesValue()) {
+ setBytesValue(other.getBytesValue());
+ }
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
+ if (hasInstanceIdentifierValue()) {
+ if (!getInstanceIdentifierValue().isInitialized()) {
+
+ return false;
+ }
+ }
return true;
}
/**
* <code>optional .org.opendaylight.controller.mdsal.QName name = 1;</code>
*/
- public Builder setName(
- org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder builderForValue) {
- if (nameBuilder_ == null) {
- name_ = builderForValue.build();
+ public Builder setName(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder builderForValue) {
+ if (nameBuilder_ == null) {
+ name_ = builderForValue.build();
+ onChanged();
+ } else {
+ nameBuilder_.setMessage(builderForValue.build());
+ }
+ bitField0_ |= 0x00000001;
+ return this;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.QName name = 1;</code>
+ */
+ public Builder mergeName(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName value) {
+ if (nameBuilder_ == null) {
+ if (((bitField0_ & 0x00000001) == 0x00000001) &&
+ name_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.getDefaultInstance()) {
+ name_ =
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.newBuilder(name_).mergeFrom(value).buildPartial();
+ } else {
+ name_ = value;
+ }
+ onChanged();
+ } else {
+ nameBuilder_.mergeFrom(value);
+ }
+ bitField0_ |= 0x00000001;
+ return this;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.QName name = 1;</code>
+ */
+ public Builder clearName() {
+ if (nameBuilder_ == null) {
+ name_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.getDefaultInstance();
+ onChanged();
+ } else {
+ nameBuilder_.clear();
+ }
+ bitField0_ = (bitField0_ & ~0x00000001);
+ return this;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.QName name = 1;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder getNameBuilder() {
+ bitField0_ |= 0x00000001;
+ onChanged();
+ return getNameFieldBuilder().getBuilder();
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.QName name = 1;</code>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder getNameOrBuilder() {
+ if (nameBuilder_ != null) {
+ return nameBuilder_.getMessageOrBuilder();
+ } else {
+ return name_;
+ }
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.QName name = 1;</code>
+ */
+ private com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder>
+ getNameFieldBuilder() {
+ if (nameBuilder_ == null) {
+ nameBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder>(
+ name_,
+ getParentForChildren(),
+ isClean());
+ name_ = null;
+ }
+ return nameBuilder_;
+ }
+
+ // optional string value = 2;
+ private java.lang.Object value_ = "";
+ /**
+ * <code>optional string value = 2;</code>
+ */
+ public boolean hasValue() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * <code>optional string value = 2;</code>
+ */
+ public java.lang.String getValue() {
+ java.lang.Object ref = value_;
+ if (!(ref instanceof java.lang.String)) {
+ java.lang.String s = ((com.google.protobuf.ByteString) ref)
+ .toStringUtf8();
+ value_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * <code>optional string value = 2;</code>
+ */
+ public com.google.protobuf.ByteString
+ getValueBytes() {
+ java.lang.Object ref = value_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ value_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * <code>optional string value = 2;</code>
+ */
+ public Builder setValue(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000002;
+ value_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional string value = 2;</code>
+ */
+ public Builder clearValue() {
+ bitField0_ = (bitField0_ & ~0x00000002);
+ value_ = getDefaultInstance().getValue();
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional string value = 2;</code>
+ */
+ public Builder setValueBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000002;
+ value_ = value;
+ onChanged();
+ return this;
+ }
+
+ // optional int32 type = 3;
+ private int type_ ;
+ /**
+ * <code>optional int32 type = 3;</code>
+ */
+ public boolean hasType() {
+ return ((bitField0_ & 0x00000004) == 0x00000004);
+ }
+ /**
+ * <code>optional int32 type = 3;</code>
+ */
+ public int getType() {
+ return type_;
+ }
+ /**
+ * <code>optional int32 type = 3;</code>
+ */
+ public Builder setType(int value) {
+ bitField0_ |= 0x00000004;
+ type_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional int32 type = 3;</code>
+ */
+ public Builder clearType() {
+ bitField0_ = (bitField0_ & ~0x00000004);
+ type_ = 0;
+ onChanged();
+ return this;
+ }
+
+ // optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 4;
+ private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier instanceIdentifierValue_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
+ private com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder> instanceIdentifierValueBuilder_;
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 4;</code>
+ *
+ * <pre>
+ * Specific values
+ * </pre>
+ */
+ public boolean hasInstanceIdentifierValue() {
+ return ((bitField0_ & 0x00000008) == 0x00000008);
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 4;</code>
+ *
+ * <pre>
+ * Specific values
+ * </pre>
+ */
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier getInstanceIdentifierValue() {
+ if (instanceIdentifierValueBuilder_ == null) {
+ return instanceIdentifierValue_;
+ } else {
+ return instanceIdentifierValueBuilder_.getMessage();
+ }
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 4;</code>
+ *
+ * <pre>
+ * Specific values
+ * </pre>
+ */
+ public Builder setInstanceIdentifierValue(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
+ if (instanceIdentifierValueBuilder_ == null) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ instanceIdentifierValue_ = value;
+ onChanged();
+ } else {
+ instanceIdentifierValueBuilder_.setMessage(value);
+ }
+ bitField0_ |= 0x00000008;
+ return this;
+ }
+ /**
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 4;</code>
+ *
+ * <pre>
+ * Specific values
+ * </pre>
+ */
+ public Builder setInstanceIdentifierValue(
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder builderForValue) {
+ if (instanceIdentifierValueBuilder_ == null) {
+ instanceIdentifierValue_ = builderForValue.build();
onChanged();
} else {
- nameBuilder_.setMessage(builderForValue.build());
+ instanceIdentifierValueBuilder_.setMessage(builderForValue.build());
}
- bitField0_ |= 0x00000001;
+ bitField0_ |= 0x00000008;
return this;
}
/**
- * <code>optional .org.opendaylight.controller.mdsal.QName name = 1;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 4;</code>
+ *
+ * <pre>
+ * Specific values
+ * </pre>
*/
- public Builder mergeName(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName value) {
- if (nameBuilder_ == null) {
- if (((bitField0_ & 0x00000001) == 0x00000001) &&
- name_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.getDefaultInstance()) {
- name_ =
- org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.newBuilder(name_).mergeFrom(value).buildPartial();
+ public Builder mergeInstanceIdentifierValue(org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier value) {
+ if (instanceIdentifierValueBuilder_ == null) {
+ if (((bitField0_ & 0x00000008) == 0x00000008) &&
+ instanceIdentifierValue_ != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance()) {
+ instanceIdentifierValue_ =
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.newBuilder(instanceIdentifierValue_).mergeFrom(value).buildPartial();
} else {
- name_ = value;
+ instanceIdentifierValue_ = value;
}
onChanged();
} else {
- nameBuilder_.mergeFrom(value);
+ instanceIdentifierValueBuilder_.mergeFrom(value);
}
- bitField0_ |= 0x00000001;
+ bitField0_ |= 0x00000008;
return this;
}
/**
- * <code>optional .org.opendaylight.controller.mdsal.QName name = 1;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 4;</code>
+ *
+ * <pre>
+ * Specific values
+ * </pre>
*/
- public Builder clearName() {
- if (nameBuilder_ == null) {
- name_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.getDefaultInstance();
+ public Builder clearInstanceIdentifierValue() {
+ if (instanceIdentifierValueBuilder_ == null) {
+ instanceIdentifierValue_ = org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.getDefaultInstance();
onChanged();
} else {
- nameBuilder_.clear();
+ instanceIdentifierValueBuilder_.clear();
}
- bitField0_ = (bitField0_ & ~0x00000001);
+ bitField0_ = (bitField0_ & ~0x00000008);
return this;
}
/**
- * <code>optional .org.opendaylight.controller.mdsal.QName name = 1;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 4;</code>
+ *
+ * <pre>
+ * Specific values
+ * </pre>
*/
- public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder getNameBuilder() {
- bitField0_ |= 0x00000001;
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder getInstanceIdentifierValueBuilder() {
+ bitField0_ |= 0x00000008;
onChanged();
- return getNameFieldBuilder().getBuilder();
+ return getInstanceIdentifierValueFieldBuilder().getBuilder();
}
/**
- * <code>optional .org.opendaylight.controller.mdsal.QName name = 1;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 4;</code>
+ *
+ * <pre>
+ * Specific values
+ * </pre>
*/
- public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder getNameOrBuilder() {
- if (nameBuilder_ != null) {
- return nameBuilder_.getMessageOrBuilder();
+ public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder getInstanceIdentifierValueOrBuilder() {
+ if (instanceIdentifierValueBuilder_ != null) {
+ return instanceIdentifierValueBuilder_.getMessageOrBuilder();
} else {
- return name_;
+ return instanceIdentifierValue_;
}
}
/**
- * <code>optional .org.opendaylight.controller.mdsal.QName name = 1;</code>
+ * <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 4;</code>
+ *
+ * <pre>
+ * Specific values
+ * </pre>
*/
private com.google.protobuf.SingleFieldBuilder<
- org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder>
- getNameFieldBuilder() {
- if (nameBuilder_ == null) {
- nameBuilder_ = new com.google.protobuf.SingleFieldBuilder<
- org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder>(
- name_,
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>
+ getInstanceIdentifierValueFieldBuilder() {
+ if (instanceIdentifierValueBuilder_ == null) {
+ instanceIdentifierValueBuilder_ = new com.google.protobuf.SingleFieldBuilder<
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>(
+ instanceIdentifierValue_,
getParentForChildren(),
isClean());
- name_ = null;
+ instanceIdentifierValue_ = null;
}
- return nameBuilder_;
+ return instanceIdentifierValueBuilder_;
}
- // optional string value = 2;
- private java.lang.Object value_ = "";
+ // repeated string bitsValue = 5;
+ private com.google.protobuf.LazyStringList bitsValue_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+ private void ensureBitsValueIsMutable() {
+ if (!((bitField0_ & 0x00000010) == 0x00000010)) {
+ bitsValue_ = new com.google.protobuf.LazyStringArrayList(bitsValue_);
+ bitField0_ |= 0x00000010;
+ }
+ }
/**
- * <code>optional string value = 2;</code>
+ * <code>repeated string bitsValue = 5;</code>
+ *
+ * <pre>
+ * intValueType = Bits
+ * </pre>
*/
- public boolean hasValue() {
- return ((bitField0_ & 0x00000002) == 0x00000002);
+ public java.util.List<java.lang.String>
+ getBitsValueList() {
+ return java.util.Collections.unmodifiableList(bitsValue_);
}
/**
- * <code>optional string value = 2;</code>
+ * <code>repeated string bitsValue = 5;</code>
+ *
+ * <pre>
+ * intValueType = Bits
+ * </pre>
*/
- public java.lang.String getValue() {
- java.lang.Object ref = value_;
- if (!(ref instanceof java.lang.String)) {
- java.lang.String s = ((com.google.protobuf.ByteString) ref)
- .toStringUtf8();
- value_ = s;
- return s;
- } else {
- return (java.lang.String) ref;
- }
+ public int getBitsValueCount() {
+ return bitsValue_.size();
}
/**
- * <code>optional string value = 2;</code>
+ * <code>repeated string bitsValue = 5;</code>
+ *
+ * <pre>
+ * intValueType = Bits
+ * </pre>
+ */
+ public java.lang.String getBitsValue(int index) {
+ return bitsValue_.get(index);
+ }
+ /**
+ * <code>repeated string bitsValue = 5;</code>
+ *
+ * <pre>
+ * intValueType = Bits
+ * </pre>
*/
public com.google.protobuf.ByteString
- getValueBytes() {
- java.lang.Object ref = value_;
- if (ref instanceof String) {
- com.google.protobuf.ByteString b =
- com.google.protobuf.ByteString.copyFromUtf8(
- (java.lang.String) ref);
- value_ = b;
- return b;
- } else {
- return (com.google.protobuf.ByteString) ref;
- }
+ getBitsValueBytes(int index) {
+ return bitsValue_.getByteString(index);
}
/**
- * <code>optional string value = 2;</code>
+ * <code>repeated string bitsValue = 5;</code>
+ *
+ * <pre>
+ * intValueType = Bits
+ * </pre>
*/
- public Builder setValue(
+ public Builder setBitsValue(
+ int index, java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ ensureBitsValueIsMutable();
+ bitsValue_.set(index, value);
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>repeated string bitsValue = 5;</code>
+ *
+ * <pre>
+ * intValueType = Bits
+ * </pre>
+ */
+ public Builder addBitsValue(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
- bitField0_ |= 0x00000002;
- value_ = value;
+ ensureBitsValueIsMutable();
+ bitsValue_.add(value);
onChanged();
return this;
}
/**
- * <code>optional string value = 2;</code>
+ * <code>repeated string bitsValue = 5;</code>
+ *
+ * <pre>
+ * intValueType = Bits
+ * </pre>
*/
- public Builder clearValue() {
- bitField0_ = (bitField0_ & ~0x00000002);
- value_ = getDefaultInstance().getValue();
+ public Builder addAllBitsValue(
+ java.lang.Iterable<java.lang.String> values) {
+ ensureBitsValueIsMutable();
+ super.addAll(values, bitsValue_);
onChanged();
return this;
}
/**
- * <code>optional string value = 2;</code>
+ * <code>repeated string bitsValue = 5;</code>
+ *
+ * <pre>
+ * intValueType = Bits
+ * </pre>
*/
- public Builder setValueBytes(
+ public Builder clearBitsValue() {
+ bitsValue_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+ bitField0_ = (bitField0_ & ~0x00000010);
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>repeated string bitsValue = 5;</code>
+ *
+ * <pre>
+ * intValueType = Bits
+ * </pre>
+ */
+ public Builder addBitsValueBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
- bitField0_ |= 0x00000002;
- value_ = value;
+ ensureBitsValueIsMutable();
+ bitsValue_.add(value);
onChanged();
return this;
}
- // optional int32 type = 3;
- private int type_ ;
+ // optional bytes bytesValue = 6;
+ private com.google.protobuf.ByteString bytesValue_ = com.google.protobuf.ByteString.EMPTY;
/**
- * <code>optional int32 type = 3;</code>
+ * <code>optional bytes bytesValue = 6;</code>
*/
- public boolean hasType() {
- return ((bitField0_ & 0x00000004) == 0x00000004);
+ public boolean hasBytesValue() {
+ return ((bitField0_ & 0x00000020) == 0x00000020);
}
/**
- * <code>optional int32 type = 3;</code>
+ * <code>optional bytes bytesValue = 6;</code>
*/
- public int getType() {
- return type_;
+ public com.google.protobuf.ByteString getBytesValue() {
+ return bytesValue_;
}
/**
- * <code>optional int32 type = 3;</code>
+ * <code>optional bytes bytesValue = 6;</code>
*/
- public Builder setType(int value) {
- bitField0_ |= 0x00000004;
- type_ = value;
+ public Builder setBytesValue(com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000020;
+ bytesValue_ = value;
onChanged();
return this;
}
/**
- * <code>optional int32 type = 3;</code>
+ * <code>optional bytes bytesValue = 6;</code>
*/
- public Builder clearType() {
- bitField0_ = (bitField0_ & ~0x00000004);
- type_ = 0;
+ public Builder clearBytesValue() {
+ bitField0_ = (bitField0_ & ~0x00000020);
+ bytesValue_ = getDefaultInstance().getBytesValue();
onChanged();
return this;
}
byte isInitialized = memoizedIsInitialized;
if (isInitialized != -1) return isInitialized == 1;
+ for (int i = 0; i < getAttributeCount(); i++) {
+ if (!getAttribute(i).isInitialized()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ }
for (int i = 0; i < getAttributesCount(); i++) {
if (!getAttributes(i).isInitialized()) {
memoizedIsInitialized = 0;
}
public final boolean isInitialized() {
+ for (int i = 0; i < getAttributeCount(); i++) {
+ if (!getAttribute(i).isInitialized()) {
+
+ return false;
+ }
+ }
for (int i = 0; i < getAttributesCount(); i++) {
if (!getAttributes(i).isInitialized()) {
java.lang.String[] descriptorData = {
"\n\014Common.proto\022!org.opendaylight.control" +
"ler.mdsal\"6\n\tAttribute\022\014\n\004name\030\001 \002(\t\022\r\n\005" +
- "value\030\002 \001(\t\022\014\n\004type\030\003 \001(\t\"l\n\025PathArgumen" +
- "tAttribute\0226\n\004name\030\001 \001(\0132(.org.opendayli" +
- "ght.controller.mdsal.QName\022\r\n\005value\030\002 \001(" +
- "\t\022\014\n\004type\030\003 \001(\005\"N\n\005QName\022\r\n\005value\030\001 \001(\t\022" +
- "\021\n\tnamespace\030\002 \001(\005\022\020\n\010revision\030\003 \001(\005\022\021\n\t" +
- "localName\030\004 \001(\005\"\207\002\n\014PathArgument\022\r\n\005valu" +
- "e\030\001 \001(\t\022\014\n\004type\030\002 \001(\t\022:\n\010nodeType\030\003 \001(\0132" +
- "(.org.opendaylight.controller.mdsal.QNam",
- "e\022K\n\tattribute\030\004 \003(\01328.org.opendaylight." +
- "controller.mdsal.PathArgumentAttribute\022@" +
+ "value\030\002 \001(\t\022\014\n\004type\030\003 \001(\t\"\353\001\n\025PathArgume" +
+ "ntAttribute\0226\n\004name\030\001 \001(\0132(.org.opendayl" +
+ "ight.controller.mdsal.QName\022\r\n\005value\030\002 \001" +
+ "(\t\022\014\n\004type\030\003 \001(\005\022V\n\027instanceIdentifierVa" +
+ "lue\030\004 \001(\01325.org.opendaylight.controller." +
+ "mdsal.InstanceIdentifier\022\021\n\tbitsValue\030\005 " +
+ "\003(\t\022\022\n\nbytesValue\030\006 \001(\014\"N\n\005QName\022\r\n\005valu" +
+ "e\030\001 \001(\t\022\021\n\tnamespace\030\002 \001(\005\022\020\n\010revision\030\003",
+ " \001(\005\022\021\n\tlocalName\030\004 \001(\005\"\207\002\n\014PathArgument" +
+ "\022\r\n\005value\030\001 \001(\t\022\014\n\004type\030\002 \001(\t\022:\n\010nodeTyp" +
+ "e\030\003 \001(\0132(.org.opendaylight.controller.md" +
+ "sal.QName\022K\n\tattribute\030\004 \003(\01328.org.opend" +
+ "aylight.controller.mdsal.PathArgumentAtt" +
+ "ribute\022@\n\nattributes\030\005 \003(\0132,.org.openday" +
+ "light.controller.mdsal.Attribute\022\017\n\007intT" +
+ "ype\030\006 \001(\005\"f\n\022InstanceIdentifier\022B\n\targum" +
+ "ents\030\001 \003(\0132/.org.opendaylight.controller" +
+ ".mdsal.PathArgument\022\014\n\004code\030\002 \003(\t\"\271\003\n\004No",
+ "de\022\014\n\004path\030\001 \001(\t\022\014\n\004type\030\002 \001(\t\022E\n\014pathAr" +
+ "gument\030\003 \001(\0132/.org.opendaylight.controll" +
+ "er.mdsal.PathArgument\022\017\n\007intType\030\004 \001(\005\022@" +
"\n\nattributes\030\005 \003(\0132,.org.opendaylight.co" +
- "ntroller.mdsal.Attribute\022\017\n\007intType\030\006 \001(" +
- "\005\"f\n\022InstanceIdentifier\022B\n\targuments\030\001 \003" +
- "(\0132/.org.opendaylight.controller.mdsal.P" +
- "athArgument\022\014\n\004code\030\002 \003(\t\"\271\003\n\004Node\022\014\n\004pa" +
- "th\030\001 \001(\t\022\014\n\004type\030\002 \001(\t\022E\n\014pathArgument\030\003" +
- " \001(\0132/.org.opendaylight.controller.mdsal" +
- ".PathArgument\022\017\n\007intType\030\004 \001(\005\022@\n\nattrib",
- "utes\030\005 \003(\0132,.org.opendaylight.controller" +
- ".mdsal.Attribute\0226\n\005child\030\006 \003(\0132\'.org.op" +
- "endaylight.controller.mdsal.Node\022\r\n\005valu" +
- "e\030\007 \001(\t\022\021\n\tvalueType\030\010 \001(\t\022\024\n\014intValueTy" +
- "pe\030\t \001(\005\022V\n\027instanceIdentifierValue\030\n \001(" +
- "\01325.org.opendaylight.controller.mdsal.In" +
- "stanceIdentifier\022\021\n\tbitsValue\030\013 \003(\t\022\014\n\004c" +
- "ode\030\014 \003(\t\022\022\n\nbytesValue\030\r \001(\014\"`\n\tContain" +
- "er\022\022\n\nparentPath\030\001 \002(\t\022?\n\016normalizedNode" +
- "\030\002 \001(\0132\'.org.opendaylight.controller.mds",
- "al.Node\"\246\001\n\014NodeMapEntry\022U\n\026instanceIden" +
- "tifierPath\030\001 \002(\01325.org.opendaylight.cont" +
- "roller.mdsal.InstanceIdentifier\022?\n\016norma" +
- "lizedNode\030\002 \001(\0132\'.org.opendaylight.contr" +
- "oller.mdsal.Node\"N\n\007NodeMap\022C\n\nmapEntrie" +
- "s\030\001 \003(\0132/.org.opendaylight.controller.md" +
- "sal.NodeMapEntryBO\n5org.opendaylight.con" +
- "troller.protobuff.messages.commonB\026Norma" +
- "lizedNodeMessages"
+ "ntroller.mdsal.Attribute\0226\n\005child\030\006 \003(\0132" +
+ "\'.org.opendaylight.controller.mdsal.Node" +
+ "\022\r\n\005value\030\007 \001(\t\022\021\n\tvalueType\030\010 \001(\t\022\024\n\014in" +
+ "tValueType\030\t \001(\005\022V\n\027instanceIdentifierVa" +
+ "lue\030\n \001(\01325.org.opendaylight.controller." +
+ "mdsal.InstanceIdentifier\022\021\n\tbitsValue\030\013 ",
+ "\003(\t\022\014\n\004code\030\014 \003(\t\022\022\n\nbytesValue\030\r \001(\014\"`\n" +
+ "\tContainer\022\022\n\nparentPath\030\001 \002(\t\022?\n\016normal" +
+ "izedNode\030\002 \001(\0132\'.org.opendaylight.contro" +
+ "ller.mdsal.Node\"\246\001\n\014NodeMapEntry\022U\n\026inst" +
+ "anceIdentifierPath\030\001 \002(\01325.org.opendayli" +
+ "ght.controller.mdsal.InstanceIdentifier\022" +
+ "?\n\016normalizedNode\030\002 \001(\0132\'.org.opendaylig" +
+ "ht.controller.mdsal.Node\"N\n\007NodeMap\022C\n\nm" +
+ "apEntries\030\001 \003(\0132/.org.opendaylight.contr" +
+ "oller.mdsal.NodeMapEntryBO\n5org.opendayl",
+ "ight.controller.protobuff.messages.commo" +
+ "nB\026NormalizedNodeMessages"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
internal_static_org_opendaylight_controller_mdsal_PathArgumentAttribute_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_org_opendaylight_controller_mdsal_PathArgumentAttribute_descriptor,
- new java.lang.String[] { "Name", "Value", "Type", });
+ new java.lang.String[] { "Name", "Value", "Type", "InstanceIdentifierValue", "BitsValue", "BytesValue", });
internal_static_org_opendaylight_controller_mdsal_QName_descriptor =
getDescriptor().getMessageTypes().get(2);
internal_static_org_opendaylight_controller_mdsal_QName_fieldAccessorTable = new
optional QName name =1;
optional string value=2;
optional int32 type=3;
+ // Specific values
+ optional InstanceIdentifier instanceIdentifierValue = 4; // intValueType = YangInstanceIdentifier
+ repeated string bitsValue = 5; // intValueType = Bits
+ optional bytes bytesValue = 6;
+
}
public static Props props(final ReentrantLock lock){
return Props.create(new Creator<PingPongActor>(){
+ private static final long serialVersionUID = 1L;
@Override
public PingPongActor create() throws Exception {
return new PingPongActor(lock);
PathUtils.toString(YangInstanceIdentifier.builder().build()), documentOne);
// Validate the value of id can be retrieved from the normalized node
- NormalizedNode output = normalizedNodeGetter.getOutput();
+ NormalizedNode<?, ?> output = normalizedNodeGetter.getOutput();
assertNotNull(output);
package org.opendaylight.controller.cluster.datastore.node.utils;
+import com.google.common.collect.ImmutableSet;
import org.junit.Test;
import org.opendaylight.controller.cluster.datastore.util.TestModel;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Map;
import java.util.Set;
-
import static junit.framework.TestCase.assertEquals;
public class PathUtilsTest {
}
private YangInstanceIdentifier.AugmentationIdentifier augmentationIdentifier(){
- Set<QName> childNames = new HashSet();
- childNames.add(QNameFactory.create("(urn:opendaylight:flow:table:statistics?revision=2013-12-15)flow-table-statistics"));
+ Set<QName> childNames = ImmutableSet.of(QNameFactory.create("(urn:opendaylight:flow:table:statistics?revision=2013-12-15)flow-table-statistics"));
return new YangInstanceIdentifier.AugmentationIdentifier(childNames);
}
start = System.nanoTime();
- NormalizedNode actualNode =
+ NormalizedNode<?, ?> actualNode =
NormalizedNodeSerializer.deSerialize(expected);
System.out.println("DeSerialize Time = " + (System.nanoTime() - start)/1000000);
package org.opendaylight.controller.cluster.datastore.node.utils.serialization;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
+import com.google.protobuf.ByteString;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.Arrays;
+import java.util.Set;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.Set;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.mock;
public class ValueSerializerTest{
ImmutableSet.of("foo", "bar"));
assertEquals(ValueType.BITS_TYPE.ordinal(), builder1.getType());
- assertEquals("[foo, bar]", builder1.getValue());
+ assertTrue( "foo not in bits", builder1.getBitsValueList().contains("foo"));
+ assertTrue( "bar not in bits", builder1.getBitsValueList().contains("bar"));
}
assertEquals(1, serializedYangInstanceIdentifier.getArgumentsCount());
Mockito.verify(mockContext).addLocalName(TestModel.TEST_QNAME.getLocalName());
Mockito.verify(mockContext).addNamespace(TestModel.TEST_QNAME.getNamespace());
+
+ NormalizedNodeMessages.PathArgumentAttribute.Builder argumentBuilder
+ = NormalizedNodeMessages.PathArgumentAttribute.newBuilder();
+
+ mockContext = mock(QNameSerializationContext.class);
+
+ ValueSerializer.serialize(argumentBuilder, mockContext, v1);
+
+ serializedYangInstanceIdentifier =
+ argumentBuilder.getInstanceIdentifierValue();
+
+ assertEquals(1, serializedYangInstanceIdentifier.getArgumentsCount());
+ Mockito.verify(mockContext).addLocalName(TestModel.TEST_QNAME.getLocalName());
+ Mockito.verify(mockContext).addNamespace(TestModel.TEST_QNAME.getNamespace());
+
}
@Test
}
+ @Test
+ public void testSerializeBinary(){
+ NormalizedNodeMessages.Node.Builder builder = NormalizedNodeMessages.Node.newBuilder();
+ byte[] bytes = new byte[] {1,2,3,4};
+ ValueSerializer.serialize(builder, mock(QNameSerializationContext.class),bytes);
+
+ assertEquals(ValueType.BINARY_TYPE.ordinal(), builder.getIntValueType());
+ assertEquals(ByteString.copyFrom(bytes), builder.getBytesValue());
+
+ NormalizedNodeMessages.PathArgumentAttribute.Builder builder1 = NormalizedNodeMessages.PathArgumentAttribute.newBuilder();
+
+ ValueSerializer.serialize(builder1, mock(QNameSerializationContext.class),bytes);
+
+ assertEquals(ValueType.BINARY_TYPE.ordinal(), builder1.getType());
+ assertEquals(ByteString.copyFrom(bytes), builder1.getBytesValue());
+
+ }
+
+
@Test
public void testDeSerializeShort(){
NormalizedNodeMessages.Node.Builder nodeBuilder = NormalizedNodeMessages.Node.newBuilder();
nodeBuilder.build());
assertTrue(o instanceof Set);
- assertTrue(((Set)o).contains("foo"));
- assertTrue(((Set) o).contains("bar"));
+ assertTrue(((Set<?>)o).contains("foo"));
+ assertTrue(((Set<?>) o).contains("bar"));
+
+ NormalizedNodeMessages.PathArgumentAttribute.Builder argumentBuilder
+ = NormalizedNodeMessages.PathArgumentAttribute.newBuilder();
+
+ argumentBuilder.setType(ValueType.BITS_TYPE.ordinal());
+ argumentBuilder.addAllBitsValue(ImmutableList.of("foo", "bar"));
+
+ o = ValueSerializer
+ .deSerialize(mock(QNameDeSerializationContext.class),
+ argumentBuilder.build());
+
+ assertTrue(o instanceof Set);
+ assertTrue(((Set<?>)o).contains("foo"));
+ assertTrue(((Set<?>) o).contains("bar"));
}
assertTrue(o instanceof YangInstanceIdentifier);
assertEquals(TestModel.TEST_PATH, o);
+ NormalizedNodeMessages.PathArgumentAttribute.Builder argumentBuilder =
+ NormalizedNodeMessages.PathArgumentAttribute.newBuilder();
+
+ argumentBuilder.setType(ValueType.YANG_IDENTIFIER_TYPE.ordinal());
+ argumentBuilder.setInstanceIdentifierValue(idBuilder);
+
+ o = ValueSerializer.deSerialize(mockContext, argumentBuilder.build());
+
+ assertTrue(o instanceof YangInstanceIdentifier);
+ assertEquals(TestModel.TEST_PATH, o);
}
@Test
}
+
+ @Test
+ public void testDeSerializeBinaryType(){
+ NormalizedNodeMessages.Node.Builder nodeBuilder = NormalizedNodeMessages.Node.newBuilder();
+ nodeBuilder.setIntValueType(ValueType.BINARY_TYPE.ordinal());
+ byte[] bytes = new byte[] {1,2,3,4};
+ nodeBuilder.setBytesValue(ByteString.copyFrom(bytes));
+
+ Object o = ValueSerializer.deSerialize(mock(QNameDeSerializationContext.class),nodeBuilder.build());
+
+ assertTrue("not a byte array", o instanceof byte[]);
+ assertTrue("bytes value does not match" , Arrays.equals(bytes, (byte[]) o));
+
+ NormalizedNodeMessages.PathArgumentAttribute.Builder argumentBuilder =
+ NormalizedNodeMessages.PathArgumentAttribute.newBuilder();
+ argumentBuilder.setType(ValueType.BINARY_TYPE.ordinal());
+ argumentBuilder.setBytesValue(ByteString.copyFrom(bytes));
+
+ o = ValueSerializer.deSerialize(mock(QNameDeSerializationContext.class), argumentBuilder.build());
+
+ assertTrue("not a byte array", o instanceof byte[]);
+ assertTrue("bytes value does not match" ,Arrays.equals(bytes, (byte[]) o));
+
+
+ }
+
+
}
package org.opendaylight.controller.cluster.datastore.util;
+import com.google.common.collect.ImmutableSet;
import org.junit.Assert;
import org.junit.Test;
import org.opendaylight.controller.cluster.datastore.node.utils.serialization.QNameDeSerializationContext;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.HashSet;
import java.util.List;
public class InstanceIdentifierUtilsTest {
@Test
public void testAugmentationIdentifier() {
- YangInstanceIdentifier.PathArgument p1 = new YangInstanceIdentifier.AugmentationIdentifier(new HashSet(
- Arrays.asList(TEST_QNAME)));
+ YangInstanceIdentifier.PathArgument p1 = new YangInstanceIdentifier.AugmentationIdentifier(
+ ImmutableSet.of(TEST_QNAME));
List<YangInstanceIdentifier.PathArgument> arguments = new ArrayList<>();
@Test
public void testInputXmlToCompositeNode() {
CompositeNode node = XmlUtils.inputXmlToCompositeNode(testRpc.getQName(), XML_CONTENT, schema);
- ImmutableList<SimpleNode> input = (ImmutableList)node.getValue().get(0).getValue();
- SimpleNode firstNode = input.get(0);
+ ImmutableList<SimpleNode<?>> input = (ImmutableList<SimpleNode<?>>)node.getValue().get(0).getValue();
+ SimpleNode<?> firstNode = input.get(0);
Assert.assertEquals("id", firstNode.getNodeType().getLocalName());
Assert.assertEquals("flowid", firstNode.getValue());
- SimpleNode secondNode = input.get(1);
+ SimpleNode<?> secondNode = input.get(1);
Assert.assertEquals("flow", secondNode.getNodeType().getLocalName());
YangInstanceIdentifier instance = (YangInstanceIdentifier) secondNode.getValue();
@Test
public void testInputCompositeNodeToXML() {
CompositeNode input = XmlUtils.inputXmlToCompositeNode(testRpc.getQName(), XML_CONTENT, schema);
- List<Node<?>> childNodes = new ArrayList();
+ List<Node<?>> childNodes = new ArrayList<>();
childNodes.add(input);
QName rpcQName = schema.getOperations().iterator().next().getQName();
CompositeNode node = new ImmutableCompositeNode(rpcQName, input.getValue(), ModifyAction.REPLACE);
package org.opendaylight.controller.cluster.datastore;
import akka.actor.ActorRef;
+import akka.actor.Address;
public interface ClusterWrapper {
void subscribeToMemberEvents(ActorRef actorRef);
String getCurrentMemberName();
- String getSelfAddress();
+ Address getSelfAddress();
}
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
+import akka.actor.Address;
import akka.cluster.Cluster;
import akka.cluster.ClusterEvent;
import com.google.common.base.Preconditions;
public class ClusterWrapperImpl implements ClusterWrapper {
private final Cluster cluster;
private final String currentMemberName;
- private final String selfAddress;
+ private final Address selfAddress;
public ClusterWrapperImpl(ActorSystem actorSystem){
Preconditions.checkNotNull(actorSystem, "actorSystem should not be null");
);
currentMemberName = (String) cluster.getSelfRoles().toArray()[0];
- selfAddress = cluster.selfAddress().toString();
+ selfAddress = cluster.selfAddress();
}
return currentMemberName;
}
- public String getSelfAddress() {
+ public Address getSelfAddress() {
return selfAddress;
}
}
private static class DataChangeListenerRegistrationCreator
implements Creator<DataChangeListenerRegistration> {
+ private static final long serialVersionUID = 1L;
final ListenerRegistration<AsyncDataChangeListener<YangInstanceIdentifier,
NormalizedNode<?, ?>>> registration;
}
static class SchemaContextModules implements Serializable {
+ private static final long serialVersionUID = 1L;
private final Set<String> modules;
SchemaContextModules(Set<String> modules){
import akka.actor.ActorSelection;
import akka.dispatch.OnComplete;
import com.google.common.base.Preconditions;
-import java.util.AbstractMap.SimpleEntry;
import java.util.Collections;
import java.util.List;
-import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
+import java.util.concurrent.atomic.AtomicInteger;
import org.opendaylight.controller.cluster.datastore.messages.CloseTransactionChain;
import org.opendaylight.controller.cluster.datastore.utils.ActorContext;
import org.opendaylight.controller.md.sal.common.api.data.TransactionChainClosedException;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import scala.concurrent.Future;
import scala.concurrent.Promise;
* TransactionChainProxy acts as a proxy for a DOMStoreTransactionChain created on a remote shard
*/
public class TransactionChainProxy implements DOMStoreTransactionChain {
+
+ private static final Logger LOG = LoggerFactory.getLogger(TransactionChainProxy.class);
+
private interface State {
boolean isReady();
- SimpleEntry<Object, List<Future<ActorSelection>>> getReadyFutures();
-
- void setReadyFutures(Object txIdentifier, List<Future<ActorSelection>> readyFutures);
+ List<Future<ActorSelection>> getPreviousReadyFutures();
}
private static class Allocated implements State {
- private volatile SimpleEntry<Object, List<Future<ActorSelection>>> readyFutures;
+ private final ChainedTransactionProxy transaction;
- @Override
- public boolean isReady() {
- return readyFutures != null;
+ Allocated(ChainedTransactionProxy transaction) {
+ this.transaction = transaction;
}
@Override
- public SimpleEntry<Object, List<Future<ActorSelection>>> getReadyFutures() {
- return readyFutures != null ? readyFutures : EMPTY_READY_FUTURES;
+ public boolean isReady() {
+ return transaction.isReady();
}
@Override
- public void setReadyFutures(Object txIdentifier, List<Future<ActorSelection>> readyFutures) {
- this.readyFutures = new SimpleEntry<>(txIdentifier, readyFutures);
+ public List<Future<ActorSelection>> getPreviousReadyFutures() {
+ return transaction.getReadyFutures();
}
}
private static abstract class AbstractDefaultState implements State {
@Override
- public SimpleEntry<Object, List<Future<ActorSelection>>> getReadyFutures() {
- return EMPTY_READY_FUTURES;
- }
-
- @Override
- public void setReadyFutures(Object txIdentifier, List<Future<ActorSelection>> readyFutures) {
- throw new IllegalStateException("No transaction is allocated");
+ public List<Future<ActorSelection>> getPreviousReadyFutures() {
+ return Collections.emptyList();
}
}
}
};
- private static final SimpleEntry<Object, List<Future<ActorSelection>>> EMPTY_READY_FUTURES =
- new SimpleEntry<Object, List<Future<ActorSelection>>>("",
- Collections.<Future<ActorSelection>>emptyList());
-
- private static final AtomicReferenceFieldUpdater<TransactionChainProxy, State> STATE_UPDATER =
- AtomicReferenceFieldUpdater.newUpdater(TransactionChainProxy.class, State.class, "state");
+ private static final AtomicInteger counter = new AtomicInteger(0);
private final ActorContext actorContext;
private final String transactionChainId;
- private volatile State state = IDLE_STATE;
+ private volatile State currentState = IDLE_STATE;
public TransactionChainProxy(ActorContext actorContext) {
this.actorContext = actorContext;
- transactionChainId = actorContext.getCurrentMemberName() + "-" + System.currentTimeMillis();
+ transactionChainId = actorContext.getCurrentMemberName() + "-txn-chain-" + counter.incrementAndGet();
+ }
+
+ public String getTransactionChainId() {
+ return transactionChainId;
}
@Override
public DOMStoreReadTransaction newReadOnlyTransaction() {
- checkReadyState();
- return new ChainedTransactionProxy(actorContext, TransactionProxy.TransactionType.READ_ONLY);
+ State localState = currentState;
+ checkReadyState(localState);
+
+ return new ChainedTransactionProxy(actorContext, TransactionProxy.TransactionType.READ_ONLY,
+ transactionChainId, localState.getPreviousReadyFutures());
}
@Override
@Override
public void close() {
- state = CLOSED_STATE;
+ currentState = CLOSED_STATE;
// Send a close transaction chain request to each and every shard
actorContext.broadcast(new CloseTransactionChain(transactionChainId));
}
private ChainedTransactionProxy allocateWriteTransaction(TransactionProxy.TransactionType type) {
- checkReadyState();
+ State localState = currentState;
- ChainedTransactionProxy txProxy = new ChainedTransactionProxy(actorContext, type);
- STATE_UPDATER.compareAndSet(this, IDLE_STATE, new Allocated());
+ checkReadyState(localState);
+
+ // Pass the ready Futures from the previous Tx.
+ ChainedTransactionProxy txProxy = new ChainedTransactionProxy(actorContext, type,
+ transactionChainId, localState.getPreviousReadyFutures());
+
+ currentState = new Allocated(txProxy);
return txProxy;
}
- private void checkReadyState() {
- Preconditions.checkState(state.isReady(), "Previous transaction %s is not ready yet",
- state.getReadyFutures().getKey());
+ private void checkReadyState(State state) {
+ Preconditions.checkState(state.isReady(), "Previous transaction is not ready yet");
}
- private class ChainedTransactionProxy extends TransactionProxy {
+ private static class ChainedTransactionProxy extends TransactionProxy {
+
+ /**
+ * Stores the ready Futures from the previous Tx in the chain.
+ */
+ private final List<Future<ActorSelection>> previousReadyFutures;
+
+ /**
+ * Stores the ready Futures from this transaction when it is readied.
+ */
+ private volatile List<Future<ActorSelection>> readyFutures;
- ChainedTransactionProxy(ActorContext actorContext, TransactionType transactionType) {
+ private ChainedTransactionProxy(ActorContext actorContext, TransactionType transactionType,
+ String transactionChainId, List<Future<ActorSelection>> previousReadyFutures) {
super(actorContext, transactionType, transactionChainId);
+ this.previousReadyFutures = previousReadyFutures;
+ }
+
+ List<Future<ActorSelection>> getReadyFutures() {
+ return readyFutures;
+ }
+
+ boolean isReady() {
+ return readyFutures != null;
}
@Override
protected void onTransactionReady(List<Future<ActorSelection>> readyFutures) {
- state.setReadyFutures(getIdentifier(), readyFutures);
+ LOG.debug("onTransactionReady {} pending readyFutures size {} chain {}", getIdentifier(),
+ readyFutures.size(), getTransactionChainId());
+ this.readyFutures = readyFutures;
}
/**
final Object serializedCreateMessage) {
// Check if there are any previous ready Futures, otherwise let the super class handle it.
- // The second check is done to ensure the the previous ready Futures aren't for this
- // Tx instance as deadlock would occur if we tried to wait on our own Futures. This can
- // occur in this scenario:
- //
- // - the TransactionProxy is created and the client does a write.
- //
- // - the TransactionProxy then attempts to create the shard Tx. However it first
- // sends a FindPrimaryShard message to the shard manager to find the local shard
- // This call is done async.
- //
- // - the client submits the Tx and the TransactionProxy is readied and we cache
- // the ready Futures here.
- //
- // - then the FindPrimaryShard call completes and this method is called to create
- // the shard Tx. However the cached Futures were from the ready on this Tx. If we
- // tried to wait on them, it would cause a form of deadlock as the ready Future
- // would be waiting on the Tx create Future and vice versa.
- SimpleEntry<Object, List<Future<ActorSelection>>> readyFuturesEntry = state.getReadyFutures();
- List<Future<ActorSelection>> readyFutures = readyFuturesEntry.getValue();
- if(readyFutures.isEmpty() || getIdentifier().equals(readyFuturesEntry.getKey())) {
+ if(previousReadyFutures.isEmpty()) {
return super.sendCreateTransaction(shard, serializedCreateMessage);
}
// Combine the ready Futures into 1.
Future<Iterable<ActorSelection>> combinedFutures = akka.dispatch.Futures.sequence(
- readyFutures, actorContext.getActorSystem().dispatcher());
+ previousReadyFutures, getActorContext().getActorSystem().dispatcher());
// Add a callback for completion of the combined Futures.
final Promise<Object> createTxPromise = akka.dispatch.Futures.promise();
// A Ready Future failed so fail the returned Promise.
createTxPromise.failure(failure);
} else {
+ LOG.debug("Previous Tx readied - sending CreateTransaction for {} on chain {}",
+ getIdentifier(), getTransactionChainId());
+
// Send the CreateTx message and use the resulting Future to complete the
// returned Promise.
- createTxPromise.completeWith(actorContext.executeOperationAsync(shard,
+ createTxPromise.completeWith(getActorContext().executeOperationAsync(shard,
serializedCreateMessage));
}
}
};
- combinedFutures.onComplete(onComplete, actorContext.getActorSystem().dispatcher());
+ combinedFutures.onComplete(onComplete, getActorContext().getActorSystem().dispatcher());
return createTxPromise.future();
}
phantomReferenceCache.put(cleanup, cleanup);
}
- LOG.debug("Created txn {} of type {}", identifier, transactionType);
+ LOG.debug("Created txn {} of type {} on chain {}", identifier, transactionType, transactionChainId);
}
@VisibleForTesting
for(TransactionFutureCallback txFutureCallback : txFutureCallbackMap.values()) {
- LOG.debug("Tx {} Readying transaction for shard {}", identifier,
- txFutureCallback.getShardName());
+ LOG.debug("Tx {} Readying transaction for shard {} chain {}", identifier,
+ txFutureCallback.getShardName(), transactionChainId);
TransactionContext transactionContext = txFutureCallback.getTransactionContext();
if(transactionContext != null) {
return transactionChainId;
}
+ protected ActorContext getActorContext() {
+ return actorContext;
+ }
+
/**
* Interface for a transaction operation to be invoked later.
*/
// TxActor is always created where the leader of the shard is.
// Check if TxActor is created in the same node
- boolean isTxActorLocal = actorContext.isLocalPath(transactionPath);
+ boolean isTxActorLocal = actorContext.isPathLocal(transactionPath);
return new TransactionContextImpl(transactionPath, transactionActor, identifier,
actorContext, schemaContext, isTxActorLocal, reply.getVersion());
package org.opendaylight.controller.cluster.datastore.exceptions;
public class NotInitializedException extends RuntimeException {
+ private static final long serialVersionUID = 1L;
public NotInitializedException(String message) {
super(message);
}
package org.opendaylight.controller.cluster.datastore.exceptions;
public class PrimaryNotFoundException extends RuntimeException {
+ private static final long serialVersionUID = 1L;
public PrimaryNotFoundException(String message){
super(message);
}
package org.opendaylight.controller.cluster.datastore.exceptions;
public class TimeoutException extends RuntimeException {
+ private static final long serialVersionUID = 1L;
public TimeoutException(String message, Exception e){
super(message, e);
}
package org.opendaylight.controller.cluster.datastore.exceptions;
public class UnknownMessageException extends Exception {
+ private static final long serialVersionUID = 1L;
private final Object message;
public UnknownMessageException(Object message) {
import java.io.Serializable;
public class ActorInitialized implements Serializable {
+ private static final long serialVersionUID = 1L;
}
import java.io.Serializable;
public class ActorNotInitialized implements Serializable {
+ private static final long serialVersionUID = 1L;
}
import akka.actor.ActorRef;
import akka.actor.ActorSelection;
import akka.actor.ActorSystem;
+import akka.actor.Address;
import akka.actor.PoisonPill;
import akka.dispatch.Mapper;
import akka.pattern.AskTimeoutException;
import akka.util.Timeout;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
+import com.google.common.base.Strings;
+import java.util.concurrent.TimeUnit;
import org.opendaylight.controller.cluster.datastore.ClusterWrapper;
import org.opendaylight.controller.cluster.datastore.Configuration;
import org.opendaylight.controller.cluster.datastore.DatastoreContext;
import scala.concurrent.Future;
import scala.concurrent.duration.Duration;
import scala.concurrent.duration.FiniteDuration;
-import java.util.concurrent.TimeUnit;
+
import static akka.pattern.Patterns.ask;
/**
private volatile SchemaContext schemaContext;
private final FiniteDuration operationDuration;
private final Timeout operationTimeout;
+ private final String selfAddressHostPort;
public ActorContext(ActorSystem actorSystem, ActorRef shardManager,
ClusterWrapper clusterWrapper, Configuration configuration) {
operationDuration = Duration.create(datastoreContext.getOperationTimeoutInSeconds(),
TimeUnit.SECONDS);
operationTimeout = new Timeout(operationDuration);
+
+ Address selfAddress = clusterWrapper.getSelfAddress();
+ if (selfAddress != null && !selfAddress.host().isEmpty()) {
+ selfAddressHostPort = selfAddress.host().get() + ":" + selfAddress.port().get();
+ } else {
+ selfAddressHostPort = null;
+ }
}
public DatastoreContext getDatastoreContext() {
return operationDuration;
}
- public boolean isLocalPath(String path) {
- String selfAddress = clusterWrapper.getSelfAddress();
- if (path == null || selfAddress == null) {
+ public boolean isPathLocal(String path) {
+ if (Strings.isNullOrEmpty(path)) {
return false;
}
- int atIndex1 = path.indexOf("@");
- int atIndex2 = selfAddress.indexOf("@");
+ int pathAtIndex = path.indexOf("@");
+ if (pathAtIndex == -1) {
+ //if the path is of local format, then its local and is co-located
+ return true;
- if (atIndex1 == -1 || atIndex2 == -1) {
- return false;
- }
+ } else if (selfAddressHostPort != null) {
+ // self-address and tx actor path, both are of remote path format
+ int slashIndex = path.indexOf("/", pathAtIndex);
+
+ if (slashIndex == -1) {
+ return false;
+ }
- int slashIndex1 = path.indexOf("/", atIndex1);
- int slashIndex2 = selfAddress.indexOf("/", atIndex2);
+ String hostPort = path.substring(pathAtIndex + 1, slashIndex);
+ return hostPort.equals(selfAddressHostPort);
- if (slashIndex1 == -1 || slashIndex2 == -1) {
+ } else {
+ // self address is local format and tx actor path is remote format
return false;
}
-
- String hostPort1 = path.substring(atIndex1, slashIndex1);
- String hostPort2 = selfAddress.substring(atIndex2, slashIndex2);
-
- return hostPort1.equals(hostPort2);
}
/**
import com.google.common.base.Optional;
import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.Uninterruptibles;
+import java.util.ArrayList;
+import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
}};
}
+ @Test
+ public void testCreateChainedTransactionsInQuickSuccession() throws Exception{
+ new IntegrationTestKit(getSystem()) {{
+ DistributedDataStore dataStore = setupDistributedDataStore(
+ "testCreateChainedTransactionsInQuickSuccession", "test-1");
+
+ DOMStoreTransactionChain txChain = dataStore.createTransactionChain();
+
+ NormalizedNode<?, ?> testNode = ImmutableNodes.containerNode(TestModel.TEST_QNAME);
+
+ int nTxs = 20;
+ List<DOMStoreThreePhaseCommitCohort> cohorts = new ArrayList<>(nTxs);
+ for(int i = 0; i < nTxs; i++) {
+ DOMStoreReadWriteTransaction rwTx = txChain.newReadWriteTransaction();
+
+ rwTx.merge(TestModel.TEST_PATH, testNode);
+
+ cohorts.add(rwTx.ready());
+
+ }
+
+ for(DOMStoreThreePhaseCommitCohort cohort: cohorts) {
+ doCommit(cohort);
+ }
+
+ txChain.close();
+
+ cleanup(dataStore);
+ }};
+ }
+
+ @Test
+ public void testCreateChainedTransactionAfterEmptyTxReadied() throws Exception{
+ new IntegrationTestKit(getSystem()) {{
+ DistributedDataStore dataStore = setupDistributedDataStore(
+ "testCreateChainedTransactionAfterEmptyTxReadied", "test-1");
+
+ DOMStoreTransactionChain txChain = dataStore.createTransactionChain();
+
+ DOMStoreReadWriteTransaction rwTx1 = txChain.newReadWriteTransaction();
+
+ rwTx1.ready();
+
+ DOMStoreReadWriteTransaction rwTx2 = txChain.newReadWriteTransaction();
+
+ Optional<NormalizedNode<?, ?>> optional = rwTx2.read(TestModel.TEST_PATH).get(5, TimeUnit.SECONDS);
+ assertEquals("isPresent", false, optional.isPresent());
+
+ txChain.close();
+
+ cleanup(dataStore);
+ }};
+ }
+
@Test
public void testCreateChainedTransactionWhenPreviousNotReady() throws Throwable {
new IntegrationTestKit(getSystem()) {{
throws Exception {
final CountDownLatch persistLatch = new CountDownLatch(1);
final Creator<ShardManager> creator = new Creator<ShardManager>() {
+ private static final long serialVersionUID = 1L;
@Override
public ShardManager create() throws Exception {
return new ShardManager(shardMrgIDSuffix, new MockClusterWrapper(), new MockConfiguration(), DatastoreContext.newBuilder().build()) {
}
private static class DelegatingShardManagerCreator implements Creator<ShardManager> {
+ private static final long serialVersionUID = 1L;
private Creator<ShardManager> delegate;
public DelegatingShardManagerCreator(Creator<ShardManager> delegate) {
super(actorSystem);
}
- protected void waitForLogMessage(final Class logLevel, ActorRef subject, String logMessage){
+ protected void waitForLogMessage(final Class<?> logLevel, ActorRef subject, String logMessage){
// Wait for a specific log message to show up
final boolean result =
new JavaTestKit.EventFilter<Boolean>(logLevel
package org.opendaylight.controller.cluster.datastore;
+import static org.mockito.Matchers.anyObject;
+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 org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import static org.mockito.Matchers.anyObject;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-
public class TransactionChainProxyTest {
ActorContext actorContext = mock(ActorContext.class);
SchemaContext schemaContext = mock(SchemaContext.class);
verify(context, times(1)).broadcast(anyObject());
}
+
+ @Test
+ public void testTransactionChainsHaveUniqueId(){
+ TransactionChainProxy one = new TransactionChainProxy(mock(ActorContext.class));
+ TransactionChainProxy two = new TransactionChainProxy(mock(ActorContext.class));
+
+ Assert.assertNotEquals(one.getTransactionChainId(), two.getTransactionChainId());
+ }
}
executeOperationAsync(eq(actorSystem.actorSelection(actorRef.path())),
eqCreateTransaction(memberName, type));
- doReturn(false).when(mockActorContext).isLocalPath(actorRef.path().toString());
+ doReturn(false).when(mockActorContext).isPathLocal(actorRef.path().toString());
return actorRef;
}
doReturn(readySerializedTxReply(actorRef.path().toString())).when(mockActorContext).executeOperationAsync(
eq(actorSelection(actorRef)), isA(ReadyTransaction.SERIALIZABLE_CLASS));
- doReturn(false).when(mockActorContext).isLocalPath(actorRef.path().toString());
+ doReturn(false).when(mockActorContext).isPathLocal(actorRef.path().toString());
TransactionProxy transactionProxy = new TransactionProxy(mockActorContext,
WRITE_ONLY);
executeOperationAsync(eq(actorSystem.actorSelection(shardActorRef.path())),
eqCreateTransaction(memberName, READ_ONLY));
- doReturn(true).when(mockActorContext).isLocalPath(actorPath);
+ doReturn(true).when(mockActorContext).isPathLocal(actorPath);
TransactionProxy transactionProxy = new TransactionProxy(mockActorContext,READ_ONLY);
executeOperationAsync(eq(actorSystem.actorSelection(shardActorRef.path())),
eqCreateTransaction(memberName, WRITE_ONLY));
- doReturn(true).when(mockActorContext).isLocalPath(actorPath);
+ doReturn(true).when(mockActorContext).isPathLocal(actorPath);
NormalizedNode<?, ?> nodeToWrite = ImmutableNodes.containerNode(TestModel.TEST_QNAME);
import akka.actor.ActorRef;
import akka.actor.ActorSelection;
import akka.actor.ActorSystem;
+import akka.actor.Address;
import akka.actor.Props;
import akka.actor.UntypedActor;
import akka.japi.Creator;
import akka.testkit.JavaTestKit;
import com.google.common.base.Optional;
+import java.util.concurrent.TimeUnit;
import org.junit.Test;
import org.opendaylight.controller.cluster.datastore.AbstractActorTest;
import org.opendaylight.controller.cluster.datastore.ClusterWrapper;
import scala.concurrent.Future;
import scala.concurrent.duration.Duration;
-import java.util.concurrent.TimeUnit;
-
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
}
@Test
- public void testIsLocalPath() {
+ public void testIsPathLocal() {
MockClusterWrapper clusterWrapper = new MockClusterWrapper();
- ActorContext actorContext =
- new ActorContext(getSystem(), null, clusterWrapper, mock(Configuration.class));
+ ActorContext actorContext = null;
- clusterWrapper.setSelfAddress("");
- assertEquals(false, actorContext.isLocalPath(null));
- assertEquals(false, actorContext.isLocalPath(""));
+ actorContext = new ActorContext(getSystem(), null, clusterWrapper, mock(Configuration.class));
+ assertEquals(false, actorContext.isPathLocal(null));
+ assertEquals(false, actorContext.isPathLocal(""));
clusterWrapper.setSelfAddress(null);
- assertEquals(false, actorContext.isLocalPath(""));
-
- clusterWrapper.setSelfAddress("akka://test/user/$b");
- assertEquals(false, actorContext.isLocalPath("akka://test/user/$a"));
-
- clusterWrapper.setSelfAddress("akka.tcp://system@127.0.0.1:2550/");
- assertEquals(true, actorContext.isLocalPath("akka.tcp://system@127.0.0.1:2550/"));
-
- clusterWrapper.setSelfAddress("akka.tcp://system@127.0.0.1:2550");
- assertEquals(false, actorContext.isLocalPath("akka.tcp://system@127.0.0.1:2550/"));
-
- clusterWrapper.setSelfAddress("akka.tcp://system@128.0.0.1:2550/");
- assertEquals(false, actorContext.isLocalPath("akka.tcp://system@127.0.0.1:2550/"));
-
- clusterWrapper.setSelfAddress("akka.tcp://system@127.0.0.1:2551/");
- assertEquals(false, actorContext.isLocalPath("akka.tcp://system@127.0.0.1:2550/"));
+ actorContext = new ActorContext(getSystem(), null, clusterWrapper, mock(Configuration.class));
+ assertEquals(false, actorContext.isPathLocal(""));
+
+ // even if the path is in local format, match the primary path (first 3 elements) and return true
+ clusterWrapper.setSelfAddress(new Address("akka", "test"));
+ actorContext = new ActorContext(getSystem(), null, clusterWrapper, mock(Configuration.class));
+ assertEquals(true, actorContext.isPathLocal("akka://test/user/$a"));
+
+ clusterWrapper.setSelfAddress(new Address("akka", "test"));
+ actorContext = new ActorContext(getSystem(), null, clusterWrapper, mock(Configuration.class));
+ assertEquals(true, actorContext.isPathLocal("akka://test/user/$a"));
+
+ clusterWrapper.setSelfAddress(new Address("akka", "test"));
+ actorContext = new ActorContext(getSystem(), null, clusterWrapper, mock(Configuration.class));
+ assertEquals(true, actorContext.isPathLocal("akka://test/user/token2/token3/$a"));
+
+ // self address of remote format,but Tx path local format.
+ clusterWrapper.setSelfAddress(new Address("akka.tcp", "system", "127.0.0.1", 2550));
+ actorContext = new ActorContext(getSystem(), null, clusterWrapper, mock(Configuration.class));
+ assertEquals(true, actorContext.isPathLocal(
+ "akka://system/user/shardmanager/shard/transaction"));
+
+ // self address of local format,but Tx path remote format.
+ clusterWrapper.setSelfAddress(new Address("akka.tcp", "system"));
+ actorContext = new ActorContext(getSystem(), null, clusterWrapper, mock(Configuration.class));
+ assertEquals(false, actorContext.isPathLocal(
+ "akka://system@127.0.0.1:2550/user/shardmanager/shard/transaction"));
+
+ //local path but not same
+ clusterWrapper.setSelfAddress(new Address("akka", "test"));
+ actorContext = new ActorContext(getSystem(), null, clusterWrapper, mock(Configuration.class));
+ assertEquals(true, actorContext.isPathLocal("akka://test1/user/$a"));
+
+ //ip and port same
+ clusterWrapper.setSelfAddress(new Address("akka.tcp", "system", "127.0.0.1", 2550));
+ actorContext = new ActorContext(getSystem(), null, clusterWrapper, mock(Configuration.class));
+ assertEquals(true, actorContext.isPathLocal("akka.tcp://system@127.0.0.1:2550/"));
+
+ // forward-slash missing in address
+ clusterWrapper.setSelfAddress(new Address("akka.tcp", "system", "127.0.0.1", 2550));
+ actorContext = new ActorContext(getSystem(), null, clusterWrapper, mock(Configuration.class));
+ assertEquals(false, actorContext.isPathLocal("akka.tcp://system@127.0.0.1:2550"));
+
+ //ips differ
+ clusterWrapper.setSelfAddress(new Address("akka.tcp", "system", "127.0.0.1", 2550));
+ actorContext = new ActorContext(getSystem(), null, clusterWrapper, mock(Configuration.class));
+ assertEquals(false, actorContext.isPathLocal("akka.tcp://system@127.1.0.1:2550/"));
+
+ //ports differ
+ clusterWrapper.setSelfAddress(new Address("akka.tcp", "system", "127.0.0.1", 2550));
+ actorContext = new ActorContext(getSystem(), null, clusterWrapper, mock(Configuration.class));
+ assertEquals(false, actorContext.isPathLocal("akka.tcp://system@127.0.0.1:2551/"));
}
@Test
package org.opendaylight.controller.cluster.datastore.utils;
import akka.actor.ActorRef;
+import akka.actor.Address;
import akka.actor.AddressFromURIString;
import akka.cluster.ClusterEvent;
import akka.cluster.MemberStatus;
public class MockClusterWrapper implements ClusterWrapper{
- private String selfAddress = "akka.tcp://test@127.0.0.1:2550/user/member-1-shard-test-config";
+ private Address selfAddress = new Address("akka.tcp", "test", "127.0.0.1", 2550);
@Override
public void subscribeToMemberEvents(ActorRef actorRef) {
}
@Override
- public String getSelfAddress() {
+ public Address getSelfAddress() {
return selfAddress;
}
- public void setSelfAddress(String selfAddress) {
+ public void setSelfAddress(Address selfAddress) {
this.selfAddress = selfAddress;
}
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>sal-inmemory-datastore</artifactId>
- <version>1.2.0-SNAPSHOT</version>
-
</dependency>
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
- <version>${slf4j.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
*/
package org.opendaylight.controller.md.sal.dom.broker.impl;
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Iterables;
+import com.google.common.util.concurrent.AbstractFuture;
+import com.google.common.util.concurrent.AbstractListeningExecutorService;
+import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.FutureCallback;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
import java.util.List;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import org.opendaylight.yangtools.util.concurrent.MappingCheckedFuture;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Iterables;
-import com.google.common.util.concurrent.AbstractFuture;
-import com.google.common.util.concurrent.AbstractListeningExecutorService;
-import com.google.common.util.concurrent.CheckedFuture;
-import com.google.common.util.concurrent.FutureCallback;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
/**
* Implementation of DOMDataCommitExecutor that coordinates transaction commits concurrently. The 3
public void onSuccess(Boolean result) {
if (result == null || !result) {
handleException(clientSubmitFuture, transaction, cohorts, cohortSize,
- CAN_COMMIT, new TransactionCommitFailedException(
+ CAN_COMMIT, TransactionCommitFailedExceptionMapper.CAN_COMMIT_ERROR_MAPPER,
+ new TransactionCommitFailedException(
"Can Commit failed, no detailed cause available."));
} else {
if(remaining.decrementAndGet() == 0) {
@Override
public void onFailure(Throwable t) {
- handleException(clientSubmitFuture, transaction, cohorts, cohortSize, CAN_COMMIT, t);
+ handleException(clientSubmitFuture, transaction, cohorts, cohortSize, CAN_COMMIT,
+ TransactionCommitFailedExceptionMapper.CAN_COMMIT_ERROR_MAPPER, t);
}
};
@Override
public void onFailure(Throwable t) {
- handleException(clientSubmitFuture, transaction, cohorts, cohortSize, CAN_COMMIT, t);
+ handleException(clientSubmitFuture, transaction, cohorts, cohortSize, PRE_COMMIT,
+ TransactionCommitFailedExceptionMapper.PRE_COMMIT_MAPPER, t);
}
};
@Override
public void onFailure(Throwable t) {
- handleException(clientSubmitFuture, transaction, cohorts, cohortSize, CAN_COMMIT, t);
+ handleException(clientSubmitFuture, transaction, cohorts, cohortSize, COMMIT,
+ TransactionCommitFailedExceptionMapper.COMMIT_ERROR_MAPPER, t);
}
};
private void handleException(final AsyncNotifyingSettableFuture clientSubmitFuture,
final DOMDataWriteTransaction transaction,
final Iterable<DOMStoreThreePhaseCommitCohort> cohorts, int cohortSize,
- final String phase, final Throwable t) {
+ final String phase, final TransactionCommitFailedExceptionMapper exMapper,
+ final Throwable t) {
if(clientSubmitFuture.isDone()) {
// We must have had failures from multiple cohorts.
e = new RuntimeException("Unexpected error occurred", t);
}
- final TransactionCommitFailedException clientException =
- TransactionCommitFailedExceptionMapper.CAN_COMMIT_ERROR_MAPPER.apply(e);
+ final TransactionCommitFailedException clientException = exMapper.apply(e);
// Transaction failed - tell all cohorts to abort.
final class TransactionCommitFailedExceptionMapper
extends ExceptionMapper<TransactionCommitFailedException> {
- static final TransactionCommitFailedExceptionMapper PRE_COMMIT_MAPPER = create("canCommit");
+ static final TransactionCommitFailedExceptionMapper PRE_COMMIT_MAPPER = create("preCommit");
- static final TransactionCommitFailedExceptionMapper CAN_COMMIT_ERROR_MAPPER = create("preCommit");
+ static final TransactionCommitFailedExceptionMapper CAN_COMMIT_ERROR_MAPPER = create("canCommit");
static final TransactionCommitFailedExceptionMapper COMMIT_ERROR_MAPPER = create("commit");
private DataNormalizer mockNormalizer() throws DataNormalizationException {
final DataNormalizer mock = mock(DataNormalizer.class);
- doReturn(new AbstractMap.SimpleEntry<YangInstanceIdentifier, NormalizedNode<?, ?>>(id, normalizedNode) {})
+ doReturn(new AbstractMap.SimpleEntry<YangInstanceIdentifier, NormalizedNode<?, ?>>(id, normalizedNode))
.when(mock).toNormalized(any(YangInstanceIdentifier.class), any(CompositeNode.class));
doReturn(compositeNode).when(mock).toLegacy(any(YangInstanceIdentifier.class), any(NormalizedNode.class));
doReturn(id).when(mock).toLegacy(any(YangInstanceIdentifier.class));
JDBCResultSet rs = new JDBCResultSet(sql);
try {
int count = 0;
- jdbcServer.execute(rs, this);
+ JDBCServer.execute(rs, this);
boolean isFirst = true;
int loc = rs.getFields().size() - 1;
int totalWidth = 0;
return cacheLoadedSuccessfuly;
}
- private static Map<Class, Set<Class>> superClassMap = new HashMap<Class, Set<Class>>();
+ private static Map<Class<?>, Set<Class<?>>> superClassMap = new HashMap<>();
- public static Set<Class> getInheritance(Class myObjectClass,
- Class returnType) {
+ public static Set<Class<?>> getInheritance(Class<?> myObjectClass,
+ Class<?> returnType) {
if (returnType != null && myObjectClass.equals(returnType)) {
- return new HashSet<Class>();
+ return new HashSet<>();
}
- Set<Class> result = superClassMap.get(myObjectClass);
+ Set<Class<?>> result = superClassMap.get(myObjectClass);
if (result != null) {
return result;
}
- result = new HashSet<Class>();
+ result = new HashSet<>();
superClassMap.put(myObjectClass, result);
if (returnType != null) {
if (!returnType.equals(myObjectClass)) {
- Class mySuperClass = myObjectClass.getSuperclass();
+ Class<?> mySuperClass = myObjectClass.getSuperclass();
while (mySuperClass != null) {
result.add(mySuperClass);
mySuperClass = mySuperClass.getSuperclass();
return result;
}
- public static Set<Class> collectInterfaces(Class cls) {
- Set<Class> result = new HashSet();
- Class myInterfaces[] = cls.getInterfaces();
+ public static Set<Class<?>> collectInterfaces(Class<?> cls) {
+ Set<Class<?>> result = new HashSet<>();
+ Class<?> myInterfaces[] = cls.getInterfaces();
if (myInterfaces != null) {
- for (Class in : myInterfaces) {
+ for (Class<?> in : myInterfaces) {
result.add(in);
result.addAll(collectInterfaces(in));
}
map.put(blNode.getBluePrintNodeName(), blNode);
}
- public Class getGenericType(ParameterizedType type) {
+ public Class<?> getGenericType(ParameterizedType type) {
Type[] typeArguments = type.getActualTypeArguments();
for (Type typeArgument : typeArguments) {
if (typeArgument instanceof ParameterizedType) {
ParameterizedType pType = (ParameterizedType) typeArgument;
- return (Class) pType.getRawType();
+ return (Class<?>) pType.getRawType();
} else if (typeArgument instanceof Class) {
- return (Class) typeArgument;
+ return (Class<?>) typeArgument;
}
}
return null;
}
- public Class getMethodReturnTypeFromGeneric(Method m) {
+ public Class<?> getMethodReturnTypeFromGeneric(Method m) {
Type rType = m.getGenericReturnType();
if (rType instanceof ParameterizedType) {
return getGenericType((ParameterizedType) rType);
this.children.add(ch);
}
- public boolean isModelChild(Class p) {
+ public boolean isModelChild(Class<?> p) {
if (this.relations.size() == 0) {
return false;
}
return "Unknown";
}
- public Class getInterface() {
+ public Class<?> getInterface() {
return this.myInterface;
}
}
}
- public List execute(Object o) {
- List result = new LinkedList();
+ public List<?> execute(Object o) {
+ List<Object> result = new LinkedList<>();
if (o == null) {
return null;
}
if (Set.class.isAssignableFrom(o.getClass())) {
- Set lst = (Set) o;
+ Set<?> lst = (Set<?>) o;
for (Object oo : lst) {
addToResult(result, execute(oo));
}
return result;
} else if (List.class.isAssignableFrom(o.getClass())) {
- List lst = (List) o;
+ List<?> lst = (List<?>) o;
for (Object oo : lst) {
addToResult(result, execute(oo));
}
return result;
}
- public static void addToResult(List result, Object o) {
+ private static void addToResult(List<Object> result, Object o) {
if (o == null) {
return;
}
if (Set.class.isAssignableFrom(o.getClass())) {
- Set lst = (Set) o;
+ Set<?> lst = (Set<?>) o;
for (Object oo : lst) {
result.add(oo);
}
} else if (List.class.isAssignableFrom(o.getClass())) {
- List lst = (List) o;
+ List<?> lst = (List<?>) o;
for (Object oo : lst) {
result.add(oo);
}
import java.io.Serializable;
-public class XSQLColumn implements Serializable, Comparable {
+public class XSQLColumn implements Serializable, Comparable<Object> {
+ private static final long serialVersionUID = 4854919735031714751L;
+
private String name = null;
private String tableName = null;
private int charWidth = -1;
- private Class type = null;
+ private Class<?> type = null;
private transient Object bluePrintNode = null;
private String origName = null;
private String origTableName = null;
types.put(Status.class, Status.class);
}
- public static boolean isColumnType(Class cls) {
+ public static boolean isColumnType(Class<?> cls) {
return types.containsKey(cls);
}
return "NULL";
}
- public static Class getTypeForODLColumn(Object odlNode){
+ public static Class<?> getTypeForODLColumn(Object odlNode){
Object type = get(odlNode,"type");
if(type instanceof Uint32 || type instanceof Uint64){
return long.class;
import org.opendaylight.controller.md.sal.dom.xsql.XSQLBluePrint;
public class JDBCCommand implements Serializable {
+ private static final long serialVersionUID = 1L;
+
public int type = 0;
public static final int TYPE_EXECUTE_QUERY = 1;
public static final int TYPE_QUERY_REPLY = 2;
return 1;
}
- public int isObjectFitCriteria(Object element, Class cls) {
+ public int isObjectFitCriteria(Object element, Class<?> cls) {
Map<XSQLColumn, List<XSQLCriteria>> tblCriteria = criteria.get(cls
.getName());
if (tblCriteria == null) {
}
}
- public void addRecord(ArrayList hierarchy) {
+ public void addRecord(ArrayList<?> hierarchy) {
Map rec = new HashMap();
for (int i = hierarchy.size() - 1; i >= 0; i--) {
Object element = hierarchy.get(i);
return true;
}
- public void addRecord(ArrayList hierarchy) {
+ public void addRecord(ArrayList<?> hierarchy) {
rs.addRecord(hierarchy);
}
logger.error("{}: Initialization in sal failed, disconnecting from device", id, t);
listener.close();
onRemoteSessionDown();
+ resetMessageTransformer();
+ }
+
+ /**
+ * Set the schema context inside transformer to null as is in initial state
+ */
+ private void resetMessageTransformer() {
+ updateMessageTransformer(null);
}
/**
for (final SchemaSourceRegistration<? extends SchemaSourceRepresentation> sourceRegistration : sourceRegistrations) {
sourceRegistration.close();
}
+ resetMessageTransformer();
}
@Override
package org.opendaylight.controller.sal.connect.netconf.schema.mapping;
import com.google.common.base.Optional;
-
import java.util.List;
import java.util.Set;
-
import javax.activation.UnsupportedDataTypeException;
-
import org.opendaylight.controller.netconf.api.NetconfMessage;
import org.opendaylight.controller.sal.connect.api.MessageTransformer;
import org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil;
import org.opendaylight.yangtools.yang.data.impl.util.CompositeNodeBuilder;
import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
import org.opendaylight.yangtools.yang.model.api.NotificationDefinition;
+import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
final DataNodeContainer schemaForGetConfig = NetconfMessageTransformUtil.createSchemaForGetConfig(schemaContext.get());
w3cPayload = XmlDocumentUtils.toDocument(rpcPayload, schemaForGetConfig, codecProvider);
} else {
- final DataNodeContainer schemaForGetConfig = NetconfMessageTransformUtil.createSchemaForRpc(rpc, schemaContext.get());
- w3cPayload = XmlDocumentUtils.toDocument(rpcPayload, schemaForGetConfig, codecProvider);
+ final Optional<RpcDefinition> schemaForRpc = NetconfMessageTransformUtil.findSchemaForRpc(rpc, schemaContext.get());
+ if(schemaForRpc.isPresent()) {
+ final DataNodeContainer schemaForGetConfig = NetconfMessageTransformUtil.createSchemaForRpc(schemaForRpc.get());
+ w3cPayload = XmlDocumentUtils.toDocument(rpcPayload, schemaForGetConfig, codecProvider);
+ } else {
+ w3cPayload = toRpcRequestWithoutSchema(rpcPayload, codecProvider);
+ }
}
} else {
- w3cPayload = XmlDocumentUtils.toDocument(rpcPayload, codecProvider);
+ w3cPayload = toRpcRequestWithoutSchema(rpcPayload, codecProvider);
}
} catch (final UnsupportedDataTypeException e) {
throw new IllegalArgumentException("Unable to create message", e);
return new NetconfMessage(w3cPayload);
}
+ private Document toRpcRequestWithoutSchema(final CompositeNodeTOImpl rpcPayload, final XmlCodecProvider codecProvider) {
+ return XmlDocumentUtils.toDocument(rpcPayload, codecProvider);
+ }
+
@Override
public synchronized RpcResult<CompositeNode> toRpcResult(final NetconfMessage message, final QName rpc) {
if(schemaContext.isPresent()) {
@Override
public synchronized void onGlobalContextUpdated(final SchemaContext schemaContext) {
- this.schemaContext = Optional.of(schemaContext);
+ this.schemaContext = Optional.fromNullable(schemaContext);
}
}
*/
package org.opendaylight.controller.sal.connect.netconf.util;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Predicate;
-import com.google.common.collect.Collections2;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Sets;
-
import java.net.URI;
import java.util.ArrayList;
import java.util.Collections;
import org.opendaylight.yangtools.yang.common.RpcError.ErrorSeverity;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.Node;
import org.opendaylight.yangtools.yang.data.api.SimpleNode;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.impl.CompositeNodeTOImpl;
import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode;
import org.opendaylight.yangtools.yang.data.impl.NodeFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
+import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Collections2;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Sets;
+
public class NetconfMessageTransformUtil {
public static final String MESSAGE_ID_ATTR = "message-id";
static Node<?> toNode(final YangInstanceIdentifier.NodeIdentifierWithPredicates argument, final Node<?> node) {
final List<Node<?>> list = new ArrayList<>();
for (final Map.Entry<QName, Object> arg : argument.getKeyValues().entrySet()) {
- list.add(new SimpleNodeTOImpl(arg.getKey(), null, arg.getValue()));
+ list.add(new SimpleNodeTOImpl<>(arg.getKey(), null, arg.getValue()));
}
if (node != null) {
list.add(node);
return new NodeContainerProxy(NETCONF_RPC_QNAME, Sets.<DataSchemaNode>newHashSet(editConfigProxy));
}
+
+ public static Optional<RpcDefinition> findSchemaForRpc(final QName rpcName, final SchemaContext schemaContext) {
+ Preconditions.checkNotNull(rpcName);
+ Preconditions.checkNotNull(schemaContext);
+
+ for (final RpcDefinition rpcDefinition : schemaContext.getOperations()) {
+ if(rpcDefinition.getQName().equals(rpcName)) {
+ return Optional.of(rpcDefinition);
+ }
+ }
+
+ return Optional.absent();
+ }
+
/**
* Creates artificial schema node for schema defined rpc. This artificial schema looks like:
* <pre>
* This makes the translation of schema defined rpc request
* to xml use schema which is crucial for some types of nodes e.g. identity-ref.
*/
- public static DataNodeContainer createSchemaForRpc(final QName rpcName, final SchemaContext schemaContext) {
- Preconditions.checkNotNull(rpcName);
- Preconditions.checkNotNull(schemaContext);
-
- for (final RpcDefinition rpcDefinition : schemaContext.getOperations()) {
- if(rpcDefinition.getQName().equals(rpcName)) {
- final NodeContainerProxy rpcBodyProxy = new NodeContainerProxy(rpcName, rpcDefinition.getInput().getChildNodes());
- return new NodeContainerProxy(NETCONF_RPC_QNAME, Sets.<DataSchemaNode>newHashSet(rpcBodyProxy));
- }
- }
-
- throw new IllegalArgumentException("Rpc " + rpcName + " not found in schema context " + schemaContext + ". Unable to invoke Rpc");
+ public static DataNodeContainer createSchemaForRpc(final RpcDefinition rpcDefinition) {
+ final NodeContainerProxy rpcBodyProxy = new NodeContainerProxy(rpcDefinition.getQName(), rpcDefinition.getInput().getChildNodes());
+ return new NodeContainerProxy(NETCONF_RPC_QNAME, Sets.<DataSchemaNode>newHashSet(rpcBodyProxy));
}
public static CompositeNodeTOImpl wrap(final QName name, final Node<?> node) {
device.onRemoteSessionUp(sessionCaps, listener);
verify(schemaContextProviderFactory, timeout(5000).times(2)).createSchemaContext(any(Collection.class));
- verify(messageTransformer, timeout(5000).times(2)).onGlobalContextUpdated(any(SchemaContext.class));
+ verify(messageTransformer, timeout(5000).times(3)).onGlobalContextUpdated(any(SchemaContext.class));
verify(facade, timeout(5000).times(2)).onDeviceConnected(any(SchemaContext.class), any(NetconfSessionCapabilities.class), any(RpcImplementation.class));
}
import java.util.Collections;
import java.util.List;
import java.util.Set;
-
import org.junit.BeforeClass;
import org.junit.Test;
import org.opendaylight.controller.netconf.api.NetconfMessage;
+import org.opendaylight.controller.netconf.util.xml.XmlUtil;
import org.opendaylight.controller.sal.connect.netconf.schema.mapping.NetconfMessageTransformer;
import org.opendaylight.controller.sal.connect.netconf.util.NetconfMessageTransformUtil;
import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.data.api.Node;
import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode;
import org.opendaylight.yangtools.yang.data.impl.util.CompositeNodeBuilder;
import org.opendaylight.yangtools.yang.model.api.Module;
final org.w3c.dom.Node streamName = subscribeName.getFirstChild();
assertEquals(streamName.getLocalName(), "stream-name");
+
+ }
+
+ @Test
+ public void testRpcResponse() throws Exception {
+ final NetconfMessage response = new NetconfMessage(XmlUtil.readXmlToDocument(
+ "<rpc-reply xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\" message-id=\"m-5\">\n" +
+ "<data xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring\">" +
+ "module schema" +
+ "</data>\n" +
+ "</rpc-reply>\n"
+ ));
+ final RpcResult<CompositeNode> compositeNodeRpcResult = messageTransformer.toRpcResult(response, SUBSCRIBE_RPC_NAME);
+ final Node<?> dataNode = compositeNodeRpcResult.getResult().getValue().get(0);
+ assertEquals("module schema", dataNode.getValue());
}
}
--- /dev/null
+/*
+ * 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.
+ */
+
+package org.opendaylight.controller.sal.connect.netconf.schema.mapping;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+
+import java.io.InputStream;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+import org.hamcrest.CoreMatchers;
+import org.junit.Test;
+import org.opendaylight.controller.netconf.api.NetconfMessage;
+import org.opendaylight.controller.netconf.util.xml.XmlUtil;
+import org.opendaylight.controller.sal.connect.netconf.NetconfToRpcRequestTest;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.data.api.Node;
+import org.opendaylight.yangtools.yang.data.impl.NodeFactory;
+import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
+
+public class NetconfMessageTransformerTest {
+
+ private static final QName COMMIT_Q_NAME = QName.create("namespace", "2012-12-12", "commit");
+
+ @Test
+ public void testToRpcRequestNoSchemaForRequest() throws Exception {
+ final NetconfMessageTransformer netconfMessageTransformer = getTransformer();
+ final NetconfMessage netconfMessage = netconfMessageTransformer.toRpcRequest(COMMIT_Q_NAME,
+ NodeFactory.createImmutableCompositeNode(COMMIT_Q_NAME, null, Collections.<Node<?>>emptyList()));
+ assertThat(XmlUtil.toString(netconfMessage.getDocument()), CoreMatchers.containsString("<commit"));
+ }
+
+ private NetconfMessageTransformer getTransformer() {
+ final NetconfMessageTransformer netconfMessageTransformer = new NetconfMessageTransformer();
+ netconfMessageTransformer.onGlobalContextUpdated(getSchema());
+ return netconfMessageTransformer;
+ }
+
+ @Test
+ public void testToRpcResultNoSchemaForResult() throws Exception {
+ final NetconfMessageTransformer netconfMessageTransformer = getTransformer();
+ final NetconfMessage response = new NetconfMessage(XmlUtil.readXmlToDocument(
+ "<rpc-reply><ok/></rpc-reply>"
+ ));
+ final RpcResult<CompositeNode> compositeNodeRpcResult = netconfMessageTransformer.toRpcResult(response, COMMIT_Q_NAME);
+ assertTrue(compositeNodeRpcResult.isSuccessful());
+ assertEquals("ok", compositeNodeRpcResult.getResult().getValue().get(0).getKey().getLocalName());
+ }
+
+ public SchemaContext getSchema() {
+ final List<InputStream> modelsToParse = Collections
+ .singletonList(NetconfToRpcRequestTest.class.getResourceAsStream("/schemas/rpc-notification-subscription.yang"));
+ final YangParserImpl parser = new YangParserImpl();
+ final Set<Module> configModules = parser.parseYangModelsFromStreams(modelsToParse);
+ final SchemaContext cfgCtx = parser.resolveSchemaContext(configModules);
+ assertNotNull(cfgCtx);
+ return cfgCtx;
+ }
+}
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
- <version>${slf4j.version}</version>
<scope>test</scope>
</dependency>
<dependency>
final Broker.ProviderSession brokerSession,
final RpcProvisionRegistry rpcProvisionRegistry) {
return Props.create(new Creator<RpcManager>() {
+ private static final long serialVersionUID = 1L;
@Override
public RpcManager create() throws Exception {
return new RpcManager(schemaContext, brokerSession, rpcProvisionRegistry);
import java.io.Serializable;
public class ExecuteRpc implements Serializable {
+ private static final long serialVersionUID = 1L;
private final String inputCompositeNode;
private final QName rpc;
import java.io.Serializable;
public class InvokeRpc implements Serializable {
+ private static final long serialVersionUID = 1L;
private final QName rpc;
private final YangInstanceIdentifier identifier;
*/
package org.opendaylight.controller.remote.rpc.messages;
-
-
import java.io.Serializable;
public class RpcResponse implements Serializable {
+ private static final long serialVersionUID = 1L;
private final String resultCompositeNode;
public RpcResponse(final String resultCompositeNode) {
import java.util.Map;
public class RoutingTable implements Copier<RoutingTable>, Serializable {
+ private static final long serialVersionUID = 1L;
private Map<RpcRouter.RouteIdentifier<?, ?, ?>, Long> table = new HashMap<>();
private ActorRef router;
import java.io.Serializable;
public class BucketImpl<T extends Copier<T>> implements Bucket<T>, Serializable {
+ private static final long serialVersionUID = 1L;
private Long version = System.currentTimeMillis();
public static class BucketStoreMessages{
- public static class GetLocalBucket implements Serializable{}
+ public static class GetLocalBucket implements Serializable {
+ private static final long serialVersionUID = 1L;
+ }
public static class ContainsBucket implements Serializable {
+ private static final long serialVersionUID = 1L;
final private Bucket bucket;
public ContainsBucket(Bucket bucket){
}
public static class UpdateBucket extends ContainsBucket implements Serializable {
+ private static final long serialVersionUID = 1L;
public UpdateBucket(Bucket bucket){
super(bucket);
}
}
public static class GetLocalBucketReply extends ContainsBucket implements Serializable {
+ private static final long serialVersionUID = 1L;
public GetLocalBucketReply(Bucket bucket){
super(bucket);
}
}
- public static class GetAllBuckets implements Serializable{}
+ public static class GetAllBuckets implements Serializable {
+ private static final long serialVersionUID = 1L;
+ }
public static class GetBucketsByMembers implements Serializable{
+ private static final long serialVersionUID = 1L;
private Set<Address> members;
public GetBucketsByMembers(Set<Address> members){
}
public static class ContainsBuckets implements Serializable{
+ private static final long serialVersionUID = 1L;
private Map<Address, Bucket> buckets;
public ContainsBuckets(Map<Address, Bucket> buckets){
}
public static class GetAllBucketsReply extends ContainsBuckets implements Serializable{
+ private static final long serialVersionUID = 1L;
public GetAllBucketsReply(Map<Address, Bucket> buckets) {
super(buckets);
}
}
public static class GetBucketsByMembersReply extends ContainsBuckets implements Serializable{
+ private static final long serialVersionUID = 1L;
public GetBucketsByMembersReply(Map<Address, Bucket> buckets) {
super(buckets);
}
}
- public static class GetBucketVersions implements Serializable{}
+ public static class GetBucketVersions implements Serializable {
+ private static final long serialVersionUID = 1L;
+ }
public static class ContainsBucketVersions implements Serializable{
+ private static final long serialVersionUID = 1L;
Map<Address, Long> versions;
public ContainsBucketVersions(Map<Address, Long> versions) {
}
public static class GetBucketVersionsReply extends ContainsBucketVersions implements Serializable{
+ private static final long serialVersionUID = 1L;
public GetBucketVersionsReply(Map<Address, Long> versions) {
super(versions);
}
}
public static class UpdateRemoteBuckets extends ContainsBuckets implements Serializable{
+ private static final long serialVersionUID = 1L;
public UpdateRemoteBuckets(Map<Address, Bucket> buckets) {
super(buckets);
}
}
public static class GossiperMessages{
- public static class Tick implements Serializable {}
+ public static class Tick implements Serializable {
+ private static final long serialVersionUID = 1L;
+ }
- public static final class GossipTick extends Tick {}
+ public static final class GossipTick extends Tick {
+ private static final long serialVersionUID = 1L;
+ }
public static final class GossipStatus extends ContainsBucketVersions implements Serializable{
+ private static final long serialVersionUID = 1L;
private Address from;
public GossipStatus(Address from, Map<Address, Long> versions) {
}
public static final class GossipEnvelope extends ContainsBuckets implements Serializable {
+ private static final long serialVersionUID = 1L;
private final Address from;
private final Address to;
public class ConditionalProbe {
private final ActorRef actorRef;
- private final Predicate predicate;
+ private final Predicate<Object> predicate;
Logger log = LoggerFactory.getLogger(ConditionalProbe.class);
- public ConditionalProbe(ActorRef actorRef, Predicate predicate) {
+ public ConditionalProbe(ActorRef actorRef, Predicate<Object> predicate) {
this.actorRef = actorRef;
this.predicate = predicate;
}
Messages.BucketStoreMessages.UpdateRemoteBuckets.class);
}
- private JavaTestKit createProbeForMessage(ActorSystem node, ActorPath subjectPath, final Class clazz) {
+ private JavaTestKit createProbeForMessage(ActorSystem node, ActorPath subjectPath, final Class<?> clazz) {
final JavaTestKit probe = new JavaTestKit(node);
ConditionalProbe conditionalProbe =
- new ConditionalProbe(probe.getRef(), new Predicate() {
+ new ConditionalProbe(probe.getRef(), new Predicate<Object>() {
@Override
public boolean apply(@Nullable Object input) {
if (input != null)
@Test
public void testReceiveGossipTick_WhenNoRemoteMemberShouldIgnore(){
- mockGossiper.setClusterMembers(Collections.EMPTY_LIST);
+ mockGossiper.setClusterMembers(Collections.<Address>emptyList());
doNothing().when(mockGossiper).getLocalStatusAndSendTo(any(Address.class));
mockGossiper.receiveGossipTick();
verify(mockGossiper, times(0)).getLocalStatusAndSendTo(any(Address.class));
<artifactId>sal-rest-docgen</artifactId>
<packaging>bundle</packaging>
- <properties>
- <jaxrs-api.version>3.0.4.Final</jaxrs-api.version>
- </properties>
-
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>jaxrs-api</artifactId>
- <version>${jaxrs-api.version}</version>
</dependency>
<dependency>
@Override
public void start(BundleContext context) throws Exception {
bundleContext = context;
- brokerServiceTracker = new ServiceTracker(context, Broker.class, this);
+ brokerServiceTracker = new ServiceTracker<>(context, Broker.class, this);
brokerServiceTracker.open();
}
notifications.add(new QName(notificationType.toString()));
String notificationStreamName = RemoteStreamTools.createNotificationStream(salRemoteService, notifications);
final Map<String,EventStreamInfo> desiredEventStream = RemoteStreamTools.createEventStream(restconfClientContext, notificationStreamName);
- RemoteNotificationListener remoteNotificationListener = new RemoteNotificationListener(listener);
+ RemoteNotificationListener<T> remoteNotificationListener = new RemoteNotificationListener<T>(listener);
final ListenerRegistration<?> listenerRegistration = restconfClientContext.getEventStreamContext(desiredEventStream.get(desiredEventStream.get(notificationStreamName)))
.registerNotificationListener(remoteNotificationListener);
package org.opendaylight.controller.sal.restconf.broker.listeners;
import org.opendaylight.controller.sal.binding.api.NotificationListener;
+import org.opendaylight.yangtools.yang.binding.Notification;
-public class RemoteNotificationListener implements org.opendaylight.yangtools.yang.binding.NotificationListener {
+public class RemoteNotificationListener<T extends Notification> implements org.opendaylight.yangtools.yang.binding.NotificationListener {
- org.opendaylight.controller.sal.binding.api.NotificationListener listener;
+ NotificationListener<T> listener;
- public RemoteNotificationListener(NotificationListener listener){
+ public RemoteNotificationListener(NotificationListener<T> listener){
this.listener = listener;
}
- public NotificationListener getListener(){
+ public NotificationListener<T> getListener() {
return this.listener;
}
import org.opendaylight.yangtools.yang.binding.Notification;
-public class SalNotificationListener implements NotificationListener {
- private NotificationListener notificationListener;
+public class SalNotificationListener<T extends Notification> implements NotificationListener<T> {
+ private NotificationListener<T> notificationListener;
- public SalNotificationListener( NotificationListener notificationListener){
+ public SalNotificationListener( NotificationListener<T> notificationListener){
this.notificationListener = notificationListener;
}
@Override
public void onNotification(Notification notification) {
- this.notificationListener.onNotification(notification);
+ this.notificationListener.onNotification((T)notification);
}
}
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
- <version>${slf4j.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
protected Object preprocess(Object value) {
Util.checkType(value, Map.class);
- Preconditions.checkArgument(((Map)value).size() == 1, "Unexpected number of values in %s, expected 1", value);
- return ((Map)value).values().iterator().next();
+ Preconditions.checkArgument(((Map<?, ?>)value).size() == 1, "Unexpected number of values in %s, expected 1", value);
+ return ((Map<?, ?>)value).values().iterator().next();
}
}
protected Object preprocess(Object value) {
Util.checkType(value, Map.class);
- Preconditions.checkArgument(((Map)value).size() == 1, "Unexpected number of values in %s, expected 1", value);
- Object stringValue = ((Map) value).values().iterator().next();
+ Preconditions.checkArgument(((Map<?, ?>)value).size() == 1, "Unexpected number of values in %s, expected 1", value);
+ Object stringValue = ((Map<?, ?>) value).values().iterator().next();
Util.checkType(stringValue, String.class);
return stringValue;
protected Object preprocess(Object value) {
Util.checkType(value, Map.class);
- Preconditions.checkArgument(((Map)value).size() == 1, "Unexpected number of values in %s, expected 1", value);
- Object listOfStrings = ((Map) value).values().iterator().next();
+ Preconditions.checkArgument(((Map<?, ?>)value).size() == 1, "Unexpected number of values in %s, expected 1", value);
+ Object listOfStrings = ((Map<?, ?>) value).values().iterator().next();
Util.checkType(listOfStrings, List.class);
StringBuilder b = new StringBuilder();
- for (Object character: (List)listOfStrings) {
+ for (Object character: (List<?>)listOfStrings) {
Util.checkType(character, String.class);
b.append(character);
}
package org.opendaylight.controller.netconf.confignetconfconnector.operations.runtimerpc;
import static org.junit.Assert.assertEquals;
-
+import com.google.common.collect.ImmutableMap;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
-
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
return Arrays.asList(new Object[][] {
// With namespaces
{ "/a:modules/a:module[a:name='instanceName'][a:type='moduleType']/b:listener-state[b:peer-id='127.0.0.1']",
- new HashMap<String, String>() {{
- put("listener-state", "127.0.0.1");
- }}},
+ new HashMap<>(ImmutableMap.of("listener-state", "127.0.0.1"))},
{ "/a:modules/a:module[a:name='instanceName'][a:type='moduleType']",
null},
{ "/modules/module[name=instanceName and type=moduleType]/inner[key=\"b\"]", Collections.singletonMap("inner", "b")},
{ "/modules/module[name=instanceName and type=\"moduleType\"]/inner[key2=a]/inner2[key=b]",
- new HashMap<String, String>() {{
- put("inner", "a");
- put("inner2", "b");
- }}
+ new HashMap<>(ImmutableMap.of("inner", "a", "inner2", "b"))
},
});
}
import org.opendaylight.controller.netconf.util.messages.NetconfHelloMessageAdditionalHeader;
import org.opendaylight.protocol.framework.SessionListenerFactory;
import org.opendaylight.protocol.framework.SessionNegotiator;
-
import static org.junit.Assert.assertNotNull;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
public void testGetSessionNegotiator() throws Exception {
NetconfClientSessionListener sessionListener = mock(NetconfClientSessionListener.class);
Timer timer = new HashedWheelTimer();
- SessionListenerFactory listenerFactory = mock(SessionListenerFactory.class);
+ SessionListenerFactory<NetconfClientSessionListener> listenerFactory = mock(SessionListenerFactory.class);
doReturn(sessionListener).when(listenerFactory).getSessionListener();
Channel channel = mock(Channel.class);
- Promise promise = mock(Promise.class);
+ Promise<NetconfClientSession> promise = mock(Promise.class);
NetconfClientSessionNegotiatorFactory negotiatorFactory = new NetconfClientSessionNegotiatorFactory(timer,
Optional.<NetconfHelloMessageAdditionalHeader>absent(), 200L);
- SessionNegotiator sessionNegotiator = negotiatorFactory.getSessionNegotiator(listenerFactory, channel, promise);
+ SessionNegotiator<?> sessionNegotiator = negotiatorFactory.getSessionNegotiator(listenerFactory, channel, promise);
assertNotNull(sessionNegotiator);
}
}
return pipeline;
}
- private NetconfClientSessionNegotiator createNetconfClientSessionNegotiator(final Promise promise,
+ private NetconfClientSessionNegotiator createNetconfClientSessionNegotiator(final Promise<NetconfClientSession> promise,
final NetconfMessage startExi) {
ChannelProgressivePromise progressivePromise = mock(ChannelProgressivePromise.class);
NetconfClientSessionPreferences preferences = new NetconfClientSessionPreferences(helloMessage, startExi);
NetconfClientSessionNegotiator negotiator = createNetconfClientSessionNegotiator(promise, null);
negotiator.channelActive(null);
- Set caps = Sets.newSet("a", "b");
+ Set<String> caps = Sets.newSet("a", "b");
NetconfHelloMessage helloServerMessage = NetconfHelloMessage.createServerHello(caps, 10);
negotiator.handleMessage(helloServerMessage);
verify(promise).setSuccess(anyObject());
NetconfClientSessionNegotiator negotiator = createNetconfClientSessionNegotiator(promise, exiMessage);
negotiator.channelActive(null);
- Set caps = Sets.newSet("exi:1.0");
+ Set<String> caps = Sets.newSet("exi:1.0");
NetconfHelloMessage helloMessage = NetconfHelloMessage.createServerHello(caps, 10);
doAnswer(new Answer<Object>() {
private Channel channel;
private ChannelFuture channelFuture;
- Set caps;
+ Set<String> caps;
private NetconfHelloMessage helloMessage;
private NetconfMessage message;
private NetconfClientSessionListener sessionListener;
NetconfClientSessionNegotiatorFactory negotiatorFactory = mock(NetconfClientSessionNegotiatorFactory.class);
NetconfClientSessionListener sessionListener = mock(NetconfClientSessionListener.class);
- SessionNegotiator sessionNegotiator = mock(SessionNegotiator.class);
+ SessionNegotiator<?> sessionNegotiator = mock(SessionNegotiator.class);
doReturn("").when(sessionNegotiator).toString();
doReturn(sessionNegotiator).when(negotiatorFactory).getSessionNegotiator(any(SessionListenerFactory.class), any(Channel.class), any(Promise.class));
ChannelPipeline pipeline = mock(ChannelPipeline.class);
@Test
public void testInitializeSessionNegotiator() throws Exception {
NetconfClientSessionNegotiatorFactory factory = mock(NetconfClientSessionNegotiatorFactory.class);
- SessionNegotiator sessionNegotiator = mock(SessionNegotiator.class);
+ SessionNegotiator<?> sessionNegotiator = mock(SessionNegotiator.class);
doReturn("").when(sessionNegotiator).toString();
doReturn(sessionNegotiator).when(factory).getSessionNegotiator(any(SessionListenerFactory.class), any(Channel.class), any(Promise.class));
NetconfClientSessionListener listener = mock(NetconfClientSessionListener.class);
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import io.netty.channel.Channel;
-import java.util.List;
import java.util.Set;
import org.junit.Before;
import org.junit.Test;
public void testSessions() throws Exception {
doReturn("sessToStr").when(managementSession).toString();
service.onSessionUp(managementSession);
- List list = Lists.newArrayList(managementSession);
}
@Test(expected = RuntimeException.class)
public void testGetSchemas3() throws Exception {
doReturn("").when(managementSession).toString();
Capability cap = mock(Capability.class);
- Set caps = Sets.newHashSet(cap);
- Set services = Sets.newHashSet(operationService);
+ Set<Capability> caps = Sets.newHashSet(cap);
+ Set<NetconfOperationService> services = Sets.newHashSet(operationService);
doReturn(snapshot).when(operationProvider).openSnapshot(anyString());
doReturn(services).when(snapshot).getServices();
doReturn(caps).when(operationService).getCapabilities();
- Optional opt = mock(Optional.class);
+ Optional<String> opt = mock(Optional.class);
doReturn(opt).when(cap).getCapabilitySchema();
doReturn(true).when(opt).isPresent();
doReturn(opt).when(cap).getModuleNamespace();
doReturn("namespace").when(opt).get();
- Optional optRev = Optional.of("rev");
+ Optional<String> optRev = Optional.of("rev");
doReturn(optRev).when(cap).getRevision();
doReturn(Optional.of("modName")).when(cap).getModuleName();
doReturn(Optional.of(Lists.newArrayList("loc"))).when(cap).getLocation();
import org.opendaylight.controller.netconf.nettyutil.handler.ssh.authentication.AuthenticationHandler;
import org.opendaylight.controller.netconf.nettyutil.handler.ssh.authentication.LoginPassword;
import org.opendaylight.controller.netconf.ssh.SshProxyServer;
+import org.opendaylight.controller.netconf.ssh.SshProxyServerConfigurationBuilder;
import org.opendaylight.controller.netconf.util.messages.NetconfMessageUtil;
import org.opendaylight.controller.netconf.util.osgi.NetconfConfigUtil;
import org.opendaylight.controller.netconf.util.xml.XmlUtil;
clientGroup = new NioEventLoopGroup();
minaTimerEx = Executors.newScheduledThreadPool(1);
sshProxyServer = new SshProxyServer(minaTimerEx, clientGroup, nioExec);
- sshProxyServer.bind(TLS_ADDRESS, NetconfConfigUtil.getNetconfLocalAddress(), new PasswordAuthenticator() {
+ sshProxyServer.bind(
+ new SshProxyServerConfigurationBuilder()
+ .setBindingAddress(TLS_ADDRESS)
+ .setLocalAddress(NetconfConfigUtil.getNetconfLocalAddress())
+ .setAuthenticator(new PasswordAuthenticator() {
@Override
public boolean authenticate(final String username, final String password, final ServerSession session) {
return true;
}
- }, new PEMGeneratorHostKeyProvider(Files.createTempFile("prefix", "suffix").toAbsolutePath().toString()));
+ })
+ .setKeyPairProvider(new PEMGeneratorHostKeyProvider(Files.createTempFile("prefix", "suffix").toAbsolutePath().toString()))
+ .setIdleTimeout(Integer.MAX_VALUE)
+ .createSshProxyServerConfiguration());
}
@After
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
- <version>2.4</version>
<executions>
<execution>
<goals>
import com.google.common.collect.Lists;
import io.netty.channel.EventLoopGroup;
-import io.netty.channel.local.LocalAddress;
import java.io.IOException;
-import java.net.InetSocketAddress;
import java.nio.channels.AsynchronousChannelGroup;
+import java.util.HashMap;
+import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import org.apache.sshd.SshServer;
import org.apache.sshd.common.FactoryManager;
-import org.apache.sshd.common.KeyPairProvider;
import org.apache.sshd.common.NamedFactory;
import org.apache.sshd.common.RuntimeSshException;
import org.apache.sshd.common.io.IoAcceptor;
import org.apache.sshd.common.io.nio2.Nio2ServiceFactoryFactory;
import org.apache.sshd.common.util.CloseableUtils;
import org.apache.sshd.server.Command;
-import org.apache.sshd.server.PasswordAuthenticator;
+import org.apache.sshd.server.ServerFactoryManager;
/**
* Proxy SSH server that just delegates decrypted content to a delegate server within same VM.
this.sshServer = SshServer.setUpDefaultServer();
}
- public void bind(final InetSocketAddress bindingAddress, final LocalAddress localAddress, final PasswordAuthenticator authenticator, final KeyPairProvider keyPairProvider) throws IOException {
- sshServer.setHost(bindingAddress.getHostString());
- sshServer.setPort(bindingAddress.getPort());
+ public void bind(final SshProxyServerConfiguration sshProxyServerConfiguration) throws IOException {
+ sshServer.setHost(sshProxyServerConfiguration.getBindingAddress().getHostString());
+ sshServer.setPort(sshProxyServerConfiguration.getBindingAddress().getPort());
- sshServer.setPasswordAuthenticator(authenticator);
- sshServer.setKeyPairProvider(keyPairProvider);
+ sshServer.setPasswordAuthenticator(sshProxyServerConfiguration.getAuthenticator());
+ sshServer.setKeyPairProvider(sshProxyServerConfiguration.getKeyPairProvider());
sshServer.setIoServiceFactoryFactory(nioServiceWithPoolFactoryFactory);
sshServer.setScheduledExecutorService(minaTimerExecutor);
+ sshServer.setProperties(getProperties(sshProxyServerConfiguration));
final RemoteNetconfCommand.NetconfCommandFactory netconfCommandFactory =
- new RemoteNetconfCommand.NetconfCommandFactory(clientGroup, localAddress);
+ new RemoteNetconfCommand.NetconfCommandFactory(clientGroup, sshProxyServerConfiguration.getLocalAddress());
sshServer.setSubsystemFactories(Lists.<NamedFactory<Command>>newArrayList(netconfCommandFactory));
sshServer.start();
}
+ private static Map<String, String> getProperties(final SshProxyServerConfiguration sshProxyServerConfiguration) {
+ return new HashMap<String, String>()
+ {{
+ put(ServerFactoryManager.IDLE_TIMEOUT, String.valueOf(sshProxyServerConfiguration.getIdleTimeout()));
+ }};
+ }
+
@Override
public void close() {
try {
--- /dev/null
+/*
+ * 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
+ */
+
+package org.opendaylight.controller.netconf.ssh;
+
+import com.google.common.base.Preconditions;
+import io.netty.channel.local.LocalAddress;
+import java.net.InetSocketAddress;
+import org.apache.sshd.common.KeyPairProvider;
+import org.apache.sshd.server.PasswordAuthenticator;
+
+public final class SshProxyServerConfiguration {
+ private final InetSocketAddress bindingAddress;
+ private final LocalAddress localAddress;
+ private final PasswordAuthenticator authenticator;
+ private final KeyPairProvider keyPairProvider;
+ private final int idleTimeout;
+
+ SshProxyServerConfiguration(final InetSocketAddress bindingAddress, final LocalAddress localAddress, final PasswordAuthenticator authenticator, final KeyPairProvider keyPairProvider, final int idleTimeout) {
+ this.bindingAddress = Preconditions.checkNotNull(bindingAddress);
+ this.localAddress = Preconditions.checkNotNull(localAddress);
+ this.authenticator = Preconditions.checkNotNull(authenticator);
+ this.keyPairProvider = Preconditions.checkNotNull(keyPairProvider);
+ // Idle timeout cannot be disabled in the sshd by using =< 0 value
+ Preconditions.checkArgument(idleTimeout > 0, "Idle timeout has to be > 0");
+ this.idleTimeout = idleTimeout;
+ }
+
+ public InetSocketAddress getBindingAddress() {
+ return bindingAddress;
+ }
+
+ public LocalAddress getLocalAddress() {
+ return localAddress;
+ }
+
+ public PasswordAuthenticator getAuthenticator() {
+ return authenticator;
+ }
+
+ public KeyPairProvider getKeyPairProvider() {
+ return keyPairProvider;
+ }
+
+ public int getIdleTimeout() {
+ return idleTimeout;
+ }
+
+
+}
--- /dev/null
+/*
+ * 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
+ */
+
+package org.opendaylight.controller.netconf.ssh;
+
+import io.netty.channel.local.LocalAddress;
+import java.net.InetSocketAddress;
+import org.apache.sshd.common.KeyPairProvider;
+import org.apache.sshd.server.PasswordAuthenticator;
+
+public final class SshProxyServerConfigurationBuilder {
+ private InetSocketAddress bindingAddress;
+ private LocalAddress localAddress;
+ private PasswordAuthenticator authenticator;
+ private KeyPairProvider keyPairProvider;
+ private int idleTimeout;
+
+ public SshProxyServerConfigurationBuilder setBindingAddress(final InetSocketAddress bindingAddress) {
+ this.bindingAddress = bindingAddress;
+ return this;
+ }
+
+ public SshProxyServerConfigurationBuilder setLocalAddress(final LocalAddress localAddress) {
+ this.localAddress = localAddress;
+ return this;
+ }
+
+ public SshProxyServerConfigurationBuilder setAuthenticator(final PasswordAuthenticator authenticator) {
+ this.authenticator = authenticator;
+ return this;
+ }
+
+ public SshProxyServerConfigurationBuilder setKeyPairProvider(final KeyPairProvider keyPairProvider) {
+ this.keyPairProvider = keyPairProvider;
+ return this;
+ }
+
+ public SshProxyServerConfigurationBuilder setIdleTimeout(final int idleTimeout) {
+ this.idleTimeout = idleTimeout;
+ return this;
+ }
+
+ public SshProxyServerConfiguration createSshProxyServerConfiguration() {
+ return new SshProxyServerConfiguration(bindingAddress, localAddress, authenticator, keyPairProvider, idleTimeout);
+ }
+
+ public SshProxyServerConfigurationBuilder create () {
+ return new SshProxyServerConfigurationBuilder();
+ }
+}
\ No newline at end of file
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.TimeUnit;
import org.apache.commons.io.FilenameUtils;
import org.apache.sshd.common.util.ThreadUtils;
import org.apache.sshd.server.keyprovider.PEMGeneratorHostKeyProvider;
import org.opendaylight.controller.netconf.ssh.SshProxyServer;
+import org.opendaylight.controller.netconf.ssh.SshProxyServerConfigurationBuilder;
import org.opendaylight.controller.netconf.util.osgi.NetconfConfigUtil;
import org.opendaylight.controller.netconf.util.osgi.NetconfConfigUtil.InfixProp;
import org.osgi.framework.BundleActivator;
private static final java.lang.String ALGORITHM = "RSA";
private static final int KEY_SIZE = 4096;
public static final int POOL_SIZE = 8;
+ private static final int DEFAULT_IDLE_TIMEOUT = (int) TimeUnit.MINUTES.toMillis(20);
private ScheduledExecutorService minaTimerExecutor;
private NioEventLoopGroup clientGroup;
NetconfConfigUtil.getPrivateKeyKey());
final SshProxyServer sshProxyServer = new SshProxyServer(minaTimerExecutor, clientGroup, nioExecutor);
- sshProxyServer.bind(sshSocketAddress, localAddress, authProviderTracker, new PEMGeneratorHostKeyProvider(path, ALGORITHM, KEY_SIZE));
+ sshProxyServer.bind(
+ new SshProxyServerConfigurationBuilder()
+ .setBindingAddress(sshSocketAddress)
+ .setLocalAddress(localAddress)
+ .setAuthenticator(authProviderTracker)
+ .setKeyPairProvider(new PEMGeneratorHostKeyProvider(path, ALGORITHM, KEY_SIZE))
+ .setIdleTimeout(DEFAULT_IDLE_TIMEOUT)
+ .createSshProxyServerConfiguration());
return sshProxyServer;
}
import org.opendaylight.controller.netconf.nettyutil.handler.ssh.authentication.LoginPassword;
import org.opendaylight.controller.netconf.nettyutil.handler.ssh.client.AsyncSshHandler;
import org.opendaylight.controller.netconf.ssh.SshProxyServer;
+import org.opendaylight.controller.netconf.ssh.SshProxyServerConfigurationBuilder;
import org.opendaylight.controller.netconf.util.osgi.NetconfConfigUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
final InetSocketAddress addr = new InetSocketAddress("127.0.0.1", 10831);
final SshProxyServer sshProxyServer = new SshProxyServer(minaTimerEx, nettyGroup, nioExec);
- sshProxyServer.bind(addr, NetconfConfigUtil.getNetconfLocalAddress(),
- new PasswordAuthenticator() {
+ sshProxyServer.bind(
+ new SshProxyServerConfigurationBuilder().setBindingAddress(addr).setLocalAddress(NetconfConfigUtil.getNetconfLocalAddress()).setAuthenticator(new PasswordAuthenticator() {
@Override
public boolean authenticate(final String username, final String password, final ServerSession session) {
return true;
}
- }, new PEMGeneratorHostKeyProvider(Files.createTempFile("prefix", "suffix").toAbsolutePath().toString()));
+ }).setKeyPairProvider(new PEMGeneratorHostKeyProvider(Files.createTempFile("prefix", "suffix").toAbsolutePath().toString())).setIdleTimeout(Integer.MAX_VALUE).createSshProxyServerConfiguration());
final EchoClientHandler echoClientHandler = connectClient(addr);
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.opendaylight.controller.netconf.ssh.SshProxyServer;
+import org.opendaylight.controller.netconf.ssh.SshProxyServerConfigurationBuilder;
import org.opendaylight.controller.netconf.util.osgi.NetconfConfigUtil;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceListener;
final InetSocketAddress addr = InetSocketAddress.createUnresolved(HOST, PORT);
server = new SshProxyServer(minaTimerEx, clientGroup, nioExec);
- server.bind(addr, NetconfConfigUtil.getNetconfLocalAddress(),
- new PasswordAuthenticator() {
+ server.bind(
+ new SshProxyServerConfigurationBuilder().setBindingAddress(addr).setLocalAddress(NetconfConfigUtil.getNetconfLocalAddress()).setAuthenticator(new PasswordAuthenticator() {
@Override
public boolean authenticate(final String username, final String password, final ServerSession session) {
return true;
}
- }, new PEMGeneratorHostKeyProvider(Files.createTempFile("prefix", "suffix").toAbsolutePath().toString()));
+ }).setKeyPairProvider(new PEMGeneratorHostKeyProvider(Files.createTempFile("prefix", "suffix").toAbsolutePath().toString())).setIdleTimeout(Integer.MAX_VALUE).createSshProxyServerConfiguration());
logger.info("SSH server started on " + PORT);
}
private final File configDir;
private final List<Integer> openDevices;
- private final File ncFeatureFile;
+ private final List<File> ncFeatureFiles;
private final File etcDir;
private final File loadOrderCfgFile;
this.configDir = new File(directory, ETC_OPENDAYLIGHT_KARAF_PATH);
this.etcDir = new File(directory, ETC_KARAF_PATH);
this.loadOrderCfgFile = new File(etcDir, ORG_OPS4J_PAX_URL_MVN_CFG);
- this.ncFeatureFile = getFeatureFile(directory, "features-netconf-connector");
+ this.ncFeatureFiles = getFeatureFile(directory, "features-netconf-connector", "xml");
this.openDevices = openDevices;
}
public void updateFeatureFile(final List<File> generated) {
- // TODO karaf core contains jaxb for feature files, use that for modification
+ // TODO karaf core contains jaxb for feature files, use that for
+ // modification
try {
- final Document document = XmlUtil.readXmlToDocument(Files.toString(ncFeatureFile, Charsets.UTF_8));
- final NodeList childNodes = document.getDocumentElement().getChildNodes();
-
- for (int i = 0; i < childNodes.getLength(); i++) {
- final Node item = childNodes.item(i);
- if(item instanceof Element == false) {
- continue;
- }
- if(item.getLocalName().equals("feature") ==false) {
- continue;
- }
-
- if(NETCONF_CONNECTOR_ALL_FEATURE.equals(((Element) item).getAttribute("name"))) {
- final Element ncAllFeatureDefinition = (Element) item;
- // Clean previous generated files
- for (final XmlElement configfile : XmlElement.fromDomElement(ncAllFeatureDefinition).getChildElements("configfile")) {
- ncAllFeatureDefinition.removeChild(configfile.getDomElement());
+ for (final File featureFile : ncFeatureFiles) {
+ final Document document = XmlUtil.readXmlToDocument(Files
+ .toString(featureFile, Charsets.UTF_8));
+ final NodeList childNodes = document.getDocumentElement().getChildNodes();
+
+ for (int i = 0; i < childNodes.getLength(); i++) {
+ final Node item = childNodes.item(i);
+ if (item instanceof Element == false) {
+ continue;
}
- for (final File file : generated) {
- final Element configfile = document.createElement("configfile");
- configfile.setTextContent("file:" + ETC_OPENDAYLIGHT_KARAF_PATH + file.getName());
- configfile.setAttribute("finalname", ETC_OPENDAYLIGHT_KARAF_PATH + file.getName());
- ncAllFeatureDefinition.appendChild(configfile);
+ if (item.getLocalName().equals("feature") == false) {
+ continue;
+ }
+
+ if (NETCONF_CONNECTOR_ALL_FEATURE
+ .equals(((Element) item).getAttribute("name"))) {
+ final Element ncAllFeatureDefinition = (Element) item;
+ // Clean previous generated files
+ for (final XmlElement configfile : XmlElement
+ .fromDomElement(ncAllFeatureDefinition)
+ .getChildElements("configfile")) {
+ ncAllFeatureDefinition.removeChild(configfile.getDomElement());
+ }
+ for (final File file : generated) {
+ final Element configfile = document.createElement("configfile");
+ configfile.setTextContent("file:"
+ + ETC_OPENDAYLIGHT_KARAF_PATH
+ + file.getName());
+ configfile.setAttribute(
+ "finalname",
+ ETC_OPENDAYLIGHT_KARAF_PATH
+ + file.getName());
+ ncAllFeatureDefinition.appendChild(configfile);
+ }
}
}
- }
- Files.write(XmlUtil.toString(document), ncFeatureFile, Charsets.UTF_8);
- LOG.info("Feature file {} updated", ncFeatureFile);
+ Files.write(XmlUtil.toString(document), featureFile,Charsets.UTF_8);
+ LOG.info("Feature file {} updated", featureFile);
+ }
} catch (final IOException e) {
throw new RuntimeException("Unable to load features file as a resource");
} catch (final SAXException e) {
}
- private static File getFeatureFile(final File distroFolder, final String featureName) {
+ private static List<File> getFeatureFile(final File distroFolder, final String featureName, final String suffix) {
checkExistingDir(distroFolder, String.format("Folder %s does not exist", distroFolder));
final File systemDir = checkExistingDir(new File(distroFolder, "system"), String.format("Folder %s does not contain a karaf distro, folder system is missing", distroFolder));
}
});
- return newestVersionDir.listFiles(new FileFilter() {
+ return Lists.newArrayList(newestVersionDir.listFiles(new FileFilter() {
@Override
public boolean accept(final File pathname) {
- return pathname.getName().contains(featureName);
+ return pathname.getName().contains(featureName)
+ && Files.getFileExtension(pathname.getName()).equals(suffix);
}
- })[0];
+ }));
}
private static File checkExistingDir(final File folder, final String msg) {
import org.opendaylight.controller.netconf.mapping.api.NetconfOperationServiceSnapshot;
import org.opendaylight.controller.netconf.monitoring.osgi.NetconfMonitoringOperationService;
import org.opendaylight.controller.netconf.ssh.SshProxyServer;
+import org.opendaylight.controller.netconf.ssh.SshProxyServerConfiguration;
+import org.opendaylight.controller.netconf.ssh.SshProxyServerConfigurationBuilder;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceException;
import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceRepresentation;
server = dispatcher.createLocalServer(tcpLocalAddress);
try {
final SshProxyServer sshServer = new SshProxyServer(minaTimerExecutor, nettyThreadgroup, nioExecutor);
- sshServer.bind(bindingAddress, tcpLocalAddress,
- new PasswordAuthenticator() {
- @Override
- public boolean authenticate(final String username, final String password, final ServerSession session) {
- // All connections are accepted
- return true;
- }
- }, keyPairProvider);
-
+ sshServer.bind(getSshConfiguration(bindingAddress, tcpLocalAddress));
sshWrappers.add(sshServer);
} catch (final Exception e) {
LOG.warn("Cannot start simulated device on {}, skipping", address, e);
return openDevices;
}
+ private SshProxyServerConfiguration getSshConfiguration(final InetSocketAddress bindingAddress, final LocalAddress tcpLocalAddress) throws IOException {
+ return new SshProxyServerConfigurationBuilder()
+ .setBindingAddress(bindingAddress)
+ .setLocalAddress(tcpLocalAddress)
+ .setAuthenticator(new PasswordAuthenticator() {
+ @Override
+ public boolean authenticate(final String username, final String password, final ServerSession session) {
+ return true;
+ }
+ })
+ .setKeyPairProvider(new PEMGeneratorHostKeyProvider(Files.createTempFile("prefix", "suffix").toAbsolutePath().toString()))
+ .setIdleTimeout(Integer.MAX_VALUE)
+ .createSshProxyServerConfiguration();
+ }
+
private PEMGeneratorHostKeyProvider getPemGeneratorHostKeyProvider() {
try {
final Path tempFile = Files.createTempFile("tempKeyNetconfTest", "suffix");
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>2.12</version>
<configuration>
<failsOnError>false</failsOnError>
<failOnViolation>false</failOnViolation>
@QueryParam("name") String queryFirewallPolicyName,
@QueryParam("description") String querySecurityPolicyDescription,
@QueryParam("shared") String querySecurityPolicyIsShared,
- @QueryParam("firewall_rules") List querySecurityPolicyFirewallRules,
+ @QueryParam("firewall_rules") List<String> querySecurityPolicyFirewallRules,
@QueryParam("audited") Boolean querySecurityPolicyIsAudited,
// pagination
@QueryParam("limit") String limit,
package org.opendaylight.controller.networkconfig.neutron.northbound;
import java.util.List;
-
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
-
import org.opendaylight.controller.networkconfig.neutron.NeutronNetwork;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
-public class NeutronNetworkRequest implements INeutronRequest {
+public class NeutronNetworkRequest implements INeutronRequest<NeutronNetwork> {
// See OpenStack Network API v2.0 Reference for description of
// annotated attributes
singletonNetwork = net;
}
+ @Override
public NeutronNetwork getSingleton() {
return singletonNetwork;
}
+ @Override
public boolean isSingleton() {
return (singletonNetwork != null);
}
+ @Override
public List<NeutronNetwork> getBulk() {
return bulkRequest;
}
package org.opendaylight.controller.networkconfig.neutron.northbound;
import java.util.List;
-
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
-
import org.opendaylight.controller.networkconfig.neutron.NeutronPort;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
-public class NeutronPortRequest implements INeutronRequest {
+public class NeutronPortRequest implements INeutronRequest<NeutronPort> {
// See OpenStack Network API v2.0 Reference for description of
// annotated attributes
singletonPort = port;
}
+ @Override
public NeutronPort getSingleton() {
return singletonPort;
}
+ @Override
public boolean isSingleton() {
return (singletonPort != null);
}
+ @Override
public List<NeutronPort> getBulk() {
return bulkRequest;
}
package org.opendaylight.controller.networkconfig.neutron.northbound;
import java.util.List;
-
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
-
import org.opendaylight.controller.networkconfig.neutron.NeutronSubnet;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
-
-public class NeutronSubnetRequest implements INeutronRequest {
+public class NeutronSubnetRequest implements INeutronRequest<NeutronSubnet> {
// See OpenStack Network API v2.0 Reference for description of
// annotated attributes
links = null;
}
+ @Override
public NeutronSubnet getSingleton() {
return singletonSubnet;
}
+ @Override
public List<NeutronSubnet> getBulk() {
return bulkRequest;
}
+ @Override
public boolean isSingleton() {
return (singletonSubnet != null);
}
package org.opendaylight.controller.networkconfig.neutron.northbound;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import javax.ws.rs.core.UriInfo;
import org.opendaylight.controller.networkconfig.neutron.INeutronObject;
import org.opendaylight.controller.networkconfig.neutron.NeutronNetwork;
import org.opendaylight.controller.networkconfig.neutron.NeutronPort;
import org.opendaylight.controller.northbound.commons.exception.BadRequestException;
import org.opendaylight.controller.northbound.commons.exception.ResourceNotFoundException;
-import javax.ws.rs.core.UriInfo;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
public class PaginatedRequestFactory {
+ private static final Comparator<INeutronObject> NEUTRON_OBJECT_COMPARATOR = new Comparator<INeutronObject>() {
+ @Override
+ public int compare(INeutronObject o1, INeutronObject o2) {
+ return o1.getID().compareTo(o2.getID());
+ }
+ };
public static class PaginationResults<T extends INeutronObject> {
List<T> collection;
}
}
- public static <T extends INeutronObject> INeutronRequest createRequest(Integer limit, String marker,
+ private static final class MarkerObject implements INeutronObject {
+ private final String id;
+
+ MarkerObject(String id) {
+ this.id = id;
+ }
+
+ @Override
+ public String getID() {
+ return id;
+ }
+
+ @Override
+ public void setID(String id) {
+ throw new UnsupportedOperationException("Marker has constant ID");
+ }
+ }
+
+ /*
+ * SuppressWarnings is needed because the compiler does not understand that we
+ * are actually safe here.
+ *
+ * FIXME: the only caller performs a cast back, so this is not actually necessary.
+ */
+ @SuppressWarnings("unchecked")
+ public static <T extends INeutronObject> INeutronRequest<T> createRequest(Integer limit, String marker,
Boolean pageReverse,
UriInfo uriInfo,
List<T> collection,
Class<T> clazz) {
- PaginationResults results = _paginate(limit, marker, pageReverse, uriInfo, collection);
+ PaginationResults<T> results = _paginate(limit, marker, pageReverse, uriInfo, collection);
if (clazz.equals(NeutronNetwork.class)){
- return new NeutronNetworkRequest(results.collection, results.links);
+ return (INeutronRequest<T>) new NeutronNetworkRequest((List<NeutronNetwork>) results.collection, results.links);
}
if (clazz.equals(NeutronSubnet.class)){
- return new NeutronSubnetRequest(results.collection, results.links);
+ return (INeutronRequest<T>) new NeutronSubnetRequest((List<NeutronSubnet>) results.collection, results.links);
}
if (clazz.equals(NeutronPort.class)){
- return new NeutronPortRequest(results.collection, results.links);
+ return (INeutronRequest<T>) new NeutronPortRequest((List<NeutronPort>) results.collection, results.links);
}
return null;
}
- private static <T extends INeutronObject> PaginationResults _paginate(Integer limit, String marker, Boolean pageReverse, UriInfo uriInfo, List<T> collection) {
+ private static <T extends INeutronObject> PaginationResults<T> _paginate(Integer limit, String marker, Boolean pageReverse, UriInfo uriInfo, List<T> collection) {
List<NeutronPageLink> links = new ArrayList<>();
- Integer startPos = null;
+ final int startPos;
String startMarker;
String endMarker;
Boolean firstPage = false;
Boolean lastPage = false;
- Comparator<INeutronObject> neutronObjectComparator = new Comparator<INeutronObject>() {
- @Override
- public int compare(INeutronObject o1, INeutronObject o2) {
- return o1.getID().compareTo(o2.getID());
- }
- };
-
- Collections.sort(collection, neutronObjectComparator);
-
- if (marker == null) {
- startPos = 0;
- }
-
- else {
-
- class MarkerObject implements INeutronObject {
- private String id;
-
- public String getID() {
- return id;
- }
+ Collections.sort(collection, NEUTRON_OBJECT_COMPARATOR);
- public void setID(String id) {
- this.id = id;
- }
+ if (marker != null) {
+ int offset = Collections.binarySearch(collection, new MarkerObject(marker), NEUTRON_OBJECT_COMPARATOR);
+ if (offset < 0) {
+ throw new ResourceNotFoundException("UUID for marker: " + marker + " could not be found");
}
- INeutronObject markerObject = new MarkerObject();
-
- markerObject.setID(marker);
-
- startPos = Collections.binarySearch(collection, markerObject, neutronObjectComparator);
-
- if (!pageReverse){
- startPos = startPos + 1;
+ if (!pageReverse) {
+ startPos = offset + 1;
}
else {
- startPos = startPos - limit;
+ startPos = offset - limit;
}
-
}
-
- if (startPos == null) {
- throw new ResourceNotFoundException("UUID for marker:" + marker + " could not be found");
+ else {
+ startPos = 0;
}
if (startPos == 0){
links.add(previous);
}
- return new PaginationResults(collection, links);
+ return new PaginationResults<T>(collection, links);
}
}
</prerequisites>
<modules>
<module>opendaylight/distribution/opendaylight</module>
- <module>opendaylight/forwarding/staticrouting</module>
- <module>opendaylight/clustering/services</module>
- <module>opendaylight/clustering/services_implementation</module>
- <module>opendaylight/clustering/stub</module>
- <module>opendaylight/clustering/test</module>
- <module>opendaylight/configuration/api</module>
- <module>opendaylight/configuration/implementation</module>
- <module>opendaylight/routing/dijkstra_implementation</module>
- <module>opendaylight/arphandler</module>
- <module>opendaylight/forwardingrulesmanager/api</module>
- <module>opendaylight/forwardingrulesmanager/implementation</module>
- <module>opendaylight/hosttracker/api</module>
- <module>opendaylight/hosttracker/implementation</module>
- <module>opendaylight/hosttracker/shell</module>
- <module>opendaylight/hosttracker_new/api</module>
- <module>opendaylight/hosttracker_new/implementation</module>
- <module>opendaylight/containermanager/api</module>
- <module>opendaylight/containermanager/implementation</module>
- <module>opendaylight/containermanager/shell</module>
- <module>opendaylight/appauth</module>
- <module>opendaylight/switchmanager/api</module>
- <module>opendaylight/switchmanager/implementation</module>
- <module>opendaylight/statisticsmanager/api</module>
- <module>opendaylight/statisticsmanager/implementation</module>
- <module>opendaylight/topologymanager/implementation</module>
- <module>opendaylight/topologymanager/shell</module>
- <module>opendaylight/usermanager/api</module>
- <module>opendaylight/usermanager/implementation</module>
- <module>opendaylight/connectionmanager/api</module>
- <module>opendaylight/connectionmanager/implementation</module>
- <module>opendaylight/security</module>
- <module>opendaylight/karaf-tomcat-security</module>
<!-- third-parties uncomment them if you need snapshot version of it -->
<!-- <module>third-party/openflowj</module> -->
<module>third-party/commons/thirdparty</module>
- <!-- SAL bundles -->
- <module>opendaylight/sal/api</module>
- <module>opendaylight/sal/implementation</module>
-
- <!-- SAL Extension bundles -->
- <module>opendaylight/sal/connection/api</module>
- <module>opendaylight/sal/connection/implementation</module>
- <module>opendaylight/sal/networkconfiguration/api</module>
- <module>opendaylight/sal/networkconfiguration/implementation</module>
-
<!-- md-sal -->
<module>opendaylight/md-sal</module>
<!-- config -->
<!-- netconf -->
<module>opendaylight/netconf</module>
- <!-- Web bundles -->
- <module>opendaylight/web/root</module>
- <module>opendaylight/web/flows</module>
- <module>opendaylight/web/devices</module>
- <module>opendaylight/web/troubleshoot</module>
- <module>opendaylight/web/topology</module>
- <module>opendaylight/web/osgi-brandfragment</module>
+ <!-- adsal -->
+ <module>opendaylight/adsal</module>
<!-- Neutron -->
<module>opendaylight/networkconfiguration/neutron</module>
<module>opendaylight/networkconfiguration/neutron/implementation</module>
- <module>opendaylight/northbound/networkconfiguration/neutron</module>
-
- <!-- Northbound bundles -->
- <module>opendaylight/northbound/commons</module>
- <module>opendaylight/northbound/bundlescanner/api</module>
- <module>opendaylight/northbound/bundlescanner/implementation</module>
- <module>opendaylight/northbound/topology</module>
- <module>opendaylight/northbound/staticrouting</module>
- <module>opendaylight/northbound/statistics</module>
- <module>opendaylight/northbound/flowprogrammer</module>
- <module>opendaylight/northbound/hosttracker</module>
- <module>opendaylight/northbound/subnets</module>
- <module>opendaylight/northbound/switchmanager</module>
- <module>opendaylight/northbound/containermanager</module>
- <module>opendaylight/northbound/networkconfiguration/bridgedomain</module>
- <module>opendaylight/northbound/httpservice-bridge</module>
- <module>opendaylight/northbound/jolokia</module>
- <module>opendaylight/northbound/connectionmanager</module>
- <module>opendaylight/northbound/usermanager</module>
- <module>opendaylight/northbound/controllermanager</module>
-
- <!-- Debug and logging -->
- <module>opendaylight/logging/bridge</module>
-
- <!-- Southbound bundles -->
- <module>opendaylight/protocol_plugins/openflow</module>
- <module>opendaylight/protocol_plugins/stub</module>
-
- <!-- Samples -->
- <module>opendaylight/samples/simpleforwarding</module>
- <module>opendaylight/samples/loadbalancer</module>
- <module>opendaylight/samples/northbound/loadbalancer</module>
+ <module>opendaylight/networkconfiguration/neutron/northbound</module>
<!-- Parents -->
<module>opendaylight/commons/concepts</module>
<module>opendaylight/commons/protocol-framework</module>
- <module>opendaylight/commons/httpclient</module>
<module>opendaylight/commons/checkstyle</module>
<module>opendaylight/commons/opendaylight</module>
<module>opendaylight/commons/parent</module>
<module>opendaylight/commons/liblldp</module>
<!-- Karaf Distribution -->
- <module>opendaylight/dummy-console</module>
<module>opendaylight/karaf-branding</module>
<module>opendaylight/distribution/opendaylight-karaf-empty</module>
<module>opendaylight/distribution/opendaylight-karaf</module>
<activeByDefault>false</activeByDefault>
</activation>
<modules>
- <module>opendaylight/clustering/integrationtest</module>
- <module>opendaylight/configuration/integrationtest</module>
- <module>opendaylight/forwardingrulesmanager/integrationtest</module>
- <module>opendaylight/hosttracker/integrationtest</module>
- <module>opendaylight/switchmanager/integrationtest</module>
- <module>opendaylight/topologymanager/integrationtest</module>
- <!-- Northbound integration tests -->
- <module>opendaylight/northbound/integrationtest</module>
- <module>opendaylight/statisticsmanager/integrationtest</module>
- <module>opendaylight/commons/integrationtest</module>
- <module>opendaylight/containermanager/it.implementation</module>
<module>opendaylight/distribution/sanitytest/</module>
</modules>
</profile>
- <profile>
- <id>docs</id>
- <activation>
- <activeByDefault>false</activeByDefault>
- </activation>
- <modules>
- <module>opendaylight/northbound/java-client</module>
- <module>opendaylight/northbound/swagger-ui</module>
- </modules>
- </profile>
</profiles>
</project>