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_DBDIR=`pwd`; export OVS_DBDIR
35 OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
36 trap 'kill `cat ovsdb-server.pid ovs-vswitchd.pid`' 0
40 AT_CHECK([ovsdb-tool create conf.db $abs_top_srcdir/vswitchd/vswitch.ovsschema])
42 dnl Start ovsdb-server.
43 AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --log-file --remote=punix:$OVS_RUNDIR/db.sock], [0], [], [stderr])
44 AT_CHECK([[sed < stderr '
45 /vlog|INFO|opened log file/d
46 /ovsdb_server|INFO|ovsdb-server (Open vSwitch)/d']])
47 AT_CAPTURE_FILE([ovsdb-server.log])
49 dnl Initialize database.
50 AT_CHECK([ovs-vsctl --no-wait init])
52 dnl Start ovs-vswitchd.
53 AT_CHECK([ovs-vswitchd --detach --no-chdir --pidfile --enable-dummy --disable-system --log-file -vvconn -vofproto_dpif], [0], [], [stderr])
54 AT_CAPTURE_FILE([ovs-vswitchd.log])
55 AT_CHECK([[sed < stderr '
56 /vlog|INFO|opened log file/d
57 /vswitchd|INFO|ovs-vswitchd (Open vSwitch)/d
59 /ofproto|INFO|using datapath ID/d
60 /ofproto|INFO|datapath ID changed to fedcba9876543210/d']])
62 dnl Add bridges, ports, etc.
63 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])
66 m4_define([OVS_VSWITCHD_STOP],
67 [AT_CHECK([ovs-appctl -t ovs-vswitchd exit])
68 AT_CHECK([ovs-appctl -t ovsdb-server exit])