netdev-dpdk: fix mbuf leaks
[cascardo/ovs.git] / tests / stp.at
index 6e2bcf9..c01ad81 100644 (file)
@@ -15,7 +15,13 @@ check 2 = F:10 B
 check 3 = F:5 F
 check 4 = F:5 B
 ])
-OVS_CHECK_LCOV([test-stp test-stp-ieee802.1d-1998])
+AT_CHECK([ovstest test-stp test-stp-ieee802.1d-1998], [0], [], [dnl
+stp|INFO|stp42: detected topology change.
+stp|INFO|stp42: detected topology change.
+stp|INFO|stp97: detected topology change.
+stp|INFO|stp97: detected topology change.
+stp|INFO|stp97: detected topology change.
+])
 AT_CLEANUP
 
 AT_SETUP([STP example from IEEE 802.1D-2004 figures 17.4 and 17.5])
@@ -52,7 +58,13 @@ check 5 = F:20 B F F
 check 6 = F:20 B F F
 check 7 = F:20 B F B
 ])
-OVS_CHECK_LCOV([test-stp test-stp-ieee802.1d-2004-fig17.4])
+AT_CHECK([ovstest test-stp test-stp-ieee802.1d-2004-fig17.4], [0], [], [dnl
+stp|INFO|stp111: detected topology change.
+stp|INFO|stp111: detected topology change.
+stp|INFO|stp111: detected topology change.
+stp|INFO|stp111: detected topology change.
+stp|INFO|stp222: detected topology change.
+])
 AT_CLEANUP
 
 AT_SETUP([STP example from IEEE 802.1D-2004 figure 17.6])
@@ -72,7 +84,13 @@ check 3 = F:30 F B
 check 4 = F:20 F F
 check 5 = F:10 F F
 ])
-OVS_CHECK_LCOV([test-stp test-stp-ieee802.1d-2004-fig17.6])
+AT_CHECK([ovstest test-stp test-stp-ieee802.1d-2004-fig17.6], [0], [], [dnl
+stp|INFO|stp111: detected topology change.
+stp|INFO|stp111: detected topology change.
+stp|INFO|stp111: detected topology change.
+stp|INFO|stp222: detected topology change.
+stp|INFO|stp222: detected topology change.
+])
 AT_CLEANUP
 
 AT_SETUP([STP example from IEEE 802.1D-2004 figure 17.7])
@@ -95,7 +113,13 @@ check 0 = root
 check 1 = F F:10 F F F F F F
 check 2 = F:20 D F F F F F F
 ])
-OVS_CHECK_LCOV([test-stp test-stp-ieee802.1d-2004-fig17.7])
+AT_CHECK([ovstest test-stp test-stp-ieee802.1d-2004-fig17.7], [0], [], [dnl
+stp|INFO|stpaa: detected topology change.
+stp|INFO|stp111: detected topology change.
+stp|INFO|stp111: detected topology change.
+stp|INFO|stp111: detected topology change.
+stp|INFO|stp111: detected topology change.
+])
 AT_CLEANUP
 
 AT_SETUP([STP.io.1.1: Link Failure])
@@ -104,7 +128,7 @@ AT_DATA([test-stp-iol-io-1.1],
 [# This test file approximates the following test from "Bridge
 # Functions Consortium Spanning Tree Interoperability Test Suite
 # Version 1.5":
-# 
+#
 # STP.io.1.1: Link Failure
 bridge 0 0x111 = a b c
 bridge 1 0x222 = a b c
@@ -128,7 +152,13 @@ run 1000
 check 0 = root
 check 1 = D D F:10
 ])
-OVS_CHECK_LCOV([test-stp test-stp-iol-io-1.1])
+AT_CHECK([ovstest test-stp test-stp-iol-io-1.1], [0], [], [dnl
+stp|INFO|stp111: detected topology change.
+stp|INFO|stp111: detected topology change.
+stp|INFO|stp111: detected topology change.
+stp|INFO|stp222: detected topology change.
+stp|INFO|stp111: detected topology change.
+])
 AT_CLEANUP
 
 AT_SETUP([STP.io.1.2: Repeated Network])
@@ -148,7 +178,11 @@ run 1000
 check 0 = rootid:0x111 F B
 check 1 = rootid:0x111 B F:10
 ])
-OVS_CHECK_LCOV([test-stp test-stp-iol-io-1.2])
+AT_CHECK([ovstest test-stp test-stp-iol-io-1.2], [0], [], [dnl
+stp|INFO|stp111: detected topology change.
+stp|INFO|stp222: detected topology change.
+stp|INFO|stp111: detected topology change.
+])
 AT_CLEANUP
 
 AT_SETUP([STP.io.1.4: Network Initialization])
@@ -168,7 +202,13 @@ check 1 = F:10 F F
 check 2 = F:10 B F
 check 3 = F:10 B B
 ])
-OVS_CHECK_LCOV([test-stp test-stp-iol-io-1.4])
+AT_CHECK([ovstest test-stp test-stp-iol-io-1.4], [0], [], [dnl
+stp|INFO|stp111: detected topology change.
+stp|INFO|stp111: detected topology change.
+stp|INFO|stp111: detected topology change.
+stp|INFO|stp222: detected topology change.
+stp|INFO|stp222: detected topology change.
+])
 AT_CLEANUP
 
 AT_SETUP([STP.io.1.5: Topology Change])
@@ -215,7 +255,13 @@ check 1 = F:10 B F F
 check 2 = B F:10 F F
 check 3 = B F:20 B B
 ])
-OVS_CHECK_LCOV([test-stp test-stp-iol-io-1.5])
+AT_CHECK([ovstest test-stp test-stp-iol-io-1.5], [0], [], [dnl
+stp|INFO|stp111: detected topology change.
+stp|INFO|stp111: detected topology change.
+stp|INFO|stp111: detected topology change.
+stp|INFO|stp111: detected topology change.
+stp|INFO|stp222: detected topology change.
+])
 AT_CLEANUP
 
 AT_SETUP([STP.op.1.1 and STP.op.1.2])
@@ -229,7 +275,7 @@ AT_DATA([test-stp-iol-op-1.1],
 bridge 0 0x123 =
 check 0 = root
 ])
-OVS_CHECK_LCOV([test-stp test-stp-iol-op-1.1])
+AT_CHECK([ovstest test-stp test-stp-iol-op-1.1])
 AT_CLEANUP
 
 AT_SETUP([STP.op.1.4: All Ports Initialized to Designated Ports])
@@ -244,7 +290,13 @@ check 0 = Li Li Li Li Li Li
 run 1000
 check 0 = F F F F F F
 ])
-OVS_CHECK_LCOV([test-stp test-stp-iol-op-1.4])
+AT_CHECK([ovstest test-stp test-stp-iol-op-1.4], [0], [], [dnl
+stp|INFO|stp123: detected topology change.
+stp|INFO|stp123: detected topology change.
+stp|INFO|stp123: detected topology change.
+stp|INFO|stp123: detected topology change.
+stp|INFO|stp123: detected topology change.
+])
 AT_CLEANUP
 
 AT_SETUP([STP.op.3.1: Root Bridge Selection: Root ID Values])
@@ -262,7 +314,9 @@ run 1000
 check 0 = rootid:0x111 root
 check 1 = rootid:0x111 F:10
 ])
-OVS_CHECK_LCOV([test-stp test-stp-iol-op-3.1])
+AT_CHECK([ovstest test-stp test-stp-iol-op-3.1], [0], [], [dnl
+stp|INFO|stp111: detected topology change.
+])
 AT_CLEANUP
 
 AT_SETUP([STP.op.3.3: Root Bridge Selection: Bridge ID Values])
@@ -280,7 +334,12 @@ check 0 = rootid:0x333^0x6000 root
 check 1 = rootid:0x333^0x6000 F:20
 check 2 = rootid:0x333^0x6000 F:10 F
 ])
-OVS_CHECK_LCOV([test-stp test-stp-iol-op-3.3])
+AT_CHECK([ovstest test-stp test-stp-iol-op-3.3], [0], [], [dnl
+stp|INFO|stp333: detected topology change.
+stp|INFO|stp111: detected topology change.
+stp|INFO|stp111: detected topology change.
+stp|INFO|stp333: detected topology change.
+])
 AT_CLEANUP
 
 AT_SETUP([STP.op.3.3: Root Bridge Selection: Bridge ID Values])
@@ -298,6 +357,110 @@ check 0 = rootid:0x333^0x6000 root
 check 1 = rootid:0x333^0x6000 F:20
 check 2 = rootid:0x333^0x6000 F:10 F
 ])
-OVS_CHECK_LCOV([test-stp test-stp-iol-op-3.4])
+AT_CHECK([ovstest test-stp test-stp-iol-op-3.4], [0], [], [dnl
+stp|INFO|stp333: detected topology change.
+stp|INFO|stp111: detected topology change.
+stp|INFO|stp111: detected topology change.
+stp|INFO|stp333: detected topology change.
+])
 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 change' | sed '
+    s/.*ofproto_dpif|.*|//
+']])
+
+AT_SETUP([STP - dummy interface])
+# Create br0 with interfaces p1 and p7
+#    and br1 with interfaces p2 and p8
+# with p1 and p2 connected via unix domain socket
+OVS_VSWITCHD_START(
+  [set port br0 other_config:stp-enable=false -- \
+   set bridge br0 stp_enable=true -- \
+   add-br br1 -- \
+   set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
+   set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
+                  fail-mode=secure -- \
+   set port br1 other_config:stp-enable=false -- \
+   set bridge br1 stp_enable=true --])
+
+AT_CHECK([ovs-appctl vlog/set ofproto_dpif:dbg])
+
+AT_CHECK([ovs-vsctl add-port br0 p1 -- \
+   set interface p1 type=dummy options:pstream=punix:$OVS_RUNDIR/p0.sock ofport_request=1 -- \
+   set port p1 other_config:stp-enable=true -- \
+])
+AT_CHECK([ovs-vsctl add-port br0 p7 -- \
+   set interface p7 ofport_request=7 type=dummy -- \
+   set port p7 other_config:stp-enable=false -- \
+])
+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:stp-enable=true -- \
+])
+AT_CHECK([ovs-vsctl add-port br1 p8 -- \
+   set interface p8 ofport_request=8 type=dummy -- \
+   set port p8 other_config:stp-enable=false -- \
+])
+
+ovs-appctl time/stop
+
+AT_CHECK([ovs-ofctl add-flow br0 "in_port=7 icmp actions=1"])
+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"])
+
+# give time for STP to move initially
+
+ovs-appctl time/warp 3000
+ovs-appctl time/warp 3000
+
+AT_CHECK([cat ovs-vswitchd.log | FILTER_STP_TOPOLOGY], [0], [dnl
+port p1: STP state changed from disabled to listening
+port p2: STP state changed from disabled to listening
+])
+
+AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(7),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' | grep STP], [0], [dnl
+STP not in forwarding state, skipping output
+])
+AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(8),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.3,dst=10.0.0.4,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' | grep STP], [0], [dnl
+STP not in forwarding state, skipping output
+])
+
+# give time for STP to synchronize
+
+ovs-appctl time/warp 3000
+ovs-appctl time/warp 3000
+ovs-appctl time/warp 3000
+ovs-appctl time/warp 3000
+ovs-appctl time/warp 3000
+ovs-appctl time/warp 3000
+ovs-appctl time/warp 3000
+ovs-appctl time/warp 3000
+ovs-appctl time/warp 3000
+
+AT_CHECK([cat ovs-vswitchd.log | FILTER_STP_TOPOLOGY], [0], [dnl
+port p1: STP state changed from disabled to listening
+port p2: STP state changed from disabled to listening
+port p1: STP state changed from listening to learning
+port p2: STP state changed from listening to learning
+port p1: STP state changed from learning to forwarding
+port p2: STP state changed from learning to forwarding
+])
+
+AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(7),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' | grep Datapath], [0], [dnl
+Datapath actions: 1
+])
+AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(8),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.3,dst=10.0.0.4,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' | grep Datapath], [0], [dnl
+Datapath actions: 2
+])
+
+OVS_VSWITCHD_STOP
+AT_CLEANUP