'
}
+# Filter (multiline) vconn debug messages from ovs-vswitchd.log.
+# Use with vconn_windows_sub() and ofctl_strip()
+print_vconn_debug () { awk -F\| < ovs-vswitchd.log '
+BEGIN { prt=0 }
+/\|vconn\|DBG\|/ { sub(/[ \t]*$/, ""); print $3 "|" $4 "|" $5; prt=1; next }
+$4 != "" { prt=0; next }
+prt==1 { sub(/[ \t]*$/, ""); print $0 }
+'
+}
+
+vconn_windows_sub() {
+ sed '
+s/tcp:127.0.0.1:[0-9][0-9]*:/unix:/
+s/No error/Success/
+'
+}
+
# parse_listening_port [SERVER]
#
# Parses the TCP or SSL port on which a server is listening from the
m4_define([STRIP_XIDS], [[sed 's/ (xid=0x[0-9a-fA-F]*)//']])
m4_define([STRIP_DURATION], [[sed 's/\bduration=[0-9.]*s/duration=?s/']])
m4_define([STRIP_USED], [[sed 's/used:[0-9]\.[0-9]*/used:0.0/']])
-m4_define([STRIP_UFID], [[sed 's/ufid:[0-9a-f]* //']])
+m4_define([STRIP_UFID], [[sed 's/ufid:[-0-9a-f]* //']])
m4_define([TESTABLE_LOG], [-vPATTERN:ANY:'%c|%p|%m'])
-# OVS_VSWITCHD_START([vsctl-args], [vsctl-output], [=override])
+# _OVS_VSWITCHD_START([vswitchd-aux-args])
#
-# Creates a database and starts ovsdb-server, starts ovs-vswitchd
-# connected to that database, calls ovs-vsctl to create a bridge named
-# br0 with predictable settings, passing 'vsctl-args' as additional
-# commands to ovs-vsctl. If 'vsctl-args' causes ovs-vsctl to provide
-# output (e.g. because it includes "create" commands) then 'vsctl-output'
-# specifies the expected output after filtering through uuidfilt.pl.
+# Creates an empty database and starts ovsdb-server.
+# Starts ovs-vswitchd, with additional arguments 'vswitchd-aux-args'.
#
-# If a test needs to use "system" devices (as dummies), then specify
-# =override (literally) as the third argument. Otherwise, system devices
-# won't work at all (which makes sense because tests should not access a
-# system's real Ethernet devices).
-m4_define([OVS_VSWITCHD_START],
+m4_define([_OVS_VSWITCHD_START],
[OVS_RUNDIR=`pwd`; export OVS_RUNDIR
OVS_LOGDIR=`pwd`; export OVS_LOGDIR
OVS_DBDIR=`pwd`; export OVS_DBDIR
OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR
- ON_EXIT([kill `cat ovsdb-server.pid ovs-vswitchd.pid`])
dnl Create database.
touch .conf.db.~lock~
dnl Start ovsdb-server.
AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --log-file --remote=punix:$OVS_RUNDIR/db.sock], [0], [], [stderr])
+ ON_EXIT_UNQUOTED([kill `cat ovsdb-server.pid`])
AT_CHECK([[sed < stderr '
/vlog|INFO|opened log file/d
/ovsdb_server|INFO|ovsdb-server (Open vSwitch)/d']])
AT_CHECK([ovs-vsctl --no-wait init])
dnl Start ovs-vswitchd.
- AT_CHECK([ovs-vswitchd --detach --no-chdir --pidfile --enable-dummy$3 --disable-system --log-file -vvconn -vofproto_dpif], [0], [], [stderr])
+ AT_CHECK([ovs-vswitchd $1 --detach --no-chdir --pidfile --log-file -vvconn -vofproto_dpif], [0], [], [stderr])
AT_CAPTURE_FILE([ovs-vswitchd.log])
+ ON_EXIT_UNQUOTED([kill `cat ovs-vswitchd.pid`])
AT_CHECK([[sed < stderr '
/ovs_numa|INFO|Discovered /d
/vlog|INFO|opened log file/d
/reconnect|INFO|/d
/ofproto|INFO|using datapath ID/d
/ofproto|INFO|datapath ID changed to fedcba9876543210/d']])
+])
+
+# OVS_VSWITCHD_START([vsctl-args], [vsctl-output], [=override])
+#
+# Creates a database and starts ovsdb-server, starts ovs-vswitchd
+# connected to that database, calls ovs-vsctl to create a bridge named
+# br0 with predictable settings, passing 'vsctl-args' as additional
+# commands to ovs-vsctl. If 'vsctl-args' causes ovs-vsctl to provide
+# output (e.g. because it includes "create" commands) then 'vsctl-output'
+# specifies the expected output after filtering through uuidfilt.pl.
+#
+# If a test needs to use "system" devices (as dummies), then specify
+# =override (literally) as the third argument. Otherwise, system devices
+# won't work at all (which makes sense because tests should not access a
+# system's real Ethernet devices).
+m4_define([OVS_VSWITCHD_START],
+ [_OVS_VSWITCHD_START([--enable-dummy$3 --disable-system])
dnl Add bridges, ports, etc.
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 protocols=[[OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13,OpenFlow14,OpenFlow15]] fail-mode=secure -- $1 m4_if([$2], [], [], [| ${PERL} $srcdir/uuidfilt.pl])], [0], [$2])