OVSDB Client Module.
Behaviours: gen_server
.
Authors: Vasu Dasari.
This Module is the primary interface to OVSDB library
db_name() = unicode:chardata()
db_table() = unicode:chardata()
dst() = pid() | port() | (RegName::atom()) | {RegName::atom(), Node::node()}
ip_addr() = inet:socket_address() | inet:hostname()
json_value() = jsone:json_value()
opts() = #{pid => dst(), database => db_name(), br_name => all | unicode:chardata(), port_name => all | unicode:chardata(), term() => term()}
ovsdb_ops() = map() | list()
proto_type() = tcp | ssl
rpc_return() = {ok, term()} | {error, term()} | not_connected
start/4 | Starts TCP connection. |
start/2 | Starts TCP connection. |
stop/1 | Stop ovsdb connection if established. |
info/1 | Get information about the ovsdb process. |
list_dbs/1 | Lists available databases. |
list_dbs/0 | Equivalent to list_dbs(#{}). |
get_schema/1 | Get database schema. |
get_schema/0 | Equivalent to get_schema(#{}). |
transaction/2 | Perform OVSDB Transaction. |
transaction/1 | Equivalent to transaction(Operation, #{}). |
cancel/2 | Cancel Transaction. |
cancel/1 | Equivalent to cancel(Operation, #{}). |
monitor/3 | Monitor. |
monitor/2 | Equivalent to monitor(Id, Select, #{}). |
monitor_cancel/2 | Cancel Monitor Operation. |
monitor_cancel/1 | Equivalent to monitor_cancel(Id, #{}). |
lock/2 | Lock Database. |
lock/1 | Equivalent to lock(Id, #{}). |
steal/2 | Steal lock. |
steal/1 | Equivalent to steal(Id, #{}). |
unlock/2 | Unlock database. |
unlock/1 | Equivalent to unlock(Id, #{}). |
echo/1 | Echo. |
echo/0 | Equivalent to echo(). |
get_schema_version/1 | Get OVSDB Schema's version. |
get_schema_version/0 | Equivalent to get_schema_version(#{}). |
list_columns/2 | Get columns of table. |
list_columns/1 | Equivalent to list_columns(Table, #{}). |
list_tables/1 | Get a list of tables. |
list_tables/0 | Equivalent to list_tables(#{}). |
dump/2 | |
dump/3 | |
start_link/3 | start_link when instantiated from applications own supervisor. |
start(Type::proto_type(), IpAddr::ip_addr(), Port::inet:port_number(), Opts::opts()) -> ok
Starts TCP connection
Establishes TCP connection with OVSDB server identified by IpAddr and Port. Optionally user can set defaul database to be used in future transactions, by specifying opts with Opts = #{database => "DbName" If a connection is already in polace, it would drop it and restarts new session if endpoint is different.
start(Ovsdb_Server_Str, Opts) -> any()
Starts TCP connection
Establishes TCP connection with OVSDB server identified by "IpAddr:Port" string format.
stop(Opts) -> any()
Stop ovsdb connection if established
info(Opts) -> any()
Get information about the ovsdb process
This API can be used to retrieve the callback module information among other things
list_dbs(Opts::opts()) -> rpc_return()
Lists available databases
Reference 4.1.1. List Databases
list_dbs() -> any()
Equivalent to list_dbs(#{})
.
get_schema(Opts::opts()) -> rpc_return()
Get database schema
Reference 4.1.2. Get Schema
get_schema() -> any()
Equivalent to get_schema(#{})
.
transaction(Operation::ovsdb_ops(), Opts::opts()) -> rpc_return()
Perform OVSDB Transaction
Reference 4.1.3. Transaction
transaction(Operation) -> any()
Equivalent to transaction(Operation, #{})
.
cancel(Operation::ovsdb_ops(), Opts::opts()) -> rpc_return()
Cancel Transaction
Reference 4.1.4. Cancel
cancel(Operation) -> any()
Equivalent to cancel(Operation, #{})
.
monitor(Id::json_value(), Select::term(), Opts::opts()) -> rpc_return()
Monitor
Caller initiates monitor session identified by an Id. This Id need to be used to cancel/stop monitor operation. All monitored events will be sent to caller process with following syntax.
{ovsdb_monitor, Id, Update}
Reference 4.1.5. Monitor
monitor(Id, Select) -> any()
Equivalent to monitor(Id, Select, #{})
.
monitor_cancel(Id::json_value(), Opts::opts()) -> rpc_return()
Cancel Monitor Operation
Reference 4.1.7. Monitor Cancellation
monitor_cancel(Id) -> any()
Equivalent to monitor_cancel(Id, #{})
.
lock(Id::json_value(), Opts::opts()) -> rpc_return()
Lock Database
This function returns with status of database getting locked or not. If it is not locked, a notification will be sent when the database is locked. And it would like this:
{ovsdb_notification, Method, LockId}
Method: locked | stolen
Reference 4.1.8. Lock Operations
lock(Id) -> any()
Equivalent to lock(Id, #{})
.
steal(Id::json_value(), Opts::opts()) -> rpc_return()
Steal lock
This method would forcefully grab the database access which was previously locked by Id by another process. This operation would notify the process which originally had lock that the lock is stolen.
Reference 4.1.8. Lock Operations
steal(Id) -> any()
Equivalent to steal(Id, #{})
.
unlock(Id::json_value(), Opts::opts()) -> rpc_return()
Unlock database
Unlock the database by releasing the lock.
Reference 4.1.8. Lock Operations
unlock(Id) -> any()
Equivalent to unlock(Id, #{})
.
echo(Opts::opts()) -> rpc_return()
Echo
This can be used to check by caller if the session is active. By default, ovsdb_client performs echo - echo-reply handshakes to makesure session is active. This function can be used for debugging.
Reference 4.1.11. Echo
echo() -> any()
Equivalent to echo()
.
get_schema_version(Opts::opts()) -> rpc_return()
Get OVSDB Schema's version
get_schema_version() -> any()
Equivalent to get_schema_version(#{})
.
list_columns(Table::db_table(), Opts::opts()) -> rpc_return()
Get columns of table
Reference 4.1.3. Transaction
list_columns(Table) -> any()
Equivalent to list_columns(Table, #{})
.
list_tables(Opts::opts()) -> rpc_return()
Get a list of tables
list_tables() -> any()
Equivalent to list_tables(#{})
.
dump(Table::db_table(), Columns::list()) -> rpc_return()
dump(Table, Columns, Opts) -> any()
start_link(ProcName::dst(), CallbackModuleName::module(), CallbackState::term()) -> {ok, Pid::pid()} | ignore | {error, Reason::term()}
start_link when instantiated from applications own supervisor
ovsdb_client keeps a state for the application module which can provide contet to the application when callbacks are called