Independent Submission                                          B. Pfaff
Request for Comments: 7047                                 B. Davie, Ed.
Category: Informational                                     VMware, Inc.
ISSN: 2070-1721                                            December 2013
        
Independent Submission                                          B. Pfaff
Request for Comments: 7047                                 B. Davie, Ed.
Category: Informational                                     VMware, Inc.
ISSN: 2070-1721                                            December 2013
        

The Open vSwitch Database Management Protocol

开放式vSwitch数据库管理协议

Abstract

摘要

Open vSwitch is an open-source software switch designed to be used as a vswitch (virtual switch) in virtualized server environments. A vswitch forwards traffic between different virtual machines (VMs) on the same physical host and also forwards traffic between VMs and the physical network. Open vSwitch is open to programmatic extension and control using OpenFlow and the OVSDB (Open vSwitch Database) management protocol. This document defines the OVSDB management protocol. The Open vSwitch project includes open-source OVSDB client and server implementations.

Open vSwitch是一种开源软件交换机,设计用于虚拟化服务器环境中的vSwitch(虚拟交换机)。vswitch转发同一物理主机上不同虚拟机(VM)之间的通信量,还转发VM和物理网络之间的通信量。OpenVSwitch可使用OpenFlow和OVSDB(OpenVSwitch数据库)管理协议进行编程扩展和控制。本文件定义了OVSDB管理协议。OpenVSwitch项目包括开源OVSDB客户端和服务器实现。

Status of This Memo

关于下段备忘

This document is not an Internet Standards Track specification; it is published for informational purposes.

本文件不是互联网标准跟踪规范;它是为了提供信息而发布的。

This is a contribution to the RFC Series, independently of any other RFC stream. The RFC Editor has chosen to publish this document at its discretion and makes no statement about its value for implementation or deployment. Documents approved for publication by the RFC Editor are not a candidate for any level of Internet Standard; see Section 2 of RFC 5741.

这是对RFC系列的贡献,独立于任何其他RFC流。RFC编辑器已选择自行发布此文档,并且未声明其对实现或部署的价值。RFC编辑批准发布的文件不适用于任何级别的互联网标准;见RFC 5741第2节。

Information about the current status of this document, any errata, and how to provide feedback on it may be obtained at http://www.rfc-editor.org/info/rfc7047.

有关本文件当前状态、任何勘误表以及如何提供反馈的信息,请访问http://www.rfc-editor.org/info/rfc7047.

Copyright Notice

版权公告

Copyright (c) 2013 IETF Trust and the persons identified as the document authors. All rights reserved.

版权所有(c)2013 IETF信托基金和确定为文件作者的人员。版权所有。

This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document.

本文件受BCP 78和IETF信托有关IETF文件的法律规定的约束(http://trustee.ietf.org/license-info)自本文件出版之日起生效。请仔细阅读这些文件,因为它们描述了您对本文件的权利和限制。

Table of Contents

目录

   1. Introduction ....................................................3
      1.1. Requirements Language ......................................3
      1.2. Terminology ................................................3
   2. System Overview .................................................4
   3. OVSDB Structure .................................................5
      3.1. JSON Usage .................................................6
      3.2. Schema Format ..............................................7
   4. Wire Protocol ..................................................12
      4.1. RPC Methods ...............................................12
           4.1.1. List Databases .....................................12
           4.1.2. Get Schema .........................................13
           4.1.3. Transact ...........................................13
           4.1.4. Cancel .............................................16
           4.1.5. Monitor ............................................16
           4.1.6. Update Notification ................................18
           4.1.7. Monitor Cancellation ...............................19
           4.1.8. Lock Operations ....................................19
           4.1.9. Locked Notification ................................21
           4.1.10. Stolen Notification ...............................21
           4.1.11. Echo ..............................................22
   5. Database Operations ............................................22
      5.1. Notation ..................................................22
      5.2. Operations ................................................27
           5.2.1. Insert .............................................27
           5.2.2. Select .............................................28
           5.2.3. Update .............................................29
           5.2.4. Mutate .............................................29
           5.2.5. Delete .............................................30
           5.2.6. Wait ...............................................31
           5.2.7. Commit .............................................32
           5.2.8. Abort ..............................................32
           5.2.9. Comment ............................................32
           5.2.10. Assert ............................................33
   6. IANA Considerations ............................................33
   7. Security Considerations ........................................33
   8. Acknowledgements ...............................................34
   9. References .....................................................34
      9.1. Normative References ......................................34
      9.2. Informative References ....................................34
        
   1. Introduction ....................................................3
      1.1. Requirements Language ......................................3
      1.2. Terminology ................................................3
   2. System Overview .................................................4
   3. OVSDB Structure .................................................5
      3.1. JSON Usage .................................................6
      3.2. Schema Format ..............................................7
   4. Wire Protocol ..................................................12
      4.1. RPC Methods ...............................................12
           4.1.1. List Databases .....................................12
           4.1.2. Get Schema .........................................13
           4.1.3. Transact ...........................................13
           4.1.4. Cancel .............................................16
           4.1.5. Monitor ............................................16
           4.1.6. Update Notification ................................18
           4.1.7. Monitor Cancellation ...............................19
           4.1.8. Lock Operations ....................................19
           4.1.9. Locked Notification ................................21
           4.1.10. Stolen Notification ...............................21
           4.1.11. Echo ..............................................22
   5. Database Operations ............................................22
      5.1. Notation ..................................................22
      5.2. Operations ................................................27
           5.2.1. Insert .............................................27
           5.2.2. Select .............................................28
           5.2.3. Update .............................................29
           5.2.4. Mutate .............................................29
           5.2.5. Delete .............................................30
           5.2.6. Wait ...............................................31
           5.2.7. Commit .............................................32
           5.2.8. Abort ..............................................32
           5.2.9. Comment ............................................32
           5.2.10. Assert ............................................33
   6. IANA Considerations ............................................33
   7. Security Considerations ........................................33
   8. Acknowledgements ...............................................34
   9. References .....................................................34
      9.1. Normative References ......................................34
      9.2. Informative References ....................................34
        
1. Introduction
1. 介绍

In virtualized server environments, it is typically required to use a vswitch (virtual switch) to forward traffic between different virtual machines (VMs) on the same physical host and between VMs and the physical network. Open vSwitch [OVS] is an open-source software switch designed to be used as a vswitch in such environments. Open vSwitch (OVS) is open to programmatic extension and control using OpenFlow [OF-SPEC] and the OVSDB (Open vSwitch Database) management protocol. This document defines the OVSDB management protocol. The Open vSwitch project includes open-source OVSDB client and server implementations.

在虚拟化服务器环境中,通常需要使用vswitch(虚拟交换机)在同一物理主机上的不同虚拟机(VM)之间以及虚拟机与物理网络之间转发流量。OpenVSwitch[OVS]是一种开源软件交换机,设计用于此类环境中的vSwitch。OpenVSwitch(OVS)可以使用OpenFlow[OF-SPEC]和OVSDB(OpenVSwitch数据库)管理协议进行编程扩展和控制。本文件定义了OVSDB管理协议。OpenVSwitch项目包括开源OVSDB客户端和服务器实现。

The OVSDB management protocol uses JSON [RFC4627] for its wire format and is based on JSON-RPC version 1.0 [JSON-RPC].

OVSDB管理协议使用JSON[RFC4627]作为其有线格式,并基于JSON-RPC版本1.0[JSON-RPC]。

The schema of the Open vSwitch database is documented in [DB-SCHEMA]. This document specifies the protocol for interacting with that database for the purposes of managing and configuring Open vSwitch instances. The protocol specified in this document also provides means for discovering the schema in use, as described in Section 4.1.2.

开放式vSwitch数据库的模式记录在[DB-schema]中。本文档指定了与该数据库交互的协议,以便管理和配置打开的vSwitch实例。如第4.1.2节所述,本文件中规定的协议还提供了发现正在使用的模式的方法。

The OVSDB management protocol is intended to allow programmatic access to the Open vSwitch database as documented in [DB-SCHEMA]. This database holds the configuration for one Open vSwitch daemon. As currently defined, this information describes the switching behavior of a virtual switch and does not describe the behavior or configuration of a routing system. In the event that the schema is extended in a future release to cover elements of the routing system, implementers and operators need to be aware of the work of the IETF's I2RS working group that specifies protocols and data models for real-time or event driven interaction with the routing system.

OVSDB管理协议旨在允许对[DB-SCHEMA]中记录的开放式vSwitch数据库进行编程访问。此数据库保存一个打开的vSwitch守护程序的配置。按照当前定义,此信息描述虚拟交换机的交换行为,而不描述路由系统的行为或配置。如果该模式在未来版本中扩展以涵盖路由系统的元素,则实施者和运营商需要了解IETF的I2RS工作组的工作,该工作组为与路由系统的实时或事件驱动交互指定协议和数据模型。

1.1. Requirements Language
1.1. 需求语言

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119].

本文件中的关键词“必须”、“不得”、“必需”、“应”、“不应”、“应”、“不应”、“建议”、“可”和“可选”应按照[RFC2119]中所述进行解释。

1.2. Terminology
1.2. 术语

UUID: Universally Unique Identifier. A 128-bit identifier that is unique in space and time [DCE].

UUID:通用唯一标识符。在空间和时间上唯一的128位标识符[DCE]。

OVS: Open vSwitch. An open-source virtual switch.

OVS:打开V开关。一个开源虚拟交换机。

OVSDB: The database that is used for the purpose of configuring OVS instances.

OVSDB:用于配置OVS实例的数据库。

JSON: Javascript Object Notation [RFC4627].

JSON:Javascript对象表示法[RFC4627]。

JSON-RPC: JSON Remote Procedure Call [JSON-RPC].

JSON-RPC:JSON远程过程调用[JSON-RPC]。

Durable: Reliably written to non-volatile storage (e.g., disk). OVSDB supports the option to specify whether or not transactions are durable.

持久:可靠地写入非易失性存储器(如磁盘)。OVSDB支持指定事务是否持久的选项。

Note that the JSON specification [RFC4627] provides precise definitions of a number of important terms such as JSON values, objects, arrays, numbers, and strings. In all cases, this document uses the definitions from [RFC4627].

请注意,JSON规范[RFC4627]提供了许多重要术语的精确定义,如JSON值、对象、数组、数字和字符串。在所有情况下,本文件均使用[RFC4627]中的定义。

2. System Overview
2. 系统概述

Figure 1 illustrates the main components of Open vSwitch and the interfaces to a control and management cluster. An OVS instance comprises a database server (ovsdb-server), a vswitch daemon (ovs-vswitchd), and, optionally, a module that performs fast-path forwarding. The "management and control cluster" consists of some number of managers and controllers. Managers use the OVSDB management protocol to manage OVS instances. An OVS instance is managed by at least one manager. Controllers use OpenFlow to install flow state in OpenFlow switches. An OVS instance can support multiple logical datapaths, referred to as "bridges". There is at least one controller for each OpenFlow bridge.

图1说明了Open vSwitch的主要组件以及与控制和管理集群的接口。OVS实例包括数据库服务器(ovsdb服务器)、vswitch守护进程(OVS vswitchd)和(可选)执行快速路径转发的模块。“管理和控制集群”由一些管理器和控制器组成。管理器使用OVSDB管理协议来管理OVS实例。OVS实例至少由一个管理器管理。控制器使用OpenFlow在OpenFlow开关中安装流状态。OVS实例可以支持多个逻辑数据路径,称为“网桥”。每个OpenFlow网桥至少有一个控制器。

The OVSDB management interface is used to perform management and configuration operations on the OVS instance. Compared to OpenFlow, OVSDB management operations occur on a relatively long timescale. Examples of operations that are supported by OVSDB include:

OVSDB管理接口用于对OVS实例执行管理和配置操作。与OpenFlow相比,OVSDB管理操作的发生时间相对较长。OVSDB支持的操作示例包括:

o Creation, modification, and deletion of OpenFlow datapaths (bridges), of which there may be many in a single OVS instance;

o 创建、修改和删除OpenFlow数据路径(网桥),单个OVS实例中可能有多个;

o Configuration of the set of controllers to which an OpenFlow datapath should connect;

o OpenFlow数据路径应连接到的控制器集的配置;

o Configuration of the set of managers to which the OVSDB server should connect;

o OVSDB服务器应连接到的一组管理器的配置;

o Creation, modification, and deletion of ports on OpenFlow datapaths;

o 在OpenFlow数据路径上创建、修改和删除端口;

o Creation, modification, and deletion of tunnel interfaces on OpenFlow datapaths;

o OpenFlow数据路径上隧道接口的创建、修改和删除;

o Creation, modification, and deletion of queues;

o 队列的创建、修改和删除;

o Configuration of QoS (quality of service) policies and attachment of those policies to queues; and

o 配置QoS(服务质量)策略并将这些策略附加到队列;和

o Collection of statistics.

o 统计数据的收集。

OVSDB does not perform per-flow operations, leaving those instead to OpenFlow.

OVSDB不执行每流操作,而是将这些操作留给OpenFlow。

          +----------------------+
          |      Control &       |
          |     Management       |
          |      Cluster         |
          +----------------------+
             |                \
             | OVSDB           \ OpenFlow
             | Mgmt             \
             |                   \
       +============================================+
       | +--------------+       +--------------+    |
       | |              |       |              |    |
       | | ovsdb-server |-------| ovs-vswitchd |    |
       | |              |       |              |    |
       | +--------------+       +--------------+    |
       |                               |            |
       |                        +----------------+  |
       |                        | Forwarding Path|  |
       |                        +----------------+  |
       +============================================+
        
          +----------------------+
          |      Control &       |
          |     Management       |
          |      Cluster         |
          +----------------------+
             |                \
             | OVSDB           \ OpenFlow
             | Mgmt             \
             |                   \
       +============================================+
       | +--------------+       +--------------+    |
       | |              |       |              |    |
       | | ovsdb-server |-------| ovs-vswitchd |    |
       | |              |       |              |    |
       | +--------------+       +--------------+    |
       |                               |            |
       |                        +----------------+  |
       |                        | Forwarding Path|  |
       |                        +----------------+  |
       +============================================+
        

Figure 1: Open vSwitch Interfaces

图1:打开的vSwitch接口

Further information about the usage of the OVSDB management protocol is provided in [DB-SCHEMA].

[DB-SCHEMA]中提供了有关OVSDB管理协议使用的更多信息。

3. OVSDB Structure
3. OVSDB结构

This section outlines the overall structure of databases in OVSDB. As described here, the database is reasonably generic. For the complete and current description of the database schema as used in OVS, refer to [DB-SCHEMA]. See also Section 4.1.2 for information on how the OVSDB management protocol may be used to discover the schema currently in use.

本节概述了OVSDB中数据库的总体结构。如本文所述,该数据库相当通用。有关OVS中使用的数据库模式的完整和当前描述,请参阅[DB-schema]。有关如何使用OVSDB管理协议发现当前使用的模式的信息,请参见第4.1.2节。

3.1. JSON Usage
3.1. JSON用法

OVSDB uses JSON [RFC4627] for both its schema format and its wire protocol format. The JSON implementation in Open vSwitch has the following limitations:

OVSDB使用JSON[RFC4627]作为其模式格式和有线协议格式。OpenVSwitch中的JSON实现有以下限制:

o Null bytes (\u0000) SHOULD NOT be used in strings.

o 字符串中不应使用空字节(\u0000)。

o Only UTF-8 encoding is supported.

o 仅支持UTF-8编码。

The descriptions below use the following shorthand notations for JSON values. Terminology follows [RFC4627].

下面的描述使用以下简写符号表示JSON值。术语如下[RFC4627]。

<string> A JSON string. Any Unicode string is allowed. Implementations SHOULD disallow null bytes.

<string>一个JSON字符串。允许使用任何Unicode字符串。实现应该不允许空字节。

<id> A JSON string matching [a-zA-Z_][a-zA-Z0-9_]*. <id>s that begin with _ are reserved to the implementation and MUST NOT be used by the user.

<id>与[A-zA-Z_][A-zA-Z0-9_]*匹配的JSON字符串<以u开头的id>s保留给实现,用户不得使用。

   <version>
      A JSON string that contains a version number that matches [0-9]+
      \.[0-9]+\.[0-9]+
        
   <version>
      A JSON string that contains a version number that matches [0-9]+
      \.[0-9]+\.[0-9]+
        

<boolean> A JSON true or false value.

<boolean>JSON真值或假值。

<number> A JSON number.

<number>一个JSON编号。

<integer> A JSON number with an integer value, within the range -(2**63)...+ (2**63)-1.

<integer>包含整数值的JSON编号,范围为-(2**63).+(2**63)-1。

<json-value> Any JSON value.

<json value>任何json值。

<nonnull-json-value> Any JSON value except null.

<nonnull json value>除null以外的任何json值。

<error> A JSON object with the following members:

<error>包含以下成员的JSON对象:

           "error": <string>          required
           "details": <string>        optional
        
           "error": <string>          required
           "details": <string>        optional
        

The value of the "error" member is a short string, specified in this document, that broadly indicates the class of the error. Most "error" strings are specific to contexts described elsewhere in this document, but the following "error" strings may appear in any context where an <error> is permitted:

“error”成员的值是一个短字符串,在本文档中指定,它大致指示错误的类别。大多数“错误”字符串特定于本文档其他地方描述的上下文,但以下“错误”字符串可能出现在允许<error>的任何上下文中:

      "error": "resources exhausted"
         The operation requires more resources (memory, disk, CPU, etc.)
         than are currently available to the database server.
        
      "error": "resources exhausted"
         The operation requires more resources (memory, disk, CPU, etc.)
         than are currently available to the database server.
        
      "error": "I/O error"
         Problems accessing the disk, network, or other required
         resources prevented the operation from completing.
        
      "error": "I/O error"
         Problems accessing the disk, network, or other required
         resources prevented the operation from completing.
        

Database implementations MAY use "error" strings not specified in this document to indicate errors that do not fit into any of the specified categories. Optionally, an <error> MAY include a "details" member, whose value is a string that describes the error in more detail for the benefit of a human user or administrator. This document does not specify the format or content of the "details" string. An <error> MAY also have other members that describe the error in more detail. This document does not specify the names or values of these members.

数据库实现可能会使用本文档中未指定的“错误”字符串来指示不属于任何指定类别的错误。可选地,<error>可以包括一个“details”成员,其值是一个字符串,该字符串为了用户或管理员的利益更详细地描述错误。本文档未指定“详细信息”字符串的格式或内容。<error>还可能有其他成员更详细地描述错误。本文档未指定这些成员的名称或值。

3.2. Schema Format
3.2. 模式格式

An Open vSwitch configuration database consists of a set of tables, each of which has a number of columns and zero or more rows. A schema for the database is represented by <database-schema>, as described below.

开放式vSwitch配置数据库由一组表组成,每个表都有许多列和零行或多行。数据库的模式由<database schema>表示,如下所述。

<database-schema> A JSON object with the following members:

<database schema>包含以下成员的JSON对象:

           "name": <id>                            required
           "version": <version>                    required
           "cksum": <string>                       optional
           "tables": {<id>: <table-schema>, ...}   required
        
           "name": <id>                            required
           "version": <version>                    required
           "cksum": <string>                       optional
           "tables": {<id>: <table-schema>, ...}   required
        

The "name" identifies the database as a whole. It must be provided to most JSON-RPC requests to identify the database being operated on.

“名称”将数据库标识为一个整体。它必须提供给大多数JSON-RPC请求,以标识正在操作的数据库。

The "version" reports the version of the database schema. It is REQUIRED to be present. Open vSwitch semantics for "version" are described in [DB-SCHEMA]. Other schemas may use it differently.

“版本”报告数据库架构的版本。必须在场。[DB-SCHEMA]中描述了“版本”的开放vSwitch语义。其他模式可能会以不同的方式使用它。

The "cksum" optionally reports an implementation-defined checksum for the database schema. Its use is primarily as a tool for schema developers, and clients SHOULD ignore it.

“校验和”可以选择报告数据库模式的实现定义的校验和。它的使用主要是作为模式开发人员的工具,客户端应该忽略它。

The value of "tables" is a JSON object whose names are table names and whose values are <table-schema>s.

“tables”的值是一个JSON对象,其名称为table name,值为<table schema>s。

<table-schema> A JSON object with the following members:

<table schema>包含以下成员的JSON对象:

         "columns": {<id>: <column-schema>, ...}   required
         "maxRows": <integer>                      optional
         "isRoot": <boolean>                       optional
         "indexes": [<column-set>*]                optional
        
         "columns": {<id>: <column-schema>, ...}   required
         "maxRows": <integer>                      optional
         "isRoot": <boolean>                       optional
         "indexes": [<column-set>*]                optional
        

The value of "columns" is a JSON object whose names are column names and whose values are <column-schema>s.

“columns”的值是一个JSON对象,其名称为列名,值为<column schema>s。

Every table has the following columns whose definitions are not included in the schema:

每个表都有以下列,这些列的定义不包括在架构中:

"_uuid": This column, which contains exactly one UUID value, is initialized to a random value by the database engine when it creates a row. It is read-only, and its value never changes during the lifetime of a row.

“_uuid”:此列正好包含一个uuid值,数据库引擎在创建行时将其初始化为随机值。它是只读的,并且其值在行的生存期内不会更改。

"_version": Like "_uuid", this column contains exactly one UUID value, initialized to a random value by the database engine when it creates a row, and it is read-only. However, its value changes to a new random value whenever any other field in the row changes. Furthermore, its value is ephemeral: when the database is closed and reopened, or when the database process is stopped and then started again, each "_version" also changes to a new random value.

“_version”:与“_uuid”类似,此列仅包含一个uuid值,在创建行时由数据库引擎初始化为随机值,并且是只读的。但是,当行中的任何其他字段更改时,其值将更改为新的随机值。此外,它的值是短暂的:当数据库关闭并重新打开时,或者当数据库进程停止然后再次启动时,每个“\u版本”也会更改为一个新的随机值。

If "maxRows" is specified, as a positive integer, it limits the maximum number of rows that may be present in the table. This is a "deferred" constraint, enforced only at transaction commit time (see the "transact" request in Section 4.1.3). If "maxRows" is not specified, the size of the table is limited only by the resources available to the database server. "maxRows" constraints are enforced after unreferenced rows are deleted from tables with a false "isRoot".

如果将“maxRows”指定为正整数,则会限制表中可能存在的最大行数。这是一个“延迟”约束,仅在事务提交时强制执行(请参阅第4.1.3节中的“transact”请求)。如果未指定“maxRows”,则表的大小仅受数据库服务器可用资源的限制。“maxRows”约束是在使用假“isRoot”从表中删除未引用的行之后强制执行的。

The "isRoot" boolean is used to determine whether rows in the table require strong references from other rows to avoid garbage collection. (See the discussion of "strong" and "weak" references below in the description of <base-type>.) If "isRoot" is

“isRoot”布尔值用于确定表中的行是否需要来自其他行的强引用以避免垃圾收集。(请参见下面<base type>描述中关于“强”和“弱”引用的讨论)如果“isRoot”是

specified as true, then rows in the table exist independent of any references (they can be thought of as part of the "root set" in a garbage collector). If "isRoot" is omitted or specified as false, then any given row in the table may exist only when there is at least one reference to it, with refType "strong", from a different row (in the same table or a different table). This is a "deferred" action: unreferenced rows in the table are deleted just before transaction commit.

指定为true,则表中的行独立于任何引用而存在(可以将它们视为垃圾收集器中“根集”的一部分)。如果省略“isRoot”或将其指定为false,则表中的任何给定行只有在至少有一个引用来自不同行(在同一个表或不同的表中)且refType为“strong”时才可能存在。这是一个“延迟”操作:在事务提交之前删除表中未引用的行。

For compatibility with schemas created before "isRoot" was introduced, if "isRoot" is omitted or false in every <table-schema> in a given <database-schema>, then every table is part of the root set.

为了与引入“isRoot”之前创建的模式兼容,如果在给定的<database schema>中的每个<table schema>中省略了“isRoot”或为false,则每个表都是根集的一部分。

If "indexes" is specified, it must be an array of zero or more <column-set>s. A <column-set> is an array of one or more strings, each of which names a column. Each <column-set> is a set of columns whose values, taken together within any given row, must be unique within the table. This is a "deferred" constraint, enforced only at transaction commit time, after unreferenced rows are deleted and dangling weak references are removed. Ephemeral columns may not be part of indexes.

如果指定了“索引”,则它必须是零个或多个<column set>s的数组。<columnset>是一个由一个或多个字符串组成的数组,每个字符串命名一个列。每个<column set>都是一组列,其值在任何给定行中都必须是表中唯一的。这是一个“延迟”约束,只有在事务提交时,在删除未引用的行并删除悬挂的弱引用之后才强制执行。临时列可能不是索引的一部分。

<column-schema> A JSON object with the following members:

<column schema>包含以下成员的JSON对象:

         "type": <type>                            required
         "ephemeral": <boolean>                    optional
         "mutable": <boolean>                      optional
        
         "type": <type>                            required
         "ephemeral": <boolean>                    optional
         "mutable": <boolean>                      optional
        

The "type" specifies the type of data stored in this column.

“类型”指定存储在此列中的数据类型。

If "ephemeral" is specified as true, then this column's values are not guaranteed to be durable; they may be lost when the database restarts. A column whose type (either key or value) is a strong reference to a table that is not part of the root set is always durable, regardless of this value. (Otherwise, restarting the database could lose entire rows.)

如果将“ephemeral”指定为true,则不保证此列的值是持久的;当数据库重新启动时,它们可能会丢失。类型(键或值)是对不属于根集的表的强引用的列始终是持久的,而不管此值如何。(否则,重新启动数据库可能会丢失整行。)

If "mutable" is specified as false, then this column's values may not be modified after they are initially set with the "insert" operation.

如果将“mutable”指定为false,则在最初使用“insert”操作设置此列的值后,不能修改这些值。

<type> The type of a database column. Either an <atomic-type> or a JSON object that describes the type of a database column, with the following members:

<type>数据库列的类型。<atomic type>或描述数据库列类型的JSON对象,包含以下成员:

         "key": <base-type>                 required
         "value": <base-type>               optional
         "min": <integer>                   optional
         "max": <integer> or "unlimited"    optional
        
         "key": <base-type>                 required
         "value": <base-type>               optional
         "min": <integer>                   optional
         "max": <integer> or "unlimited"    optional
        

If "min" or "max" is not specified, each defaults to 1. If "max" is specified as "unlimited", then there is no specified maximum number of elements, although the implementation will enforce some limit. After considering defaults, "min" must be exactly 0 or exactly 1, "max" must be at least 1, and "max" must be greater than or equal to "min".

如果未指定“最小”或“最大”,则每个默认值为1。如果将“max”指定为“unlimited”,则没有指定元素的最大数量,尽管实现将强制执行一些限制。在考虑默认值后,“最小值”必须正好为0或正好为1,“最大值”必须至少为1,“最大值”必须大于或等于“最小值”。

If "min" and "max" are both 1 and "value" is not specified, the type is the scalar type specified by "key".

如果“min”和“max”均为1且未指定“value”,则类型为“key”指定的标量类型。

If "min" is not 1 or "max" is not 1, or both, and "value" is not specified, the type is a set of scalar type "key".

如果“min”不是1或“max”不是1,或两者都不是,并且未指定“value”,则该类型是一组标量类型“key”。

If "value" is specified, the type is a map from type "key" to type "value".

如果指定了“值”,则类型是从“键”类型到“值”类型的映射。

<base-type> The type of a key or value in a database column. Either an <atomic-type> or a JSON object with the following members:

<base type>数据库列中键或值的类型。<atomic type>或具有以下成员的JSON对象:

         "type": <atomic-type>            required
         "enum": <value>                  optional
         "minInteger": <integer>          optional, integers only
         "maxInteger": <integer>          optional, integers only
         "minReal": <real>                optional, reals only
         "maxReal": <real>                optional, reals only
         "minLength": <integer>           optional, strings only
         "maxLength": <integer>           optional, strings only
         "refTable": <id>                 optional, UUIDs only
         "refType": "strong" or "weak"    optional, only with "refTable"
        
         "type": <atomic-type>            required
         "enum": <value>                  optional
         "minInteger": <integer>          optional, integers only
         "maxInteger": <integer>          optional, integers only
         "minReal": <real>                optional, reals only
         "maxReal": <real>                optional, reals only
         "minLength": <integer>           optional, strings only
         "maxLength": <integer>           optional, strings only
         "refTable": <id>                 optional, UUIDs only
         "refType": "strong" or "weak"    optional, only with "refTable"
        

An <atomic-type> by itself is equivalent to a JSON object with a single member "type" whose value is the <atomic-type>.

<atomic type>本身就相当于一个JSON对象,它有一个成员“type”,其值是<atomic type>。

"enum" may be specified as a <value> whose type is a set of one or more values specified for the member "type". If "enum" is specified, then the valid values of the <base-type> are limited to those in the <value>.

“enum”可以指定为<value>,其类型是为成员“type”指定的一个或多个值的集合。如果指定了“enum”,则<base type>的有效值仅限于<value>中的值。

"enum" is mutually exclusive with the following constraints:

“枚举”与以下约束条件相互排斥:

If "type" is "integer", then "minInteger" or "maxInteger" or both may also be specified, restricting the valid integer range. If both are specified, then "maxInteger" must be greater than or equal to "minInteger".

如果“type”为“integer”,则还可以指定“minInteger”或“maxInteger”或两者,从而限制有效的整数范围。如果两者都指定,则“maxInteger”必须大于或等于“minInteger”。

If "type" is "real", then "minReal" or "maxReal" or both may also be specified, restricting the valid real range. If both are specified, then "maxReal" must be greater than or equal to "minReal".

如果“type”为“real”,则还可以指定“minReal”或“maxReal”或两者,从而限制有效的实数范围。如果两者都指定,则“maxReal”必须大于或等于“minReal”。

If "type" is "string", then "minLength" and "maxLength" or both may be specified, restricting the valid length of value strings. If both are specified, then "maxLength" must be greater than or equal to "minLength". String length is measured in characters.

如果“type”是“string”,则可以指定“minLength”和“maxLength”或两者,从而限制值字符串的有效长度。如果两者都指定,则“maxLength”必须大于或等于“minLength”。字符串长度以字符为单位。

If "type" is "uuid", then "refTable", if present, must be the name of a table within this database. If "refTable" is specified, then "refType" may also be specified. If "refTable" is set, the effect depends on "refType":

如果“type”是“uuid”,那么“refTable”(如果存在)必须是该数据库中的表名。如果指定了“refTable”,则也可以指定“refType”。如果设置了“refTable”,则效果取决于“refType”:

+ If "refType" is "strong" or if "refType" is omitted, the allowed UUIDs are limited to UUIDs for rows in the named table.

+ 如果“refType”为“strong”或省略了“refType”,则允许的UUID仅限于命名表中行的UUID。

+ If "refType" is "weak", then any UUIDs are allowed, but UUIDs that do not correspond to rows in the named table will be automatically deleted. When this situation arises in a map, both the key and the value will be deleted from the map.

+ 如果“refType”为“弱”,则允许任何UUID,但与命名表中的行不对应的UUID将自动删除。当映射中出现这种情况时,键和值都将从映射中删除。

"refTable" constraints are "deferred" constraints: they are enforced only at transaction commit time (see the "transact" request in Section 4.1.3). The other constraints on <base-type> are "immediate", enforced immediately by each operation.

“refTable”约束是“延迟”约束:它们仅在事务提交时强制执行(请参阅第4.1.3节中的“transact”请求)。<base type>上的其他约束是“立即的”,由每个操作立即执行。

<atomic-type> One of the strings "integer", "real", "boolean", "string", or "uuid", representing the specified scalar type.

<atomic type>字符串“integer”、“real”、“boolean”、“string”或“uuid”之一,表示指定的标量类型。

4. Wire Protocol
4. 有线协议

The database wire protocol is implemented in JSON-RPC 1.0 [JSON-RPC]. While the JSON-RPC specification allows a range of transports, implementations of this specification SHOULD operate directly over TCP. See Section 6 for discussion of the TCP port.

数据库连接协议在JSON-RPC 1.0[JSON-RPC]中实现。虽然JSON-RPC规范允许一系列传输,但该规范的实现应该直接通过TCP进行操作。有关TCP端口的讨论,请参见第6节。

4.1. RPC Methods
4.1. RPC方法

The following subsections describe the RPC methods that are supported. As described in the JSON-RPC 1.0 specification, each request comprises a string containing the name of the method, a (possibly null) array of parameters to pass to the method, and a request ID, which can be used to match the response to the request. Each response comprises a result object (non-null in the event of a successful invocation), an error object (non-null in the event of an error), and the ID of the matching request. More details on each method, its parameters, and its results are described below.

以下小节描述了支持的RPC方法。如JSON-RPC 1.0规范所述,每个请求都包含一个字符串,其中包含方法名称、要传递给方法的参数数组(可能为null)和一个请求ID,该ID可用于匹配对请求的响应。每个响应包括一个结果对象(成功调用时为非null)、一个错误对象(出错时为非null)和匹配请求的ID。关于每种方法、其参数和结果的更多细节如下所述。

An OVSDB server MUST implement all of the following methods. An OVSDB client MUST implement the "Echo" method and is otherwise free to implement whichever methods suit the implementation's needs.

OVSDB服务器必须实现以下所有方法。OVSDB客户端必须实现“Echo”方法,否则可以自由地实现任何适合实现需要的方法。

The operations that may be performed on the OVS database using these methods (e.g., the "transact" method) are described in Section 5.

可使用这些方法(例如“transact”方法)在OVS数据库上执行的操作在第5节中进行了描述。

4.1.1. List Databases
4.1.1. 列出数据库

This operation retrieves an array whose elements are the names of the databases that can be accessed over this management protocol connection.

此操作检索一个数组,其元素是可通过此管理协议连接访问的数据库的名称。

The request object contains the following members:

请求对象包含以下成员:

   o  "method": "list_dbs"
        
   o  "method": "list_dbs"
        
   o  "params": []
        
   o  "params": []
        
   o  "id": <nonnull-json-value>
        
   o  "id": <nonnull-json-value>
        

The response object contains the following members:

响应对象包含以下成员:

   o  "result": [<db-name>,...]
        
   o  "result": [<db-name>,...]
        

o "error": null

o “错误”:空

o "id": same "id" as request

o “id”:与请求相同的“id”

4.1.2. Get Schema
4.1.2. 获取模式

This operation retrieves a <database-schema> that describes hosted database <db-name>.

此操作检索描述托管数据库<db name>的<database schema>。

The request object contains the following members:

请求对象包含以下成员:

   o  "method": "get_schema"
        
   o  "method": "get_schema"
        
   o  "params": [<db-name>]
        
   o  "params": [<db-name>]
        
   o  "id": <nonnull-json-value>
        
   o  "id": <nonnull-json-value>
        

The response object contains the following members:

响应对象包含以下成员:

   o  "result": <database-schema>
        
   o  "result": <database-schema>
        

o "error": null

o “错误”:空

o "id": same "id" as request

o “id”:与请求相同的“id”

In the event that the database named in the request does not exist, the server sends a JSON-RPC error response of the following form:

如果请求中命名的数据库不存在,服务器将发送以下形式的JSON-RPC错误响应:

o "result": null

o “结果”:空

   o  "error": "unknown database"
        
   o  "error": "unknown database"
        

o "id": same "id" as request

o “id”:与请求相同的“id”

4.1.3. Transact
4.1.3. 做交易

This RPC method causes the database server to execute a series of operations in the specified order on a given database.

此RPC方法使数据库服务器在给定数据库上按指定顺序执行一系列操作。

The request object contains the following members:

请求对象包含以下成员:

   o  "method": "transact"
        
   o  "method": "transact"
        
   o  "params": [<db-name>, <operation>*]
        
   o  "params": [<db-name>, <operation>*]
        
   o  "id": <nonnull-json-value>
        
   o  "id": <nonnull-json-value>
        

The value of "id" MUST be unique among all in-flight transactions within the current JSON-RPC session. Otherwise, the server may return a JSON-RPC error.

“id”的值在当前JSON-RPC会话中的所有正在进行的事务中必须是唯一的。否则,服务器可能返回JSON-RPC错误。

The "params" array for this method consists of a <db-name> that identifies the database to which the transaction applies, followed by zero or more JSON objects, each of which represents a single database operation. Section 5 describes the valid operations. The database server executes each of the specified operations in the specified order, except if an operation fails, then the remaining operations are not executed. The set of operations is executed as a single atomic, consistent, isolated transaction. The transaction is committed if and only if every operation succeeds. Durability of the commit is not guaranteed unless the "commit" operation, with "durable" set to true, is included in the operation set. See Section 5 for more discussion of the database operations.

此方法的“params”数组由一个标识事务所应用的数据库的<db name>组成,后跟零个或多个JSON对象,每个对象表示一个数据库操作。第5节描述了有效的操作。数据库服务器按照指定的顺序执行每个指定的操作,除非某个操作失败,否则将不执行其余的操作。操作集作为单个原子、一致、独立的事务执行。当且仅当每个操作都成功时才提交事务。除非操作集中包含“提交”操作(将“持久”设置为true),否则提交的持久性不受保证。有关数据库操作的更多讨论,请参见第5节。

The response object contains the following members:

响应对象包含以下成员:

   o  "result": [<object>*]
        
   o  "result": [<object>*]
        

o "error": null

o “错误”:空

o "id": same "id" as request

o “id”:与请求相同的“id”

Regardless of whether errors occur in the database operations, the response is always a JSON-RPC response with null "error" and a "result" member that is an array with the same number of elements as "params". Each element of the "result" array corresponds to the same element of the "params" array. The "result" array elements may be interpreted as follows:

无论数据库操作中是否发生错误,响应始终是一个JSON-RPC响应,带有null“error”和一个“result”成员,该成员是一个与“params”元素数相同的数组。“result”数组的每个元素对应于“params”数组的相同元素。“结果”数组元素可解释如下:

o A JSON object that does not contain an "error" member indicates that the operation completed successfully. The specific members of the object are specified below in the descriptions of individual operations. Some operations do not produce any results, in which case the object will have no members.

o 不包含“error”成员的JSON对象表示操作已成功完成。对象的特定成员在下面的各个操作说明中指定。某些操作不会产生任何结果,在这种情况下,对象将没有成员。

o An <error> indicates that the matching operation completed with an error.

o <error>表示匹配操作已完成,但出现错误。

o A JSON null value indicates that the operation was not attempted because a prior operation failed.

o JSON null值表示由于先前的操作失败而未尝试该操作。

In general, "result" contains some number of successful results, possibly followed by an error, in turn followed by enough JSON null values to match the number of elements in "params". There is one exception: if all of the operations succeed, but the results cannot be committed, then "result" will have one more element than "params", with the additional element being an <error>. In this case, the possible "error" strings include the following:

通常,“result”包含一定数量的成功结果,可能后跟一个错误,然后是足够的JSON空值,以匹配“params”中的元素数量。有一个例外:如果所有操作都成功,但结果无法提交,那么“result”将比“params”多出一个元素,另外一个元素是<error>。在这种情况下,可能的“错误”字符串包括以下内容:

   "error": "referential integrity violation"
      When the commit was attempted, a column's value referenced the
      UUID for a row that did not exist in the table named by the
      column's <base-type> key or value "refTable" that has a "refType"
      of "strong".  (This can be caused by inserting a row that
      references a nonexistent row, by deleting a row that is still
      referenced by another row, by specifying the UUID for a row in the
      wrong table, and other ways.)
        
   "error": "referential integrity violation"
      When the commit was attempted, a column's value referenced the
      UUID for a row that did not exist in the table named by the
      column's <base-type> key or value "refTable" that has a "refType"
      of "strong".  (This can be caused by inserting a row that
      references a nonexistent row, by deleting a row that is still
      referenced by another row, by specifying the UUID for a row in the
      wrong table, and other ways.)
        
   "error": "constraint violation"
      A number of situations can arise in which the attempted commit
      would lead to a constraint on the database being violated.  (See
      Section 3.2 for more discussion of constraints.)  These situations
      include:
        
   "error": "constraint violation"
      A number of situations can arise in which the attempted commit
      would lead to a constraint on the database being violated.  (See
      Section 3.2 for more discussion of constraints.)  These situations
      include:
        

* The number of rows in a table exceeds the maximum number permitted by the table's "maxRows" value.

* 表中的行数超过了表的“maxRows”值允许的最大行数。

* Two or more rows in a table had the same values in the columns that comprise an index.

* 表中的两行或多行在构成索引的列中具有相同的值。

* A column with a <base-type> key or value "refTable" whose "refType" is "weak" became empty due to deletion(s), and this column is not allowed to be empty because its <type> has a "min" of 1. Such deletions may be the result of rows that it referenced being deleted (or never having existed, if the column's row was inserted within the transaction).

* 具有<base type>键或值“refTable”且其“refType”为“弱”的列由于删除而变为空,并且此列不允许为空,因为其<type>的“min”为1。这样的删除可能是由于它引用的行被删除(或者如果列的行被插入到事务中,则从未存在过)。

   "error": "resources exhausted"
      The operation requires more resources (memory, disk, CPU, etc.)
      than are currently available to the database server.
        
   "error": "resources exhausted"
      The operation requires more resources (memory, disk, CPU, etc.)
      than are currently available to the database server.
        
   "error": "I/O error"
      Problems accessing the disk, network, or other required resources
      prevented the operation from completing.
        
   "error": "I/O error"
      Problems accessing the disk, network, or other required resources
      prevented the operation from completing.
        

If "params" contains one or more "wait" operations, then the transaction may take an arbitrary amount of time to complete. The database implementation MUST be capable of accepting, executing, and replying to other transactions and other JSON-RPC requests while a transaction or transactions containing "wait" operations are outstanding on the same or different JSON-RPC sessions.

如果“params”包含一个或多个“wait”操作,则事务可能需要任意时间才能完成。当包含“等待”操作的一个或多个事务在相同或不同的JSON-RPC会话上未完成时,数据库实现必须能够接受、执行和回复其他事务和其他JSON-RPC请求。

4.1.4. Cancel
4.1.4. 取消

The "cancel" method is a JSON-RPC notification, i.e., no matching response is provided. It instructs the database server to immediately complete or cancel the "transact" request whose "id" is the same as the notification's "params" value. The notification object has the following members:

“cancel”方法是JSON-RPC通知,即不提供匹配响应。它指示数据库服务器立即完成或取消“transact”请求,该请求的“id”与通知的“params”值相同。通知对象具有以下成员:

   o  "method": "cancel"
        
   o  "method": "cancel"
        
   o  "params": [the "id" for an outstanding request]
        
   o  "params": [the "id" for an outstanding request]
        

o "id": null

o “id”:空

If the "transact" request can be completed immediately, then the server sends a response in the form described for "transact" (Section 4.1.3). Otherwise, the server sends a JSON-RPC error response of the following form:

如果可以立即完成“transact”请求,则服务器将以“transact”所述的形式发送响应(第4.1.3节)。否则,服务器将发送以下形式的JSON-RPC错误响应:

o "result": null

o “结果”:空

   o  "error": "canceled"
        
   o  "error": "canceled"
        

o "id": the "id" member of the canceled request.

o “id”:已取消请求的“id”成员。

The "cancel" notification itself has no reply.

“取消”通知本身没有答复。

4.1.5. Monitor
4.1.5. 班长

The "monitor" request enables a client to replicate tables or subsets of tables within an OVSDB database by requesting notifications of changes to those tables and by receiving the complete initial state of a table or a subset of a table. The request object has the following members:

“监视”请求使客户机能够通过请求表的更改通知和接收表或表子集的完整初始状态,在OVSDB数据库中复制表或表子集。请求对象具有以下成员:

   o  "method": "monitor"
        
   o  "method": "monitor"
        
   o  "params": [<db-name>, <json-value>, <monitor-requests>]
        
   o  "params": [<db-name>, <json-value>, <monitor-requests>]
        
   o  "id": <nonnull-json-value>
        
   o  "id": <nonnull-json-value>
        

The <json-value> parameter is used to match subsequent update notifications (see below) to this request. The <monitor-requests> object maps the name of the table to be monitored to an array of <monitor-request> objects.

<json value>参数用于将后续更新通知(见下文)与此请求相匹配。<monitor requests>对象将要监视的表的名称映射到一个<monitor request>对象数组。

Each <monitor-request> is an object with the following members:

每个<monitor request>都是具有以下成员的对象:

       "columns": [<column>*]            optional
       "select": <monitor-select>        optional
        
       "columns": [<column>*]            optional
       "select": <monitor-select>        optional
        

The columns, if present, define the columns within the table to be monitored. <monitor-select> is an object with the following members:

列(如果存在)定义要监视的表中的列<monitor select>是具有以下成员的对象:

       "initial": <boolean>              optional
       "insert": <boolean>               optional
       "delete": <boolean>               optional
       "modify": <boolean>               optional
        
       "initial": <boolean>              optional
       "insert": <boolean>               optional
       "delete": <boolean>               optional
       "modify": <boolean>               optional
        

The contents of this object specify how the columns or table are to be monitored, as explained in more detail below.

此对象的内容指定如何监视列或表,如下所述。

The response object has the following members:

响应对象具有以下成员:

   o  "result": <table-updates>
        
   o  "result": <table-updates>
        

o "error": null

o “错误”:空

o "id": same "id" as request

o “id”:与请求相同的“id”

The <table-updates> object is described in detail in Section 4.1.6. It contains the contents of the tables for which "initial" rows are selected. If no tables' initial contents are requested, then "result" is an empty object.

第4.1.6节详细描述了<table updates>对象。它包含为其选择“初始”行的表的内容。如果没有请求表的初始内容,则“result”是一个空对象。

Subsequently, when changes to the specified tables are committed, the changes are automatically sent to the client using the "update" monitor notification (see Section 4.1.6). This monitoring persists until the JSON-RPC session terminates or until the client sends a "monitor_cancel" JSON-RPC request.

随后,当提交对指定表的更改时,使用“更新”监视器通知将更改自动发送给客户端(见第4.1.6节)。此监视将一直持续,直到JSON-RPC会话终止或客户端发送“monitor_cancel”JSON-RPC请求。

Each <monitor-request> specifies one or more columns and the manner in which the columns (or the entire table) are to be monitored. The "columns" member specifies the columns whose values are monitored. It MUST NOT contain duplicates. If "columns" is omitted, all columns in the table, except for "_uuid", are monitored. The circumstances in which an "update" notification is sent for a row within the table are determined by <monitor-select>:

每个<monitor request>指定一个或多个列以及监视这些列(或整个表)的方式。“columns”成员指定监视其值的列。它不能包含重复项。如果省略“columns”,则会监视表中除“_uuid”之外的所有列。为表中的某一行发送“更新”通知的情况由<monitor select>确定:

o If "initial" is omitted or true, every row in the table is sent as part of the response to the "monitor" request.

o 如果省略“initial”或为true,则表中的每一行都将作为对“monitor”请求的响应的一部分发送。

o If "insert" is omitted or true, "update" notifications are sent for rows newly inserted into the table.

o 如果省略“insert”或为true,则会为新插入到表中的行发送“update”通知。

o If "delete" is omitted or true, "update" notifications are sent for rows deleted from the table.

o 如果省略“delete”或为true,则会为从表中删除的行发送“update”通知。

o If "modify" is omitted or true, "update" notifications are sent whenever a row in the table is modified.

o 如果省略“modify”或为true,则每当修改表中的行时,都会发送“update”通知。

If there is more than one <monitor-request> in an array, then each <monitor-request> in the array should specify both "columns" and "select", and the "columns" MUST be non-overlapping sets.

如果一个数组中有多个<monitor request>,那么数组中的每个<monitor request>都应该指定“columns”和“select”,并且“columns”必须是非重叠集。

4.1.6. Update Notification
4.1.6. 更新通知

The "update" notification is sent by the server to the client to report changes in tables that are being monitored following a "monitor" request as described above. The notification has the following members:

“更新”通知由服务器发送到客户端,以报告在上述“监视”请求之后正在监视的表中的更改。通知有以下成员:

   o  "method": "update"
        
   o  "method": "update"
        
   o  "params": [<json-value>, <table-updates>]
        
   o  "params": [<json-value>, <table-updates>]
        

o "id": null

o “id”:空

The <json-value> in "params" is the same as the value passed as the <json-value> in "params" for the corresponding "monitor" request. <table-updates> is an object that maps from a table name to a <table-update>. A <table-update> is an object that maps from the row's UUID to a <row-update> object. A <row-update> is an object with the following members:

“params”中的<json value>与对应的“monitor”请求在“params”中作为<json value>传递的值相同<table updates>是一个从表名映射到<table update>的对象。<table update>是从行的UUID映射到<row update>对象的对象。<row update>是具有以下成员的对象:

    "old": <row>   present for "delete" and "modify" updates
    "new": <row>   present for "initial", "insert", and "modify" updates
        
    "old": <row>   present for "delete" and "modify" updates
    "new": <row>   present for "initial", "insert", and "modify" updates
        

The format of <row> is described in Section 5.1.

第5.1节描述了<row>的格式。

Each table in which one or more rows has changed (or whose initial view is being presented) is represented in <table-updates>. Each row that has changed (or whose initial view is being presented) is represented in its <table-update> as a member with its name taken from the row's "_uuid" member. The corresponding value is a <row-update>:

其中一行或多行已更改(或显示其初始视图)的每个表都在<table updates>中表示。已更改(或其初始视图正在显示)的每一行在其<table update>中表示为一个成员,其名称取自该行的“_uuid”成员。相应的值是<row update>:

o The "old" member is present for "delete" and "modify" updates. For "delete" updates, each monitored column is included. For "modify" updates, the prior value of each monitored column whose value has changed is included (monitored columns that have not changed are represented in "new").

o “旧”成员将出现以进行“删除”和“修改”更新。对于“删除”更新,将包括每个受监控列。对于“修改”更新,包括值已更改的每个受监控列的先前值(未更改的受监控列在“新建”中表示)。

o The "new" member is present for "initial", "insert", and "modify" updates. For "initial" and "insert" updates, each monitored column is included. For "modify" updates, the new value of each monitored column is included.

o “新”成员用于“初始”、“插入”和“修改”更新。对于“初始”和“插入”更新,每个受监控列都包括在内。对于“修改”更新,将包括每个受监控列的新值。

Note that initial views of rows are not presented in update notifications, but in the response object to the monitor request. The formatting of the <table-updates> object, however, is the same in either case.

请注意,行的初始视图不会显示在更新通知中,而是显示在监视器请求的响应对象中。然而,<table updates>对象的格式在两种情况下都是相同的。

4.1.7. Monitor Cancellation
4.1.7. 监视器取消

The "monitor_cancel" request cancels a previously issued monitor request. The request object members are:

“监视器取消”请求取消以前发出的监视器请求。请求对象成员包括:

   o  "method": "monitor_cancel"
        
   o  "method": "monitor_cancel"
        
   o  "params": [<json-value>]
        
   o  "params": [<json-value>]
        
   o  "id": <nonnull-json-value>
        
   o  "id": <nonnull-json-value>
        

The <json-value> in "params" matches the <json-value> in "params" for the ongoing "monitor" request that is to be canceled. No more "update" messages will be sent for this table monitor. The response to this request has the following members:

“params”中的<json value>与要取消的正在进行的“monitor”请求的“params”中的<json value>相匹配。将不再为此表监视器发送任何“更新”消息。对这一请求的答复有以下成员:

   o  "result": {}
        
   o  "result": {}
        

o "error": null

o “错误”:空

o "id": the request "id" member

o “id”:请求“id”成员

In the event that a monitor cancellation request refers to an unknown monitor request, an error response with the following members is returned:

如果监视器取消请求引用未知监视器请求,则返回具有以下成员的错误响应:

o "result": null

o “结果”:空

   o  "error": "unknown monitor"
        
   o  "error": "unknown monitor"
        

o "id": the request "id" member

o “id”:请求“id”成员

4.1.8. Lock Operations
4.1.8. 锁定操作

Three RPC methods, "lock", "steal", and "unlock", provide support to clients to perform locking operations on the database. The database server supports an arbitrary number of locks, each of which is identified by a client-defined ID. At any given time, each lock may

三种RPC方法“lock”、“steal”和“unlock”为客户端提供对数据库执行锁定操作的支持。数据库服务器支持任意数量的锁,每个锁都由客户端定义的ID标识。在任何给定时间,每个锁都可以

have at most one owner. The precise usage of a lock is determined by the client. For example, a set of clients may agree that a certain table can only be written by the owner of a certain lock. OVSDB itself does not enforce any restrictions on how locks are used -- it simply ensures that a lock has at most one owner.

最多有一个所有者。锁的确切用法由客户端决定。例如,一组客户端可能同意某个表只能由某个锁的所有者写入。OVSDB本身并没有对锁的使用方式实施任何限制——它只是确保一个锁最多有一个所有者。

The RPC request objects have the following members:

RPC请求对象具有以下成员:

   o  "method": "lock", "steal", or "unlock"
        
   o  "method": "lock", "steal", or "unlock"
        
   o  "params": [<id>]
        
   o  "params": [<id>]
        
   o  "id": <nonnull-json-value>
        
   o  "id": <nonnull-json-value>
        

The response depends on the request and has the following members:

响应取决于请求,由以下成员组成:

   o  "result": {"locked": boolean} for "lock"
        
   o  "result": {"locked": boolean} for "lock"
        
   o  "result": {"locked": true} for "steal"
        
   o  "result": {"locked": true} for "steal"
        
   o  "result": {} for "unlock"
        
   o  "result": {} for "unlock"
        

o "error": null

o “错误”:空

o "id": same "id" as request

o “id”:与请求相同的“id”

The three methods operate as follows:

这三种方法的操作如下:

o "lock": The database will assign this client ownership of the lock as soon as it becomes available. When multiple clients request the same lock, they will receive it in first-come, first-served order.

o “锁”:一旦锁可用,数据库将分配该客户端对锁的所有权。当多个客户端请求相同的锁时,它们将以先到先得的顺序接收该锁。

o "steal": The database immediately assigns this client ownership of the lock. If there is an existing owner, it loses ownership.

o “steal”:数据库会立即分配该客户机对锁的所有权。如果存在现有所有者,它将失去所有权。

o "unlock": If the client owns the lock, this operation releases it. If the client has requested ownership of the lock, this cancels the request.

o “解锁”:如果客户端拥有锁,此操作将释放锁。如果客户端已请求锁的所有权,则会取消该请求。

(Closing or otherwise disconnecting a database client connection unlocks all of its locks.)

(关闭或断开数据库客户端连接将解锁其所有锁。)

For any given lock, the client MUST alternate "lock" or "steal" operations with "unlock" operations. That is, if the previous operation on a lock was "lock" or "steal", it MUST be followed by an "unlock" operation, and vice versa.

对于任何给定的锁,客户端必须将“锁定”或“窃取”操作替换为“解锁”操作。也就是说,如果锁上的前一个操作是“锁定”或“窃取”,那么它后面必须跟着“解锁”操作,反之亦然。

For a "lock" operation, the "locked" member in the response object is true if the lock has already been acquired and false if another client holds the lock and the client's request for it was queued. In the latter case, the client will be notified later with a "locked" message (Section 4.1.9) when acquisition succeeds.

对于“锁定”操作,如果已获取锁,则响应对象中的“锁定”成员为true;如果另一个客户端持有该锁并且客户端对该锁的请求已排队,则为false。在后一种情况下,当采集成功时,将向客户发送“锁定”消息(第4.1.9节)。

These requests complete and send a response quickly, without waiting. The "locked" and "stolen" notifications (see below) report asynchronous changes to ownership.

这些请求完成并快速发送响应,无需等待。“锁定”和“被盗”通知(见下文)报告所有权的异步更改。

   Note that the scope of a lock is a database server, not a database
   hosted by that server.  A client may choose to implement a naming
   convention, such as "<db-name>__<lock-name>", which can effectively
   limit the scope of a lock to a particular database.
        
   Note that the scope of a lock is a database server, not a database
   hosted by that server.  A client may choose to implement a naming
   convention, such as "<db-name>__<lock-name>", which can effectively
   limit the scope of a lock to a particular database.
        
4.1.9. Locked Notification
4.1.9. 锁定通知

The "locked" notification is provided to notify a client that it has been granted a lock that it had previously requested with the "lock" method described above. The notification has the following members:

提供“锁定”通知是为了通知客户机已被授予其先前使用上述“锁定”方法请求的锁定。通知有以下成员:

   o  "method": "locked"
        
   o  "method": "locked"
        
   o  "params": [<id>]
        
   o  "params": [<id>]
        

o "id": null

o “id”:空

"Params" contains the name of the lock that was given in the "lock" request. The notified client now owns the lock named in "params".

“Params”包含“lock”请求中给定的锁的名称。通知的客户端现在拥有名为“params”的锁。

The database server sends this notification after the reply to the corresponding "lock" request (but only if the "locked" member of the response was false) and before the reply to the client's subsequent "unlock" request.

数据库服务器在响应相应的“锁定”请求之后(但仅当响应的“锁定”成员为false时)和响应客户端随后的“解锁”请求之前发送此通知。

4.1.10. Stolen Notification
4.1.10. 被盗通知

The "stolen" notification is provided to notify a client, which had previously obtained a lock, that another client has stolen ownership of that lock. The notification has the following members:

提供“被盗”通知是为了通知先前已获得锁的客户,另一客户已窃取该锁的所有权。通知有以下成员:

   o  "method": "stolen"
        
   o  "method": "stolen"
        
   o  "params": [<id>]
        
   o  "params": [<id>]
        

o "id": null

o “id”:空

The notified client no longer owns the lock named in "params". The client MUST still issue an "unlock" request before performing any subsequent "lock" or "steal" operation on the lock.

通知的客户端不再拥有“params”中命名的锁。在对锁执行任何后续“锁定”或“窃取”操作之前,客户端仍必须发出“解锁”请求。

If the client originally obtained the lock through a "lock" request, then it will automatically regain the lock later after the client that stole it releases it. (The database server will send the client a "locked" notification at that point to let it know.)

如果客户端最初通过“锁”请求获得锁,那么在窃取它的客户端释放锁后,它将自动重新获得锁。(数据库服务器将在此时向客户端发送一个“锁定”通知,让客户端知道。)

If the client originally obtained the lock through a "steal" request, the database server won't automatically reassign it ownership of the lock when it later becomes available. To regain ownership, the client must "unlock" and then "lock" or "steal" the lock again.

如果客户机最初通过“窃取”请求获得锁,则数据库服务器不会在以后可用时自动重新分配锁的所有权。要重新获得所有权,客户端必须先“解锁”,然后再“锁定”或“窃取”锁。

4.1.11. Echo
4.1.11. 回响

The "echo" method can be used by both clients and servers to verify the liveness of a database connection. It MUST be implemented by both clients and servers. The members of the request are:

客户端和服务器都可以使用“echo”方法来验证数据库连接的活动性。它必须由客户端和服务器实现。请求的成员是:

   o  "method": "echo"
        
   o  "method": "echo"
        

o "params": JSON array with any contents

o “params”:包含任何内容的JSON数组

   o  "id": <json-value>
        
   o  "id": <json-value>
        

The response object has the following members:

响应对象具有以下成员:

o "result": same as "params"

o “结果”:与“参数”相同

o "error": null

o “错误”:空

o "id": the request "id" member

o “id”:请求“id”成员

5. Database Operations
5. 数据库操作

This section describes the operations that may be specified in the "transact" method described in Section 4.1.3.

本节描述了第4.1.3节中描述的“transact”方法中可能指定的操作。

5.1. Notation
5.1. 符号

We introduce the following notation for the discussion of operations.

为了讨论操作,我们引入以下符号。

<db-name> An <id> that names a database. The valid <db-name>s can be obtained using a "list_dbs" request. The <db-name> is taken from the "name" member of <database-schema>.

<db name>为数据库命名的<id>。可以使用“list_dbs”请求获得有效的<db name>s。<db name>取自<database schema>的“name”成员。

<table> An <id> that names a table.

<table>命名表的<id>。

<column> An <id> that names a table column.

<column>为表列命名的<id>。

<row> A JSON object that describes a table row or a subset of a table row. Each member is the name of a table column paired with the <value> of that column.

<row>描述表行或表行子集的JSON对象。每个成员都是与该列的<value>成对的表列的名称。

<value> A JSON value that represents the value of a column in a table row, one of <atom>, <set>, or <map>.

<value>表示表行中列的值的JSON值,<atom>、<set>或<map>中的一个。

<atom> A JSON value that represents a scalar value for a column, one of <string>, <number>, <boolean>, <uuid>, or <named-uuid>.

<atom>表示列的标量值的JSON值,<string>、<number>、<boolean>、<uuid>或<named uuid>中的一个。

<set> Either an <atom>, representing a set with exactly one element, or a 2-element JSON array that represents a database set value. The first element of the array must be the string "set", and the second element must be an array of zero or more <atom>s giving the values in the set. All of the <atom>s must have the same type.

<set>一个<atom>,表示正好有一个元素的集合,或者一个表示数据库集合值的2元素JSON数组。数组的第一个元素必须是字符串“set”,第二个元素必须是零个或多个<atom>s的数组,给出集合中的值。所有<atom>s必须具有相同的类型。

<map> A 2-element JSON array that represents a database map value. The first element of the array must be the string "map", and the second element must be an array of zero or more <pair>s giving the values in the map. All of the <pair>s must have the same key and value types.

<map>表示数据库映射值的2元素JSON数组。数组的第一个元素必须是字符串“map”,第二个元素必须是一个零个或多个<pair>s的数组,给出map中的值。所有<pair>s必须具有相同的键和值类型。

(JSON objects are not used to represent <map> because JSON only allows string names in an object.)

(JSON对象不用于表示<map>,因为JSON只允许对象中的字符串名称。)

<pair> A 2-element JSON array that represents a pair within a database map. The first element is an <atom> that represents the key, and the second element is an <atom> that represents the value.

<pair>表示数据库映射中的一对的2元素JSON数组。第一个元素是表示键的<atom>,第二个元素是表示值的<atom>。

<uuid> A 2-element JSON array that represents a UUID. The first element of the array must be the string "uuid", and the second element must be a 36-character string giving the UUID in the format described by RFC 4122 [RFC4122]. For example, the following <uuid> represents the UUID 550e8400-e29b-41d4-a716-446655440000:

<uuid>表示uuid的2元素JSON数组。数组的第一个元素必须是字符串“uuid”,第二个元素必须是36个字符的字符串,以RFC 4122[RFC4122]描述的格式提供uuid。例如,以下<uuid>表示uuid 550e8400-e29b-41d4-a716-446655440000:

["uuid", "550e8400-e29b-41d4-a716-446655440000"]

[“uuid”、“550e8400-e29b-41d4-a716-446655440000”]

<named-uuid> A 2-element JSON array that represents the UUID of a row inserted in an "insert" operation within the same transaction. The first element of the array must be the string "named-uuid", and the second element should be the <id> specified as the "uuid-name" for an "insert" operation within the same transaction. For example, if an "insert" operation within this transaction specifies a "uuid-name" of "myrow", the following <named-uuid> represents the UUID created by that operation:

<named uuid>一个2元素JSON数组,表示在同一事务中的“insert”操作中插入的行的uuid。数组的第一个元素必须是字符串“named uuid”,第二个元素应该是为同一事务中的“insert”操作指定为“uuid name”的<id>。例如,如果此事务中的“插入”操作指定“myrow”的“uuid名称”,则以下<named uuid>表示该操作创建的uuid:

["named-uuid", "myrow"]

[“命名uuid”、“myrow”]

A <named-uuid> may be used anywhere a <uuid> is valid. This enables a single transaction to both insert a new row and then refer to that row using the "uuid-name" that was associated with that row when it was inserted. Note that the "uuid-name" is only meaningful within the scope of a single transaction.

<named uuid>可以在<uuid>有效的任何地方使用。这使得单个事务既可以插入新行,又可以使用插入该行时与该行关联的“uuid名称”引用该行。请注意,“uuid名称”仅在单个事务的范围内有意义。

<condition> A 3-element JSON array of the form [<column>, <function>, <value>] that represents a test on a column value. Except as otherwise specified below, <value> MUST have the same type as <column>. The meaning depends on the type of <column>:

<condition>一个3元素JSON数组,其形式为[<column>,<function>,<value>],表示对列值的测试。除非下面另有规定,<value>必须具有与<column>相同的类型。含义取决于<column>的类型:

integer or real <function> must be "<", "<=", "==", "!=", ">=", ">", "includes", or "excludes".

整数或实数<函数>必须是“<”、“<=”、“=”、“!=”、“>=”、“>”、“包含”或“排除”。

The test is true if the column's value satisfies the relation <function> <value>, e.g., if the column has value 1 and <value> is 2, the test is true if <function> is "<", "<=", or "!=", but not otherwise.

如果列的值满足关系<函数><值>,则测试为真,例如,如果列的值为1且<值>为2,则如果<函数>为“<”、“<=”或“!=”,则测试为真,否则测试为真。

"includes" is equivalent to "=="; "excludes" is equivalent to "!=".

“包括”相当于“=”;“排除”相当于“!=”。

boolean or string or uuid <function> must be "!=", "==", "includes", or "excludes".

布尔值、字符串或uuid<function>必须为“!=”、“=”、“包含”或“排除”。

If <function> is "==" or "includes", the test is true if the column's value equals <value>. If <function> is "!=" or "excludes", the test is inverted.

如果<function>为“==”或“includes”,则如果列的值等于<value>,则测试为真。如果<function>为“!=”或“excludes”,则测试将反转。

set or map <function> must be "!=", "==", "includes", or "excludes".

集合或映射<函数>必须是“!=”、“=”、“包含”或“排除”。

If <function> is "==", the test is true if the column's value contains exactly the same values (for sets) or pairs (for maps). If <function> is "!=", the test is inverted.

如果<function>为“==”,则如果列的值包含完全相同的值(对于集合)或对(对于贴图),则测试为真。如果<function>为“!=”,则测试为反向。

If <function> is "includes", the test is true if the column's value contains all of the values (for sets) or pairs (for maps) in <value>. The column's value may also contain other values or pairs.

如果<function>为“includes”,则如果列的值包含<value>中的所有值(对于集合)或对(对于映射),则测试为真。列的值还可能包含其他值或对。

If <function> is "excludes", the test is true if the column's value does not contain any of the values (for sets) or pairs (for maps) in <value>. The column's value may contain other values or pairs not in <value>.

如果<function>为“excludes”,则如果列的值不包含<value>中的任何值(对于集合)或对(对于映射),则测试为真。列的值可能包含不在<value>中的其他值或对。

If <function> is "includes" or "excludes", then the required type of <value> is slightly relaxed, in that it may have fewer than the minimum number of elements specified by the column's type. If <function> is "excludes", then the required type is additionally relaxed in that <value> may have more than the maximum number of elements specified by the column's type.

如果<function>是“includes”或“excludes”,则所需的<value>类型会稍微放宽,因为它可能具有少于列类型指定的最小元素数。如果<function>为“excludes”,则所需类型将另外放宽,因为<value>可能具有超过列类型指定的最大元素数。

<function> One of "<", "<=", "==", "!=", ">=", ">", "includes", or "excludes".

<function>是“<”、“<=”、“=”、“!=”、“>=”、“>”、“包含”或“排除”中的一个。

<mutation> A 3-element JSON array of the form [<column>, <mutator>, <value>] that represents a change to a column value. Except as otherwise specified below, <value> must have the same type as <column>. The meaning depends on the type of <column>:

<mutation>一个3元素JSON数组,其形式为[<column>,<mutator>,<value>],表示对列值的更改。除非下面另有规定,<value>必须具有与<column>相同的类型。含义取决于<column>的类型:

integer or real <mutator> must be "+=", "-=", "*=", "/=", or (integer only) "%=". The value of <column> is changed to the sum, difference, product, quotient, or remainder, respectively, of <column> and <value>.

整数或实数<mutator>必须为“+=”、“-=”、“*=”、“/=”或(仅限整数)“%=”。<column>的值分别更改为<column>和<value>的和、差、积、商或余数。

Constraints on <column> are ignored when parsing <value>.

解析<value>时忽略<column>上的约束。

boolean, string, or uuid No valid <mutator>s are currently defined for these types.

布尔值、字符串或uuid当前未为这些类型定义有效的<mutator>s。

set Any <mutator> valid for the set's element type may be applied to the set, in which case the mutation is applied to each member of the set individually. <value> must be a scalar value of the same type as the set's element type, except that constraints are ignored when parsing <value>.

对集合的元素类型有效的set Any<mutator>可以应用于集合,在这种情况下,变异分别应用于集合的每个成员<value>必须是与集合的元素类型相同类型的标量值,除非在分析<value>时忽略约束。

If <mutator> is "insert", then each of the values in the set in <value> is added to <column> if it is not already present. The required type of <value> is slightly relaxed, in that it may have fewer than the minimum number of elements specified by the column's type.

如果<mutator>为“insert”,则<value>中集合中的每个值都将添加到<column>中(如果尚未存在)。所需的<value>类型稍微放宽,因为它可能少于列类型指定的最小元素数。

If <mutator> is "delete", then each of the values in the set in <value> is removed from <column> if it is present there. The required type is slightly relaxed in that <value> may have more or less than the maximum number of elements specified by the column's type.

如果<mutator>为“delete”,则<value>中设置的每个值都将从<column>中删除(如果存在)。所需的类型稍微放宽,因为<value>的元素数可能大于或小于列类型指定的最大元素数。

map <mutator> must be "insert" or "delete".

映射<mutator>必须是“插入”或“删除”。

If <mutator> is "insert", then each of the key-value pairs in the map in <value> is added to <column> only if its key is not already present. The required type of <value> is slightly relaxed, in that it may have fewer than the minimum number of elements specified by the column's type.

如果<mutator>为“insert”,则<value>中映射中的每个键值对仅在其键不存在时添加到<column>。所需的<value>类型稍微放宽,因为它可能少于列类型指定的最小元素数。

If <mutator> is "delete", then <value> may have the same type as <column> (a map type), or it may be a set whose element type is the same as <column>'s key type:

如果<mutator>为“delete”,则<value>可能与<column>具有相同的类型(映射类型),或者可能是元素类型与<column>的键类型相同的集合:

+ If <value> is a map, the mutation deletes each key-value pair in <column> whose key and value equal one of the key-value pairs in <value>.

+ 如果<value>是一个映射,则变异会删除<column>中的每个键值对,其键值等于<value>中的一个键值对。

+ If <value> is a set, the mutation deletes each key-value pair in <column> whose key equals one of the values in <value>.

+ 如果<value>是一个集合,则变异会删除<column>中的每个键值对,其键值等于<value>中的一个值。

For "delete", <value> may have any number of elements, regardless of restrictions on the number of elements in <column>.

对于“delete”,<value>可以有任意数量的元素,而不考虑<column>中元素数量的限制。

<mutator> One of "+=", "-=", "*=", "/=", "%=", "insert", or "delete".

<mutator>一个“+=”、“-=”、“*=”、“/=”、“%=”、“插入”或“删除”。

5.2. Operations
5.2. 操作

The operations that may be performed as part of a "transact" RPC request (see Section 4.1.3) are described in the following subsections. Each of these operations is a JSON object that may be included as one of the elements of the "params" array that is one of the elements of the "transact" request. The details of each object, its semantics, results, and possible errors are described below.

可作为“transact”RPC请求的一部分执行的操作(见第4.1.3节)在以下小节中描述。这些操作中的每一个都是一个JSON对象,可以作为“transact”请求元素之一的“params”数组的元素之一包含。每个对象的详细信息、语义、结果和可能的错误如下所述。

5.2.1. Insert
5.2.1. 插入

The "insert" object contains the following members:

“插入”对象包含以下成员:

      "op": "insert"          required
      "table": <table>        required
      "row": <row>            required
      "uuid-name": <id>       optional
        
      "op": "insert"          required
      "table": <table>        required
      "row": <row>            required
      "uuid-name": <id>       optional
        

The corresponding result object contains the following member:

相应的结果对象包含以下成员:

      "uuid": <uuid>
        
      "uuid": <uuid>
        

The operation inserts "row" into "table". If "row" does not specify values for all the columns in "table", those columns receive default values. The default value for a column depends on its type. The default for a column whose <type> specifies a "min" of 0 is an empty set or empty map. Otherwise, the default is a single value or a single key-value pair, whose value(s) depend on its <atomic-type>:

该操作将“行”插入“表”。如果“行”未为“表”中的所有列指定值,则这些列将接收默认值。列的默认值取决于其类型。<type>指定“min”为0的列的默认值为空集或空映射。否则,默认值为单个值或单个键值对,其值取决于其<原子类型>:

o "integer" or "real": 0

o “整数”或“实数”:0

o "boolean": false

o “布尔”:false

   o  "string": "" (the empty string)
        
   o  "string": "" (the empty string)
        

o "uuid": 00000000-0000-0000-0000-000000000000

o “uuid”:00000000-0000-0000-0000-000000000000

The new row receives a new, randomly generated UUID. If "uuid-name" is supplied, then it is an error if <id> is not unique among the "uuid-name"s supplied on all the "insert" operations within this transaction. The UUID for the new row is returned as the "uuid" member of the result.

新行接收随机生成的新UUID。如果提供了“uuid name”,那么如果在该事务中的所有“insert”操作上提供的“uuid name”中<id>不是唯一的,则为错误。新行的UUID作为结果的“UUID”成员返回。

The errors that may be returned are as follows:

可能返回的错误如下所示:

   "error": "duplicate uuid-name"
      The same "uuid-name" appears on another "insert" operation within
      this transaction.
        
   "error": "duplicate uuid-name"
      The same "uuid-name" appears on another "insert" operation within
      this transaction.
        
   "error": "constraint violation"
      One of the values in "row" does not satisfy the immediate
      constraints for its column's <base-type>.  This error will occur
      for columns that are not explicitly set by "row" if the default
      value does not satisfy the column's constraints.
        
   "error": "constraint violation"
      One of the values in "row" does not satisfy the immediate
      constraints for its column's <base-type>.  This error will occur
      for columns that are not explicitly set by "row" if the default
      value does not satisfy the column's constraints.
        
5.2.2. Select
5.2.2. 选择

The "select" object contains the following members:

“选择”对象包含以下成员:

      "op": "select"                required
      "table": <table>              required
      "where": [<condition>*]       required
      "columns": [<column>*]        optional
        
      "op": "select"                required
      "table": <table>              required
      "where": [<condition>*]       required
      "columns": [<column>*]        optional
        

The corresponding result object contains the following member:

相应的结果对象包含以下成员:

      "rows": [<row>*]
        
      "rows": [<row>*]
        

The operation searches "table" for rows that match all the conditions specified in "where". If "where" is an empty array, every row in "table" is selected.

该操作在“表”中搜索与“where”中指定的所有条件匹配的行。如果“where”是空数组,“table”中的每一行都被选中。

The "rows" member of the result is an array of objects. Each object corresponds to a matching row, with each column specified in "columns" as a member, the column's name as the member name, and its value as the member value. If "columns" is not specified, all the table's columns are included (including the internally generated "_uuid" and "_version" columns). If two rows of the result have the same values for all included columns, only one copy of that row is included in "rows". Specifying "_uuid" within "columns" will avoid dropping duplicates, since every row has a unique UUID.

结果的“rows”成员是一个对象数组。每个对象对应一个匹配的行,在“columns”中指定每个列作为成员,列的名称作为成员名称,其值作为成员值。如果未指定“columns”,则包括表中的所有列(包括内部生成的“\u uuid”和“\u version”列)。如果结果的两行对于所有包含的列具有相同的值,则“行”中只包含该行的一个副本。在“columns”中指定“_uuid”将避免删除重复项,因为每一行都有一个唯一的uuid。

The ordering of rows within "rows" is unspecified.

未指定“行”中的行顺序。

5.2.3. Update
5.2.3. 使现代化

The "update" object contains the following members:

“更新”对象包含以下成员:

      "op": "update"                required
      "table": <table>              required
      "where": [<condition>*]       required
      "row": <row>                  required
        
      "op": "update"                required
      "table": <table>              required
      "where": [<condition>*]       required
      "row": <row>                  required
        

The corresponding result object contains the following member:

相应的结果对象包含以下成员:

      "count": <integer>
        
      "count": <integer>
        

The operation updates rows in a table. It searches "table" for rows that match all the conditions specified in "where". For each matching row, it changes the value of each column specified in "row" to the value for that column specified in "row". The "_uuid" and "_version" columns of a table may not be directly updated with this operation. Columns designated read-only in the schema also may not be updated.

该操作将更新表中的行。它在“表”中搜索与“where”中指定的所有条件匹配的行。对于每个匹配行,它将“行”中指定的每列的值更改为“行”中指定的该列的值。表的“\u uuid”和“\u version”列不能通过此操作直接更新。架构中指定为只读的列也可能不会更新。

The "count" member of the result specifies the number of rows that matched.

结果的“count”成员指定匹配的行数。

The error that may be returned is:

可能返回的错误为:

   "error": "constraint violation"
      One of the values in "row" does not satisfy the immediate
      constraints for its column's <base-type>.
        
   "error": "constraint violation"
      One of the values in "row" does not satisfy the immediate
      constraints for its column's <base-type>.
        
5.2.4. Mutate
5.2.4. 变异

The "mutate" object contains the following members:

“mutate”对象包含以下成员:

      "op":  "mutate"               required
      "table": <table>              required
      "where": [<condition>*]       required
      "mutations": [<mutation>*]    required
        
      "op":  "mutate"               required
      "table": <table>              required
      "where": [<condition>*]       required
      "mutations": [<mutation>*]    required
        

The corresponding result object contains the following member:

相应的结果对象包含以下成员:

      "count": <integer>
        
      "count": <integer>
        

The operation mutates rows in a table. It searches "table" for rows that match all the conditions specified in "where". For each matching row, it mutates its columns as specified by each <mutation> in "mutations", in the order specified.

该操作将改变表中的行。它在“表”中搜索与“where”中指定的所有条件匹配的行。对于每个匹配行,它按照“突变”中的每个<mutation>指定的顺序突变其列。

The "_uuid" and "_version" columns of a table may not be directly modified with this operation. Columns designated read-only in the schema also may not be updated.

此操作不能直接修改表的“\u uuid”和“\u version”列。架构中指定为只读的列也可能不会更新。

The "count" member of the result specifies the number of rows that matched.

结果的“count”成员指定匹配的行数。

The errors that may be returned are:

可能返回的错误有:

"error": "domain error" The result of the mutation is not mathematically defined, e.g., division by zero.

“错误”:“域错误”突变的结果没有数学定义,例如,除以零。

"error": "range error" The result of the mutation is not representable within the database's format, e.g., an integer result outside the range INT64_MIN...INT64_MAX or a real result outside the range -DBL_MAX...DBL_MAX.

“错误”:“范围错误”变异的结果在数据库的格式中不可表示,例如,范围INT64_MIN…INT64_MAX之外的整数结果或范围-DBL_MAX…DBL_MAX之外的实际结果。

   "error": "constraint violation"
      The mutation caused the column's value to violate a constraint,
      e.g., it caused a column to have more or fewer values than are
      allowed, an arithmetic operation caused a set or map to have
      duplicate elements, or it violated a constraint specified by a
      column's <base-type>.
        
   "error": "constraint violation"
      The mutation caused the column's value to violate a constraint,
      e.g., it caused a column to have more or fewer values than are
      allowed, an arithmetic operation caused a set or map to have
      duplicate elements, or it violated a constraint specified by a
      column's <base-type>.
        
5.2.5. Delete
5.2.5. 删去

The "delete" object contains the following members:

“删除”对象包含以下成员:

      "op":  "delete"               required
      "table": <table>              required
      "where": [<condition>*]       required
        
      "op":  "delete"               required
      "table": <table>              required
      "where": [<condition>*]       required
        

The corresponding result object contains the following member:

相应的结果对象包含以下成员:

      "count": <integer>
        
      "count": <integer>
        

The operation deletes all the rows from "table" that match all the conditions specified in "where". The "count" member of the result specifies the number of deleted rows.

该操作从“表”中删除与“where”中指定的所有条件匹配的所有行。结果的“count”成员指定删除的行数。

5.2.6. Wait
5.2.6. 等待

The "wait" object contains the following members:

“wait”对象包含以下成员:

      "op": "wait"                        required
      "timeout": <integer>                optional
      "table": <table>                    required
      "where": [<condition>*]             required
      "columns": [<column>*]              required
      "until": "==" or "!="               required
      "rows": [<row>*]                    required
        
      "op": "wait"                        required
      "timeout": <integer>                optional
      "table": <table>                    required
      "where": [<condition>*]             required
      "columns": [<column>*]              required
      "until": "==" or "!="               required
      "rows": [<row>*]                    required
        

There is no corresponding result object.

没有相应的结果对象。

The operation waits until a condition becomes true.

操作将等待条件变为真。

If "until" is "==", it checks whether the query on "table" specified by "where" and "columns", which is evaluated in the same way as specified for "select", returns the result set specified by "rows". If it does, then the operation completes successfully. Otherwise, the entire transaction rolls back. It is automatically restarted later, after a change in the database makes it possible for the operation to succeed. The client will not receive a response until the operation permanently succeeds or fails.

如果“until”为“==”,则检查由“where”和“columns”指定的“table”上的查询是否返回由“rows”指定的结果集,该查询的计算方式与为“select”指定的相同。如果成功,则操作将成功完成。否则,整个事务将回滚。在数据库中的更改使操作成功后,它将在稍后自动重新启动。在操作永久成功或失败之前,客户端将不会收到响应。

If "until" is "!=", the sense of the test is negated. That is, as long as the query on "table" specified by "where" and "columns" returns "rows", the transaction will be rolled back and restarted later.

如果“直到”为“!=”,则测试的意义为否定。也就是说,只要由“where”和“columns”指定的对“table”的查询返回“rows”,事务就会回滚并在以后重新启动。

If "timeout" is specified, then the transaction aborts after the specified number of milliseconds. The transaction is guaranteed to be attempted at least once before it aborts. A "timeout" of 0 will abort the transaction on the first mismatch.

如果指定了“超时”,则事务在指定的毫秒数后中止。保证在事务中止之前至少尝试一次。“超时”为0将在第一次不匹配时中止事务。

The error that may be returned is:

可能返回的错误为:

"error": "timed out" The "timeout" was reached before the transaction was able to complete.

“错误”:“超时”在事务能够完成之前达到“超时”。

5.2.7. Commit
5.2.7. 犯罪

The "commit" object contains the following members:

“提交”对象包含以下成员:

      "op": "commit"                      required
      "durable": <boolean>                required
        
      "op": "commit"                      required
      "durable": <boolean>                required
        

There is no corresponding result object.

没有相应的结果对象。

If "durable" is specified as true, then the transaction, if it commits, will be stored durably (to disk) before the reply is sent to the client. This operation with "durable" set to false is effectively a no-op.

如果将“持久”指定为true,则事务(如果提交)将在应答发送到客户端之前持久存储(到磁盘)。此“持久”设置为false的操作实际上是不可操作的。

The error that may be returned is:

可能返回的错误为:

   "error": "not supported"
      When "durable" is true, this database implementation does not
      support durable commits.
        
   "error": "not supported"
      When "durable" is true, this database implementation does not
      support durable commits.
        
5.2.8. Abort
5.2.8. 中止

The "abort" object contains the following member:

“abort”对象包含以下成员:

"op": "abort" required

“op”:“中止”是必需的

There is no corresponding result object (the operation never succeeds).

没有相应的结果对象(操作永远不会成功)。

The operation aborts the entire transaction with an error. This may be useful for testing.

该操作将中止整个事务,并出现错误。这可能对测试有用。

The error that will be returned is:

将返回的错误为:

   "error": "aborted"
      This operation always fails with this error.
        
   "error": "aborted"
      This operation always fails with this error.
        
5.2.9. Comment
5.2.9. 议论

The "comment" object contains the following members:

“comment”对象包含以下成员:

      "op": "comment"                    required
      "comment": <string>                required
        
      "op": "comment"                    required
      "comment": <string>                required
        

There is no corresponding result object.

没有相应的结果对象。

The operation provides information to a database administrator on the purpose of a transaction. The ovsdb-server implementation, for example, adds comments in transactions that modify the database to the database journal. This can be helpful in debugging, e.g., when there are multiple clients writing to a database. An example of this can be seen in the ovs-vsctl tool, a command line tool that interacts with ovsdb-server. When performing operations on the database, it includes the command that was invoked (e.g., "ovs-vsctl add-br br0") as a comment in the transaction, which can then be seen in the journal alongside the changes that were made to the tables in the database.

该操作为数据库管理员提供有关事务的信息。例如,ovsdb服务器实现在修改数据库的事务中将注释添加到数据库日志中。这有助于调试,例如,当有多个客户端写入数据库时。ovs vsctl工具就是一个例子,它是一个与ovsdb服务器交互的命令行工具。在数据库上执行操作时,它将调用的命令(例如,“ovs vsctl add br br0”)作为注释包含在事务中,然后可以在日志中看到该命令以及对数据库中的表所做的更改。

5.2.10. Assert
5.2.10. 明确肯定

The assert object contains the following members:

assert对象包含以下成员:

      "op": "assert"                     required
      "lock": <id>                       required
        
      "op": "assert"                     required
      "lock": <id>                       required
        

Result object has no members.

结果对象没有成员。

The assert operation causes the transaction to be aborted if the client does not own the lock named <id>.

如果客户端不拥有名为<id>的锁,则断言操作会导致事务中止。

The error that may be returned is:

可能返回的错误为:

   "error": "not owner"
      The client does not own the named lock.
        
   "error": "not owner"
      The client does not own the named lock.
        
6. IANA Considerations
6. IANA考虑

IANA has assigned TCP port 6640 for this protocol. Earlier implementations of OVSDB used another port number, but compliant implementations should use the IANA-assigned number.

IANA已为此协议分配TCP端口6640。OVSDB的早期实现使用了另一个端口号,但是兼容的实现应该使用IANA分配的端口号。

IANA has updated the reference for port 6640 to point to this document.

IANA已更新6640端口的参考,以指向此文档。

7. Security Considerations
7. 安全考虑

The main security issue that needs to be addressed for the OVSDB protocol is the authentication, integrity, and privacy of communications between a client and server implementing this protocol. To provide such protection, an OVSDB connection SHOULD be secured using Transport Layer Security (TLS) [RFC5246]. The precise details of how clients and servers authenticate each other is highly dependent on the operating environment. It is often the case that

OVSDB协议需要解决的主要安全问题是实现该协议的客户端和服务器之间通信的身份验证、完整性和隐私性。为提供此类保护,应使用传输层安全性(TLS)[RFC5246]保护OVSDB连接。客户端和服务器如何相互验证的确切细节在很大程度上取决于操作环境。通常情况下

OVSDB clients and servers operate in a tightly controlled environment, e.g., on machines in a single data center where they communicate on an isolated management network.

OVSDB客户端和服务器在严格控制的环境中运行,例如,在单个数据中心的机器上,它们在隔离的管理网络上通信。

8. Acknowledgements
8. 致谢

Thanks to Jeremy Stribling and Justin Pettit for their helpful input to this document.

感谢Jeremy Stripling和Justin Pettit对本文档的帮助。

9. References
9. 工具书类
9.1. Normative References
9.1. 规范性引用文件

[DCE] "DCE: Remote Procedure Call", Open Group CAE Specification C309, ISBN 1-85912-041-5, August 1994.

[DCE]“DCE:远程过程调用”,开放组CAE规范C309,ISBN 1-85912-041-51994年8月。

[JSON-RPC] "JSON-RPC Specification, Version 1.0", <http://json-rpc.org/wiki/specification>.

[JSON-RPC]“JSON-RPC规范,版本1.0”<http://json-rpc.org/wiki/specification>.

[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997.

[RFC2119]Bradner,S.,“RFC中用于表示需求水平的关键词”,BCP 14,RFC 2119,1997年3月。

[RFC4122] Leach, P., Mealling, M., and R. Salz, "A Universally Unique IDentifier (UUID) URN Namespace", RFC 4122, July 2005.

[RFC4122]Leach,P.,Mealling,M.和R.Salz,“通用唯一标识符(UUID)URN名称空间”,RFC 4122,2005年7月。

[RFC4627] Crockford, D., "The application/json Media Type for JavaScript Object Notation (JSON)", RFC 4627, July 2006.

[RFC4627]Crockford,D.,“JavaScript对象表示法(json)的应用程序/json媒体类型”,RFC4627,2006年7月。

[RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security (TLS) Protocol Version 1.2", RFC 5246, August 2008.

[RFC5246]Dierks,T.和E.Rescorla,“传输层安全(TLS)协议版本1.2”,RFC 5246,2008年8月。

9.2. Informative References
9.2. 资料性引用

[DB-SCHEMA] "Open vSwitch Database Schema", <http://openvswitch.org/ovs-vswitchd.conf.db.5.pdf>.

[DB-SCHEMA]“打开vSwitch数据库模式”<http://openvswitch.org/ovs-vswitchd.conf.db.5.pdf>.

[OF-SPEC] Open Networking Foundation, "OpenFlow Switch Specification, version 1.3.3", October 2013, <https://www.opennetworking.org>.

开放式网络基金会,“OpenFLUE交换机规范,版本1.3.3”,2013年10月,<https://www.opennetworking.org>.

[OVS] "Open vSwitch", <http://openvswitch.org/>.

[OVS]“打开vSwitch”<http://openvswitch.org/>.

Authors' Addresses

作者地址

Ben Pfaff VMware, Inc. 3401 Hillview Ave. Palo Alto, CA 94304 USA

Ben Pfaff VMware,Inc.美国加利福尼亚州帕洛阿尔托Hillview大道3401号,邮编94304

   EMail: blp@nicira.com
        
   EMail: blp@nicira.com
        

Bruce Davie (editor) VMware, Inc. 3401 Hillview Ave. Palo Alto, CA 94304 USA

Bruce Davie(编辑)VMware,Inc.美国加利福尼亚州帕洛阿尔托Hillview大道3401号,邮编94304

   EMail: bsd@nicira.com
        
   EMail: bsd@nicira.com