.\" Man page generated from reStructuredText. . .TH "OVSDB-SERVER" "7" "Apr 11, 2023" "2.15" "Open vSwitch" .SH NAME ovsdb-server \- Open vSwitch Database Server Protocol . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .SH DESCRIPTION .sp \fBovsdb\-server\fP implements the Open vSwitch Database (OVSDB) protocol specified in RFC 7047. This document provides clarifications for how \fBovsdb\-server\fP implements the protocol and describes the extensions that it provides beyond RFC 7047. Numbers in section headings refer to corresponding sections in RFC 7047. .SS 3.1 JSON Usage .sp RFC 4627 says that names within a JSON object should be unique. The Open vSwitch JSON parser discards all but the last value for a name that is specified more than once. .sp The definition of allows for implementation extensions. Currently \fBovsdb\-server\fP uses the following additional \fBerror\fP strings (which might change in later releases): .INDENT 0.0 .TP .B \fBsyntax error\fP or \fBunknown column\fP The request could not be parsed as an OVSDB request. An additional \fBsyntax\fP member, whose value is a string that contains JSON, may narrow down the particular syntax that could not be parsed. .TP .B \fBinternal error\fP The request triggered a bug in \fBovsdb\-server\fP\&. .TP .B \fBovsdb error\fP A map or set contains a duplicate key. .TP .B \fBpermission error\fP The request was denied by the role\-based access control extension, introduced in version 2.8. .UNINDENT .SS 3.2 Schema Format .sp RFC 7047 requires the \fBversion\fP field in . Current versions of \fBovsdb\-server\fP allow it to be omitted (future versions are likely to require it). .sp RFC 7047 allows columns that contain weak references to be immutable. This raises the issue of the behavior of the weak reference when the rows that it references are deleted. Since version 2.6, \fBovsdb\-server\fP forces columns that contain weak references to be mutable. .sp Since version 2.8, the table name \fBRBAC_Role\fP is used internally by the role\-based access control extension to \fBovsdb\-server\fP and should not be used for purposes other than defining mappings of role names to table access permissions. This table has one row per role name and the following columns: .INDENT 0.0 .TP .B \fBname\fP The role name. .TP .B \fBpermissions\fP A map of table name to a reference to a row in a separate permission table. .UNINDENT .sp The separate RBAC permission table has one row per access control configuration and the following columns: .INDENT 0.0 .TP .B \fBname\fP The name of the table to which the row applies. .TP .B \fBauthorization\fP The set of column names and column:key pairs to be compared with the client ID in order to determine the authorization status of the requested operation. .TP .B \fBinsert_delete\fP A boolean value, true if authorized insertions and deletions are allowed, false if no insertions or deletions are allowed. .TP .B \fBupdate\fP The set of columns and column:key pairs for which authorized update and mutate operations should be permitted. .UNINDENT .SS 4 Wire Protocol .sp The original OVSDB specifications included the following reasons, omitted from RFC 7047, to operate JSON\-RPC directly over a stream instead of over HTTP: .INDENT 0.0 .IP \(bu 2 JSON\-RPC is a peer\-to\-peer protocol, but HTTP is a client\-server protocol, which is a poor match. Thus, JSON\-RPC over HTTP requires the client to periodically poll the server to receive server requests. .IP \(bu 2 HTTP is more complicated than stream connections and doesn’t provide any corresponding advantage. .IP \(bu 2 The JSON\-RPC specification for HTTP transport is incomplete. .UNINDENT .SS 4.1.3 Transact .sp Since version 2.8, role\-based access controls can be applied to operations within a transaction that would modify the contents of the database (these operations include row insert, row delete, column update, and column mutate). Role\-based access controls are applied when the database schema contains a table with the name \fBRBAC_Role\fP and the connection on which the transaction request was received has an associated role name (from the \fBrole\fP column in the remote connection table). When role\-based access controls are enabled, transactions that are otherwise well\-formed may be rejected depending on the client’s role, ID, and the contents of the \fBRBAC_Role\fP table and associated permissions table. .SS 4.1.5 Monitor .sp For backward compatibility, \fBovsdb\-server\fP currently permits a single to be used instead of an array; it is treated as a single\-element array. Future versions of \fBovsdb\-server\fP might remove this compatibility feature. .sp Because the parameter is used to match subsequent update notifications (see below) to the request, it must be unique among all active monitors. \fBovsdb\-server\fP rejects attempt to create two monitors with the same identifier. .sp When a given client sends a \fBtransact\fP request that changes a table that the same client is monitoring, \fBovsdb\-server\fP always sends the \fBupdate\fP (or \fBupdate2\fP or \fBupdate3\fP) for these changes before it sends the reply to the \fBtransact\fP request. Thus, when a client receives a \fBtransact\fP reply, it can know immediately what changes (if any) the transaction made. (If ovsdb\-server might use the other order, then a client that wishes to act on based on the results of its own transactions would not know when this was guaranteed to have taken place.) .SS 4.1.7 Monitor Cancellation .sp When a database monitored by a session is removed, and database change awareness is enabled for the session (see Section 4.1.16), the database server spontaneously cancels all monitors (including conditional monitors described in Section 4.1.12) for the removed database. For each canceled monitor, it issues a notification in the following form: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C "method": "monitor_canceled" "params": [] "id": null .ft P .fi .UNINDENT .UNINDENT .SS 4.1.12 Monitor_cond .sp A new monitor method added in Open vSwitch version 2.6. The \fBmonitor_cond\fP request enables a client to replicate subsets of tables within an OVSDB database by requesting notifications of changes to rows matching one of the conditions specified in \fBwhere\fP by receiving the specified contents of these rows when table updates occur. \fBmonitor_cond\fP also allows a more efficient update notifications by receiving notifications (described below). .sp The \fBmonitor\fP method described in Section 4.1.5 also applies to \fBmonitor_cond\fP, with the following exceptions: .INDENT 0.0 .IP \(bu 2 RPC request method becomes \fBmonitor_cond\fP\&. .IP \(bu 2 Reply result follows , described in Section 4.1.14. .IP \(bu 2 Subsequent changes are sent to the client using the \fBupdate2\fP monitor notification, described in Section 4.1.14 .IP \(bu 2 Update notifications are being sent only for rows matching [*]. .UNINDENT .sp The request object has the following members: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C "method": "monitor_cond" "params": [, , ] "id": .ft P .fi .UNINDENT .UNINDENT .sp The parameter is used to match subsequent update notifications (see below) to this request. The object maps the name of the table to an array of . .sp Each is an object with the following members: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C "columns": [*] optional "where": [*] optional "select": optional .ft P .fi .UNINDENT .UNINDENT .sp The \fBcolumns\fP, if present, define the columns within the table to be monitored that match conditions. If not present, all columns are monitored. .sp The \fBwhere\fP, if present, is a JSON array of and boolean values. If not present or condition is an empty array, implicit True will be considered and updates on all rows will be sent. .sp is an object with the following members: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C "initial": optional "insert": optional "delete": optional "modify": optional .ft P .fi .UNINDENT .UNINDENT .sp The contents of this object specify how the columns or table are to be monitored as explained in more detail below. .sp The response object has the following members: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C "result": "error": null "id": same "id" as request .ft P .fi .UNINDENT .UNINDENT .sp The object is described in detail in Section 4.1.14. It contains the contents of the tables for which initial rows are selected. If no tables initial contents are requested, then \fBresult\fP is an empty object. .sp Subsequently, when changes to a specified table that match one of the conditions in are committed, the changes are automatically sent to the client using the \fBupdate2\fP monitor notification (see Section 4.1.14). This monitoring persists until the JSON\-RPC session terminates or until the client sends a \fBmonitor_cancel\fP JSON\-RPC request. .sp Each specifies one or more conditions and the manner in which the rows that match the conditions are to be monitored. The circumstances in which an \fBupdate\fP notification is sent for a row within the table are determined by : .INDENT 0.0 .IP \(bu 2 If \fBinitial\fP is omitted or true, every row in the original table that matches one of the conditions is sent as part of the response to the \fBmonitor_cond\fP request. .IP \(bu 2 If \fBinsert\fP is omitted or true, update notifications are sent for rows newly inserted into the table that match conditions or for rows modified in the table so that their old version does not match the condition and new version does. .IP \(bu 2 If \fBdelete\fP is omitted or true, update notifications are sent for rows deleted from the table that match conditions or for rows modified in the table so that their old version does match the conditions and new version does not. .IP \(bu 2 If \fBmodify\fP is omitted or true, update notifications are sent whenever a row in the table that matches conditions in both old and new version is modified. .UNINDENT .sp Both \fBmonitor\fP and \fBmonitor_cond\fP sessions can exist concurrently. However, \fBmonitor\fP and \fBmonitor_cond\fP shares the same parameter space; it must be unique among all \fBmonitor\fP and \fBmonitor_cond\fP sessions. .SS 4.1.13 Monitor_cond_change .sp The \fBmonitor_cond_change\fP request enables a client to change an existing \fBmonitor_cond\fP replication of the database by specifying a new condition and columns for each replicated table. Currently changing the columns set is not supported. .sp The request object has the following members: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C "method": "monitor_cond_change" "params": [, , ] "id": .ft P .fi .UNINDENT .UNINDENT .sp The parameter should have a value of an existing conditional monitoring session from this client. The second in params array is the requested value for this session. This value is valid only after \fBmonitor_cond_change\fP is committed. A user can use these values to distinguish between update messages before conditions update and after. The object maps the name of the table to an array of . Monitored tables not included in retain their current conditions. .sp Each is an object with the following members: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C "columns": [*] optional "where": [*] optional .ft P .fi .UNINDENT .UNINDENT .sp The \fBcolumns\fP specify a new array of columns to be monitored, although this feature is not yet supported. .sp The \fBwhere\fP specify a new array of conditions to be applied to this monitoring session. .sp The response object has the following members: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C "result": null "error": null "id": same "id" as request .ft P .fi .UNINDENT .UNINDENT .sp Subsequent notifications are described in detail in Section 4.1.14 in the RFC. If insert contents are requested by original monitor_cond request, will contain rows that match the new condition and do not match the old condition. If deleted contents are requested by origin monitor request, will contain any matched rows by old condition and not matched by the new condition. .sp Changes according to the new conditions are automatically sent to the client using the \fBupdate2\fP or \fBupdate3\fP monitor notification depending on the monitor method. An update, if any, as a result of a condition change, will be sent to the client before the reply to the \fBmonitor_cond_change\fP request. .SS 4.1.14 Update2 notification .sp The \fBupdate2\fP notification is sent by the server to the client to report changes in tables that are being monitored following a \fBmonitor_cond\fP request as described above. The notification has the following members: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C "method": "update2" "params": [, ] "id": null .ft P .fi .UNINDENT .UNINDENT .sp The in \fBparams\fP is the same as the value passed as the in \fBparams\fP for the corresponding \fBmonitor\fP request. is an object that maps from a table name to a . A is an object that maps from row’s UUID to a object. A is an object with one of the following members: .INDENT 0.0 .TP .B \fB"initial": \fP present for \fBinitial\fP updates .TP .B \fB"insert": \fP present for \fBinsert\fP updates .TP .B \fB"delete": \fP present for \fBdelete\fP updates .TP .B \fB"modify": "\fP present for \fBmodify\fP updates .UNINDENT .sp The format of is described in Section 5.1. .sp is always a null object for a \fBdelete\fP update. In \fBinitial\fP and \fBinsert\fP updates, omits columns whose values equal the default value of the column type. .sp For a \fBmodify\fP update, contains only the columns that are modified. stores the difference between the old and new value for those columns, as described below. .sp For columns with single value, the difference is the value of the new column. .sp The difference between two sets are all elements that only belong to one of the sets. .sp The difference between two maps are all key\-value pairs whose keys appears in only one of the maps, plus the key\-value pairs whose keys appear in both maps but with different values. For the latter elements, includes the value from the new column. .sp Initial views of rows are not presented in update2 notifications, but in the response object to the \fBmonitor_cond\fP request. The formatting of the object, however, is the same in either case. .SS 4.1.15 Monitor_cond_since .sp A new monitor method added in Open vSwitch version 2.12. The \fBmonitor_cond_since\fP request enables a client to request changes that happened after a specific transaction id. A client can use this feature to request only latest changes after a server connection reset instead of re\-transfer all data from the server again. .sp The \fBmonitor_cond\fP method described in Section 4.1.12 also applies to \fBmonitor_cond_since\fP, with the following exceptions: .INDENT 0.0 .IP \(bu 2 RPC request method becomes \fBmonitor_cond_since\fP\&. .IP \(bu 2 Reply result includes extra parameters. .IP \(bu 2 Subsequent changes are sent to the client using the \fBupdate3\fP monitor notification, described in Section 4.1.16 .UNINDENT .sp The request object has the following members: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C "method": "monitor_cond_since" "params": [, , , ] "id": .ft P .fi .UNINDENT .UNINDENT .sp The parameter is the transaction id that identifies the latest data the client already has, and it requests server to send changes AFTER this transaction (exclusive). .sp All other parameters are the same as \fBmonitor_cond\fP method. .sp The response object has the following members: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C "result": [, , ] "error": null "id": same "id" as request .ft P .fi .UNINDENT .UNINDENT .sp The is a boolean value that tells if the requested by client is found in server’s history or not. If true, the changes after that version up to current is sent. Otherwise, all data is sent. .sp The is the transaction id that identifies the latest transaction included in the changes in of this response, so that client can keep tracking. If there is no change involved in this response, it is the same as the in the request if is true, or zero uuid if is false. If the server does not support transaction uuid, it will be zero uuid as well. .sp All other parameters are the same as in response object of \fBmonitor_cond\fP method. .sp Like in \fBmonitor_cond\fP, subsequent changes that match conditions in are automatically sent to the client, but using \fBupdate3\fP monitor notification (see Section 4.1.16), instead of \fBupdate2\fP\&. .SS 4.1.16 Update3 notification .sp The \fBupdate3\fP notification is sent by the server to the client to report changes in tables that are being monitored following a \fBmonitor_cond_since\fP request as described above. The notification has the following members: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C "method": "update3" "params": [, , ] "id": null .ft P .fi .UNINDENT .UNINDENT .sp The is the same as described in the response object of \fBmonitor_cond_since\fP\&. .sp All other parameters are the same as in \fBupdate2\fP monitor notification (see Section 4.1.14). .SS 4.1.17 Get Server ID .sp A new RPC method added in Open vSwitch version 2.7. The request contains the following members: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C "method": "get_server_id" "params": null "id": .ft P .fi .UNINDENT .UNINDENT .sp The response object contains the following members: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C "result": "" "error": null "id": same "id" as request .ft P .fi .UNINDENT .UNINDENT .sp is JSON string that contains a UUID that uniquely identifies the running OVSDB server process. A fresh UUID is generated when the process restarts. .SS 4.1.18 Database Change Awareness .sp RFC 7047 does not provide a way for a client to find out about some kinds of configuration changes, such as about databases added or removed while a client is connected to the server, or databases changing between read/write and read\-only due to a transition between active and backup roles. Traditionally, \fBovsdb\-server\fP disconnects all of its clients when this happens, because this prompts a well\-written client to reassess what is available from the server when it reconnects. .sp OVS 2.9 provides a way for clients to keep track of these kinds of changes, by monitoring the \fBDatabase\fP table in the \fB_Server\fP database introduced in this release (see \fBovsdb\-server(5)\fP for details). By itself, this does not suppress \fBovsdb\-server\fP disconnection behavior, because a client might monitor this database without understanding its special semantics. Instead, \fBovsdb\-server\fP provides a special request: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C "method": "set_db_change_aware" "params": [] "id": .ft P .fi .UNINDENT .UNINDENT .sp If the boolean in the request is true, it suppresses the connection\-closing behavior for the current connection, and false restores the default behavior. The reply is always the same: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C "result": {} "error": null "id": same "id" as request .ft P .fi .UNINDENT .UNINDENT .SS 4.1.19 Schema Conversion .sp Open vSwitch 2.9 adds a new JSON\-RPC request to convert an online database from one schema to another. The request contains the following members: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C "method": "convert" "params": [, ] "id": .ft P .fi .UNINDENT .UNINDENT .sp Upon receipt, the server converts database to schema . The schema’s name must be . The conversion is atomic, consistent, isolated, and durable. The data in the database must be valid when interpreted under , with only one exception: data for tables and columns that do not exist in the new schema are ignored. Columns that exist in but not in the database are set to their default values. All of the new schema’s constraints apply in full. .sp If the conversion is successful, the server notifies clients that use the \fBset_db_change_aware\fP RPC introduced in Open vSwitch 2.9 and cancels their outstanding transactions and monitors. The server disconnects other clients, enabling them to notice the change when they reconnect. The server sends the following reply: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C "result": {} "error": null "id": same "id" as request .ft P .fi .UNINDENT .UNINDENT .sp If the conversion fails, then the server sends an error reply in the following form: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C "result": null "error": [] "id": same "id" as request .ft P .fi .UNINDENT .UNINDENT .SS 5.1 Notation .sp For , RFC 7047 only allows the use of \fB!=\fP, \fB==\fP, \fBincludes\fP, and \fBexcludes\fP operators with set types. Open vSwitch 2.4 and later extend to allow the use of \fB<\fP, \fB<=\fP, \fB>=\fP, and \fB>\fP operators with a column with type “set of 0 or 1 integer” and an integer argument, and with “set of 0 or 1 real” and a real argument. These conditions evaluate to false when the column is empty, and otherwise as described in RFC 7047 for integer and real types. .sp is specified in Section 5.1 in the RFC with the following change: A condition can be either a 3\-element JSON array as described in the RFC or a boolean value. In case of an empty array an implicit true boolean value will be considered. .SS 5.2.1 Insert .sp As an extension, Open vSwitch 2.13 and later allow an optional \fBuuid\fP member to specify the UUID for the new row. The specified UUID must be unique within the table when it is inserted and not the UUID of a row previously deleted within the transaction. If the UUID violates these rules, then the operation fails with a \fBduplicate uuid\fP error. .SS 5.2.6 Wait, 5.2.7 Commit, 5.2.9 Comment .sp RFC 7047 says that the \fBwait\fP, \fBcommit\fP, and \fBcomment\fP operations have no corresponding result object. This is not true. Instead, when such an operation is successful, it yields a result object with no members. .SH AUTHOR The Open vSwitch Development Community .SH COPYRIGHT 2023, The Open vSwitch Development Community .\" Generated by docutils manpage writer. .