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 voidcancelMonitor(MonitorHandle handler)Cancels an existing monitor method.voidcancelMonitor(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.voiddisconnect()com.google.common.util.concurrent.ListenableFuture<List<String>>echo()ovsdb echo operation.OvsdbConnectionInfogetConnectionInfo()com.google.common.util.concurrent.ListenableFuture<List<String>>getDatabases()Gets the list of database names exposed by this ovsdb capable device.TypedDatabaseSchemagetDatabaseSchema(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.booleanisActive()booleanisConnectionPublished()booleanisReady(int timeout)voidlock(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.voidsetConnectionPublished(boolean connectionPublished)voidsetRpc(OvsdbRPC rpc)voidstartEchoService(EchoServiceCallbackFilters callbackFilters)Starts the echo service.com.google.common.util.concurrent.ListenableFuture<Boolean>steal(String lockId)ovsdb steal operation.voidstopEchoService()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.TransactionBuildertransactBuilder(DatabaseSchema dbSchema)Allows for a mini DSL way of collecting the transactions to be executed against the ovsdb instance.protected TableUpdatestransformingCallback(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:OvsdbClientExecute the list of operations in a single Transactions. Similar to the transactBuilder() method- Specified by:
transactin interfaceOvsdbClientoperations- 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:OvsdbClientovsdb monitor operation.- Specified by:
monitorin interfaceOvsdbClientmonitorRequest- 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:OvsdbClientovsdb monitor operation.- Specified by:
monitorin interfaceOvsdbClientmonitorRequest- 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:OvsdbClientovsdb monitor operation.- Specified by:
monitorin interfaceOvsdbClientmonitorRequest- 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:OvsdbClientovsdb monitor operation.- Specified by:
monitorin interfaceOvsdbClientmonitorRequest- 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:OvsdbClientCancels an existing monitor method.- Specified by:
cancelMonitorin 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:OvsdbClientCancels an existing monitor method.- Specified by:
cancelMonitorin 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:OvsdbClientovsdb echo operation.- Specified by:
echoin interfaceOvsdbClient
-
lock
public void lock(String lockId, LockAquisitionCallback lockedCallBack, LockStolenCallback stolenCallback)
Description copied from interface:OvsdbClientovsdb lock operation.- Specified by:
lockin 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:OvsdbClientovsdb steal operation. SeeOvsdbClient.lock(String, LockAquisitionCallback, LockStolenCallback)- Specified by:
stealin interfaceOvsdbClient
-
unLock
public com.google.common.util.concurrent.ListenableFuture<Boolean> unLock(String lockId)
Description copied from interface:OvsdbClientovsdb unlock operation. SeeOvsdbClient.unLock(String)- Specified by:
unLockin interfaceOvsdbClient
-
startEchoService
public void startEchoService(EchoServiceCallbackFilters callbackFilters)
Description copied from interface:OvsdbClientStarts the echo service. ThecallbackFilterscan be used to get notified on the absence of echo notifications from the remote device and control the frequency of such notifications.- Specified by:
startEchoServicein interfaceOvsdbClient- Parameters:
callbackFilters- callbacks for notifying the client of missing echo calls from remote.
-
stopEchoService
public void stopEchoService()
Description copied from interface:OvsdbClientStops the echo service, i.e echo requests from the remote would not be acknowledged after this call.- Specified by:
stopEchoServicein interfaceOvsdbClient
-
transactBuilder
public TransactionBuilder transactBuilder(DatabaseSchema dbSchema)
Description copied from interface:OvsdbClientAllows for a mini DSL way of collecting the transactions to be executed against the ovsdb instance.- Specified by:
transactBuilderin 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:OvsdbClientGets the list of database names exposed by this ovsdb capable device.- Specified by:
getDatabasesin interfaceOvsdbClient- Returns:
- list of database names
-
getSchema
public com.google.common.util.concurrent.ListenableFuture<TypedDatabaseSchema> getSchema(String database)
Description copied from interface:OvsdbClientAsynchronously returns the schema object for a specific database.- Specified by:
getSchemain 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:
getDatabaseSchemain 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:
createTypedRowWrapperin 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:
createTypedRowWrapperin 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:
getTypedRowWrapperin 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:
getConnectionInfoin interfaceOvsdbClient
-
isActive
public boolean isActive()
- Specified by:
isActivein interfaceOvsdbClient
-
disconnect
public void disconnect()
- Specified by:
disconnectin interfaceOvsdbClient
-
isConnectionPublished
public boolean isConnectionPublished()
- Specified by:
isConnectionPublishedin interfaceOvsdbClient
-
setConnectionPublished
public void setConnectionPublished(boolean connectionPublished)
- Specified by:
setConnectionPublishedin interfaceOvsdbClient
-
-