]> git.proxmox.com Git - mirror_ovs.git/blame - tests/unixctl-py.at
db-ctl-base: Add {in} and {not-in} set relational operators.
[mirror_ovs.git] / tests / unixctl-py.at
CommitLineData
0a68ffd2
EJ
1AT_BANNER([unixctl])
2
f4ec6ff4 3m4_define([APPCTL], [ovs-appctl --timeout 20])
1ca0323e 4m4_define([PYAPPCTL_PY], [$PYTHON3 $srcdir/appctl.py --timeout 20])
f4ec6ff4 5
1ca0323e
BP
6AT_SETUP([unixctl ovs-vswitchd exit - Python3])
7AT_KEYWORDS([python unixctl])
8OVS_VSWITCHD_START
0a68ffd2 9
1ca0323e
BP
10AT_CHECK([PYAPPCTL_PY -t ovs-vswitchd exit], [0], [])
11OVS_WAIT_WHILE([test -s ovs-vswitchd.pid])
0a68ffd2 12
1ca0323e
BP
13AT_CHECK([PYAPPCTL_PY -t ovsdb-server exit], [0], [])
14OVS_WAIT_WHILE([test -s ovsdb-server.pid])
15AT_CLEANUP
0a68ffd2 16
1ca0323e
BP
17AT_SETUP([unixctl ovs-vswitchd list-commands - Python3])
18OVS_VSWITCHD_START
0a68ffd2 19
1ca0323e
BP
20AT_CHECK([APPCTL list-commands], [0], [stdout])
21AT_CHECK([head -1 stdout], [0], [dnl
0a68ffd2
EJ
22The available commands are:
23])
1ca0323e
BP
24mv stdout expout
25AT_CHECK([PYAPPCTL_PY list-commands], [0], [expout])
0a68ffd2 26
1ca0323e
BP
27OVS_VSWITCHD_STOP
28AT_CLEANUP]
0a68ffd2 29
1ca0323e
BP
30AT_SETUP([unixctl ovs-vswitchd arguments - Python3])
31OVS_VSWITCHD_START
0a68ffd2 32
1ca0323e
BP
33AT_CHECK([APPCTL bond/hash], [2], [], [stderr])
34AT_CHECK([head -1 stderr], [0], [dnl
0a68ffd2
EJ
35"bond/hash" command requires at least 1 arguments
36])
1ca0323e
BP
37sed 's/ovs-appctl/appctl.py/' stderr > experr
38AT_CHECK([PYAPPCTL_PY bond/hash], [2], [], [experr])
0a68ffd2 39
1ca0323e
BP
40AT_CHECK([APPCTL bond/hash mac], [2], [], [stderr])
41AT_CHECK([head -1 stderr], [0], [dnl
0a68ffd2
EJ
42invalid mac
43])
1ca0323e
BP
44sed 's/ovs-appctl/appctl.py/' stderr > experr
45AT_CHECK([PYAPPCTL_PY bond/hash mac], [2], [], [experr])
0a68ffd2 46
1ca0323e
BP
47AT_CHECK([APPCTL bond/hash mac vlan], [2], [], [stderr])
48AT_CHECK([head -1 stderr], [0], [dnl
0a68ffd2
EJ
49invalid vlan
50])
1ca0323e
BP
51sed 's/ovs-appctl/appctl.py/' stderr > experr
52AT_CHECK([PYAPPCTL_PY bond/hash mac vlan], [2], [], [experr])
0a68ffd2 53
1ca0323e
BP
54AT_CHECK([APPCTL bond/hash mac vlan basis], [2], [], [stderr])
55AT_CHECK([head -1 stderr], [0], [dnl
0a68ffd2
EJ
56invalid vlan
57])
1ca0323e
BP
58sed 's/ovs-appctl/appctl.py/' stderr > experr
59AT_CHECK([PYAPPCTL_PY bond/hash vlan basis], [2], [], [experr])
0a68ffd2 60
1ca0323e
BP
61AT_CHECK([APPCTL bond/hash mac vlan basis extra], [2], [], [stderr])
62AT_CHECK([head -1 stderr], [0], [dnl
0a68ffd2
EJ
63"bond/hash" command takes at most 3 arguments
64])
1ca0323e
BP
65sed 's/ovs-appctl/appctl.py/' stderr > experr
66AT_CHECK([PYAPPCTL_PY bond/hash mac vlan basis extra], [2], [], [experr])
0a68ffd2 67
1ca0323e
BP
68OVS_VSWITCHD_STOP
69AT_CLEANUP
0a68ffd2 70
1ca0323e
BP
71AT_SETUP([unixctl bad target - Python3])
72AT_CHECK([PYAPPCTL_PY -t bogus doit], [1], [], [stderr])
73AT_CHECK_UNQUOTED([tail -1 stderr], [0], [dnl
37d03458 74appctl.py: cannot read pidfile "`pwd`/bogus.pid" (No such file or directory)
0a68ffd2 75])
1ca0323e
BP
76if test "$IS_WIN32" = "no"; then
77 AT_CHECK([PYAPPCTL_PY -t /bogus/path.pid doit], [1], [], [stderr])
78 AT_CHECK([tail -1 stderr], [0], [dnl
0a68ffd2
EJ
79appctl.py: cannot connect to "/bogus/path.pid" (No such file or directory)
80])
1ca0323e
BP
81else
82 AT_CHECK([PYAPPCTL_PY -t c:/bogus/path.pid doit], [1], [], [stderr])
83 AT_CHECK([tail -1 stderr], [0], [dnl
07170206
PB
84appctl.py: cannot connect to "c:/bogus/path.pid" (No such file or directory)
85])
1ca0323e
BP
86fi
87AT_CLEANUP
0a68ffd2 88
1ca0323e
BP
89AT_SETUP([unixctl server - Python3])
90on_exit 'kill `cat test-unixctl.py.pid`'
91AT_CAPTURE_FILE([`pwd`/test-unixctl.py.log])
92AT_CHECK([$PYTHON3 $srcdir/test-unixctl.py --log-file --pidfile --detach --no-chdir])
0a68ffd2 93
1ca0323e
BP
94AT_CHECK([APPCTL -t test-unixctl.py help], [0], [stdout])
95AT_CHECK([cat stdout], [0], [dnl
0a68ffd2 96The available commands are:
f4ec6ff4 97 block
0a68ffd2
EJ
98 echo [[arg ...]]
99 echo_error [[arg ...]]
100 exit
101 help
8ba37945 102 log [[arg ...]]
0a68ffd2 103 version
06380128 104 vlog/close
f26ddb5b 105 vlog/list
8ba37945 106 vlog/reopen
f26ddb5b 107 vlog/set spec
0a68ffd2 108])
1ca0323e
BP
109mv stdout expout
110AT_CHECK([PYAPPCTL_PY -t test-unixctl.py help], [0], [expout])
0a68ffd2 111
1ca0323e
BP
112AT_CHECK([ovs-vsctl --version | sed 's/ovs-vsctl/test-unixctl.py/' | head -1 > expout])
113AT_CHECK([APPCTL -t test-unixctl.py version], [0], [expout])
114AT_CHECK([PYAPPCTL_PY -t test-unixctl.py version], [0], [expout])
0a68ffd2 115
1ca0323e
BP
116AT_CHECK([APPCTL -t test-unixctl.py echo robot ninja], [0], [stdout])
117AT_CHECK([cat stdout | sed -e "s/u'/'/g"], [0], [dnl
64eb96a9 118[['robot', 'ninja']]
0a68ffd2 119])
1ca0323e
BP
120mv stdout expout
121AT_CHECK([PYAPPCTL_PY -t test-unixctl.py echo robot ninja], [0], [expout])
0a68ffd2 122
1ca0323e
BP
123AT_CHECK([APPCTL -t test-unixctl.py echo_error robot ninja], [2], [], [stderr])
124AT_CHECK([cat stderr | sed -e "s/u'/'/g"], [0], [dnl
64eb96a9 125[['robot', 'ninja']]
0a68ffd2
EJ
126ovs-appctl: test-unixctl.py: server returned an error
127])
1ca0323e
BP
128sed 's/ovs-appctl/appctl.py/' stderr > experr
129AT_CHECK([PYAPPCTL_PY -t test-unixctl.py echo_error robot ninja], [2], [], [experr])
0a68ffd2 130
1ca0323e
BP
131AT_CHECK([APPCTL -t test-unixctl.py echo], [2], [], [stderr])
132AT_CHECK([cat stderr], [0], [dnl
0a68ffd2
EJ
133"echo" command requires at least 1 arguments
134ovs-appctl: test-unixctl.py: server returned an error
135])
1ca0323e
BP
136sed 's/ovs-appctl/appctl.py/' stderr > experr
137AT_CHECK([PYAPPCTL_PY -t test-unixctl.py echo], [2], [], [experr])
0a68ffd2 138
1ca0323e
BP
139AT_CHECK([APPCTL -t test-unixctl.py echo robot ninja pirates], [2], [], [stderr])
140AT_CHECK([cat stderr], [0], [dnl
0a68ffd2
EJ
141"echo" command takes at most 2 arguments
142ovs-appctl: test-unixctl.py: server returned an error
143])
1ca0323e
BP
144sed 's/ovs-appctl/appctl.py/' stderr > experr
145AT_CHECK([PYAPPCTL_PY -t test-unixctl.py echo robot ninja pirates], [2], [], [experr])
0a68ffd2 146
1ca0323e
BP
147AT_CHECK([APPCTL -t test-unixctl.py bogus], [2], [], [stderr])
148AT_CHECK([cat stderr], [0], [dnl
0a68ffd2
EJ
149"bogus" is not a valid command
150ovs-appctl: test-unixctl.py: server returned an error
151])
1ca0323e
BP
152sed 's/ovs-appctl/appctl.py/' stderr > experr
153AT_CHECK([PYAPPCTL_PY -t test-unixctl.py bogus], [2], [], [experr])
0a68ffd2 154
1ca0323e
BP
155AT_CHECK([APPCTL -t test-unixctl.py exit])
156AT_CLEANUP
0a68ffd2 157
1ca0323e
BP
158AT_SETUP([unixctl server errors - Python3])
159AT_CHECK($PYTHON3 $srcdir/test-unixctl.py --unixctl "`pwd`"/bogus/path, [1], [], [ignore])
160AT_CLEANUP