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,//
15 m4_divert_pop([PREPARE_TESTS])
17 m4_define([STRIP_XIDS], [[sed 's/ (xid=0x[0-9a-fA-F]*)//']])
18 m4_define([STRIP_DURATION], [[sed 's/\bduration=[0-9.]*s/duration=?s/']])
19 m4_define([TESTABLE_LOG], [-vPATTERN:ANY:'%c|%p|%m'])
21 # OVS_VSWITCHD_START([vsctl-args], [vsctl-output])
23 # Creates a database and starts ovsdb-server, starts ovs-vswitchd
24 # connected to that database, calls ovs-vsctl to create a bridge named
25 # br0 with predictable settings, passing 'vsctl-args' as additional
26 # commands to ovs-vsctl. If 'vsctl-args' causes ovs-vsctl to provide
27 # output (e.g. because it includes "create" commands) then 'vsctl-output'
28 # specifies the expected output after filtering through uuidfilt.pl.
29 m4_define([OVS_VSWITCHD_START],
30 [OVS_RUNDIR=$PWD; export OVS_RUNDIR
31 OVS_LOGDIR=$PWD; export OVS_LOGDIR
32 OVS_SYSCONFDIR=$PWD; export OVS_SYSCONFDIR
33 trap 'kill `cat ovsdb-server.pid ovs-vswitchd.pid`' 0
37 touch openvswitch/.conf.db.~lock~
38 AT_CHECK([ovsdb-tool create openvswitch/conf.db $abs_top_srcdir/vswitchd/vswitch.ovsschema])
40 dnl Start ovsdb-server.
41 AT_CHECK([ovsdb-server --detach --pidfile --log-file --remote=punix:$OVS_RUNDIR/db.sock], [0], [], [stderr])
42 AT_CHECK([[sed < stderr '/vlog|INFO|opened log file/d']])
43 AT_CAPTURE_FILE([ovsdb-server.log])
45 dnl Initialize database.
46 AT_CHECK([ovs-vsctl --no-wait init])
48 dnl Start ovs-vswitchd.
49 AT_CHECK([ovs-vswitchd --detach --pidfile --enable-dummy --disable-system --log-file], [0], [], [stderr])
50 AT_CAPTURE_FILE([ovs-vswitchd.log])
51 AT_CHECK([[sed < stderr '
52 /vlog|INFO|opened log file/d
54 /ofproto|INFO|using datapath ID/d
55 /ofproto|INFO|datapath ID changed to fedcba9876543210/d']])
57 dnl Add bridges, ports, etc.
58 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])
61 m4_define([OVS_VSWITCHD_STOP],
62 [AT_CHECK([ovs-appctl -t ovs-vswitchd exit])
63 AT_CHECK([ovs-appctl -t ovsdb-server exit])