]> git.proxmox.com Git - ovs.git/blob - tests/ovsdb-schema.at
Fix ovs-dpctl-top by removing 3 wrong hunks in py3-compat.patch.
[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 Immutable weak references are forced to be mutable.
60 OVSDB_CHECK_POSITIVE_CPY([schema with immutable weak references],
61 [[parse-schema \
62 '{"name": "mydb",
63 "version": "4.2.1",
64 "tables": {
65 "a": {
66 "columns": {
67 "x": {
68 "type": {
69 "key": {
70 "type": "uuid",
71 "refTable": "a",
72 "refType": "weak"}},
73 "mutable": false}}}}}']],
74 [[{"name":"mydb","tables":{"a":{"columns":{"x":{"type":{"key":{"refTable":"a","refType":"weak","type":"uuid"}}}}}},"version":"4.2.1"}]])
75
76 dnl Schemas without version numbers are accepted for backward
77 dnl compatibility, but this is a deprecated feature.
78 OVSDB_CHECK_POSITIVE_CPY([schema without version number],
79 [[parse-schema \
80 '{"name": "mydb",
81 "tables": {
82 "x": {
83 "columns": {
84 "y": {
85 "type": "integer"}}}}}']],
86 [{"name":"mydb","tables":{"x":{"columns":{"y":{"type":"integer"}}}}}])
87
88 OVSDB_CHECK_NEGATIVE_CPY([schema with invalid refTables],
89 [[parse-schema \
90 '{"name": "mydb",
91 "tables": {
92 "a": {
93 "columns": {
94 "map": {
95 "type": {
96 "key": {
97 "type": "uuid",
98 "refTable": "c"},
99 "value": {
100 "type": "uuid",
101 "refTable": "a"}}}}},
102 "b": {
103 "columns": {
104 "aRef": {
105 "type": {
106 "key": {
107 "type": "uuid",
108 "refTable": "a"}}}}}}}']],
109 [[syntax error: column map key refers to undefined table c]])
110
111 OVSDB_CHECK_NEGATIVE_CPY([schema with invalid version number],
112 [[parse-schema \
113 '{"name": "mydb",
114 "tables": {
115 "x": {
116 "columns": {
117 "y": {
118 "type": "integer"}}}},
119 "version": "xxx"}']],
120 [[schema version "xxx" not in format x.y.z]])