Package org.opendaylight.ovsdb.lib.impl
Class OvsdbClientImpl
- java.lang.Object
-
- org.opendaylight.ovsdb.lib.impl.OvsdbClientImpl
-
- All Implemented Interfaces:
OvsdbClient
public class OvsdbClientImpl extends Object implements OvsdbClient
-
-
Constructor Summary
Constructors Constructor Description OvsdbClientImpl(OvsdbRPC rpc, io.netty.channel.Channel channel, OvsdbConnectionInfo.ConnectionType type, OvsdbConnectionInfo.SocketConnectionType socketConnType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cancelMonitor(MonitorHandle handler)
Cancels an existing monitor method.void
cancelMonitor(MonitorHandle handler, int timeout)
Cancels an existing monitor method.<T extends TypedBaseTable<?>>
TcreateTypedRowWrapper(Class<T> klazz)
User friendly convenient method that make use of TyperUtils.getTypedRowWrapper to create a Typed Row Proxy given the Typed Table Class.<T extends TypedBaseTable<?>>
TcreateTypedRowWrapper(DatabaseSchema dbSchema, Class<T> klazz)
User friendly convenient method that make use of getTypedRowWrapper to create a Typed Row Proxy given DatabaseSchema and Typed Table Class.void
disconnect()
com.google.common.util.concurrent.ListenableFuture<List<String>>
echo()
ovsdb echo operation.OvsdbConnectionInfo
getConnectionInfo()
com.google.common.util.concurrent.ListenableFuture<List<String>>
getDatabases()
Gets the list of database names exposed by this ovsdb capable device.TypedDatabaseSchema
getDatabaseSchema(String dbName)
com.google.common.util.concurrent.ListenableFuture<TypedDatabaseSchema>
getSchema(String database)
Asynchronously returns the schema object for a specific database.<T extends TypedBaseTable<?>>
TgetTypedRowWrapper(Class<T> klazz, Row<GenericTableSchema> row)
User friendly convenient method to get a Typed Row Proxy given a Typed Table Class and the Row to be wrapped.boolean
isActive()
boolean
isConnectionPublished()
boolean
isReady(int timeout)
void
lock(String lockId, LockAquisitionCallback lockedCallBack, LockStolenCallback stolenCallback)
ovsdb lock operation.<E extends TableSchema<E>>
TableUpdatesmonitor(DatabaseSchema dbSchema, List<MonitorRequest> monitorRequest, MonitorCallBack callback)
ovsdb monitor operation.<E extends TableSchema<E>>
TableUpdatesmonitor(DatabaseSchema dbSchema, List<MonitorRequest> monitorRequest, MonitorCallBack callback, int timeout)
ovsdb monitor operation.<E extends TableSchema<E>>
TableUpdatesmonitor(DatabaseSchema dbSchema, List<MonitorRequest> monitorRequest, MonitorHandle monitorHandle, MonitorCallBack callback)
ovsdb monitor operation.<E extends TableSchema<E>>
TableUpdatesmonitor(DatabaseSchema dbSchema, List<MonitorRequest> monitorRequest, MonitorHandle monitorHandle, MonitorCallBack callback, int timeout)
ovsdb monitor operation.void
setConnectionPublished(boolean connectionPublished)
void
setRpc(OvsdbRPC rpc)
void
startEchoService(EchoServiceCallbackFilters callbackFilters)
Starts the echo service.com.google.common.util.concurrent.ListenableFuture<Boolean>
steal(String lockId)
ovsdb steal operation.void
stopEchoService()
Stops the echo service, i.e echo requests from the remote would not be acknowledged after this call.com.google.common.util.concurrent.ListenableFuture<List<OperationResult>>
transact(DatabaseSchema dbSchema, List<Operation> operations)
Execute the list of operations in a single Transactions.TransactionBuilder
transactBuilder(DatabaseSchema dbSchema)
Allows for a mini DSL way of collecting the transactions to be executed against the ovsdb instance.protected TableUpdates
transformingCallback(com.fasterxml.jackson.databind.JsonNode tableUpdatesJson, DatabaseSchema dbSchema)
com.google.common.util.concurrent.ListenableFuture<Boolean>
unLock(String lockId)
ovsdb unlock operation.
-
-
-
Constructor Detail
-
OvsdbClientImpl
public OvsdbClientImpl(OvsdbRPC rpc, io.netty.channel.Channel channel, OvsdbConnectionInfo.ConnectionType type, OvsdbConnectionInfo.SocketConnectionType socketConnType)
-
-
Method Detail
-
transformingCallback
protected TableUpdates transformingCallback(com.fasterxml.jackson.databind.JsonNode tableUpdatesJson, DatabaseSchema dbSchema)
-
transact
public com.google.common.util.concurrent.ListenableFuture<List<OperationResult>> transact(DatabaseSchema dbSchema, List<Operation> operations)
Description copied from interface:OvsdbClient
Execute the list of operations in a single Transactions. Similar to the transactBuilder() method- Specified by:
transact
in interfaceOvsdbClient
operations
- List of operations that needs to be part of a transact call- Returns:
- Future object representing the result of the transaction. Calling cancel on the Future would cause OVSDB cancel operation to be fired against the device.
-
monitor
public <E extends TableSchema<E>> TableUpdates monitor(DatabaseSchema dbSchema, List<MonitorRequest> monitorRequest, MonitorCallBack callback)
Description copied from interface:OvsdbClient
ovsdb monitor operation.- Specified by:
monitor
in interfaceOvsdbClient
monitorRequest
- represents what needs to be monitored including a client specified monitor handle. This handle is used to later cancel (OvsdbClient.cancelMonitor(MonitorHandle)
) the monitor.callback
- receives the monitor response
-
monitor
public <E extends TableSchema<E>> TableUpdates monitor(DatabaseSchema dbSchema, List<MonitorRequest> monitorRequest, MonitorCallBack callback, int timeout)
Description copied from interface:OvsdbClient
ovsdb monitor operation.- Specified by:
monitor
in interfaceOvsdbClient
monitorRequest
- represents what needs to be monitored including a client specified monitor handle. This handle is used to later cancel (OvsdbClient.cancelMonitor(MonitorHandle)
) the monitor.callback
- receives the monitor responsetimeout
- time in seconds for monitor transaction timeout
-
monitor
public <E extends TableSchema<E>> TableUpdates monitor(DatabaseSchema dbSchema, List<MonitorRequest> monitorRequest, MonitorHandle monitorHandle, MonitorCallBack callback)
Description copied from interface:OvsdbClient
ovsdb monitor operation.- Specified by:
monitor
in interfaceOvsdbClient
monitorRequest
- represents what needs to be monitoredmonitorHandle
- A client specified monitor handle. This handle is used to later cancel (OvsdbClient.cancelMonitor(MonitorHandle)
) the monitor.callback
- receives the monitor response
-
monitor
public <E extends TableSchema<E>> TableUpdates monitor(DatabaseSchema dbSchema, List<MonitorRequest> monitorRequest, MonitorHandle monitorHandle, MonitorCallBack callback, int timeout)
Description copied from interface:OvsdbClient
ovsdb monitor operation.- Specified by:
monitor
in interfaceOvsdbClient
monitorRequest
- represents what needs to be monitoredmonitorHandle
- A client specified monitor handle. This handle is used to later cancel (OvsdbClient.cancelMonitor(MonitorHandle)
) the monitor.callback
- receives the monitor responsetimeout
- time in seconds for monitor transaction timeout
-
cancelMonitor
public void cancelMonitor(MonitorHandle handler)
Description copied from interface:OvsdbClient
Cancels an existing monitor method.- Specified by:
cancelMonitor
in interfaceOvsdbClient
- Parameters:
handler
- Handle identifying a specific monitor request that is being cancelled.
-
cancelMonitor
public void cancelMonitor(MonitorHandle handler, int timeout)
Description copied from interface:OvsdbClient
Cancels an existing monitor method.- Specified by:
cancelMonitor
in interfaceOvsdbClient
- Parameters:
handler
- Handle identifying a specific monitor request that is being cancelled.timeout
- time in seconds for monitor transaction timeout
-
echo
public com.google.common.util.concurrent.ListenableFuture<List<String>> echo()
Description copied from interface:OvsdbClient
ovsdb echo operation.- Specified by:
echo
in interfaceOvsdbClient
-
lock
public void lock(String lockId, LockAquisitionCallback lockedCallBack, LockStolenCallback stolenCallback)
Description copied from interface:OvsdbClient
ovsdb lock operation.- Specified by:
lock
in interfaceOvsdbClient
- Parameters:
lockId
- a client specified id for the lock; this can be used for unlocking (OvsdbClient.unLock(String)
)lockedCallBack
- Callback to nofify when the lock is acquiredstolenCallback
- Callback to notify when an acquired lock is stolen by another client
-
steal
public com.google.common.util.concurrent.ListenableFuture<Boolean> steal(String lockId)
Description copied from interface:OvsdbClient
ovsdb steal operation. SeeOvsdbClient.lock(String, LockAquisitionCallback, LockStolenCallback)
- Specified by:
steal
in interfaceOvsdbClient
-
unLock
public com.google.common.util.concurrent.ListenableFuture<Boolean> unLock(String lockId)
Description copied from interface:OvsdbClient
ovsdb unlock operation. SeeOvsdbClient.unLock(String)
- Specified by:
unLock
in interfaceOvsdbClient
-
startEchoService
public void startEchoService(EchoServiceCallbackFilters callbackFilters)
Description copied from interface:OvsdbClient
Starts the echo service. ThecallbackFilters
can be used to get notified on the absence of echo notifications from the remote device and control the frequency of such notifications.- Specified by:
startEchoService
in interfaceOvsdbClient
- Parameters:
callbackFilters
- callbacks for notifying the client of missing echo calls from remote.
-
stopEchoService
public void stopEchoService()
Description copied from interface:OvsdbClient
Stops the echo service, i.e echo requests from the remote would not be acknowledged after this call.- Specified by:
stopEchoService
in interfaceOvsdbClient
-
transactBuilder
public TransactionBuilder transactBuilder(DatabaseSchema dbSchema)
Description copied from interface:OvsdbClient
Allows for a mini DSL way of collecting the transactions to be executed against the ovsdb instance.- Specified by:
transactBuilder
in interfaceOvsdbClient
- Returns:
- TransactionBuilder
-
isReady
public boolean isReady(int timeout) throws InterruptedException
- Throws:
InterruptedException
-
getDatabases
public com.google.common.util.concurrent.ListenableFuture<List<String>> getDatabases()
Description copied from interface:OvsdbClient
Gets the list of database names exposed by this ovsdb capable device.- Specified by:
getDatabases
in interfaceOvsdbClient
- Returns:
- list of database names
-
getSchema
public com.google.common.util.concurrent.ListenableFuture<TypedDatabaseSchema> getSchema(String database)
Description copied from interface:OvsdbClient
Asynchronously returns the schema object for a specific database.- Specified by:
getSchema
in interfaceOvsdbClient
- Parameters:
database
- name of the database schema- Returns:
- DatabaseSchema future
-
setRpc
public void setRpc(OvsdbRPC rpc)
-
getDatabaseSchema
public TypedDatabaseSchema getDatabaseSchema(String dbName)
- Specified by:
getDatabaseSchema
in interfaceOvsdbClient
-
createTypedRowWrapper
public <T extends TypedBaseTable<?>> T createTypedRowWrapper(Class<T> klazz)
User friendly convenient method that make use of TyperUtils.getTypedRowWrapper to create a Typed Row Proxy given the Typed Table Class.- Specified by:
createTypedRowWrapper
in interfaceOvsdbClient
- Parameters:
klazz
- Typed Interface- Returns:
- Proxy wrapper for the actual raw Row class.
-
createTypedRowWrapper
public <T extends TypedBaseTable<?>> T createTypedRowWrapper(DatabaseSchema dbSchema, Class<T> klazz)
User friendly convenient method that make use of getTypedRowWrapper to create a Typed Row Proxy given DatabaseSchema and Typed Table Class.- Specified by:
createTypedRowWrapper
in interfaceOvsdbClient
- Parameters:
dbSchema
- Database Schema of interestklazz
- Typed Interface- Returns:
- Proxy wrapper for the actual raw Row class.
-
getTypedRowWrapper
public <T extends TypedBaseTable<?>> T getTypedRowWrapper(Class<T> klazz, Row<GenericTableSchema> row)
User friendly convenient method to get a Typed Row Proxy given a Typed Table Class and the Row to be wrapped.- Specified by:
getTypedRowWrapper
in interfaceOvsdbClient
- Parameters:
klazz
- Typed Interfacerow
- The actual Row that the wrapper is operating on. It can be null if the caller is just interested in getting ColumnSchema.- Returns:
- Proxy wrapper for the actual raw Row class.
-
getConnectionInfo
public OvsdbConnectionInfo getConnectionInfo()
- Specified by:
getConnectionInfo
in interfaceOvsdbClient
-
isActive
public boolean isActive()
- Specified by:
isActive
in interfaceOvsdbClient
-
disconnect
public void disconnect()
- Specified by:
disconnect
in interfaceOvsdbClient
-
isConnectionPublished
public boolean isConnectionPublished()
- Specified by:
isConnectionPublished
in interfaceOvsdbClient
-
setConnectionPublished
public void setConnectionPublished(boolean connectionPublished)
- Specified by:
setConnectionPublished
in interfaceOvsdbClient
-
-