Refactor Open vSwitch Schema Integration Tests 87/8387/4
authorDave Tucker <djt@redhat.com>
Thu, 26 Jun 2014 23:36:04 +0000 (00:36 +0100)
committerDave Tucker <djt@redhat.com>
Fri, 27 Jun 2014 14:10:15 +0000 (15:10 +0100)
- Add a Junit suite that runs the test in correct order
- Make changes to the pom to ensure only the suite is run rather than
  the individual test cases
- Fix failing IT's for the IPFIX table using Junit Assumptions
- Add test case to check correct exception is raised when a table is not
  supported in the current schema

Change-Id: I074f047e964610c7397af040946dde1b562754c0
Signed-off-by: Dave Tucker <djt@redhat.com>
12 files changed:
schemas/Open_vSwitch/pom.xml
schemas/Open_vSwitch/src/test/java/org/opendaylight/ovsdb/schema/openvswitch/BridgeTestCases.java [new file with mode: 0644]
schemas/Open_vSwitch/src/test/java/org/opendaylight/ovsdb/schema/openvswitch/ControllerTestCases.java [new file with mode: 0644]
schemas/Open_vSwitch/src/test/java/org/opendaylight/ovsdb/schema/openvswitch/IpfixTestCases.java [new file with mode: 0644]
schemas/Open_vSwitch/src/test/java/org/opendaylight/ovsdb/schema/openvswitch/MonitorTestCases.java [new file with mode: 0644]
schemas/Open_vSwitch/src/test/java/org/opendaylight/ovsdb/schema/openvswitch/NetflowTestCases.java [new file with mode: 0644]
schemas/Open_vSwitch/src/test/java/org/opendaylight/ovsdb/schema/openvswitch/OpenVswitchSchemaSuiteIT.java [new file with mode: 0644]
schemas/Open_vSwitch/src/test/java/org/opendaylight/ovsdb/schema/openvswitch/OpenVswitchSchemaTestBase.java [moved from schemas/Open_vSwitch/src/test/java/org/opendaylight/ovsdb/schema/openvswitch/OvsdbTestBase.java with 70% similarity]
schemas/Open_vSwitch/src/test/java/org/opendaylight/ovsdb/schema/openvswitch/PortAndInterfaceTestCases.java [new file with mode: 0644]
schemas/Open_vSwitch/src/test/java/org/opendaylight/ovsdb/schema/openvswitch/SflowTestCases.java [new file with mode: 0644]
schemas/Open_vSwitch/src/test/java/org/opendaylight/ovsdb/schema/openvswitch/TearDown.java [new file with mode: 0644]
schemas/Open_vSwitch/src/test/java/org/opendaylight/ovsdb/schema/openvswitch/TypedVSwitchdSchemaIT.java [deleted file]

index 95174f103242afa1f939fd3f0baf8e631c22ed4a..ab989ea40db4dbe52408dbc74ab80c88b937e597 100755 (executable)
           <excludes>
             <!--  Exclude integration tests -->
             <exclude>**/*IT*</exclude>
+            <exclude>**/*TestCases*</exclude>
           </excludes>
         </configuration>
       </plugin>
diff --git a/schemas/Open_vSwitch/src/test/java/org/opendaylight/ovsdb/schema/openvswitch/BridgeTestCases.java b/schemas/Open_vSwitch/src/test/java/org/opendaylight/ovsdb/schema/openvswitch/BridgeTestCases.java
new file mode 100644 (file)
index 0000000..f8e218f
--- /dev/null
@@ -0,0 +1,103 @@
+/*
+ * 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 : Madhu Venugopal, Dave Tucker
+ */
+
+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.Row;
+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.lang.reflect.InvocationTargetException;
+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 BridgeTestCases extends OpenVswitchSchemaTestBase {
+    Logger logger = LoggerFactory.getLogger(BridgeTestCases.class);
+
+    @Before
+    public void setUp() throws ExecutionException, InterruptedException, TimeoutException, IOException {
+        super.setUp();
+     }
+
+    @Test
+    public void createTypedBridge() throws IOException, InterruptedException, ExecutionException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+        Bridge bridge = this.ovs.createTypedRowWrapper(Bridge.class);
+        Assert.assertNotNull(bridge);
+        bridge.setName(TEST_BRIDGE_NAME);
+        bridge.setStatus(ImmutableMap.of("key", "value"));
+        bridge.setFloodVlans(Sets.newHashSet(34));
+
+        OpenVSwitch openVSwitch = this.ovs.createTypedRowWrapper(OpenVSwitch.class);
+        openVSwitch.setBridges(Sets.newHashSet(new UUID(TEST_BRIDGE_NAME)));
+
+        int insertOperationIndex = 0;
+
+        TransactionBuilder transactionBuilder = this.ovs.transactBuilder()
+                .add(op.insert(bridge.getSchema())
+                        .withId(TEST_BRIDGE_NAME)
+                        .value(bridge.getNameColumn()))
+                .add(op.update(bridge.getSchema())
+                        .set(bridge.getStatusColumn())
+                        .set(bridge.getFloodVlansColumn())
+                        .where(bridge.getNameColumn().getSchema().opEqual(bridge.getName()))
+                        .and(bridge.getNameColumn().getSchema().opEqual(bridge.getName())).build())
+                .add(op.mutate(openVSwitch.getSchema())
+                        .addMutation(openVSwitch.getBridgesColumn().getSchema(), Mutator.INSERT,
+                                openVSwitch.getBridgesColumn().getData()));
+
+        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());
+        logger.info("Insert & Update operation results = " + operationResults);
+        for (OperationResult result : operationResults) {
+            Assert.assertNull(result.getError());
+        }
+        OpenVswitchSchemaSuiteIT.setTestBridgeUuid(operationResults.get(insertOperationIndex).getUuid());
+
+        Row bridgeRow = OpenVswitchSchemaSuiteIT.getTableCache().get(bridge.getSchema().getName()).get(OpenVswitchSchemaSuiteIT.getTestBridgeUuid());
+        Bridge monitoredBridge = ovs.getTypedRowWrapper(Bridge.class, bridgeRow);
+        Assert.assertEquals(monitoredBridge.getNameColumn().getData(), bridge.getNameColumn().getData());
+        Assert.assertNotNull(monitoredBridge.getUuid());
+        Assert.assertNotNull(monitoredBridge.getVersion());
+        Assert.assertNotNull(this.getOpenVSwitchTableUuid(ovs, OpenVswitchSchemaSuiteIT.getTableCache()));
+    }
+
+    @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) {
+
+    }
+}
diff --git a/schemas/Open_vSwitch/src/test/java/org/opendaylight/ovsdb/schema/openvswitch/ControllerTestCases.java b/schemas/Open_vSwitch/src/test/java/org/opendaylight/ovsdb/schema/openvswitch/ControllerTestCases.java
new file mode 100644 (file)
index 0000000..9f2ddf8
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+ * 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 : Madhu Venugopal, Dave Tucker
+ */
+
+package org.opendaylight.ovsdb.schema.openvswitch;
+
+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.Row;
+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.lang.reflect.InvocationTargetException;
+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 ControllerTestCases extends OpenVswitchSchemaTestBase {
+    Logger logger = LoggerFactory.getLogger(ControllerTestCases.class);
+
+    @Before
+    public void setUp() throws ExecutionException, InterruptedException, TimeoutException, IOException {
+        super.setUp();
+    }
+
+    @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");
+        Controller controller2 = ovs.createTypedRowWrapper(Controller.class);
+        controller2.setTarget("tcp:2.2.2.2:6640");
+
+        Bridge bridge = ovs.getTypedRowWrapper(Bridge.class, null);
+
+        String transactionUuidStr = "controller";
+        TransactionBuilder transactionBuilder = ovs.transactBuilder()
+                .add(op.insert(controller1.getSchema())
+                        .withId(transactionUuidStr)
+                        .value(controller1.getTargetColumn()))
+                .add(op.mutate(bridge.getSchema())
+                        .addMutation(bridge.getControllerColumn().getSchema(), Mutator.INSERT,
+                                Sets.newHashSet(new UUID(transactionUuidStr)))
+                        .where(bridge.getNameColumn().getSchema().opEqual(TEST_BRIDGE_NAME))
+                        .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());
+        logger.info("Insert & Mutate operation results for controller1 = " + operationResults);
+        // Check for any errors
+        for (OperationResult result : operationResults) {
+            Assert.assertNull(result.getError());
+        }
+
+        Row bridgeRow = OpenVswitchSchemaSuiteIT.getTableCache().get(bridge.getSchema().getName()).get(OpenVswitchSchemaSuiteIT.getTestBridgeUuid());
+        Bridge monitoredBridge = ovs.getTypedRowWrapper(Bridge.class, bridgeRow);
+        Assert.assertEquals(1, monitoredBridge.getControllerColumn().getData().size());
+
+        transactionBuilder = ovs.transactBuilder()
+                .add(op.insert(controller2.getSchema())
+                        .withId(transactionUuidStr)
+                        .value(controller2.getTargetColumn()))
+                .add(op.mutate(bridge.getSchema())
+                        .addMutation(bridge.getControllerColumn().getSchema(), Mutator.INSERT,
+                                Sets.newHashSet(new UUID(transactionUuidStr)))
+                        .where(bridge.getNameColumn().getSchema().opEqual(TEST_BRIDGE_NAME))
+                        .build());
+
+        results = transactionBuilder.execute();
+        operationResults = results.get();
+        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 controller2 = " + operationResults);
+        // Check for any errors
+        for (OperationResult result : operationResults) {
+            Assert.assertNull(result.getError());
+        }
+
+        bridgeRow = OpenVswitchSchemaSuiteIT.getTableCache().get(bridge.getSchema().getName()).get(OpenVswitchSchemaSuiteIT.getTestBridgeUuid());
+        monitoredBridge = ovs.getTypedRowWrapper(Bridge.class, bridgeRow);
+        Assert.assertEquals(2, monitoredBridge.getControllerColumn().getData().size());
+    }
+
+    @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) {
+
+    }
+}
diff --git a/schemas/Open_vSwitch/src/test/java/org/opendaylight/ovsdb/schema/openvswitch/IpfixTestCases.java b/schemas/Open_vSwitch/src/test/java/org/opendaylight/ovsdb/schema/openvswitch/IpfixTestCases.java
new file mode 100644 (file)
index 0000000..221cbb2
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+ * 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.Assume;
+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.notation.Version;
+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 IpfixTestCases extends OpenVswitchSchemaTestBase {
+
+    Logger logger = LoggerFactory.getLogger(IpfixTestCases.class);
+    Version schemaVersion;
+    Version ipfixFromVersion = Version.fromString("7.3.0");
+
+
+    @Before
+    public void setUp() throws ExecutionException, InterruptedException, TimeoutException, IOException {
+        super.setUp();
+        schemaVersion = ovs.getDatabaseSchema("Open_vSwitch").getVersion();
+    }
+
+    @Test(expected=RuntimeException.class)
+    public void testUnsupportedTable() {
+        // Don't run this test if we can run the IPFIX test
+        Assume.assumeTrue(schemaVersion.compareTo(ipfixFromVersion) < 0);
+        IPFIX ipfix = ovs.createTypedRowWrapper(IPFIX.class);
+        ipfix.setTargets(ImmutableSet.of("1.1.1.1:9988"));
+    }
+
+    @Test
+    public void testCreateTypedIpFix() throws InterruptedException, ExecutionException, IllegalArgumentException{
+        // Don't run this test if the table is not supported
+        Assume.assumeTrue(schemaVersion.compareTo(ipfixFromVersion) >= 0);
+
+        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(TEST_BRIDGE_NAME))
+                        .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);
+    }
+
+    @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) {
+
+    }
+}
diff --git a/schemas/Open_vSwitch/src/test/java/org/opendaylight/ovsdb/schema/openvswitch/MonitorTestCases.java b/schemas/Open_vSwitch/src/test/java/org/opendaylight/ovsdb/schema/openvswitch/MonitorTestCases.java
new file mode 100644 (file)
index 0000000..59d2978
--- /dev/null
@@ -0,0 +1,127 @@
+/*
+ * 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 : Madhu Venugopal, Dave Tucker
+ */
+
+package org.opendaylight.ovsdb.schema.openvswitch;
+
+import com.google.common.collect.Lists;
+import junit.framework.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.ovsdb.lib.MonitorCallBack;
+import org.opendaylight.ovsdb.lib.MonitorHandle;
+import org.opendaylight.ovsdb.lib.message.MonitorRequest;
+import org.opendaylight.ovsdb.lib.message.MonitorRequestBuilder;
+import org.opendaylight.ovsdb.lib.message.MonitorSelect;
+import org.opendaylight.ovsdb.lib.message.TableUpdate;
+import org.opendaylight.ovsdb.lib.message.TableUpdates;
+import org.opendaylight.ovsdb.lib.message.UpdateNotification;
+import org.opendaylight.ovsdb.lib.notation.Row;
+import org.opendaylight.ovsdb.lib.notation.UUID;
+import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeoutException;
+
+public class MonitorTestCases extends OpenVswitchSchemaTestBase {
+
+    Logger logger = LoggerFactory.getLogger(PortAndInterfaceTestCases.class);
+    DatabaseSchema dbSchema = null;
+
+    @Before
+    public void setUp() throws ExecutionException, InterruptedException, TimeoutException, IOException {
+        super.setUp();
+        dbSchema = this.ovs.getSchema(OPEN_VSWITCH_SCHEMA, true).get();
+    }
+
+    @Test
+    public void monitorTables() throws ExecutionException, InterruptedException, IOException {
+        Assert.assertNotNull(dbSchema);
+
+        List<MonitorRequest<GenericTableSchema>> monitorRequests = Lists.newArrayList();
+        monitorRequests.add(this.getAllColumnsMonitorRequest(Bridge.class));
+        monitorRequests.add(this.getAllColumnsMonitorRequest(OpenVSwitch.class));
+
+        MonitorHandle monitor = ovs.monitor(dbSchema, monitorRequests, new UpdateMonitor());
+        Assert.assertNotNull(monitor);
+    }
+
+    /**
+     * As per RFC 7047, section 4.1.5, if a Monitor request is sent without any columns, the update response will not include
+     * the _uuid column.
+     * ----------------------------------------------------------------------------------------------------------------------------------
+     * Each <monitor-request> specifies one or more columns and the manner in which the columns (or the entire table) are to be monitored.
+     * The "columns" member specifies the columns whose values are monitored. It MUST NOT contain duplicates.
+     * If "columns" is omitted, all columns in the table, except for "_uuid", are monitored.
+     * ----------------------------------------------------------------------------------------------------------------------------------
+     * In order to overcome this limitation, this method
+     *
+     * @return MonitorRequest that includes all the Bridge Columns including _uuid
+     */
+    public <T extends TypedBaseTable<GenericTableSchema>> MonitorRequest<GenericTableSchema> getAllColumnsMonitorRequest (Class <T> klazz) {
+        TypedBaseTable<GenericTableSchema> table = ovs.createTypedRowWrapper(klazz);
+        GenericTableSchema bridgeSchema = table.getSchema();
+        Set<String> columns = bridgeSchema.getColumns();
+        MonitorRequestBuilder<GenericTableSchema> bridgeBuilder = MonitorRequestBuilder.builder(table.getSchema());
+        for (String column : columns) {
+            bridgeBuilder.addColumn(column);
+        }
+        return bridgeBuilder.with(new MonitorSelect(true, true, true, true)).build();
+    }
+
+
+
+    @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) {
+
+    }
+
+    private class UpdateMonitor implements MonitorCallBack {
+        @Override
+        public void update(TableUpdates result) {
+            for (String tableName : result.getUpdates().keySet()) {
+                Map<UUID, Row> tUpdate = OpenVswitchSchemaSuiteIT.getTableCache().get(tableName);
+                TableUpdate update = result.getUpdates().get(tableName);
+                if (update.getNew() != null) {
+                    if (tUpdate == null) {
+                        tUpdate = new HashMap<>();
+                        OpenVswitchSchemaSuiteIT.getTableCache().put(tableName, tUpdate);
+                    }
+                    tUpdate.put(update.getUuid(), update.getNew());
+                } else {
+                    tUpdate.remove(update.getUuid());
+                }
+            }
+        }
+
+        @Override
+        public void exception(Throwable t) {
+            System.out.println("Exception t = " + t);
+        }
+    }
+}
diff --git a/schemas/Open_vSwitch/src/test/java/org/opendaylight/ovsdb/schema/openvswitch/NetflowTestCases.java b/schemas/Open_vSwitch/src/test/java/org/opendaylight/ovsdb/schema/openvswitch/NetflowTestCases.java
new file mode 100644 (file)
index 0000000..65c08b3
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ * 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.math.BigInteger;
+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 NetflowTestCases extends OpenVswitchSchemaTestBase {
+
+    Logger logger = LoggerFactory.getLogger(NetflowTestCases.class);
+
+    @Before
+    public void setUp() throws ExecutionException, InterruptedException, TimeoutException, IOException {
+        super.setUp();
+    }
+
+    @Test
+    public 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(TEST_BRIDGE_NAME))
+                        .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);
+    }
+
+    @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) {
+
+    }
+}
diff --git a/schemas/Open_vSwitch/src/test/java/org/opendaylight/ovsdb/schema/openvswitch/OpenVswitchSchemaSuiteIT.java b/schemas/Open_vSwitch/src/test/java/org/opendaylight/ovsdb/schema/openvswitch/OpenVswitchSchemaSuiteIT.java
new file mode 100644 (file)
index 0000000..35d6b95
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * 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 : Madhu Venugopal, Dave Tucker
+ */
+package org.opendaylight.ovsdb.schema.openvswitch;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.opendaylight.ovsdb.lib.OvsdbClient;
+import org.opendaylight.ovsdb.lib.notation.Row;
+import org.opendaylight.ovsdb.lib.notation.UUID;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+        MonitorTestCases.class,
+        BridgeTestCases.class,
+        ControllerTestCases.class,
+        PortAndInterfaceTestCases.class,
+        NetflowTestCases.class,
+        SflowTestCases.class,
+        IpfixTestCases.class,
+        TearDown.class
+})
+public class OpenVswitchSchemaSuiteIT {
+
+    // Keep this data between test runs
+    static OvsdbClient ovsdbClient;
+    static UUID testBridgeUuid;
+    static Map<String, Map<UUID, Row>> tableCache = new HashMap<String, Map<UUID, Row>>();
+
+    public static OvsdbClient getOvsdbClient() {
+        return ovsdbClient;
+    }
+
+    public static void setOvsdbClient(OvsdbClient ovsdbClient) {
+        OpenVswitchSchemaSuiteIT.ovsdbClient = ovsdbClient;
+    }
+
+    public static UUID getTestBridgeUuid() {
+        return testBridgeUuid;
+    }
+
+    public static void setTestBridgeUuid(UUID testBridgeUuid) {
+        OpenVswitchSchemaSuiteIT.testBridgeUuid = testBridgeUuid;
+    }
+
+    public static Map<String, Map<UUID, Row>> getTableCache() {
+        return tableCache;
+    }
+}
similarity index 70%
rename from schemas/Open_vSwitch/src/test/java/org/opendaylight/ovsdb/schema/openvswitch/OvsdbTestBase.java
rename to schemas/Open_vSwitch/src/test/java/org/opendaylight/ovsdb/schema/openvswitch/OpenVswitchSchemaTestBase.java
index 5d87096a14745d111273dd802ebf7555d8beb53e..0d6a1118648d832231544cdee14c11b5440b3fc2 100644 (file)
@@ -5,12 +5,26 @@
  * 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
+ * Authors : Madhu Venugopal, Dave Tucker
  */
 
 package org.opendaylight.ovsdb.schema.openvswitch;
+
+import com.google.common.util.concurrent.ListenableFuture;
+import junit.framework.Assert;
+import org.junit.Before;
+import org.opendaylight.ovsdb.lib.OvsdbClient;
+import org.opendaylight.ovsdb.lib.OvsdbConnection;
+import org.opendaylight.ovsdb.lib.OvsdbConnectionListener;
+import org.opendaylight.ovsdb.lib.impl.OvsdbConnectionService;
+import org.opendaylight.ovsdb.lib.message.OvsdbRPC;
+import org.opendaylight.ovsdb.lib.notation.Row;
+import org.opendaylight.ovsdb.lib.notation.UUID;
+
 import java.io.IOException;
 import java.net.InetAddress;
+import java.util.List;
+import java.util.Map;
 import java.util.Properties;
 import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutionException;
@@ -20,27 +34,43 @@ import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 
-import junit.framework.Assert;
-
-import org.opendaylight.ovsdb.lib.OvsdbClient;
-import org.opendaylight.ovsdb.lib.OvsdbConnection;
-import org.opendaylight.ovsdb.lib.OvsdbConnectionListener;
-import org.opendaylight.ovsdb.lib.impl.OvsdbConnectionService;
-import org.opendaylight.ovsdb.lib.message.OvsdbRPC;
-
-public abstract class OvsdbTestBase implements OvsdbRPC.Callback{
+public abstract class OpenVswitchSchemaTestBase implements OvsdbRPC.Callback{
     private final static String SERVER_IPADDRESS = "ovsdbserver.ipaddress";
     private final static String SERVER_PORT = "ovsdbserver.port";
     private final static String CONNECTION_TYPE = "ovsdbserver.connection";
     private final static String CONNECTION_TYPE_ACTIVE = "active";
     private final static String CONNECTION_TYPE_PASSIVE = "passive";
-
     private final static String DEFAULT_SERVER_PORT = "6640";
-
+    protected static final String TEST_BRIDGE_NAME = "br_test";
     /**
-     * Represents the Open Vswitch Schema
+     * Represents the Open vSwitch Schema
      */
-    public final static String OPEN_VSWITCH_SCHEMA = "Open_vSwitch";
+    protected final static String OPEN_VSWITCH_SCHEMA = "Open_vSwitch";
+
+    protected OvsdbClient ovs = null;
+
+    @Before
+    public void setUp() throws InterruptedException, ExecutionException, TimeoutException, IOException {
+
+        this.ovs = OpenVswitchSchemaSuiteIT.getOvsdbClient();
+
+        if (this.ovs == null) {
+            this.ovs = getTestConnection();
+            OpenVswitchSchemaSuiteIT.setOvsdbClient(this.ovs);
+
+            ListenableFuture<List<String>> databases = ovs.getDatabases();
+            List<String> dbNames = databases.get();
+            Assert.assertNotNull(dbNames);
+            boolean hasOpenVswitchSchema = false;
+            for (String dbName : dbNames) {
+                if (dbName.equals(OPEN_VSWITCH_SCHEMA)) {
+                    hasOpenVswitchSchema = true;
+                    break;
+                }
+            }
+            Assert.assertTrue(OPEN_VSWITCH_SCHEMA + " schema is not supported by the switch", hasOpenVswitchSchema);
+        }
+    }
 
     public Properties loadProperties() {
         Properties props = new Properties(System.getProperties());
@@ -88,6 +118,17 @@ public abstract class OvsdbTestBase implements OvsdbRPC.Callback{
         return null;
     }
 
+    public UUID getOpenVSwitchTableUuid(OvsdbClient ovs, Map<String, Map<UUID, Row>> tableCache) {
+        OpenVSwitch openVSwitch = ovs.getTypedRowWrapper(OpenVSwitch.class, null);
+        Map<UUID, Row> ovsTable = tableCache.get(openVSwitch.getSchema().getName());
+        if (ovsTable != null) {
+            if (ovsTable.keySet().size() >= 1) {
+                return (UUID)ovsTable.keySet().toArray()[0];
+            }
+        }
+        return null;
+    }
+
     private String usage() {
         return "Integration Test needs a valid connection configuration as follows :\n" +
                "active connection : mvn -Pintegrationtest -Dovsdbserver.ipaddress=x.x.x.x -Dovsdbserver.port=yyyy verify\n"+
diff --git a/schemas/Open_vSwitch/src/test/java/org/opendaylight/ovsdb/schema/openvswitch/PortAndInterfaceTestCases.java b/schemas/Open_vSwitch/src/test/java/org/opendaylight/ovsdb/schema/openvswitch/PortAndInterfaceTestCases.java
new file mode 100644 (file)
index 0000000..b1fb9dd
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+ * 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 : 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.math.BigInteger;
+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 PortAndInterfaceTestCases extends OpenVswitchSchemaTestBase {
+
+    Logger logger = LoggerFactory.getLogger(PortAndInterfaceTestCases.class);
+
+    @Before
+    public void setUp() throws ExecutionException, InterruptedException, TimeoutException, IOException {
+        super.setUp();
+    }
+
+
+    @Test
+    public void testCreateTypedPortandInterface() throws InterruptedException, ExecutionException {
+        String portUuidStr = "testPort";
+        String intfUuidStr = "testIntf";
+        Port port = ovs.createTypedRowWrapper(Port.class);
+        port.setName("testPort");
+        port.setTag(ImmutableSet.of(BigInteger.ONE));
+        port.setMac(ImmutableSet.of("00:00:00:00:00:01"));
+        port.setInterfaces(ImmutableSet.of(new UUID(intfUuidStr)));
+
+        Interface intf = ovs.createTypedRowWrapper(Interface.class);
+        intf.setName(port.getNameColumn().getData());
+        intf.setExternalIds(ImmutableMap.of("vm-id", "12345abcedf78910"));
+
+        Bridge bridge = ovs.getTypedRowWrapper(Bridge.class, null);
+        TransactionBuilder transactionBuilder = ovs.transactBuilder()
+                .add(op.insert(port.getSchema())
+                        .withId(portUuidStr)
+                        .value(port.getNameColumn())
+                        .value(port.getMacColumn()))
+                .add(op.insert(intf.getSchema())
+                        .withId(intfUuidStr)
+                        .value(intf.getNameColumn()))
+                .add(op.update(port.getSchema())
+                        .set(port.getTagColumn())
+                        .set(port.getMacColumn())
+                        .set(port.getInterfacesColumn())
+                        .where(port.getNameColumn().getSchema().opEqual(port.getName()))
+                        .build())
+                .add(op.update(intf.getSchema())
+                        .set(intf.getExternalIdsColumn())
+                        .where(intf.getNameColumn().getSchema().opEqual(intf.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());
+        // Check if Results matches the number of operations in transaction
+        Assert.assertEquals(transactionBuilder.getOperations().size(), operationResults.size());
+        logger.info("Insert & Mutate operation results for Port and Interface = " + 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) {
+
+    }
+}
diff --git a/schemas/Open_vSwitch/src/test/java/org/opendaylight/ovsdb/schema/openvswitch/SflowTestCases.java b/schemas/Open_vSwitch/src/test/java/org/opendaylight/ovsdb/schema/openvswitch/SflowTestCases.java
new file mode 100644 (file)
index 0000000..229adb3
--- /dev/null
@@ -0,0 +1,102 @@
+/*
+ * 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.junit.Assert.assertNull;
+import static org.opendaylight.ovsdb.lib.operations.Operations.op;
+
+public class SflowTestCases extends OpenVswitchSchemaTestBase {
+
+    Logger logger = LoggerFactory.getLogger(SflowTestCases.class);
+
+    @Before
+    public void setUp() throws ExecutionException, InterruptedException, TimeoutException, IOException {
+        super.setUp();
+    }
+
+    @Test
+    public 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(TEST_BRIDGE_NAME))
+                        .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);
+    }
+
+    @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) {
+
+    }
+}
diff --git a/schemas/Open_vSwitch/src/test/java/org/opendaylight/ovsdb/schema/openvswitch/TearDown.java b/schemas/Open_vSwitch/src/test/java/org/opendaylight/ovsdb/schema/openvswitch/TearDown.java
new file mode 100644 (file)
index 0000000..9b70fdf
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * 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 : Madhu Venugopal, Dave Tucker
+ */
+
+package org.opendaylight.ovsdb.schema.openvswitch;
+
+import com.google.common.collect.Sets;
+import com.google.common.util.concurrent.ListenableFuture;
+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.operations.OperationResult;
+
+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 TearDown extends OpenVswitchSchemaTestBase {
+
+    @Before
+    public void setUp() throws ExecutionException, InterruptedException, TimeoutException, IOException {
+        super.setUp();
+    }
+
+    @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);
+
+        ListenableFuture<List<OperationResult>> results = this.ovs.transactBuilder()
+                .add(op.delete(bridge.getSchema())
+                        .where(bridge.getNameColumn().getSchema().opEqual(OpenVswitchSchemaTestBase.TEST_BRIDGE_NAME))
+                        .build())
+                .add(op.mutate(openVSwitch.getSchema())
+                        .addMutation(openVSwitch.getBridgesColumn().getSchema(), Mutator.DELETE, Sets.newHashSet(OpenVswitchSchemaSuiteIT.getTestBridgeUuid())))
+                .add(op.commit(true))
+                .execute();
+
+        List<OperationResult> operationResults = results.get();
+        System.out.println("Delete operation results = " + operationResults);
+        // tableCache = new HashMap<String, Map<UUID, Row>>();
+    }
+
+    @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) {
+
+    }
+}
diff --git a/schemas/Open_vSwitch/src/test/java/org/opendaylight/ovsdb/schema/openvswitch/TypedVSwitchdSchemaIT.java b/schemas/Open_vSwitch/src/test/java/org/opendaylight/ovsdb/schema/openvswitch/TypedVSwitchdSchemaIT.java
deleted file mode 100644 (file)
index 172af49..0000000
+++ /dev/null
@@ -1,467 +0,0 @@
-/*
- * 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 : Madhu Venugopal
- */
-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;
-import java.lang.reflect.InvocationTargetException;
-import java.math.BigInteger;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeoutException;
-
-import junit.framework.Assert;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.ovsdb.lib.MonitorCallBack;
-import org.opendaylight.ovsdb.lib.MonitorHandle;
-import org.opendaylight.ovsdb.lib.OvsdbClient;
-import org.opendaylight.ovsdb.lib.message.MonitorRequest;
-import org.opendaylight.ovsdb.lib.message.MonitorRequestBuilder;
-import org.opendaylight.ovsdb.lib.message.MonitorSelect;
-import org.opendaylight.ovsdb.lib.message.TableUpdate;
-import org.opendaylight.ovsdb.lib.message.TableUpdates;
-import org.opendaylight.ovsdb.lib.message.UpdateNotification;
-import org.opendaylight.ovsdb.lib.notation.Mutator;
-import org.opendaylight.ovsdb.lib.notation.Row;
-import org.opendaylight.ovsdb.lib.notation.UUID;
-import org.opendaylight.ovsdb.lib.operations.OperationResult;
-import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
-import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
-import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
-import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-import com.google.common.util.concurrent.ListenableFuture;
-
-public class TypedVSwitchdSchemaIT extends OvsdbTestBase {
-
-    Logger logger = LoggerFactory.getLogger(TypedVSwitchdSchemaIT.class);
-    OvsdbClient ovs;
-    DatabaseSchema dbSchema = null;
-    static String testBridgeName = "br_test";
-    static UUID testBridgeUuid = null;
-
-    @Test
-    public void testTypedBridgeOperations() throws IOException, InterruptedException, ExecutionException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
-        this.monitorTables();
-        this.createTypedBridge();
-        this.createTypedController();
-        this.testCreateTypedPortandInterface();
-        this.testCreateTypedIpFix();
-        this.testCreateTypedNetFlow();
-        this.testCreateTypedSflow();
-    }
-
-    private void createTypedBridge() throws IOException, InterruptedException, ExecutionException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
-        Bridge bridge = ovs.createTypedRowWrapper(Bridge.class);
-        bridge.setName(testBridgeName);
-        bridge.setStatus(ImmutableMap.of("key","value"));
-        bridge.setFloodVlans(Sets.newHashSet(34));
-
-        OpenVSwitch openVSwitch = ovs.createTypedRowWrapper(OpenVSwitch.class);
-        openVSwitch.setBridges(Sets.newHashSet(new UUID(testBridgeName)));
-
-        int insertOperationIndex = 0;
-
-        TransactionBuilder transactionBuilder = ovs.transactBuilder()
-                .add(op.insert(bridge)
-                        .withId(testBridgeName))
-                .add(op.update(bridge.getSchema())
-                        .set(bridge.getStatusColumn())
-                        .set(bridge.getFloodVlansColumn())
-                        .where(bridge.getNameColumn().getSchema().opEqual(bridge.getName()))
-                        .and(bridge.getNameColumn().getSchema().opEqual(bridge.getName())).build())
-                .add(op.mutate(openVSwitch.getSchema())
-                        .addMutation(openVSwitch.getBridgesColumn().getSchema(), Mutator.INSERT,
-                                     openVSwitch.getBridgesColumn().getData()));
-
-        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());
-        System.out.println("Insert & Update operation results = " + operationResults);
-        for (OperationResult result : operationResults) {
-            Assert.assertNull(result.getError());
-        }
-        testBridgeUuid = operationResults.get(insertOperationIndex).getUuid();
-
-        Row bridgeRow = tableCache.get(bridge.getSchema().getName()).get(testBridgeUuid);
-        Bridge monitoredBridge = ovs.getTypedRowWrapper(Bridge.class, bridgeRow);
-        Assert.assertEquals(monitoredBridge.getNameColumn().getData(), bridge.getNameColumn().getData());
-        Assert.assertNotNull(monitoredBridge.getUuid());
-        Assert.assertNotNull(monitoredBridge.getVersion());
-        Assert.assertNotNull(this.getOpenVSwitchTableUuid());
-    }
-
-    private void createTypedController() throws IOException, InterruptedException, ExecutionException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
-        Controller controller1 = ovs.createTypedRowWrapper(Controller.class);
-        controller1.setTarget("tcp:1.1.1.1:6640");
-        Controller controller2 = ovs.createTypedRowWrapper(Controller.class);
-        controller2.setTarget("tcp:2.2.2.2:6640");
-
-        Bridge bridge = ovs.getTypedRowWrapper(Bridge.class, null);
-
-        String transactionUuidStr = "controller";
-        TransactionBuilder transactionBuilder = ovs.transactBuilder()
-                .add(op.insert(controller1.getSchema())
-                        .withId(transactionUuidStr)
-                        .value(controller1.getTargetColumn()))
-                .add(op.mutate(bridge.getSchema())
-                        .addMutation(bridge.getControllerColumn().getSchema(), Mutator.INSERT,
-                                     Sets.newHashSet(new UUID(transactionUuidStr)))
-                        .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());
-        System.out.println("Insert & Mutate operation results for controller1 = " + operationResults);
-        // Check for any errors
-        for (OperationResult result : operationResults) {
-            Assert.assertNull(result.getError());
-        }
-
-        Row bridgeRow = tableCache.get(bridge.getSchema().getName()).get(testBridgeUuid);
-        Bridge monitoredBridge = ovs.getTypedRowWrapper(Bridge.class, bridgeRow);
-        Assert.assertEquals(1, monitoredBridge.getControllerColumn().getData().size());
-
-        transactionBuilder = ovs.transactBuilder()
-                .add(op.insert(controller2.getSchema())
-                        .withId(transactionUuidStr)
-                        .value(controller2.getTargetColumn()))
-                .add(op.mutate(bridge.getSchema())
-                        .addMutation(bridge.getControllerColumn().getSchema(), Mutator.INSERT,
-                                Sets.newHashSet(new UUID(transactionUuidStr)))
-                        .where(bridge.getNameColumn().getSchema().opEqual(testBridgeName))
-                        .build());
-
-        results = transactionBuilder.execute();
-        operationResults = results.get();
-        Assert.assertFalse(operationResults.isEmpty());
-        // Check if Results matches the number of operations in transaction
-        Assert.assertEquals(transactionBuilder.getOperations().size(), operationResults.size());
-        System.out.println("Insert & Mutate operation results for controller2 = " + operationResults);
-        // Check for any errors
-        for (OperationResult result : operationResults) {
-            Assert.assertNull(result.getError());
-        }
-
-        bridgeRow = tableCache.get(bridge.getSchema().getName()).get(testBridgeUuid);
-        monitoredBridge = ovs.getTypedRowWrapper(Bridge.class, bridgeRow);
-        Assert.assertEquals(2, monitoredBridge.getControllerColumn().getData().size());
-    }
-
-    private void testCreateTypedPortandInterface() throws InterruptedException, ExecutionException{
-        String portUuidStr = "testPort";
-        String intfUuidStr = "testIntf";
-        Port port = ovs.createTypedRowWrapper(Port.class);
-        port.setName("testPort");
-        port.setTag(ImmutableSet.of(BigInteger.ONE));
-        port.setMac(ImmutableSet.of("00:00:00:00:00:01"));
-        port.setInterfaces(ImmutableSet.of(new UUID(intfUuidStr)));
-
-        Interface intf = ovs.createTypedRowWrapper(Interface.class);
-        intf.setName(port.getNameColumn().getData());
-        intf.setExternalIds(ImmutableMap.of("vm-id", "12345abcedf78910"));
-
-        Bridge bridge = ovs.getTypedRowWrapper(Bridge.class, null);
-        TransactionBuilder transactionBuilder = ovs.transactBuilder()
-                .add(op.insert(port.getSchema())
-                        .withId(portUuidStr)
-                        .value(port.getNameColumn())
-                        .value(port.getMacColumn()))
-                .add(op.insert(intf.getSchema())
-                        .withId(intfUuidStr)
-                        .value(intf.getNameColumn()))
-                .add(op.update(port.getSchema())
-                        .set(port.getTagColumn())
-                        .set(port.getMacColumn())
-                        .set(port.getInterfacesColumn())
-                        .where(port.getNameColumn().getSchema().opEqual(port.getName()))
-                        .build())
-                .add(op.update(intf.getSchema())
-                        .set(intf.getExternalIdsColumn())
-                        .where(intf.getNameColumn().getSchema().opEqual(intf.getName()))
-                        .build())
-                .add(op.mutate(bridge.getSchema())
-                        .addMutation(bridge.getPortsColumn().getSchema(), Mutator.INSERT, Sets.newHashSet(new UUID(portUuidStr)))
-                        .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());
-        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();
-        Assert.assertNotNull(dbNames);
-        boolean hasOpenVswitchSchema = false;
-        for(String dbName : dbNames) {
-           if (dbName.equals(OPEN_VSWITCH_SCHEMA)) {
-                hasOpenVswitchSchema = true;
-                break;
-           }
-        }
-        Assert.assertTrue(OPEN_VSWITCH_SCHEMA+" schema is not supported by the switch", hasOpenVswitchSchema);
-    }
-
-    private UUID getOpenVSwitchTableUuid() {
-        OpenVSwitch openVSwitch = ovs.getTypedRowWrapper(OpenVSwitch.class, null);
-        Map<UUID, Row> ovsTable = tableCache.get(openVSwitch.getSchema().getName());
-        if (ovsTable != null) {
-            if (ovsTable.keySet().size() >= 1) {
-                return (UUID)ovsTable.keySet().toArray()[0];
-            }
-        }
-        return null;
-    }
-
-    public void monitorTables() throws ExecutionException, InterruptedException, IOException {
-        Assert.assertNotNull(dbSchema);
-
-        List<MonitorRequest<GenericTableSchema>> monitorRequests = Lists.newArrayList();
-        monitorRequests.add(this.getAllColumnsMonitorRequest(Bridge.class));
-        monitorRequests.add(this.getAllColumnsMonitorRequest(OpenVSwitch.class));
-
-        MonitorHandle monitor = ovs.monitor(dbSchema, monitorRequests, new UpdateMonitor());
-        Assert.assertNotNull(monitor);
-    }
-
-    /**
-     * As per RFC 7047, section 4.1.5, if a Monitor request is sent without any columns, the update response will not include
-     * the _uuid column.
-     * ----------------------------------------------------------------------------------------------------------------------------------
-     * Each <monitor-request> specifies one or more columns and the manner in which the columns (or the entire table) are to be monitored.
-     * The "columns" member specifies the columns whose values are monitored. It MUST NOT contain duplicates.
-     * If "columns" is omitted, all columns in the table, except for "_uuid", are monitored.
-     * ----------------------------------------------------------------------------------------------------------------------------------
-     * In order to overcome this limitation, this method
-     *
-     * @return MonitorRequest that includes all the Bridge Columns including _uuid
-     */
-    public <T extends TypedBaseTable> MonitorRequest<GenericTableSchema> getAllColumnsMonitorRequest (Class <T> klazz) {
-        TypedBaseTable table = ovs.createTypedRowWrapper(klazz);
-        GenericTableSchema bridgeSchema = (GenericTableSchema) table.getSchema();
-        Set<String> columns = bridgeSchema.getColumns();
-        MonitorRequestBuilder<GenericTableSchema> bridgeBuilder = MonitorRequestBuilder.builder(table.getSchema());
-        for (String column : columns) {
-            bridgeBuilder.addColumn(column);
-        }
-        return bridgeBuilder.with(new MonitorSelect(true, true, true, true)).build();
-    }
-
-    static Map<String, Map<UUID, Row>> tableCache = new HashMap<String, Map<UUID, Row>>();
-    private static class UpdateMonitor implements MonitorCallBack {
-        @Override
-        public void update(TableUpdates result) {
-            for (String tableName : result.getUpdates().keySet()) {
-                Map<UUID, Row> tUpdate = tableCache.get(tableName);
-                TableUpdate update = result.getUpdates().get(tableName);
-                if (update.getNew() != null) {
-                    if (tUpdate == null) {
-                        tUpdate = new HashMap<UUID, Row>();
-                        tableCache.put(tableName, tUpdate);
-                    }
-                    tUpdate.put(update.getUuid(), update.getNew());
-                } else {
-                    tUpdate.remove(update.getUuid());
-                }
-            }
-        }
-
-        @Override
-        public void exception(Throwable t) {
-            System.out.println("Exception t = " + t);
-        }
-    }
-
-    @Before
-    public  void setUp() throws IOException, ExecutionException, InterruptedException, TimeoutException {
-        if (ovs != null) {
-            return;
-        }
-        ovs = getTestConnection();
-        testGetDBs();
-        dbSchema = ovs.getSchema(OPEN_VSWITCH_SCHEMA, true).get();
-    }
-
-    @After
-    public void tearDown() throws InterruptedException, ExecutionException {
-        Bridge bridge = ovs.getTypedRowWrapper(Bridge.class, null);
-        OpenVSwitch openVSwitch = ovs.getTypedRowWrapper(OpenVSwitch.class, null);
-
-        ListenableFuture<List<OperationResult>> results = ovs.transactBuilder()
-                .add(op.delete(bridge.getSchema())
-                        .where(bridge.getNameColumn().getSchema().opEqual(testBridgeName))
-                        .build())
-                .add(op.mutate(openVSwitch.getSchema())
-                        .addMutation(openVSwitch.getBridgesColumn().getSchema(), Mutator.DELETE, Sets.newHashSet(testBridgeUuid)))
-                .add(op.commit(true))
-                .execute();
-
-        List<OperationResult> operationResults = results.get();
-        System.out.println("Delete operation results = " + operationResults);
-        tableCache = new HashMap<String, Map<UUID, Row>>();
-    }
-
-    @Override
-    public void update(Object node, UpdateNotification upadateNotification) {
-        // TODO Auto-generated method stub
-
-    }
-    @Override
-    public void locked(Object node, List<String> ids) {
-        // TODO Auto-generated method stub
-
-    }
-    @Override
-    public void stolen(Object node, List<String> ids) {
-        // TODO Auto-generated method stub
-
-    }
-}