thread: Keep openvswitch/thread.h #includes more contained within include/.
[cascardo/ovs.git] / tests / rstp.at
index be3490d..ba48c0a 100644 (file)
@@ -148,13 +148,6 @@ check 2 = F:400000 Di F F F F F F
 AT_CHECK([ovstest test-rstp test-rstp-ieee802.1d-2004-fig17.7], [0], [])
 AT_CLEANUP
 
-# Strips out uninteresting parts of flow output, as well as parts
-# that vary from one run to another (e.g., timing and bond actions).
-m4_define([STRIP_USED], [[sed '
-    s/used:[0-9]*\.[0-9]*/used:0.0/
-    s/duration=[0-9.]*s*/duration=Xs/
-    s/idle_age=[0-9]*,/idle_age=X,/
-']])
 m4_define([FILTER_STP_TOPOLOGY], [[
 grep 'STP state changed' | sed '
     s/.*ofproto_dpif|.*|//
@@ -172,7 +165,8 @@ OVS_VSWITCHD_START(
    set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
                   fail-mode=secure -- \
    set port br1 other_config:rstp-enable=false -- \
-   set bridge br1 rstp_enable=true --])
+   set bridge br1 rstp_enable=false -- \
+])
 
 AT_CHECK([ovs-vsctl add-port br0 p1 -- \
    set interface p1 type=dummy options:pstream=punix:$OVS_RUNDIR/p0.sock ofport_request=1 -- \
@@ -184,13 +178,25 @@ AT_CHECK([ovs-vsctl add-port br0 p7 -- \
 ])
 AT_CHECK([ovs-vsctl add-port br1 p2 -- \
    set interface p2 type=dummy options:stream=unix:$OVS_RUNDIR/p0.sock ofport_request=2 -- \
-   set port p2 other_config:rstp-enable=true -- \
+   set port p2 other_config:rstp-enable=false -- \
 ])
 AT_CHECK([ovs-vsctl add-port br1 p8 -- \
    set interface p8 ofport_request=8 type=dummy -- \
    set port p8 other_config:rstp-enable=false -- \
 ])
 
+#
+# RSTP needs link to be in admin-state up, netdev-dummy is by default down
+#
+AT_CHECK([ovs-appctl netdev-dummy/set-admin-state p1 up], [], [dnl
+OK
+])
+
+#
+# Turn RSTP on in br1 after the ports have been added.
+#
+AT_CHECK([ovs-vsctl set bridge br1 rstp_enable=true])
+
 ovs-appctl time/stop
 
 AT_CHECK([ovs-ofctl add-flow br0 "in_port=7 icmp actions=1"])
@@ -198,6 +204,9 @@ AT_CHECK([ovs-ofctl add-flow br0 "in_port=1 icmp actions=7"])
 AT_CHECK([ovs-ofctl add-flow br1 "in_port=8 icmp actions=2"])
 AT_CHECK([ovs-ofctl add-flow br1 "in_port=2 icmp actions=8"])
 
+AT_CHECK([ovs-vsctl set port p2 other_config:rstp-enable=true])
+
+OVS_WAIT_UNTIL([test `cat ovs-vswitchd.log | FILTER_STP_TOPOLOGY | wc -l` -ge 2])
 AT_CHECK([cat ovs-vswitchd.log | FILTER_STP_TOPOLOGY], [0], [dnl
 port p1: RSTP state changed from Disabled to Discarding
 port p2: RSTP state changed from Disabled to Discarding
@@ -213,10 +222,16 @@ RSTP not in forwarding state, skipping output
 #
 # RSTP needs link to be in admin-state up, netdev-dummy is by default down
 #
-AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], [], [dnl
+AT_CHECK([ovs-appctl netdev-dummy/set-admin-state p2 up], [], [dnl
 OK
 ])
 
+# give time for RSTP to move initially
+
+ovs-appctl time/warp 1000
+ovs-appctl time/warp 1000
+
+OVS_WAIT_UNTIL([test `cat ovs-vswitchd.log | FILTER_STP_TOPOLOGY | wc -l` -ge 4])
 AT_CHECK([cat ovs-vswitchd.log | FILTER_STP_TOPOLOGY], [0], [dnl
 port p1: RSTP state changed from Disabled to Discarding
 port p2: RSTP state changed from Disabled to Discarding
@@ -231,5 +246,10 @@ AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(8),eth(src=50:54:00:00:00:
 Datapath actions: 2
 ])
 
+AT_CHECK([ovs-vsctl del-br br1])
+
+AT_CHECK([ovs-vsctl del-port br0 p7])
+AT_CHECK([ovs-vsctl del-port br0 p1])
+
 OVS_VSWITCHD_STOP
 AT_CLEANUP