1 m4_divert_push([PREPARE_TESTS])
3 # Strips out uninteresting parts of ovs-ofctl output, as well as parts
4 # that vary from one run to another.
7 s/ (xid=0x[0-9a-fA-F]*)//
8 s/ duration=[0-9.]*s,//
17 m4_divert_pop([PREPARE_TESTS])
19 m4_define([STRIP_XIDS], [[sed 's/ (xid=0x[0-9a-fA-F]*)//']])
20 m4_define([STRIP_DURATION], [[sed 's/\bduration=[0-9.]*s/duration=?s/']])
21 m4_define([TESTABLE_LOG], [-vPATTERN:ANY:'%c|%p|%m'])
23 # OVS_VSWITCHD_START([vsctl-args], [vsctl-output])
25 # Creates a database and starts ovsdb-server, starts ovs-vswitchd
26 # connected to that database, calls ovs-vsctl to create a bridge named
27 # br0 with predictable settings, passing 'vsctl-args' as additional
28 # commands to ovs-vsctl. If 'vsctl-args' causes ovs-vsctl to provide
29 # output (e.g. because it includes "create" commands) then 'vsctl-output'
30 # specifies the expected output after filtering through uuidfilt.pl.
31 m4_define([OVS_VSWITCHD_START],
32 [OVS_RUNDIR=`pwd`; export OVS_RUNDIR
33 OVS_LOGDIR=`pwd`; export OVS_LOGDIR
34 OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
35 trap 'kill `cat ovsdb-server.pid ovs-vswitchd.pid`' 0
39 touch openvswitch/.conf.db.~lock~
40 AT_CHECK([ovsdb-tool create openvswitch/conf.db $abs_top_srcdir/vswitchd/vswitch.ovsschema])
42 dnl Start ovsdb-server.
43 AT_CHECK([ovsdb-server --detach --pidfile --log-file --remote=punix:$OVS_RUNDIR/db.sock], [0], [], [stderr])
44 AT_CHECK([[sed < stderr '/vlog|INFO|opened log file/d']])
45 AT_CAPTURE_FILE([ovsdb-server.log])
47 dnl Initialize database.
48 AT_CHECK([ovs-vsctl --no-wait init])
50 dnl Start ovs-vswitchd.
51 AT_CHECK([ovs-vswitchd --detach --pidfile --enable-dummy --disable-system --log-file], [0], [], [stderr])
52 AT_CAPTURE_FILE([ovs-vswitchd.log])
53 AT_CHECK([[sed < stderr '
54 /vlog|INFO|opened log file/d
56 /ofproto|INFO|using datapath ID/d
57 /ofproto|INFO|datapath ID changed to fedcba9876543210/d']])
59 dnl Add bridges, ports, etc.
60 AT_CHECK([ovs-vsctl -- add-br br0 -- set bridge br0 datapath-type=dummy other-config:datapath-id=fedcba9876543210 other-config:hwaddr=aa:55:aa:55:00:00 fail-mode=secure -- $1 m4_if([$2], [], [], [| perl $srcdir/uuidfilt.pl])], [0], [$2])
63 m4_define([OVS_VSWITCHD_STOP],
64 [AT_CHECK([ovs-appctl -t ovs-vswitchd exit])
65 AT_CHECK([ovs-appctl -t ovsdb-server exit])