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