1 AT_BANNER([JSON-RPC - Python])
3 m4_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])
7 AT_CHECK([$PYTHON $srcdir/test-jsonrpc.py --pidfile --detach listen punix:socket])
8 on_exit 'kill `cat test-jsonrpc.py.pid`'
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}]}
15 JSONRPC_REQ_REPLY_SUCCESS_PYN([Python2], [$HAVE_PYTHON], [$PYTHON])
16 JSONRPC_REQ_REPLY_SUCCESS_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
18 m4_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])
22 AT_CHECK([$PYTHON $srcdir/test-jsonrpc.py --pidfile --detach listen punix:socket])
23 on_exit 'kill `cat test-jsonrpc.py.pid`'
25 [[$3 $srcdir/test-jsonrpc.py request unix:socket bad-request '[]']], [0],
26 [[{"error":{"error":"unknown method"},"id":0,"result":null}
30 JSONRPC_REQ_REPLY_ERROR_PYN([Python2], [$HAVE_PYTHON], [$PYTHON])
31 JSONRPC_REQ_REPLY_ERROR_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
33 m4_define([JSONRPC_NOTIFICATION_PYN],
34 [AT_SETUP([JSON-RPC notification - $1])
35 AT_SKIP_IF([test $2 = no])
36 AT_KEYWORDS([python jsonrpc])
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])
45 JSONRPC_NOTIFICATION_PYN([Python2], [$HAVE_PYTHON], [$PYTHON])
46 JSONRPC_NOTIFICATION_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])