2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-21 14:49:41 +00:00

ovsdb: Make scalars and 1-element sets interchangeable.

It is natural to write "abc" in place of ["set",["abc"]] and vice versa.
I cannot think of a reason not to support this, and it can make reading
and writing OVSDB files and transactions easier, so support it.
This commit is contained in:
Ben Pfaff
2010-02-08 16:37:49 -08:00
parent fbf925e45d
commit ae8f13e290
7 changed files with 78 additions and 68 deletions

View File

@@ -897,26 +897,17 @@ ovsdb_datum_from_json(struct ovsdb_datum *datum,
{ {
struct ovsdb_error *error; struct ovsdb_error *error;
if (ovsdb_type_is_scalar(type)) { if (ovsdb_type_is_map(type)
datum->n = 1; || (json->type == JSON_ARRAY
datum->keys = xmalloc(sizeof *datum->keys); && json->u.array.n > 0
datum->values = NULL; && json->u.array.elems[0]->type == JSON_STRING
&& !strcmp(json->u.array.elems[0]->u.string, "set"))) {
error = ovsdb_atom_from_json(&datum->keys[0], &type->key,
json, symtab);
if (error) {
free(datum->keys);
}
return error;
} else {
bool is_map = ovsdb_type_is_map(type); bool is_map = ovsdb_type_is_map(type);
const char *class = is_map ? "map" : "set"; const char *class = is_map ? "map" : "set";
const struct json *inner; const struct json *inner;
unsigned int i; unsigned int i;
size_t n; size_t n;
assert(is_map || ovsdb_type_is_set(type));
error = unwrap_json(json, class, JSON_ARRAY, &inner); error = unwrap_json(json, class, JSON_ARRAY, &inner);
if (error) { if (error) {
return error; return error;
@@ -974,6 +965,17 @@ ovsdb_datum_from_json(struct ovsdb_datum *datum,
error: error:
ovsdb_datum_destroy(datum, type); ovsdb_datum_destroy(datum, type);
return error; return error;
} else {
datum->n = 1;
datum->keys = xmalloc(sizeof *datum->keys);
datum->values = NULL;
error = ovsdb_atom_from_json(&datum->keys[0], &type->key,
json, symtab);
if (error) {
free(datum->keys);
}
return error;
} }
} }
@@ -983,7 +985,7 @@ ovsdb_datum_to_json(const struct ovsdb_datum *datum,
{ {
/* These tests somewhat tolerate a 'datum' that does not exactly match /* These tests somewhat tolerate a 'datum' that does not exactly match
* 'type', in particular a datum with 'n' not in the allowed range. */ * 'type', in particular a datum with 'n' not in the allowed range. */
if (datum->n == 1 && ovsdb_type_is_scalar(type)) { if (datum->n == 1 && !ovsdb_type_is_map(type)) {
return ovsdb_atom_to_json(&datum->keys[0], type->key.type); return ovsdb_atom_to_json(&datum->keys[0], type->key.type);
} else if (type->value.type == OVSDB_TYPE_VOID) { } else if (type->value.type == OVSDB_TYPE_VOID) {
struct json **elems; struct json **elems;

View File

@@ -566,7 +566,8 @@ ovsdb_type_is_valid(const struct ovsdb_type *type)
&& ovsdb_base_type_is_valid(&type->key) && ovsdb_base_type_is_valid(&type->key)
&& ovsdb_base_type_is_valid(&type->value) && ovsdb_base_type_is_valid(&type->value)
&& type->n_min <= 1 && type->n_min <= 1
&& type->n_min <= type->n_max); && type->n_min <= type->n_max
&& type->n_max >= 1);
} }
static struct ovsdb_error * static struct ovsdb_error *

View File

@@ -547,7 +547,8 @@ Notation for the Wire Protocol
<set> <set>
A 2-element JSON array that represents a database set value. The 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 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 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. in the set. All of the <atom>s must have the same type.

View File

@@ -149,22 +149,22 @@ OVSDB_CHECK_POSITIVE([conditions on sets],
["uuid", "62315898-64e0-40b9-b26f-ff74225303e6"]]]]]' \ ["uuid", "62315898-64e0-40b9-b26f-ff74225303e6"]]]]]' \
]], ]],
[[[["i","==",["set",[]]]] [[[["i","==",["set",[]]]]
[["i","!=",["set",[1]]]] [["i","!=",1]]
[["i","includes",["set",[1,2]]]] [["i","includes",["set",[1,2]]]]
[["i","excludes",["set",[1,2,3]]]] [["i","excludes",["set",[1,2,3]]]]
[["r","==",["set",[]]]] [["r","==",["set",[]]]]
[["r","!=",["set",[1.5]]]] [["r","!=",1.5]]
[["r","includes",["set",[1.5,2.5]]]] [["r","includes",["set",[1.5,2.5]]]]
[["r","excludes",["set",[1.5,2.5,3.5]]]] [["r","excludes",["set",[1.5,2.5,3.5]]]]
[["b","==",["set",[true]]]] [["b","==",true]]
[["b","!=",["set",[false]]]] [["b","!=",false]]
[["b","includes",["set",[false]]]] [["b","includes",false]]
[["b","excludes",["set",[false,true]]]] [["b","excludes",["set",[false,true]]]]
[["s","==",["set",["a"]]]] [["s","==","a"]]
[["s","!=",["set",["a","b"]]]] [["s","!=",["set",["a","b"]]]]
[["s","includes",["set",["c"]]]] [["s","includes","c"]]
[["s","excludes",["set",["c","d"]]]] [["s","excludes",["set",["c","d"]]]]
[["u","==",["set",[["uuid","b10d28f7-af18-4a67-9e78-2a6394516c59"]]]]] [["u","==",["uuid","b10d28f7-af18-4a67-9e78-2a6394516c59"]]]
[["u","==",["set",[["uuid","9179ca6d-6d65-400a-b455-3ad92783a099"],["uuid","b10d28f7-af18-4a67-9e78-2a6394516c59"]]]]] [["u","==",["set",[["uuid","9179ca6d-6d65-400a-b455-3ad92783a099"],["uuid","b10d28f7-af18-4a67-9e78-2a6394516c59"]]]]]
[["u","includes",["set",[["uuid","9179ca6d-6d65-400a-b455-3ad92783a099"],["uuid","ad0fa355-8b84-4a36-a4b5-b2c1bfd91758"],["uuid","b10d28f7-af18-4a67-9e78-2a6394516c59"]]]]] [["u","includes",["set",[["uuid","9179ca6d-6d65-400a-b455-3ad92783a099"],["uuid","ad0fa355-8b84-4a36-a4b5-b2c1bfd91758"],["uuid","b10d28f7-af18-4a67-9e78-2a6394516c59"]]]]]
[["u","excludes",["set",[["uuid","62315898-64e0-40b9-b26f-ff74225303e6"],["uuid","9179ca6d-6d65-400a-b455-3ad92783a099"],["uuid","ad0fa355-8b84-4a36-a4b5-b2c1bfd91758"],["uuid","b10d28f7-af18-4a67-9e78-2a6394516c59"]]]]]]], [["u","excludes",["set",[["uuid","62315898-64e0-40b9-b26f-ff74225303e6"],["uuid","9179ca6d-6d65-400a-b455-3ad92783a099"],["uuid","ad0fa355-8b84-4a36-a4b5-b2c1bfd91758"],["uuid","b10d28f7-af18-4a67-9e78-2a6394516c59"]]]]]]],

View File

@@ -350,7 +350,7 @@ constraint violation: "abc" length 3 is greater than maximum allowed length 2
AT_BANNER([OSVDB -- simple data]) AT_BANNER([OSVDB -- simple data])
OVSDB_CHECK_POSITIVE([integer JSON datum], OVSDB_CHECK_POSITIVE([integer JSON datum],
[[parse-data '["integer"]' '[0]' '[1]' '[-1]']], [[parse-data '["integer"]' '[0]' '["set",[1]]' '[-1]']],
[0 [0
1 1
-1]) -1])
@@ -363,7 +363,7 @@ OVSDB_CHECK_POSITIVE([integer string datum],
1]) 1])
OVSDB_CHECK_POSITIVE([real JSON datum], OVSDB_CHECK_POSITIVE([real JSON datum],
[[parse-data '["real"]' '[0]' '[1.0]' '[-1.25]']], [[parse-data '["real"]' '[0]' '["set",[1.0]]' '[-1.25]']],
[0 [0
1 1
-1.25]) -1.25])
@@ -375,7 +375,7 @@ OVSDB_CHECK_POSITIVE([real string datum],
-1.25]) -1.25])
OVSDB_CHECK_POSITIVE([boolean JSON datum], OVSDB_CHECK_POSITIVE([boolean JSON datum],
[[parse-data '["boolean"]' '[true]' '[false]' ]], [[parse-data '["boolean"]' '["set", [true]]' '[false]' ]],
[true [true
false]) false])
@@ -385,7 +385,7 @@ OVSDB_CHECK_POSITIVE([boolean string datum],
false]) false])
OVSDB_CHECK_POSITIVE([string JSON datum], OVSDB_CHECK_POSITIVE([string JSON datum],
[[parse-data '["string"]' '[""]' '["true"]' '["\"\\\/\b\f\n\r\t"]']], [[parse-data '["string"]' '["set",[""]]' '["true"]' '["\"\\\/\b\f\n\r\t"]']],
["" [""
"true" "true"
"\"\\/\b\f\n\r\t"]) "\"\\/\b\f\n\r\t"])
@@ -401,11 +401,11 @@ AT_BANNER([OVSDB -- set data])
OVSDB_CHECK_POSITIVE([JSON optional boolean], OVSDB_CHECK_POSITIVE([JSON optional boolean],
[[parse-data '{"key": "boolean", "min": 0}' \ [[parse-data '{"key": "boolean", "min": 0}' \
'["set", [true]]' \ '[true]' \
'["set", [false]]' \ '["set", [false]]' \
'["set", []]']], '["set", []]']],
[[["set",[true]] [[true
["set",[false]] false
["set",[]]]], ["set",[]]]],
[set]) [set])
@@ -422,12 +422,14 @@ false
OVSDB_CHECK_POSITIVE([JSON set of 0 or more integers], OVSDB_CHECK_POSITIVE([JSON set of 0 or more integers],
[[parse-data '{"key": "integer", "min": 0, "max": "unlimited"}' \ [[parse-data '{"key": "integer", "min": 0, "max": "unlimited"}' \
'["set", [0]]' \ '["set", [0]]' \
'[1]' \
'["set", [0, 1]]' \ '["set", [0, 1]]' \
'["set", [0, 1, 2]]' \ '["set", [0, 1, 2]]' \
'["set", [0, 1, 2, 3, 4, 5]]' \ '["set", [0, 1, 2, 3, 4, 5]]' \
'["set", [0, 1, 2, 3, 4, 5, 6, 7, 8]]' \ '["set", [0, 1, 2, 3, 4, 5, 6, 7, 8]]' \
'["set", [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]]']], '["set", [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]]']],
[[["set",[0]] [[0
1
["set",[0,1]] ["set",[0,1]]
["set",[0,1,2]] ["set",[0,1,2]]
["set",[0,1,2,3,4,5]] ["set",[0,1,2,3,4,5]]
@@ -452,10 +454,12 @@ OVSDB_CHECK_POSITIVE([string set of 0 or more integers],
OVSDB_CHECK_POSITIVE([JSON set of 1 to 3 uuids], OVSDB_CHECK_POSITIVE([JSON set of 1 to 3 uuids],
[[parse-data '{"key": "uuid", "min": 1, "max": 3}' \ [[parse-data '{"key": "uuid", "min": 1, "max": 3}' \
'["set", [["uuid", "550e8400-e29b-41d4-a716-446655440000"]]]' \ '["set", [["uuid", "550e8400-e29b-41d4-a716-446655440000"]]]' \
'["uuid", "b5078be0-7664-4299-b836-8bcc03ef941f"]' \
'["set", [["uuid", "c5051240-30ff-43ed-b4b9-93cf3f050813"], '["set", [["uuid", "c5051240-30ff-43ed-b4b9-93cf3f050813"],
["uuid", "90558331-09af-4d2f-a572-509cad2e9088"], ["uuid", "90558331-09af-4d2f-a572-509cad2e9088"],
["uuid", "550e8400-e29b-41d4-a716-446655440000"]]]']], ["uuid", "550e8400-e29b-41d4-a716-446655440000"]]]']],
[[["set",[["uuid","550e8400-e29b-41d4-a716-446655440000"]]] [[["uuid","550e8400-e29b-41d4-a716-446655440000"]
["uuid","b5078be0-7664-4299-b836-8bcc03ef941f"]
["set",[["uuid","550e8400-e29b-41d4-a716-446655440000"],["uuid","90558331-09af-4d2f-a572-509cad2e9088"],["uuid","c5051240-30ff-43ed-b4b9-93cf3f050813"]]]]]) ["set",[["uuid","550e8400-e29b-41d4-a716-446655440000"],["uuid","90558331-09af-4d2f-a572-509cad2e9088"],["uuid","c5051240-30ff-43ed-b4b9-93cf3f050813"]]]]])
OVSDB_CHECK_POSITIVE([string set of 1 to 3 uuids], OVSDB_CHECK_POSITIVE([string set of 1 to 3 uuids],
@@ -470,11 +474,13 @@ OVSDB_CHECK_POSITIVE([string set of 1 to 3 uuids],
OVSDB_CHECK_POSITIVE([JSON set of 0 to 3 strings], OVSDB_CHECK_POSITIVE([JSON set of 0 to 3 strings],
[[parse-data '{"key": "string", "min": 0, "max": 3}' \ [[parse-data '{"key": "string", "min": 0, "max": 3}' \
'["set", []]' \ '["set", []]' \
'["a longer string"]' \
'["set", ["a relatively long string"]]' \ '["set", ["a relatively long string"]]' \
'["set", ["short string", "a relatively long string"]]' \ '["set", ["short string", "a relatively long string"]]' \
'["set", ["zzz", "short string", "a relatively long string"]]']], '["set", ["zzz", "short string", "a relatively long string"]]']],
[[["set",[]] [[["set",[]]
["set",["a relatively long string"]] "a longer string"
"a relatively long string"
["set",["a relatively long string","short string"]] ["set",["a relatively long string","short string"]]
["set",["a relatively long string","short string","zzz"]]]]) ["set",["a relatively long string","short string","zzz"]]]])

View File

@@ -143,11 +143,11 @@ OVSDB_CHECK_POSITIVE([mutations on sets],
[["r","/=",4]] [["r","/=",4]]
[["r","insert",["set",[1,2]]]] [["r","insert",["set",[1,2]]]]
[["r","delete",["set",[1,2,3]]]] [["r","delete",["set",[1,2,3]]]]
[["b","insert",["set",[true]]]] [["b","insert",true]]
[["b","delete",["set",[false]]]] [["b","delete",false]]
[["s","insert",["set",["a"]]]] [["s","insert","a"]]
[["s","delete",["set",["a","b"]]]] [["s","delete",["set",["a","b"]]]]
[["u","insert",["set",[["uuid","b10d28f7-af18-4a67-9e78-2a6394516c59"]]]]] [["u","insert",["uuid","b10d28f7-af18-4a67-9e78-2a6394516c59"]]]
[["u","delete",["set",[["uuid","9179ca6d-6d65-400a-b455-3ad92783a099"],["uuid","b10d28f7-af18-4a67-9e78-2a6394516c59"]]]]]]], [["u","delete",["set",[["uuid","9179ca6d-6d65-400a-b455-3ad92783a099"],["uuid","b10d28f7-af18-4a67-9e78-2a6394516c59"]]]]]]],
[mutation]) [mutation])
@@ -449,13 +449,13 @@ OVSDB_CHECK_POSITIVE([executing mutations on integer sets],
{"i": ["set", [0, 1, 2]]}']]], {"i": ["set", [0, 1, 2]]}']]],
[[mutation 0: [[mutation 0:
row 0: no change row 0: no change
row 1: {"i":["set",[1]]} row 1: {"i":1}
row 2: {"i":["set",[1,2]]} row 2: {"i":["set",[1,2]]}
row 3: {"i":["set",[1,2,3]]} row 3: {"i":["set",[1,2,3]]}
mutation 1: mutation 1:
row 0: no change row 0: no change
row 1: {"i":["set",[-2]]} row 1: {"i":-2}
row 2: {"i":["set",[-2,-1]]} row 2: {"i":["set",[-2,-1]]}
row 3: {"i":["set",[-2,-1,0]]} row 3: {"i":["set",[-2,-1,0]]}
@@ -478,7 +478,7 @@ row 2: no change
row 3: constraint violation: Result of "%=" operation contains duplicates. row 3: constraint violation: Result of "%=" operation contains duplicates.
mutation 5: mutation 5:
row 0: {"i":["set",[1]]} row 0: {"i":1}
row 1: {"i":["set",[0,1]]} row 1: {"i":["set",[0,1]]}
row 2: no change row 2: no change
row 3: no change row 3: no change
@@ -492,7 +492,7 @@ row 3: {"i":["set",[0,1,2,3]]}
mutation 7: mutation 7:
row 0: no change row 0: no change
row 1: no change row 1: no change
row 2: {"i":["set",[0]]} row 2: {"i":0}
row 3: {"i":["set",[0,2]]} row 3: {"i":["set",[0,2]]}
mutation 8: mutation 8:
@@ -512,52 +512,52 @@ OVSDB_CHECK_POSITIVE([executing mutations on real sets],
[["r", "*=", 2.5]], [["r", "*=", 2.5]],
[["r", "/=", 4]], [["r", "/=", 4]],
[["r", "*=", 0]], [["r", "*=", 0]],
[["r", "insert", ["set", [1.5]]]], [["r", "insert", 1.5]],
[["r", "insert", ["set", [3]]]], [["r", "insert", 3]],
[["r", "delete", ["set", [1.5, 3.5]]]], [["r", "delete", ["set", [1.5, 3.5]]]],
[["r", "delete", ["set", [0.5, 1.5, 2.5]]]]]' \ [["r", "delete", ["set", [0.5, 1.5, 2.5]]]]]' \
'[{"r": ["set", []]}, '[{"r": ["set", []]},
{"r": ["set", [0.5]]}, {"r": 0.5},
{"r": ["set", [0.5, 1.5]]}, {"r": ["set", [0.5, 1.5]]},
{"r": ["set", [0.5, 1.5, 2.5]]}']]], {"r": ["set", [0.5, 1.5, 2.5]]}']]],
[[mutation 0: [[mutation 0:
row 0: no change row 0: no change
row 1: {"r":["set",[1]]} row 1: {"r":1}
row 2: {"r":["set",[1,2]]} row 2: {"r":["set",[1,2]]}
row 3: {"r":["set",[1,2,3]]} row 3: {"r":["set",[1,2,3]]}
mutation 1: mutation 1:
row 0: no change row 0: no change
row 1: {"r":["set",[-1]]} row 1: {"r":-1}
row 2: {"r":["set",[-1,0]]} row 2: {"r":["set",[-1,0]]}
row 3: {"r":["set",[-1,0,1]]} row 3: {"r":["set",[-1,0,1]]}
mutation 2: mutation 2:
row 0: no change row 0: no change
row 1: {"r":["set",[1.25]]} row 1: {"r":1.25}
row 2: {"r":["set",[1.25,3.75]]} row 2: {"r":["set",[1.25,3.75]]}
row 3: constraint violation: 6.25 is greater than maximum allowed value 6 row 3: constraint violation: 6.25 is greater than maximum allowed value 6
mutation 3: mutation 3:
row 0: no change row 0: no change
row 1: {"r":["set",[0.125]]} row 1: {"r":0.125}
row 2: {"r":["set",[0.125,0.375]]} row 2: {"r":["set",[0.125,0.375]]}
row 3: {"r":["set",[0.125,0.375,0.625]]} row 3: {"r":["set",[0.125,0.375,0.625]]}
mutation 4: mutation 4:
row 0: no change row 0: no change
row 1: {"r":["set",[0]]} row 1: {"r":0}
row 2: constraint violation: Result of "*=" operation contains duplicates. row 2: constraint violation: Result of "*=" operation contains duplicates.
row 3: constraint violation: Result of "*=" operation contains duplicates. row 3: constraint violation: Result of "*=" operation contains duplicates.
mutation 5: mutation 5:
row 0: {"r":["set",[1.5]]} row 0: {"r":1.5}
row 1: {"r":["set",[0.5,1.5]]} row 1: {"r":["set",[0.5,1.5]]}
row 2: no change row 2: no change
row 3: no change row 3: no change
mutation 6: mutation 6:
row 0: {"r":["set",[3]]} row 0: {"r":3}
row 1: {"r":["set",[0.5,3]]} row 1: {"r":["set",[0.5,3]]}
row 2: {"r":["set",[0.5,1.5,3]]} row 2: {"r":["set",[0.5,1.5,3]]}
row 3: {"r":["set",[0.5,1.5,2.5,3]]} row 3: {"r":["set",[0.5,1.5,2.5,3]]}
@@ -565,7 +565,7 @@ row 3: {"r":["set",[0.5,1.5,2.5,3]]}
mutation 7: mutation 7:
row 0: no change row 0: no change
row 1: no change row 1: no change
row 2: {"r":["set",[0.5]]} row 2: {"r":0.5}
row 3: {"r":["set",[0.5,2.5]]} row 3: {"r":["set",[0.5,2.5]]}
mutation 8: mutation 8:
@@ -589,13 +589,13 @@ OVSDB_CHECK_POSITIVE([executing mutations on boolean sets],
{"b": ["set", [true]]}, {"b": ["set", [true]]},
{"b": ["set", [false, true]]}']]], {"b": ["set", [false, true]]}']]],
[[mutation 0: [[mutation 0:
row 0: {"b":["set",[false]]} row 0: {"b":false}
row 1: no change row 1: no change
row 2: {"b":["set",[false,true]]} row 2: {"b":["set",[false,true]]}
row 3: no change row 3: no change
mutation 1: mutation 1:
row 0: {"b":["set",[true]]} row 0: {"b":true}
row 1: {"b":["set",[false,true]]} row 1: {"b":["set",[false,true]]}
row 2: no change row 2: no change
row 3: no change row 3: no change
@@ -610,13 +610,13 @@ mutation 3:
row 0: no change row 0: no change
row 1: {"b":["set",[]]} row 1: {"b":["set",[]]}
row 2: no change row 2: no change
row 3: {"b":["set",[true]]} row 3: {"b":true}
mutation 4: mutation 4:
row 0: no change row 0: no change
row 1: no change row 1: no change
row 2: {"b":["set",[]]} row 2: {"b":["set",[]]}
row 3: {"b":["set",[false]]} row 3: {"b":false}
mutation 5: mutation 5:
row 0: no change row 0: no change
@@ -639,13 +639,13 @@ OVSDB_CHECK_POSITIVE([executing mutations on string sets],
{"s": ["set", ["a", "b"]]}, {"s": ["set", ["a", "b"]]},
{"s": ["set", ["a", "b", "c", "d"]]}']]], {"s": ["set", ["a", "b", "c", "d"]]}']]],
[[mutation 0: [[mutation 0:
row 0: {"s":["set",["a"]]} row 0: {"s":"a"}
row 1: no change row 1: no change
row 2: no change row 2: no change
row 3: no change row 3: no change
mutation 1: mutation 1:
row 0: {"s":["set",["b"]]} row 0: {"s":"b"}
row 1: {"s":["set",["a","b"]]} row 1: {"s":["set",["a","b"]]}
row 2: no change row 2: no change
row 3: no change row 3: no change
@@ -659,13 +659,13 @@ row 3: no change
mutation 3: mutation 3:
row 0: no change row 0: no change
row 1: {"s":["set",[]]} row 1: {"s":["set",[]]}
row 2: {"s":["set",["b"]]} row 2: {"s":"b"}
row 3: {"s":["set",["b","c","d"]]} row 3: {"s":["set",["b","c","d"]]}
mutation 4: mutation 4:
row 0: no change row 0: no change
row 1: no change row 1: no change
row 2: {"s":["set",["a"]]} row 2: {"s":"a"}
row 3: {"s":["set",["a","c","d"]]} row 3: {"s":["set",["a","c","d"]]}
mutation 5: mutation 5:
@@ -689,19 +689,19 @@ OVSDB_CHECK_POSITIVE([executing mutations on uuid sets],
{"u": ["set", [["uuid", "a60fe7ff-317b-4568-9106-892b37445313"]]]}, {"u": ["set", [["uuid", "a60fe7ff-317b-4568-9106-892b37445313"]]]},
{"u": ["set", [["uuid", "2607d30e-e652-4927-9fec-8bbf1b60c7e9"]]]}']]], {"u": ["set", [["uuid", "2607d30e-e652-4927-9fec-8bbf1b60c7e9"]]]}']]],
[[mutation 0: [[mutation 0:
row 0: {"u":["set",[["uuid","ddd9e79d-7782-414c-8b22-1046c60b6ec2"]]]} row 0: {"u":["uuid","ddd9e79d-7782-414c-8b22-1046c60b6ec2"]}
row 1: no change row 1: no change
row 2: {"u":["set",[["uuid","a60fe7ff-317b-4568-9106-892b37445313"],["uuid","ddd9e79d-7782-414c-8b22-1046c60b6ec2"]]]} row 2: {"u":["set",[["uuid","a60fe7ff-317b-4568-9106-892b37445313"],["uuid","ddd9e79d-7782-414c-8b22-1046c60b6ec2"]]]}
row 3: {"u":["set",[["uuid","2607d30e-e652-4927-9fec-8bbf1b60c7e9"],["uuid","ddd9e79d-7782-414c-8b22-1046c60b6ec2"]]]} row 3: {"u":["set",[["uuid","2607d30e-e652-4927-9fec-8bbf1b60c7e9"],["uuid","ddd9e79d-7782-414c-8b22-1046c60b6ec2"]]]}
mutation 1: mutation 1:
row 0: {"u":["set",[["uuid","a60fe7ff-317b-4568-9106-892b37445313"]]]} row 0: {"u":["uuid","a60fe7ff-317b-4568-9106-892b37445313"]}
row 1: {"u":["set",[["uuid","a60fe7ff-317b-4568-9106-892b37445313"],["uuid","ddd9e79d-7782-414c-8b22-1046c60b6ec2"]]]} row 1: {"u":["set",[["uuid","a60fe7ff-317b-4568-9106-892b37445313"],["uuid","ddd9e79d-7782-414c-8b22-1046c60b6ec2"]]]}
row 2: no change row 2: no change
row 3: {"u":["set",[["uuid","2607d30e-e652-4927-9fec-8bbf1b60c7e9"],["uuid","a60fe7ff-317b-4568-9106-892b37445313"]]]} row 3: {"u":["set",[["uuid","2607d30e-e652-4927-9fec-8bbf1b60c7e9"],["uuid","a60fe7ff-317b-4568-9106-892b37445313"]]]}
mutation 2: mutation 2:
row 0: {"u":["set",[["uuid","2607d30e-e652-4927-9fec-8bbf1b60c7e9"]]]} row 0: {"u":["uuid","2607d30e-e652-4927-9fec-8bbf1b60c7e9"]}
row 1: {"u":["set",[["uuid","2607d30e-e652-4927-9fec-8bbf1b60c7e9"],["uuid","ddd9e79d-7782-414c-8b22-1046c60b6ec2"]]]} row 1: {"u":["set",[["uuid","2607d30e-e652-4927-9fec-8bbf1b60c7e9"],["uuid","ddd9e79d-7782-414c-8b22-1046c60b6ec2"]]]}
row 2: {"u":["set",[["uuid","2607d30e-e652-4927-9fec-8bbf1b60c7e9"],["uuid","a60fe7ff-317b-4568-9106-892b37445313"]]]} row 2: {"u":["set",[["uuid","2607d30e-e652-4927-9fec-8bbf1b60c7e9"],["uuid","a60fe7ff-317b-4568-9106-892b37445313"]]]}
row 3: no change row 3: no change

View File

@@ -84,7 +84,7 @@ OVSDB_CHECK_POSITIVE([row with set of 1 to 2 elements],
[[parse-rows \ [[parse-rows \
'{"columns": {"myset": {"type": {"key": "integer", "min": 1, "max": 2}}}}' \ '{"columns": {"myset": {"type": {"key": "integer", "min": 1, "max": 2}}}}' \
'{}']], '{}']],
[{RESERVED_COLUMNS,["myset":["set",[0]]]} [{RESERVED_COLUMNS,["myset":0]}
<none>]) <none>])
OVSDB_CHECK_POSITIVE([row with map of 1 to 2 elements], OVSDB_CHECK_POSITIVE([row with map of 1 to 2 elements],
@@ -108,10 +108,10 @@ OVSDB_CHECK_POSITIVE([row with several columns],
"snoops": {"type": {"key": "uuid", "min": 0, "max": "unlimited"}}}}' \ "snoops": {"type": {"key": "uuid", "min": 0, "max": "unlimited"}}}}' \
'{"vswitch": ["uuid", "1a5c7280-0d4c-4e34-9ec7-c772339f7774"], '{"vswitch": ["uuid", "1a5c7280-0d4c-4e34-9ec7-c772339f7774"],
"name": "br0", "name": "br0",
"datapath_id": ["set", ["000ae4256bb0"]], "datapath_id": "000ae4256bb0",
"hwaddr": "00:0a:e4:25:6b:b0"}' \ "hwaddr": "00:0a:e4:25:6b:b0"}' \
'{}']], '{}']],
[{RESERVED_COLUMNS,["controller":["set",[]],"datapath_id":["set",["000ae4256bb0"]],"hwaddr":"00:0a:e4:25:6b:b0","listeners":["set",[]],"mirrors":["set",[]],"name":"br0","netflows":["set",[]],"snoops":["set",[]],"vswitch":["uuid","1a5c7280-0d4c-4e34-9ec7-c772339f7774"]]} [{RESERVED_COLUMNS,["controller":["set",[]],"datapath_id":"000ae4256bb0","hwaddr":"00:0a:e4:25:6b:b0","listeners":["set",[]],"mirrors":["set",[]],"name":"br0","netflows":["set",[]],"snoops":["set",[]],"vswitch":["uuid","1a5c7280-0d4c-4e34-9ec7-c772339f7774"]]}
datapath_id, hwaddr, name, vswitch datapath_id, hwaddr, name, vswitch
{RESERVED_COLUMNS,["controller":["set",[]],"datapath_id":["set",[]],"hwaddr":"","listeners":["set",[]],"mirrors":["set",[]],"name":"","netflows":["set",[]],"snoops":["set",[]],"vswitch":["uuid","00000000-0000-0000-0000-000000000000"]]} {RESERVED_COLUMNS,["controller":["set",[]],"datapath_id":["set",[]],"hwaddr":"","listeners":["set",[]],"mirrors":["set",[]],"name":"","netflows":["set",[]],"snoops":["set",[]],"vswitch":["uuid","00000000-0000-0000-0000-000000000000"]]}
<none>], [], [2.64]) <none>], [], [2.64])