Stephane A. Sezer sas@cd80.net
SUGYO Kazushi sugyo.org@gmail.com
Tadaaki Nagao nagao@stratosphere.co.jp
+Terry Wilson twilson@redhat.com
Tetsuo NAKAGAWA nakagawa@mxc.nes.nec.co.jp
Thomas Goirand zigo@debian.org
Thomas Graf tgraf@noironetworks.com
* OpenFlow 1.5 (draft) Copy-Field action is now supported.
* OpenFlow 1.3+ table features requests are now supported (read-only).
* Nicira extension "move" actions may now be included in action sets.
+ - ovsdb-server: New OVSDB protocol extension allows inequality tests on
+ "optional scalar" columns. See ovsdb-server(1) for details.
v2.3.0 - 14 Aug 2014
static inline bool ovsdb_type_is_scalar(const struct ovsdb_type *);
static inline bool ovsdb_type_is_optional(const struct ovsdb_type *);
+static inline bool ovsdb_type_is_optional_scalar(
+ const struct ovsdb_type *);
static inline bool ovsdb_type_is_composite(const struct ovsdb_type *);
static inline bool ovsdb_type_is_set(const struct ovsdb_type *);
static inline bool ovsdb_type_is_map(const struct ovsdb_type *);
return type->n_min == 0;
}
+static inline bool ovsdb_type_is_optional_scalar(
+ const struct ovsdb_type *type)
+{
+ return (type->value.type == OVSDB_TYPE_VOID
+ && type->n_min == 0 && type->n_max == 1);
+}
+
static inline bool ovsdb_type_is_composite(const struct ovsdb_type *type)
{
return type->n_max > 1;
case OVSDB_F_LE:
case OVSDB_F_GT:
case OVSDB_F_GE:
- /* XXX should we also allow these operators for types with n_min == 0,
- * n_max == 1? (They would always be "false" if the value was
- * missing.) */
- if (!ovsdb_type_is_scalar(&type)
+ /* Allow these operators for types with n_min == 0, n_max == 1.
+ * (They will always be "false" if the value is missing.) */
+ if (!(ovsdb_type_is_scalar(&type)
+ || ovsdb_type_is_optional_scalar(&type))
|| (type.key.type != OVSDB_TYPE_INTEGER
&& type.key.type != OVSDB_TYPE_REAL)) {
char *s = ovsdb_type_to_english(&type);
const struct ovsdb_datum *arg = &c->arg;
const struct ovsdb_type *type = &c->column->type;
- if (ovsdb_type_is_scalar(type)) {
+ if (ovsdb_type_is_optional_scalar(type) && field->n == 0) {
+ switch (c->function) {
+ case OVSDB_F_LT:
+ case OVSDB_F_LE:
+ case OVSDB_F_EQ:
+ case OVSDB_F_GE:
+ case OVSDB_F_GT:
+ case OVSDB_F_INCLUDES:
+ return false;
+ case OVSDB_F_NE:
+ case OVSDB_F_EXCLUDES:
+ return true;
+ }
+ } else if (ovsdb_type_is_scalar(type)
+ || ovsdb_type_is_optional_scalar(type)) {
int cmp = ovsdb_atom_compare_3way(&field->keys[0], &arg->keys[0],
type->key.type);
switch (c->function) {
active monitors. \fBovsdb\-server\fR rejects attempt to create two
monitors with the same identifier.
.
+.IP "5.1. Notation"
+For <condition>, RFC 7047 only allows the use of \fB!=\fR, \fB==\fR,
+\fBincludes\fR, and \fBexcludes\fR operators with set types. Open
+vSwitch 2.4 and later extend <condition> to allow the use of \fB<\fR,
+\fB<=\fR, \fB>=\fR, and \fB>\fR operators with columns with type ``set
+of 0 or 1 integer'' and ``set of 0 or 1 real''. These conditions
+evaluate to false when the column is empty, and otherwise as described
+in RFC 7047 for integer and real types.
+.
.IP "6. IANA Considerations"
\fBovsdb\-server\fR currently defaults to its historical port number
6632. Future versions will adopt IANA-assigned port 6640 as default.
condition 30: TTT-T -T-T- T----
condition 31: T-T-T ---T- -----
condition 32: ----- T---- ---T-], [condition])
+
+OVSDB_CHECK_POSITIVE([evaluating conditions on optional integers],
+ [[evaluate-conditions \
+ '{"columns": {"i": {"type": {"key": "integer", "min": 0, "max": 1}}}}' \
+ '[[["i", "<", 1]],
+ [["i", "<=", 1]],
+ [["i", "==", 1]],
+ [["i", "!=", 1]],
+ [["i", ">=", 1]],
+ [["i", ">", 1]],
+ [["i", "includes", 1]],
+ [["i", "excludes", 1]],
+ [["i", ">", 0], ["i", "<", 2]]]' \
+ '[{"i": ["set", []]},
+ {"i": ["set", [0]]},
+ {"i": ["set", [1]]},
+ {"i": ["set", [2]]}]']],
+ [dnl
+condition 0: -T--
+condition 1: -TT-
+condition 2: --T-
+condition 3: TT-T
+condition 4: --TT
+condition 5: ---T
+condition 6: --T-
+condition 7: TT-T
+condition 8: --T-], [condition])
+
+OVSDB_CHECK_POSITIVE([evaluating conditions on optional strings],
+ [[evaluate-conditions \
+ '{"columns": {"s": {"type": {"key": "string", "min": 0, "max": 1}}}}' \
+ '[[["s", "==", ""]],
+ [["s", "!=", ""]],
+ [["s", "includes", ""]],
+ [["s", "excludes", ""]],
+ [["s", "==", "foo"]],
+ [["s", "!=", "foo"]],
+ [["s", "includes", "foo"]],
+ [["s", "excludes", "foo"]],
+ [["s", "!=", "foo"], ["s", "!=", ""]]]' \
+ '[{"s": ["set", [""]]},
+ {"s": ["set", ["foo"]]},
+ {"s": ["set", ["xxx"]]},
+ {"s": ["set", []]}]']],
+ [dnl
+condition 0: T---
+condition 1: -TTT
+condition 2: T---
+condition 3: -TTT
+condition 4: -T--
+condition 5: T-TT
+condition 6: -T--
+condition 7: T-TT
+condition 8: --TT], [condition])
+
+OVSDB_CHECK_POSITIVE([evaluating conditions on optional reals],
+ [[evaluate-conditions \
+ '{"columns": {"r": {"type": {"key": "real", "min": 0, "max": 1}}}}' \
+ '[[["r", "<", 5.0]],
+ [["r", "<=", 5.0]],
+ [["r", "==", 5.0]],
+ [["r", "!=", 5.0]],
+ [["r", ">=", 5.0]],
+ [["r", ">", 5.0]],
+ [["r", "includes", 5.0]],
+ [["r", "excludes", 5.0]],
+ [["r", "!=", 0], ["r", "!=", 5.1]]]' \
+ '[{"r": ["set", [0]]},
+ {"r": ["set", [5.0]]},
+ {"r": ["set", [5.1]]},
+ {"r": ["set", []]}]']],
+ [dnl
+condition 0: T---
+condition 1: TT--
+condition 2: -T--
+condition 3: T-TT
+condition 4: -TT-
+condition 5: --T-
+condition 6: -T--
+condition 7: T-TT
+condition 8: -T-T], [condition])