2012-02-16 19:15:01 -08:00
|
|
|
AT_BANNER([unixctl])
|
|
|
|
|
2012-03-06 16:10:46 -08:00
|
|
|
m4_define([APPCTL], [ovs-appctl --timeout 20])
|
|
|
|
m4_define([PYAPPCTL], [$PYTHON $srcdir/appctl.py --timeout 20])
|
|
|
|
|
2012-02-16 19:15:01 -08:00
|
|
|
AT_SETUP([unixctl ovs-vswitchd exit - Python])
|
|
|
|
AT_SKIP_IF([test $HAVE_PYTHON = no])
|
|
|
|
OVS_VSWITCHD_START
|
|
|
|
|
2012-03-06 16:10:46 -08:00
|
|
|
AT_CHECK([PYAPPCTL -t ovs-vswitchd exit], [0], [])
|
2012-02-16 19:15:01 -08:00
|
|
|
OVS_WAIT_WHILE([test -s ovs-vswitchd.pid])
|
|
|
|
|
2012-03-06 16:10:46 -08:00
|
|
|
AT_CHECK([PYAPPCTL -t ovsdb-server exit], [0], [])
|
2012-02-16 19:15:01 -08:00
|
|
|
OVS_WAIT_WHILE([test -s ovsdb-server.pid])
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
AT_SETUP([unixctl ovs-vswitchd help - Python])
|
|
|
|
AT_SKIP_IF([test $HAVE_PYTHON = no])
|
|
|
|
OVS_VSWITCHD_START
|
|
|
|
|
2012-03-06 16:10:46 -08:00
|
|
|
AT_CHECK([APPCTL help], [0], [stdout])
|
2012-02-16 19:15:01 -08:00
|
|
|
AT_CHECK([head -1 stdout], [0], [dnl
|
|
|
|
The available commands are:
|
|
|
|
])
|
|
|
|
mv stdout expout
|
2012-03-06 16:10:46 -08:00
|
|
|
AT_CHECK([PYAPPCTL help], [0], [expout])
|
2012-02-16 19:15:01 -08:00
|
|
|
|
|
|
|
OVS_VSWITCHD_STOP
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
|
|
|
|
AT_SETUP([unixctl ovs-vswitchd arguments - Python])
|
|
|
|
AT_SKIP_IF([test $HAVE_PYTHON = no])
|
|
|
|
OVS_VSWITCHD_START
|
|
|
|
|
2012-03-06 16:10:46 -08:00
|
|
|
AT_CHECK([APPCTL bond/hash], [2], [], [stderr])
|
2012-02-16 19:15:01 -08:00
|
|
|
AT_CHECK([head -1 stderr], [0], [dnl
|
|
|
|
"bond/hash" command requires at least 1 arguments
|
|
|
|
])
|
|
|
|
sed 's/ovs-appctl/appctl.py/' stderr > experr
|
2012-03-06 16:10:46 -08:00
|
|
|
AT_CHECK([PYAPPCTL bond/hash], [2], [], [experr])
|
2012-02-16 19:15:01 -08:00
|
|
|
|
2012-03-06 16:10:46 -08:00
|
|
|
AT_CHECK([APPCTL bond/hash mac], [2], [], [stderr])
|
2012-02-16 19:15:01 -08:00
|
|
|
AT_CHECK([head -1 stderr], [0], [dnl
|
|
|
|
invalid mac
|
|
|
|
])
|
|
|
|
sed 's/ovs-appctl/appctl.py/' stderr > experr
|
2012-03-06 16:10:46 -08:00
|
|
|
AT_CHECK([PYAPPCTL bond/hash mac], [2], [], [experr])
|
2012-02-16 19:15:01 -08:00
|
|
|
|
2012-03-06 16:10:46 -08:00
|
|
|
AT_CHECK([APPCTL bond/hash mac vlan], [2], [], [stderr])
|
2012-02-16 19:15:01 -08:00
|
|
|
AT_CHECK([head -1 stderr], [0], [dnl
|
|
|
|
invalid vlan
|
|
|
|
])
|
|
|
|
sed 's/ovs-appctl/appctl.py/' stderr > experr
|
2012-03-06 16:10:46 -08:00
|
|
|
AT_CHECK([PYAPPCTL bond/hash mac vlan], [2], [], [experr])
|
2012-02-16 19:15:01 -08:00
|
|
|
|
2012-03-06 16:10:46 -08:00
|
|
|
AT_CHECK([APPCTL bond/hash mac vlan basis], [2], [], [stderr])
|
2012-02-16 19:15:01 -08:00
|
|
|
AT_CHECK([head -1 stderr], [0], [dnl
|
|
|
|
invalid vlan
|
|
|
|
])
|
|
|
|
sed 's/ovs-appctl/appctl.py/' stderr > experr
|
2012-03-06 16:10:46 -08:00
|
|
|
AT_CHECK([PYAPPCTL bond/hash vlan basis], [2], [], [experr])
|
2012-02-16 19:15:01 -08:00
|
|
|
|
2012-03-06 16:10:46 -08:00
|
|
|
AT_CHECK([APPCTL bond/hash mac vlan basis extra], [2], [], [stderr])
|
2012-02-16 19:15:01 -08:00
|
|
|
AT_CHECK([head -1 stderr], [0], [dnl
|
|
|
|
"bond/hash" command takes at most 3 arguments
|
|
|
|
])
|
|
|
|
sed 's/ovs-appctl/appctl.py/' stderr > experr
|
2012-03-06 16:10:46 -08:00
|
|
|
AT_CHECK([PYAPPCTL bond/hash mac vlan basis extra], [2], [], [experr])
|
2012-02-16 19:15:01 -08:00
|
|
|
|
|
|
|
OVS_VSWITCHD_STOP
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
AT_SETUP([unixctl bad target - Python])
|
2012-03-12 10:23:36 -07:00
|
|
|
OVS_RUNDIR=`pwd`; export OVS_RUNDIR
|
2012-02-16 19:15:01 -08:00
|
|
|
AT_SKIP_IF([test $HAVE_PYTHON = no])
|
|
|
|
|
2012-03-06 16:10:46 -08:00
|
|
|
AT_CHECK([PYAPPCTL -t bogus doit], [1], [], [stderr])
|
2012-02-16 19:15:01 -08:00
|
|
|
AT_CHECK_UNQUOTED([tail -1 stderr], [0], [dnl
|
2012-03-12 10:23:36 -07:00
|
|
|
appctl.py: cannot read pidfile "`pwd`/bogus.pid" (No such file or directory)
|
2012-02-16 19:15:01 -08:00
|
|
|
])
|
|
|
|
|
2012-03-06 16:10:46 -08:00
|
|
|
AT_CHECK([PYAPPCTL -t /bogus/path.pid doit], [1], [], [stderr])
|
2012-02-16 19:15:01 -08:00
|
|
|
AT_CHECK([tail -1 stderr], [0], [dnl
|
|
|
|
appctl.py: cannot connect to "/bogus/path.pid" (No such file or directory)
|
|
|
|
])
|
|
|
|
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
AT_SETUP([unixctl server - Python])
|
|
|
|
AT_SKIP_IF([test $HAVE_PYTHON = no])
|
2012-03-12 10:23:36 -07:00
|
|
|
OVS_RUNDIR=`pwd`; export OVS_RUNDIR
|
|
|
|
OVS_LOGDIR=`pwd`; export OVS_LOGDIR
|
|
|
|
OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
|
2012-02-16 19:15:01 -08:00
|
|
|
trap 'kill `cat test-unixctl.py.pid`' 0
|
2012-03-12 10:23:36 -07:00
|
|
|
AT_CAPTURE_FILE([`pwd`/test-unixctl.py.log])
|
2012-02-16 19:15:01 -08:00
|
|
|
AT_CHECK([$PYTHON $srcdir/test-unixctl.py --log-file --pidfile --detach])
|
|
|
|
|
2012-03-06 16:10:46 -08:00
|
|
|
AT_CHECK([APPCTL -t test-unixctl.py help], [0], [stdout])
|
2012-02-16 19:15:01 -08:00
|
|
|
AT_CHECK([cat stdout], [0], [dnl
|
|
|
|
The available commands are:
|
2012-03-06 16:10:46 -08:00
|
|
|
block
|
2012-02-16 19:15:01 -08:00
|
|
|
echo [[arg ...]]
|
|
|
|
echo_error [[arg ...]]
|
|
|
|
exit
|
|
|
|
help
|
|
|
|
version
|
|
|
|
])
|
|
|
|
mv stdout expout
|
2012-03-06 16:10:46 -08:00
|
|
|
AT_CHECK([PYAPPCTL -t test-unixctl.py help], [0], [expout])
|
2012-02-16 19:15:01 -08:00
|
|
|
|
2012-03-07 15:48:32 -08:00
|
|
|
AT_CHECK([ovs-vsctl --version | sed 's/ovs-vsctl/test-unixctl.py/' | head -1 > expout])
|
2012-03-06 16:10:46 -08:00
|
|
|
AT_CHECK([APPCTL -t test-unixctl.py version], [0], [expout])
|
|
|
|
AT_CHECK([PYAPPCTL -t test-unixctl.py version], [0], [expout])
|
2012-02-16 19:15:01 -08:00
|
|
|
|
2012-03-06 16:10:46 -08:00
|
|
|
AT_CHECK([APPCTL -t test-unixctl.py echo robot ninja], [0], [stdout])
|
2012-02-16 19:15:01 -08:00
|
|
|
AT_CHECK([cat stdout], [0], [dnl
|
|
|
|
[[u'robot', u'ninja']]
|
|
|
|
])
|
|
|
|
mv stdout expout
|
2012-03-06 16:10:46 -08:00
|
|
|
AT_CHECK([PYAPPCTL -t test-unixctl.py echo robot ninja], [0], [expout])
|
2012-02-16 19:15:01 -08:00
|
|
|
|
2012-03-06 16:10:46 -08:00
|
|
|
AT_CHECK([APPCTL -t test-unixctl.py echo_error robot ninja], [2], [], [stderr])
|
2012-02-16 19:15:01 -08:00
|
|
|
AT_CHECK([cat stderr], [0], [dnl
|
|
|
|
[[u'robot', u'ninja']]
|
|
|
|
ovs-appctl: test-unixctl.py: server returned an error
|
|
|
|
])
|
|
|
|
sed 's/ovs-appctl/appctl.py/' stderr > experr
|
2012-03-06 16:10:46 -08:00
|
|
|
AT_CHECK([PYAPPCTL -t test-unixctl.py echo_error robot ninja], [2], [], [experr])
|
2012-02-16 19:15:01 -08:00
|
|
|
|
2012-03-06 16:10:46 -08:00
|
|
|
AT_CHECK([APPCTL -t test-unixctl.py echo], [2], [], [stderr])
|
2012-02-16 19:15:01 -08:00
|
|
|
AT_CHECK([cat stderr], [0], [dnl
|
|
|
|
"echo" command requires at least 1 arguments
|
|
|
|
ovs-appctl: test-unixctl.py: server returned an error
|
|
|
|
])
|
|
|
|
sed 's/ovs-appctl/appctl.py/' stderr > experr
|
2012-03-06 16:10:46 -08:00
|
|
|
AT_CHECK([PYAPPCTL -t test-unixctl.py echo], [2], [], [experr])
|
2012-02-16 19:15:01 -08:00
|
|
|
|
2012-03-06 16:10:46 -08:00
|
|
|
AT_CHECK([APPCTL -t test-unixctl.py echo robot ninja pirates], [2], [], [stderr])
|
2012-02-16 19:15:01 -08:00
|
|
|
AT_CHECK([cat stderr], [0], [dnl
|
|
|
|
"echo" command takes at most 2 arguments
|
|
|
|
ovs-appctl: test-unixctl.py: server returned an error
|
|
|
|
])
|
|
|
|
sed 's/ovs-appctl/appctl.py/' stderr > experr
|
2012-03-06 16:10:46 -08:00
|
|
|
AT_CHECK([PYAPPCTL -t test-unixctl.py echo robot ninja pirates], [2], [], [experr])
|
2012-02-16 19:15:01 -08:00
|
|
|
|
2012-03-06 16:10:46 -08:00
|
|
|
AT_CHECK([APPCTL -t test-unixctl.py bogus], [2], [], [stderr])
|
2012-02-16 19:15:01 -08:00
|
|
|
AT_CHECK([cat stderr], [0], [dnl
|
|
|
|
"bogus" is not a valid command
|
|
|
|
ovs-appctl: test-unixctl.py: server returned an error
|
|
|
|
])
|
|
|
|
sed 's/ovs-appctl/appctl.py/' stderr > experr
|
2012-03-06 16:10:46 -08:00
|
|
|
AT_CHECK([PYAPPCTL -t test-unixctl.py bogus], [2], [], [experr])
|
2012-02-16 19:15:01 -08:00
|
|
|
|
2012-03-06 16:10:46 -08:00
|
|
|
AT_CHECK([APPCTL -t test-unixctl.py exit])
|
2012-02-16 19:15:01 -08:00
|
|
|
trap '' 0]
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
|
|
|
|
AT_SETUP([unixctl server errors - Python])
|
|
|
|
AT_SKIP_IF([test $HAVE_PYTHON = no])
|
2012-03-12 10:23:36 -07:00
|
|
|
AT_CHECK($PYTHON $srcdir/test-unixctl.py --unixctl "`pwd`"/bogus/path, [1], [], [ignore])
|
2012-02-16 19:15:01 -08:00
|
|
|
AT_CLEANUP
|