]>
Commit | Line | Data |
---|---|---|
99155935 BP |
1 | AT_BANNER([JSON-RPC - Python]) |
2 | ||
58bed3df RB |
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]) | |
44253435 | 7 | AT_CHECK([$3 $srcdir/test-jsonrpc.py --pidfile --detach listen punix:socket]) |
56120500 | 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 |
15 | JSONRPC_REQ_REPLY_SUCCESS_PYN([Python2], [$HAVE_PYTHON], [$PYTHON]) |
16 | JSONRPC_REQ_REPLY_SUCCESS_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3]) | |
17 | ||
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]) | |
44253435 | 22 | AT_CHECK([$3 $srcdir/test-jsonrpc.py --pidfile --detach listen punix:socket]) |
56120500 | 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 | ||
30 | JSONRPC_REQ_REPLY_ERROR_PYN([Python2], [$HAVE_PYTHON], [$PYTHON]) | |
31 | JSONRPC_REQ_REPLY_ERROR_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3]) | |
99155935 | 32 | |
58bed3df RB |
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]) | |
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 | ||
45 | JSONRPC_NOTIFICATION_PYN([Python2], [$HAVE_PYTHON], [$PYTHON]) | |
46 | JSONRPC_NOTIFICATION_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3]) |