Patchset5: ugh git add ftw.
Patchset4: more typos ftw
Patchset3: spelling typos
patchset2: These are the ones with IT I have done.
Abondoning the other commits, the groupings are wrong
as some IT tests have dependencies on tables that
I had grouped in another commit.
note: breaking up commits for easier review. next up
is IT for the tables in the new schema.
Change-Id: I8983305659066ee6ab80a166d3ddb0ef55773700
Signed-off-by: Brent Salisbury <brent.salisbury@gmail.com>
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.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
+/**
+ * This class is a typed interface to the Flow_Table Table
*/
-@TypedTable(name="Flow_Table", database="Open_vSwitch")
+@TypedTable(name="Flow_Table", database="Open_vSwitch", fromVersion="6.5.0")
public interface FlowTable extends TypedBaseTable {
- @TypedColumn(name="flow_limit", method=MethodType.GETCOLUMN)
+
+ @TypedColumn(name="flow_limit", method=MethodType.GETCOLUMN, fromVersion="6.5.0")
public Column<GenericTableSchema, Integer> getFlowLimitColumn() ;
- @TypedColumn(name="details", method=MethodType.SETDATA)
+
+ @TypedColumn(name="flow_limit", method=MethodType.SETDATA, fromVersion="6.5.0")
public void setFlowLimit(Integer flowLimit) ;
- @TypedColumn(name="overflow_policy", method=MethodType.GETCOLUMN)
+ @TypedColumn(name="overflow_policy", method=MethodType.GETCOLUMN, fromVersion="6.5.0")
public Column<GenericTableSchema, Set<String>> getOverflowPolicyColumn() ;
- @TypedColumn(name="overflow_policy", method=MethodType.SETDATA)
+
+ @TypedColumn(name="overflow_policy", method=MethodType.SETDATA, fromVersion="6.5.0")
public void setOverflowPolicy(Set<String> overflowPolicy) ;
- @TypedColumn(name="groups", method=MethodType.GETCOLUMN)
+ @TypedColumn(name="groups", method=MethodType.GETCOLUMN, fromVersion="6.5.0")
public Column<GenericTableSchema, Set<String>> getGroupsColumn() ;
- @TypedColumn(name="groups", method=MethodType.SETDATA)
+
+ @TypedColumn(name="groups", method=MethodType.SETDATA, fromVersion="6.5.0")
public void setGroups(Set<String> groups) ;
+
+ @TypedColumn(name="name", method=MethodType.GETCOLUMN, fromVersion="6.5.0")
+ public Column<GenericTableSchema, Set<String>> getNameColumn();
+
+ @TypedColumn(name="name", method=MethodType.SETDATA, fromVersion="6.5.0")
+ public void setName(Set<String> name);
+
+ @TypedColumn(name="prefixes", method=MethodType.GETCOLUMN, fromVersion="7.4.0")
+ public Column<GenericTableSchema, Set<String>> getPrefixesColumn();
+
+ @TypedColumn(name="prefixes", method=MethodType.SETDATA, fromVersion="7.4.0")
+ public void setPrefixes(Set<String> prefixes);
+
+ @TypedColumn(name="external_ids", method=MethodType.GETCOLUMN, fromVersion="7.5.0")
+ public Column<GenericTableSchema, Map<String, String>> getExternalIdsColumn();
+
+ @TypedColumn(name="external_ids", method=MethodType.SETDATA, fromVersion="7.5.0")
+ public void setExternalIds(Map<String, String> externalIds);
+
}
\ No newline at end of file
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
+/**
+ * This class is a typed interface to the IPFIX Table
*/
-
-@TypedTable(name="IPFIX", database="Open_vSwitch")
+@TypedTable(name="IPFIX", database="Open_vSwitch", fromVersion="7.1.0")
public interface IPFIX extends TypedBaseTable {
- @TypedColumn(name="targets", method=MethodType.GETCOLUMN)
+ @TypedColumn(name="targets", method=MethodType.GETCOLUMN, fromVersion="7.1.0")
public Column<GenericTableSchema, Set<String>> getTargetsColumn();
- @TypedColumn(name="targets", method=MethodType.SETDATA)
+ @TypedColumn(name="targets", method=MethodType.SETDATA, fromVersion="7.1.0")
public void setTargets(Set<String> targets);
- @TypedColumn(name="sampling", method=MethodType.GETCOLUMN)
+ @TypedColumn(name="sampling", method=MethodType.GETCOLUMN, fromVersion="7.1.0")
public Column<GenericTableSchema, Set<Integer>> getSamplingColumn();
- @TypedColumn(name="sampling", method=MethodType.SETDATA)
+ @TypedColumn(name="sampling", method=MethodType.SETDATA, fromVersion="7.1.0")
public void setSampling(Set<Integer> sampling);
- @TypedColumn(name="obs_domain_id", method=MethodType.GETCOLUMN)
+ @TypedColumn(name="obs_domain_id", method=MethodType.GETCOLUMN, fromVersion="7.1.0")
public Column<GenericTableSchema, Set<Integer>> getObsDomainIdColumn();
- @TypedColumn(name="obs_domain_id", method=MethodType.SETDATA)
+ @TypedColumn(name="obs_domain_id", method=MethodType.SETDATA, fromVersion="7.1.0")
public void setObsDomainId(Set<Integer> obs_domain_id);
- @TypedColumn(name="obs_point_id", method=MethodType.GETCOLUMN)
- public Column<GenericTableSchema, Set<Integer>> getObsOointIdColumn();
- @TypedColumn(name="obs_point_id", method=MethodType.SETDATA)
+ @TypedColumn(name="obs_point_id", method=MethodType.GETCOLUMN, fromVersion="7.1.0")
+ public Column<GenericTableSchema, Set<Integer>> getObsPointIdColumn();
+ @TypedColumn(name="obs_point_id", method=MethodType.SETDATA, fromVersion="7.1.0")
public void setObsPointId(Set<Integer> obsPointId);
- @TypedColumn(name="cache_active_timeout", method=MethodType.GETCOLUMN)
+ @TypedColumn(name="cache_active_timeout", method=MethodType.GETCOLUMN, fromVersion="7.3.0")
public Column<GenericTableSchema, Set<Integer>> getCacheActiveTimeoutColumn();
- @TypedColumn(name="cache_active_timeout", method=MethodType.SETDATA)
+ @TypedColumn(name="cache_active_timeout", method=MethodType.SETDATA, fromVersion="7.3.0")
public void setCacheActiveTimeout(Set<Integer> cacheActiveTimeout);
- @TypedColumn(name="cache_max_flows", method=MethodType.GETCOLUMN)
- public Column<GenericTableSchema, Set<Integer>> getCacheMaxFowsColumn();
- @TypedColumn(name="cache_max_flows", method=MethodType.SETDATA)
- public void setCacheMaxFows(Set<Integer> cacheMaxFows);
+ @TypedColumn(name="cache_max_flows", method=MethodType.GETCOLUMN, fromVersion="7.3.0")
+ public Column<GenericTableSchema, Set<Integer>> getCacheMaxFlowsColumn();
+ @TypedColumn(name="cache_max_flows", method=MethodType.SETDATA, fromVersion="7.3.0")
+ public void setCacheMaxFlows(Set<Integer> cacheMaxFlows);
- @TypedColumn(name="external_ids", method=MethodType.GETCOLUMN)
+ @TypedColumn(name="external_ids", method=MethodType.GETCOLUMN, fromVersion="7.1.0")
public Column<GenericTableSchema, Map<String, String>> getExternalIdsColumn();
- @TypedColumn(name="external_ids", method=MethodType.SETDATA)
+ @TypedColumn(name="external_ids", method=MethodType.SETDATA, fromVersion="7.1.0")
public void setExternalIds(Map<String, String> externalIds);
-}
+}
\ No newline at end of file
*/
package org.opendaylight.ovsdb.schema.openvswitch;
+import java.math.BigInteger;
+import java.util.Map;
import java.util.Set;
import org.opendaylight.ovsdb.lib.notation.Column;
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
+/**
+ * This class is a typed interface to the NetFlow Table
*/
-@TypedTable(name="NetFlow", database="Open_vSwitch")
+@TypedTable(name="NetFlow", database="Open_vSwitch", fromVersion="1.0.0")
public interface NetFlow extends TypedBaseTable {
- @TypedColumn(name="targets", method=MethodType.GETCOLUMN)
- public Column<GenericTableSchema, Set<String>> getTargetsColumn() ;
- @TypedColumn(name="targets", method=MethodType.SETDATA)
- public void setTargets(Set<String> targets) ;
-
- @TypedColumn(name="active_timeout", method=MethodType.GETCOLUMN)
- public Column<GenericTableSchema, Integer> getActiveTimeoutColumn() ;
- @TypedColumn(name="active_timeout", method=MethodType.SETDATA)
- public void setActiveTimeout(Integer activeTimeout) ;
+
+ @TypedColumn(name="targets", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+ public Column<GenericTableSchema, Set<String>> getTargetsColumn();
+
+ @TypedColumn(name="targets", method=MethodType.SETDATA, fromVersion="1.0.0")
+ public void setTargets(Set<String> targets);
+
+ @TypedColumn(name="active_timeout", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+ public Column<GenericTableSchema, Set<Integer>> getActiveTimeoutColumn();
+
+ @TypedColumn(name="active_timeout", method=MethodType.SETDATA, fromVersion="1.0.0")
+ public void setActiveTimeout(Integer activeTimeout);
+
+ @TypedColumn(name="engine_type", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+ public Column<GenericTableSchema, Set<BigInteger>> getEngineTypeColumn();
+
+ @TypedColumn(name="engine_type", method=MethodType.SETDATA, fromVersion="1.0.0")
+ public void setEngineType(Set<BigInteger> engineType);
+
+ @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="active_timeout", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+ public Column<GenericTableSchema, Set<Integer>> getActivityTimeoutColumn();
+
+ @TypedColumn(name="active_timeout", method=MethodType.SETDATA, fromVersion="1.0.0")
+ public void setActivityTimeout(Set<Integer> activityTimeout);
+
+ @TypedColumn(name="add_id_to_interface", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+ public Column<GenericTableSchema, Set<Boolean>> getAddIdToInterfaceColumn();
+
+ @TypedColumn(name="add_id_to_interface", method=MethodType.SETDATA, fromVersion="1.0.0")
+ public void setAddIdToInterface(Boolean addIdToInterface);
+
+ @TypedColumn(name="engine_id", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+ public Column<GenericTableSchema, Set<BigInteger>> getEngineIdColumn();
+
+ @TypedColumn(name="engine_id", method=MethodType.SETDATA, fromVersion="1.0.0")
+ public void setEngineId(Set<BigInteger> engineId);
+
}
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
+/**
+ * This class is a typed interface to the SFlow Table
*/
-
-@TypedTable(name="SFlow", database="Open_vSwitch")
+@TypedTable(name="sFlow", database="Open_vSwitch", fromVersion="1.0.0")
public interface SFlow extends TypedBaseTable {
- @TypedColumn(name="targets", method=MethodType.GETCOLUMN)
+ @TypedColumn(name="targets", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
public Column<GenericTableSchema, Set<String>> getTargetsColumn() ;
- @TypedColumn(name="targets", method=MethodType.SETDATA)
+ @TypedColumn(name="targets", method=MethodType.SETDATA, fromVersion="1.0.0")
public void setTargets(Set<String> targets) ;
- @TypedColumn(name="agent", method=MethodType.GETCOLUMN)
+ @TypedColumn(name="agent", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
public Column<GenericTableSchema, Set<String>> getAgentColumn() ;
- @TypedColumn(name="agent", method=MethodType.SETDATA)
+ @TypedColumn(name="agent", method=MethodType.SETDATA, fromVersion="1.0.0")
public void setAgent(Set<String> agent) ;
- @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="header", method=MethodType.GETCOLUMN)
+ @TypedColumn(name="header", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
public Column<GenericTableSchema, Set<Integer>> getHeaderColumn() ;
- @TypedColumn(name="header", method=MethodType.SETDATA)
+ @TypedColumn(name="header", method=MethodType.SETDATA, fromVersion="1.0.0")
public void setHeader(Set<Integer> header) ;
- @TypedColumn(name="polling", method=MethodType.GETCOLUMN)
+ @TypedColumn(name="polling", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
public Column<GenericTableSchema, Set<Integer>> getPollingColumn() ;
- @TypedColumn(name="polling", method=MethodType.SETDATA)
+ @TypedColumn(name="polling", method=MethodType.SETDATA, fromVersion="1.0.0")
public void setPolling(Set<Integer> polling) ;
- @TypedColumn(name="sampling", method=MethodType.GETCOLUMN)
+ @TypedColumn(name="sampling", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
public Column<GenericTableSchema, Set<Integer>> getSamplingColumn() ;
- @TypedColumn(name="sampling", method=MethodType.SETDATA)
+ @TypedColumn(name="sampling", method=MethodType.SETDATA, fromVersion="1.0.0")
public void setSampling(Set<Integer> sampling) ;
-}
+}
\ No newline at end of file
*/
package org.opendaylight.ovsdb.schema.openvswitch;
+import static org.junit.Assert.assertNull;
import static org.opendaylight.ovsdb.lib.operations.Operations.op;
import java.io.IOException;
this.createTypedBridge();
this.createTypedController();
this.testCreateTypedPortandInterface();
+ this.testCreateTypedIpFix();
+ this.testCreateTypedNetFlow();
+ this.testCreateTypedSflow();
}
private void createTypedBridge() throws IOException, InterruptedException, ExecutionException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
System.out.println("Insert & Mutate operation results for Port and Interface = " + operationResults);
}
+ private void testCreateTypedIpFix() throws InterruptedException, ExecutionException, IllegalArgumentException{
+ String ipfixUuidStr = "testIpfix";
+ String ipfixTarget = "172.16.20.1:4739";
+ Integer obsDomainId = 112;
+ Integer obsPointId = 358;
+ Integer cacheMax = 132;
+ Integer cacheTimeout = 134;
+ Integer sampling = 558;
+ IPFIX ipfix = ovs.createTypedRowWrapper(IPFIX.class);
+ ipfix.setTargets(ImmutableSet.of(ipfixTarget));
+ ipfix.setObsDomainId(ImmutableSet.of(obsDomainId));
+ ipfix.setObsPointId(ImmutableSet.of(obsPointId));
+ ipfix.setCacheMaxFlows(ImmutableSet.of(cacheMax));
+ ipfix.setCacheActiveTimeout(ImmutableSet.of(cacheTimeout));
+ ipfix.setSampling(ImmutableSet.of(sampling));
+ ipfix.setExternalIds(ImmutableMap.of("<3", "ovs"));
+ Bridge bridge = ovs.getTypedRowWrapper(Bridge.class, null);
+ TransactionBuilder transactionBuilder = ovs.transactBuilder()
+ .add(op.insert(ipfix.getSchema())
+ .withId(ipfixUuidStr)
+ .value(ipfix.getTargetsColumn())
+ .value(ipfix.getObsDomainIdColumn())
+ .value(ipfix.getObsPointIdColumn())
+ .value(ipfix.getCacheMaxFlowsColumn())
+ .value(ipfix.getCacheActiveTimeoutColumn())
+ .value(ipfix.getSamplingColumn())
+ .value(ipfix.getExternalIdsColumn()))
+ .add(op.mutate(bridge.getSchema())
+ .addMutation(bridge.getIpfixColumn().getSchema(), Mutator.INSERT,
+ Sets.newHashSet(new UUID(ipfixUuidStr)))
+ .where(bridge.getNameColumn().getSchema().opEqual(testBridgeName))
+ .build());
+ ListenableFuture<List<OperationResult>> results = transactionBuilder.execute();
+ List<OperationResult> operationResults = results.get();
+ Assert.assertFalse(operationResults.isEmpty());
+ // Check if Results matches the number of operations in transaction
+ Assert.assertEquals(transactionBuilder.getOperations().size(), operationResults.size());
+ for (OperationResult result : operationResults) Assert.assertNull(result.getError());
+ logger.info("Insert & Mutate operation results for IPFIX = {} ", operationResults);
+ }
+
+ private void testCreateTypedSflow() throws InterruptedException, ExecutionException, IllegalArgumentException{
+ String sFlowUuidStr = "testSFlow";
+ String sFlowTarget = "172.16.20.200:6343";
+ Integer header = 128;
+ Integer obsPointId = 358;
+ Integer polling = 10;
+ String agent = "172.16.20.210";
+ Integer sampling = 64;
+ SFlow sFlow = ovs.createTypedRowWrapper(SFlow.class);
+ sFlow.setTargets(ImmutableSet.of(sFlowTarget));
+ sFlow.setHeader(ImmutableSet.of(header));
+ sFlow.setPolling(ImmutableSet.of(obsPointId));
+ sFlow.setPolling(ImmutableSet.of(polling));
+ sFlow.setAgent(ImmutableSet.of(agent));
+ sFlow.setSampling(ImmutableSet.of(sampling));
+ sFlow.setExternalIds(ImmutableMap.of("kit", "tah"));
+ Bridge bridge = ovs.getTypedRowWrapper(Bridge.class, null);
+ TransactionBuilder transactionBuilder = ovs.transactBuilder()
+ .add(op.insert(sFlow.getSchema())
+ .withId(sFlowUuidStr)
+ .value(sFlow.getTargetsColumn())
+ .value(sFlow.getHeaderColumn())
+ .value(sFlow.getPollingColumn())
+ .value(sFlow.getAgentColumn())
+ .value(sFlow.getSamplingColumn())
+ .value(sFlow.getExternalIdsColumn()))
+ .add(op.mutate(bridge.getSchema())
+ .addMutation(bridge.getSflowColumn().getSchema(), Mutator.INSERT,
+ Sets.newHashSet(new UUID(sFlowUuidStr)))
+ .where(bridge.getNameColumn().getSchema().opEqual(testBridgeName))
+ .build());
+ ListenableFuture<List<OperationResult>> results = transactionBuilder.execute();
+ List<OperationResult> operationResults = results.get();
+ for (OperationResult result : operationResults) {
+ assertNull(result.getError());
+ }
+ Assert.assertFalse(operationResults.isEmpty());
+ // Check if Results matches the number of operations in transaction
+ Assert.assertEquals(transactionBuilder.getOperations().size(), operationResults.size());
+ logger.info("Insert & Mutate operation results for SFlow = {} ", operationResults);
+ }
+
+ private void testCreateTypedNetFlow() throws InterruptedException, ExecutionException, IllegalArgumentException{
+ String netFlowUuidStr = "testNetFlow";
+ String netFlowTargets = "172.16.20.200:6343";
+ BigInteger engineType = BigInteger.valueOf(128);
+ BigInteger engineID = BigInteger.valueOf(32);
+ Integer activityTimeout = 1;
+ NetFlow netFlow = ovs.createTypedRowWrapper(NetFlow.class);
+ netFlow.setTargets(ImmutableSet.of(netFlowTargets));
+ netFlow.setEngineType(ImmutableSet.of(engineType));
+ netFlow.setEngineId(ImmutableSet.of(engineID));
+ netFlow.setActivityTimeout(ImmutableSet.of(activityTimeout));
+ netFlow.setExternalIds(ImmutableMap.of("big", "baby"));
+ Bridge bridge = ovs.getTypedRowWrapper(Bridge.class, null);
+ TransactionBuilder transactionBuilder = ovs.transactBuilder()
+ .add(op.insert(netFlow.getSchema())
+ .withId(netFlowUuidStr)
+ .value(netFlow.getTargetsColumn())
+ .value(netFlow.getEngineTypeColumn())
+ .value(netFlow.getEngineIdColumn())
+ .value(netFlow.getActiveTimeoutColumn())
+ .value(netFlow.getExternalIdsColumn()))
+ .add(op.mutate(bridge.getSchema())
+ .addMutation(bridge.getNetflowColumn().getSchema(), Mutator.INSERT,
+ Sets.newHashSet(new UUID(netFlowUuidStr)))
+ .where(bridge.getNameColumn().getSchema().opEqual(testBridgeName))
+ .build());
+ ListenableFuture<List<OperationResult>> results = transactionBuilder.execute();
+ List<OperationResult> operationResults = results.get();
+ for (OperationResult result : operationResults) Assert.assertNull(result.getError());
+ Assert.assertFalse(operationResults.isEmpty());
+ // Check if Results matches the number of operations in transaction
+ Assert.assertEquals(transactionBuilder.getOperations().size(), operationResults.size());
+ logger.info("Insert & Mutate operation results for NetFlow = {} ", operationResults);
+ }
+
public void testGetDBs() throws ExecutionException, InterruptedException {
ListenableFuture<List<String>> databases = ovs.getDatabases();
List<String> dbNames = databases.get();