<?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>
- <prerequisites>
- <maven>3.0</maven>
- </prerequisites>
<parent>
<groupId>org.opendaylight.controller</groupId>
<artifactId>commons.opendaylight</artifactId>
<version>1.4.2-SNAPSHOT</version>
</parent>
<groupId>org.opendaylight.ovsdb</groupId>
- <artifactId>commons.ovsdb</artifactId>
+ <artifactId>ovsdb_commons</artifactId>
<version>1.1.0-SNAPSHOT</version>
<packaging>pom</packaging>
- <url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
- <scm>
- <connection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</connection>
- <developerConnection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</developerConnection>
- <url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
- <tag>HEAD</tag>
- </scm>
+ <prerequisites>
+ <maven>3.0</maven>
+ </prerequisites>
<properties>
- <nexusproxy>http://nexus.opendaylight.org/content</nexusproxy>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version.source>1.7</java.version.source>
<java.version.target>1.7</java.version.target>
+ <nexusproxy>http://nexus.opendaylight.org/content</nexusproxy>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
</plugins>
</pluginManagement>
</build>
+ <url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
+ <scm>
+ <connection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</connection>
+ <developerConnection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</developerConnection>
+ <tag>HEAD</tag>
+ <url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
+ </scm>
<repositories>
<!-- Opendaylight public group -->
<repository>
- <id>opendaylight-public</id>
- <name>opendaylight-public</name>
- <url>${nexusproxy}/groups/public/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
+ <id>opendaylight-public</id>
+ <name>opendaylight-public</name>
+ <url>${nexusproxy}/groups/public/</url>
</repository>
<!-- OpenDayLight Released artifact -->
<repository>
<pluginRepositories>
<pluginRepository>
- <id>opendaylight-public</id>
- <name>opendaylight-public</name>
- <url>http://nexus.opendaylight.org/content/groups/public/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
+ <id>opendaylight-public</id>
+ <name>opendaylight-public</name>
+ <url>http://nexus.opendaylight.org/content/groups/public/</url>
</pluginRepository>
<pluginRepository>
<id>opendaylight-release</id>
+<?xml version="1.0" encoding="UTF-8"?>
<!--
Adapted from David Erickson's Distribution pom.xml
see https://git.opendaylight.org/gerrit/#/c/390/
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.opendaylight.ovsdb</groupId>
- <artifactId>commons.ovsdb</artifactId>
+ <artifactId>ovsdb_commons</artifactId>
<version>1.1.0-SNAPSHOT</version>
<relativePath>../../commons/parent/</relativePath>
</parent>
<artifactId>distribution.ovsdb</artifactId>
<packaging>pom</packaging>
<name>ovsdb Distribution</name>
-
- <scm>
- <connection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</connection>
- <developerConnection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</developerConnection>
- <url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
- <tag>HEAD</tag>
- </scm>
<dependencies>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>distribution.opendaylight</artifactId>
- <version>0.1.2-SNAPSHOT</version>
- <type>zip</type>
- <classifier>osgipackage</classifier>
- <!-- Make sure this isn't included on any classpath-->
- <scope>provided</scope>
- </dependency>
<dependency>
<groupId>org.opendaylight.ovsdb</groupId>
- <artifactId>ovsdb</artifactId>
+ <artifactId>ovsdb_library</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.opendaylight.ovsdb</groupId>
- <artifactId>ovsdb.northbound</artifactId>
+ <artifactId>ovsdb_neutron</artifactId>
<version>0.6.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.opendaylight.ovsdb</groupId>
- <artifactId>ovsdb.neutron</artifactId>
+ <artifactId>ovsdb_northbound</artifactId>
<version>0.6.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.ovsdb</groupId>
+ <artifactId>ovsdb_plugin</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>distribution.opendaylight</artifactId>
+ <version>0.1.2-SNAPSHOT</version>
+ <classifier>osgipackage</classifier>
+ <type>zip</type>
+ <!-- Make sure this isn't included on any classpath-->
+ <scope>provided</scope>
+ </dependency>
</dependencies>
<build>
<resources>
<directory>${basedir}/src/main/resources</directory>
</resource>
<resource>
- <directory>${project.build.directory}/generated-resources</directory>
<filtering>true</filtering>
+ <directory>${project.build.directory}/generated-resources</directory>
</resource>
</resources>
<plugins>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <version>2.8</version>
+ <artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
- <id>unpack-shared-resources</id>
+ <id>distro-assembly</id>
<goals>
- <goal>unpack-dependencies</goal>
+ <goal>single</goal>
</goals>
- <phase>generate-resources</phase>
+ <phase>package</phase>
<configuration>
- <outputDirectory>${project.build.directory}/generated-resources</outputDirectory>
- <includeArtifactIds>distribution.opendaylight</includeArtifactIds>
- <includeGroupIds>org.opendaylight.controller</includeGroupIds>
- <excludeTransitive>true</excludeTransitive>
- <ignorePermissions>false</ignorePermissions>
+ <descriptors>
+ <descriptor>src/assemble/bin.xml</descriptor>
+ </descriptors>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
- <artifactId>maven-assembly-plugin</artifactId>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>2.8</version>
<executions>
<execution>
- <id>distro-assembly</id>
- <phase>package</phase>
+ <id>unpack-shared-resources</id>
<goals>
- <goal>single</goal>
+ <goal>unpack-dependencies</goal>
</goals>
+ <phase>generate-resources</phase>
<configuration>
- <descriptors>
- <descriptor>src/assemble/bin.xml</descriptor>
- </descriptors>
+ <outputDirectory>${project.build.directory}/generated-resources</outputDirectory>
+ <includeArtifactIds>distribution.opendaylight</includeArtifactIds>
+ <includeGroupIds>org.opendaylight.controller</includeGroupIds>
+ <excludeTransitive>true</excludeTransitive>
+ <ignorePermissions>false</ignorePermissions>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
+
+ <scm>
+ <connection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</connection>
+ <developerConnection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</developerConnection>
+ <tag>HEAD</tag>
+ <url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
+ </scm>
</project>
<?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.ovsdb</groupId>
- <artifactId>commons.ovsdb</artifactId>
- <version>1.1.0-SNAPSHOT</version>
- <relativePath>../commons/parent</relativePath>
- </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.opendaylight.ovsdb</groupId>
+ <artifactId>ovsdb_commons</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <relativePath>../commons/parent</relativePath>
+ </parent>
- <artifactId>ovsdb.neutron</artifactId>
- <version>0.6.0-SNAPSHOT</version>
- <packaging>bundle</packaging>
+ <artifactId>ovsdb_neutron</artifactId>
+ <version>0.6.0-SNAPSHOT</version>
+ <packaging>bundle</packaging>
- <scm>
- <connection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</connection>
- <developerConnection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</developerConnection>
- <url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
- <tag>HEAD</tag>
- </scm>
-
- <properties>
- <guava.version>14.0.1</guava.version>
- <xtend.version>2.4.3</xtend.version>
- <bundle.plugin.version>2.4.0</bundle.plugin.version>
- <maven.clean.plugin.version>2.5</maven.clean.plugin.version>
- </properties>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <version>2.3.6</version>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Import-Package>
- org.opendaylight.controller.networkconfig.neutron,
- org.opendaylight.controller.containermanager,
- org.opendaylight.controller.switchmanager,
- org.opendaylight.controller.forwardingrulesmanager,
- org.opendaylight.controller.sal.core,
- org.opendaylight.controller.sal.utils,
- org.opendaylight.controller.sal.action,
- org.opendaylight.ovsdb.plugin,
- org.opendaylight.ovsdb.lib.notation,
- org.opendaylight.ovsdb.lib.table,
- org.opendaylight.ovsdb.lib.table.internal,
- org.opendaylight.controller.sal.binding.api,
- org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819,
- org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes,
- org.opendaylight.yangtools.yang.binding,
- org.apache.felix.dm,
- org.slf4j,
- org.osgi.framework,
- *
- </Import-Package>
- <Bundle-Activator>
- org.opendaylight.ovsdb.neutron.Activator
- </Bundle-Activator>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
+ <properties>
+ <bundle.plugin.version>2.4.0</bundle.plugin.version>
+ <guava.version>14.0.1</guava.version>
+ <maven.clean.plugin.version>2.5</maven.clean.plugin.version>
+ <xtend.version>2.4.3</xtend.version>
+ </properties>
<dependencies>
<dependency>
<groupId>org.opendaylight.controller</groupId>
- <version>0.4.2-SNAPSHOT</version>
- <artifactId>networkconfig.neutron</artifactId>
+ <artifactId>containermanager</artifactId>
+ <version>0.5.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
- <artifactId>switchmanager</artifactId>
- <version>0.7.1-SNAPSHOT</version>
+ <artifactId>forwardingrulesmanager</artifactId>
+ <version>0.5.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
- <artifactId>forwardingrulesmanager</artifactId>
- <version>0.5.1-SNAPSHOT</version>
+ <artifactId>networkconfig.neutron</artifactId>
+ <version>0.4.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>sal</artifactId>
<version>0.7.1-SNAPSHOT</version>
</dependency>
- <dependency>
- <groupId>org.opendaylight.ovsdb</groupId>
- <artifactId>ovsdb</artifactId>
- <version>0.5.1-SNAPSHOT</version>
- </dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
- <artifactId>containermanager</artifactId>
- <version>0.5.2-SNAPSHOT</version>
+ <artifactId>sal-binding-api</artifactId>
+ <version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-binding-api</artifactId>
- <version>1.1-SNAPSHOT</version>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-common-util</artifactId>
+ <version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
- <groupId>org.opendaylight.controller.model</groupId>
- <artifactId>model-flow-service</artifactId>
- <version>1.1-SNAPSHOT</version>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>switchmanager</artifactId>
+ <version>0.7.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.opendaylight.controller.model</groupId>
<artifactId>model-flow-base</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
- <dependency>
+ <dependency>
<groupId>org.opendaylight.controller.model</groupId>
<artifactId>model-flow-management</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller.model</groupId>
+ <artifactId>model-flow-service</artifactId>
+ <version>1.1-SNAPSHOT</version>
+ </dependency>
<dependency>
<groupId>org.opendaylight.controller.model</groupId>
<artifactId>model-inventory</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.ovsdb</groupId>
+ <artifactId>ovsdb_library</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.ovsdb</groupId>
+ <artifactId>ovsdb_plugin</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </dependency>
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yang-binding</artifactId>
<version>0.6.2-SNAPSHOT</version>
</dependency>
<dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-common-util</artifactId>
- <version>1.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.11</version>
- <scope>test</scope>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.11</version>
+ <scope>test</scope>
</dependency>
<dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- <version>1.9.5</version>
- <scope>test</scope>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <version>1.9.5</version>
+ <scope>test</scope>
</dependency>
<dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-module-junit4</artifactId>
- <version>1.5.2</version>
- <scope>test</scope>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-api-mockito</artifactId>
+ <version>1.5.2</version>
+ <scope>test</scope>
</dependency>
<dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito</artifactId>
- <version>1.5.2</version>
- <scope>test</scope>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-module-junit4</artifactId>
+ <version>1.5.2</version>
+ <scope>test</scope>
</dependency>
</dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>2.3.6</version>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Import-Package>org.opendaylight.controller.networkconfig.neutron,
+ org.opendaylight.controller.containermanager,
+ org.opendaylight.controller.switchmanager,
+ org.opendaylight.controller.forwardingrulesmanager,
+ org.opendaylight.controller.sal.core,
+ org.opendaylight.controller.sal.utils,
+ org.opendaylight.controller.sal.action,
+ org.opendaylight.ovsdb.plugin,
+ org.opendaylight.ovsdb.lib.notation,
+ org.opendaylight.ovsdb.lib.table,
+ org.opendaylight.controller.sal.binding.api,
+ org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819,
+ org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes,
+ org.opendaylight.yangtools.yang.binding,
+ org.apache.felix.dm,
+ org.slf4j,
+ org.osgi.framework,
+ *</Import-Package>
+ <Bundle-Activator>org.opendaylight.ovsdb.neutron.Activator</Bundle-Activator>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <scm>
+ <connection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</connection>
+ <developerConnection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</developerConnection>
+ <tag>HEAD</tag>
+ <url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
+ </scm>
</project>
import org.opendaylight.controller.sal.core.Node;
import org.opendaylight.controller.sal.utils.ServiceHelper;
import org.opendaylight.ovsdb.lib.table.Open_vSwitch;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
+import org.opendaylight.ovsdb.lib.table.Table;
import org.opendaylight.ovsdb.plugin.OVSDBConfigService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.opendaylight.ovsdb.lib.table.Bridge;
import org.opendaylight.ovsdb.lib.table.Interface;
import org.opendaylight.ovsdb.lib.table.Port;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
+import org.opendaylight.ovsdb.lib.table.Table;
import org.opendaylight.ovsdb.neutron.provider.ProviderNetworkManager;
import org.opendaylight.ovsdb.plugin.IConnectionServiceInternal;
import org.opendaylight.ovsdb.plugin.OVSDBConfigService;
import org.opendaylight.ovsdb.lib.notation.UUID;
import org.opendaylight.ovsdb.lib.table.Interface;
import org.opendaylight.ovsdb.lib.table.Port;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
+import org.opendaylight.ovsdb.lib.table.Table;
import org.opendaylight.ovsdb.plugin.OVSDBConfigService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
package org.opendaylight.ovsdb.neutron;
import org.opendaylight.controller.sal.core.Node;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
+import org.opendaylight.ovsdb.lib.table.Table;
public class SouthboundEvent {
public enum Type { NODE, ROW };
import org.opendaylight.ovsdb.lib.table.Interface;
import org.opendaylight.ovsdb.lib.table.Open_vSwitch;
import org.opendaylight.ovsdb.lib.table.Port;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
+import org.opendaylight.ovsdb.lib.table.Table;
import org.opendaylight.ovsdb.neutron.provider.ProviderNetworkManager;
import org.opendaylight.ovsdb.plugin.OVSDBInventoryListener;
import org.slf4j.Logger;
import org.opendaylight.ovsdb.lib.table.Interface;
import org.opendaylight.ovsdb.lib.table.Open_vSwitch;
import org.opendaylight.ovsdb.lib.table.Port;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
+import org.opendaylight.ovsdb.lib.table.Table;
import org.opendaylight.ovsdb.neutron.provider.ProviderNetworkManager;
import org.opendaylight.ovsdb.plugin.IConnectionServiceInternal;
import org.opendaylight.ovsdb.plugin.OVSDBConfigService;
import org.opendaylight.ovsdb.lib.table.Bridge;
import org.opendaylight.ovsdb.lib.table.Interface;
import org.opendaylight.ovsdb.lib.table.Port;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
+import org.opendaylight.ovsdb.lib.table.Table;
import org.opendaylight.ovsdb.neutron.AdminConfigManager;
import org.opendaylight.ovsdb.neutron.InternalNetworkManager;
import org.opendaylight.ovsdb.neutron.TenantNetworkManager;
String bridgeUUID = null;
String tunnelBridgeName = AdminConfigManager.getManager().getIntegrationBridgeName();
OVSDBConfigService ovsdbTable = (OVSDBConfigService)ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
- Map<String, org.opendaylight.ovsdb.lib.table.internal.Table<?>> bridgeTable = ovsdbTable.getRows(node, Bridge.NAME.getName());
+ Map<String, org.opendaylight.ovsdb.lib.table.Table<?>> bridgeTable = ovsdbTable.getRows(node, Bridge.NAME.getName());
if (bridgeTable != null) {
for (String uuid : bridgeTable.keySet()) {
Bridge bridge = (Bridge)bridgeTable.get(uuid);
return;
}
- Map<String, org.opendaylight.ovsdb.lib.table.internal.Table<?>> intfs = ovsdbTable.getRows(node, Interface.NAME.getName());
+ Map<String, org.opendaylight.ovsdb.lib.table.Table<?>> intfs = ovsdbTable.getRows(node, Interface.NAME.getName());
if (intfs != null) {
- for (org.opendaylight.ovsdb.lib.table.internal.Table<?> row : intfs.values()) {
+ for (org.opendaylight.ovsdb.lib.table.Table<?> row : intfs.values()) {
Interface tunIntf = (Interface)row;
if (tunIntf.getName().equals(this.getTunnelName(tunnelType, dst))) {
of_ports = tunIntf.getOfport();
private Status triggerInterfaceUpdates(Node node) {
try {
OVSDBConfigService ovsdbTable = (OVSDBConfigService)ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
- Map<String, org.opendaylight.ovsdb.lib.table.internal.Table<?>> intfs = ovsdbTable.getRows(node, Interface.NAME.getName());
+ Map<String, org.opendaylight.ovsdb.lib.table.Table<?>> intfs = ovsdbTable.getRows(node, Interface.NAME.getName());
if (intfs != null) {
- for (org.opendaylight.ovsdb.lib.table.internal.Table<?> row : intfs.values()) {
+ for (org.opendaylight.ovsdb.lib.table.Table<?> row : intfs.values()) {
Interface intf = (Interface)row;
NeutronNetwork network = TenantNetworkManager.getManager().getTenantNetworkForInterface(intf);
logger.debug("Trigger Interface update for {}", intf);
import org.opendaylight.controller.sal.utils.Status;
import org.opendaylight.ovsdb.lib.table.Bridge;
import org.opendaylight.ovsdb.lib.table.Interface;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
+import org.opendaylight.ovsdb.lib.table.Table;
import org.opendaylight.ovsdb.plugin.OVSDBConfigService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.opendaylight.controller.sal.utils.ServiceHelper;
import org.opendaylight.ovsdb.lib.notation.OvsDBMap;
import org.opendaylight.ovsdb.lib.table.Open_vSwitch;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
+import org.opendaylight.ovsdb.lib.table.Table;
import org.opendaylight.ovsdb.plugin.ConfigurationService;
import org.opendaylight.ovsdb.plugin.OVSDBConfigService;
import org.powermock.api.mockito.PowerMockito;
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.opendaylight.ovsdb</groupId>
- <artifactId>commons.ovsdb</artifactId>
+ <artifactId>ovsdb_commons</artifactId>
<version>1.1.0-SNAPSHOT</version>
- <relativePath>../../commons/parent</relativePath>
+ <relativePath>../commons/parent</relativePath>
</parent>
- <scm>
- <connection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</connection>
- <developerConnection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</developerConnection>
- <url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
- <tag>HEAD</tag>
- </scm>
- <artifactId>ovsdb.northbound</artifactId>
+ <artifactId>ovsdb_northbound</artifactId>
<version>0.6.0-SNAPSHOT</version>
<packaging>bundle</packaging>
+ <dependencies>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
+ <version>${jackson.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ <version>${jackson.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ <version>${jackson.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.enunciate</groupId>
+ <artifactId>enunciate-core-annotations</artifactId>
+ <version>${enunciate.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>commons.northbound</artifactId>
+ <version>0.4.2-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal</artifactId>
+ <version>0.7.1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.ovsdb</groupId>
+ <artifactId>ovsdb_library</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.ovsdb</groupId>
+ <artifactId>ovsdb_plugin</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </dependency>
+
+ </dependencies>
<build>
<plugins>
- <plugin>
- <groupId>org.codehaus.enunciate</groupId>
- <artifactId>maven-enunciate-plugin</artifactId>
- <version>${enunciate.version}</version>
- </plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
- <Export-Package>
- </Export-Package>
- <Import-Package>
- org.opendaylight.controller.sal.utils,
+ <Export-Package></Export-Package>
+ <Import-Package>org.opendaylight.controller.sal.utils,
org.opendaylight.controller.northbound.commons,
org.opendaylight.controller.northbound.commons.exception,
org.opendaylight.controller.northbound.commons.utils,
org.opendaylight.controller.sal.core,
org.opendaylight.controller.sal.authorization,
org.opendaylight.ovsdb.lib.table,
- org.opendaylight.ovsdb.lib.table.internal,
org.opendaylight.ovsdb.lib.notation,
org.opendaylight.ovsdb.plugin,
javax.ws.rs,
org.apache.catalina.filters,
com.fasterxml.jackson.databind.annotation,
com.fasterxml.jackson.annotation,
- !org.codehaus.enunciate.jaxrs
- </Import-Package>
- <Export-Package>
- </Export-Package>
+ !org.codehaus.enunciate.jaxrs</Import-Package>
+ <Export-Package></Export-Package>
<Web-ContextPath>/ovsdb/nb/v2</Web-ContextPath>
<Jaxrs-Resources>,${classes;ANNOTATION;javax.ws.rs.Path}</Jaxrs-Resources>
</instructions>
<manifestLocation>${project.basedir}/src/main/resources/META-INF</manifestLocation>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.codehaus.enunciate</groupId>
+ <artifactId>maven-enunciate-plugin</artifactId>
+ <version>${enunciate.version}</version>
+ </plugin>
</plugins>
</build>
- <dependencies>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal</artifactId>
- <version>0.7.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.ovsdb</groupId>
- <artifactId>ovsdb</artifactId>
- <version>0.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>commons.northbound</artifactId>
- <version>0.4.2-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.codehaus.enunciate</groupId>
- <artifactId>enunciate-core-annotations</artifactId>
- <version>${enunciate.version}</version>
- </dependency>
-
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-annotations</artifactId>
- <version>${jackson.version}</version>
- </dependency>
-
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- <version>${jackson.version}</version>
- </dependency>
-
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- <version>${jackson.version}</version>
- </dependency>
-
- </dependencies>
+ <scm>
+ <connection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</connection>
+ <developerConnection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</developerConnection>
+ <tag>HEAD</tag>
+ <url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
+ </scm>
</project>
import org.opendaylight.controller.sal.utils.Status;
import org.opendaylight.controller.sal.utils.StatusCode;
import org.opendaylight.ovsdb.lib.notation.UUID;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
-import org.opendaylight.ovsdb.lib.table.internal.Tables;
+import org.opendaylight.ovsdb.lib.table.Table;
+import org.opendaylight.ovsdb.lib.table.Tables;
import org.opendaylight.ovsdb.plugin.OVSDBConfigService;
import org.opendaylight.ovsdb.plugin.StatusWithUuid;
import org.slf4j.Logger;
import org.opendaylight.ovsdb.lib.table.Queue;
import org.opendaylight.ovsdb.lib.table.SFlow;
import org.opendaylight.ovsdb.lib.table.SSL;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
+import org.opendaylight.ovsdb.lib.table.Table;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import java.util.Map;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
+import org.opendaylight.ovsdb.lib.table.Table;
public class OVSDBRows {
Map<String, Table<?>> rows;
+++ /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.ovsdb</groupId>
- <artifactId>commons.ovsdb</artifactId>
- <version>1.1.0-SNAPSHOT</version>
- <relativePath>../commons/parent</relativePath>
- </parent>
- <scm>
- <connection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</connection>
- <developerConnection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</developerConnection>
- <url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
- <tag>HEAD</tag>
- </scm>
- <artifactId>ovsdb</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- <packaging>bundle</packaging>
-
- <properties>
- <skip.integrationtest>true</skip.integrationtest>
- <!-- used for filtering the integration test resource -->
- <ovsdbserver.ipaddress>192.168.56.10</ovsdbserver.ipaddress>
- <ovsdbserver.port>6640</ovsdbserver.port>
- </properties>
-
- <build>
- <testResources>
- <testResource>
- <directory>src/test/resources</directory>
- <filtering>true</filtering>
- </testResource>
- </testResources>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <version>2.3.6</version>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Import-Package>
- org.opendaylight.controller.sal.packet,
- org.opendaylight.controller.sal.action,
- org.opendaylight.controller.sal.discovery,
- org.opendaylight.controller.sal.topology,
- org.opendaylight.controller.sal.core,
- org.opendaylight.controller.sal.flowprogrammer,
- org.opendaylight.controller.sal.reader,
- org.opendaylight.controller.sal.inventory,
- org.opendaylight.controller.sal.match,
- org.opendaylight.controller.sal.utils,
- org.opendaylight.controller.sal.connection,
- org.opendaylight.controller.clustering.services,
- org.opendaylight.controller.sal.networkconfig.bridgedomain,
- org.apache.commons.lang3.builder,
- org.apache.commons.lang3.tuple,
- org.apache.felix.dm,
- org.slf4j,
- org.eclipse.osgi.framework.console,
- org.osgi.framework,
- javax.net.ssl,
- *
- </Import-Package>
- <Embed-Dependency>httpclient,commons-codec,httpcore-nio,javax.servlet-api,portlet-api,commons-collections;type=!pom;inline=false</Embed-Dependency>
- <Embed-Transitive>
- true
- </Embed-Transitive>
- <Bundle-Activator>
- org.opendaylight.ovsdb.plugin.Activator
- </Bundle-Activator>
- <Export-Package>
- org.opendaylight.ovsdb.lib.table, org.opendaylight.ovsdb.lib.table.internal, org.opendaylight.ovsdb.plugin, org.opendaylight.ovsdb.lib.notation
- </Export-Package>
- </instructions>
- <manifestLocation>${project.basedir}/META-INF</manifestLocation>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.16</version>
- <configuration>
- <excludes>
- <!-- Exclude integration tests -->
- <exclude>**/*IT</exclude>
- </excludes>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-failsafe-plugin</artifactId>
- <configuration>
- <skipITs>${skip.integrationtest}</skipITs>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>clustering.services</artifactId>
- <version>0.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal</artifactId>
- <version>0.7.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal.connection</artifactId>
- <version>0.1.2-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal.networkconfiguration</artifactId>
- <version>0.0.3-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-annotations</artifactId>
- <version>${jackson.version}</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- <version>${jackson.version}</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- <version>${jackson.version}</version>
- </dependency>
- <dependency>
- <groupId>javax.portlet</groupId>
- <artifactId>portlet-api</artifactId>
- <version>2.0</version>
- </dependency>
- <dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- <version>1.4</version>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpcore-nio</artifactId>
- <version>4.2.1</version>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-all</artifactId>
- <version>4.0.10.Final</version>
- </dependency>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <version>2.3</version>
- </dependency>
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- <version>1.0</version>
- </dependency>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- <version>${guava.version}</version>
- </dependency>
- <dependency>
- <groupId>equinoxSDK381</groupId>
- <artifactId>org.eclipse.osgi</artifactId>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- <version>2.1</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-core</artifactId>
- </dependency>
- </dependencies>
-
- <profiles>
- <profile>
- <id>integrationtest</id>
- <activation>
- </activation>
- <properties>
- <skip.integrationtest>false</skip.integrationtest>
- </properties>
- </profile>
- </profiles>
-</project>
+++ /dev/null
-/*
- *
- * * Copyright (C) 2014 EBay Software Foundation
- * *
- * * This program and the accompanying materials are made available under the
- * * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * * and is available at http://www.eclipse.org/legal/epl-v10.html
- * *
- * * Authors : Ashwin Raveendran
- *
- */
-
-package org.opendaylight.ovsdb.lib;
-
-/**
- * @author Ashwin Raveendran (ashwin at gmail)
- */
-public interface EchoServiceCallbackFilters {
-}
+++ /dev/null
-/*
- *
- * * Copyright (C) 2014 EBay Software Foundation
- * *
- * * This program and the accompanying materials are made available under the
- * * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * * and is available at http://www.eclipse.org/legal/epl-v10.html
- * *
- * * Authors : Ashwin Raveendran
- *
- */
-
-package org.opendaylight.ovsdb.lib;
-
-/**
- * Callback that can be registered with {@link OvsDBClient} to
- * get notified of a lock stolen.
- * @see <a href="http://tools.ietf.org/html/draft-pfaff-ovsdb-proto-04#section-4.1.10">ovsdb spec</a>
- * <p/>
- *
- * @see OvsDBClient
- */
-public interface LockAquisitionCallback {
-
- public void lockAcquired();
-
-}
+++ /dev/null
-/*
- *
- * * Copyright (C) 2014 EBay Software Foundation
- * *
- * * This program and the accompanying materials are made available under the
- * * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * * and is available at http://www.eclipse.org/legal/epl-v10.html
- * *
- * * Authors : Ashwin Raveendran
- *
- */
-
-package org.opendaylight.ovsdb.lib;
-
-/**
- * Callback that can be registered with {@link org.opendaylight.ovsdb.lib.OvsDBClient} to
- * get notified of a lock stolen.
- * @see <a href="http://tools.ietf.org/html/draft-pfaff-ovsdb-proto-04#section-4.1.10">ovsdb spec</a>
- * <p/>
- *
- * @see org.opendaylight.ovsdb.lib.OvsDBClient#lock(String, LockStolenCallback)
- */
-public interface LockStolenCallback {
-
- public void lockStolen();
-
-}
+++ /dev/null
-/*
- *
- * * Copyright (C) 2014 EBay Software Foundation
- * *
- * * This program and the accompanying materials are made available under the
- * * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * * and is available at http://www.eclipse.org/legal/epl-v10.html
- * *
- * * Authors : Ashwin Raveendran
- *
- */
-
-package org.opendaylight.ovsdb.lib;
-
-public interface MonitorCallBack {
-}
+++ /dev/null
-/*
- *
- * * Copyright (C) 2014 EBay Software Foundation
- * *
- * * This program and the accompanying materials are made available under the
- * * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * * and is available at http://www.eclipse.org/legal/epl-v10.html
- * *
- * * Authors : Ashwin Raveendran
- *
- */
-
-package org.opendaylight.ovsdb.lib;
-
-public interface MonitorHandle {
-}
+++ /dev/null
-/*
- *
- * * Copyright (C) 2014 EBay Software Foundation
- * *
- * * This program and the accompanying materials are made available under the
- * * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * * and is available at http://www.eclipse.org/legal/epl-v10.html
- * *
- * * Authors : Ashwin Raveendran
- *
- */
-
-package org.opendaylight.ovsdb.lib;
-
-import com.google.common.util.concurrent.ListenableFuture;
-import org.opendaylight.ovsdb.lib.message.MonitorRequest;
-import org.opendaylight.ovsdb.lib.operations.Operation;
-import org.opendaylight.ovsdb.lib.operations.OperationResult;
-import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
-import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
-
-import java.util.List;
-
-/**
- * The main interface to interact with a device speaking ovsdb protocol in an asynchronous fashion and hence most
- * operations return a Future object representing the eventual response data from the remote.
- */
-public interface OvsDBClient {
-
- /**
- * Represents the Open Vswitch Schema
- */
- String OPEN_VSWITCH_SCHEMA = "Open_vSwitch";
-
- /**
- * Gets the list of database names exposed by this ovsdb capable device
- * @return list of database names
- */
- ListenableFuture<List<String>> getDatabases();
-
- /**
- * Asynchronously returns the schema object for a specific database
- * @param database name of the database schema
- * @param cacheResult if the results be cached by this instance
- * @return DatabaseSchema future
- */
- ListenableFuture<DatabaseSchema> getSchema(String database, boolean cacheResult);
-
- /**
- * Allows for a mini DSL way of collecting the transactions to be executed against the ovsdb instance.
- * @return TransactionBuilder
- */
- TransactionBuilder transactBuilder();
-
- /**
- * Execute the list of operations in a single Transactions. Similar to the transactBuilder() method
- * @param operations List of operations that needs to be part of a transact call
- * @return Future object representing the result of the transaction. Calling
- * cancel on the Future would cause OVSDB cancel operation to be fired against
- * the device.
- */
- ListenableFuture<List<OperationResult>> transact(List<Operation> operations);
-
-
- /**
- * ovsdb <a href="http://tools.ietf.org/html/draft-pfaff-ovsdb-proto-04#section-4.1.5">monitor</a> operation.
- * @param monitorRequest represents what needs to be monitored including a client specified monitor handle. This
- * handle is used to later cancel ({@link #cancelMonitor(MonitorHandle)}) the monitor.
- * @param callback receives the monitor response
- */
- public void monitor(MonitorRequest monitorRequest, MonitorCallBack callback);
-
- /**
- * Cancels an existing monitor method.
- * @param handler Handle identifying a specific monitor request that is being cancelled.
- * @throws java.lang.IllegalStateException if there is no outstanding monitor request for this handle
- */
- public void cancelMonitor(MonitorHandle handler);
-
- /**
- * ovsdb <a href="http://tools.ietf.org/html/draft-pfaff-ovsdb-proto-04#section-4.1.8">lock</a> operation.
- * @param lockId a client specified id for the lock; this can be used for unlocking ({@link #unLock(String)})
- * @param lockedCallBack Callback to nofify when the lock is acquired
- * @param stolenCallback Callback to notify when an acquired lock is stolen by another client
- */
- public void lock(String lockId, LockAquisitionCallback lockedCallBack, LockStolenCallback stolenCallback);
-
- /**
- * ovsdb steal operation, see {@link #lock(String, LockAquisitionCallback, LockStolenCallback)}
- * @param lockId
- * @return
- */
- public ListenableFuture<Boolean> steal(String lockId);
-
- /**
- * ovsdb unlock operaiton, see {@link #unLock(String)}
- * @param lockId
- * @return
- */
- public ListenableFuture<Boolean> unLock(String lockId);
-
- /**
- * Starts the echo service. The {@code callbackFilters} can be used to get notified on the absence of echo
- * notifications from the remote device and control the frequency of such notifications.
- * @param callbackFilters callbacks for notifying the client of missing echo calls from remote.
- */
- public void startEchoService(EchoServiceCallbackFilters callbackFilters);
-
- /**
- * Stops the echo service, i.e echo requests from the remote would not be acknowledged after this call.
- */
- public void stopEchoService();
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2014 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran
- */
-package org.opendaylight.ovsdb.lib;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import com.google.common.util.concurrent.FutureCallback;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.SettableFuture;
-import org.opendaylight.ovsdb.lib.message.MonitorRequest;
-import org.opendaylight.ovsdb.lib.message.OvsdbRPC;
-import org.opendaylight.ovsdb.lib.message.TransactBuilder;
-import org.opendaylight.ovsdb.lib.operations.Operation;
-import org.opendaylight.ovsdb.lib.operations.OperationResult;
-import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
-import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Queue;
-import java.util.concurrent.ExecutorService;
-
-
-public class OvsDBClientImpl implements OvsDBClient {
-
- ExecutorService executorService;
- String schemaName;
- OvsdbRPC rpc;
- Map<String, DatabaseSchema> schema = Maps.newHashMap();
- Queue<Throwable> exceptions;
-
- public OvsDBClientImpl(OvsdbRPC rpc, ExecutorService executorService) {
- this.rpc = rpc;
- this.executorService = executorService;
- }
-
- public OvsDBClientImpl() {
- }
-
- @Override
- public ListenableFuture<List<OperationResult>> transact(List<Operation> operations) {
-
- //todo, we may not need transactionbuilder if we can have JSON objects
- TransactBuilder builder = new TransactBuilder();
- for (Operation o : operations) {
- builder.addOperation(o);
- }
-
- ListenableFuture<List<OperationResult>> transact = rpc.transact(builder);
- return transact;
- }
-
- @Override
- public void monitor(MonitorRequest monitorRequest, MonitorCallBack callback) {
- throw new UnsupportedOperationException("not yet implemented");
- }
-
- @Override
- public void cancelMonitor(MonitorHandle handler) {
- throw new UnsupportedOperationException("not yet implemented");
- }
-
- @Override
- public void lock(String lockId, LockAquisitionCallback lockedCallBack, LockStolenCallback stolenCallback) {
- throw new UnsupportedOperationException("not yet implemented");
- }
-
- @Override
- public ListenableFuture<Boolean> steal(String lockId) {
- throw new UnsupportedOperationException("not yet implemented");
- }
-
- @Override
- public ListenableFuture<Boolean> unLock(String lockId) {
- throw new UnsupportedOperationException("not yet implemented");
- }
-
- @Override
- public void startEchoService(EchoServiceCallbackFilters callbackFilters) {
- throw new UnsupportedOperationException("not yet implemented");
- }
-
- @Override
- public void stopEchoService() {
- throw new UnsupportedOperationException("not yet implemented");
- }
-
- @Override
- public TransactionBuilder transactBuilder() {
- return new TransactionBuilder(this);
- }
-
-
- public boolean isReady(long timeout) {
- //todo implement timeout
- return null != schema;
- }
-
- @Override
- public ListenableFuture<List<String>> getDatabases() {
- return rpc.list_dbs();
- }
-
- @Override
- public ListenableFuture<DatabaseSchema> getSchema(final String database, final boolean cacheResult) {
-
- DatabaseSchema databaseSchema = schema.get(database);
-
- if (databaseSchema == null) {
- ListenableFuture<Map<String, DatabaseSchema>> schemaFromDevice = getSchemaFromDevice(Lists.newArrayList(database));
-
- final SettableFuture<DatabaseSchema> future = SettableFuture.create();
- Futures.addCallback(schemaFromDevice, new FutureCallback<Map<String, DatabaseSchema>>() {
- @Override
- public void onSuccess(Map<String, DatabaseSchema> result) {
- if (result.containsKey(database)) {
- DatabaseSchema s = result.get(database);
- if (cacheResult) {
- OvsDBClientImpl.this.schema.put(database, s);
- }
- future.set(s);
- } else {
- future.set(null);
- }
- }
-
- @Override
- public void onFailure(Throwable t) {
- //todo: should wrap
- future.setException(t);
- }
- });
- return future;
-
- } else {
- return Futures.immediateFuture(databaseSchema);
- }
- }
-
- private ListenableFuture<Map<String, DatabaseSchema>> getSchemaFromDevice(final List<String> dbNames) {
- Map<String, DatabaseSchema> schema = Maps.newHashMap();
- SettableFuture<Map<String, DatabaseSchema>> future = SettableFuture.create();
- _populateSchema(dbNames, schema, future);
- return future;
- }
-
- private void _populateSchema(final List<String> dbNames,
- final Map<String, DatabaseSchema> schema,
- final SettableFuture<Map<String, DatabaseSchema>> sfuture) {
-
- if (dbNames == null || dbNames.isEmpty()) {
- return;
- }
-
- Futures.transform(rpc.get_schema(Lists.newArrayList(dbNames.get(0))),
- new com.google.common.base.Function<JsonNode, Void>() {
- @Override
- public Void apply(JsonNode jsonNode) {
- try{
- schema.put(dbNames.get(0), DatabaseSchema.fromJson(jsonNode));
- if (schema.size() > 1 && !sfuture.isCancelled()) {
- _populateSchema(dbNames.subList(1, dbNames.size()), schema, sfuture);
- } else if (schema.size() == 1) {
- sfuture.set(schema);
- }
- } catch (Throwable e) {
- sfuture.setException(e);
- }
- return null;
- }});
- }
-
- public void setRpc(OvsdbRPC rpc) {
- this.rpc = rpc;
- }
-
- public Queue<Throwable> getExceptions() {
- return exceptions;
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2014 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran
- */
-package org.opendaylight.ovsdb.lib.database;
-
-
-public class Column<E extends Table> {
- ColumnSchema schema;
-}
+++ /dev/null
-/*\r
- * [[ Authors will Fill in the Copyright header ]]\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Authors : Brent Salisbury, Evan Zeller\r
- */\r
-package org.opendaylight.ovsdb.lib.database;\r
-\r
-import com.fasterxml.jackson.annotation.JsonProperty;\r
-\r
-public class ColumnSchema {\r
-\r
- String name;\r
-\r
- @JsonProperty("type")\r
- private OvsdbType type;\r
-\r
- @JsonProperty("ephemeral")\r
- private Boolean ephemeral;\r
-\r
- @JsonProperty("mutable")\r
- private Boolean mutable;\r
-\r
- public OvsdbType getType() {\r
- return type;\r
- }\r
-\r
- public Boolean getEphemeral() {\r
- return ephemeral;\r
- }\r
-\r
- public Boolean getMutable() {\r
- return mutable;\r
- }\r
-\r
- public String getName() {\r
- return name;\r
- }\r
-\r
- public void setName(String name) {\r
- this.name = name;\r
- }\r
-\r
-\r
- @Override\r
- public String toString() {\r
- return "ColumnType [type=" + type + ", ephemeral=" + ephemeral\r
- + ", mutable=" + mutable + "]";\r
- }\r
-\r
-}\r
+++ /dev/null
-/*\r
- * [[ Authors will Fill in the Copyright header ]]\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Authors : Brent Salisbury, Evan Zeller\r
- */\r
-package org.opendaylight.ovsdb.lib.database;\r
-\r
-import java.util.Map;\r
-\r
-import com.fasterxml.jackson.annotation.JsonProperty;\r
-\r
-public class DatabaseSchema {\r
- @JsonProperty("name")\r
- private String name;\r
-\r
- @JsonProperty("version")\r
- private String version;\r
-\r
- @JsonProperty("cksum")\r
- private String cksum;\r
-\r
- @JsonProperty("tables")\r
- private Map<String, TableSchema> tables;\r
-\r
- public String getName() {\r
- return name;\r
- }\r
-\r
- public String getVersion() {\r
- return version;\r
- }\r
-\r
- public String getCksum() {\r
- return cksum;\r
- }\r
-\r
- public Map<String, TableSchema> getTables() {\r
- return tables;\r
- }\r
-\r
- public TableSchema getTable(String tableName) {\r
- return tables.get(tableName);\r
- }\r
-\r
- @Override\r
- public String toString() {\r
- return "DatabaseSchema [name=" + name + ", version=" + version\r
- + ", cksum=" + cksum + ", tables=" + tables + "]";\r
- }\r
-}\r
+++ /dev/null
-/*
- * [[ Authors will Fill in the Copyright header ]]
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Brent Salisbury, Evan Zeller
- */
-package org.opendaylight.ovsdb.lib.database;\r
-\r
-\r
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.opendaylight.ovsdb.plugin.Connection;
-import org.opendaylight.ovsdb.plugin.OvsdbMessage;
-\r
-public class OVSBridge {\r
-\r
- private String uuid;\r
- private String name;\r
-\r
- public OVSBridge(String uuid, String name){\r
- this.uuid = uuid;\r
- this.name = name;\r
- }\r
-\r
- public String getUuid(){\r
- return this.uuid;\r
- }\r
-\r
- public String getName(){\r
- return this.name;\r
- }\r
-\r
- @SuppressWarnings("unchecked")\r
- public static Map<String, OVSBridge> monitorBridge(Connection connection){\r
- List<String> columns = new ArrayList<String>();\r
- columns.add("_uuid");\r
- columns.add("name");\r
-\r
- Map<String, List<String>> row = new HashMap<String, List<String>>();\r
- row.put("columns", columns);\r
-\r
- Map<String, Map> tables = new HashMap<String, Map>();\r
- tables.put("Bridge", row);\r
-\r
- Object[] params = {"Open_vSwitch", null, tables};\r
-\r
- OvsdbMessage msg = new OvsdbMessage("monitor", params);\r
- Map<String, Object> monitorResponse = new HashMap<String, Object>();\r
-\r
- Map<String, Object> bridgeTable = (Map) monitorResponse.get("Bridge");\r
-\r
- Object[] uuidObjects = bridgeTable.keySet().toArray();\r
- String[] uuids = Arrays.copyOf(uuidObjects, uuidObjects.length, String[].class);\r
-\r
- Map<String, OVSBridge> result = new HashMap<String, OVSBridge>();\r
-\r
- for(String uuid : uuids){\r
- Map<String, Object> newRow = (Map) bridgeTable.get(uuid);\r
- Map<String, Object> newColumns = (Map) newRow.get("new");\r
- String name = (String) newColumns.get("name");\r
- result.put(name, new OVSBridge(uuid, name));\r
- }\r
-\r
- return result;\r
- }\r
-}\r
+++ /dev/null
-/*
- * [[ Authors will Fill in the Copyright header ]]
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Brent Salisbury, Evan Zeller
- */
-package org.opendaylight.ovsdb.lib.database;\r
-\r
-\r
-import org.opendaylight.ovsdb.plugin.Connection;\r
-import org.opendaylight.ovsdb.plugin.OvsdbMessage;\r
-\r
-import java.util.ArrayList;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-\r
-public class OVSInstance {\r
- private String uuid;\r
-\r
- public OVSInstance(){\r
- this.uuid = null;\r
- }\r
-\r
- public OVSInstance(String uuid){\r
- this.uuid = uuid;\r
- }\r
-\r
- @SuppressWarnings("unchecked")\r
- public static OVSInstance monitorOVS(Connection connection){\r
- List<String> columns = new ArrayList<String>();\r
- columns.add("_uuid");\r
- columns.add("bridges");\r
-\r
- Map<String, List<String>> row = new HashMap<String, List<String>>();\r
- row.put("columns", columns);\r
-\r
- Map<String, Map> tables = new HashMap<String, Map>();\r
- tables.put("Open_vSwitch", row);\r
-\r
- Object[] params = {"Open_vSwitch", null, tables};\r
-\r
- OvsdbMessage msg = new OvsdbMessage("monitor", params);\r
- Map<String, Object> monitorResponse = new HashMap<String, Object>();\r
-\r
- Map<String, Object> vSwitchTable = (Map) monitorResponse.get("Open_vSwitch");\r
- if(vSwitchTable != null){\r
- String uuid = (String) vSwitchTable.keySet().toArray()[0];\r
- return new OVSInstance(uuid);\r
- }\r
- return null;\r
- }\r
-\r
- public String getUuid(){\r
- return this.uuid;\r
- }\r
-\r
-}\r
+++ /dev/null
-/*
- * [[ Authors will Fill in the Copyright header ]]
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Brent Salisbury, Evan Zeller
- */
-package org.opendaylight.ovsdb.lib.database;\r
-\r
-import com.fasterxml.jackson.annotation.JsonProperty;
-\r
-\r
-public class OvsdbType {\r
- public enum PortType {\r
- VLAN("vlan"),\r
- TUNNEL("Tunnel"),\r
- BONDING("Bonding"),\r
- PATCH("patch"),\r
- INTERNAL("internal");\r
-\r
- private PortType(String name) {\r
- this.name = name;\r
- }\r
-\r
- private String name;\r
-\r
- @Override
- public String toString() {\r
- return name;\r
- }\r
- }\r
- public OvsdbType(String type){\r
- this.key = new BaseType(type);\r
- }\r
-\r
- public OvsdbType(@JsonProperty("key") BaseType key, @JsonProperty("value") BaseType value,\r
- @JsonProperty("min") Integer min, @JsonProperty("max") Object max){\r
- this.key = key;\r
- this.value = value;\r
- this.min = min;\r
- this.max = max;\r
- }\r
-\r
- public BaseType key;\r
- public BaseType value;\r
- public Integer min;\r
- public Object max;\r
-\r
- public static class BaseType{\r
-\r
- public BaseType(String type){\r
- this.type = type;\r
- }\r
-\r
- public BaseType(@JsonProperty("type") String type, @JsonProperty("enum") Object ovsdbEnum,\r
- @JsonProperty("minInteger") Integer minInteger, @JsonProperty("maxInteger") Integer maxInteger,\r
- @JsonProperty("minReal") Double minReal, @JsonProperty("maxReal") Double maxReal,\r
- @JsonProperty("minLength") Integer minLength, @JsonProperty("maxLength") Integer maxLength,\r
- @JsonProperty("refTable") String refTable, @JsonProperty("refType") String refType){\r
- this.type = type;\r
- this.ovsdbEnum = ovsdbEnum;\r
- this.minInteger = minInteger;\r
- this.maxInteger = maxInteger;\r
- this.minReal = minReal;\r
- this.maxReal = maxReal;\r
- this.minLength = minLength;\r
- this.maxLength = maxLength;\r
- this.refTable = refTable;\r
- this.refType = refType;\r
- }\r
-\r
- public String type;\r
- public Object ovsdbEnum;\r
- public Integer minInteger;\r
- public Integer maxInteger;\r
- public Double minReal;\r
- public Double maxReal;\r
- public Integer minLength;\r
- public Integer maxLength;\r
- public String refTable;\r
- public String refType;\r
- @Override\r
- public String toString() {\r
- return "BaseType [type=" + type + ", ovsdbEnum="\r
- + ovsdbEnum + ", minInteger=" + minInteger\r
- + ", maxInteger=" + maxInteger + ", minReal=" + minReal\r
- + ", maxReal=" + maxReal + ", minLength=" + minLength\r
- + ", maxLength=" + maxLength + ", refTable=" + refTable\r
- + ", refType=" + refType + "]";\r
- }\r
- }\r
-\r
- @Override\r
- public String toString() {\r
- return "OvsdbType [key=" + key + ", value=" + value + ", min=" + min\r
- + ", max=" + max + "]";\r
- }\r
-}\r
+++ /dev/null
-/*
- * Copyright (C) 2014 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran
- */
-package org.opendaylight.ovsdb.lib.database;
-
-
-public class Table<E extends Table> {
- TableSchema schema;
-
-
-}
+++ /dev/null
-/*\r
- * [[ Authors will Fill in the Copyright header ]]\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Authors : Brent Salisbury, Evan Zeller\r
- */\r
-package org.opendaylight.ovsdb.lib.database;\r
-\r
-import java.util.Map;\r
-\r
-import com.fasterxml.jackson.annotation.JsonProperty;\r
-\r
-public class TableSchema {\r
-\r
- @JsonProperty("columns")\r
- private Map<String, ColumnSchema> columns;\r
-\r
- @JsonProperty("maxRows")\r
- private Integer maxRows;\r
-\r
- @JsonProperty("isRoot")\r
- private Boolean isRoot;\r
-\r
- @JsonProperty("indexes")\r
- private Object indexes;\r
-\r
- public Map<String, ColumnSchema> getColumns() {\r
- return this.columns;\r
- }\r
-\r
- public ColumnSchema getColumn(String columnName) {\r
- return this.columns.get(columnName);\r
- }\r
-\r
- public Integer getMaxRows() {\r
- return maxRows;\r
- }\r
-\r
- public Boolean getIsRoot() {\r
- return isRoot;\r
- }\r
-\r
- public Object getIndexes() {\r
- return indexes;\r
- }\r
-\r
- @Override\r
- public String toString() {\r
- return "TableSchema [columns=" + columns + ", maxRows=" + maxRows\r
- + ", isRoot=" + isRoot + ", indexes=" + indexes + "]";\r
- }\r
-}\r
+++ /dev/null
-/*
- * [[ Authors will Fill in the Copyright header ]]
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Brent Salisbury, Evan Zeller
- */
-package org.opendaylight.ovsdb.lib.database;\r
-\r
-import com.fasterxml.jackson.annotation.JsonProperty;\r
-\r
-public class Uuid {\r
- @JsonProperty("uuid")\r
- public String[] uuid;\r
-}\r
+++ /dev/null
-/*
- * Copyright (C) 2013 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran
- */
-package org.opendaylight.ovsdb.lib.jsonrpc;
-
-import io.netty.channel.ChannelHandlerAdapter;
-import io.netty.channel.ChannelHandlerContext;
-import io.netty.handler.codec.TooLongFrameException;
-
-public class ExceptionHandler extends ChannelHandlerAdapter {
-
- @Override
- public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
- if ((cause instanceof InvalidEncodingException)
- || (cause instanceof TooLongFrameException)) {
-
- ctx.channel().disconnect();
- }
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran, Madhu Venugopal
- */
-package org.opendaylight.ovsdb.lib.jsonrpc;
-
-public class InvalidEncodingException extends RuntimeException {
-
- private final String actual;
-
- public InvalidEncodingException(String actual, String message) {
- super(message);
- this.actual = actual;
- }
-
- public String getActual() {
- return actual;
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran, Madhu Venugopal
- */
-package org.opendaylight.ovsdb.lib.jsonrpc;
-
-import com.google.common.collect.Lists;
-
-import java.util.List;
-
-public class JsonRpc10Request {
-
- String id;
- String method;
- List<Object> params = Lists.newArrayList();
-
- public JsonRpc10Request(String id) {
- setId(id);
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getMethod() {
- return method;
- }
-
- public void setMethod(String method) {
- this.method = method;
- }
-
- public List<Object> getParams() {
- return params;
- }
-
- public void setParams(List<Object> params) {
- this.params = params;
- }
-
- public void setParams(Object[] pararms) {
- this.params = Lists.newArrayList(pararms);
- }
-
- @Override
- public String toString() {
- return "JsonRpc10Request [id=" + id + ", method=" + method
- + ", params=" + params + "]";
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran, Madhu Venugopal
- */
-package org.opendaylight.ovsdb.lib.jsonrpc;
-
-import java.util.List;
-
-import com.google.common.collect.Lists;
-
-public class JsonRpc10Response {
-
- String id;
- String error;
- List<Object> result = Lists.newArrayList();
-
- public JsonRpc10Response(String id) {
- setId(id);
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getError() {
- return error;
- }
-
- public void setError(String error) {
- this.error = error;
- }
-
- public List<Object> getResult() {
- return result;
- }
-
- public void setResult(List<Object> result) {
- this.result = result;
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran, Madhu Venugopal
- */
-package org.opendaylight.ovsdb.lib.jsonrpc;
-
-
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.ByteBufInputStream;
-import io.netty.channel.ChannelHandlerContext;
-import io.netty.handler.codec.ByteToMessageDecoder;
-import io.netty.handler.codec.TooLongFrameException;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.fasterxml.jackson.core.JsonEncoding;
-import com.fasterxml.jackson.core.JsonFactory;
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.io.IOContext;
-import com.fasterxml.jackson.core.json.ByteSourceJsonBootstrapper;
-import com.fasterxml.jackson.core.util.BufferRecycler;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.MappingJsonFactory;
-
-/**
- * JSON RPC 1.0 compatible decoder capable of decoding JSON messages from a TCP stream.
- * The stream is framed first by inspecting the json for valid end marker (left curly)
- * and is passed to a Json parser (jackson) for converting into an object model.
- *
- * There are no JSON parsers that I am aware of that does non blocking parsing.
- * This approach avoids having to run json parser over and over again on the entire
- * stream waiting for input. Parser is invoked only when we know of a full JSON message
- * in the stream.
- */
-public class JsonRpcDecoder extends ByteToMessageDecoder {
-
- protected static final Logger logger = LoggerFactory.getLogger(JsonRpcDecoder.class);
-
- private int maxFrameLength;
-
- private JsonFactory jacksonJsonFactory = new MappingJsonFactory();
-
- private IOContext jacksonIOContext = new IOContext(new BufferRecycler(), null, false);
-
- // context for the previously read incomplete records
- private int lastRecordBytes = 0;
- private int leftCurlies = 0;
- private int rightCurlies = 0;
- private boolean inS = false;
-
- private int recordsRead;
-
- public JsonRpcDecoder(int maxFrameLength) {
- this.maxFrameLength = maxFrameLength;
- }
-
- @Override
- protected void decode(ChannelHandlerContext ctx, ByteBuf buf, List<Object> out) throws Exception {
-
- logger.trace("readable bytes {}, records read {}, incomplete record bytes {}",
- buf.readableBytes(), recordsRead, lastRecordBytes);
-
- if (lastRecordBytes == 0) {
- if (buf.readableBytes() < 4) {
- return; //wait for more data
- }
-
- skipSpaces(buf);
-
- byte[] buff = new byte[4];
- buf.getBytes(buf.readerIndex(), buff);
- ByteSourceJsonBootstrapper strapper = new ByteSourceJsonBootstrapper(jacksonIOContext, buff, 0, 4);
- JsonEncoding jsonEncoding = strapper.detectEncoding();
- if (!JsonEncoding.UTF8.equals(jsonEncoding)) {
- throw new InvalidEncodingException(jsonEncoding.getJavaName(), "currently only UTF-8 is supported");
- }
- }
-
- int i = lastRecordBytes + buf.readerIndex();
-
- for (; i < buf.writerIndex(); i++) {
- switch (buf.getByte(i)) {
- case '{':
- if (!inS) leftCurlies++;
- break;
- case '}':
- if (!inS) rightCurlies++;
- break;
- case '"': {
- if (buf.getByte(i - 1) != '\\') inS = !inS;
- break;
- }
- }
-
- if (leftCurlies != 0 && leftCurlies == rightCurlies && !inS) {
- ByteBuf slice = buf.readSlice(1 + i - buf.readerIndex());
- JsonParser jp = jacksonJsonFactory.createParser(new ByteBufInputStream(slice));
- JsonNode root = jp.readValueAsTree();
- out.add(root);
- leftCurlies = rightCurlies = lastRecordBytes = 0;
- recordsRead++;
- break;
- }
-
- if (i - buf.readerIndex() >= maxFrameLength) {
- fail(ctx, i - buf.readerIndex());
- }
- }
-
- // end of stream, save the incomplete record index to avoid reexamining the whole on next run
- if (i >= buf.writerIndex()) {
- lastRecordBytes = buf.readableBytes();
- return;
- }
- }
-
- public int getRecordsRead() {
- return recordsRead;
- }
-
- private static void skipSpaces(ByteBuf b) throws IOException {
- while (b.isReadable()) {
- int ch = b.getByte(b.readerIndex()) & 0xFF;
- if (!(ch == ' ' || ch == '\r' || ch == '\n' || ch == '\t')) {
- return;
- } else {
- b.readByte(); //move the read index
- }
- }
- }
-
-
- private void print(ByteBuf buf, String message) {
- print(buf, buf.readerIndex(), buf.readableBytes(), message == null ? "buff" : message);
- }
-
- private void print(ByteBuf buf, int startPos, int chars, String message) {
- if (null == message) message = "";
- if (startPos > buf.writerIndex()) {
- logger.trace("startPos out of bounds");
- }
- byte[] b = new byte[startPos + chars <= buf.writerIndex() ? chars : buf.writerIndex() - startPos];
- buf.getBytes(startPos, b);
- logger.trace("{} ={}", message, new String(b));
- }
-
- // copied from Netty decoder
- private void fail(ChannelHandlerContext ctx, long frameLength) {
- if (frameLength > 0) {
- ctx.fireExceptionCaught(
- new TooLongFrameException(
- "frame length exceeds " + maxFrameLength +
- ": " + frameLength + " - discarded"));
- } else {
- ctx.fireExceptionCaught(
- new TooLongFrameException(
- "frame length exceeds " + maxFrameLength +
- " - discarding"));
- }
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran, Madhu Venugopal
- */
-package org.opendaylight.ovsdb.lib.jsonrpc;
-
-import io.netty.channel.ChannelHandlerContext;
-import io.netty.handler.codec.MessageToMessageEncoder;
-
-import java.util.List;
-
-/**
- * Created with IntelliJ IDEA.
- * User: araveendrann
- * Date: 10/6/13
- * Time: 11:19 PM
- * To change this template use File | Settings | File Templates.
- */
-public class JsonRpcEncoder extends MessageToMessageEncoder<Object> {
- @Override
- protected void encode(ChannelHandlerContext ctx, Object msg, List<Object> out) throws Exception {
-
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran, Madhu Venugopal
- */
-package org.opendaylight.ovsdb.lib.jsonrpc;
-
-import io.netty.channel.Channel;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-import org.opendaylight.controller.sal.core.Node;
-import org.opendaylight.ovsdb.lib.message.OvsdbRPC;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.JavaType;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.type.TypeFactory;
-import com.google.common.collect.Maps;
-import com.google.common.reflect.Reflection;
-import com.google.common.reflect.TypeToken;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.SettableFuture;
-
-public class JsonRpcEndpoint {
-
- protected static final Logger logger = LoggerFactory.getLogger(JsonRpcEndpoint.class);
-
- public class CallContext {
- Method method;
- JsonRpc10Request request;
- SettableFuture<Object> future;
-
- public CallContext(JsonRpc10Request request, Method method, SettableFuture<Object> future) {
- this.method = method;
- this.request = request;
- this.future = future;
- }
-
- public Method getMethod() {
- return method;
- }
-
- public JsonRpc10Request getRequest() {
- return request;
- }
-
- public SettableFuture<Object> getFuture() {
- return future;
- }
- }
-
- ObjectMapper objectMapper;
- Channel nettyChannel;
- Map<String, CallContext> methodContext = Maps.newHashMap();
- Map<Node, OvsdbRPC.Callback> requestCallbacks = Maps.newHashMap();
-
- public JsonRpcEndpoint(ObjectMapper objectMapper, Channel channel) {
- this.objectMapper = objectMapper;
- this.nettyChannel = channel;
- }
-
- public <T> T getClient(final Node node, Class<T> klazz) {
-
- return Reflection.newProxy(klazz, new InvocationHandler() {
- @Override
- public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
- if (method.getName().equals(OvsdbRPC.REGISTER_CALLBACK_METHOD)) {
- if ((args == null) || args.length != 1 || !(args[0] instanceof OvsdbRPC.Callback)) return false;
- requestCallbacks.put(node, (OvsdbRPC.Callback)args[0]);
- return true;
- }
-
- JsonRpc10Request request = new JsonRpc10Request(UUID.randomUUID().toString());
- request.setMethod(method.getName());
-
- if (args != null && args.length != 0) {
- List<Object> params = null;
-
- if (args.length == 1) {
- if (args[0] instanceof Params) {
- params = ((Params) args[0]).params();
- } else if (args[0] instanceof List) {
- params = (List<Object>) args[0];
- }
-
- if (params == null) {
- throw new RuntimeException("do not understand this argument yet");
- }
- request.setParams(params);
- }
- }
-
- String s = objectMapper.writeValueAsString(request);
- logger.trace("{}", s);
-
- SettableFuture<Object> sf = SettableFuture.create();
- methodContext.put(request.getId(), new CallContext(request, method, sf));
-
- nettyChannel.writeAndFlush(s);
-
- return sf;
- }
- }
- );
- }
-
- public void processResult(JsonNode response) throws NoSuchMethodException {
-
- logger.trace("Response : {}", response.toString());
- CallContext returnCtxt = methodContext.get(response.get("id").asText());
- if (returnCtxt == null) return;
-
- if (ListenableFuture.class == returnCtxt.getMethod().getReturnType()) {
- TypeToken<?> retType = TypeToken.of(
- returnCtxt.getMethod().getGenericReturnType())
- .resolveType(ListenableFuture.class.getMethod("get").getGenericReturnType());
- JavaType javaType = TypeFactory.defaultInstance().constructType (retType.getType());
-
- JsonNode result = response.get("result");
- logger.trace("Result : {}", result.toString());
-
- Object result1 = objectMapper.convertValue(result, javaType);
- JsonNode error = response.get("error");
- if (error != null && !error.isNull()) {
- logger.error("Error : {}", error.toString());
- }
-
- returnCtxt.getFuture().set(result1);
-
- } else {
- throw new RuntimeException("donno how to deal with this");
- }
- }
-
- public void processRequest(Node node, JsonNode requestJson) {
- JsonRpc10Request request = new JsonRpc10Request(requestJson.get("id").asText());
- request.setMethod(requestJson.get("method").asText());
- logger.trace("Request : {} {}", requestJson.get("method"), requestJson.get("params"));
- OvsdbRPC.Callback callback = requestCallbacks.get(node);
- if (callback != null) {
- Method[] methods = callback.getClass().getDeclaredMethods();
- for (Method m : methods) {
- if (m.getName().equals(request.getMethod())) {
- Class<?>[] parameters = m.getParameterTypes();
- JsonNode params = requestJson.get("params");
- Object param = objectMapper.convertValue(params, parameters[1]);
- try {
- m.invoke(callback, node, param);
- } catch (IllegalAccessException | InvocationTargetException e) {
- logger.error("Unable to invoke callback " + m.getName(), e);
- }
- return;
- }
- }
- }
-
- // Echo dont need any special processing. hence handling it internally.
-
- if (request.getMethod().equals("echo")) {
- JsonRpc10Response response = new JsonRpc10Response(request.getId());
- response.setError(null);
- String s = null;
- try {
- s = objectMapper.writeValueAsString(response);
- nettyChannel.writeAndFlush(s);
- } catch (JsonProcessingException e) {
- logger.error("Exception while processing JSON string " + s, e );
- }
- return;
- }
-
- logger.error("No handler for Request : {} on {}",requestJson.toString(), node);
- }
-
- public Map<String, CallContext> getMethodContext() {
- return methodContext;
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran, Madhu Venugopal
- */
-package org.opendaylight.ovsdb.lib.jsonrpc;\r
-\r
-import com.fasterxml.jackson.databind.JsonNode;\r
-import com.google.common.base.Strings;\r
-import com.google.common.collect.Maps;\r
-import com.google.common.util.concurrent.SettableFuture;\r
-\r
-import io.netty.channel.ChannelHandlerContext;\r
-import io.netty.channel.ChannelInboundHandlerAdapter;\r
-\r
-import org.opendaylight.controller.sal.core.Node;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-\r
-import java.util.Map;\r
-\r
-public class JsonRpcServiceBinderHandler extends ChannelInboundHandlerAdapter {\r
- protected static final Logger logger = LoggerFactory.getLogger(JsonRpcServiceBinderHandler.class);\r
- Map<Object, SettableFuture<Object>> waitingForReply = Maps.newHashMap();\r
- JsonRpcEndpoint factory = null;\r
- Node node = null;\r
-\r
- public Node getNode() {\r
- return node;\r
- }\r
-\r
- public void setNode(Node node) {\r
- this.node = node;\r
- }\r
-\r
- public JsonRpcServiceBinderHandler(JsonRpcEndpoint factory) {\r
- this.factory = factory;\r
- }\r
-\r
- @Override\r
- public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {\r
-\r
- if (msg instanceof JsonNode) {\r
- JsonNode jsonNode = (JsonNode) msg;\r
-\r
- if (jsonNode.has("result")) {\r
- factory.processResult(jsonNode);\r
- } else if (jsonNode.hasNonNull("method")) {\r
- if (jsonNode.has("id") && !Strings.isNullOrEmpty(jsonNode.get("id").asText())) {\r
- factory.processRequest(node, jsonNode);\r
- }\r
- }\r
-\r
- return;\r
- }\r
-\r
- ctx.channel().close();\r
- }\r
-\r
- @Override\r
- public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {\r
- ctx.flush();\r
- }\r
-}
+++ /dev/null
-/*
- * Copyright (C) 2014 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran
- */
-package org.opendaylight.ovsdb.lib.jsonrpc;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.ObjectWriter;
-
-
-public class JsonUtils {
-
- static ObjectMapper mapper = new ObjectMapper();
-
- static ObjectWriter prettyWriter = mapper.writerWithDefaultPrettyPrinter();
-
- public static String prettyString(Object jsonNode){
- try {
- return prettyWriter.writeValueAsString(jsonNode);
- } catch (JsonProcessingException e) {
- throw new RuntimeException(e);
- }
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran
- */
-package org.opendaylight.ovsdb.lib.jsonrpc;
-
-import java.util.List;
-
-public interface Params {
- List<Object> params();
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran, Madhu Venugopal
- */
-package org.opendaylight.ovsdb.lib.message;
-
-public class EchoResponse extends Response {
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran, Madhu Venugopal
- */
-package org.opendaylight.ovsdb.lib.message;
-
-import java.io.IOException;
-
-import org.opendaylight.ovsdb.lib.operations.InsertOperation;
-
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.JsonSerializer;
-import com.fasterxml.jackson.databind.SerializerProvider;
-
-public class InsertSerializer extends JsonSerializer<InsertOperation> {
- @Override
- public void serialize(InsertOperation condition, JsonGenerator generator,
- SerializerProvider provider) throws IOException,
- JsonProcessingException {
- generator.writeStartArray();
-
- generator.writeEndArray();
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran, Madhu Venugopal
- */
-package org.opendaylight.ovsdb.lib.message;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.google.common.collect.Lists;
-
-import java.util.List;
-
-import org.opendaylight.ovsdb.lib.table.internal.Column;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-public class MonitorRequest<E> {
-
- //@JsonSerialize(contentAs = ToStringSerializer.class)
- List<Column<E>> columns;
-
- MonitorSelect select;
-
- public List<? extends Column> getColumns() {
- return columns;
- }
-
- public void setColumns(List<Column<E>> columns) {
- this.columns = columns;
- }
-
-
- public MonitorSelect getSelect() {
- return select;
- }
-
- public void setSelect(MonitorSelect select) {
- this.select = select;
- }
-
- public MonitorRequest<E> column(Column<E> column) {
- if (null == columns) {
- columns = Lists.newArrayList();
- }
- columns.add(column);
- return this;
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran, Madhu Venugopal
- */
-package org.opendaylight.ovsdb.lib.message;
-
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-
-import org.opendaylight.ovsdb.lib.jsonrpc.Params;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
-
-import java.util.List;
-import java.util.Map;
-
-public class MonitorRequestBuilder implements Params {
-
- Map<String, MonitorRequest> requests = Maps.newLinkedHashMap();
-
- @Override
- public List<Object> params() {
- return Lists.newArrayList("Open_vSwitch", null, requests);
- }
-
- public <T extends Table> MonitorRequest<T> monitor(T table) {
- MonitorRequest<T> req = new MonitorRequest<T>();
- requests.put(table.getTableName().getName(), req);
- return req;
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran, Madhu Venugopal
- */
-package org.opendaylight.ovsdb.lib.message;
-
-public class MonitorSelect {
-
- boolean inital;
- boolean insert;
- boolean delete;
- boolean modify;
-
- public boolean isInital() {
- return inital;
- }
-
- public void setInital(boolean inital) {
- this.inital = inital;
- }
-
- public boolean isInsert() {
- return insert;
- }
-
- public void setInsert(boolean insert) {
- this.insert = insert;
- }
-
- public boolean isDelete() {
- return delete;
- }
-
- public void setDelete(boolean delete) {
- this.delete = delete;
- }
-
- public boolean isModify() {
- return modify;
- }
-
- public void setModify(boolean modify) {
- this.modify = modify;
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran, Madhu Venugopal
- */
-package org.opendaylight.ovsdb.lib.message;
-
-import java.util.List;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.google.common.util.concurrent.ListenableFuture;
-
-import org.opendaylight.controller.sal.core.Node;
-import org.opendaylight.ovsdb.lib.operations.OperationResult;
-
-public interface OvsdbRPC {
- public static final String REGISTER_CALLBACK_METHOD = "registerCallback";
-
- //public ListenableFuture<DatabaseSchema> get_schema(List<String> db_names);
- public ListenableFuture<JsonNode> get_schema(List<String> db_names);
-
- public ListenableFuture<List<String>> echo();
-
- public ListenableFuture<TableUpdates> monitor(MonitorRequestBuilder request);
-
- public ListenableFuture<List<String>> list_dbs();
-
- public ListenableFuture<List<OperationResult>> transact(TransactBuilder transact);
-
- public ListenableFuture<Response> cancel(String id);
-
- public ListenableFuture<Object> monitor_cancel(Object json_value);
-
- public ListenableFuture<Object> lock(List<String> id);
-
- public ListenableFuture<Object> steal(List<String> id);
-
- public ListenableFuture<Object> unlock(List<String> id);
-
- public boolean registerCallback(Callback callback);
-
-
- public static interface Callback {
- public void update(Node node, UpdateNotification upadateNotification);
- public void locked(Node node, List<String> ids);
- public void stolen(Node node, List<String> ids);
- // ECHO is handled by JsonRPCEndpoint directly.
- // We can add Echo request here if there is a need for clients to handle it.
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran, Madhu Venugopal
- */
-package org.opendaylight.ovsdb.lib.message;
-
-public abstract class Response {
- Object error;
- Object details;
-
- public Object getError() {
- return error;
- }
-
- public void setError(Object error) {
- this.error = error;
- }
-
- public Object getDetails() {
- return details;
- }
-
- public void setDetails(Object details) {
- this.details = details;
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran, Madhu Venugopal
- */
-package org.opendaylight.ovsdb.lib.message;
-
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.google.common.collect.Maps;
-
-import java.util.Collection;
-import java.util.Map;
-
-import org.opendaylight.ovsdb.lib.table.internal.Table;
-
-
-public class TableUpdate<T extends Table> {
- /*This could have been done as a map, but doing so would expose the inner wrapper class in type signature*/
-
- Map<String, Row<T>> map = Maps.newHashMap();
-
- @JsonAnyGetter
- public Row<T> get(String rowId) {
- return map.get(rowId);
- }
-
- @JsonAnySetter
- public void set(String rowId, Row<T> value) {
- map.put(rowId, value);
- value.setId(rowId);
- }
-
- public Collection<Row<T>> getRows() {
- return map.values();
- }
-
- @Override
- public String toString() {
- return "TableUpdate [map=" + map + "]";
- }
-
- public static class Row<T> {
-
- @JsonIgnore
- String id;
-
- @JsonProperty("new")
- T _new;
- T old;
-
- public String getId() {
- return id;
- }
-
- public T getNew() {
- return _new;
- }
-
- public void setNew(T neww) {
- this._new = neww;
- }
-
- public T getOld() {
- return old;
- }
-
- public void setOld(T old) {
- this.old = old;
- }
-
- void setId(String id) {
- this.id = id;
- }
-
- @Override
- public String toString() {
- return "Row{" +
- "id='" + id + '\'' +
- ", _new=" + _new.toString() +
- '}';
- }
-
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran, Madhu Venugopal
- */
-package org.opendaylight.ovsdb.lib.message;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.google.common.collect.Maps;
-import org.opendaylight.ovsdb.lib.table.Bridge;
-import org.opendaylight.ovsdb.lib.table.Capability;
-import org.opendaylight.ovsdb.lib.table.Interface;
-import org.opendaylight.ovsdb.lib.table.Port;
-import org.opendaylight.ovsdb.lib.table.Controller;
-import org.opendaylight.ovsdb.lib.table.Manager;
-import org.opendaylight.ovsdb.lib.table.Mirror;
-import org.opendaylight.ovsdb.lib.table.NetFlow;
-import org.opendaylight.ovsdb.lib.table.Open_vSwitch;
-import org.opendaylight.ovsdb.lib.table.Qos;
-import org.opendaylight.ovsdb.lib.table.Queue;
-import org.opendaylight.ovsdb.lib.table.SFlow;
-import org.opendaylight.ovsdb.lib.table.SSL;
-import org.opendaylight.ovsdb.lib.table.Flow_Sample_Collector_Set;
-import org.opendaylight.ovsdb.lib.table.Flow_Table;
-import org.opendaylight.ovsdb.lib.table.IPFIX;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
-
-import java.util.Map;
-import java.util.Set;
-
-
-public class TableUpdates extends Response {
-
- Map<Table.Name, TableUpdate> map = Maps.newHashMap();
-
- public Set<Table.Name> availableUpdates() {
- return map.keySet();
- }
-
- @SuppressWarnings("unchecked")
- public <T extends Table> TableUpdate<T> getUpdate(Table.Name<T> name) {
- return map.get(name);
- }
-
- private <T extends Table> void put(Table.Name<T> name, TableUpdate<T> update) {
- map.put(name, update);
- }
-
- @JsonProperty("Interface")
- public TableUpdate<Interface> getInterfaceUpdate() {
- return getUpdate(Interface.NAME);
- }
-
- public void setInterfaceUpdate(TableUpdate<Interface> interfaceUpdate) {
- put(Interface.NAME, interfaceUpdate);
- }
-
- @JsonProperty("Bridge")
- TableUpdate<Bridge> getBridgeUpdate() {
- return getUpdate(Bridge.NAME);
- }
-
- public void setBridgeUpdate(TableUpdate<Bridge> bridgeUpdate) {
- put(Bridge.NAME, bridgeUpdate);
- }
-
- @JsonProperty("Port")
- TableUpdate<Port> getPortUpdate() {
- return getUpdate(Port.NAME);
- }
-
- void setPortUpdate(TableUpdate<Port> portUpdate) {
- put(Port.NAME, portUpdate);
- }
-
- @JsonProperty("Capability")
- public TableUpdate<Capability> getCapabilityUpdate() {
- return getUpdate(Capability.NAME);
- }
-
- public void setCapabilityUpdate(TableUpdate<Capability> capabilityUpdate) {
- put(Capability.NAME, capabilityUpdate);
- }
-
- @JsonProperty("Controller")
- public TableUpdate<Controller> getControllerUpdate() {
- return getUpdate(Controller.NAME);
- }
-
- public void setControllerUpdate(TableUpdate<Controller> controllerUpdate) {
- put(Controller.NAME, controllerUpdate);
- }
-
- @JsonProperty("Manager")
- public TableUpdate<Manager> getManagerUpdate() {
- return getUpdate(Manager.NAME);
- }
-
- public void setManagerUpdate(TableUpdate<Manager> managerUpdate) {
- put(Manager.NAME, managerUpdate);
- }
-
- @JsonProperty("Mirror")
- public TableUpdate<Mirror> getMirrorUpdate() {
- return getUpdate(Mirror.NAME);
- }
-
- public void setMirrorUpdate(TableUpdate<Mirror> mirrorUpdate) {
- put(Mirror.NAME, mirrorUpdate);
- }
-
- @JsonProperty("NetFlow")
- public TableUpdate<NetFlow> getNetFlowUpdate() {
- return getUpdate(NetFlow.NAME);
- }
-
- public void setNetFlowUpdate(TableUpdate<NetFlow> netFlowUpdate) {
- put(NetFlow.NAME, netFlowUpdate);
- }
-
- @JsonProperty("Open_vSwitch")
- public TableUpdate<Open_vSwitch> getOpen_vSwitchUpdate() {
- return getUpdate(Open_vSwitch.NAME);
- }
-
- public void setOpen_vSwitchUpdate(TableUpdate<Open_vSwitch> openVSwitchUpdate) {
- put(Open_vSwitch.NAME, openVSwitchUpdate);
- }
-
- @JsonProperty("QoS")
- public TableUpdate<Qos> getQosUpdate() {
- return getUpdate(Qos.NAME);
- }
-
- public void setQosUpdate(TableUpdate<Qos> qosUpdate) {
- put(Qos.NAME, qosUpdate);
- }
-
- @JsonProperty("Queue")
- public TableUpdate<Queue> getQueueUpdate() {
- return getUpdate(Queue.NAME);
- }
-
- public void setQueueUpdate(TableUpdate<Queue> queueUpdate) {
- put(Queue.NAME, queueUpdate);
- }
-
- @JsonProperty("sFlow")
- public TableUpdate<SFlow> getSFlowUpdate() {
- return getUpdate(SFlow.NAME);
- }
-
- public void setSFlowUpdate(TableUpdate<SFlow> sFlowUpdate) {
- put(SFlow.NAME, sFlowUpdate);
- }
-
- @JsonProperty("SSL")
- public TableUpdate<SSL> getSSLUpdate() {
- return getUpdate(SSL.NAME);
- }
-
- public void setSSLUpdate(TableUpdate<SSL> sslUpdate) {
- put(SSL.NAME, sslUpdate);
- }
-
- @JsonProperty("Flow_Table")
- public TableUpdate<Flow_Table> getFlow_TableUpdate() {
- return getUpdate(Flow_Table.NAME);
- }
-
- public void setFlow_TableUpdate(TableUpdate<Flow_Table> Flow_TableUpdate) {
- put(Flow_Table.NAME, Flow_TableUpdate);
- }
-
- @JsonProperty("Flow_Sample_Collector_Set")
- public TableUpdate<Flow_Sample_Collector_Set> getFlow_Sample_Collector_SetUpdate() {
- return getUpdate(Flow_Sample_Collector_Set.NAME);
- }
-
- public void setFlow_Sample_Collector_SetUpdate(TableUpdate<Flow_Sample_Collector_Set> Flow_Sample_Collector_SetUpdate) {
- put(Flow_Sample_Collector_Set.NAME, Flow_Sample_Collector_SetUpdate);
- }
-
- @JsonProperty("IPFIX")
- public TableUpdate<IPFIX> getIPFIXUpdate() {
- return getUpdate(IPFIX.NAME);
- }
-
- public void setIPFIXUpdate(TableUpdate<IPFIX> IPFIXUpdate) {
- put(IPFIX.NAME, IPFIXUpdate);
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran, Madhu Venugopal
- */
-package org.opendaylight.ovsdb.lib.message;
-
-import com.google.common.collect.Lists;
-
-import org.opendaylight.ovsdb.lib.jsonrpc.Params;
-import org.opendaylight.ovsdb.lib.operations.Operation;
-import java.util.List;
-
-public class TransactBuilder implements Params {
-
- List<Operation> requests = Lists.newArrayList();
-
- public List<Operation> getRequests() {
- return requests;
- }
-
- @Override
- public List<Object> params() {
- List<Object> lists = Lists.newArrayList((Object)"Open_vSwitch");
- lists.addAll(requests);
- return lists;
- }
-
- public void addOperations (List<Operation> o) {
- requests.addAll(o);
- }
-
- public void addOperation (Operation o) {
- requests.add(o);
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran, Madhu Venugopal
- */
-package org.opendaylight.ovsdb.lib.message;
-
-import java.util.ArrayList;
-
-import org.opendaylight.ovsdb.lib.operations.OperationResult;
-
-public class TransactResponse extends Response {
- ArrayList<OperationResult> result;
-
- public ArrayList<OperationResult> getResult() {
- return result;
- }
-
- public void setResult(ArrayList<OperationResult> result) {
- this.result = result;
- }
-
- @Override
- public String toString() {
- return "TransactResponse [result=" + result + "]";
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran, Madhu Venugopal
- */
-package org.opendaylight.ovsdb.lib.message;
-
-import org.opendaylight.ovsdb.lib.notation.json.Converter.UpdateNotificationConverter;
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
-@JsonDeserialize(converter = UpdateNotificationConverter.class)
-public class UpdateNotification {
- Object context;
- TableUpdates update;
- public Object getContext() {
- return context;
- }
- public void setContext(Object context) {
- this.context = context;
- }
- public TableUpdates getUpdate() {
- return update;
- }
- public void setUpdate(TableUpdates update) {
- this.update = update;
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 Red Hat, Inc.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Madhu Venugopal, Ashwin Raveendran
- */
-package org.opendaylight.ovsdb.lib.notation;
-
-import org.opendaylight.ovsdb.lib.notation.json.ConditionSerializer;
-
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-@JsonSerialize(using = ConditionSerializer.class)
-
-public class Condition {
- String column;
- Function function;
- Object value;
-
- public Condition(String column, Function function, Object value) {
- super();
- this.column = column;
- this.function = function;
- this.value = value;
- }
-
- public String getColumn() {
- return column;
- }
-
- public void setColumn(String column) {
- this.column = column;
- }
-
- public Function getFunction() {
- return function;
- }
-
- public void setFunction(Function function) {
- this.function = function;
- }
-
- public Object getValue() {
- return value;
- }
-
- public void setValue(Object value) {
- this.value = value;
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 Red Hat, Inc.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Madhu Venugopal, Ashwin Raveendran
- */
-package org.opendaylight.ovsdb.lib.notation;
-
-public enum Function {
- LESS_THAN("<"),
- LESS_THAN_OR_EQUALS("<="),
- EQUALS("=="),
- NOT_EQUALS("!="),
- GREATER_THAN(">="),
- GREATER_THAN_OR_EQUALS(">="),
- INCLUDES("includes"),
- EXCLUDES("excludes");
-
- private Function(String name) {
- this.name = name;
- }
-
- private String name;
-
- public String toString() {
- return name;
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 Red Hat, Inc.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Madhu Venugopal, Ashwin Raveendran
- */
-package org.opendaylight.ovsdb.lib.notation;
-
-import org.opendaylight.ovsdb.lib.notation.json.MutationSerializer;
-
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-
-@JsonSerialize(using = MutationSerializer.class)
-public class Mutation {
- String column;
- Mutator mutator;
- Object value;
-
- public Mutation(String column, Mutator mutator, Object value) {
- super();
- this.column = column;
- this.mutator = mutator;
- this.value = value;
- }
-
- public String getColumn() {
- return column;
- }
-
- public void setColumn(String column) {
- this.column = column;
- }
-
- public Mutator getMutator() {
- return mutator;
- }
-
- public void setMutator(Mutator mutator) {
- this.mutator = mutator;
- }
-
- public Object getValue() {
- return value;
- }
-
- public void setValue(Object value) {
- this.value = value;
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 Red Hat, Inc.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Madhu Venugopal, Ashwin Raveendran
- */
-package org.opendaylight.ovsdb.lib.notation;
-
-public enum Mutator {
- SUM("+="),
- DIFFERENCE("-="),
- PRODUCT("*="),
- QUOTIENT("/="),
- REMAINDER("%="),
- INSERT("insert"),
- DELETE("delete");
-
- private Mutator(String name) {
- this.name = name;
- }
-
- private String name;
-
- public String toString() {
- return name;
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran
- */
-package org.opendaylight.ovsdb.lib.notation;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import com.google.common.collect.ForwardingMap;
-import com.google.common.collect.Maps;
-
-import org.opendaylight.ovsdb.lib.notation.json.Converter;
-import org.opendaylight.ovsdb.lib.notation.json.OvsDBMapSerializer;
-
-import java.util.HashMap;
-import java.util.Map;
-
-@JsonDeserialize(converter = Converter.MapConverter.class)
-@JsonSerialize(using = OvsDBMapSerializer.class)
-public class OvsDBMap<K, V> extends ForwardingMap<K, V> {
-
- HashMap<K, V> target = Maps.newHashMap();
-
- @Override
- public Map<K, V> delegate() {
- return target;
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran
- */
-package org.opendaylight.ovsdb.lib.notation;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import com.google.common.collect.ForwardingSet;
-import com.google.common.collect.Sets;
-
-import org.opendaylight.ovsdb.lib.notation.json.Converter;
-import org.opendaylight.ovsdb.lib.notation.json.OvsDBSetSerializer;
-
-import java.util.Set;
-
-@JsonDeserialize(converter = Converter.SetConverter.class)
-@JsonSerialize(using = OvsDBSetSerializer.class)
-public class OvsDBSet<T> extends ForwardingSet<T> {
-
- Set<T> target = Sets.newHashSet();
-
- @Override
- public Set<T> delegate() {
- return target;
- }
-}
+++ /dev/null
-/*
- *
- * * Copyright (C) 2014 EBay Software Foundation
- * *
- * * This program and the accompanying materials are made available under the
- * * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * * and is available at http://www.eclipse.org/legal/epl-v10.html
- * *
- * * Authors : Ashwin Raveendran
- *
- */
-
-package org.opendaylight.ovsdb.lib.notation;
-
-import org.opendaylight.ovsdb.lib.database.ColumnSchema;
-
-import java.util.Map;
-
-public class Row {
- private Map<String, ColumnSchema> columnSchema;
- private Map<String, Object> columns;
-
-
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran, Madhu Venugopal
- */
-package org.opendaylight.ovsdb.lib.notation;
-
-import org.opendaylight.ovsdb.lib.notation.json.UUIDSerializer;
-import org.opendaylight.ovsdb.lib.notation.json.UUIDStringConverter;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-
-@JsonDeserialize(contentConverter = UUIDStringConverter.class)
-@JsonSerialize(using = UUIDSerializer.class)
-/*
- * Handles both uuid and named-uuid.
- */
-public class UUID {
- String val;
-
- public UUID(String value) {
- this.val = value;
- }
-
- @Override
- public String toString() {
- return val;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((val == null) ? 0 : val.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- UUID other = (UUID) obj;
- if (val == null) {
- if (other.val != null)
- return false;
- } else if (!val.equals(other.val))
- return false;
- return true;
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 Red Hat, Inc.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Madhu Venugopal, Ashwin Raveendran
- */
-package org.opendaylight.ovsdb.lib.notation.json;
-
-import java.io.IOException;
-
-import org.opendaylight.ovsdb.lib.notation.Condition;
-
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.JsonSerializer;
-import com.fasterxml.jackson.databind.SerializerProvider;
-
-public class ConditionSerializer extends JsonSerializer<Condition> {
- @Override
- public void serialize(Condition condition, JsonGenerator generator,
- SerializerProvider provider) throws IOException,
- JsonProcessingException {
- generator.writeStartArray();
- generator.writeString(condition.getColumn());
- generator.writeString(condition.getFunction().toString());
- generator.writeObject(condition.getValue());
- generator.writeEndArray();
- }
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright (C) 2013 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran
- */
-package org.opendaylight.ovsdb.lib.notation.json;
-
-import org.opendaylight.ovsdb.lib.message.TableUpdates;
-import org.opendaylight.ovsdb.lib.message.UpdateNotification;
-import org.opendaylight.ovsdb.lib.notation.OvsDBMap;
-import org.opendaylight.ovsdb.lib.notation.OvsDBSet;
-import org.opendaylight.ovsdb.lib.notation.UUID;
-
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.util.StdConverter;
-
-public class Converter {
-
- static AtomDeser atomDeser = new AtomDeser();
- static MapDeser mapDeser = new MapDeser();
- static SetDeser setDeser = new SetDeser();
- static UpdateNotificationDeser unDeser = new UpdateNotificationDeser();
-
- public static class MapConverter extends StdConverter<JsonNode, OvsDBMap<Object, Object>> {
- @Override
- public OvsDBMap<Object, Object> convert(JsonNode value) {
- return mapDeser.deserialize(value);
- }
- }
-
- public static class SetConverter extends StdConverter<JsonNode, OvsDBSet<Object>> {
- @Override
- public OvsDBSet<Object> convert(JsonNode value) {
- return setDeser.deserialize(value);
- }
- }
-
- public static class UpdateNotificationConverter extends StdConverter<JsonNode, UpdateNotification> {
- @Override
- public UpdateNotification convert(JsonNode value) {
- return unDeser.deserialize(value);
- }
- }
-
- static class MapDeser {
- public OvsDBMap<Object, Object> deserialize(JsonNode node) {
- if (node.isArray()) {
- if (node.size() == 2) {
- if (node.get(0).isTextual() && "map".equals(node.get(0).asText())) {
- OvsDBMap<Object, Object> map = new OvsDBMap<Object, Object>();
- for (JsonNode pairNode : node.get(1)) {
- if (pairNode.isArray() && node.size() == 2) {
- Object key = atomDeser.deserialize(pairNode.get(0));
- Object value = atomDeser.deserialize(pairNode.get(1));
- map.put(key, value);
- }
- }
- return map;
- } else if (node.size() == 0) {
- return null;
- }
- }
- }
- throw new RuntimeException("not a map type");
- }
- }
-
- static class SetDeser {
- public OvsDBSet<Object> deserialize(JsonNode node) {
- OvsDBSet<Object> set = new OvsDBSet<Object>();
- if (node.isArray()) {
- if (node.size() == 2) {
- if (node.get(0).isTextual() && "set".equals(node.get(0).asText())) {
- for (JsonNode atomNode : node.get(1)) {
- set.add(atomDeser.deserialize(atomNode));
- }
- return set;
- }
- } else if (node.size() == 0) {
- return null;
- }
- }
- //treat the whole thing as a single Atom
- Object atom = atomDeser.deserialize(node);
- if (null != atom) {
- set.add(atom);
- }
- return set;
- }
- }
-
- static class UpdateNotificationDeser {
- public UpdateNotification deserialize(JsonNode node) {
- UpdateNotification un = new UpdateNotification();
- if (node.isArray()) {
- if (node.size() == 2) {
- un.setContext(node.get(0).asText());
- ObjectMapper objectMapper = new ObjectMapper();
- objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
- TableUpdates updates = objectMapper.convertValue(node.get(1), TableUpdates.class);
- un.setUpdate(updates);
- return un;
- }
- }
- return null;
- }
- }
-
- static class AtomDeser {
-
- public Object deserialize(JsonNode node) {
- if (!node.isArray()) {
- switch (node.getNodeType()) {
- case BOOLEAN:
- return node.asBoolean();
- case NUMBER:
- if (node.isFloatingPointNumber()) {
- return node.decimalValue();
- } else {
- return node.bigIntegerValue();
- }
- case STRING:
- return node.asText();
- }
- }
-
- if (node.isArray() && node.get(0).isTextual()) {
- if ("uuid".equals(node.get(0).asText()) || "named-uuid".equals(node.get(0).asText())) {
- return new UUID(node.get(1).asText());
- }
- }
-
- throw new RuntimeException("not an atom node");
- }
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 Red Hat, Inc.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Madhu Venugopal, Ashwin Raveendran
- */
-package org.opendaylight.ovsdb.lib.notation.json;
-
-import java.io.IOException;
-
-import org.opendaylight.ovsdb.lib.notation.Mutation;
-
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.JsonSerializer;
-import com.fasterxml.jackson.databind.SerializerProvider;
-
-public class MutationSerializer extends JsonSerializer<Mutation> {
- @Override
- public void serialize(Mutation condition, JsonGenerator generator,
- SerializerProvider provider) throws IOException,
- JsonProcessingException {
- generator.writeStartArray();
- generator.writeString(condition.getColumn());
- generator.writeString(condition.getMutator().toString());
- generator.writeObject(condition.getValue());
- generator.writeEndArray();
- }
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright (C) 2013 Red Hat, Inc.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Madhu Venugopal, Ashwin Raveendran
- */
-package org.opendaylight.ovsdb.lib.notation.json;
-
-import com.fasterxml.jackson.annotation.JsonTypeInfo;
-import com.fasterxml.jackson.databind.JavaType;
-import com.fasterxml.jackson.databind.jsontype.TypeIdResolver;
-import com.fasterxml.jackson.databind.type.TypeFactory;
-
-import org.opendaylight.ovsdb.lib.notation.OvsDBSet;
-import org.opendaylight.ovsdb.lib.notation.UUID;
-
-public class OVSDBTypesIDResolver implements TypeIdResolver {
-
- private JavaType baseType;
-
- @Override
- public void init(JavaType bt) {
- this.baseType = bt;
- }
-
- @Override
- public String idFromValue(Object value) {
- throw new UnsupportedOperationException("not yet done");
- }
-
- @Override
- public String idFromValueAndType(Object value, Class<?> suggestedType) {
- throw new UnsupportedOperationException("not yet done");
- }
-
- @Override
- public String idFromBaseType() {
- throw new UnsupportedOperationException("not yet done");
- }
-
- @Override
- public JavaType typeFromId(String id) {
- if ("set".equals(id)) {
- return TypeFactory.defaultInstance().constructCollectionType(OvsDBSet.class, Object.class);
- } else if ("uuid".equals(id) || "named-uuid".equals(id)) {
- return TypeFactory.defaultInstance().constructType(UUID.class);
- }
- return null;
- }
-
- @Override
- public JsonTypeInfo.Id getMechanism() {
- throw new UnsupportedOperationException("not yet done");
- }
- }
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright (C) 2013 Red Hat, Inc.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Madhu Venugopal, Ashwin Raveendran
- */
-package org.opendaylight.ovsdb.lib.notation.json;
-
-import java.io.IOException;
-import java.util.Map;
-import org.opendaylight.ovsdb.lib.notation.OvsDBMap;
-
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.JsonSerializer;
-import com.fasterxml.jackson.databind.SerializerProvider;
-
-public class OvsDBMapSerializer extends JsonSerializer<OvsDBMap<?,?>> {
- @Override
- public void serialize(OvsDBMap<?,?> map, JsonGenerator generator,
- SerializerProvider provider) throws IOException,
- JsonProcessingException {
- generator.writeStartArray();
- generator.writeString("map");
- generator.writeStartArray();
- Map<?,?> javaMap = map.delegate();
- for (Object t : javaMap.keySet()) {
- generator.writeStartArray();
- generator.writeObject(t);
- generator.writeObject(javaMap.get(t));
- generator.writeEndArray();
- }
- generator.writeEndArray();
- generator.writeEndArray();
- }
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright (C) 2013 Red Hat, Inc.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Madhu Venugopal, Ashwin Raveendran
- */
-package org.opendaylight.ovsdb.lib.notation.json;
-
-import java.io.IOException;
-import java.util.Set;
-
-import org.opendaylight.ovsdb.lib.notation.OvsDBSet;
-
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.JsonSerializer;
-import com.fasterxml.jackson.databind.SerializerProvider;
-
-public class OvsDBSetSerializer extends JsonSerializer<OvsDBSet<?>> {
- @Override
- public void serialize(OvsDBSet<?> set, JsonGenerator generator,
- SerializerProvider provider) throws IOException,
- JsonProcessingException {
- generator.writeStartArray();
- generator.writeString("set");
- generator.writeStartArray();
- Set<?> javaSet = set.delegate();
- for (Object t : javaSet) {
- generator.writeObject(t);
- }
- generator.writeEndArray();
- generator.writeEndArray();
- }
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright (C) 2013 Red Hat, Inc.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Madhu Venugopal, Ashwin Raveendran
- */
-package org.opendaylight.ovsdb.lib.notation.json;
-
-import java.io.IOException;
-
-import org.opendaylight.ovsdb.lib.notation.UUID;
-
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.JsonSerializer;
-import com.fasterxml.jackson.databind.SerializerProvider;
-
-public class UUIDSerializer extends JsonSerializer<UUID> {
- @Override
- public void serialize(UUID value, JsonGenerator generator,
- SerializerProvider provider) throws IOException,
- JsonProcessingException {
- generator.writeStartArray();
- try {
- java.util.UUID.fromString(value.toString());
- generator.writeString("uuid");
- } catch (IllegalArgumentException ex) {
- generator.writeString("named-uuid");
- }
- generator.writeString(value.toString());
- generator.writeEndArray();
- }
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright (C) 2013 Red Hat, Inc.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Madhu Venugopal, Ashwin Raveendran
- */
-package org.opendaylight.ovsdb.lib.notation.json;
-
-import com.fasterxml.jackson.databind.util.StdConverter;
-
-import org.opendaylight.ovsdb.lib.notation.UUID;
-
-public class UUIDStringConverter extends StdConverter<String, UUID> {
-
- @Override
- public UUID convert(String value) {
- return new UUID(value);
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 Red Hat, Inc.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Madhu Venugopal
- */
-package org.opendaylight.ovsdb.lib.operations;
-
-public class AbortOperation extends Operation {
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 Red Hat, Inc.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Madhu Venugopal
- */
-package org.opendaylight.ovsdb.lib.operations;
-
-public class AssertOperation extends Operation {
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 Red Hat, Inc.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Madhu Venugopal
- */
-package org.opendaylight.ovsdb.lib.operations;
-
-public class CommentOperation extends Operation {
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 Red Hat, Inc.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Madhu Venugopal
- */
-package org.opendaylight.ovsdb.lib.operations;
-
-public class CommitOperation extends Operation {
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2014 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran
- */
-package org.opendaylight.ovsdb.lib.operations;
-
-import org.opendaylight.ovsdb.lib.notation.Condition;
-
-/**
- * Represents an Operation type that accepts a condition, for e.g Update, Select etc
- */
-public interface ConditionalOperation {
-
- public void addCondition(Condition condition);
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 Red Hat, Inc.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Madhu Venugopal
- */
-package org.opendaylight.ovsdb.lib.operations;
-
-import java.util.List;
-
-import org.opendaylight.ovsdb.lib.notation.Condition;
-//TODO Madhu : This is not complete. Getting it in to enable other committers to make progress
-public class DeleteOperation extends Operation {
- String table;
- List<Condition> where;
-
- public DeleteOperation(String table, List<Condition> where) {
- super();
- super.setOp("delete");
- this.table = table;
- this.where = where;
- }
- public String getTable() {
- return table;
- }
- public void setTable(String table) {
- this.table = table;
- }
- public List<Condition> getWhere() {
- return where;
- }
- public void setWhere(List<Condition> where) {
- this.where = where;
- }
- @Override
- public String toString() {
- return "DeleteOperation [table=" + table + ", where=" + where
- + ", toString()=" + super.toString() + "]";
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2014 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran
- */
-package org.opendaylight.ovsdb.lib.operations;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.google.common.collect.Maps;
-import org.opendaylight.ovsdb.lib.schema.ColumnSchema;
-import org.opendaylight.ovsdb.lib.schema.TableSchema;
-
-import java.util.Map;
-
-
-public class Insert<E extends TableSchema<E>> extends Operation<E> {
-
- public static final String INSERT = "insert";
-
- String uuid;
-
- @JsonProperty("uuid-name")
- private String uuidName;
-
- private Map<String, Object> row = Maps.newHashMap();
-
- public Insert on(TableSchema schema){
- this.setTableSchema(schema);
- return this;
- }
-
- public Insert withId(String name) {
- this.uuidName = name;
- this.setOp(INSERT);
- return this;
- }
-
-
- public Insert(TableSchema<E> schema) {
- super(schema, INSERT);
- }
-
- public <D, C extends TableSchema<C>> Insert<E> value(ColumnSchema<C, D> columnSchema, D value) {
- row.put(columnSchema.getName(), value);
- return this;
- }
-
- public String getUuid() {
- return uuid;
- }
-
- public void setUuid(String uuid) {
- this.uuid = uuid;
- }
-
- public String getUuidName() {
- return uuidName;
- }
-
- public void setUuidName(String uuidName) {
- this.uuidName = uuidName;
- }
-
- public Map<String, Object> getRow() {
- return row;
- }
-
- public void setRow(Map<String, Object> row) {
- this.row = row;
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 Red Hat, Inc.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Madhu Venugopal
- */
-package org.opendaylight.ovsdb.lib.operations;
-
-import org.opendaylight.ovsdb.lib.table.internal.Table;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-// TODO Madhu : This is not complete. Getting it in to enable other committers to make progress
-public class InsertOperation extends Operation {
- String table;
- @JsonProperty("uuid-name")
- public String uuidName;
- public Table<?> row;
-
- public InsertOperation() {
- super();
- super.setOp("insert");
- }
-
- public InsertOperation(String table, String uuidName,
- Table<?> row) {
- this();
- this.table = table;
- this.uuidName = uuidName;
- this.row = row;
- }
-
- public String getTable() {
- return table;
- }
-
- public void setTable(String table) {
- this.table = table;
- }
-
- public String getUuidName() {
- return uuidName;
- }
-
- public void setUuidName(String uuidName) {
- this.uuidName = uuidName;
- }
-
- public Table<?> getRow() {
- return row;
- }
-
- public void setRow(Table<?> row) {
- this.row = row;
- }
-
- @Override
- public String toString() {
- return "InsertOperation [table=" + table + ", uuidName=" + uuidName
- + ", row=" + row + ", toString()=" + super.toString() + "]";
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 Red Hat, Inc.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Madhu Venugopal
- */
-package org.opendaylight.ovsdb.lib.operations;
-
-import java.util.List;
-
-import org.opendaylight.ovsdb.lib.notation.Condition;
-import org.opendaylight.ovsdb.lib.notation.Mutation;
-
-public class MutateOperation extends Operation {
- String table;
- List<Condition> where;
- List<Mutation> mutations;
-
- public MutateOperation(String table, List<Condition> where,
- List<Mutation> mutations) {
- super();
- super.setOp("mutate");
- this.table = table;
- this.where = where;
- this.mutations = mutations;
- }
-
- public String getTable() {
- return table;
- }
-
- public void setTable(String table) {
- this.table = table;
- }
-
- public List<Condition> getWhere() {
- return where;
- }
-
- public void setWhere(List<Condition> where) {
- this.where = where;
- }
-
- public List<Mutation> getMutations() {
- return mutations;
- }
-
- public void setMutations(List<Mutation> mutations) {
- this.mutations = mutations;
- }
-
- @Override
- public String toString() {
- return "MutateOperation [table=" + table + ", where=" + where
- + ", mutations=" + mutations + ", toString()="
- + super.toString() + "]";
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 Red Hat, Inc.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Madhu Venugopal, Ashwin Raveendran
- */
-package org.opendaylight.ovsdb.lib.operations;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import org.opendaylight.ovsdb.lib.schema.TableSchema;
-
-public abstract class Operation<E extends TableSchema<E>> {
-
- @JsonIgnore
- private TableSchema<E> tableSchema;
-
- private String op;
-
- @JsonIgnore
- //todo(Ashwin): remove this
- // Just a simple way to retain the result of a transact operation which the client can refer to.
- private OperationResult result;
-
-
- protected Operation() {
- }
-
- protected Operation(TableSchema<E> tableSchema) {
- this.tableSchema = tableSchema;
- }
-
- public Operation(TableSchema<E> schema, String operation) {
- this.tableSchema = schema;
- this.op = operation;
- }
-
- public String getOp() {
- return op;
- }
-
- public void setOp(String op) {
- this.op = op;
- }
-
- public OperationResult getResult() {
- return result;
- }
-
- public void setResult(OperationResult result) {
- this.result = result;
- }
-
- public TableSchema<E> getTableSchema() {
- return tableSchema;
- }
-
- public void setTableSchema(TableSchema<E> tableSchema) {
- this.tableSchema = tableSchema;
- }
-
- @JsonProperty
- public String getTable() {
- return tableSchema.getName();
- }
-
- @Override
- public String toString() {
- return "Operation [op=" + op + ", result=" + result + "]";
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 Red Hat, Inc.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Madhu Venugopal
- */
-package org.opendaylight.ovsdb.lib.operations;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.opendaylight.ovsdb.lib.notation.UUID;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-// Section 5.2 of ovsdb draft covers the various response structures for
-// each of the Operations covered by Transaction (Insert, Update, Delete, Mutate, etc...)
-// It is better to have the OperationResult as an abstract parent class with individual
-// concrete child classes for each of the operation response.
-// TODO : But this needs proper response handling
-// https://trello.com/c/mfTTS86k/28-generic-response-error-handling-especially-for-transact
-// As a temporary measure, adding all the expected responses under the same response.
-
-public class OperationResult {
- //public abstract boolean isSuccess();
- private int count;
- @JsonIgnore
- private UUID uuid;
- private ArrayList<Object> rows;
- private String error;
- private String details;
-
- public int getCount() {
- return count;
- }
- public void setCount(int count) {
- this.count = count;
- }
- @JsonProperty("uuid")
- public UUID getUuid() {
- return uuid;
- }
- public void setUuid(List<String> uuidList) {
- this.uuid = new UUID(uuidList.get(1));
- }
- public ArrayList<Object> getRows() {
- return rows;
- }
- public void setRows(ArrayList<Object> rows) {
- this.rows = rows;
- }
- public String getError() {
- return error;
- }
- public void setError(String error) {
- this.error = error;
- }
- public String getDetails() {
- return details;
- }
- public void setDetails(String details) {
- this.details = details;
- }
-
- @Override
- public String toString() {
- return "OperationResult [count=" + count + ", uuid=" + uuid + ", rows="
- + rows + ", error=" + error + "]";
- }
-}
+++ /dev/null
-/*
- *
- * * Copyright (C) 2014 EBay Software Foundation
- * *
- * * This program and the accompanying materials are made available under the
- * * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * * and is available at http://www.eclipse.org/legal/epl-v10.html
- * *
- * * Authors : Ashwin Raveendran
- *
- */
-
-package org.opendaylight.ovsdb.lib.operations;
-
-import org.opendaylight.ovsdb.lib.schema.TableSchema;
-
-public class Operations {
- public static Operations op = new Operations();
-
- public <E extends TableSchema<E>> Insert<E> insert(TableSchema<E> schema) {
- return new Insert<>(schema);
- }
-
- public <E extends TableSchema<E>> Update<E> update(TableSchema<E> schema) {
- return new Update<>(schema);
- }
-
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 Red Hat, Inc.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Madhu Venugopal
- */
-package org.opendaylight.ovsdb.lib.operations;
-
-import java.util.List;
-
-import org.opendaylight.ovsdb.lib.notation.Condition;
-
-public class SelectOperation extends Operation {
- String table;
- List<Condition> where;
- List<String> columns;
-
- public SelectOperation(String table, List<Condition> where, List<String> columns) {
- super();
- super.setOp("select");
- this.table = table;
- this.where = where;
- this.columns = columns;
- }
- public String getTable() {
- return table;
- }
- public void setTable(String table) {
- this.table = table;
- }
- public List<Condition> getWhere() {
- return where;
- }
- public void setWhere(List<Condition> where) {
- this.where = where;
- }
- public List<String> getColumns() {
- return columns;
- }
- public void setColumns(List<String> columns) {
- this.columns = columns;
- }
- @Override
- public String toString() {
- return "SelectOperation [table=" + table + ", where=" + where
- + ", columns=" + columns + "]";
- }
-}
+++ /dev/null
-/*
- *
- * * Copyright (C) 2014 EBay Software Foundation
- * *
- * * This program and the accompanying materials are made available under the
- * * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * * and is available at http://www.eclipse.org/legal/epl-v10.html
- * *
- * * Authors : Ashwin Raveendran
- *
- */
-
-package org.opendaylight.ovsdb.lib.operations;
-
-import com.google.common.collect.Lists;
-import com.google.common.util.concurrent.ListenableFuture;
-import org.opendaylight.ovsdb.lib.OvsDBClientImpl;
-import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class TransactionBuilder {
-
- private DatabaseSchema eDatabaseSchema;
- OvsDBClientImpl ovs;
- ArrayList<Operation> operations = Lists.newArrayList();
-
- public TransactionBuilder(OvsDBClientImpl ovs) {
- this.ovs = ovs;
- }
-
- public TransactionBuilder(DatabaseSchema eDatabaseSchema) {
- this.eDatabaseSchema = eDatabaseSchema;
- }
-
- public TransactionBuilder add(Operation operation) {
- operations.add(operation);
- return this;
- }
-
- public List<Operation> build() {
- return operations;
- }
-
- public ListenableFuture<List<OperationResult>> execute() {
- return ovs.transact(operations);
- }
-}
+++ /dev/null
-/*
- *
- * * Copyright (C) 2014 EBay Software Foundation
- * *
- * * This program and the accompanying materials are made available under the
- * * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * * and is available at http://www.eclipse.org/legal/epl-v10.html
- * *
- * * Authors : Ashwin Raveendran
- *
- */
-
-package org.opendaylight.ovsdb.lib.operations;
-
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import org.opendaylight.ovsdb.lib.notation.Condition;
-import org.opendaylight.ovsdb.lib.schema.ColumnSchema;
-import org.opendaylight.ovsdb.lib.schema.TableSchema;
-
-import java.util.List;
-import java.util.Map;
-
-public class Update<E extends TableSchema<E>> extends Operation<E> implements ConditionalOperation {
-
- Map<String, Object> row = Maps.newHashMap();
- String uuid;
- //Where where;
- List<Condition> where = Lists.newArrayList();
-
- private String uuidName;
-
- public Update(TableSchema<E> schema) {
- super(schema, "update");
- }
-
- public Update<E> on(TableSchema schema){
- return this;
- }
-
- public <T extends TableSchema<T>, D> Update<E> set(ColumnSchema<T, D> columnSchema, D value) {
- columnSchema.validate(value);
- this.row.put(columnSchema.getName(), value);
- return this;
- }
-
- public Where where(Condition condition) {
- return new Where(this);
- }
-
- public String getUuid() {
- return uuid;
- }
-
- public void setUuid(String uuid) {
- this.uuid = uuid;
- }
-
- public String getUuidName() {
- return uuidName;
- }
-
- public void setUuidName(String uuidName) {
- this.uuidName = uuidName;
- }
-
- public Map<String, Object> getRow() {
- return row;
- }
-
- public void setRow(Map<String, Object> row) {
- this.row = row;
- }
-
- @Override
- public void addCondition(Condition condition) {
- this.where.add(condition);
- }
-
- public List<Condition> getWhere() {
- return where;
- }
-
- public void setWhere(List<Condition> where) {
- this.where = where;
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 Red Hat, Inc.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Madhu Venugopal
- */
-package org.opendaylight.ovsdb.lib.operations;
-
-import java.util.List;
-
-import org.opendaylight.ovsdb.lib.notation.Condition;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
-//TODO Madhu : This is not complete. Getting it in to enable other committers to make progress
-public class UpdateOperation extends Operation {
- String table;
- List<Condition> where;
- Table<?> row;
-
- public UpdateOperation(String table, List<Condition> where, Table<?> row) {
- super();
- super.setOp("update");
- this.table = table;
- this.where = where;
- this.row = row;
- }
- public String getTable() {
- return table;
- }
- public void setTable(String table) {
- this.table = table;
- }
- public List<Condition> getWhere() {
- return where;
- }
- public void setWhere(List<Condition> where) {
- this.where = where;
- }
- public Table<?> getRow() {
- return row;
- }
- public void setRow(Table<?> row) {
- this.row = row;
- }
- @Override
- public String toString() {
- return "UpdateOperation [table=" + table + ", where=" + where
- + ", row=" + row + ", toString()=" + super.toString() + "]";
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 Red Hat, Inc.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Madhu Venugopal
- */
-package org.opendaylight.ovsdb.lib.operations;
-
-public class WaitOperation extends Operation {
-
-}
+++ /dev/null
-/*
- *
- * * Copyright (C) 2014 EBay Software Foundation
- * *
- * * This program and the accompanying materials are made available under the
- * * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * * and is available at http://www.eclipse.org/legal/epl-v10.html
- * *
- * * Authors : Ashwin Raveendran
- *
- */
-
-package org.opendaylight.ovsdb.lib.operations;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import org.opendaylight.ovsdb.lib.notation.Condition;
-import org.opendaylight.ovsdb.lib.notation.Function;
-import org.opendaylight.ovsdb.lib.schema.ColumnSchema;
-
-public class Where {
-
- @JsonIgnore
- ConditionalOperation operation;
-
- public Where() {
- }
-
- public Where(ConditionalOperation operation) {
- this.operation = operation;
- }
-
- public Where condition(Condition condition) {
- operation.addCondition(condition);
- return this;
- }
-
- public Where condition(ColumnSchema column, Function function, Object value) {
- this.condition(new Condition(column.getName(), function, value));
- return this;
- }
-
- public Where and(ColumnSchema column, Function function, Object value) {
- condition(column, function, value);
- return this;
- }
-
- public Where and(Condition condition) {
- condition(condition);
- return this;
- }
-
- public Operation operation() {
- return (Operation) this.operation;
- }
-
-}
+++ /dev/null
-/*
- *
- * * Copyright (C) 2014 EBay Software Foundation
- * *
- * * This program and the accompanying materials are made available under the
- * * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * * and is available at http://www.eclipse.org/legal/epl-v10.html
- * *
- * * Authors : Ashwin Raveendran
- *
- */
-
-package org.opendaylight.ovsdb.lib.schema;
-
-public class ATableSchema extends TableSchema<ATableSchema> {
-}
+++ /dev/null
-/*
- * Copyright (C) 2014 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran
- */
-package org.opendaylight.ovsdb.lib.schema;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.google.common.collect.Sets;
-
-import java.util.Set;
-
-public abstract class BaseType<E extends BaseType<E>> {
-
- private static BaseType[] types = new BaseType[]{
- new StringBaseType(),
- new IntegerBaseType(),
- new RealBaseType(),
- new BooleanBaseType(),
- new UuidBaseType(),
- };
-
- public static BaseType fromJson(JsonNode json, String keyorval) {
- BaseType baseType = null;
- if (json.isValueNode()) {
- for (BaseType baseTypeFactory : types) {
- String type = json.asText().trim();
- baseType = baseTypeFactory.fromString(type);
- if (baseType != null) {
- break;
- }
- }
- } else {
- if (!json.has(keyorval)) {
- throw new RuntimeException("Not a type");
- }
-
- for (BaseType baseTypeFactory : types) {
- baseType = baseTypeFactory.fromJsonNode(json.get(keyorval), keyorval);
- if (baseType != null) {
- break;
- }
- }
- }
- return baseType;
- }
-
- protected abstract E fromString(String type);
-
- protected abstract void getConstraints(E baseType, JsonNode type);
-
- protected E fromJsonNode(JsonNode type, String keyorval) {
-
- E baseType = null;
-
- //json like "string"
- if (type.isTextual()) {
- baseType = fromString(type.asText());
- if (baseType != null) {
- return baseType;
- }
- }
-
- //json like {"type" : "string", "enum": ["set", ["access", "native-tagged"]]}" for key or value
- if (type.isObject() && type.has("type")) {
- baseType = fromString(type.get("type").asText());
- if (baseType != null) {
- getConstraints(baseType, type);
- }
- }
-
- return baseType;
- }
-
- public static class IntegerBaseType extends BaseType<IntegerBaseType> {
- long min = Long.MIN_VALUE;
- long max = Long.MAX_VALUE;
- Set<Integer> enums;
-
- public IntegerBaseType fromString(String typeString) {
- return "integer".equals(typeString) ? new IntegerBaseType() : null;
- }
-
- @Override
- protected void getConstraints(IntegerBaseType baseType, JsonNode type) {
-
- JsonNode node = null;
-
- if ((node = type.get("maxInteger")) != null) {
- baseType.setMax(node.asLong());
- }
-
- if ((node = type.get("minInteger")) != null) {
- baseType.setMin(node.asLong());
- }
-
- populateEnum(type);
- }
-
- private void populateEnum(JsonNode node) {
- if (node.has("enum")) {
- Set<Long> s = Sets.newHashSet();
- JsonNode anEnum = node.get("enum").get(1);
- for (JsonNode n : anEnum) {
- s.add(n.asLong());
- }
- }
- }
-
-
- public long getMin() {
- return min;
- }
-
- public void setMin(long min) {
- this.min = min;
- }
-
- public long getMax() {
- return max;
- }
-
- public void setMax(long max) {
- this.max = max;
- }
-
- public Set<Integer> getEnums() {
- return enums;
- }
-
- public void setEnums(Set<Integer> enums) {
- this.enums = enums;
- }
-
- @Override
- public String toString() {
- return "IntegerBaseType";
- }
- }
-
- public static class RealBaseType extends BaseType<RealBaseType> {
- double min = Double.MIN_VALUE;
- double max = Double.MAX_VALUE;
- Set<Double> enums;
-
- public RealBaseType fromString(String typeString) {
- return "real".equals(typeString) ? new RealBaseType() : null;
- }
-
- @Override
- protected void getConstraints(RealBaseType baseType, JsonNode type) {
-
- JsonNode node = null;
-
- if ((node = type.get("maxReal")) != null) {
- baseType.setMax(node.asLong());
- }
-
- if ((node = type.get("minReal")) != null) {
- baseType.setMin(node.asLong());
- }
-
- populateEnum(type);
- }
-
- private void populateEnum(JsonNode node) {
- if (node.has("enum")) {
- Set<Double> s = Sets.newHashSet();
- JsonNode anEnum = node.get("enum").get(1);
- for (JsonNode n : anEnum) {
- s.add(n.asDouble());
- }
- }
- }
-
- public double getMin() {
- return min;
- }
-
- public void setMin(double min) {
- this.min = min;
- }
-
- public double getMax() {
- return max;
- }
-
- public void setMax(double max) {
- this.max = max;
- }
-
- public Set<Double> getEnums() {
- return enums;
- }
-
- public void setEnums(Set<Double> enums) {
- this.enums = enums;
- }
-
- @Override
- public String toString() {
- return "RealBaseType";
- }
- }
-
-
- public static class BooleanBaseType extends BaseType {
-
- public BooleanBaseType fromString(String typeString) {
- return "boolean".equals(typeString) ? new BooleanBaseType() : null;
- }
-
- @Override
- protected void getConstraints(BaseType baseType, JsonNode node) {
- //no op
- }
-
- @Override
- public String toString() {
- return "BooleanBaseType";
- }
- }
-
- public static class StringBaseType extends BaseType<StringBaseType> {
- int minLength = Integer.MIN_VALUE;
- int maxLength = Integer.MAX_VALUE;
- Set<String> enums;
-
- public StringBaseType fromString(String typeString) {
- return "string".equals(typeString) ? new StringBaseType() : null;
- }
-
- @Override
- protected void getConstraints(StringBaseType baseType, JsonNode type) {
-
- JsonNode node = null;
-
- if ((node = type.get("maxLength")) != null) {
- baseType.setMaxLength(node.asInt());
- }
-
- if ((node = type.get("minLength")) != null) {
- baseType.setMinLength(node.asInt());
- }
-
- populateEnum(baseType, type);
- }
-
- private void populateEnum(StringBaseType baseType, JsonNode node) {
- if (node.has("enum")) {
- Set<String> s = Sets.newHashSet();
- JsonNode anEnum = node.get("enum").get(1);
- for (JsonNode n : anEnum) {
- s.add(n.asText());
- }
- baseType.setEnums(s);
- }
- }
-
- public int getMinLength() {
- return minLength;
- }
-
- public void setMinLength(int minLength) {
- this.minLength = minLength;
- }
-
- public int getMaxLength() {
- return maxLength;
- }
-
- public void setMaxLength(int maxLength) {
- this.maxLength = maxLength;
- }
-
- public Set<String> getEnums() {
- return enums;
- }
-
- public void setEnums(Set<String> enums) {
- this.enums = enums;
- }
-
- public String toString() {
- return "StringBaseType";
- }
-
- }
-
-
- public static class UuidBaseType extends BaseType<UuidBaseType> {
- public static enum RefType {strong, weak}
-
- String refTable;
- RefType refType;
-
-
- public UuidBaseType fromString(String typeString) {
- return "uuid".equals(typeString) ? new UuidBaseType() : null;
- }
-
- @Override
- protected void getConstraints(UuidBaseType baseType, JsonNode node) {
-
- JsonNode refTable = node.get("refTable");
- baseType.setRefTable(refTable != null ? refTable.asText() : null);
-
- JsonNode refTypeJson = node.get("refType");
- baseType.setRefType(refTypeJson != null ? RefType.valueOf(refTypeJson.asText()) : RefType.strong);
-
- }
-
- public String getRefTable() {
- return refTable;
- }
-
- public void setRefTable(String refTable) {
- this.refTable = refTable;
- }
-
- public RefType getRefType() {
- return refType;
- }
-
- public void setRefType(RefType refType) {
- this.refType = refType;
- }
-
- public String toString() {
- return "UuidBaseType";
- }
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2014 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran
- */
-package org.opendaylight.ovsdb.lib.schema;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import org.opendaylight.ovsdb.lib.notation.Condition;
-import org.opendaylight.ovsdb.lib.notation.Function;
-
-
-public class ColumnSchema<E extends TableSchema<E>, D> {
- String name;
- ColumnType type;
- boolean ephemeral;
- boolean mutable;
-
- public ColumnSchema(String name, ColumnType columnType) {
- this.name = name;
- this.type = columnType;
- }
-
- public static ColumnSchema fromJson(String name, JsonNode json) {
- if (!json.isObject() || !json.has("type")) {
- //todo specific types of exception
- throw new RuntimeException("bad column schema root, expected \"type\" as child");
- }
-
- return new ColumnSchema(name, ColumnType.fromJson(json.get("type")));
- }
-
- public String getName() {
- return name;
- }
-
- public ColumnType getType() { return type; }
-
- // --- Operations on the column ----------//
-
- public Condition opEqual(D data) {
- return new Condition(this.getName(), Function.EQUALS, data);
- }
-
- public Condition opGreaterThan(D data) {
- return new Condition(this.getName(), Function.GREATER_THAN, data);
- }
-
- public Condition opLesserThan(D data) {
- return new Condition(this.getName(), Function.GREATER_THAN, data);
- }
-
- public Condition opLesserThanOrEquals(D data) {
- return new Condition(this.getName(), Function.LESS_THAN_OR_EQUALS, data);
- }
-
- // --- Operations on the column ----------//:w
-
- @Override
- public String toString() {
- return "ColumnType [type=" + type + ", ephemeral=" + ephemeral
- + ", mutable=" + mutable + "]";
- }
-
- /**
- * Validates the passed in value against the constraints set for this ColumnSchema
- * @param value
- * @throws java.lang.RuntimeException (validation exception)
- */
- public void validate(Object value)throws RuntimeException {
- //todo(type check and validate based on constraints set)
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2014 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran
- */
-package org.opendaylight.ovsdb.lib.schema;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import org.opendaylight.ovsdb.lib.jsonrpc.JsonUtils;
-
-
-public abstract class ColumnType {
- BaseType baseType;
- int min = 0;
- int max = 0;
-
- private static ColumnType columns[] = new ColumnType[]{
- new AtomicColumnType(),
- new KeyValuedColumnType()
- };
-
-
- public ColumnType() {
-
- }
-
- public ColumnType(BaseType baseType) {
- this.baseType = baseType;
- }
-
- public BaseType getBaseType() {
- return baseType;
- }
-
- /**
- "type": {
- "key": {
- "maxInteger": 4294967295,
- "minInteger": 0,
- "type": "integer"
- },
- "min": 0,
- "value": {
- "type": "uuid",
- "refTable": "Queue"
- },
- "max": "unlimited"
- }
- * @param json
- * @return
- */
- public static ColumnType fromJson(JsonNode json) {
- for (ColumnType colType : columns) {
- ColumnType columnType = colType.fromJsonNode(json);
- if (null != columnType) {
- return columnType;
- }
- }
- //todo mode to speicfic typed exception
- throw new RuntimeException(String.format("could not find the right column type %s",
- JsonUtils.prettyString(json)));
- }
-
-
- /**
- * Creates a ColumnType from the JsonNode if the type knows how to,
- * returns null otherwise
- *
- * @param json the JSONNode object that needs to converted
- * @return a valid SubType or Null (if the JsonNode does not represent
- * the subtype)
- */
- protected abstract ColumnType fromJsonNode(JsonNode json);
-
- public static class AtomicColumnType extends ColumnType {
-
- public AtomicColumnType() {
- }
-
- public AtomicColumnType(BaseType baseType1) {
- super(baseType1);
- }
-
- public AtomicColumnType fromJsonNode(JsonNode json) {
- if (json.isObject() && json.has("value")) {
- return null;
- }
- BaseType baseType = BaseType.fromJson(json, "key");
-
- return baseType != null ? new AtomicColumnType(baseType) : null;
- }
-
- }
-
- public static class KeyValuedColumnType extends ColumnType {
-
- BaseType valueType;
-
- public KeyValuedColumnType() {
- }
-
- public KeyValuedColumnType(BaseType baseType, BaseType valueType) {
- super(baseType);
- }
-
- public KeyValuedColumnType fromJsonNode(JsonNode json) {
- if (json.isValueNode() || !json.has("value")) {
- return null;
- }
- BaseType keyType = BaseType.fromJson(json, "key");
- BaseType valueType = BaseType.fromJson(json, "value");
-
- return new KeyValuedColumnType(keyType, valueType);
- }
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2014 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran
- */
-package org.opendaylight.ovsdb.lib.schema;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-
-public class DatabaseSchema {
-
- public static Logger logger = LoggerFactory.getLogger(DatabaseSchema.class);
-
- public Map<String, TableSchema> tables;
-
- public DatabaseSchema(Map<String, TableSchema> tables) {
- this.tables = tables;
- }
-
- public Set<String> getTables() {
- return this.tables.keySet();
- }
-
- public boolean hasTable(String table) {
- return this.getTables().contains(table);
- }
-
- public TableSchema getTable(String table) {
- return this.tables.get(table);
- }
-
- public static DatabaseSchema fromJson(JsonNode json) {
- if (!json.isObject() || !json.has("tables")) {
- //todo specific types of exception
- throw new RuntimeException("bad databaseschema root, expected \"tables\" as child");
- }
-
- Map<String, TableSchema> tables = new HashMap<>();
- //Iterator<Map.Entry<String,JsonNode>> fields = json.fields();
- for (Iterator<Map.Entry<String, JsonNode>> iter = json.get("tables").fields(); iter.hasNext(); ) {
- Map.Entry<String, JsonNode> table = iter.next();
- logger.debug("Read schema for table[{}]:{}", table.getKey(), table.getValue());
-
- tables.put(table.getKey(), TableSchema.fromJson(table.getKey(), table.getValue()));
- }
-
- return new DatabaseSchema(tables);
- }
-
- public TransactionBuilder beginTransaction() {
- return new TransactionBuilder(this);
- }
-
- public <E extends TableSchema<E>> TableSchema<E> table(String tableName) {
- //todo : error handling
- return tables.get(tableName);
- }
-
- public <E extends TableSchema<E>> E table(String tableName, Class<E> clazz) {
- TableSchema<E> table = table(tableName);
- return table.as(clazz);
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2014 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran
- */
-package org.opendaylight.ovsdb.lib.schema;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import org.opendaylight.ovsdb.lib.operations.Insert;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.lang.reflect.Constructor;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-
-public class TableSchema<E extends TableSchema<E>> {
-
- protected static final Logger logger = LoggerFactory.getLogger(TableSchema.class);
- private String name;
- private Map<String, ColumnSchema> columns;
-
- public TableSchema() {
- }
-
- public TableSchema(String name, Map<String, ColumnSchema> columns) {
- this.name = name;
- this.columns = columns;
- }
-
- public Set<String> getColumns() {
- return this.columns.keySet();
- }
-
- public Map<String, ColumnSchema> getColumnSchemas() {
- return columns;
- }
-
- public boolean hasColumn(String column) {
- return this.getColumns().contains(column);
- }
-
- public ColumnSchema getColumn(String column) {
- return this.columns.get(column);
- }
-
- public ColumnType getColumnType(String column) {
- return this.columns.get(column).getType();
- }
-
- public static TableSchema fromJson(String tableName, JsonNode json) {
-
- if (!json.isObject() || !json.has("columns")) {
- //todo specific types of exception
- throw new RuntimeException("bad tableschema root, expected \"columns\" as child");
- }
-
- Map<String, ColumnSchema> columns = new HashMap<>();
- for (Iterator<Map.Entry<String, JsonNode>> iter = json.get("columns").fields(); iter.hasNext(); ) {
- Map.Entry<String, JsonNode> column = iter.next();
- logger.debug("%s:%s", tableName, column.getKey());
- columns.put(column.getKey(), ColumnSchema.fromJson(column.getKey(), column.getValue()));
- }
-
- TableSchema tableSchema = new TableSchema(tableName, columns);
- return tableSchema;
- }
-
- public <E extends TableSchema<E>> E as(Class<E> clazz) {
- try {
- Constructor<E> e = clazz.getConstructor(TableSchema.class);
- return e.newInstance(this);
- } catch (Exception e) {
- throw new RuntimeException("exception constructing instance of clazz " + clazz, e);
- }
- }
-
- public Insert<E> insert() {
- return new Insert<>(this);
- }
-
- public <D> ColumnSchema<E, D> column(String column, Class<D> type) {
- //todo exception handling
- return columns.get(column);
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
-}
+++ /dev/null
-/*
- * [[ Authors will Fill in the Copyright header ]]
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Brent Salisbury, Madhu Venugopal, Evan Zeller
- */
-package org.opendaylight.ovsdb.lib.table;
-
-import org.opendaylight.ovsdb.lib.notation.OvsDBMap;
-import org.opendaylight.ovsdb.lib.notation.OvsDBSet;
-import org.opendaylight.ovsdb.lib.notation.UUID;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-public class Bridge extends Table<Bridge> {
- public static final Name<Bridge> NAME = new Name<Bridge>("Bridge"){};
- public enum Column implements org.opendaylight.ovsdb.lib.table.internal.Column<Bridge>{controller, fail_mode, name, ports}
-
- private String name;
- private OvsDBSet<UUID> ports;
- private OvsDBSet<UUID> mirrors;
- private OvsDBSet<UUID> controller;
- private OvsDBSet<String> datapath_id;
- private String datapath_type;
- private OvsDBSet<String> fail_mode;
- private OvsDBSet<UUID> sflow;
- private OvsDBSet<UUID> netflow;
- private OvsDBSet<String> protocols;
- private OvsDBMap<String, String> status;
- private Boolean stp_enable;
- private OvsDBMap<String, String> other_config;
- private OvsDBMap<String, String> external_ids;
-
- public Bridge() {
- }
-
- @Override
- @JsonIgnore
- public Name<Bridge> getTableName() {
- return NAME;
- }
-
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public OvsDBSet<UUID> getPorts() {
- return ports;
- }
-
- public void setPorts(OvsDBSet<UUID> ports) {
- this.ports = ports;
- }
-
- public OvsDBSet<UUID> getMirrors() {
- return mirrors;
- }
-
- public void setMirrors(OvsDBSet<UUID> mirrors) {
- this.mirrors = mirrors;
- }
-
- public OvsDBSet<UUID> getController() {
- return controller;
- }
-
- public void setController(OvsDBSet<UUID> controller) {
- this.controller = controller;
- }
-
- public OvsDBSet<String> getDatapath_id() {
- return datapath_id;
- }
-
- public void setDatapath_id(OvsDBSet<String> datapath_id) {
- this.datapath_id = datapath_id;
- }
-
- public String getDatapath_type() {
- return datapath_type;
- }
-
- public void setDatapath_type(String datapath_type) {
- this.datapath_type = datapath_type;
- }
-
- public OvsDBSet<String> getFail_mode() {
- return fail_mode;
- }
-
- public void setFail_mode(OvsDBSet<String> fail_mode) {
- this.fail_mode = fail_mode;
- }
-
- public void setFlow(OvsDBSet<UUID> sflow){
- this.sflow = sflow;
- }
-
- public void setNetflow(OvsDBSet<UUID> netflow){
- this.netflow = netflow;
- }
-
- public OvsDBSet<UUID> getSflow() {
- return sflow;
- }
-
- public OvsDBSet<UUID> getNetflow() {
- return netflow;
- }
-
- public OvsDBMap<String, String> getStatus() {
- return status;
- }
-
- public void setStatus(OvsDBMap<String, String> status) {
- this.status = status;
- }
-
- public Boolean getStp_enable() {
- return stp_enable;
- }
-
- public OvsDBSet<String> getProtocols() {
- return protocols;
- }
-
- public void setProtocols(OvsDBSet<String> protocols) {
- this.protocols = protocols;
- }
-
- public void setStp_enable(Boolean stp_enable) {
- this.stp_enable = stp_enable;
- }
-
- public OvsDBMap<String, String> getOther_config() {
- return other_config;
- }
-
- public void setOther_config(OvsDBMap<String, String> other_config) {
- this.other_config = other_config;
- }
-
- public OvsDBMap<String, String> getExternal_ids() {
- return external_ids;
- }
-
- public void setExternal_ids(OvsDBMap<String, String> external_ids) {
- this.external_ids = external_ids;
- }
-
- @Override
- public String toString() {
- return "Bridge [name=" + name + ", ports=" + ports + ", controller="
- + controller + ", datapath_id=" + datapath_id
- + ", datapath_type=" + datapath_type + ", fail_mode="
- + fail_mode + ", status=" + status + ", stp_enable="
- + stp_enable + ", other_config=" + other_config
- + ", external_ids=" + external_ids + "]";
- }
-}
+++ /dev/null
-/*
- * [[ Authors will Fill in the Copyright header ]]
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Brent Salisbury, Madhu Venugopal, Evan Zeller
- */
-package org.opendaylight.ovsdb.lib.table;
-
-import org.opendaylight.ovsdb.lib.notation.OvsDBMap;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-public class Capability extends Table<Capability> {
-
- public static final Name<Capability> NAME = new Name<Capability>("Capability") {};
- private OvsDBMap<String, String> details;
-
-
- public OvsDBMap<String, String> getDetails() {
- return details;
- }
-
- public void setDetails(OvsDBMap<String, String> details) {
- this.details = details;
- }
-
- @Override
- @JsonIgnore
- public Name<Capability> getTableName() {
- return NAME;
- }
-
- @Override
- public String toString() {
- return "Capability [details=" + details + "]";
- }
-}
+++ /dev/null
-/*
- * [[ Authors will Fill in the Copyright header ]]
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Brent Salisbury, Madhu Venugopal, Evan Zeller
- */
-package org.opendaylight.ovsdb.lib.table;
-
-import org.opendaylight.ovsdb.lib.table.internal.Table;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-public class Controller extends Table<Controller> {
-
- public static final Name<Controller> NAME = new Name<Controller>("Controller") {};
- private String target;
-
- public String getTarget() {
- return target;
- }
-
- public void setTarget(String target) {
- this.target = target;
- }
-
- @Override
- @JsonIgnore
- public Name<Controller> getTableName() {
- return NAME;
- }
-
- @Override
- public String toString() {
- return "Controller [target=" + target + "]";
- }
-}
+++ /dev/null
-package org.opendaylight.ovsdb.lib.table;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import org.opendaylight.ovsdb.lib.notation.OvsDBMap;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
-
-/**
- * Per ovs-vswitchd.conf.db 2.0.90
- *
- * A summary of the Flow_Sample_Collector_Set fields:
- * bridge Bridge
- * ipfix ipfix (optional)
- * external_ids map of string-string pairs
- */
-
-public class Flow_Sample_Collector_Set extends Table<Flow_Sample_Collector_Set> {
-
- public static final Name<Flow_Sample_Collector_Set> NAME = new Name<Flow_Sample_Collector_Set>("Flow_Sample_Collector_Set") {};
-
- private Integer id;
- private Bridge bridge;
- private IPFIX ipfix;
- private OvsDBMap<String, String> external_ids;
-
- public Integer getId() {
- return id;
- }
-
- public void setId(Integer id) {
- this.id = id;
- }
-
- public Bridge getBridge() {
- return bridge;
- }
-
- public void setBridge(Bridge bridge) {
- this.bridge = bridge;
- }
-
- public IPFIX getIpfix() {
- return ipfix;
- }
-
- public void setIpfix(IPFIX ipfix) {
- this.ipfix = ipfix;
- }
-
- public OvsDBMap<String, String> getExternal_ids() {
- return external_ids;
- }
-
- public void setExternal_ids(OvsDBMap<String, String> external_ids) {
- this.external_ids = external_ids;
- }
-
- @Override
- @JsonIgnore
- public Name<Flow_Sample_Collector_Set> getTableName() {
- return NAME;
- }
-
- @Override
- public String toString() {
- return "Flow_Sample_Collector_Set [" +
- "id=" + id +
- ", bridge=" + bridge +
- ", ipfix=" + ipfix +
- ", external_ids=" + external_ids +
- "]";
- }
-
- public enum Column implements org.opendaylight.ovsdb.lib.table.internal.Column<Flow_Sample_Collector_Set> {
- id,
- bridge,
- external_ids,
- }
-}
+++ /dev/null
-package org.opendaylight.ovsdb.lib.table;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import org.opendaylight.ovsdb.lib.notation.OvsDBSet;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
-
-/**
- * Per ovs-vswitchd.conf.db 2.0.90
- *
- * Summary of the Flow_Table fields:
- * name optional string
- * flow_limit integer, at least 0 (optional)
- * overflow_policy optional string, either refuse or evict
- * groups set of strings
- */
-
-public class Flow_Table extends Table<Flow_Table> {
-
- public static final Name<Flow_Table> NAME = new Name<Flow_Table>("Flow_Table") {};
-
- private String name;
- private Integer flow_limit;
- private OvsDBSet<String> overflow_policy;
- private OvsDBSet<String> groups;
-
- public Flow_Table() {
- }
-
- public Integer getFlow_limit() {
- return flow_limit;
- }
-
- public void setFlow_limit(Integer flow_limit) {
- this.flow_limit = flow_limit;
- }
-
- public OvsDBSet<String> getOverflow_policy() {
- return overflow_policy;
- }
-
- public void setOverflow_policy(OvsDBSet<String> overflow_policy) {
- this.overflow_policy = overflow_policy;
- }
-
- public OvsDBSet<String> getGroups() {
- return groups;
- }
-
- public void setGroups(OvsDBSet<String> groups) {
- this.groups = groups;
- }
-
- @Override
- @JsonIgnore
- public Name<Flow_Table> getTableName() {
- return NAME;
- }
-
- @Override
- public String toString() {
- return "Flow_Table [" +
- "name=" + name +
- ", flow_limit=" + flow_limit +
- ", overflow_policy=" + overflow_policy +
- ", groups=" + groups +
- "]";
- }
-
-
- public enum Column implements org.opendaylight.ovsdb.lib.table.internal.Column<Flow_Table> {
- name,
- flow_limit,
- overflow_policy,
- groups,
-
- }
-}
\ No newline at end of file
+++ /dev/null
-package org.opendaylight.ovsdb.lib.table;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import org.opendaylight.ovsdb.lib.notation.OvsDBMap;
-import org.opendaylight.ovsdb.lib.notation.OvsDBSet;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
-
-/**
- * Per ovs-vswitchd.conf.db 2.0.90
- *
- * Summary of the IPFIX fields:
- * targets set of 1 or more strings
- * sampling integer, in range 1 to 4,294,967,295 (optional)
- * obs_domain_id integer, in range 0 to 4,294,967,295 (optional)
- * obs_point_id integer, in range 0 to 4,294,967,295 (optional)
- * cache_active_timeout integer, in range 0 to 4,200 (optional)
- * cache_max_flows integer, in range 0 to 4,294,967,295 (optional)
- */
-
-public class IPFIX extends Table<IPFIX> {
-
- public static final Name<IPFIX> NAME = new Name<IPFIX>("IPFIX") {};
-
- private OvsDBSet<String> targets;
- private OvsDBSet<Integer> sampling;
- private Integer obs_domain_id;
- private Integer obs_point_id;
- private OvsDBSet<Integer> cache_active_timeout;
- private OvsDBSet<Integer> cache_max_flows;
- private OvsDBMap<String, String> external_ids;
-
- public IPFIX() {
- }
-
- public OvsDBSet<String> getTargets() {
- return targets;
- }
-
- public void setTargets(OvsDBSet<String> targets) {
- this.targets = targets;
- }
-
- public OvsDBSet<Integer> getSampling() {
- return sampling;
- }
-
- public void setSampling(OvsDBSet<Integer> sampling) {
- this.sampling = sampling;
- }
-
- public Integer getObs_domain_id() {
- return obs_domain_id;
- }
-
- public void setObs_domain_id(Integer obs_domain_id) {
- this.obs_domain_id = obs_domain_id;
- }
-
- public Integer getObs_point_id() {
- return obs_point_id;
- }
-
- public void setObs_point_id(Integer obs_point_id) {
- this.obs_point_id = obs_point_id;
- }
-
- public OvsDBSet<Integer> getCache_active_timeout() {
- return cache_active_timeout;
- }
-
- public void setCache_active_timeout(OvsDBSet<Integer> cache_active_timeout) {
- this.cache_active_timeout = cache_active_timeout;
- }
-
- public OvsDBSet<Integer> getCache_max_flows() {
- return cache_max_flows;
- }
-
- public void setCache_max_flows(OvsDBSet<Integer> cache_max_flows) {
- this.cache_max_flows = cache_max_flows;
- }
-
- public OvsDBMap<String, String> getExternal_ids() {
- return external_ids;
- }
-
- public void setExternal_ids(OvsDBMap<String, String> external_ids) {
- this.external_ids = external_ids;
- }
-
- @Override
- @JsonIgnore
- public Name<IPFIX> getTableName() {
- return NAME;
- }
-
- @Override
- public String toString() {
- return "IPFIX [" +
- "targets=" + targets +
- ", sampling=" + sampling +
- ", obs_domain_id=" + obs_domain_id +
- ", obs_point_id=" + obs_point_id +
- ", cache_active_timeout=" + cache_active_timeout +
- ", cache_max_flows=" + cache_max_flows +
- ", external_ids=" + external_ids +
- "]";
- }
-}
+++ /dev/null
-/*
- * [[ Authors will Fill in the Copyright header ]]
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Brent Salisbury, Madhu Venugopal, Evan Zeller
- */
-package org.opendaylight.ovsdb.lib.table;
-
-import java.math.BigInteger;
-
-import org.opendaylight.ovsdb.lib.notation.OvsDBMap;
-import org.opendaylight.ovsdb.lib.notation.OvsDBSet;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-public class Interface extends Table<Interface> {
-
- public static Name<Interface> NAME = new Name<Interface>("Interface") {};
-
- private String name;
- private OvsDBMap<String, String> options;
- private String type;
- private OvsDBSet<BigInteger> ofport;
- private OvsDBSet<String> mac;
- private OvsDBMap<String, Integer> statistics;
- private OvsDBMap<String, String> status;
- private OvsDBMap<String, String> other_config;
- private OvsDBMap<String, String> external_ids;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public OvsDBMap<String, String> getOptions() {
- return options;
- }
-
- public void setOptions(OvsDBMap<String, String> options) {
- this.options = options;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public OvsDBSet<BigInteger> getOfport() {
- return ofport;
- }
-
- public void setOfport(OvsDBSet<BigInteger> ofport) {
- this.ofport = ofport;
- }
-
- public OvsDBSet<String> getMac() {
- return mac;
- }
-
- public void setMac(OvsDBSet<String> mac) {
- this.mac = mac;
- }
-
- public OvsDBMap<String, Integer> getStatistics() {
- return statistics;
- }
-
- public void setStatistics(OvsDBMap<String, Integer> statistics) {
- this.statistics = statistics;
- }
-
- public OvsDBMap<String, String> getStatus() {
- return status;
- }
-
- public void setStatus(OvsDBMap<String, String> status) {
- this.status = status;
- }
-
- public OvsDBMap<String, String> getOther_config() {
- return other_config;
- }
-
- public void setOther_config(OvsDBMap<String, String> other_config) {
- this.other_config = other_config;
- }
-
- public OvsDBMap<String, String> getExternal_ids() {
- return external_ids;
- }
-
- public void setExternal_ids(OvsDBMap<String, String> external_ids) {
- this.external_ids = external_ids;
- }
-
- @Override
- @JsonIgnore
- public Name<Interface> getTableName() {
- return NAME;
- }
-
- @Override
- public String toString() {
- return "Interface [name=" + name + ", options=" + options + ", type="
- + type + ", ofport=" + ofport + ", mac=" + mac
- + ", statistics=" + statistics + ", status=" + status
- + ", other_config=" + other_config + ", external_ids="
- + external_ids + "]";
- }
-}
+++ /dev/null
-/*
- * [[ Authors will Fill in the Copyright header ]]
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Brent Salisbury, Madhu Venugopal, Evan Zeller
- */
-package org.opendaylight.ovsdb.lib.table;
-
-import org.opendaylight.ovsdb.lib.table.internal.Table;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-public class Manager extends Table<Manager> {
-
- public static final Name<Manager> NAME = new Name<Manager>("Manager") {};
- private String target;
-
- public String getTarget() {
- return target;
- }
-
- public void setTarget(String target) {
- this.target = target;
- }
-
- @Override
- @JsonIgnore
- public Name<Manager> getTableName() {
- return NAME;
- }
-
- @Override
- public String toString() {
- return "Manager [target=" + target + "]";
- }
-}
+++ /dev/null
-/*
- * [[ Authors will Fill in the Copyright header ]]
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Brent Salisbury, Madhu Venugopal, Evan Zeller
- */
-package org.opendaylight.ovsdb.lib.table;
-
-import org.opendaylight.ovsdb.lib.notation.OvsDBMap;
-import org.opendaylight.ovsdb.lib.notation.OvsDBSet;
-import org.opendaylight.ovsdb.lib.notation.UUID;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-public class Mirror extends Table<Mirror> {
-
- public static final Name<Mirror> NAME = new Name<Mirror>("Mirror") {};
- private String name;
- private OvsDBSet<UUID> select_src_port;
- private OvsDBSet<UUID> select_dst_port;
- private OvsDBSet<Integer> select_vlan;
- private OvsDBSet<UUID> output_port;
- private OvsDBSet<Integer> output_vlan;
- private OvsDBMap<String, Integer> statistics;
- private OvsDBMap<String, String> external_ids;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public OvsDBSet<UUID> getSelect_src_port() {
- return select_src_port;
- }
-
- public void setSelect_src_port(OvsDBSet<UUID> select_src_port) {
- this.select_src_port = select_src_port;
- }
-
- public OvsDBSet<UUID> getSelect_dst_port() {
- return select_dst_port;
- }
-
- public void setSelect_dst_port(OvsDBSet<UUID> select_dst_port) {
- this.select_dst_port = select_dst_port;
- }
-
- public OvsDBSet<Integer> getSelect_vlan() {
- return select_vlan;
- }
-
- public void setSelect_vlan(OvsDBSet<Integer> select_vlan) {
- this.select_vlan = select_vlan;
- }
-
- public OvsDBSet<UUID> getOutput_port() {
- return output_port;
- }
-
- public void setOutput_port(OvsDBSet<UUID> output_port) {
- this.output_port = output_port;
- }
-
- public OvsDBSet<Integer> getOutput_vlan() {
- return output_vlan;
- }
-
- public void setOutput_vlan(OvsDBSet<Integer> output_vlan) {
- this.output_vlan = output_vlan;
- }
-
- public OvsDBMap<String, Integer> getStatistics() {
- return statistics;
- }
-
- public void setStatistics(OvsDBMap<String, Integer> statistics) {
- this.statistics = statistics;
- }
-
- public OvsDBMap<String, String> getExternal_ids() {
- return external_ids;
- }
-
- public void setExternal_ids(OvsDBMap<String, String> external_ids) {
- this.external_ids = external_ids;
- }
-
- @Override
- @JsonIgnore
- public Name<Mirror> getTableName() {
- return NAME;
- }
-
- @Override
- public String toString() {
- return "Mirror [name=" + name + ", select_src_port=" + select_src_port
- + ", select_dst_port=" + select_dst_port + ", select_vlan="
- + select_vlan + ", output_port=" + output_port
- + ", output_vlan=" + output_vlan + ", statistics=" + statistics
- + ", external_ids=" + external_ids + "]";
- }
-}
+++ /dev/null
-/*
- * [[ Authors will Fill in the Copyright header ]]
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Brent Salisbury, Madhu Venugopal, Evan Zeller
- */
-package org.opendaylight.ovsdb.lib.table;
-
-import org.opendaylight.ovsdb.lib.notation.OvsDBSet;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-public class NetFlow extends Table<NetFlow> {
-
- public static final Name<NetFlow> NAME = new Name<NetFlow>("NetFlow") {};
- private OvsDBSet<String> targets;
- private Integer active_timeout;
-
- public OvsDBSet<String> getTargets() {
- return targets;
- }
-
- public Integer getActiveTimeout() {
- return active_timeout;
- }
-
- public void setTargets(OvsDBSet<String> targets) {
- this.targets = targets;
- }
-
- @Override
- @JsonIgnore
- public Name<NetFlow> getTableName() {
- return NAME;
- }
-
- @Override
- public String toString() {
- return "NetFlow [targets=" + targets + "]";
- }
-}
+++ /dev/null
-/*
- * [[ Authors will Fill in the Copyright header ]]
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Brent Salisbury, Madhu Venugopal, Evan Zeller
- */
-package org.opendaylight.ovsdb.lib.table;
-
-import org.opendaylight.ovsdb.lib.notation.OvsDBMap;
-import org.opendaylight.ovsdb.lib.notation.OvsDBSet;
-import org.opendaylight.ovsdb.lib.notation.UUID;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-public class Open_vSwitch extends Table<Open_vSwitch> {
-
- public static final Name<Open_vSwitch> NAME = new Name<Open_vSwitch>("Open_vSwitch"){};
-
- private OvsDBSet<UUID> bridges;
- private Integer curr_cfg;
- private OvsDBSet<String> db_version;
- private OvsDBSet<UUID> manager_options;
- private OvsDBMap<String, String> status;
- private Integer next_cfg;
- private OvsDBSet<String> ovs_version;
- private OvsDBSet<UUID> ssl;
- private OvsDBSet<String> system_type;
- private OvsDBSet<String> system_version;
- private OvsDBMap<String, UUID> capabilities;
- private OvsDBMap<String, String> other_config;
- private OvsDBMap<String, String> external_ids;
- private OvsDBMap<String, Integer> statistics;
-
- public Open_vSwitch() {
- }
-
- @Override
- @JsonIgnore
- public Name<Open_vSwitch> getTableName() {
- return NAME;
- }
-
- public OvsDBSet<UUID> getBridges() {
- return bridges;
- }
-
- public void setBridges(OvsDBSet<UUID> bridges) {
- this.bridges = bridges;
- }
-
- public Integer getCurr_cfg() {
- return curr_cfg;
- }
-
- public void setCurr_cfg(Integer curr_cfg) {
- this.curr_cfg = curr_cfg;
- }
-
- public OvsDBSet<String> getDb_version() {
- return db_version;
- }
-
- public void setDb_version(OvsDBSet<String> db_version) {
- this.db_version = db_version;
- }
-
- public OvsDBSet<UUID> getManager_options() {
- return manager_options;
- }
-
- public void setManager_options(OvsDBSet<UUID> manager_options) {
- this.manager_options = manager_options;
- }
-
- public OvsDBMap<String, String> getStatus() {
- return status;
- }
-
- public void setStatus(OvsDBMap<String, String> status) {
- this.status = status;
- }
-
- public Integer getNext_cfg() {
- return next_cfg;
- }
-
- public void setNext_cfg(Integer next_cfg) {
- this.next_cfg = next_cfg;
- }
-
- public OvsDBSet<String> getOvs_version() {
- return ovs_version;
- }
-
- public void setOvs_version(OvsDBSet<String> ovs_version) {
- this.ovs_version = ovs_version;
- }
-
- public OvsDBSet<UUID> getSsl() {
- return ssl;
- }
-
- public void setSsl(OvsDBSet<UUID> ssl) {
- this.ssl = ssl;
- }
-
- public OvsDBSet<String> getSystem_type() {
- return system_type;
- }
-
- public void setSystem_type(OvsDBSet<String> system_type) {
- this.system_type = system_type;
- }
-
- public OvsDBSet<String> getSystem_version() {
- return system_version;
- }
-
- public void setSystem_version(OvsDBSet<String> system_version) {
- this.system_version = system_version;
- }
-
- public OvsDBMap<String, UUID> getCapabilities() {
- return capabilities;
- }
-
- public void setCapabilities(OvsDBMap<String, UUID> capabilities) {
- this.capabilities = capabilities;
- }
-
- public OvsDBMap<String, String> getOther_config() {
- return other_config;
- }
-
- public void setOther_config(OvsDBMap<String, String> other_config) {
- this.other_config = other_config;
- }
-
- public OvsDBMap<String, String> getExternal_ids() {
- return external_ids;
- }
-
- public void setExternal_ids(OvsDBMap<String, String> external_ids) {
- this.external_ids = external_ids;
- }
-
- public OvsDBMap<String, Integer> getStatistics() {
- return statistics;
- }
-
- public void setStatistics(OvsDBMap<String, Integer> statistics) {
- this.statistics = statistics;
- }
-
- @Override
- public String toString() {
- return "Open_vSwitch [bridges=" + bridges + ", curr_cfg=" + curr_cfg
- + ", db_version=" + db_version + ", manager_options="
- + manager_options + ", status=" + status + ", next_cfg="
- + next_cfg + ", ovs_version=" + ovs_version + ", ssl=" + ssl
- + ", system_type=" + system_type + ", system_version="
- + system_version + ", capabilities=" + capabilities
- + ", other_config=" + other_config + ", external_ids="
- + external_ids + ", statistics=" + statistics + "]";
- }
-
- public enum Column implements org.opendaylight.ovsdb.lib.table.internal.Column<Open_vSwitch>{ controller, fail_mode, name, ports}
-}
+++ /dev/null
-/*
- * [[ Authors will Fill in the Copyright header ]]
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Brent Salisbury, Madhu Venugopal, Evan Zeller
- */
-package org.opendaylight.ovsdb.lib.table;
-
-import java.math.BigInteger;
-
-import org.opendaylight.ovsdb.lib.notation.OvsDBMap;
-import org.opendaylight.ovsdb.lib.notation.OvsDBSet;
-import org.opendaylight.ovsdb.lib.notation.UUID;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-public class Port extends Table<Port> {
-
- public static final Name<Port> NAME = new Name<Port>("Port") {};
-
- private String name;
- private OvsDBSet<BigInteger> tag;
- private OvsDBSet<BigInteger> trunks;
- private OvsDBSet<UUID> interfaces;
- private OvsDBSet<String> mac;
- private OvsDBSet<UUID> qos;
- private OvsDBMap<String, String> other_config;
- private OvsDBMap<String, String> external_ids;
-
- public Port() {
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public OvsDBSet<BigInteger> getTag() {
- return tag;
- }
-
- public void setTag(OvsDBSet<BigInteger> tag) {
- this.tag = tag;
- }
-
- public OvsDBSet<BigInteger> getTrunks() {
- return trunks;
- }
-
- public void setTrunks(OvsDBSet<BigInteger> trunks) {
- this.trunks = trunks;
- }
-
- public OvsDBSet<UUID> getInterfaces() {
- return interfaces;
- }
-
- public void setInterfaces(OvsDBSet<UUID> interfaces) {
- this.interfaces = interfaces;
- }
-
- public OvsDBSet<String> getMac() {
- return mac;
- }
-
- public void setMac(OvsDBSet<String> mac) {
- this.mac = mac;
- }
-
- public OvsDBSet<UUID> getQos() {
- return qos;
- }
-
- public void setQos(OvsDBSet<UUID> qos) {
- this.qos = qos;
- }
-
- public OvsDBMap<String, String> getOther_config() {
- return other_config;
- }
-
- public void setOther_config(OvsDBMap<String, String> other_config) {
- this.other_config = other_config;
- }
-
- public OvsDBMap<String, String> getExternal_ids() {
- return external_ids;
- }
-
- public void setExternal_ids(OvsDBMap<String, String> external_ids) {
- this.external_ids = external_ids;
- }
-
- @Override
- @JsonIgnore
- public Name<Port> getTableName() {
- return NAME;
- }
-
- @Override
- public String toString() {
- return "Port [name=" + name + ", tag=" + tag + ", trunks=" + trunks
- + ", interfaces=" + interfaces + ", mac=" + mac + ", qos="
- + qos + ", other_config=" + other_config + ", external_ids="
- + external_ids + "]";
- }
-
- public enum Column implements org.opendaylight.ovsdb.lib.table.internal.Column<Port> {
- interfaces,
- name,
- tag,
- trunks,
- mac,
- qos,
- statistics,
- other_config,
- external_ids}
-}
+++ /dev/null
-/*
- * [[ Authors will Fill in the Copyright header ]]
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Brent Salisbury, Madhu Venugopal, Evan Zeller
- */
-package org.opendaylight.ovsdb.lib.table;
-
-
-import org.opendaylight.ovsdb.lib.notation.OvsDBMap;
-import org.opendaylight.ovsdb.lib.notation.UUID;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-public class Qos extends Table<Qos> {
-
- public static final Name<Qos> NAME = new Name<Qos>("QoS") {};
-
- private OvsDBMap<Integer, UUID> queues;
- private String type;
- private OvsDBMap<String, String> other_config;
- private OvsDBMap<String, String> external_ids;
-
- public Qos() {
- }
-
- public OvsDBMap<Integer, UUID> getQueues() {
- return queues;
- }
-
- public void setQueues(OvsDBMap<Integer, UUID> queues) {
- this.queues = queues;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public OvsDBMap<String, String> getOther_config() {
- return other_config;
- }
-
- public void setOther_config(OvsDBMap<String, String> other_config) {
- this.other_config = other_config;
- }
-
- public OvsDBMap<String, String> getExternal_ids() {
- return external_ids;
- }
-
- public void setExternal_ids(OvsDBMap<String, String> external_ids) {
- this.external_ids = external_ids;
- }
-
- @Override
- @JsonIgnore
- public Name<Qos> getTableName() {
- return NAME;
- }
-
- @Override
- public String toString() {
- return "Qos [queues=" + queues + ", type=" + type + ", other_config="
- + other_config + ", external_ids=" + external_ids + "]";
- }
-
- public enum Column implements org.opendaylight.ovsdb.lib.table.internal.Column<Qos> {
- queues,
- type,
- other_config,
- external_ids}
-}
+++ /dev/null
-/*
- * [[ Authors will Fill in the Copyright header ]]
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Brent Salisbury, Madhu Venugopal, Evan Zeller
- */
-package org.opendaylight.ovsdb.lib.table;
-
-
-import org.opendaylight.ovsdb.lib.notation.OvsDBMap;
-import org.opendaylight.ovsdb.lib.notation.OvsDBSet;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-public class Queue extends Table<Queue> {
-
- public static final Name<Queue> NAME = new Name<Queue>("Queue") {};
-
- private OvsDBSet<Integer> dscp;
- private OvsDBMap<String, String> other_config;
- private OvsDBMap<String, String> external_ids;
-
- public Queue() {
- }
-
- public OvsDBSet<Integer> getDscp() {
- return dscp;
- }
-
- public void setDscp(OvsDBSet<Integer> dscp) {
- this.dscp = dscp;
- }
-
- public OvsDBMap<String, String> getOther_config() {
- return other_config;
- }
-
- public void setOther_config(OvsDBMap<String, String> other_config) {
- this.other_config = other_config;
- }
-
- public OvsDBMap<String, String> getExternal_ids() {
- return external_ids;
- }
-
- public void setExternal_ids(OvsDBMap<String, String> external_ids) {
- this.external_ids = external_ids;
- }
-
- @Override
- @JsonIgnore
- public Name<Queue> getTableName() {
- return NAME;
- }
-
- @Override
- public String toString() {
- return "Queue [dscp=" + dscp + ", other_config=" + other_config
- + ", external_ids=" + external_ids + "]";
- }
-
- public enum Column implements org.opendaylight.ovsdb.lib.table.internal.Column<Queue> {
- dscp,
- other_config,
- external_ids}
-}
+++ /dev/null
-/*
- * [[ Authors will Fill in the Copyright header ]]
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Brent Salisbury, Madhu Venugopal, Evan Zeller
- */
-package org.opendaylight.ovsdb.lib.table;
-
-import org.opendaylight.ovsdb.lib.notation.OvsDBMap;
-import org.opendaylight.ovsdb.lib.notation.OvsDBSet;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-public class SFlow extends Table<SFlow> {
-
- public static final Name<SFlow> NAME = new Name<SFlow>("sFlow") {};
- private OvsDBSet<String> agent;
- private OvsDBSet<String> targets;
- private OvsDBMap<String, String> external_ids;
- private OvsDBSet<Integer> header;
- private OvsDBSet<Integer> polling;
- private OvsDBSet<Integer> sampling;
-
- public OvsDBSet<String> getTargets() {
- return targets;
- }
-
- public void setTargets(OvsDBSet<String> targets) {
- this.targets = targets;
- }
-
- @Override
- @JsonIgnore
- public Name<SFlow> getTableName() {
- return NAME;
- }
-
- public OvsDBSet<String> getAgent() {
- return agent;
- }
-
- public void setAgent(OvsDBSet<String> agent) {
- this.agent = agent;
- }
-
- public OvsDBMap<String, String> getExternal_ids() {
- return external_ids;
- }
-
- public void setExternal_ids(OvsDBMap<String, String> external_ids) {
- this.external_ids = external_ids;
- }
-
- public OvsDBSet<Integer> getHeader() {
- return header;
- }
-
- public void setHeader(OvsDBSet<Integer> header) {
- this.header = header;
- }
-
- public OvsDBSet<Integer> getPolling() {
- return polling;
- }
-
- public void setPolling(OvsDBSet<Integer> polling) {
- this.polling = polling;
- }
-
- public OvsDBSet<Integer> getSampling() {
- return sampling;
- }
-
- public void setSampling(OvsDBSet<Integer> sampling) {
- this.sampling = sampling;
- }
-
- @Override
- public String toString() {
- return "SFlow [agent=" + agent + ", targets=" + targets
- + ", external_ids=" + external_ids + ", header=" + header
- + ", polling=" + polling + ", sampling=" + sampling + "]";
- }
-}
+++ /dev/null
-/*
- * [[ Authors will Fill in the Copyright header ]]
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Brent Salisbury, Madhu Venugopal, Evan Zeller
- */
-package org.opendaylight.ovsdb.lib.table;
-
-import org.opendaylight.ovsdb.lib.notation.OvsDBMap;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-public class SSL extends Table<SSL> {
-
- public static final Name<SSL> NAME = new Name<SSL>("SSL") {};
- private String ca_cert;
- private Boolean bootstrap_ca_cert;
- private String certificate;
- private String private_key;
- private OvsDBMap<String, String> external_ids;
-
- public String getCa_cert() {
- return ca_cert;
- }
- public void setCa_cert(String ca_cert) {
- this.ca_cert = ca_cert;
- }
- public OvsDBMap<String, String> getExternal_ids() {
- return external_ids;
- }
- public void setExternal_ids(OvsDBMap<String, String> external_ids) {
- this.external_ids = external_ids;
- }
- public Boolean getBootstrap_ca_cert() {
- return bootstrap_ca_cert;
- }
- public void setBootstrap_ca_cert(Boolean bootstrap_ca_cert) {
- this.bootstrap_ca_cert = bootstrap_ca_cert;
- }
- public String getCertificate() {
- return certificate;
- }
- public void setCertificate(String certificate) {
- this.certificate = certificate;
- }
- public String getPrivate_key() {
- return private_key;
- }
- public void setPrivate_key(String private_key) {
- this.private_key = private_key;
- }
-
- @Override
- @JsonIgnore
- public Name<SSL> getTableName() {
- return NAME;
- }
-
- @Override
- public String toString() {
- return "SSL [ca_cert=" + ca_cert + ", bootstrap_ca_cert="
- + bootstrap_ca_cert + ", certificate=" + certificate
- + ", private_key=" + private_key + ", external_ids="
- + external_ids + "]";
- }
-
- public enum Column implements org.opendaylight.ovsdb.lib.table.internal.Column<SSL> {
- ca_cert,
- bootstrap_ca_cert,
- certificate,
- private_key,
- external_ids}
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 Ebay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran
- */
-package org.opendaylight.ovsdb.lib.table.internal;
-
-
-public interface Column<E> {
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 Ebay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran
- */
-package org.opendaylight.ovsdb.lib.table.internal;
-
-public abstract class Table<E extends Table> {
- public abstract Name<E> getTableName();
- @Override
- public abstract String toString();
- public Column<E> getColumns() {
- return null;
- }
-
- public static abstract class Name<E extends Table> {
- String name;
-
- protected Name(String name) {
- this.name = name;
- }
-
- public String getName() {
- return name;
- }
-
- @Override
- public String toString() {
- return "Table:" + name;
- }
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 Ebay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran
- */
-package org.opendaylight.ovsdb.lib.table.internal;
-
-import org.opendaylight.ovsdb.lib.table.Bridge;
-import org.opendaylight.ovsdb.lib.table.Capability;
-import org.opendaylight.ovsdb.lib.table.Interface;
-import org.opendaylight.ovsdb.lib.table.Port;
-import org.opendaylight.ovsdb.lib.table.Controller;
-import org.opendaylight.ovsdb.lib.table.Manager;
-import org.opendaylight.ovsdb.lib.table.Mirror;
-import org.opendaylight.ovsdb.lib.table.NetFlow;
-import org.opendaylight.ovsdb.lib.table.Open_vSwitch;
-import org.opendaylight.ovsdb.lib.table.Qos;
-import org.opendaylight.ovsdb.lib.table.Queue;
-import org.opendaylight.ovsdb.lib.table.SFlow;
-import org.opendaylight.ovsdb.lib.table.SSL;
-import org.opendaylight.ovsdb.lib.table.Flow_Sample_Collector_Set;
-import org.opendaylight.ovsdb.lib.table.Flow_Table;
-import org.opendaylight.ovsdb.lib.table.IPFIX;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class Tables {
- public static List<Table> tables = new ArrayList<Table>();
-
- static {
- tables.add(new Bridge());
- tables.add(new Port());
- tables.add(new Capability());
- tables.add(new Interface());
- tables.add(new Controller());
- tables.add(new Manager());
- tables.add(new Mirror());
- tables.add(new NetFlow());
- tables.add(new Open_vSwitch());
- tables.add(new Qos());
- tables.add(new Queue());
- tables.add(new SFlow());
- tables.add(new SSL());
- tables.add(new Flow_Sample_Collector_Set());
- tables.add(new Flow_Table());
- tables.add(new IPFIX());
- }
-
- public static List<Table> getTables() {
- return tables;
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2014 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran
- */
-package org.opendaylight.ovsdb.lib;
-
-import com.google.common.util.concurrent.ListenableFuture;
-import junit.framework.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.ovsdb.lib.message.OvsdbRPC;
-import org.opendaylight.ovsdb.lib.operations.OperationResult;
-import org.opendaylight.ovsdb.lib.schema.ATableSchema;
-import org.opendaylight.ovsdb.lib.schema.ColumnSchema;
-import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
-import org.opendaylight.ovsdb.lib.schema.TableSchema;
-import org.opendaylight.ovsdb.plugin.OvsdbTestBase;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-import static org.opendaylight.ovsdb.lib.operations.Operations.op;
-
-
-public class OvsDBClientTestIT extends OvsdbTestBase {
- Logger logger = LoggerFactory.getLogger(OvsDBClientTestIT.class);
-
- OvsDBClientImpl ovs;
-
-
-
- @Test
- public void testTransact() throws IOException, InterruptedException, ExecutionException {
-
- ListenableFuture<DatabaseSchema> schema = ovs.getSchema(OvsDBClient.OPEN_VSWITCH_SCHEMA, true);
- TableSchema<ATableSchema> bridge = schema.get().table("Bridge");
-
- for (Map.Entry<String, ColumnSchema> names : bridge.getColumnSchemas().entrySet()) {
- System.out.println("names = " + names.getKey());
- System.out.println("names.getValue().getType() = " + names.getValue().getType().getBaseType());
- }
-
- ColumnSchema<ATableSchema, String> name = bridge.column("name", String.class);
- ColumnSchema<ATableSchema, String> fail_mode = bridge.column("fail_mode", String.class);
-
- ListenableFuture<List<OperationResult>> results = ovs.transactBuilder()
- .add(op.insert(bridge).value(name, "br-int"))
- .add(op.update(bridge)
- .set(fail_mode, "secure")
- .where(name.opEqual("br-int"))
- //.and(name.opEqual("br-int"))
- .operation())
- .execute();
-
- List<OperationResult> operationResults = results.get();
- Assert.assertFalse(operationResults.isEmpty());
- System.out.println("operationResults = " + operationResults);
- }
-
- @Test
- public void testGetDBs() throws ExecutionException, InterruptedException {
- ListenableFuture<List<String>> databases = ovs.getDatabases();
- List<String> dbNames = databases.get();
- Assert.assertNotNull(dbNames);
- Assert.assertTrue(dbNames.size() > 0);
- }
-
- @Before
- public void initalize() throws IOException {
- if (ovs != null) {
- return;
- }
- TestObjects testConnection = getTestConnection();
- OvsdbRPC rpc = testConnection.connectionService.getConnection(testConnection.node).getRpc();
-
- ExecutorService executorService = Executors.newFixedThreadPool(3);
- ovs = new OvsDBClientImpl(rpc, executorService);
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2014 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran
- */
-package org.opendaylight.ovsdb.lib;
-
-import com.google.common.util.concurrent.ListenableFuture;
-import junit.framework.Assert;
-import org.junit.Test;
-import org.opendaylight.ovsdb.lib.message.OvsdbRPC;
-import org.opendaylight.ovsdb.lib.operations.OperationResult;
-import org.opendaylight.ovsdb.lib.schema.ColumnSchema;
-import org.opendaylight.ovsdb.lib.schema.TableSchema;
-import org.opendaylight.ovsdb.lib.schema.temp.Reference;
-import org.opendaylight.ovsdb.plugin.OvsdbTestBase;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-import static org.opendaylight.ovsdb.lib.operations.Operations.op;
-
-public class OvsDBClientTestITTyped extends OvsdbTestBase {
-
- Logger logger = LoggerFactory.getLogger(OvsDBClientTestITTyped.class);
-
-
- static class Bridge extends TableSchema<Bridge> {
-
- Bridge(String name, Map<String, ColumnSchema> columns) {
- super(name, columns);
- }
-
- public ColumnSchema<Bridge, String> name() {
- return column("name", String.class);
- }
-
- public ColumnSchema<Bridge, Integer> floodVlans() {
- return column("flood_vlans", Integer.class);
- }
-
- public ColumnSchema<Bridge, String> status() {
- return column("status", String.class);
- }
-
- public ColumnSchema<Bridge, Reference> netflow() {
- return column("netflow", Reference.class);
- }
- }
-
-
- @Test
- public void test() throws IOException, InterruptedException, ExecutionException {
- OvsDBClientImpl ovs = getVswitch();
-
- Bridge bridge = ovs.getSchema(OvsDBClient.OPEN_VSWITCH_SCHEMA, true).get().table("Bridge", Bridge.class);
-
- ListenableFuture<List<OperationResult>> results = ovs.transactBuilder()
- .add(op.insert(bridge).value(bridge.name(), "br-int"))
- .add(op.update(bridge)
- .set(bridge.status(), "br-blah")
- .set(bridge.floodVlans(), 34)
- .where(bridge.name().opEqual("br-int"))
- .and(bridge.name().opEqual("br-int")).operation())
- .execute();
-
- List<OperationResult> operationResults = results.get();
- Assert.assertFalse(operationResults.isEmpty());
- System.out.println("operationResults = " + operationResults);
- }
-
-
-
-
- private OvsDBClientImpl getVswitch() throws IOException, InterruptedException {
- TestObjects testConnection = getTestConnection();
- OvsdbRPC rpc = testConnection.connectionService.getConnection(testConnection.node).getRpc();
-
- ExecutorService executorService = Executors.newFixedThreadPool(3);
- OvsDBClientImpl ovs = new OvsDBClientImpl(rpc, executorService);
-
- for (int i = 0; i < 100; i++) {
- if (ovs.isReady(0)) {
- break;
- }
- Thread.sleep(1000);
- }
- return ovs;
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Aswin Raveendran
- */
-package org.opendaylight.ovsdb.lib.jsonrpc;
-
-import io.netty.bootstrap.ServerBootstrap;
-import io.netty.channel.ChannelFuture;
-import io.netty.channel.ChannelHandler;
-import io.netty.channel.ChannelInitializer;
-import io.netty.channel.ChannelOption;
-import io.netty.channel.EventLoopGroup;
-import io.netty.channel.nio.NioEventLoopGroup;
-import io.netty.channel.socket.SocketChannel;
-import io.netty.channel.socket.nio.NioServerSocketChannel;
-
-import java.util.concurrent.TimeUnit;
-
-public class NettyBootStrapper {
-
- EventLoopGroup bossGroup = null;
- EventLoopGroup workerGroup = null;
- ChannelFuture f = null;
-
- public ChannelFuture startServer(int localPort, final ChannelHandler... handlers) throws Exception {
- // Configure the server.
- bossGroup = new NioEventLoopGroup();
- workerGroup = new NioEventLoopGroup();
- ServerBootstrap b = new ServerBootstrap();
- b.group(bossGroup, workerGroup)
- .channel(NioServerSocketChannel.class)
- .option(ChannelOption.SO_BACKLOG, 100)
- .localAddress(localPort)
- .childOption(ChannelOption.TCP_NODELAY, true)
- .childHandler(new ChannelInitializer<SocketChannel>() {
-
- @Override
- public void initChannel(SocketChannel ch) throws Exception {
- for (ChannelHandler handler : handlers) {
- ch.pipeline().addLast(handler);
- }
- }
- });
-
- // Start the server.
- f = b.bind().sync();
- return f;
- }
-
- public void stopServer() throws InterruptedException {
- try {
-
- ChannelFuture channelFuture = f.channel().closeFuture();
- channelFuture.get(1000, TimeUnit.MILLISECONDS);
- if (!channelFuture.isDone()) {
- f.channel().unsafe().closeForcibly();
- }
-
- bossGroup.shutdownGracefully();
- workerGroup.shutdownGracefully();
-
- // Wait until all threads are terminated.
- bossGroup.terminationFuture().sync();
- workerGroup.terminationFuture().sync();
- } catch (Exception e) {
- //ignore
- }
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Aswin Raveendran
- */
-package org.opendaylight.ovsdb.lib.jsonrpc;
-
-import io.netty.handler.logging.LogLevel;
-import io.netty.handler.logging.LoggingHandler;
-import junit.framework.TestCase;
-import org.junit.Test;
-
-import java.io.OutputStream;
-import java.io.IOException;
-import java.net.Socket;
-
-public class TestClient extends TestCase {
-
- String serverurl = "127.0.0.1";
- int serverport = 8080;
-
- NettyBootStrapper bootstrapper = new NettyBootStrapper();
- JsonRpcDecoder jsonRpcDecoder = new JsonRpcDecoder(100000);
-
- public void setupServer() throws Exception {
- bootstrapper.startServer(serverport,
- jsonRpcDecoder,
- new LoggingHandler(LogLevel.DEBUG));
- }
-
- public void shutDownServer() throws InterruptedException {
- bootstrapper.stopServer();
- }
-
- @Test
- public void testBasicFlow() throws Exception {
- setupServer();
- Socket socket = socket = new Socket(serverurl, serverport);
-
- OutputStream outputStream = socket.getOutputStream();
-
- int records = 20;
-
- for (int i = 0; i < records; i++) {
- writeJson(outputStream, 1);
- writePartialFirst(outputStream);
- outputStream.flush();
- Thread.sleep(10);
- writePartialLast(outputStream);
- }
- socket.close();
- shutDownServer();
-
- assertEquals("mismatch in records processed", records * 2, jsonRpcDecoder.getRecordsRead());
- }
-
- static int counter = 0;
-
- /*
- create and a json of specified size
- */
- private void writeJson(OutputStream outputStream, int times) throws IOException {
- outputStream.write("{".getBytes("UTF-8"));
- for (int i = 0 ; i < times; i ++) {
- counter++;
- String s = ",\"key1"+ counter +"\":\"planet of apes" + counter +
- "\", \"key2"+ counter +"\":{\"k1\":\"ovs-db rocks the world\"}";
- outputStream.write(s.substring(i == 0 ? 1 : 0).getBytes("UTF-8"));
- System.out.println("data counter = " + counter);
- }
- outputStream.write("}".getBytes("UTF-8"));
- }
-
- /*
- writes a partial json and flush to simulate the case where netty gets half the message and
- has to frame it accordingly.
- */
- private void writePartialFirst(OutputStream outputStream) throws IOException {
- counter++;
- String s = " {\"part"+ counter+"\":";
- outputStream.write(s.getBytes("UTF-8"));
- System.out.println("partial first half counter = " + counter);
- }
-
- /*
- finishes the json started by writePartialFirst
- */
- private void writePartialLast(OutputStream outputStream) throws IOException {
- String s = "\"val"+ counter+"\"}";
- outputStream.write(s.getBytes("UTF-8"));
- System.out.println("partial second half counter = " + counter);
- }
-
-}
-
+++ /dev/null
-/*
- * Copyright (C) 2013 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Aswin Raveendran
- */
-package org.opendaylight.ovsdb.lib.jsonrpc;
-
-import com.google.common.reflect.Invokable;
-import com.google.common.reflect.TypeToken;
-import com.google.common.util.concurrent.ListenableFuture;
-import java.lang.reflect.Method;
-
-
-public class TestTokens {
-
- public ListenableFuture<String> getString() {
- return null;
- }
-
-
- public static void main(String[] args) throws NoSuchMethodException {
- Method getString = TestTokens.class.getMethod("getString");
- Invokable<?, Object> from = Invokable.from(getString);
- //TypeToken<?> get = from.getReturnType().resolveType(ListenableFuture.class.getMethod("get").getGenericReturnType());
- TypeToken<?> get = from.getReturnType().resolveType(ListenableFuture.class.getMethod("get").getGenericReturnType());
- System.out.println(get.getRawType());
-
-
- TypeToken<?> get1 = TypeToken.of(getString.getGenericReturnType()).resolveType(ListenableFuture.class.getMethod("get").getGenericReturnType());
- System.out.println("get1 = " + get1);
- }
-
-}
+++ /dev/null
-/*
- * [[ Authors will Fill in the Copyright header ]]
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Brent Salisbury, Aswin Raveendran, Madhu Venugopal
- */
-package org.opendaylight.ovsdb.lib.message;
-
-import com.fasterxml.jackson.annotation.JsonAutoDetect;
-import com.fasterxml.jackson.annotation.PropertyAccessor;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.google.common.base.Function;
-import com.google.common.collect.Ordering;
-import com.google.common.io.InputSupplier;
-import com.google.common.io.Resources;
-
-import junit.framework.TestCase;
-
-import org.opendaylight.ovsdb.lib.notation.OvsDBMap;
-import org.opendaylight.ovsdb.lib.notation.OvsDBSet;
-import org.opendaylight.ovsdb.lib.notation.UUID;
-import org.opendaylight.ovsdb.lib.table.Bridge;
-import org.opendaylight.ovsdb.lib.table.Interface;
-import org.opendaylight.ovsdb.lib.table.Port;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-public class MonitorResponseTest extends TestCase {
-
- public void testDeser() throws IOException {
- URL resource = Resources.getResource(MonitorResponseTest.class, "monitor_response1.json");
- InputSupplier<InputStream> inputStreamInputSupplier = Resources.newInputStreamSupplier(resource);
- InputStream input = inputStreamInputSupplier.getInput();
- ObjectMapper mapper = new ObjectMapper();
- mapper.setVisibility(PropertyAccessor.GETTER, JsonAutoDetect.Visibility.ANY);
- TableUpdates updates = mapper.readValue(input, TableUpdates.class);
-
- Set<Table.Name> available = updates.availableUpdates();
- for (Table.Name name : available) {
- if (Bridge.NAME.equals(name)) {
- verifyBridge(updates);
- } else if (Port.NAME.equals(name)) {
- veriftyPort(updates);
- } else if (Interface.NAME.equals(name)) {
- verifyInterface(updates);
- }
- }
- }
-
- private void verifyInterface(TableUpdates updates) {
- TableUpdate<Interface> update = updates.getUpdate(Interface.NAME);
- for (TableUpdate.Row<Interface> interfaceRow : update.getRows()) {
- System.out.println("interfaceRow = " + interfaceRow);
- Interface aNew = interfaceRow.getNew();
- if (null != aNew) {
- OvsDBMap<String, String> options = aNew.getOptions();
- if (options != null) {
- for (Map.Entry<String, String> optE : options.entrySet()) {
- System.out.println("optE.getKey() = " + optE.getKey());
- System.out.println("optE.getValue() = " + optE.getValue());
- }
- }
- }
- }
- }
-
- private void verifyBridge(TableUpdates updates) {
- TableUpdate<Bridge> update = updates.getUpdate(Bridge.NAME);
- for (TableUpdate.Row<Bridge> row : update.getRows()) {
- assertEquals("788de61c-0e4f-43d8-a068-259e75aabbba", row.getId());
- Bridge bridge = row.getNew();
- assertNotNull(bridge);
- OvsDBSet<UUID> ports = bridge.getPorts();
- assertEquals(2, ports.size());
- List<UUID> uuids = Ordering.usingToString().sortedCopy(ports);
- assertEquals("f6018e7a-7ca5-4e72-a744-a9b434f47011", uuids.get(0).toString());
- assertEquals("fe3c89fd-2ff3-44d8-9f27-f9c7ac2a693d", uuids.get(1).toString());
- bridge = row.getOld();
- assertNull(bridge);
- }
- }
-
- private void veriftyPort(TableUpdates updates) {
- TableUpdate<Port> update = updates.getUpdate(Port.NAME);
- Collection<TableUpdate.Row<Port>> rows = update.getRows();
- assertEquals(2, rows.size());
- List<TableUpdate.Row<Port>> sorted = Ordering.natural().onResultOf(new Function<TableUpdate.Row<Port>, String>() {
- @Override
- public String apply(org.opendaylight.ovsdb.lib.message.TableUpdate.Row<Port> input) {
- return input.getId();
- }
- }).sortedCopy(rows);
-
- TableUpdate.Row<Port> portRow = sorted.get(0);
- assertEquals("f6018e7a-7ca5-4e72-a744-a9b434f47011", portRow.getId());
- Port port = portRow.getNew();
- assertNotNull(port);
- List<UUID> interfaces = Ordering.usingToString().sortedCopy(port.getInterfaces());
- assertEquals("13548b08-dca3-4d4b-9e9b-f50c237dcb9e", interfaces.get(0).toString());
- port = portRow.getOld();
- assertNull(port);
-
- portRow = sorted.get(1);
- assertEquals("fe3c89fd-2ff3-44d8-9f27-f9c7ac2a693d", portRow.getId());
- port = portRow.getNew();
- assertNotNull(port);
- interfaces = Ordering.usingToString().sortedCopy(port.getInterfaces());
- assertEquals("88ae29fb-8c91-41a9-a14f-a74126e790c0", interfaces.get(0).toString());
- port = portRow.getOld();
- assertNull(port);
- }
-
-}
+++ /dev/null
-/*
- * [[ Authors will Fill in the Copyright header ]]
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Brent Salisbury, Madhu Venugopal, Aswin Raveendran
- */
-package org.opendaylight.ovsdb.lib.message;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.concurrent.ExecutionException;
-
-import org.apache.commons.collections.MapUtils;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.controller.sal.connection.ConnectionConstants;
-import org.opendaylight.controller.sal.core.Node;
-import org.opendaylight.ovsdb.lib.database.DatabaseSchema;
-import org.opendaylight.ovsdb.lib.operations.InsertOperation;
-import org.opendaylight.ovsdb.lib.operations.MutateOperation;
-import org.opendaylight.ovsdb.lib.operations.Operation;
-import org.opendaylight.ovsdb.lib.operations.OperationResult;
-import org.opendaylight.ovsdb.lib.notation.Condition;
-import org.opendaylight.ovsdb.lib.notation.Function;
-import org.opendaylight.ovsdb.lib.notation.Mutation;
-import org.opendaylight.ovsdb.lib.notation.Mutator;
-import org.opendaylight.ovsdb.lib.notation.OvsDBSet;
-import org.opendaylight.ovsdb.lib.notation.UUID;
-import org.opendaylight.ovsdb.lib.table.Bridge;
-import org.opendaylight.ovsdb.lib.table.Interface;
-import org.opendaylight.ovsdb.lib.table.Open_vSwitch;
-import org.opendaylight.ovsdb.lib.table.Port;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
-import org.opendaylight.ovsdb.lib.table.internal.Tables;
-import org.opendaylight.ovsdb.plugin.Connection;
-import org.opendaylight.ovsdb.plugin.ConnectionService;
-import org.opendaylight.ovsdb.plugin.InventoryService;
-
-import com.google.common.util.concurrent.ListenableFuture;
-
-public class OVSDBNettyFactoryIT {
- InventoryService inventoryService;
- private static String bridgeIdentifier = "br1";
- private Properties props;
-
- @Before
- public void initialize() throws IOException {
- InputStream is = this.getClass().getClassLoader()
- .getResourceAsStream(
- "org/opendaylight/ovsdb/lib/message/integration-test.properties");
- if (is == null) {
- throw new IOException("Unable to load integration-test.properties");
- }
- props = new Properties();
- props.load(is);
-
- }
-
- @Test
- public void testSome() throws InterruptedException, ExecutionException,
- IOException {
- ConnectionService connectionService = new ConnectionService();
- connectionService.init();
- inventoryService = new InventoryService();
- inventoryService.init();
- connectionService.setInventoryServiceInternal(inventoryService);
- Node.NodeIDType.registerIDType("OVS", String.class);
- Map<ConnectionConstants, String> params = new HashMap<ConnectionConstants, String>();
- params.put(ConnectionConstants.ADDRESS,
- props.getProperty("ovsdbserver.ipaddress"));
- params.put(ConnectionConstants.PORT,
- props.getProperty("ovsdbserver.port", "6640"));
- Node node = connectionService.connect("TEST", params);
- if (node == null) {
- throw new IOException("Unable to connect to the host");
- }
-
- Connection connection = connectionService.getConnection(node);
- if (connection == null) {
- throw new IOException("Unable to connect to the host");
- }
-
- OvsdbRPC ovsdb = connection.getRpc();
- if (ovsdb == null) {
- throw new IOException("Unable to obtain RPC instance");
- }
-
- //GET DB-SCHEMA
- List<String> dbNames = Arrays.asList(Open_vSwitch.NAME.getName());
- ListenableFuture<DatabaseSchema> dbSchemaF = null; //ovsdb.get_schema(dbNames);
- DatabaseSchema databaseSchema = dbSchemaF.get();
- MapUtils.debugPrint(System.out, null, databaseSchema.getTables());
-
- // TEST MONITOR
- // YES it is expected to fail with "duplicate monitor ID" as we have a perpetual monitor in Inventory Service
- MonitorRequestBuilder monitorReq = new MonitorRequestBuilder();
- for (Table<?> table : Tables.getTables()) {
- monitorReq.monitor(table);
- }
-
- ListenableFuture<TableUpdates> monResponse = ovsdb.monitor(monitorReq);
- System.out.println("Monitor Request sent :");
- TableUpdates updates = monResponse.get();
- inventoryService.processTableUpdates(node, updates);
- inventoryService.printCache(node);
-
- // TRANSACT INSERT TEST
-
- Map<String, Table<?>> ovsTable = inventoryService.getTableCache(node, Open_vSwitch.NAME.getName());
- String newBridge = "new_bridge";
- String newInterface = "new_interface";
- String newPort = "new_port";
- String newSwitch = "new_switch";
-
- Operation addSwitchRequest = null;
-
- if(ovsTable != null){
- String ovsTableUUID = (String) ovsTable.keySet().toArray()[0];
- UUID bridgeUuidPair = new UUID(newBridge);
- Mutation bm = new Mutation("bridges", Mutator.INSERT, bridgeUuidPair);
- List<Mutation> mutations = new ArrayList<Mutation>();
- mutations.add(bm);
-
- UUID uuid = new UUID(ovsTableUUID);
- Condition condition = new Condition("_uuid", Function.EQUALS, uuid);
- List<Condition> where = new ArrayList<Condition>();
- where.add(condition);
- addSwitchRequest = new MutateOperation(Open_vSwitch.NAME.getName(), where, mutations);
- }
- else{
- Open_vSwitch ovsTableRow = new Open_vSwitch();
- OvsDBSet<UUID> bridges = new OvsDBSet<UUID>();
- UUID bridgeUuidPair = new UUID(newBridge);
- bridges.add(bridgeUuidPair);
- ovsTableRow.setBridges(bridges);
- addSwitchRequest = new InsertOperation(Open_vSwitch.NAME.getName(), newSwitch, ovsTableRow);
- }
-
- Bridge bridgeRow = new Bridge();
- bridgeRow.setName(bridgeIdentifier);
- OvsDBSet<UUID> ports = new OvsDBSet<UUID>();
- UUID port = new UUID(newPort);
- ports.add(port);
- bridgeRow.setPorts(ports);
- InsertOperation addBridgeRequest = new InsertOperation(Bridge.NAME.getName(), newBridge, bridgeRow);
-
- Port portRow = new Port();
- portRow.setName(bridgeIdentifier);
- OvsDBSet<UUID> interfaces = new OvsDBSet<UUID>();
- UUID interfaceid = new UUID(newInterface);
- interfaces.add(interfaceid);
- portRow.setInterfaces(interfaces);
- InsertOperation addPortRequest = new InsertOperation(Port.NAME.getName(), newPort, portRow);
-
- Interface interfaceRow = new Interface();
- interfaceRow.setName(bridgeIdentifier);
- interfaceRow.setType("internal");
- InsertOperation addIntfRequest = new InsertOperation(Interface.NAME.getName(), newInterface, interfaceRow);
-
- TransactBuilder transaction = new TransactBuilder();
- transaction.addOperations(new ArrayList<Operation>(
- Arrays.asList(addSwitchRequest, addIntfRequest, addPortRequest, addBridgeRequest)));
-
- ListenableFuture<List<OperationResult>> transResponse = ovsdb.transact(transaction);
- System.out.println("Transcation sent :");
- List<OperationResult> tr = transResponse.get();
- System.out.println("Transaction response : "+transResponse.toString());
- List<Operation> requests = transaction.getRequests();
- for (int i = 0; i < tr.size() ; i++) {
- if (i < requests.size()) requests.get(i).setResult(tr.get(i));
- }
-
- System.out.println("Request + Response : "+requests.toString());
- if (tr.size() > requests.size()) {
- System.out.println("ERROR : "+tr.get(tr.size()-1).getError());
- System.out.println("Details : "+tr.get(tr.size()-1).getDetails());
- }
-
- // TEST ECHO
-
- ListenableFuture<List<String>> some = ovsdb.echo();
- Object s = some.get();
- System.out.printf("Result of echo is %s \n", s);
-
- // TEST ECHO REQUEST/REPLY
- Thread.sleep(10000);
-
- connectionService.disconnect(node);
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2014 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran
- */
-package org.opendaylight.ovsdb.lib.schema;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import org.junit.Test;
-import static org.junit.Assert.assertNotNull;
-import java.io.IOException;
-import java.io.InputStream;
-
-
-public class OvsDBSchemaTest {
-
- @Test
- public void testSchema() throws IOException {
- InputStream resourceAsStream = OvsDBSchemaTest.class.getResourceAsStream("test_schema.json");
- ObjectMapper mapper = new ObjectMapper();
- JsonNode jsonNode = mapper.readTree(resourceAsStream);
- System.out.println("jsonNode = " + jsonNode.get("id"));
-
- DatabaseSchema schema = DatabaseSchema.fromJson(jsonNode.get("result"));
- assertNotNull(schema);
-
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2014 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran
- */
-package org.opendaylight.ovsdb.lib.schema.temp;
-
-
-public class Reference {
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2014 EBay Software Foundation
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Ashwin Raveendran
- */
-package org.opendaylight.ovsdb.lib.schema.temp;
-
-import org.opendaylight.ovsdb.lib.OvsDBClient;
-import org.opendaylight.ovsdb.lib.OvsDBClientImpl;
-import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
-import org.opendaylight.ovsdb.lib.schema.ColumnSchema;
-import org.opendaylight.ovsdb.lib.schema.TableSchema;
-
-import java.util.concurrent.ExecutionException;
-
-
-public class SchemaObjs {
-
- public static class Bridge extends TableSchema<Bridge> {
- public static String NAME = "Bridge";
- TableSchema target;
-
- ColumnSchema<Bridge, String> name;
- ColumnSchema<Bridge, Boolean> flood_vlans;
-
-
- public Bridge(TableSchema<Bridge> target) {
- this.target = target;
- name = target.column("name", String.class);
- flood_vlans = target.column("statistics", Boolean.class);
- }
-
- }
-
- public static class Port extends TableSchema<Port> {
- public static String NAME = "Port";
- TableSchema target;
-
- ColumnSchema<Port, String> name;
- ColumnSchema<Port, String> statistics;
-
- public Port(TableSchema<Port> target) {
- this.target = target;
- name = target.column("name", String.class);
- statistics = target.column("statistics", String.class);
- }
-
- }
-
- public static void main(String[] args) throws ExecutionException, InterruptedException {
-
- OvsDBClientImpl ovs = new OvsDBClientImpl(null, null);
- DatabaseSchema db = ovs.getSchema(OvsDBClient.OPEN_VSWITCH_SCHEMA, true).get();
- Bridge bridge = db.table(Bridge.NAME, Bridge.class);
- Port port = db.table(Port.NAME, Port.class);
-
- db.beginTransaction()
- .add(bridge.insert()
- .value(bridge.flood_vlans, true)
- .value(bridge.name, "br-int"))
- .add(port.insert()
- .value(port.statistics, "stats")
- //.value(port.statistics, 2) ## will not type check as stats is a string
- .value(port.name, "newport")
- )
- .execute();
-
- //todo untyped version
-
- }
-}
+++ /dev/null
-{
- "id": 0,
- "result": {
- "tables": {
- "Port": {
- "columns": {
- "name": {
- "mutable": false,
- "type": "string"
- },
- "statistics": {
- "ephemeral": true,
- "type": {
- "key": "string",
- "min": 0,
- "value": "integer",
- "max": "unlimited"
- }
- },
- "vlan_mode": {
- "type": {
- "key": {
- "type": "string",
- "enum": [
- "set",
- [
- "access",
- "native-tagged",
- "native-untagged",
- "trunk"
- ]
- ]
- },
- "min": 0
- }
- },
- "qos": {
- "type": {
- "key": {
- "type": "uuid",
- "refTable": "QoS"
- },
- "min": 0
- }
- },
- "status": {
- "ephemeral": true,
- "type": {
- "key": "string",
- "min": 0,
- "value": "string",
- "max": "unlimited"
- }
- },
- "trunks": {
- "type": {
- "key": {
- "maxInteger": 4095,
- "minInteger": 0,
- "type": "integer"
- },
- "min": 0,
- "max": 4096
- }
- },
- "mac": {
- "type": {
- "key": "string",
- "min": 0
- }
- },
- "interfaces": {
- "type": {
- "key": {
- "type": "uuid",
- "refTable": "Interface"
- },
- "max": "unlimited"
- }
- },
- "bond_downdelay": {
- "type": "integer"
- },
- "bond_mode": {
- "type": {
- "key": {
- "type": "string",
- "enum": [
- "set",
- [
- "active-backup",
- "balance-slb",
- "balance-tcp",
- "stable"
- ]
- ]
- },
- "min": 0
- }
- },
- "bond_updelay": {
- "type": "integer"
- },
- "external_ids": {
- "type": {
- "key": "string",
- "min": 0,
- "value": "string",
- "max": "unlimited"
- }
- },
- "other_config": {
- "type": {
- "key": "string",
- "min": 0,
- "value": "string",
- "max": "unlimited"
- }
- },
- "tag": {
- "type": {
- "key": {
- "maxInteger": 4095,
- "minInteger": 0,
- "type": "integer"
- },
- "min": 0
- }
- },
- "bond_fake_iface": {
- "type": "boolean"
- },
- "fake_bridge": {
- "type": "boolean"
- },
- "lacp": {
- "type": {
- "key": {
- "type": "string",
- "enum": [
- "set",
- [
- "active",
- "off",
- "passive"
- ]
- ]
- },
- "min": 0
- }
- }
- },
- "indexes": [
- [
- "name"
- ]
- ]
- },
- "Manager": {
- "columns": {
- "is_connected": {
- "ephemeral": true,
- "type": "boolean"
- },
- "target": {
- "type": "string"
- },
- "other_config": {
- "type": {
- "key": "string",
- "min": 0,
- "value": "string",
- "max": "unlimited"
- }
- },
- "external_ids": {
- "type": {
- "key": "string",
- "min": 0,
- "value": "string",
- "max": "unlimited"
- }
- },
- "max_backoff": {
- "type": {
- "key": {
- "minInteger": 1000,
- "type": "integer"
- },
- "min": 0
- }
- },
- "connection_mode": {
- "type": {
- "key": {
- "type": "string",
- "enum": [
- "set",
- [
- "in-band",
- "out-of-band"
- ]
- ]
- },
- "min": 0
- }
- },
- "status": {
- "ephemeral": true,
- "type": {
- "key": "string",
- "min": 0,
- "value": "string",
- "max": "unlimited"
- }
- },
- "inactivity_probe": {
- "type": {
- "key": "integer",
- "min": 0
- }
- }
- },
- "indexes": [
- [
- "target"
- ]
- ]
- },
- "Bridge": {
- "columns": {
- "name": {
- "mutable": false,
- "type": "string"
- },
- "flood_vlans": {
- "type": {
- "key": {
- "maxInteger": 4095,
- "minInteger": 0,
- "type": "integer"
- },
- "min": 0,
- "max": 4096
- }
- },
- "netflow": {
- "type": {
- "key": {
- "type": "uuid",
- "refTable": "NetFlow"
- },
- "min": 0
- }
- },
- "mirrors": {
- "type": {
- "key": {
- "type": "uuid",
- "refTable": "Mirror"
- },
- "min": 0,
- "max": "unlimited"
- }
- },
- "status": {
- "ephemeral": true,
- "type": {
- "key": "string",
- "min": 0,
- "value": "string",
- "max": "unlimited"
- }
- },
- "datapath_id": {
- "ephemeral": true,
- "type": {
- "key": "string",
- "min": 0
- }
- },
- "controller": {
- "type": {
- "key": {
- "type": "uuid",
- "refTable": "Controller"
- },
- "min": 0,
- "max": "unlimited"
- }
- },
- "protocols": {
- "type": {
- "key": {
- "type": "string",
- "enum": [
- "set",
- [
- "OpenFlow10",
- "OpenFlow12",
- "OpenFlow13"
- ]
- ]
- },
- "min": 0,
- "max": "unlimited"
- }
- },
- "fail_mode": {
- "type": {
- "key": {
- "type": "string",
- "enum": [
- "set",
- [
- "secure",
- "standalone"
- ]
- ]
- },
- "min": 0
- }
- },
- "ports": {
- "type": {
- "key": {
- "type": "uuid",
- "refTable": "Port"
- },
- "min": 0,
- "max": "unlimited"
- }
- },
- "external_ids": {
- "type": {
- "key": "string",
- "min": 0,
- "value": "string",
- "max": "unlimited"
- }
- },
- "flow_tables": {
- "type": {
- "key": {
- "maxInteger": 254,
- "minInteger": 0,
- "type": "integer"
- },
- "min": 0,
- "value": {
- "type": "uuid",
- "refTable": "Flow_Table"
- },
- "max": "unlimited"
- }
- },
- "sflow": {
- "type": {
- "key": {
- "type": "uuid",
- "refTable": "sFlow"
- },
- "min": 0
- }
- },
- "datapath_type": {
- "type": "string"
- },
- "other_config": {
- "type": {
- "key": "string",
- "min": 0,
- "value": "string",
- "max": "unlimited"
- }
- },
- "stp_enable": {
- "type": "boolean"
- }
- },
- "indexes": [
- [
- "name"
- ]
- ]
- },
- "Interface": {
- "columns": {
- "options": {
- "type": {
- "key": "string",
- "min": 0,
- "value": "string",
- "max": "unlimited"
- }
- },
- "name": {
- "mutable": false,
- "type": "string"
- },
- "statistics": {
- "ephemeral": true,
- "type": {
- "key": "string",
- "min": 0,
- "value": "integer",
- "max": "unlimited"
- }
- },
- "link_speed": {
- "ephemeral": true,
- "type": {
- "key": "integer",
- "min": 0
- }
- },
- "mtu": {
- "ephemeral": true,
- "type": {
- "key": "integer",
- "min": 0
- }
- },
- "mac_in_use": {
- "ephemeral": true,
- "type": {
- "key": "string",
- "min": 0
- }
- },
- "type": {
- "type": "string"
- },
- "ingress_policing_rate": {
- "type": {
- "key": {
- "minInteger": 0,
- "type": "integer"
- }
- }
- },
- "cfm_remote_opstate": {
- "ephemeral": true,
- "type": {
- "key": {
- "type": "string",
- "enum": [
- "set",
- [
- "down",
- "up"
- ]
- ]
- },
- "min": 0
- }
- },
- "status": {
- "ephemeral": true,
- "type": {
- "key": "string",
- "min": 0,
- "value": "string",
- "max": "unlimited"
- }
- },
- "mac": {
- "type": {
- "key": "string",
- "min": 0
- }
- },
- "ofport": {
- "type": {
- "key": "integer",
- "min": 0
- }
- },
- "cfm_fault_status": {
- "ephemeral": true,
- "type": {
- "key": "string",
- "min": 0,
- "max": "unlimited"
- }
- },
- "duplex": {
- "ephemeral": true,
- "type": {
- "key": {
- "type": "string",
- "enum": [
- "set",
- [
- "full",
- "half"
- ]
- ]
- },
- "min": 0
- }
- },
- "lacp_current": {
- "ephemeral": true,
- "type": {
- "key": "boolean",
- "min": 0
- }
- },
- "cfm_fault": {
- "ephemeral": true,
- "type": {
- "key": "boolean",
- "min": 0
- }
- },
- "external_ids": {
- "type": {
- "key": "string",
- "min": 0,
- "value": "string",
- "max": "unlimited"
- }
- },
- "other_config": {
- "type": {
- "key": "string",
- "min": 0,
- "value": "string",
- "max": "unlimited"
- }
- },
- "admin_state": {
- "ephemeral": true,
- "type": {
- "key": {
- "type": "string",
- "enum": [
- "set",
- [
- "down",
- "up"
- ]
- ]
- },
- "min": 0
- }
- },
- "link_state": {
- "ephemeral": true,
- "type": {
- "key": {
- "type": "string",
- "enum": [
- "set",
- [
- "down",
- "up"
- ]
- ]
- },
- "min": 0
- }
- },
- "cfm_remote_mpids": {
- "ephemeral": true,
- "type": {
- "key": "integer",
- "min": 0,
- "max": "unlimited"
- }
- },
- "cfm_mpid": {
- "type": {
- "key": "integer",
- "min": 0
- }
- },
- "ofport_request": {
- "type": {
- "key": {
- "maxInteger": 65279,
- "minInteger": 1,
- "type": "integer"
- },
- "min": 0
- }
- },
- "ingress_policing_burst": {
- "type": {
- "key": {
- "minInteger": 0,
- "type": "integer"
- }
- }
- },
- "cfm_health": {
- "ephemeral": true,
- "type": {
- "key": {
- "maxInteger": 100,
- "minInteger": 0,
- "type": "integer"
- },
- "min": 0
- }
- },
- "link_resets": {
- "ephemeral": true,
- "type": {
- "key": "integer",
- "min": 0
- }
- }
- },
- "indexes": [
- [
- "name"
- ]
- ]
- },
- "SSL": {
- "columns": {
- "ca_cert": {
- "type": "string"
- },
- "private_key": {
- "type": "string"
- },
- "bootstrap_ca_cert": {
- "type": "boolean"
- },
- "external_ids": {
- "type": {
- "key": "string",
- "min": 0,
- "value": "string",
- "max": "unlimited"
- }
- },
- "certificate": {
- "type": "string"
- }
- },
- "maxRows": 1
- },
- "Open_vSwitch": {
- "columns": {
- "ovs_version": {
- "type": {
- "key": "string",
- "min": 0
- }
- },
- "system_version": {
- "type": {
- "key": "string",
- "min": 0
- }
- },
- "bridges": {
- "type": {
- "key": {
- "type": "uuid",
- "refTable": "Bridge"
- },
- "min": 0,
- "max": "unlimited"
- }
- },
- "statistics": {
- "ephemeral": true,
- "type": {
- "key": "string",
- "min": 0,
- "value": "string",
- "max": "unlimited"
- }
- },
- "other_config": {
- "type": {
- "key": "string",
- "min": 0,
- "value": "string",
- "max": "unlimited"
- }
- },
- "external_ids": {
- "type": {
- "key": "string",
- "min": 0,
- "value": "string",
- "max": "unlimited"
- }
- },
- "next_cfg": {
- "type": "integer"
- },
- "manager_options": {
- "type": {
- "key": {
- "type": "uuid",
- "refTable": "Manager"
- },
- "min": 0,
- "max": "unlimited"
- }
- },
- "system_type": {
- "type": {
- "key": "string",
- "min": 0
- }
- },
- "ssl": {
- "type": {
- "key": {
- "type": "uuid",
- "refTable": "SSL"
- },
- "min": 0
- }
- },
- "db_version": {
- "type": {
- "key": "string",
- "min": 0
- }
- },
- "cur_cfg": {
- "type": "integer"
- }
- },
- "maxRows": 1,
- "isRoot": true
- },
- "Queue": {
- "columns": {
- "external_ids": {
- "type": {
- "key": "string",
- "min": 0,
- "value": "string",
- "max": "unlimited"
- }
- },
- "other_config": {
- "type": {
- "key": "string",
- "min": 0,
- "value": "string",
- "max": "unlimited"
- }
- },
- "dscp": {
- "type": {
- "key": {
- "maxInteger": 63,
- "minInteger": 0,
- "type": "integer"
- },
- "min": 0
- }
- }
- },
- "isRoot": true
- },
- "NetFlow": {
- "columns": {
- "engine_type": {
- "type": {
- "key": {
- "maxInteger": 255,
- "minInteger": 0,
- "type": "integer"
- },
- "min": 0
- }
- },
- "targets": {
- "type": {
- "key": "string",
- "max": "unlimited"
- }
- },
- "add_id_to_interface": {
- "type": "boolean"
- },
- "active_timeout": {
- "type": {
- "key": {
- "minInteger": -1,
- "type": "integer"
- }
- }
- },
- "external_ids": {
- "type": {
- "key": "string",
- "min": 0,
- "value": "string",
- "max": "unlimited"
- }
- },
- "engine_id": {
- "type": {
- "key": {
- "maxInteger": 255,
- "minInteger": 0,
- "type": "integer"
- },
- "min": 0
- }
- }
- }
- },
- "Mirror": {
- "columns": {
- "name": {
- "type": "string"
- },
- "output_port": {
- "type": {
- "key": {
- "refType": "weak",
- "type": "uuid",
- "refTable": "Port"
- },
- "min": 0
- }
- },
- "output_vlan": {
- "type": {
- "key": {
- "maxInteger": 4095,
- "minInteger": 1,
- "type": "integer"
- },
- "min": 0
- }
- },
- "statistics": {
- "ephemeral": true,
- "type": {
- "key": "string",
- "min": 0,
- "value": "integer",
- "max": "unlimited"
- }
- },
- "external_ids": {
- "type": {
- "key": "string",
- "min": 0,
- "value": "string",
- "max": "unlimited"
- }
- },
- "select_dst_port": {
- "type": {
- "key": {
- "refType": "weak",
- "type": "uuid",
- "refTable": "Port"
- },
- "min": 0,
- "max": "unlimited"
- }
- },
- "select_all": {
- "type": "boolean"
- },
- "select_vlan": {
- "type": {
- "key": {
- "maxInteger": 4095,
- "minInteger": 0,
- "type": "integer"
- },
- "min": 0,
- "max": 4096
- }
- },
- "select_src_port": {
- "type": {
- "key": {
- "refType": "weak",
- "type": "uuid",
- "refTable": "Port"
- },
- "min": 0,
- "max": "unlimited"
- }
- }
- }
- },
- "QoS": {
- "columns": {
- "queues": {
- "type": {
- "key": {
- "maxInteger": 4294967295,
- "minInteger": 0,
- "type": "integer"
- },
- "min": 0,
- "value": {
- "type": "uuid",
- "refTable": "Queue"
- },
- "max": "unlimited"
- }
- },
- "other_config": {
- "type": {
- "key": "string",
- "min": 0,
- "value": "string",
- "max": "unlimited"
- }
- },
- "external_ids": {
- "type": {
- "key": "string",
- "min": 0,
- "value": "string",
- "max": "unlimited"
- }
- },
- "type": {
- "type": "string"
- }
- },
- "isRoot": true
- },
- "Controller": {
- "columns": {
- "is_connected": {
- "ephemeral": true,
- "type": "boolean"
- },
- "enable_async_messages": {
- "type": {
- "key": "boolean",
- "min": 0
- }
- },
- "controller_rate_limit": {
- "type": {
- "key": {
- "minInteger": 100,
- "type": "integer"
- },
- "min": 0
- }
- },
- "target": {
- "type": "string"
- },
- "external_ids": {
- "type": {
- "key": "string",
- "min": 0,
- "value": "string",
- "max": "unlimited"
- }
- },
- "other_config": {
- "type": {
- "key": "string",
- "min": 0,
- "value": "string",
- "max": "unlimited"
- }
- },
- "local_netmask": {
- "type": {
- "key": "string",
- "min": 0
- }
- },
- "local_gateway": {
- "type": {
- "key": "string",
- "min": 0
- }
- },
- "max_backoff": {
- "type": {
- "key": {
- "minInteger": 1000,
- "type": "integer"
- },
- "min": 0
- }
- },
- "local_ip": {
- "type": {
- "key": "string",
- "min": 0
- }
- },
- "connection_mode": {
- "type": {
- "key": {
- "type": "string",
- "enum": [
- "set",
- [
- "in-band",
- "out-of-band"
- ]
- ]
- },
- "min": 0
- }
- },
- "status": {
- "ephemeral": true,
- "type": {
- "key": "string",
- "min": 0,
- "value": "string",
- "max": "unlimited"
- }
- },
- "role": {
- "ephemeral": true,
- "type": {
- "key": {
- "type": "string",
- "enum": [
- "set",
- [
- "master",
- "other",
- "slave"
- ]
- ]
- },
- "min": 0
- }
- },
- "inactivity_probe": {
- "type": {
- "key": "integer",
- "min": 0
- }
- },
- "controller_burst_limit": {
- "type": {
- "key": {
- "minInteger": 25,
- "type": "integer"
- },
- "min": 0
- }
- }
- }
- },
- "Flow_Table": {
- "columns": {
- "groups": {
- "type": {
- "key": "string",
- "min": 0,
- "max": "unlimited"
- }
- },
- "name": {
- "type": {
- "key": "string",
- "min": 0
- }
- },
- "overflow_policy": {
- "type": {
- "key": {
- "type": "string",
- "enum": [
- "set",
- [
- "evict",
- "refuse"
- ]
- ]
- },
- "min": 0
- }
- },
- "flow_limit": {
- "type": {
- "key": {
- "minInteger": 0,
- "type": "integer"
- },
- "min": 0
- }
- }
- }
- },
- "sFlow": {
- "columns": {
- "polling": {
- "type": {
- "key": "integer",
- "min": 0
- }
- },
- "targets": {
- "type": {
- "key": "string",
- "max": "unlimited"
- }
- },
- "header": {
- "type": {
- "key": "integer",
- "min": 0
- }
- },
- "agent": {
- "type": {
- "key": "string",
- "min": 0
- }
- },
- "external_ids": {
- "type": {
- "key": "string",
- "min": 0,
- "value": "string",
- "max": "unlimited"
- }
- },
- "sampling": {
- "type": {
- "key": "integer",
- "min": 0
- }
- }
- }
- }
- },
- "cksum": "2180939265 17455",
- "name": "Open_vSwitch",
- "version": "6.12.0"
- },
- "error": null
-}
--- /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.ovsdb</groupId>
+ <artifactId>ovsdb_commons</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <relativePath>../commons/parent</relativePath>
+ </parent>
+ <artifactId>ovsdb_plugin</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>bundle</packaging>
+
+ <properties>
+ <!-- used for filtering the integration test resource -->
+ <ovsdbserver.ipaddress>192.168.56.10</ovsdbserver.ipaddress>
+ <ovsdbserver.port>6640</ovsdbserver.port>
+ <skip.integrationtest>true</skip.integrationtest>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
+ <version>${jackson.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ <version>${jackson.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ <version>${jackson.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ <version>2.1</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <version>${guava.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>1.4</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <version>1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.3</version>
+ </dependency>
+ <dependency>
+ <groupId>equinoxSDK381</groupId>
+ <artifactId>org.eclipse.osgi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-all</artifactId>
+ <version>4.0.10.Final</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.portlet</groupId>
+ <artifactId>portlet-api</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpcore-nio</artifactId>
+ <version>4.2.1</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>clustering.services</artifactId>
+ <version>0.5.1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal</artifactId>
+ <version>0.7.1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal.connection</artifactId>
+ <version>0.1.2-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal.networkconfiguration</artifactId>
+ <version>0.0.3-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.ovsdb</groupId>
+ <artifactId>ovsdb_library</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <testResources>
+ <testResource>
+ <filtering>true</filtering>
+ <directory>src/test/resources</directory>
+ </testResource>
+ </testResources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>2.3.6</version>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Import-Package>org.opendaylight.controller.sal.packet,
+ org.opendaylight.controller.sal.action,
+ org.opendaylight.controller.sal.discovery,
+ org.opendaylight.controller.sal.topology,
+ org.opendaylight.controller.sal.core,
+ org.opendaylight.controller.sal.flowprogrammer,
+ org.opendaylight.controller.sal.reader,
+ org.opendaylight.controller.sal.inventory,
+ org.opendaylight.controller.sal.match,
+ org.opendaylight.controller.sal.utils,
+ org.opendaylight.controller.sal.connection,
+ org.opendaylight.controller.clustering.services,
+ org.opendaylight.controller.sal.networkconfig.bridgedomain,
+ org.opendaylight.ovsdb.lib.table,
+ org.opendaylight.ovsdb.plugin,
+ org.opendaylight.ovsdb.lib.notation,
+ org.opendaylight.ovsdb.lib.database,
+ org.opendaylight.ovsdb.lib.operations,
+ org.opendaylight.ovsdb.lib.message,
+ org.apache.commons.lang3.builder,
+ org.apache.commons.lang3.tuple,
+ org.apache.felix.dm,
+ org.slf4j,
+ org.eclipse.osgi.framework.console,
+ org.osgi.framework,
+ javax.net.ssl,
+ *</Import-Package>
+ <Embed-Dependency>httpclient,commons-codec,httpcore-nio,javax.servlet-api,portlet-api,commons-collections;type=!pom;inline=false</Embed-Dependency>
+ <Embed-Transitive>true</Embed-Transitive>
+ <Bundle-Activator>org.opendaylight.ovsdb.plugin.Activator</Bundle-Activator>
+ <Export-Package>org.opendaylight.ovsdb.plugin</Export-Package>
+ </instructions>
+ <manifestLocation>${project.basedir}/META-INF</manifestLocation>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <configuration>
+ <skipITs>${skip.integrationtest}</skipITs>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.16</version>
+ <configuration>
+ <excludes>
+ <!-- Exclude integration tests -->
+ <exclude>**/*IT</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <scm>
+ <connection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</connection>
+ <developerConnection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</developerConnection>
+ <tag>HEAD</tag>
+ <url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
+ </scm>
+
+ <profiles>
+ <profile>
+ <id>integrationtest</id>
+ <activation></activation>
+ <properties>
+ <skip.integrationtest>false</skip.integrationtest>
+ </properties>
+ </profile>
+ </profiles>
+</project>
import org.opendaylight.ovsdb.lib.database.OVSInstance;
import org.opendaylight.ovsdb.lib.database.OvsdbType;
import org.opendaylight.ovsdb.lib.message.TransactBuilder;
-import org.opendaylight.ovsdb.lib.operations.DeleteOperation;
-import org.opendaylight.ovsdb.lib.operations.InsertOperation;
-import org.opendaylight.ovsdb.lib.operations.MutateOperation;
-import org.opendaylight.ovsdb.lib.operations.Operation;
-import org.opendaylight.ovsdb.lib.operations.OperationResult;
-import org.opendaylight.ovsdb.lib.operations.UpdateOperation;
import org.opendaylight.ovsdb.lib.notation.Condition;
import org.opendaylight.ovsdb.lib.notation.Function;
import org.opendaylight.ovsdb.lib.notation.Mutation;
import org.opendaylight.ovsdb.lib.notation.OvsDBMap;
import org.opendaylight.ovsdb.lib.notation.OvsDBSet;
import org.opendaylight.ovsdb.lib.notation.UUID;
+import org.opendaylight.ovsdb.lib.operations.DeleteOperation;
+import org.opendaylight.ovsdb.lib.operations.InsertOperation;
+import org.opendaylight.ovsdb.lib.operations.MutateOperation;
+import org.opendaylight.ovsdb.lib.operations.Operation;
+import org.opendaylight.ovsdb.lib.operations.OperationResult;
+import org.opendaylight.ovsdb.lib.operations.UpdateOperation;
import org.opendaylight.ovsdb.lib.table.Bridge;
import org.opendaylight.ovsdb.lib.table.Controller;
import org.opendaylight.ovsdb.lib.table.Interface;
import org.opendaylight.ovsdb.lib.table.Queue;
import org.opendaylight.ovsdb.lib.table.SFlow;
import org.opendaylight.ovsdb.lib.table.SSL;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
+import org.opendaylight.ovsdb.lib.table.Table;
import org.osgi.framework.BundleContext;
import org.osgi.framework.FrameworkUtil;
import org.slf4j.Logger;
if (connection != null) {
String newmanager = "new_manager";
- OVSInstance instance = OVSInstance.monitorOVS(connection);
+ OVSInstance instance = OVSInstance.monitorOVS();
Map ovsoutter = new LinkedHashMap();
Map ovsinner = new LinkedHashMap();
import org.opendaylight.ovsdb.lib.table.Bridge;
import org.opendaylight.ovsdb.lib.table.Controller;
import org.opendaylight.ovsdb.lib.table.Open_vSwitch;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
-import org.opendaylight.ovsdb.lib.table.internal.Tables;
+import org.opendaylight.ovsdb.lib.table.Table;
+import org.opendaylight.ovsdb.lib.table.Tables;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
JsonRpcEndpoint factory = new JsonRpcEndpoint(objectMapper, channel);
JsonRpcServiceBinderHandler binderHandler = new JsonRpcServiceBinderHandler(factory);
- binderHandler.setNode(node);
+ binderHandler.setContext(node);
channel.pipeline().addLast(binderHandler);
OvsdbRPC ovsdb = factory.getClient(node, OvsdbRPC.class);
}
@Override
- public void update(Node node, UpdateNotification updateNotification) {
+ public void update(Object context, UpdateNotification updateNotification) {
if (updateNotification == null) return;
- inventoryServiceInternal.processTableUpdates(node, updateNotification.getUpdate());
+ inventoryServiceInternal.processTableUpdates((Node)context, updateNotification.getUpdate());
}
@Override
- public void locked(Node node, List<String> ids) {
+ public void locked(Object context, List<String> ids) {
// TODO Auto-generated method stub
}
@Override
- public void stolen(Node node, List<String> ids) {
+ public void stolen(Object context, List<String> ids) {
// TODO Auto-generated method stub
}
import org.opendaylight.ovsdb.lib.message.TableUpdates;
import org.opendaylight.ovsdb.lib.notation.OvsDBSet;
import org.opendaylight.ovsdb.lib.table.Bridge;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
+import org.opendaylight.ovsdb.lib.table.Table;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.opendaylight.controller.sal.inventory.IPluginInInventoryService;
import org.opendaylight.ovsdb.lib.database.DatabaseSchema;
import org.opendaylight.ovsdb.lib.message.TableUpdates;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
+import org.opendaylight.ovsdb.lib.table.Table;
public interface InventoryServiceInternal extends IPluginInInventoryService {
public ConcurrentMap<String, ConcurrentMap<String, Table<?>>> getCache(Node n);
import org.apache.commons.collections.MapUtils;
import org.opendaylight.ovsdb.lib.database.DatabaseSchema;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
+import org.opendaylight.ovsdb.lib.table.Table;
public class NodeDB {
private DatabaseSchema schema;
import org.opendaylight.controller.sal.core.Node;
import org.opendaylight.controller.sal.utils.Status;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
+import org.opendaylight.ovsdb.lib.table.Table;
public interface OVSDBConfigService {
public StatusWithUuid insertRow (Node node, String tableName, String parentUUID, Table<?> row);
package org.opendaylight.ovsdb.plugin;
import org.opendaylight.controller.sal.core.Node;
-import org.opendaylight.ovsdb.lib.table.internal.Table;
+import org.opendaylight.ovsdb.lib.table.Table;
public interface OVSDBInventoryListener {
public void nodeAdded(Node node);
<?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>
- <prerequisites>
- <maven>3.0</maven>
- </prerequisites>
<parent>
<groupId>org.opendaylight.ovsdb</groupId>
- <artifactId>commons.ovsdb</artifactId>
+ <artifactId>ovsdb_commons</artifactId>
<version>1.1.0-SNAPSHOT</version>
<relativePath>commons/parent</relativePath>
</parent>
<groupId>org.opendaylight.ovsdb</groupId>
- <artifactId>ovsdb.project</artifactId>
+ <artifactId>ovsdb_project</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
- <scm>
- <connection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</connection>
- <developerConnection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</developerConnection>
- <url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
- <tag>HEAD</tag>
- </scm>
+ <prerequisites>
+ <maven>3.0</maven>
+ </prerequisites>
<modules>
- <module>ovsdb</module>
- <module>northbound/ovsdb</module>
+ <module>library</module>
+ <module>plugin</module>
+ <module>northbound</module>
<module>neutron</module>
<module>commons/parent</module>
<module>distribution/opendaylight</module>
</modules>
+ <scm>
+ <connection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</connection>
+ <developerConnection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</developerConnection>
+ <tag>HEAD</tag>
+ <url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
+ </scm>
</project>