interface declaration for missing ovsdb operations 26/5926/2
authorMadhu Venugopal <mavenugo@gmail.com>
Tue, 8 Apr 2014 11:34:17 +0000 (04:34 -0700)
committerMadhu Venugopal <mavenugo@gmail.com>
Tue, 8 Apr 2014 11:34:17 +0000 (04:34 -0700)
Fixing Merge-Conflicts manually as the Automatic Rebase failed.

Change-Id: I2b22210c55fb96da6f393e440666f247a97c5aca
Signed-off-by: Madhu Venugopal <mavenugo@gmail.com>
ovsdb/src/main/java/org/opendaylight/ovsdb/lib/EchoServiceCallbackFilters.java [new file with mode: 0644]
ovsdb/src/main/java/org/opendaylight/ovsdb/lib/LockAquisitionCallback.java [new file with mode: 0644]
ovsdb/src/main/java/org/opendaylight/ovsdb/lib/LockStolenCallback.java [new file with mode: 0644]
ovsdb/src/main/java/org/opendaylight/ovsdb/lib/MonitorCallBack.java [new file with mode: 0644]
ovsdb/src/main/java/org/opendaylight/ovsdb/lib/MonitorHandle.java [new file with mode: 0644]
ovsdb/src/main/java/org/opendaylight/ovsdb/lib/OvsDBClient.java
ovsdb/src/main/java/org/opendaylight/ovsdb/lib/OvsDBClientImpl.java

diff --git a/ovsdb/src/main/java/org/opendaylight/ovsdb/lib/EchoServiceCallbackFilters.java b/ovsdb/src/main/java/org/opendaylight/ovsdb/lib/EchoServiceCallbackFilters.java
new file mode 100644 (file)
index 0000000..296a181
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ *
+ *  * Copyright (C) 2014 EBay Software Foundation
+ *  *
+ *  * This program and the accompanying materials are made available under the
+ *  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ *  * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *  *
+ *  * Authors : Ashwin Raveendran
+ *
+ */
+
+package org.opendaylight.ovsdb.lib;
+
+/**
+ * @author Ashwin Raveendran (ashwin at gmail)
+ */
+public interface EchoServiceCallbackFilters {
+}
diff --git a/ovsdb/src/main/java/org/opendaylight/ovsdb/lib/LockAquisitionCallback.java b/ovsdb/src/main/java/org/opendaylight/ovsdb/lib/LockAquisitionCallback.java
new file mode 100644 (file)
index 0000000..75bfce6
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ *
+ *  * Copyright (C) 2014 EBay Software Foundation
+ *  *
+ *  * This program and the accompanying materials are made available under the
+ *  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ *  * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *  *
+ *  * Authors : Ashwin Raveendran
+ *
+ */
+
+package org.opendaylight.ovsdb.lib;
+
+/**
+ *  Callback that can be registered with {@link OvsDBClient} to
+ *  get notified of a lock stolen.
+ *  @see <a href="http://tools.ietf.org/html/draft-pfaff-ovsdb-proto-04#section-4.1.10">ovsdb spec</a>
+ *  <p/>
+ *
+ *  @see OvsDBClient
+ */
+public interface LockAquisitionCallback {
+
+    public void lockAcquired();
+
+}
diff --git a/ovsdb/src/main/java/org/opendaylight/ovsdb/lib/LockStolenCallback.java b/ovsdb/src/main/java/org/opendaylight/ovsdb/lib/LockStolenCallback.java
new file mode 100644 (file)
index 0000000..7672a76
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ *
+ *  * Copyright (C) 2014 EBay Software Foundation
+ *  *
+ *  * This program and the accompanying materials are made available under the
+ *  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ *  * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *  *
+ *  * Authors : Ashwin Raveendran
+ *
+ */
+
+package org.opendaylight.ovsdb.lib;
+
+/**
+ *  Callback that can be registered with {@link org.opendaylight.ovsdb.lib.OvsDBClient} to
+ *  get notified of a lock stolen.
+ *  @see <a href="http://tools.ietf.org/html/draft-pfaff-ovsdb-proto-04#section-4.1.10">ovsdb spec</a>
+ *  <p/>
+ *
+ *  @see org.opendaylight.ovsdb.lib.OvsDBClient#lock(String, LockStolenCallback)
+ */
+public interface LockStolenCallback {
+
+    public void lockStolen();
+
+}
diff --git a/ovsdb/src/main/java/org/opendaylight/ovsdb/lib/MonitorCallBack.java b/ovsdb/src/main/java/org/opendaylight/ovsdb/lib/MonitorCallBack.java
new file mode 100644 (file)
index 0000000..01fe2fa
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ *
+ *  * Copyright (C) 2014 EBay Software Foundation
+ *  *
+ *  * This program and the accompanying materials are made available under the
+ *  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ *  * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *  *
+ *  * Authors : Ashwin Raveendran
+ *
+ */
+
+package org.opendaylight.ovsdb.lib;
+
+public interface MonitorCallBack {
+}
diff --git a/ovsdb/src/main/java/org/opendaylight/ovsdb/lib/MonitorHandle.java b/ovsdb/src/main/java/org/opendaylight/ovsdb/lib/MonitorHandle.java
new file mode 100644 (file)
index 0000000..5f6404c
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ *
+ *  * Copyright (C) 2014 EBay Software Foundation
+ *  *
+ *  * This program and the accompanying materials are made available under the
+ *  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ *  * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *  *
+ *  * Authors : Ashwin Raveendran
+ *
+ */
+
+package org.opendaylight.ovsdb.lib;
+
+public interface MonitorHandle {
+}
index 31f63e1f0cf1df3939e44ace0b50847df1facca4..a6a1d881c3d93d6073b17a32f668ff8fa956ea98 100644 (file)
@@ -13,6 +13,7 @@
 package org.opendaylight.ovsdb.lib;
 
 import com.google.common.util.concurrent.ListenableFuture;
+import org.opendaylight.ovsdb.lib.message.MonitorRequest;
 import org.opendaylight.ovsdb.lib.operations.Operation;
 import org.opendaylight.ovsdb.lib.operations.OperationResult;
 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
@@ -21,22 +22,24 @@ import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
 import java.util.List;
 
 /**
- * The main interface to interact with a device speaking OVSDB protocol in an
- * asynchronous fashion and hence most operations return a Future object representing
- * the eventual response data from the remote.
+ * The main interface to interact with a device speaking ovsdb protocol in an asynchronous fashion and hence most
+ * operations return a Future object representing the eventual response data from the remote.
  */
 public interface OvsDBClient {
 
+    /**
+     * Represents the Open Vswitch Schema
+     */
     String OPEN_VSWITCH_SCHEMA = "Open_vSwitch";
 
     /**
-     * Gets the list of database names exposed by this OVSDB capable device
+     * Gets the list of database names exposed by this ovsdb capable device
      * @return list of database names
      */
     ListenableFuture<List<String>> getDatabases();
 
     /**
-     * Asynchronosly returns the schema object for a specific database
+     * Asynchronously returns the schema object for a specific database
      * @param database name of the database schema
      * @param cacheResult if the results be cached by this instance
      * @return DatabaseSchema future
@@ -44,18 +47,68 @@ public interface OvsDBClient {
     ListenableFuture<DatabaseSchema> getSchema(String database, boolean cacheResult);
 
     /**
-     * Allows for a mini DSL way of collecting the transactions to be executed against
-     * the ovsdb instance.
+     * Allows for a mini DSL way of collecting the transactions to be executed against the ovsdb instance.
      * @return TransactionBuilder
      */
     TransactionBuilder transactBuilder();
 
     /**
-     * Execute the list of operations in a single Transactions. Similar to the
-     * transactBuilder() method
+     * Execute the list of operations in a single Transactions. Similar to the transactBuilder() method
      * @param operations List of operations that needs to be part of a transact call
-     * @return Future object representing the result of the transaction.
+     * @return Future object representing the result of the transaction. Calling
+     * cancel on the Future would cause OVSDB cancel operation to be fired against
+     * the device.
      */
     ListenableFuture<List<OperationResult>> transact(List<Operation> operations);
 
+
+    /**
+     * ovsdb <a href="http://tools.ietf.org/html/draft-pfaff-ovsdb-proto-04#section-4.1.5">monitor</a> operation.
+     * @param monitorRequest represents what needs to be monitored including a client specified monitor handle. This
+     *                       handle is used to later cancel ({@link #cancelMonitor(MonitorHandle)}) the monitor.
+     * @param callback receives the monitor response
+     */
+    public void monitor(MonitorRequest monitorRequest, MonitorCallBack callback);
+
+    /**
+     * Cancels an existing monitor method.
+     * @param handler Handle identifying a specific monitor request that is being cancelled.
+     * @throws java.lang.IllegalStateException if there is no outstanding monitor request for this handle
+     */
+    public void cancelMonitor(MonitorHandle handler);
+
+    /**
+     * ovsdb <a href="http://tools.ietf.org/html/draft-pfaff-ovsdb-proto-04#section-4.1.8">lock</a> operation.
+     * @param lockId a client specified id for the lock; this can be used for unlocking ({@link #unLock(String)})
+     * @param lockedCallBack Callback to nofify when the lock is acquired
+     * @param stolenCallback Callback to notify when an acquired lock is stolen by another client
+     */
+    public void lock(String lockId, LockAquisitionCallback lockedCallBack, LockStolenCallback stolenCallback);
+
+    /**
+     * ovsdb steal operation, see {@link #lock(String, LockAquisitionCallback, LockStolenCallback)}
+     * @param lockId
+     * @return
+     */
+    public ListenableFuture<Boolean> steal(String lockId);
+
+    /**
+     * ovsdb unlock operaiton, see {@link #unLock(String)}
+     * @param lockId
+     * @return
+     */
+    public ListenableFuture<Boolean> unLock(String lockId);
+
+    /**
+     * Starts the echo service. The {@code callbackFilters} can be used to get notified on the absence of echo
+     * notifications from the remote device and control the frequency of such notifications.
+     * @param callbackFilters callbacks for notifying the client of missing echo calls from remote.
+     */
+    public void startEchoService(EchoServiceCallbackFilters callbackFilters);
+
+    /**
+     * Stops the echo service, i.e echo requests from the remote would not be acknowledged after this call.
+     */
+    public void stopEchoService();
+
 }
index f7a199d48dc9f82d13f2db0fca437b95603faf00..4efbc9c1347bb743a44b50ebe1fe2fde00d2f611 100644 (file)
@@ -16,6 +16,7 @@ import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.SettableFuture;
+import org.opendaylight.ovsdb.lib.message.MonitorRequest;
 import org.opendaylight.ovsdb.lib.message.OvsdbRPC;
 import org.opendaylight.ovsdb.lib.message.TransactBuilder;
 import org.opendaylight.ovsdb.lib.operations.Operation;
@@ -58,6 +59,41 @@ public class OvsDBClientImpl implements OvsDBClient {
         return transact;
     }
 
+    @Override
+    public void monitor(MonitorRequest monitorRequest, MonitorCallBack callback) {
+        throw new UnsupportedOperationException("not yet implemented");
+    }
+
+    @Override
+    public void cancelMonitor(MonitorHandle handler) {
+        throw new UnsupportedOperationException("not yet implemented");
+    }
+
+    @Override
+    public void lock(String lockId, LockAquisitionCallback lockedCallBack, LockStolenCallback stolenCallback) {
+        throw new UnsupportedOperationException("not yet implemented");
+    }
+
+    @Override
+    public ListenableFuture<Boolean> steal(String lockId) {
+        throw new UnsupportedOperationException("not yet implemented");
+    }
+
+    @Override
+    public ListenableFuture<Boolean> unLock(String lockId) {
+        throw new UnsupportedOperationException("not yet implemented");
+    }
+
+    @Override
+    public void startEchoService(EchoServiceCallbackFilters callbackFilters) {
+        throw new UnsupportedOperationException("not yet implemented");
+    }
+
+    @Override
+    public void stopEchoService() {
+        throw new UnsupportedOperationException("not yet implemented");
+    }
+
     @Override
     public TransactionBuilder transactBuilder() {
         return new TransactionBuilder(this);