]> git.proxmox.com Git - mirror_ovs.git/blob - tests/ovsdb-schema.at
ovs-ctl: Log messages about database upgrade process.
[mirror_ovs.git] / tests / ovsdb-schema.at
1 AT_BANNER([OVSDB -- schemas])
2
3 OVSDB_CHECK_POSITIVE_CPY([schema with valid refTables],
4 [[parse-schema \
5 '{"name": "mydb",
6 "version": "4.2.1",
7 "tables": {
8 "a": {
9 "columns": {
10 "map": {
11 "type": {
12 "key": {
13 "type": "uuid",
14 "refTable": "b"},
15 "value": {
16 "type": "uuid",
17 "refTable": "a"}}}}},
18 "b": {
19 "columns": {
20 "aRef": {
21 "type": {
22 "key": {
23 "type": "uuid",
24 "refTable": "a"}}}}}}}']],
25 [[{"name":"mydb","tables":{"a":{"columns":{"map":{"type":{"key":{"refTable":"b","type":"uuid"},"value":{"refTable":"a","type":"uuid"}}}}},"b":{"columns":{"aRef":{"type":{"key":{"refTable":"a","type":"uuid"}}}}}},"version":"4.2.1"}]])
26
27 dnl Ephemeral strong references to root set tables are OK.
28 dnl Ephemeral strong references to non-root set tables are forced to be
29 dnl persistent.
30 OVSDB_CHECK_POSITIVE_CPY([schema with ephemeral strong references],
31 [[parse-schema \
32 '{"name": "mydb",
33 "version": "4.2.1",
34 "tables": {
35 "a": {
36 "columns": {
37 "x": {
38 "type": {
39 "key": {
40 "type": "uuid",
41 "refTable": "b"}},
42 "ephemeral": true},
43 "y": {
44 "type": {
45 "key": {
46 "type": "uuid",
47 "refTable": "a"}},
48 "ephemeral": true}}},
49 "b": {
50 "columns": {
51 "aRef": {
52 "type": {
53 "key": {
54 "type": "uuid",
55 "refTable": "a"}}}},
56 "isRoot": true}}}']],
57 [[{"name":"mydb","tables":{"a":{"columns":{"x":{"ephemeral":true,"type":{"key":{"refTable":"b","type":"uuid"}}},"y":{"type":{"key":{"refTable":"a","type":"uuid"}}}}},"b":{"columns":{"aRef":{"type":{"key":{"refTable":"a","type":"uuid"}}}},"isRoot":true}},"version":"4.2.1"}]])
58
59 dnl Schemas without version numbers are accepted for backward
60 dnl compatibility, but this is a deprecated feature.
61 OVSDB_CHECK_POSITIVE_CPY([schema without version number],
62 [[parse-schema \
63 '{"name": "mydb",
64 "tables": {
65 "x": {
66 "columns": {
67 "y": {
68 "type": "integer"}}}}}']],
69 [{"name":"mydb","tables":{"x":{"columns":{"y":{"type":"integer"}}}}}])
70
71 OVSDB_CHECK_NEGATIVE_CPY([schema with invalid refTables],
72 [[parse-schema \
73 '{"name": "mydb",
74 "tables": {
75 "a": {
76 "columns": {
77 "map": {
78 "type": {
79 "key": {
80 "type": "uuid",
81 "refTable": "c"},
82 "value": {
83 "type": "uuid",
84 "refTable": "a"}}}}},
85 "b": {
86 "columns": {
87 "aRef": {
88 "type": {
89 "key": {
90 "type": "uuid",
91 "refTable": "a"}}}}}}}']],
92 [[syntax error: column map key refers to undefined table c]])
93
94 OVSDB_CHECK_NEGATIVE_CPY([schema with invalid version number],
95 [[parse-schema \
96 '{"name": "mydb",
97 "tables": {
98 "x": {
99 "columns": {
100 "y": {
101 "type": "integer"}}}},
102 "version": "xxx"}']],
103 [[schema version "xxx" not in format x.y.z]])