1 AT_BANNER([OVSDB -- interface description language (IDL) - Python])
3 # OVSDB_CHECK_IDL(TITLE, [PRE-IDL-TXN], TRANSACTIONS, OUTPUT, [KEYWORDS],
6 # Creates a database with a schema derived from idltest.ovsidl, runs
7 # each PRE-IDL-TXN (if any), starts an ovsdb-server on that database,
8 # and runs "test-ovsdb idl" passing each of the TRANSACTIONS along.
10 # Checks that the overall output is OUTPUT. Before comparison, the
11 # output is sorted (using "sort") and UUIDs in the output are replaced
12 # by markers of the form <N> where N is a number. The first unique
13 # UUID is replaced by <0>, the next by <1>, and so on. If a given
14 # UUID appears more than once it is always replaced by the same
15 # marker. If FILTER is supplied then the output is also filtered
16 # through the specified program.
18 # TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS.
19 m4_define([OVSDB_CHECK_IDL_PY],
21 AT_SKIP_IF([test $HAVE_PYTHON = no])
22 AT_KEYWORDS([ovsdb server idl positive Python $5])
23 AT_CHECK([ovsdb-tool create db $abs_srcdir/idltest.ovsschema],
24 [0], [stdout], [ignore])
25 AT_CHECK([ovsdb-server '-vPATTERN:console:ovsdb-server|%c|%m' --detach --pidfile=$PWD/pid --remote=punix:socket --unixctl=$PWD/unixctl db], [0], [ignore], [ignore])
27 [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore], [kill `cat pid`])])
28 AT_CHECK([$PYTHON $srcdir/test-ovsdb.py -t10 idl unix:socket $3],
29 [0], [stdout], [ignore], [kill `cat pid`])
30 AT_CHECK([sort stdout | perl $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]),
31 [0], [$4], [], [kill `cat pid`])
35 OVSDB_CHECK_IDL_PY([simple idl, initially empty, no ops - Python],
42 OVSDB_CHECK_IDL([simple idl, initially empty, various ops - Python],
51 "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"],
52 "ia": ["set", [1, 2, 3]],
53 "ra": ["set", [-0.5]],
54 "ba": ["set", [true, false]],
55 "sa": ["set", ["abc", "def"]],
56 "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
57 ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
65 "row": {"b": true}}]' \
70 "row": {"r": 123.5}}]' \
80 "ba": ["set", [false]],
82 "ua": ["set", []]}}]' \
86 "where": [["i", "<", 1]],
87 "row": {"s": "newstring"}}]' \
91 "where": [["i", "==", 0]]}]' \
94 001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]}
95 002: i=0 r=0 b=false s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
96 002: i=1 r=2 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[false true] sa=[abc def] ua=[<4> <5>] uuid=<0>
97 003: {"error":null,"result":[{"count":2}]}
98 004: i=0 r=0 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
99 004: i=1 r=2 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[false true] sa=[abc def] ua=[<4> <5>] uuid=<0>
100 005: {"error":null,"result":[{"count":2}]}
101 006: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
102 006: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[false true] sa=[abc def] ua=[<4> <5>] uuid=<0>
103 007: {"error":null,"result":[{"uuid":["uuid","<6>"]}]}
104 008: i=-1 r=125 b=false s= u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
105 008: i=0 r=123.5 b=true s= u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
106 008: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[false true] sa=[abc def] ua=[<4> <5>] uuid=<0>
107 009: {"error":null,"result":[{"count":2}]}
108 010: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
109 010: i=0 r=123.5 b=true s=newstring u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
110 010: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[false true] sa=[abc def] ua=[<4> <5>] uuid=<0>
111 011: {"error":null,"result":[{"count":1}]}
112 012: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
113 012: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[false true] sa=[abc def] ua=[<4> <5>] uuid=<0>
115 014: i=-1 r=125 b=false s=newstring u=<2> ia=[1] ra=[1.5] ba=[false] sa=[] ua=[] uuid=<6>
116 014: i=1 r=123.5 b=true s=mystring u=<3> ia=[1 2 3] ra=[-0.5] ba=[false true] sa=[abc def] ua=[<4> <5>] uuid=<0>
120 OVSDB_CHECK_IDL([simple idl, initially populated - Python],
128 "u": ["uuid", "84f5c8f5-ac76-4dbc-a24f-8860eb407fc1"],
129 "ia": ["set", [1, 2, 3]],
130 "ra": ["set", [-0.5]],
131 "ba": ["set", [true, false]],
132 "sa": ["set", ["abc", "def"]],
133 "ua": ["set", [["uuid", "69443985-7806-45e2-b35f-574a04e720f9"],
134 ["uuid", "aad11ef0-816a-4b01-93e6-03b8b4256b98"]]]}},
142 "row": {"b": true}}]']],
143 [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
144 000: i=1 r=2 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[false true] sa=[abc def] ua=[<3> <4>] uuid=<5>
145 001: {"error":null,"result":[{"count":2}]}
146 002: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
147 002: i=1 r=2 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[false true] sa=[abc def] ua=[<3> <4>] uuid=<5>