mirror of
https://github.com/openvswitch/ovs
synced 2025-08-28 21:07:47 +00:00
160 lines
5.2 KiB
Plaintext
160 lines
5.2 KiB
Plaintext
|
AT_BANNER([unixctl])
|
||
|
|
||
|
AT_SETUP([unixctl ovs-vswitchd exit - Python])
|
||
|
AT_SKIP_IF([test $HAVE_PYTHON = no])
|
||
|
OVS_VSWITCHD_START
|
||
|
|
||
|
AT_CHECK([$PYTHON $srcdir/appctl.py -t ovs-vswitchd exit], [0], [])
|
||
|
OVS_WAIT_WHILE([test -s ovs-vswitchd.pid])
|
||
|
|
||
|
AT_CHECK([$PYTHON $srcdir/appctl.py -t ovsdb-server exit], [0], [])
|
||
|
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
|
||
|
|
||
|
AT_CHECK([ovs-appctl help], [0], [stdout])
|
||
|
AT_CHECK([head -1 stdout], [0], [dnl
|
||
|
The available commands are:
|
||
|
])
|
||
|
mv stdout expout
|
||
|
AT_CHECK([$PYTHON $srcdir/appctl.py help], [0], [expout])
|
||
|
|
||
|
OVS_VSWITCHD_STOP
|
||
|
AT_CLEANUP
|
||
|
|
||
|
|
||
|
AT_SETUP([unixctl ovs-vswitchd arguments - Python])
|
||
|
AT_SKIP_IF([test $HAVE_PYTHON = no])
|
||
|
OVS_VSWITCHD_START
|
||
|
|
||
|
AT_CHECK([ovs-appctl bond/hash], [2], [], [stderr])
|
||
|
AT_CHECK([head -1 stderr], [0], [dnl
|
||
|
"bond/hash" command requires at least 1 arguments
|
||
|
])
|
||
|
sed 's/ovs-appctl/appctl.py/' stderr > experr
|
||
|
AT_CHECK([$PYTHON $srcdir/appctl.py bond/hash], [2], [], [experr])
|
||
|
|
||
|
AT_CHECK([ovs-appctl bond/hash mac], [2], [], [stderr])
|
||
|
AT_CHECK([head -1 stderr], [0], [dnl
|
||
|
invalid mac
|
||
|
])
|
||
|
sed 's/ovs-appctl/appctl.py/' stderr > experr
|
||
|
AT_CHECK([$PYTHON $srcdir/appctl.py bond/hash mac], [2], [], [experr])
|
||
|
|
||
|
AT_CHECK([ovs-appctl bond/hash mac vlan], [2], [], [stderr])
|
||
|
AT_CHECK([head -1 stderr], [0], [dnl
|
||
|
invalid vlan
|
||
|
])
|
||
|
sed 's/ovs-appctl/appctl.py/' stderr > experr
|
||
|
AT_CHECK([$PYTHON $srcdir/appctl.py bond/hash mac vlan], [2], [], [experr])
|
||
|
|
||
|
AT_CHECK([ovs-appctl bond/hash mac vlan basis], [2], [], [stderr])
|
||
|
AT_CHECK([head -1 stderr], [0], [dnl
|
||
|
invalid vlan
|
||
|
])
|
||
|
sed 's/ovs-appctl/appctl.py/' stderr > experr
|
||
|
AT_CHECK([$PYTHON $srcdir/appctl.py bond/hash vlan basis], [2], [], [experr])
|
||
|
|
||
|
AT_CHECK([ovs-appctl bond/hash mac vlan basis extra], [2], [], [stderr])
|
||
|
AT_CHECK([head -1 stderr], [0], [dnl
|
||
|
"bond/hash" command takes at most 3 arguments
|
||
|
])
|
||
|
sed 's/ovs-appctl/appctl.py/' stderr > experr
|
||
|
AT_CHECK([$PYTHON $srcdir/appctl.py bond/hash mac vlan basis extra], [2], [], [experr])
|
||
|
|
||
|
OVS_VSWITCHD_STOP
|
||
|
AT_CLEANUP
|
||
|
|
||
|
AT_SETUP([unixctl bad target - Python])
|
||
|
OVS_RUNDIR=$PWD; export OVS_RUNDIR
|
||
|
AT_SKIP_IF([test $HAVE_PYTHON = no])
|
||
|
|
||
|
AT_CHECK([$PYTHON $srcdir/appctl.py -t bogus doit], [1], [], [stderr])
|
||
|
AT_CHECK_UNQUOTED([tail -1 stderr], [0], [dnl
|
||
|
appctl.py: cannot read pidfile "$PWD/bogus.pid" (No such file or directory)
|
||
|
])
|
||
|
|
||
|
AT_CHECK([$PYTHON $srcdir/appctl.py -t /bogus/path.pid doit], [1], [], [stderr])
|
||
|
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])
|
||
|
OVS_RUNDIR=$PWD; export OVS_RUNDIR
|
||
|
OVS_LOGDIR=$PWD; export OVS_LOGDIR
|
||
|
OVS_SYSCONFDIR=$PWD; export OVS_SYSCONFDIR
|
||
|
trap 'kill `cat test-unixctl.py.pid`' 0
|
||
|
AT_CAPTURE_FILE([$PWD/test-unixctl.py.log])
|
||
|
AT_CHECK([$PYTHON $srcdir/test-unixctl.py --log-file --pidfile --detach])
|
||
|
|
||
|
AT_CHECK([ovs-appctl -t test-unixctl.py help], [0], [stdout])
|
||
|
AT_CHECK([cat stdout], [0], [dnl
|
||
|
The available commands are:
|
||
|
echo [[arg ...]]
|
||
|
echo_error [[arg ...]]
|
||
|
exit
|
||
|
help
|
||
|
version
|
||
|
])
|
||
|
mv stdout expout
|
||
|
AT_CHECK([$PYTHON $srcdir/appctl.py -t test-unixctl.py help], [0], [expout])
|
||
|
|
||
|
AT_CHECK([echo "test-unixctl.py (Open vSwitch) $VERSION $BUILDNR" > expout])
|
||
|
AT_CHECK([ovs-appctl -t test-unixctl.py version], [0], [expout])
|
||
|
AT_CHECK([$PYTHON $srcdir/appctl.py -t test-unixctl.py version], [0], [expout])
|
||
|
|
||
|
AT_CHECK([ovs-appctl -t test-unixctl.py echo robot ninja], [0], [stdout])
|
||
|
AT_CHECK([cat stdout], [0], [dnl
|
||
|
[[u'robot', u'ninja']]
|
||
|
])
|
||
|
mv stdout expout
|
||
|
AT_CHECK([$PYTHON $srcdir/appctl.py -t test-unixctl.py echo robot ninja], [0], [expout])
|
||
|
|
||
|
AT_CHECK([ovs-appctl -t test-unixctl.py echo_error robot ninja], [2], [], [stderr])
|
||
|
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
|
||
|
AT_CHECK([$PYTHON $srcdir/appctl.py -t test-unixctl.py echo_error robot ninja], [2], [], [experr])
|
||
|
|
||
|
AT_CHECK([ovs-appctl -t test-unixctl.py echo], [2], [], [stderr])
|
||
|
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
|
||
|
AT_CHECK([$PYTHON $srcdir/appctl.py -t test-unixctl.py echo], [2], [], [experr])
|
||
|
|
||
|
AT_CHECK([ovs-appctl -t test-unixctl.py echo robot ninja pirates], [2], [], [stderr])
|
||
|
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
|
||
|
AT_CHECK([$PYTHON $srcdir/appctl.py -t test-unixctl.py echo robot ninja pirates], [2], [], [experr])
|
||
|
|
||
|
AT_CHECK([ovs-appctl -t test-unixctl.py bogus], [2], [], [stderr])
|
||
|
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
|
||
|
AT_CHECK([$PYTHON $srcdir/appctl.py -t test-unixctl.py bogus], [2], [], [experr])
|
||
|
|
||
|
AT_CHECK([ovs-appctl -t test-unixctl.py exit])
|
||
|
trap '' 0]
|
||
|
AT_CLEANUP
|
||
|
|
||
|
|
||
|
AT_SETUP([unixctl server errors - Python])
|
||
|
AT_SKIP_IF([test $HAVE_PYTHON = no])
|
||
|
AT_CHECK($PYTHON $srcdir/test-unixctl.py --unixctl $PWD/bogus/path, [1], [], [ignore])
|
||
|
AT_CLEANUP
|