d129093a216d1641b541d736196dbc4196599df8
[sliver-openvswitch.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 Schemas without version numbers are accepted for backward
28 dnl compatibility, but this is a deprecated feature.
29 OVSDB_CHECK_POSITIVE_CPY([schema without version number],
30   [[parse-schema \
31       '{"name": "mydb",
32         "tables": {
33           "x": {
34             "columns": {
35               "y": {
36                 "type": "integer"}}}}}']],
37   [{"name":"mydb","tables":{"x":{"columns":{"y":{"type":"integer"}}}}}])
38      
39 OVSDB_CHECK_NEGATIVE_CPY([schema with invalid refTables],
40   [[parse-schema \
41       '{"name": "mydb",
42         "tables": {
43           "a": {
44             "columns": {
45               "map": {
46                 "type": {
47                   "key": {
48                     "type": "uuid",
49                     "refTable": "c"},
50                   "value": {
51                     "type": "uuid",
52                     "refTable": "a"}}}}},
53           "b": {
54             "columns": {
55               "aRef": {
56                 "type": {
57                   "key": {
58                     "type": "uuid",
59                     "refTable": "a"}}}}}}}']],
60   [[syntax error: column map key refers to undefined table c]])
61      
62 OVSDB_CHECK_NEGATIVE_CPY([schema with invalid version number],
63   [[parse-schema \
64       '{"name": "mydb",
65         "tables": {
66           "x": {
67             "columns": {
68               "y": {
69                 "type": "integer"}}}},
70         "version": "xxx"}']],
71   [[schema version "xxx" not in format x.y.z]])