]> git.proxmox.com Git - mirror_ovs.git/blame - tests/run-oftest
bfd: Support overlay BFD
[mirror_ovs.git] / tests / run-oftest
CommitLineData
81a114e5
BP
1#! /bin/sh
2
3set -e
4
5run () {
6 echo "$@"
7 "$@" || exit 1
8}
9
10# Put built tools early in $PATH.
11builddir=`pwd`
12if test ! -e vswitchd/ovs-vswitchd; then
13 echo >&2 'not in build directory, please change directory or run via \"make check-oftest'
14 exit 1
15fi
16PATH=$builddir/ovsdb:$builddir/vswitchd:$builddir/utilities:$PATH; export PATH
17
18# Find srcdir.
19case $srcdir in
20 '') srcdir=$builddir ;;
21 /*) ;;
22 *) srcdir=`pwd`/$srcdir ;;
23esac
3c8a3b31 24if test ! -e "$srcdir"/README.rst; then
81a114e5
BP
25 echo >&2 'source directory not found, please set $srcdir or run via \"make check-oftest'
26 exit 1
27fi
28
29# Make sure oftest is available.
30if test X"$OFT" = X; then
31 OFT=oft
32fi
33if ($OFT --version) >/dev/null 2>&1; then
34 :
35else
36 echo >&2 'OFTest "oft" binary not found or cannot be run, please add to $PATH or set $OFT'
37 exit 1
38fi
39
40# Create sandbox.
41rm -rf sandbox
42mkdir sandbox
43cd sandbox
44sandbox=`pwd`
45
46# Set up environment for OVS programs to sandbox themselves.
47OVS_RUNDIR=$sandbox; export OVS_RUNDIR
48OVS_LOGDIR=$sandbox; export OVS_LOGDIR
49OVS_DBDIR=$sandbox; export OVS_DBDIR
50OVS_SYSCONFDIR=$sandbox; export OVS_SYSCONFDIR
51
52trap 'kill `cat *.pid`' 0 1 2 3 13 14 15
53
54# Create database and start ovsdb-server.
55touch .conf.db.~lock~
56rm -f conf.db
57run ovsdb-tool create conf.db "$srcdir"/vswitchd/vswitch.ovsschema
58run ovsdb-server --detach --no-chdir --pidfile -vconsole:off --log-file \
59 --remote=punix:"$sandbox"/db.sock
60
61# Start ovs-vswitchd.
62run ovs-vswitchd --detach --no-chdir --pidfile -vconsole:off --log-file \
63 --enable-dummy --disable-system -vvconn -vnetdev_dummy
64
65# Add a bridge and some ports for OFTest to use,
66# and configure ovs-vswitchd to connect to OFTest.
67run ovs-vsctl --no-wait \
68 -- add-br br0 \
69 -- set bridge br0 datapath-type=dummy fail-mode=secure
70for port in p1 p2 p3 p4; do
71 run ovs-vsctl --no-wait \
5a0e4aec
BP
72 -- add-port br0 $port \
73 -- set interface $port type=dummy \
81a114e5
BP
74 options:pstream=punix:$OVS_RUNDIR/$port
75done
76run ovs-vsctl \
91a5b5be 77 -- set-controller br0 tcp:127.0.0.1:6653 \
81a114e5
BP
78 -- set controller br0 connection-mode=out-of-band max-backoff=1000
79
80# Run OFTest.
81run $OFT -P ovs-dummy $OFTFLAGS; status=$?
82
83cat <<EOF
84
85----------------------------------------------------------------------
86Logs may be found under $sandbox, e.g.:
5a0e4aec
BP
87 $sandbox/oft.log
88 $sandbox/ovs-vswitchd.log
89 $sandbox/ovsdb-server.log
81a114e5
BP
90----------------------------------------------------------------------
91EOF
92
93# Propagate OFTest exit status.
94exit $status