]> git.proxmox.com Git - ovs.git/blame - tests/stp.at
Fix ovs-dpctl-top by removing 3 wrong hunks in py3-compat.patch.
[ovs.git] / tests / stp.at
CommitLineData
829a7d02
JP
1AT_BANNER([Spanning Tree Protocol unit tests])
2
3AT_SETUP([STP example from IEEE 802.1D-1998])
4AT_KEYWORDS([STP])
5AT_DATA([test-stp-ieee802.1d-1998],
6[bridge 0 0x42 = a b
7bridge 1 0x97 = c:5 a d:5
8bridge 2 0x45 = b e
9bridge 3 0x57 = b:5 e:5
10bridge 4 0x83 = a:5 e:5
11run 1000
12check 0 = root
13check 1 = F F:10 F
14check 2 = F:10 B
15check 3 = F:5 F
16check 4 = F:5 B
17])
eadd1644 18AT_CHECK([ovstest test-stp test-stp-ieee802.1d-1998], [0], [], [dnl
634408e0
EJ
19stp|INFO|stp42: detected topology change.
20stp|INFO|stp42: detected topology change.
21stp|INFO|stp97: detected topology change.
22stp|INFO|stp97: detected topology change.
23stp|INFO|stp97: detected topology change.
24])
829a7d02
JP
25AT_CLEANUP
26
27AT_SETUP([STP example from IEEE 802.1D-2004 figures 17.4 and 17.5])
28AT_KEYWORDS([STP])
29AT_DATA([test-stp-ieee802.1d-2004-fig17.4],
30[bridge 0 0x111 = a b e c
31bridge 1 0x222 = a b d f
32bridge 2 0x333 = c d l j h g
33bridge 3 0x444 = e f n m k i
34bridge 4 0x555 = g i 0 0
35bridge 5 0x666 = h k 0 0
36bridge 6 0x777 = j m 0 0
37bridge 7 0x888 = l n 0 0
38run 1000
39check 0 = root
40check 1 = F:10 B F F
41check 2 = F:10 B F F F F
42check 3 = F:10 B F F F F
43check 4 = F:20 B F F
44check 5 = F:20 B F F
45check 6 = F:20 B F F
46check 7 = F:20 B F F
47
48# Now connect two ports of bridge 7 to the same LAN.
49bridge 7 = l n o o
50# Same results except for bridge 7:
51run 1000
52check 0 = root
53check 1 = F:10 B F F
54check 2 = F:10 B F F F F
55check 3 = F:10 B F F F F
56check 4 = F:20 B F F
57check 5 = F:20 B F F
58check 6 = F:20 B F F
59check 7 = F:20 B F B
60])
eadd1644 61AT_CHECK([ovstest test-stp test-stp-ieee802.1d-2004-fig17.4], [0], [], [dnl
634408e0
EJ
62stp|INFO|stp111: detected topology change.
63stp|INFO|stp111: detected topology change.
64stp|INFO|stp111: detected topology change.
65stp|INFO|stp111: detected topology change.
66stp|INFO|stp222: detected topology change.
67])
829a7d02
JP
68AT_CLEANUP
69
70AT_SETUP([STP example from IEEE 802.1D-2004 figure 17.6])
71AT_KEYWORDS([STP])
72AT_DATA([test-stp-ieee802.1d-2004-fig17.6],
73[bridge 0 0x111 = a b l
74bridge 1 0x222 = b c d
75bridge 2 0x333 = d e f
76bridge 3 0x444 = f g h
77bridge 4 0x555 = j h i
78bridge 5 0x666 = l j k
79run 1000
80check 0 = root
81check 1 = F:10 F F
82check 2 = F:20 F F
83check 3 = F:30 F B
84check 4 = F:20 F F
85check 5 = F:10 F F
86])
eadd1644 87AT_CHECK([ovstest test-stp test-stp-ieee802.1d-2004-fig17.6], [0], [], [dnl
634408e0
EJ
88stp|INFO|stp111: detected topology change.
89stp|INFO|stp111: detected topology change.
90stp|INFO|stp111: detected topology change.
91stp|INFO|stp222: detected topology change.
92stp|INFO|stp222: detected topology change.
93])
829a7d02
JP
94AT_CLEANUP
95
96AT_SETUP([STP example from IEEE 802.1D-2004 figure 17.7])
97AT_KEYWORDS([STP])
98AT_DATA([test-stp-ieee802.1d-2004-fig17.7],
99[bridge 0 0xaa = b
100bridge 1 0x111 = a b d f h g e c
101bridge 2 0x222 = g h j l n m k i
102run 1000
103check 0 = root
104check 1 = F F:10 F F F F F F
105check 2 = B F:20 F F F F F F
106
107# This is not the port priority change described in that figure,
108# but I don't understand what port priority change would cause
109# that change.
110bridge 2 = g X j l n m k i
111run 1000
112check 0 = root
113check 1 = F F:10 F F F F F F
114check 2 = F:20 D F F F F F F
115])
eadd1644 116AT_CHECK([ovstest test-stp test-stp-ieee802.1d-2004-fig17.7], [0], [], [dnl
634408e0
EJ
117stp|INFO|stpaa: detected topology change.
118stp|INFO|stp111: detected topology change.
119stp|INFO|stp111: detected topology change.
120stp|INFO|stp111: detected topology change.
121stp|INFO|stp111: detected topology change.
122])
829a7d02
JP
123AT_CLEANUP
124
125AT_SETUP([STP.io.1.1: Link Failure])
126AT_KEYWORDS([STP])
127AT_DATA([test-stp-iol-io-1.1],
128[# This test file approximates the following test from "Bridge
129# Functions Consortium Spanning Tree Interoperability Test Suite
130# Version 1.5":
131#
132# STP.io.1.1: Link Failure
133bridge 0 0x111 = a b c
134bridge 1 0x222 = a b c
135run 1000
136check 0 = root
137check 1 = F:10 B B
138bridge 1 = 0 _ _
139run 1000
140check 0 = root
141check 1 = F F:10 B
142bridge 1 = X _ _
143run 1000
144check 0 = root
145check 1 = D F:10 B
146bridge 1 = _ 0 _
147run 1000
148check 0 = root
149check 1 = D F F:10
150bridge 1 = _ X _
151run 1000
152check 0 = root
153check 1 = D D F:10
154])
eadd1644 155AT_CHECK([ovstest test-stp test-stp-iol-io-1.1], [0], [], [dnl
634408e0
EJ
156stp|INFO|stp111: detected topology change.
157stp|INFO|stp111: detected topology change.
158stp|INFO|stp111: detected topology change.
159stp|INFO|stp222: detected topology change.
160stp|INFO|stp111: detected topology change.
161])
829a7d02
JP
162AT_CLEANUP
163
164AT_SETUP([STP.io.1.2: Repeated Network])
165AT_KEYWORDS([STP])
166AT_DATA([test-stp-iol-io-1.2],
167[# This test file approximates the following test from "Bridge
168# Functions Consortium Spanning Tree Interoperability Test Suite
169# Version 1.5":
170# STP.io.1.2: Repeated Network
171bridge 0 0x111 = a a
172bridge 1 0x222 = a a
173run 1000
174check 0 = rootid:0x111 F B
175check 1 = rootid:0x111 F:10 B
176bridge 1 = a^0x90 _
177run 1000
178check 0 = rootid:0x111 F B
179check 1 = rootid:0x111 B F:10
180])
eadd1644 181AT_CHECK([ovstest test-stp test-stp-iol-io-1.2], [0], [], [dnl
634408e0
EJ
182stp|INFO|stp111: detected topology change.
183stp|INFO|stp222: detected topology change.
184stp|INFO|stp111: detected topology change.
185])
829a7d02
JP
186AT_CLEANUP
187
188AT_SETUP([STP.io.1.4: Network Initialization])
189AT_KEYWORDS([STP])
190AT_DATA([test-stp-iol-io-1.4],
191[# This test file approximates the following test from "Bridge
192# Functions Consortium Spanning Tree Interoperability Test Suite
193# Version 1.5":
194# STP.io.1.4: Network Initialization
195bridge 0 0x111 = a b c
196bridge 1 0x222 = b d e
197bridge 2 0x333 = a d f
198bridge 3 0x444 = c e f
199run 1000
200check 0 = root
201check 1 = F:10 F F
202check 2 = F:10 B F
203check 3 = F:10 B B
204])
eadd1644 205AT_CHECK([ovstest test-stp test-stp-iol-io-1.4], [0], [], [dnl
634408e0
EJ
206stp|INFO|stp111: detected topology change.
207stp|INFO|stp111: detected topology change.
208stp|INFO|stp111: detected topology change.
209stp|INFO|stp222: detected topology change.
210stp|INFO|stp222: detected topology change.
211])
829a7d02
JP
212AT_CLEANUP
213
214AT_SETUP([STP.io.1.5: Topology Change])
215AT_KEYWORDS([STP])
216AT_DATA([test-stp-iol-io-1.5],
217[# This test file approximates the following test from "Bridge
218# Functions Consortium Spanning Tree Interoperability Test Suite
219# Version 1.5":
220# STP.io.1.5: Topology Change
221bridge 0 0x111 = a b d c
222bridge 1 0x222 = a b f e
223bridge 2 0x333 = c d g h
224bridge 3 0x444 = e f g h
225run 1000
226check 0 = root
227check 1 = F:10 B F F
228check 2 = B F:10 F F
229check 3 = B F:20 B B
230bridge 1^0x7000
231run 1000
232check 0 = F:10 B F F
233check 1 = root
234check 2 = B F:20 B B
235check 3 = B F:10 F F
236bridge 2^0x6000
237run 1000
238check 0 = F F B F:10
239check 1 = F:20 B B B
240check 2 = root
241check 3 = F F F:10 B
242bridge 3^0x5000
243run 1000
244check 0 = B B B F:20
245check 1 = F F B F:10
246check 2 = F F F:10 B
247check 3 = root
248bridge 0^0x4000
249bridge 1^0x4001
250bridge 2^0x4002
251bridge 3^0x4003
252run 1000
253check 0 = root
254check 1 = F:10 B F F
255check 2 = B F:10 F F
256check 3 = B F:20 B B
257])
eadd1644 258AT_CHECK([ovstest test-stp test-stp-iol-io-1.5], [0], [], [dnl
634408e0
EJ
259stp|INFO|stp111: detected topology change.
260stp|INFO|stp111: detected topology change.
261stp|INFO|stp111: detected topology change.
262stp|INFO|stp111: detected topology change.
263stp|INFO|stp222: detected topology change.
264])
829a7d02
JP
265AT_CLEANUP
266
267AT_SETUP([STP.op.1.1 and STP.op.1.2])
268AT_KEYWORDS([STP])
269AT_DATA([test-stp-iol-op-1.1],
270[# This test file approximates the following tests from "Bridge
271# Functions Consortium Spanning Tree Protocol Operations Test Suite
272# Version 2.3":
273# Test STP.op.1.1: Root ID Initialized to Bridge ID
274# Test STP.op.1.2: Root Path Cost Initialized to Zero
275bridge 0 0x123 =
276check 0 = root
277])
eadd1644 278AT_CHECK([ovstest test-stp test-stp-iol-op-1.1])
829a7d02
JP
279AT_CLEANUP
280
281AT_SETUP([STP.op.1.4: All Ports Initialized to Designated Ports])
282AT_KEYWORDS([STP])
283AT_DATA([test-stp-iol-op-1.4],
284[# This test file approximates the following test from "Bridge
285# Functions Consortium Spanning Tree Protocol Operations Test Suite
286# Version 2.3":
287# Test STP.op.1.4: All Ports Initialized to Designated Ports
288bridge 0 0x123 = a b c d e f
289check 0 = Li Li Li Li Li Li
290run 1000
291check 0 = F F F F F F
292])
eadd1644 293AT_CHECK([ovstest test-stp test-stp-iol-op-1.4], [0], [], [dnl
634408e0
EJ
294stp|INFO|stp123: detected topology change.
295stp|INFO|stp123: detected topology change.
296stp|INFO|stp123: detected topology change.
297stp|INFO|stp123: detected topology change.
298stp|INFO|stp123: detected topology change.
299])
829a7d02
JP
300AT_CLEANUP
301
302AT_SETUP([STP.op.3.1: Root Bridge Selection: Root ID Values])
303AT_KEYWORDS([STP])
304AT_DATA([test-stp-iol-op-3.1],
305[# This test file approximates the following test from "Bridge
306# Functions Consortium Spanning Tree Protocol Operations Test Suite
307# Version 2.3":
308# Test STP.op.3.1: Root Bridge Selection: Root ID Values
309bridge 0 0x111 = a
310bridge 1 0x222 = a
311check 0 = rootid:0x111 Li
312check 1 = rootid:0x222 Li
313run 1000
314check 0 = rootid:0x111 root
315check 1 = rootid:0x111 F:10
316])
eadd1644 317AT_CHECK([ovstest test-stp test-stp-iol-op-3.1], [0], [], [dnl
634408e0
EJ
318stp|INFO|stp111: detected topology change.
319])
829a7d02
JP
320AT_CLEANUP
321
322AT_SETUP([STP.op.3.3: Root Bridge Selection: Bridge ID Values])
323AT_KEYWORDS([STP])
324AT_DATA([test-stp-iol-op-3.3],
325[# This test file approximates the following test from "Bridge
326# Functions Consortium Spanning Tree Protocol Operations Test Suite
327# Version 2.3":
328# Test STP.op.3.3: Root Bridge Selection: Bridge ID Values
329bridge 0 0x333^0x6000 = a
330bridge 1 0x222^0x7000 = b
331bridge 2 0x111 = a b
332run 1000
333check 0 = rootid:0x333^0x6000 root
334check 1 = rootid:0x333^0x6000 F:20
335check 2 = rootid:0x333^0x6000 F:10 F
336])
eadd1644 337AT_CHECK([ovstest test-stp test-stp-iol-op-3.3], [0], [], [dnl
634408e0
EJ
338stp|INFO|stp333: detected topology change.
339stp|INFO|stp111: detected topology change.
340stp|INFO|stp111: detected topology change.
341stp|INFO|stp333: detected topology change.
342])
829a7d02
JP
343AT_CLEANUP
344
345AT_SETUP([STP.op.3.3: Root Bridge Selection: Bridge ID Values])
346AT_KEYWORDS([STP])
347AT_DATA([test-stp-iol-op-3.4],
348[# This test file approximates the following test from "Bridge
349# Functions Consortium Spanning Tree Protocol Operations Test Suite
350# Version 2.3":
351# Test STP.op.3.3: Root Bridge Selection: Bridge ID Values
352bridge 0 0x333^0x6000 = a
353bridge 1 0x222^0x7000 = b
354bridge 2 0x111 = a b
355run 1000
356check 0 = rootid:0x333^0x6000 root
357check 1 = rootid:0x333^0x6000 F:20
358check 2 = rootid:0x333^0x6000 F:10 F
359])
eadd1644 360AT_CHECK([ovstest test-stp test-stp-iol-op-3.4], [0], [], [dnl
634408e0
EJ
361stp|INFO|stp333: detected topology change.
362stp|INFO|stp111: detected topology change.
363stp|INFO|stp111: detected topology change.
364stp|INFO|stp333: detected topology change.
365])
829a7d02 366AT_CLEANUP
9a0bb428
JR
367
368# Strips out uninteresting parts of flow output, as well as parts
369# that vary from one run to another (e.g., timing and bond actions).
370m4_define([STRIP_USED], [[sed '
371 s/used:[0-9]*\.[0-9]*/used:0.0/
372 s/duration=[0-9.]*s*/duration=Xs/
373 s/idle_age=[0-9]*,/idle_age=X,/
374']])
375m4_define([FILTER_STP_TOPOLOGY], [[
376grep 'STP state change' | sed '
427e9751 377 s/.*ofproto_dpif|.*|port .*:/port <>:/
378']])
379
182c7821 380m4_define([FILTER_STP_TOPOLOGY_LISTENING], [[
381grep 'disabled to listening' | sed '
382 s/.*ofproto_dpif|.*|port .*:/port <>:/
383']])
384
427e9751 385m4_define([FILTER_STP_TOPOLOGY_FORWARDING], [[
386grep 'learning to forwarding' | sed '
387 s/.*ofproto_dpif|.*|port .*:/port <>:/
9a0bb428
JR
388']])
389
390AT_SETUP([STP - dummy interface])
391# Create br0 with interfaces p1 and p7
392# and br1 with interfaces p2 and p8
393# with p1 and p2 connected via unix domain socket
394OVS_VSWITCHD_START(
395 [set port br0 other_config:stp-enable=false -- \
396 set bridge br0 stp_enable=true -- \
397 add-br br1 -- \
398 set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
399 set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
400 fail-mode=secure -- \
401 set port br1 other_config:stp-enable=false -- \
402 set bridge br1 stp_enable=true --])
403
404AT_CHECK([ovs-appctl vlog/set ofproto_dpif:dbg])
405
406AT_CHECK([ovs-vsctl add-port br0 p1 -- \
407 set interface p1 type=dummy options:pstream=punix:$OVS_RUNDIR/p0.sock ofport_request=1 -- \
408 set port p1 other_config:stp-enable=true -- \
409])
410AT_CHECK([ovs-vsctl add-port br0 p7 -- \
411 set interface p7 ofport_request=7 type=dummy -- \
412 set port p7 other_config:stp-enable=false -- \
413])
414AT_CHECK([ovs-vsctl add-port br1 p2 -- \
415 set interface p2 type=dummy options:stream=unix:$OVS_RUNDIR/p0.sock ofport_request=2 -- \
416 set port p2 other_config:stp-enable=true -- \
417])
418AT_CHECK([ovs-vsctl add-port br1 p8 -- \
419 set interface p8 ofport_request=8 type=dummy -- \
420 set port p8 other_config:stp-enable=false -- \
421])
422
52182c5f 423ovs-appctl netdev-dummy/set-admin-state up
9a0bb428
JR
424ovs-appctl time/stop
425
426AT_CHECK([ovs-ofctl add-flow br0 "in_port=7 icmp actions=1"])
427AT_CHECK([ovs-ofctl add-flow br0 "in_port=1 icmp actions=7"])
428AT_CHECK([ovs-ofctl add-flow br1 "in_port=8 icmp actions=2"])
429AT_CHECK([ovs-ofctl add-flow br1 "in_port=2 icmp actions=8"])
430
431# give time for STP to move initially
dbbedf38 432ovs-appctl time/warp 6000 3000
9a0bb428 433
182c7821 434AT_CHECK([cat ovs-vswitchd.log | FILTER_STP_TOPOLOGY_LISTENING], [0], [dnl
427e9751 435port <>: STP state changed from disabled to listening
436port <>: STP state changed from disabled to listening
9a0bb428
JR
437])
438
439AT_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
2d9b49dd 440 >> STP not in forwarding state, skipping output
9a0bb428
JR
441])
442AT_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
2d9b49dd 443 >> STP not in forwarding state, skipping output
9a0bb428
JR
444])
445
446# give time for STP to synchronize
dbbedf38 447ovs-appctl time/warp 30000 3000
9a0bb428
JR
448
449AT_CHECK([cat ovs-vswitchd.log | FILTER_STP_TOPOLOGY], [0], [dnl
427e9751 450port <>: STP state changed from disabled to listening
451port <>: STP state changed from disabled to listening
452port <>: STP state changed from listening to learning
453port <>: STP state changed from listening to learning
454port <>: STP state changed from learning to forwarding
455port <>: STP state changed from learning to forwarding
9a0bb428
JR
456])
457
458AT_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
459Datapath actions: 1
460])
461AT_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
462Datapath actions: 2
463])
464
427e9751 465AT_CLEANUP
466
467AT_SETUP([STP - flush the fdb and mdb when topology changed])
468OVS_VSWITCHD_START([])
469
470# setting as below, the br0 will be root bridge and p5 will be blocked.
471AT_CHECK([
472 ovs-vsctl -- \
473 set port br0 other_config:stp-enable=false -- \
474 set bridge br0 datapath-type=dummy -- \
475 set bridge br0 stp_enable=true mcast_snooping_enable=true \
476 other-config:hwaddr=aa:66:aa:66:00:00 -- \
477 add-br br1 -- \
478 set port br1 other_config:stp-enable=false -- \
479 set bridge br1 datapath-type=dummy -- \
480 set bridge br1 stp_enable=true mcast_snooping_enable=true \
481 other-config:hwaddr=aa:66:aa:66:00:01 -- \
482 add-br br2 -- \
483 set port br2 other_config:stp-enable=false -- \
484 set bridge br2 datapath-type=dummy -- \
485 set bridge br2 stp_enable=true mcast_snooping_enable=true \
486 other-config:hwaddr=aa:66:aa:66:00:02
487], [0])
488
489AT_CHECK([ovs-appctl vlog/set ofproto_dpif:dbg])
182c7821 490AT_CHECK([ovs-appctl vlog/set ofproto_dpif_xlate:dbg])
427e9751 491
492AT_CHECK([ovs-ofctl add-flow br0 action=normal])
493AT_CHECK([ovs-ofctl add-flow br1 action=normal])
494AT_CHECK([ovs-ofctl add-flow br2 action=normal])
495
496AT_CHECK([
497 ovs-vsctl add-port br0 p1 -- \
498 set interface p1 type=dummy options:pstream=punix:$OVS_RUNDIR/p1.sock ofport_request=1
499 ovs-vsctl add-port br0 p2 -- \
500 set interface p2 type=dummy options:stream=unix:$OVS_RUNDIR/p6.sock ofport_request=2
501 ovs-vsctl add-port br1 p3 -- \
502 set interface p3 type=dummy options:stream=unix:$OVS_RUNDIR/p1.sock ofport_request=3
503 ovs-vsctl add-port br1 p4 -- \
504 set interface p4 type=dummy options:pstream=punix:$OVS_RUNDIR/p4.sock ofport_request=4
505 ovs-vsctl add-port br2 p5 -- \
506 set interface p5 type=dummy options:stream=unix:$OVS_RUNDIR/p4.sock ofport_request=5
507 ovs-vsctl add-port br2 p6 -- \
508 set interface p6 type=dummy options:pstream=punix:$OVS_RUNDIR/p6.sock ofport_request=6
509], [0])
510
52182c5f 511ovs-appctl netdev-dummy/set-admin-state up
427e9751 512ovs-appctl time/stop
513
514# give time for STP to move initially
dbbedf38 515ovs-appctl time/warp 6000 3000
427e9751 516
182c7821 517AT_CHECK([cat ovs-vswitchd.log | FILTER_STP_TOPOLOGY_LISTENING], [0], [dnl
427e9751 518port <>: STP state changed from disabled to listening
519port <>: STP state changed from disabled to listening
520port <>: STP state changed from disabled to listening
521port <>: STP state changed from disabled to listening
522port <>: STP state changed from disabled to listening
523port <>: STP state changed from disabled to listening
524])
525
526# give time for STP to synchronize
dbbedf38 527ovs-appctl time/warp 30000 3000
427e9751 528
529AT_CHECK([cat ovs-vswitchd.log | FILTER_STP_TOPOLOGY_FORWARDING], [0], [dnl
530port <>: STP state changed from learning to forwarding
531port <>: STP state changed from learning to forwarding
532port <>: STP state changed from learning to forwarding
533port <>: STP state changed from learning to forwarding
534port <>: STP state changed from learning to forwarding
535])
536
182c7821 537# When topology is changed or the root brdige receives the TCN BPDU, the
538# root bridge will start the topology change timer. We should wait the
539# topology change timer to stop after 35s (max age 20 + forward delay 15).
540# After 35s, the root bridge will stop send CONF BPDU with
541# STP_CONFIG_TOPOLOGY_CHANGE flag and the topology will be stable. More
542# importantly, we should make time warp (in a second) because the hold timer
543# of stp ports will stop after 1s. So the root bridge can send quickly
544# topology change ack (other bridges may send TCN BPDU to root bridge) for
545# avoiding root brdige to flush fdb and mdb frequently.
dbbedf38 546ovs-appctl time/warp 36000 1000
182c7821 547
427e9751 548# root bridge sends query packet
549# we don't want to lose that message, so send it twice
550AT_CHECK([ovs-appctl netdev-dummy/receive br0 \
551 '01005E010101000C29A027D18100000108004500001C000100004002CBCBAC102201E00101011114EEEB00000000'])
552
553ovs-appctl time/warp 1000
554AT_CHECK([ovs-appctl netdev-dummy/receive br0 \
555 '01005E010101000C29A027D18100000108004500001C000100004002CBCBAC102201E00101011114EEEB00000000'])
556
557OVS_WAIT_UNTIL([ovs-appctl fdb/show br0 | grep '00:0c:29:a0:27:d1'])
558OVS_WAIT_UNTIL([ovs-appctl fdb/show br1 | grep '00:0c:29:a0:27:d1'])
559OVS_WAIT_UNTIL([ovs-appctl fdb/show br2 | grep '00:0c:29:a0:27:d1'])
560
561OVS_WAIT_UNTIL([ovs-appctl mdb/show br0 | grep 'querier'])
562OVS_WAIT_UNTIL([ovs-appctl mdb/show br1 | grep 'querier'])
563OVS_WAIT_UNTIL([ovs-appctl mdb/show br2 | grep 'querier'])
564
fcb86647
ID
565# Make sure that validation of flows was before changing of topology.
566ovs-appctl revalidator/wait
567
427e9751 568# del p2 on the br0, the topology will be changed
569AT_CHECK([ovs-vsctl del-port br0 p2])
570
571# give time for STP to synchronize
dbbedf38 572ovs-appctl time/warp 36000 3000
427e9751 573
574# check fdb and mdb
575AT_CHECK([ovs-appctl fdb/show br0], [0], [dnl
576 port VLAN MAC Age
577])
578AT_CHECK([ovs-appctl fdb/show br1], [0], [dnl
579 port VLAN MAC Age
580])
581AT_CHECK([ovs-appctl fdb/show br2], [0], [dnl
582 port VLAN MAC Age
583])
584
585AT_CHECK([ovs-appctl mdb/show br0], [0], [dnl
586 port VLAN GROUP Age
587])
588AT_CHECK([ovs-appctl mdb/show br1], [0], [dnl
589 port VLAN GROUP Age
590])
591AT_CHECK([ovs-appctl mdb/show br2], [0], [dnl
592 port VLAN GROUP Age
593])
594
52182c5f 595AT_CLEANUP
596
597AT_SETUP([STP - check link-state when stp is running])
598OVS_VSWITCHD_START([])
599
600AT_CHECK([
601 ovs-vsctl -- \
602 set port br0 other_config:stp-enable=false -- \
603 set bridge br0 datapath-type=dummy stp_enable=true \
604 other-config:hwaddr=aa:66:aa:66:00:00
605], [0])
606
607AT_CHECK([
608 ovs-vsctl add-port br0 p1 -- \
609 set interface p1 type=dummy -- \
610 set port p1 other_config:stp-port-num=1
611 ovs-vsctl add-port br0 p2 -- \
612 set interface p2 type=dummy -- \
613 set port p2 other_config:stp-port-num=2
614], [0])
615
616ovs-appctl netdev-dummy/set-admin-state up
617ovs-appctl time/stop
618
619# give time for STP to move initially
dbbedf38 620ovs-appctl time/warp 31000 1000
52182c5f 621
622AT_CHECK([ovs-appctl stp/show br0 | grep p1], [0], [dnl
aa141053 623 p1 designated forwarding 19 128.1
52182c5f 624])
625AT_CHECK([ovs-appctl stp/show br0 | grep p2], [0], [dnl
aa141053 626 p2 designated forwarding 19 128.2
52182c5f 627])
628
629# add a stp port
630AT_CHECK([
631 ovs-vsctl add-port br0 p3 -- \
632 set interface p3 type=dummy -- \
633 set port p3 other_config:stp-port-num=3
634], [0])
635
636ovs-appctl netdev-dummy/set-admin-state p3 down
637
638# We should not show the p3 because its link-state is down
639AT_CHECK([ovs-appctl stp/show br0 | grep p1], [0], [dnl
aa141053 640 p1 designated forwarding 19 128.1
52182c5f 641])
642AT_CHECK([ovs-appctl stp/show br0 | grep p2], [0], [dnl
aa141053 643 p2 designated forwarding 19 128.2
52182c5f 644])
645AT_CHECK([ovs-appctl stp/show br0 | grep p3], [1], [dnl
646])
647
648ovs-appctl netdev-dummy/set-admin-state p3 up
649
650AT_CHECK([ovs-appctl stp/show br0 | grep p1], [0], [dnl
aa141053 651 p1 designated forwarding 19 128.1
52182c5f 652])
653AT_CHECK([ovs-appctl stp/show br0 | grep p2], [0], [dnl
aa141053 654 p2 designated forwarding 19 128.2
52182c5f 655])
656AT_CHECK([ovs-appctl stp/show br0 | grep p3], [0], [dnl
aa141053 657 p3 designated listening 19 128.3
52182c5f 658])
659
660
9a0bb428
JR
661OVS_VSWITCHD_STOP
662AT_CLEANUP