import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ExecutionException;
+import com.google.common.collect.ImmutableSet;
import org.eclipse.osgi.framework.console.CommandInterpreter;
import org.eclipse.osgi.framework.console.CommandProvider;
import org.opendaylight.controller.clustering.services.IClusterGlobalServices;
for (InetAddress ofControllerAddress : ofControllerAddrs) {
String newController = "tcp:"+ofControllerAddress.getHostAddress()+":"+ofControllerPort;
Controller controllerRow = connection.getClient().createTypedRowWrapper(Controller.class);
- controllerRow.setTarget(newController);
+ controllerRow.setTarget(ImmutableSet.of(newController));
status = this.insertRow(node, controllerRow.getSchema().getName(), bridgeUUID, controllerRow.getRow());
}
return status.isSuccess();
Connection connection = connectionService.getConnection(node);
OvsdbClient client = connection.getClient();
Manager manager = client.createTypedRowWrapper(Manager.class);
- manager.setTarget(managerip);
+ manager.setTarget(ImmutableSet.of(managerip));
OpenVSwitch openVSwitch = connection.getClient().getTypedRowWrapper(OpenVSwitch.class, null);
ConcurrentMap<String, Row> row = this.getRows(node, openVSwitch.getSchema().getName());
import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
-/*
- * Reusing the existing Table definitions and many of columns are not defined here
- * TODO : Fill up the missing Columns and include Supported DB Version
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * This class is a typed interface to the Controller Table
*/
-@TypedTable(name="Controller", database="Open_vSwitch")
+@TypedTable (name="Controller", database="Open_vSwitch", fromVersion="1.0.0")
public interface Controller extends TypedBaseTable<GenericTableSchema> {
- @TypedColumn(name="target", method=MethodType.GETCOLUMN)
- public Column<GenericTableSchema, String> getTargetColumn();
+ @TypedColumn (name = "target", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
+ public Column<GenericTableSchema, Set <String>> getTargetColumn();
- @TypedColumn(name="target", method=MethodType.SETDATA)
- public void setTarget(String target);
+ @TypedColumn (name = "target", method = MethodType.SETDATA, fromVersion = "1.0.0")
+ public void setTarget(Set <String> target);
- @TypedColumn(name="controller_burst_limit", method=MethodType.GETCOLUMN)
+ @TypedColumn (name = "controller_burst_limit", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
public Column<GenericTableSchema, Integer> getBurstLimitColumn();
- @TypedColumn(name="controller_burst_limit", method=MethodType.SETDATA)
+ @TypedColumn (name = "controller_burst_limit", method = MethodType.SETDATA, fromVersion = "1.0.0")
public void setBurstLimit(Integer burstLimit);
- @TypedColumn(name="controller_rate_limit", method=MethodType.GETCOLUMN)
+ @TypedColumn (name = "controller_rate_limit", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
public Column<GenericTableSchema, Integer> getRateLimitColumn();
- @TypedColumn(name="controller_rate_limit", method=MethodType.SETDATA)
- public void setRateLimit(Integer burstLimit);
+ @TypedColumn (name = "controller_rate_limit", method = MethodType.SETDATA, fromVersion = "1.0.0")
+ public void setRateLimit(Integer rateLimit);
+
+ @TypedColumn (name = "connection_mode", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
+ public Column<GenericTableSchema, Set<String>> getConnectionModeColumn();
+
+ @TypedColumn (name = "connection_mode", method = MethodType.SETDATA, fromVersion = "1.0.0")
+ public void setConnectionMode(Set<String> connectionMode);
+
+ @TypedColumn (name = "enable_async_messages", method = MethodType.GETCOLUMN, fromVersion = "6.7.0")
+ public Column<GenericTableSchema, Set<Boolean>> getEnableAsyncMessagesColumn();
+
+ @TypedColumn (name = "enable_async_messages", method = MethodType.SETDATA, fromVersion = "6.7.0")
+ public void setEnableAsyncMessages(Set<Boolean> enableAsyncMessages);
+
+ @TypedColumn (name = "external_ids", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
+ public Column<GenericTableSchema, Map<String, String>> getExternalIdsColumn();
+
+ @TypedColumn (name = "external_ids", method = MethodType.SETDATA, fromVersion = "1.0.0")
+ public void setExternalIds(Map<String, String> externalIds);
+
+ @TypedColumn (name = "local_netmask", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
+ public Column<GenericTableSchema, Set<String>> getLocalNetmaskColumn();
+
+ @TypedColumn (name = "local_netmask", method = MethodType.SETDATA, fromVersion = "1.0.0")
+ public void setLocalNetmask(Set<String> localNetmask);
+
+ @TypedColumn (name = "local_gateway", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
+ public Column<GenericTableSchema, Set<String>> getLocalGatewayColumn();
+
+ @TypedColumn (name = "local_gateway", method = MethodType.SETDATA, fromVersion = "1.0.0")
+ public void setLocalGateway(Set<String> localGateway);
+
+ @TypedColumn (name = "status", method = MethodType.GETCOLUMN, fromVersion = "1.1.0")
+ public Column<GenericTableSchema, Map<String, String>> getStatusColumn();
+
+ @TypedColumn (name = "status", method = MethodType.SETDATA, fromVersion = "1.1.0")
+ public void setStatus(Map<String, String> status);
+
+ @TypedColumn (name = "role", method = MethodType.GETCOLUMN, fromVersion = "1.1.0")
+ public Column<GenericTableSchema, Set<String>> getRoleColumn();
+
+ @TypedColumn (name = "role", method = MethodType.SETDATA, fromVersion = "1.1.0")
+ public void setRole(Set<String> role);
+
+ @TypedColumn (name = "inactivity_probe", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
+ public Column<GenericTableSchema, Set<Integer>> getInactivityProbeColumn();
+
+ @TypedColumn (name = "inactivity_probe", method = MethodType.SETDATA, fromVersion = "1.0.0")
+ public void setInactivityProbe(Set<Integer> inactivityProbe);
+
+ @TypedColumn (name = "is_connected", method = MethodType.GETCOLUMN, fromVersion = "1.1.0")
+ public Column<GenericTableSchema, Boolean> getIsConnectedColumn();
+
+ @TypedColumn (name = "is_connected", method = MethodType.SETDATA, fromVersion = "1.1.0")
+ public void setIsConnected(Boolean isConnected);
+
+ @TypedColumn (name = "other_config", method = MethodType.GETCOLUMN, fromVersion = "6.8.0")
+ public Column<GenericTableSchema, Map<String, String>> getOtherConfigColumn();
+
+ @TypedColumn (name = "other_config", method = MethodType.SETDATA, fromVersion = "6.8.0")
+ public void setOtherConfig(Map<String, String> otherConfig);
+
+ @TypedColumn (name = "max_backoff", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
+ public Column<GenericTableSchema, Integer> getMaxBackoffColumn();
+
+ @TypedColumn (name = "max_backoff", method = MethodType.SETDATA, fromVersion = "1.0.0")
+ public void setMaxBackoff(Integer maxBackoff);
+
+ @TypedColumn (name = "local_ip", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
+ public Column<GenericTableSchema, Set<String>> getLocalIpColumn();
+
+ @TypedColumn (name = "local_ip", method = MethodType.SETDATA, fromVersion = "1.0.0")
+ public void setLocalIp(Set<String> localIp);
+
+ @TypedColumn (name = "discover_update_resolv_conf", method = MethodType.GETCOLUMN,
+ fromVersion="1.0.0", untilVersion="3.0.0")
+ public Column<GenericTableSchema, Set<String>> getDiscoverUpdateResolvConfColumn();
+
+ @TypedColumn (name = "discover_update_resolv_conf", method = MethodType.SETDATA,
+ fromVersion="1.0.0", untilVersion="3.0.0")
+ public void setDiscoverUpdateResolvConf(Set<String> discoverUpdateResolvConf);
+
+ @TypedColumn (name = "discover_accept_regex", method = MethodType.GETCOLUMN,
+ fromVersion="1.0.0", untilVersion="3.0.0")
+ public Column<GenericTableSchema, Set<String>> getDiscoverAcceptRegexColumn();
+
+ @TypedColumn (name = "discover_accept_regex", method = MethodType.SETDATA,
+ fromVersion="1.0.0", untilVersion="3.0.0")
+ public void setDiscoverAcceptRegex(Set<String> discoverAcceptRegex);
}
import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
-/*
- * Reusing the existing Table definitions and many of columns are not defined here
- * TODO : Fill up the missing Columns and include Supported DB Version
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * This class is a typed interface to the Manager Table
*/
-@TypedTable(name="Manager", database="Open_vSwitch")
+@TypedTable (name="Manager", database="Open_vSwitch", fromVersion = "1.0.0")
public interface Manager extends TypedBaseTable<GenericTableSchema> {
- @TypedColumn(name="target", method=MethodType.GETCOLUMN)
- public Column<GenericTableSchema, String> getTargetColumn() ;
- @TypedColumn(name="target", method=MethodType.SETDATA)
- public void setTarget(String target) ;
-}
+
+ @TypedColumn (name="target", method= MethodType.GETCOLUMN, fromVersion = "1.0.0")
+ public Column<GenericTableSchema, Set<String>> getTargetColumn();
+
+ @TypedColumn (name="target", method= MethodType.SETDATA, fromVersion = "1.0.0")
+ public void setTarget(Set<String> target) ;
+
+ @TypedColumn (name = "is_connected", method = MethodType.GETCOLUMN, fromVersion = "1.1.0")
+ public Column<GenericTableSchema, Boolean> getIsConnectedColumn();
+
+ @TypedColumn (name = "is_connected", method = MethodType.SETDATA, fromVersion = "1.1.0")
+ public void setIsConnected(Boolean isConnected);
+
+ @TypedColumn (name = "other_config", method = MethodType.GETCOLUMN, fromVersion = "6.8.0")
+ public Column<GenericTableSchema, Map<String, String>> getOtherConfigColumn();
+
+ @TypedColumn (name = "other_config", method = MethodType.SETDATA, fromVersion = "6.8.0")
+ public void setOtherConfig(Map<String, String> otherConfig);
+
+ @TypedColumn (name = "external_ids", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
+ public Column<GenericTableSchema, Map<String, String>> getExternalIdsColumn();
+
+ @TypedColumn (name = "external_ids", method = MethodType.SETDATA, fromVersion = "1.0.0")
+ public void setExternalIds(Map<String, String> externalIds);
+
+ @TypedColumn (name = "max_backoff", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
+ public Column<GenericTableSchema, Set<Integer>> getMaxBackoffColumn();
+
+ @TypedColumn (name = "max_backoff", method = MethodType.SETDATA, fromVersion = "1.0.0")
+ public void setMaxBackoff(Set<Integer> maxBackoff);
+
+ @TypedColumn (name = "status", method = MethodType.GETCOLUMN, fromVersion = "1.1.0")
+ public Column<GenericTableSchema, Map<String, String>> getStatusColumn();
+
+ @TypedColumn (name = "status", method = MethodType.SETDATA, fromVersion = "1.1.0")
+ public void setStatus(Map<String, String> status);
+
+ @TypedColumn (name = "inactivity_probe", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
+ public Column<GenericTableSchema, Set<Integer>> getInactivityProbeColumn();
+
+ @TypedColumn (name = "inactivity_probe", method = MethodType.SETDATA, fromVersion = "1.0.0")
+ public void setInactivityProbe(Set<Integer> inactivityProbe);
+
+ @TypedColumn (name = "connection_mode", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
+ public Column<GenericTableSchema, Set<String>> getConnectionModeColumn();
+
+ @TypedColumn (name = "connection_mode", method = MethodType.SETDATA, fromVersion = "1.0.0")
+ public void setConnectionMode(Set<String> connectionMode);
+}
\ No newline at end of file
*/
package org.opendaylight.ovsdb.schema.openvswitch;
-import java.util.Map;
-import java.util.Set;
-
import org.opendaylight.ovsdb.lib.notation.Column;
import org.opendaylight.ovsdb.lib.notation.UUID;
import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
+import java.util.Map;
+import java.util.Set;
-/*
- * Reusing the existing Table definitions and many of columns are not defined here
- * TODO : Fill up the missing Columns and include Supported DB Version
+/**
+ * This class is a typed interface to the Mirror Table
*/
-@TypedTable(name="Mirror", database="Open_vSwitch")
+@TypedTable (name="Mirror", database="Open_vSwitch", fromVersion="1.0.0")
public interface Mirror extends TypedBaseTable<GenericTableSchema> {
- @TypedColumn(name="name", method=MethodType.GETCOLUMN)
+ @TypedColumn(name="name", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
public Column<GenericTableSchema, String> getNameColumn();
- @TypedColumn(name="name", method=MethodType.SETDATA)
- public void setName(String name);
- @TypedColumn(name="select_src_port", method=MethodType.GETCOLUMN)
+ @TypedColumn(name="name", method=MethodType.SETDATA, fromVersion="1.0.0")
+ public void setName(Set<String> name);
+
+ @TypedColumn(name="name", method=MethodType.GETDATA, fromVersion="1.0.0")
+ public Set<String> getName();
+
+ @TypedColumn(name="select_src_port", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
public Column<GenericTableSchema, Set<UUID>> getSelectSrcPortColumn();
- @TypedColumn(name="select_src_port", method=MethodType.SETDATA)
+
+ @TypedColumn(name="select_src_port", method=MethodType.SETDATA, fromVersion="1.0.0")
public void setSelectSrcPort(Set<UUID> selectSrcPort);
- @TypedColumn(name="select_dst_port", method=MethodType.GETCOLUMN)
+ @TypedColumn(name="select_dst_port", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
public Column<GenericTableSchema, Set<UUID>> getSelectDstPortColumn();
- @TypedColumn(name="select_dst_port", method=MethodType.SETDATA)
+
+ @TypedColumn(name="select_dst_port", method=MethodType.SETDATA, fromVersion="1.0.0")
public void setSelectDstPort(Set<UUID> selectDstPrt);
- @TypedColumn(name="select_vlan", method=MethodType.GETCOLUMN)
+ @TypedColumn(name="select_vlan", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
public Column<GenericTableSchema, Set<Integer>> getSelectVlanColumn();
- @TypedColumn(name="select_vlan", method=MethodType.SETDATA)
+
+ @TypedColumn(name="select_vlan", method=MethodType.SETDATA, fromVersion="1.0.0")
public void setSelectVlan(Set<Integer> selectVlan);
- @TypedColumn(name="output_port", method=MethodType.GETCOLUMN)
+ @TypedColumn(name="output_port", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
public Column<GenericTableSchema, Set<UUID>> getOutputPortColumn();
- @TypedColumn(name="output_port", method=MethodType.SETDATA)
+
+ @TypedColumn(name="output_port", method=MethodType.SETDATA, fromVersion="1.0.0")
public void setOutputPort(Set<UUID> outputPort);
- @TypedColumn(name="output_vlan", method=MethodType.GETCOLUMN)
+ @TypedColumn (name="output_vlan", method= MethodType.GETCOLUMN, fromVersion="1.0.0")
public Column<GenericTableSchema, Set<Integer>> getOutputVlanColumn();
- @TypedColumn(name="output_vlan", method=MethodType.SETDATA)
+
+ @TypedColumn (name="output_vlan", method= MethodType.SETDATA, fromVersion="1.0.0")
public void setOutputVlan(Set<Integer> outputVlan);
- @TypedColumn(name="statistics", method=MethodType.GETCOLUMN)
+ @TypedColumn (name="statistics", method= MethodType.GETCOLUMN, fromVersion="6.4.0")
public Column<GenericTableSchema, Map<String, Integer>> getStatisticsColumn();
- @TypedColumn(name="statistics", method=MethodType.SETDATA)
+
+ @TypedColumn (name="statistics", method= MethodType.SETDATA, fromVersion="6.4.0")
public void setStatistics(Map<String, Integer> statistics);
- @TypedColumn(name="external_ids", method=MethodType.GETCOLUMN)
+ @TypedColumn (name="external_ids", method= MethodType.GETCOLUMN, fromVersion="1.0.0")
public Column<GenericTableSchema, Map<String, String>> getExternalIdsColumn();
- @TypedColumn(name="external_ids", method=MethodType.SETDATA)
+
+ @TypedColumn (name="external_ids", method= MethodType.SETDATA, fromVersion="1.0.0")
public void setExternalIds(Map<String, String> externalIds);
-}
+
+ @TypedColumn (name="select_all", method= MethodType.GETCOLUMN, fromVersion="6.2.0")
+ public Column<GenericTableSchema, Boolean> getSelectAllColumn();
+
+ @TypedColumn (name="select_all", method= MethodType.SETDATA, fromVersion="6.2.0")
+ public void setSelectAll(Boolean selectAll);
+}
\ No newline at end of file
package org.opendaylight.ovsdb.schema.openvswitch;
-import java.util.Map;
-
import org.opendaylight.ovsdb.lib.notation.Column;
import org.opendaylight.ovsdb.lib.notation.UUID;
import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
+import java.util.Map;
+import java.util.Set;
-/*
- * Reusing the existing Table definitions and many of columns are not defined here
- * TODO : Fill up the missing Columns and include Supported DB Version
+/**
+ * This class is a typed interface to the QoS Table
*/
-
-@TypedTable(name="Qos", database="Open_vSwitch")
+@TypedTable (name="QoS", database="Open_vSwitch", fromVersion="1.0.0")
public interface Qos extends TypedBaseTable<GenericTableSchema> {
- @TypedColumn(name="queues", method=MethodType.GETCOLUMN)
+
+ @TypedColumn (name="queues", method= MethodType.GETCOLUMN, fromVersion="1.0.0")
public Column<GenericTableSchema, Map<Integer, UUID>> getQueuesColumn() ;
- @TypedColumn(name="queues", method=MethodType.SETDATA)
+
+ @TypedColumn (name="queues", method= MethodType.SETDATA, fromVersion="1.0.0")
public void setQueues(Map<Integer, UUID> queues) ;
- @TypedColumn(name="type", method=MethodType.GETCOLUMN)
- public Column<GenericTableSchema, String> getTypeColumn() ;
- @TypedColumn(name="type", method=MethodType.SETDATA)
- public void setType(String type) ;
+ @TypedColumn (name="type", method= MethodType.GETCOLUMN, fromVersion="1.0.0")
+ public Column<GenericTableSchema, Set<String>> getTypeColumn() ;
+
+ @TypedColumn (name="type", method= MethodType.SETDATA, fromVersion="1.0.0")
+ public void setType(Set<String> type) ;
- @TypedColumn(name="other_config", method=MethodType.GETCOLUMN)
+ @TypedColumn (name="other_config", method= MethodType.GETCOLUMN, fromVersion="1.0.0")
public Column<GenericTableSchema, Map<String, String>> getOtherConfigColumn() ;
- @TypedColumn(name="other_config", method=MethodType.SETDATA)
+
+ @TypedColumn (name="other_config", method= MethodType.SETDATA, fromVersion="1.0.0")
public void setOtherConfig(Map<String, String> otherConfig) ;
- @TypedColumn(name="externalIds", method=MethodType.GETCOLUMN)
+ @TypedColumn (name="externalIds", method= MethodType.GETCOLUMN, fromVersion="1.0.0")
public Column<GenericTableSchema, Map<String, String>> getExternalIdsColumn() ;
- @TypedColumn(name="externalIds", method=MethodType.SETDATA)
+
+ @TypedColumn (name="externalIds", method= MethodType.SETDATA, fromVersion="1.0.0")
public void setExternalIds(Map<String, String> externalIds) ;
-}
+}
\ No newline at end of file
package org.opendaylight.ovsdb.schema.openvswitch;
-import java.util.Map;
-import java.util.Set;
-
import org.opendaylight.ovsdb.lib.notation.Column;
import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
import org.opendaylight.ovsdb.lib.schema.typed.MethodType;
import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
+import java.util.Map;
+import java.util.Set;
-/*
- * Reusing the existing Table definitions and many of columns are not defined here
- * TODO : Fill up the missing Columns and include Supported DB Version
+/**
+ * This class is a typed interface to the Queue Table
*/
-
-@TypedTable(name="Queue", database="Open_vSwitch")
+@TypedTable (name="Queue", database="Open_vSwitch", fromVersion="1.0.0")
public interface Queue extends TypedBaseTable<GenericTableSchema> {
- @TypedColumn(name="dscp", method=MethodType.GETCOLUMN)
+
+ @TypedColumn (name="dscp", method= MethodType.GETCOLUMN, fromVersion="1.0.0")
public Column<GenericTableSchema, Set<Integer>> getDscpColumn() ;
- @TypedColumn(name="dscp", method=MethodType.SETDATA)
+
+ @TypedColumn (name="dscp", method= MethodType.SETDATA, fromVersion="6.4.0")
public void setDscp(Set<Integer> dscp) ;
- @TypedColumn(name="other_config", method=MethodType.GETCOLUMN)
+ @TypedColumn (name="other_config", method= MethodType.GETCOLUMN, fromVersion="1.0.0")
public Column<GenericTableSchema, Map<String, String>> getOtherConfigColumn() ;
- @TypedColumn(name="other_config", method=MethodType.SETDATA)
+
+ @TypedColumn (name="other_config", method= MethodType.SETDATA, fromVersion="1.0.0")
public void setOtherConfig(Map<String, String> otherConfig) ;
- @TypedColumn(name="external_ids", method=MethodType.GETCOLUMN)
+ @TypedColumn (name="external_ids", method= MethodType.GETCOLUMN, fromVersion="1.0.0")
public Column<GenericTableSchema, Map<String, String>> getExternalIdsColumn() ;
- @TypedColumn(name="external_ids", method=MethodType.SETDATA)
+
+ @TypedColumn (name="external_ids", method= MethodType.SETDATA, fromVersion="1.0.0")
public void setExternalIds(Map<String, String> externalIds) ;
}
\ No newline at end of file
*/
package org.opendaylight.ovsdb.schema.openvswitch;
-import java.util.Map;
-
import org.opendaylight.ovsdb.lib.notation.Column;
import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
import org.opendaylight.ovsdb.lib.schema.typed.MethodType;
import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
-/*
- * Reusing the existing Table definitions and many of columns are not defined here
- * TODO : Fill up the missing Columns and include Supported DB Version
+
+import java.util.Map;
+
+/**
+ * This class is a typed interface to the SSL Table
*/
-@TypedTable(name="SSL", database="Open_vSwitch")
+@TypedTable (name="SSL", database="Open_vSwitch", fromVersion="1.0.0")
public interface SSL extends TypedBaseTable<GenericTableSchema> {
- @TypedColumn(name="ca_cert", method=MethodType.GETCOLUMN)
+
+ @TypedColumn (name="ca_cert", method= MethodType.GETCOLUMN, fromVersion="1.0.0")
public Column<GenericTableSchema, String> getCaCertColumn() ;
- @TypedColumn(name="ca_cert", method=MethodType.SETDATA)
+
+ @TypedColumn (name="ca_cert", method= MethodType.SETDATA, fromVersion="1.0.0")
public void setCaCert(String caCert) ;
- @TypedColumn(name="external_ids", method=MethodType.GETCOLUMN)
+ @TypedColumn (name="external_ids", method= MethodType.GETCOLUMN, fromVersion="1.0.0")
public Column<GenericTableSchema, Map<String, String>> getExternalIdsColumn() ;
- @TypedColumn(name="external_ids", method=MethodType.SETDATA)
+
+ @TypedColumn (name="external_ids", method= MethodType.SETDATA, fromVersion="1.0.0")
public void setExternalIds(Map<String, String> externalIds) ;
- @TypedColumn(name="bootstrap_ca_cert", method=MethodType.GETCOLUMN)
+ @TypedColumn (name="bootstrap_ca_cert", method= MethodType.GETCOLUMN, fromVersion="1.0.0")
public Column<GenericTableSchema, Boolean> getBootstrapCaCertColumn() ;
- @TypedColumn(name="bootstrap_ca_cert", method=MethodType.SETDATA)
+
+ @TypedColumn (name="bootstrap_ca_cert", method= MethodType.SETDATA, fromVersion="1.0.0")
public void setBootstrapCaCert(Boolean bootstrapCaCert) ;
- @TypedColumn(name="certificate", method=MethodType.GETCOLUMN)
+ @TypedColumn (name="certificate", method= MethodType.GETCOLUMN, fromVersion="1.0.0")
public Column<GenericTableSchema, String> getCertificateColumn() ;
- @TypedColumn(name="certificate", method=MethodType.SETDATA)
+
+ @TypedColumn (name="certificate", method= MethodType.SETDATA, fromVersion="1.0.0")
public void setCertificate(String certificate) ;
- @TypedColumn(name="private_key", method=MethodType.GETCOLUMN)
+ @TypedColumn (name="private_key", method= MethodType.GETCOLUMN, fromVersion="1.0.0")
public Column<GenericTableSchema, String> getPrivateKeyColumn() ;
- @TypedColumn(name="private_key", method=MethodType.SETDATA)
+
+ @TypedColumn (name="private_key", method= MethodType.SETDATA, fromVersion="1.0.0")
public void setPrivateKey(String private_key) ;
-}
+}
\ No newline at end of file
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeoutException;
+import com.google.common.collect.ImmutableSet;
import junit.framework.Assert;
@Test
public void createTypedController() throws IOException, InterruptedException, ExecutionException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
Controller controller1 = ovs.createTypedRowWrapper(Controller.class);
- controller1.setTarget("tcp:1.1.1.1:6640");
+ controller1.setTarget(ImmutableSet.of("tcp:1.1.1.1:6640"));
Controller controller2 = ovs.createTypedRowWrapper(Controller.class);
- controller2.setTarget("tcp:2.2.2.2:6640");
+ controller2.setTarget(ImmutableSet.of("tcp:2.2.2.2:6640"));
Bridge bridge = ovs.getTypedRowWrapper(Bridge.class, null);
--- /dev/null
+/*
+ * Copyright (C) 2014 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
+ *
+ */
+
+package org.opendaylight.ovsdb.schema.openvswitch;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Sets;
+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.UpdateNotification;
+import org.opendaylight.ovsdb.lib.notation.Mutator;
+import org.opendaylight.ovsdb.lib.notation.UUID;
+import org.opendaylight.ovsdb.lib.operations.OperationResult;
+import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeoutException;
+
+import static org.opendaylight.ovsdb.lib.operations.Operations.op;
+
+
+public class ManagerTestCases extends OpenVswitchSchemaTestBase {
+ Logger logger = LoggerFactory.getLogger(ManagerTestCases.class);
+
+ @Before
+ public void setUp() throws ExecutionException, InterruptedException, TimeoutException, IOException {
+ super.setUp();
+ }
+
+ @Test
+ public void testCreateTypedManagerTable() throws InterruptedException, ExecutionException, IllegalArgumentException {
+
+ String mgrUuidStr = "sslUuidName";
+ ImmutableMap<String, String> externalIds = ImmutableMap.of("slaveof", "themaster");
+
+ UUID openVSwitchRowUuid = this.getOpenVSwitchTableUuid(ovs, OpenVswitchSchemaSuiteIT.getTableCache());
+ OpenVSwitch openVSwitch = ovs.getTypedRowWrapper(OpenVSwitch.class, null);
+
+ Manager manager = ovs.createTypedRowWrapper(Manager.class);
+ manager.setInactivityProbe(Sets.newHashSet(8192));
+ manager.setMaxBackoff(Sets.newHashSet(4094));
+ manager.setTarget(Sets.newHashSet("172.16.50.50:6640"));
+ manager.setExternalIds(externalIds);
+
+ int insertSslOperationIndex = 0;
+ TransactionBuilder transactionBuilder = ovs.transactBuilder()
+ .add(op.insert(manager.getSchema())
+ .withId(mgrUuidStr)
+ .value(manager.getTargetColumn())
+ .value(manager.getInactivityProbeColumn())
+ .value(manager.getMaxBackoffColumn())
+ .value(manager.getExternalIdsColumn()))
+ .add(op.comment("Inserting Slave Manager"))
+ .add(op.mutate(openVSwitch.getSchema())
+ .addMutation(openVSwitch.getManagerOptionsColumn().getSchema(), Mutator.INSERT,
+ Sets.newHashSet(new UUID(mgrUuidStr)))
+ .where(openVSwitch.getUuidColumn().getSchema().opEqual(openVSwitchRowUuid))
+ .build());
+
+ ListenableFuture<List<OperationResult>> results = transactionBuilder.execute();
+ List<OperationResult> operationResults = results.get();
+ Assert.assertFalse(operationResults.isEmpty());
+ for (OperationResult result : operationResults) {
+ Assert.assertNull(result.getError());
+ }
+ // Store the returned SSL row UUID to be used in the TearDown deletion transaction
+ OpenVswitchSchemaSuiteIT.setTestManagerUuid(operationResults.get(insertSslOperationIndex).getUuid());
+ // Check if Results matches the number of operations in transaction
+ Assert.assertEquals(transactionBuilder.getOperations().size(), operationResults.size());
+ logger.info("Mutate operation results for Manager = {} ", operationResults);
+
+ }
+
+ @Override
+ public void update(Object context, UpdateNotification upadateNotification) {
+
+ }
+
+ @Override
+ public void locked(Object context, List<String> ids) {
+
+ }
+
+ @Override
+ public void stolen(Object context, List<String> ids) {
+
+ }
+}
--- /dev/null
+/*
+ * Copyright (C) 2014 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 : Brent Salisbury, Dave Tucker
+ */
+
+package org.opendaylight.ovsdb.schema.openvswitch;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Sets;
+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.UpdateNotification;
+import org.opendaylight.ovsdb.lib.notation.Mutator;
+import org.opendaylight.ovsdb.lib.notation.UUID;
+import org.opendaylight.ovsdb.lib.operations.OperationResult;
+import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeoutException;
+
+import static org.opendaylight.ovsdb.lib.operations.Operations.op;
+
+public class MirrorTestCases extends OpenVswitchSchemaTestBase {
+
+ Logger logger = LoggerFactory.getLogger(MirrorTestCases.class);
+
+ @Before
+ public void setUp() throws ExecutionException, InterruptedException, TimeoutException, IOException {
+ super.setUp();
+ }
+
+ @Test
+ public void testCreateTypedMirror() throws InterruptedException, ExecutionException, IllegalArgumentException{
+
+ String mirrorUuidStr = "testMirror";
+ String mirrorName = "my_name_is_mirror";
+ Integer outputVid = 1024;
+ Integer selectVid = 2048;
+
+ Mirror mirror = ovs.createTypedRowWrapper(Mirror.class);
+ mirror.setName(ImmutableSet.of(mirrorName));
+ mirror.setExternalIds(ImmutableMap.of("overlays", "ftw"));
+ mirror.setOutputVlan(ImmutableSet.of(outputVid));
+ mirror.setSelectVlan(ImmutableSet.of(selectVid));
+ mirror.setExternalIds(ImmutableMap.of("reading", "urmail"));
+ Bridge bridge = ovs.getTypedRowWrapper(Bridge.class, null);
+
+ int insertMirrorOperationIndex = 0;
+ TransactionBuilder transactionBuilder = ovs.transactBuilder()
+ .add(op.insert(mirror.getSchema())
+ .withId(mirrorUuidStr)
+ .value(mirror.getNameColumn())
+ .value(mirror.getExternalIdsColumn()))
+ .add(op.mutate(bridge.getSchema())
+ .addMutation(bridge.getMirrorsColumn().getSchema(), Mutator.INSERT,
+ Sets.newHashSet(new UUID(mirrorUuidStr)))
+ .where(bridge.getNameColumn().getSchema().opEqual(TEST_BRIDGE_NAME))
+ .build());
+
+ ListenableFuture<List<OperationResult>> results = transactionBuilder.execute();
+ List<OperationResult> operationResults = results.get();
+ Assert.assertFalse(operationResults.isEmpty());
+ for (OperationResult result : operationResults) {
+ Assert.assertNull(result.getError());
+ }
+ // Check if Results matches the number of operations in transaction
+ Assert.assertEquals(transactionBuilder
+ .getOperations().size(), operationResults.size());
+ // Store the returned Mirror row UUID to be used in the TearDown cleanup transaction
+ OpenVswitchSchemaSuiteIT.setTestMirrorUuid
+ (operationResults.get(insertMirrorOperationIndex).getUuid());
+ logger.info("Insert, Update & Mutate operation results for QOS " + operationResults);
+ }
+
+ @Override
+ public void update(Object context, UpdateNotification upadateNotification) {
+
+ }
+
+ @Override
+ public void locked(Object context, List<String> ids) {
+
+ }
+
+ @Override
+ public void stolen(Object context, List<String> ids) {
+
+ }
+}
IpfixTestCases.class,
FlowSampleCollectorSetTestCases.class,
FlowTableTestCases.class,
+ SslTestCases.class,
+ QosTestCases.class,
+ QueueTestCases.class,
+ ManagerTestCases.class,
+ MirrorTestCases.class,
TearDown.class
})
public class OpenVswitchSchemaSuiteIT {
// Keep this data between test runs
static OvsdbClient ovsdbClient;
static UUID testBridgeUuid;
+ static UUID testSslUuid;
+ static UUID testQosUuid;
+ static UUID testQosPortUuid;
+ static UUID testQueueUuid;
+ static UUID testManagerUuid;
+ static UUID testMirrorUuid;
+
static Map<String, Map<UUID, Row>> tableCache = new HashMap<String, Map<UUID, Row>>();
public static OvsdbClient getOvsdbClient() {
OpenVswitchSchemaSuiteIT.testBridgeUuid = testBridgeUuid;
}
+ public static UUID getTestSslUuid() {
+ return testSslUuid;
+ }
+
+ public static void setTestSslUuid(UUID testSslUuid) {
+ OpenVswitchSchemaSuiteIT.testSslUuid = testSslUuid;
+ }
+
+ public static UUID getTestQosUuid() {
+ return testQosUuid;
+ }
+
+ public static void setTestQosUuid(UUID testQosUuid) {
+ OpenVswitchSchemaSuiteIT.testQosUuid = testQosUuid;
+ }
+
+ public static UUID getTestQosPortUuid() {
+ return testQosPortUuid;
+ }
+
+ public static void setTestQosPortUuid(UUID testQosPortUuid) {
+ OpenVswitchSchemaSuiteIT.testQosPortUuid = testQosPortUuid;
+ }
+
+ public static UUID getTestQueueUuid() {
+ return testQueueUuid;
+ }
+
+ public static void setTestQueueUuid(UUID testQueueUuid) {
+ OpenVswitchSchemaSuiteIT.testQueueUuid = testQueueUuid;
+ }
+
+ public static UUID getTestManagerUuid() {
+ return testManagerUuid;
+ }
+
+ public static void setTestManagerUuid(UUID testManagerUuid) {
+ OpenVswitchSchemaSuiteIT.testManagerUuid = testManagerUuid;
+ }
+
+ public static UUID getTestMirrorUuid() {
+ return testMirrorUuid;
+ }
+
+ public static void setTestMirrorUuid(UUID testMirrorUuid) {
+ OpenVswitchSchemaSuiteIT.testMirrorUuid = testMirrorUuid;
+ }
+
public static Map<String, Map<UUID, Row>> getTableCache() {
return tableCache;
}
+
+
}
--- /dev/null
+/*
+ * Copyright (C) 2014 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
+ *
+ */
+package org.opendaylight.ovsdb.schema.openvswitch;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Sets;
+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.UpdateNotification;
+import org.opendaylight.ovsdb.lib.notation.Mutator;
+import org.opendaylight.ovsdb.lib.notation.UUID;
+import org.opendaylight.ovsdb.lib.operations.OperationResult;
+import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import java.io.IOException;
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeoutException;
+
+import static org.opendaylight.ovsdb.lib.operations.Operations.op;
+
+public class QosTestCases extends OpenVswitchSchemaTestBase {
+ Logger logger = LoggerFactory.getLogger(QosTestCases.class);
+
+ @Before
+ public void setUp() throws ExecutionException, InterruptedException, TimeoutException, IOException {
+ super.setUp();
+ }
+
+ /**
+ * Test creates a functional port (including Interface table row)
+ * on br_test with a reference to a QoS row. The QueueTestCases
+ * IT test builds upon these elements and adds a Queue that is
+ * referenced in the QoS queue column.
+ *
+ * @throws InterruptedException the interrupted exception
+ * @throws ExecutionException the execution exception
+ */
+ @Test
+ public void testCreateTypedQos() throws InterruptedException, ExecutionException {
+
+ String portUuidStr = "testQosPortUuid";
+ String intfUuidStr = "testQosIntfUuid";
+ String qosUuidStr = "testQosUuid";
+ String qosPort = "testQosPort";
+
+
+ Port port = ovs.createTypedRowWrapper(Port.class);
+ port.setName(qosPort);
+ port.setInterfaces(ImmutableSet.of(new UUID(intfUuidStr)));
+ port.setQos(ImmutableSet.of(new UUID(qosUuidStr)));
+ port.setOtherConfig(ImmutableMap.of("m0r3", "c0ff33"));
+
+ Interface intf = ovs.createTypedRowWrapper(Interface.class);
+ intf.setName(port.getNameColumn().getData());
+ intf.setOtherConfig(ImmutableMap.of("proto", "duction"));
+ intf.setExternalIds(ImmutableMap.of("stringly", "typed"));
+
+ Qos qos = ovs.createTypedRowWrapper(Qos.class);
+ qos.setOtherConfig(ImmutableMap.of("mmm", "kay"));
+ qos.setType(ImmutableSet.of("404"));
+
+ int insertPortOperationIndex = 0;
+ int insertQosOperationIndex = 2;
+ Bridge bridge = ovs.getTypedRowWrapper(Bridge.class, null);
+
+ TransactionBuilder transactionBuilder = ovs.transactBuilder()
+ .add(op.insert(port.getSchema())
+ .withId(portUuidStr)
+ .value(port.getNameColumn()))
+ .add(op.insert(intf.getSchema())
+ .withId(intfUuidStr)
+ .value(intf.getExternalIdsColumn())
+ .value(intf.getNameColumn())
+ .value(intf.getOtherConfigColumn()))
+ .add(op.insert(qos.getSchema())
+ .withId(qosUuidStr)
+ .value(qos.getTypeColumn())
+ .value(qos.getOtherConfigColumn()))
+ .add(op.update(port.getSchema())
+ .set(port.getOtherConfigColumn())
+ .set(port.getInterfacesColumn())
+ .set(port.getQosColumn())
+ .where(port.getNameColumn().getSchema().opEqual(port.getName()))
+ .build())
+ .add(op.mutate(bridge.getSchema())
+ .addMutation(bridge.getPortsColumn().getSchema(), Mutator.INSERT,
+ Sets.newHashSet(new UUID(portUuidStr)))
+ .where(bridge.getNameColumn().getSchema().opEqual(TEST_BRIDGE_NAME))
+ .build());
+
+ ListenableFuture<List<OperationResult>> results = transactionBuilder.execute();
+ List<OperationResult> operationResults = results.get();
+ Assert.assertFalse(operationResults.isEmpty());
+ for (OperationResult result : operationResults) {
+ Assert.assertNull(result.getError());
+ }
+ // Check if Results matches the number of operations in transaction
+ Assert.assertEquals(transactionBuilder
+ .getOperations().size(), operationResults.size());
+ // Store the returned QoS row UUID to be used in the TearDown deletion transaction
+ OpenVswitchSchemaSuiteIT.setTestQosUuid
+ (operationResults.get(insertQosOperationIndex).getUuid());
+ // Store the returned Port row UUID to be used in the TearDown deletion transaction
+ OpenVswitchSchemaSuiteIT.setTestQosPortUuid
+ (operationResults.get(insertPortOperationIndex).getUuid());
+ logger.info("Insert, Update & Mutate operation results for QOS " + operationResults);
+ }
+
+ @Override
+ public void update(Object context, UpdateNotification upadateNotification) {
+
+ }
+
+ @Override
+ public void locked(Object context, List<String> ids) {
+
+ }
+
+ @Override
+ public void stolen(Object context, List<String> ids) {
+
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (C) 2014 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
+ *
+ */
+package org.opendaylight.ovsdb.schema.openvswitch;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+
+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.UpdateNotification;
+import org.opendaylight.ovsdb.lib.notation.Mutator;
+import org.opendaylight.ovsdb.lib.notation.UUID;
+import org.opendaylight.ovsdb.lib.operations.OperationResult;
+import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeoutException;
+
+import static org.opendaylight.ovsdb.lib.operations.Operations.op;
+
+public class QueueTestCases extends OpenVswitchSchemaTestBase {
+ Logger logger = LoggerFactory.getLogger(QueueTestCases.class);
+
+ @Before
+ public void setUp() throws ExecutionException, InterruptedException, TimeoutException, IOException {
+ super.setUp();
+ }
+
+ @Test
+ public void testCreateTypedQueueTable() throws InterruptedException, ExecutionException, IllegalArgumentException {
+ /**
+ * This is an arbitrary String that is a placeholder for
+ * the future UUID generated by the OVSDB Server in the
+ * future transaction. While it is possible to generate
+ * ones own UUID for the transaction it is not recommended
+ * since it wouldn't add any conceivable value.
+ */
+ String queueUuidStr = "queueUuidStr";
+ Integer dscpVal = 4;
+ Queue queue = ovs.createTypedRowWrapper(Queue.class);
+ // Example of explicit ImmutableSet/Map Attribute declaration
+ ImmutableSet<Integer> dscp = ImmutableSet.of(dscpVal);
+ ImmutableMap<String, String> externalIds = ImmutableMap.of("little", "coat");
+ // Example of condensing the attributes bindings in one line
+ queue.setOtherConfig(ImmutableMap.of("war", "onfun"));
+ // Bind the Attributes to the transaction. These values end up in columns.
+ queue.setExternalIds(externalIds);
+ queue.setDscp(dscp);
+ // Get the parent Qos table row UUID to insert the queue.
+ Qos qos = ovs.getTypedRowWrapper(Qos.class, null);
+ // Queue key that is mapped to the queue record/value/ofp_action_enqueue
+ Integer queueKey = Integer.valueOf(0);
+ // The transaction index for the Queue insert is used to store the Queue UUID
+ int insertQueueOperationIndex = 0;
+ // Reference the Port row to insert the Queue with UID or Port name
+ TransactionBuilder transactionBuilder = ovs.transactBuilder()
+ .add(op.insert(queue.getSchema())
+ .withId(queueUuidStr)
+ .value(queue.getDscpColumn())
+ .value(queue.getExternalIdsColumn())
+ .value(queue.getOtherConfigColumn()))
+ .add(op.mutate(qos.getSchema())
+ .addMutation(qos.getQueuesColumn().getSchema(), Mutator.INSERT,
+ ImmutableMap.of(queueKey, new UUID(queueUuidStr)))
+ .where(qos.getUuidColumn().getSchema()
+ .opEqual(OpenVswitchSchemaSuiteIT.getTestQosUuid()))
+ .build());
+
+ ListenableFuture<List<OperationResult>> results = transactionBuilder.execute();
+ List<OperationResult> operationResults = results.get();
+ Assert.assertFalse(operationResults.isEmpty());
+ for (OperationResult result : operationResults) {
+ Assert.assertNull(result.getError());
+ }
+ // Store the returned Queue row UUID to be used in the TearDown deletion transaction
+ OperationResult operationResult = operationResults.get(insertQueueOperationIndex);
+ OpenVswitchSchemaSuiteIT.setTestQueueUuid(operationResult.getUuid());
+ // Check if Results matches the number of operations in transaction
+ Assert.assertEquals(transactionBuilder.getOperations().size(), operationResults.size());
+ logger.info("Insert & Mutate operation results for Queue = {} ", operationResults);
+
+ }
+
+ @Override
+ public void update(Object context, UpdateNotification upadateNotification) {
+
+ }
+
+ @Override
+ public void locked(Object context, List<String> ids) {
+
+ }
+
+ @Override
+ public void stolen(Object context, List<String> ids) {
+
+ }
+}
--- /dev/null
+/*
+ * Copyright (C) 2014 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
+ *
+ */
+
+package org.opendaylight.ovsdb.schema.openvswitch;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Sets;
+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.UpdateNotification;
+import org.opendaylight.ovsdb.lib.notation.Mutator;
+import org.opendaylight.ovsdb.lib.notation.UUID;
+import org.opendaylight.ovsdb.lib.operations.OperationResult;
+import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeoutException;
+
+import static org.opendaylight.ovsdb.lib.operations.Operations.op;
+
+public class SslTestCases extends OpenVswitchSchemaTestBase {
+ Logger logger = LoggerFactory.getLogger(SslTestCases.class);
+
+ @Before
+ public void setUp() throws ExecutionException, InterruptedException, TimeoutException, IOException {
+ super.setUp();
+ }
+
+ @Test
+ public void testCreateTypedSslTable() throws InterruptedException, ExecutionException, IllegalArgumentException {
+
+ String sslUuidStr = "sslUuidName";
+ String caCert = "PARC";
+ String certificate = "01101110 01100101 01110010 01100100";
+ String privateKey = "SSL_Table_Test_Secret";
+ ImmutableMap<String, String> externalIds = ImmutableMap.of("roomba", "powered");
+
+ SSL ssl = ovs.createTypedRowWrapper(SSL.class);
+ ssl.setCaCert(caCert);
+ ssl.setCertificate(certificate);
+ ssl.setPrivateKey(privateKey);
+ ssl.setExternalIds(externalIds);
+ // Get the parent OVS table UUID in it's single row
+ UUID openVSwitchRowUuid = this.getOpenVSwitchTableUuid(ovs, OpenVswitchSchemaSuiteIT.getTableCache());
+ OpenVSwitch openVSwitch = ovs.getTypedRowWrapper(OpenVSwitch.class, null);
+ // The transaction index for the SSL insert is used to store the SSL UUID
+ int insertSslOperationIndex = 0;
+ TransactionBuilder transactionBuilder = ovs.transactBuilder()
+ .add(op.insert(ssl.getSchema())
+ .withId(sslUuidStr)
+ .value(ssl.getCertificateColumn())
+ .value(ssl.getPrivateKeyColumn())
+ .value(ssl.getCaCertColumn())
+ .value(ssl.getExternalIdsColumn()))
+ .add(op.mutate(openVSwitch.getSchema())
+ .addMutation(openVSwitch.getSslColumn().getSchema(), Mutator.INSERT,
+ Sets.newHashSet(new UUID(sslUuidStr)))
+ .where(openVSwitch.getUuidColumn().getSchema().opEqual(openVSwitchRowUuid))
+ .build());
+
+ ListenableFuture<List<OperationResult>> results = transactionBuilder.execute();
+ List<OperationResult> operationResults = results.get();
+ Assert.assertFalse(operationResults.isEmpty());
+ for (OperationResult result : operationResults) {
+ Assert.assertNull(result.getError());
+ }
+ // Store the returned SSL row UUID to be used in the TearDown deletion transaction
+ OpenVswitchSchemaSuiteIT.setTestSslUuid(operationResults.get(insertSslOperationIndex).getUuid());
+ // Check if Results matches the number of operations in transaction
+ Assert.assertEquals(transactionBuilder.getOperations().size(), operationResults.size());
+ logger.info("Insert & Mutate operation results for SSL = {} ", operationResults);
+
+ }
+
+ @Override
+ public void update(Object context, UpdateNotification upadateNotification) {
+
+ }
+
+ @Override
+ public void locked(Object context, List<String> ids) {
+
+ }
+
+ @Override
+ public void stolen(Object context, List<String> ids) {
+
+ }
+}
import com.google.common.collect.Sets;
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.UpdateNotification;
schemaVersion = ovs.getDatabaseSchema("Open_vSwitch").getVersion();
}
+ /**
+ * Tear down the rows in the OVSDB server created by the
+ * integration tests. Deleting the parent Bridge Row in the
+ * Bridge table will cause the OVSDB server to GC most most
+ * of the table rows. The remaining tables with references
+ * are deleted with the follwoing transaction.
+ *
+ * @throws InterruptedException the interrupted exception
+ * @throws ExecutionException the execution exception
+ * @throws IOException the iO exception
+ * @throws TimeoutException the timeout exception
+ */
@Test
public void tearDown() throws InterruptedException, ExecutionException, IOException, TimeoutException {
Bridge bridge = this.ovs.getTypedRowWrapper(Bridge.class, null);
OpenVSwitch openVSwitch = this.ovs.getTypedRowWrapper(OpenVSwitch.class, null);
+ SSL ssl = this.ovs.getTypedRowWrapper(SSL.class, null);
+ Qos qos = this.ovs.getTypedRowWrapper(Qos.class, null);
+ Port port = this.ovs.getTypedRowWrapper(Port.class, null);
+ Queue queue = this.ovs.getTypedRowWrapper(Queue.class, null);
+ Manager manager = this.ovs.getTypedRowWrapper(Manager.class, null);
TransactionBuilder transactionBuilder = this.ovs.transactBuilder();
transactionBuilder.add(op.delete(bridge.getSchema())
.where(bridge.getNameColumn().getSchema().opEqual(TEST_BRIDGE_NAME))
.build())
- .add(op.mutate(openVSwitch.getSchema())
- .addMutation(openVSwitch.getBridgesColumn().getSchema(), Mutator.DELETE, Sets.newHashSet(OpenVswitchSchemaSuiteIT.getTestBridgeUuid())))
+ .add(op.delete(ssl.getSchema()) // Delete an SSL row in the SSL table
+ .where(ssl.getUuidColumn().getSchema()
+ .opEqual(OpenVswitchSchemaSuiteIT.getTestSslUuid()))
+ .build())
+ .add(op.delete(manager.getSchema()) // Delete a Manager row in the SSL table
+ .where(manager.getUuidColumn().getSchema()
+ .opEqual(OpenVswitchSchemaSuiteIT.getTestManagerUuid()))
+ .build())
+ .add(op.delete(queue.getSchema()) // Delete a Queue row in the Queue table
+ .where(queue.getUuidColumn().getSchema()
+ .opEqual(OpenVswitchSchemaSuiteIT.getTestQueueUuid()))
+ .build())
+ .add(op.delete(qos.getSchema()) // Delete a QoS row in the QOS table
+ .where(qos.getUuidColumn().getSchema()
+ .opEqual(OpenVswitchSchemaSuiteIT.getTestQosUuid()))
+ .build())
+ .add(op.delete(port.getSchema()) // Delete a Port row in the Port table
+ .where(port.getUuidColumn().getSchema()
+ .opEqual(OpenVswitchSchemaSuiteIT.getTestQosPortUuid()))
+ .build())
+ .add(op.mutate(openVSwitch.getSchema()) // Delete a manager_opt column in the OVS table
+ .addMutation(openVSwitch.getManagerOptionsColumn().getSchema(), Mutator.DELETE,
+ Sets.newHashSet(OpenVswitchSchemaSuiteIT.getTestManagerUuid())))
+ .add(op.mutate(openVSwitch.getSchema()) // Delete an SSL column in the OVS table
+ .addMutation(openVSwitch.getSslColumn().getSchema(), Mutator.DELETE,
+ Sets.newHashSet(OpenVswitchSchemaSuiteIT.getTestSslUuid())))
+ .add(op.mutate(port.getSchema()) // Delete the Qos reference in the Qos test Port row
+ .addMutation(port.getQosColumn().getSchema(), Mutator.DELETE,
+ Sets.newHashSet(OpenVswitchSchemaSuiteIT.getTestQosPortUuid())))
+ .add(op.mutate(openVSwitch.getSchema()) // Delete a bridge column reference in the OVS table
+ .addMutation(openVSwitch.getBridgesColumn().getSchema(), Mutator.DELETE,
+ Sets.newHashSet(OpenVswitchSchemaSuiteIT.getTestBridgeUuid())))
.add(op.commit(true))
.execute();
ListenableFuture<List<OperationResult>> results = transactionBuilder.execute();
List<OperationResult> operationResults = results.get();
+ for (OperationResult result : operationResults) {
+ Assert.assertNull(result.getError());
+ }
System.out.println("Delete operation results = " + operationResults);
// tableCache = new HashMap<String, Map<UUID, Row>>();
}