]> git.proxmox.com Git - mirror_ovs.git/blame - tests/jsonrpc-py.at
ovn-northd: Sort options in put_dhcp(v6)_opts.
[mirror_ovs.git] / tests / jsonrpc-py.at
CommitLineData
99155935
BP
1AT_BANNER([JSON-RPC - Python])
2
58bed3df
RB
3m4_define([JSONRPC_REQ_REPLY_SUCCESS_PYN],
4 [AT_SETUP([JSON-RPC request and successful reply - $1])
5 AT_SKIP_IF([test $2 = no])
6 AT_KEYWORDS([python jsonrpc])
56120500
BP
7 AT_CHECK([$PYTHON $srcdir/test-jsonrpc.py --pidfile --detach listen punix:socket])
8 on_exit 'kill `cat test-jsonrpc.py.pid`'
58bed3df
RB
9 AT_CHECK(
10 [[$3 $srcdir/test-jsonrpc.py request unix:socket echo '[{"a": "b", "x": null}]']], [0],
11 [[{"error":null,"id":0,"result":[{"a":"b","x":null}]}
56120500 12]])
58bed3df 13 AT_CLEANUP])
99155935 14
58bed3df
RB
15JSONRPC_REQ_REPLY_SUCCESS_PYN([Python2], [$HAVE_PYTHON], [$PYTHON])
16JSONRPC_REQ_REPLY_SUCCESS_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
17
18m4_define([JSONRPC_REQ_REPLY_ERROR_PYN],
19 [AT_SETUP([JSON-RPC request and error reply - $1])
20 AT_SKIP_IF([test $2 = no])
21 AT_KEYWORDS([python jsonrpc])
56120500
BP
22 AT_CHECK([$PYTHON $srcdir/test-jsonrpc.py --pidfile --detach listen punix:socket])
23 on_exit 'kill `cat test-jsonrpc.py.pid`'
58bed3df
RB
24 AT_CHECK(
25 [[$3 $srcdir/test-jsonrpc.py request unix:socket bad-request '[]']], [0],
26 [[{"error":{"error":"unknown method"},"id":0,"result":null}
56120500 27]])
58bed3df
RB
28 AT_CLEANUP])
29
30JSONRPC_REQ_REPLY_ERROR_PYN([Python2], [$HAVE_PYTHON], [$PYTHON])
31JSONRPC_REQ_REPLY_ERROR_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
99155935 32
58bed3df
RB
33m4_define([JSONRPC_NOTIFICATION_PYN],
34 [AT_SETUP([JSON-RPC notification - $1])
35 AT_SKIP_IF([test $2 = no])
36 AT_KEYWORDS([python jsonrpc])
56120500
BP
37 AT_CHECK([$3 $srcdir/test-jsonrpc.py --pidfile --detach listen punix:socket])
38 on_exit 'kill `cat test-jsonrpc.py.pid`'
39 AT_CHECK([test -e test-jsonrpc.py.pid])
40 AT_CHECK([[$3 $srcdir/test-jsonrpc.py notify unix:socket shutdown '[]']])
41 # Wait for test-jsonrpc to die, based on its pidfile disappearing
42 OVS_WAIT_WHILE([test -e test-jsonrpc.py.pid])
58bed3df
RB
43 AT_CLEANUP])
44
45JSONRPC_NOTIFICATION_PYN([Python2], [$HAVE_PYTHON], [$PYTHON])
46JSONRPC_NOTIFICATION_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])