]>
Commit | Line | Data |
---|---|---|
1 | AT_BANNER([Spanning Tree Protocol unit tests]) | |
2 | ||
3 | AT_SETUP([STP example from IEEE 802.1D-1998]) | |
4 | AT_KEYWORDS([STP]) | |
5 | AT_DATA([test-stp-ieee802.1d-1998], | |
6 | [bridge 0 0x42 = a b | |
7 | bridge 1 0x97 = c:5 a d:5 | |
8 | bridge 2 0x45 = b e | |
9 | bridge 3 0x57 = b:5 e:5 | |
10 | bridge 4 0x83 = a:5 e:5 | |
11 | run 1000 | |
12 | check 0 = root | |
13 | check 1 = F F:10 F | |
14 | check 2 = F:10 B | |
15 | check 3 = F:5 F | |
16 | check 4 = F:5 B | |
17 | ]) | |
18 | AT_CHECK([ovstest test-stp test-stp-ieee802.1d-1998], [0], [], [dnl | |
19 | stp|INFO|stp42: detected topology change. | |
20 | stp|INFO|stp42: detected topology change. | |
21 | stp|INFO|stp97: detected topology change. | |
22 | stp|INFO|stp97: detected topology change. | |
23 | stp|INFO|stp97: detected topology change. | |
24 | ]) | |
25 | AT_CLEANUP | |
26 | ||
27 | AT_SETUP([STP example from IEEE 802.1D-2004 figures 17.4 and 17.5]) | |
28 | AT_KEYWORDS([STP]) | |
29 | AT_DATA([test-stp-ieee802.1d-2004-fig17.4], | |
30 | [bridge 0 0x111 = a b e c | |
31 | bridge 1 0x222 = a b d f | |
32 | bridge 2 0x333 = c d l j h g | |
33 | bridge 3 0x444 = e f n m k i | |
34 | bridge 4 0x555 = g i 0 0 | |
35 | bridge 5 0x666 = h k 0 0 | |
36 | bridge 6 0x777 = j m 0 0 | |
37 | bridge 7 0x888 = l n 0 0 | |
38 | run 1000 | |
39 | check 0 = root | |
40 | check 1 = F:10 B F F | |
41 | check 2 = F:10 B F F F F | |
42 | check 3 = F:10 B F F F F | |
43 | check 4 = F:20 B F F | |
44 | check 5 = F:20 B F F | |
45 | check 6 = F:20 B F F | |
46 | check 7 = F:20 B F F | |
47 | ||
48 | # Now connect two ports of bridge 7 to the same LAN. | |
49 | bridge 7 = l n o o | |
50 | # Same results except for bridge 7: | |
51 | run 1000 | |
52 | check 0 = root | |
53 | check 1 = F:10 B F F | |
54 | check 2 = F:10 B F F F F | |
55 | check 3 = F:10 B F F F F | |
56 | check 4 = F:20 B F F | |
57 | check 5 = F:20 B F F | |
58 | check 6 = F:20 B F F | |
59 | check 7 = F:20 B F B | |
60 | ]) | |
61 | AT_CHECK([ovstest test-stp test-stp-ieee802.1d-2004-fig17.4], [0], [], [dnl | |
62 | stp|INFO|stp111: detected topology change. | |
63 | stp|INFO|stp111: detected topology change. | |
64 | stp|INFO|stp111: detected topology change. | |
65 | stp|INFO|stp111: detected topology change. | |
66 | stp|INFO|stp222: detected topology change. | |
67 | ]) | |
68 | AT_CLEANUP | |
69 | ||
70 | AT_SETUP([STP example from IEEE 802.1D-2004 figure 17.6]) | |
71 | AT_KEYWORDS([STP]) | |
72 | AT_DATA([test-stp-ieee802.1d-2004-fig17.6], | |
73 | [bridge 0 0x111 = a b l | |
74 | bridge 1 0x222 = b c d | |
75 | bridge 2 0x333 = d e f | |
76 | bridge 3 0x444 = f g h | |
77 | bridge 4 0x555 = j h i | |
78 | bridge 5 0x666 = l j k | |
79 | run 1000 | |
80 | check 0 = root | |
81 | check 1 = F:10 F F | |
82 | check 2 = F:20 F F | |
83 | check 3 = F:30 F B | |
84 | check 4 = F:20 F F | |
85 | check 5 = F:10 F F | |
86 | ]) | |
87 | AT_CHECK([ovstest test-stp test-stp-ieee802.1d-2004-fig17.6], [0], [], [dnl | |
88 | stp|INFO|stp111: detected topology change. | |
89 | stp|INFO|stp111: detected topology change. | |
90 | stp|INFO|stp111: detected topology change. | |
91 | stp|INFO|stp222: detected topology change. | |
92 | stp|INFO|stp222: detected topology change. | |
93 | ]) | |
94 | AT_CLEANUP | |
95 | ||
96 | AT_SETUP([STP example from IEEE 802.1D-2004 figure 17.7]) | |
97 | AT_KEYWORDS([STP]) | |
98 | AT_DATA([test-stp-ieee802.1d-2004-fig17.7], | |
99 | [bridge 0 0xaa = b | |
100 | bridge 1 0x111 = a b d f h g e c | |
101 | bridge 2 0x222 = g h j l n m k i | |
102 | run 1000 | |
103 | check 0 = root | |
104 | check 1 = F F:10 F F F F F F | |
105 | check 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. | |
110 | bridge 2 = g X j l n m k i | |
111 | run 1000 | |
112 | check 0 = root | |
113 | check 1 = F F:10 F F F F F F | |
114 | check 2 = F:20 D F F F F F F | |
115 | ]) | |
116 | AT_CHECK([ovstest test-stp test-stp-ieee802.1d-2004-fig17.7], [0], [], [dnl | |
117 | stp|INFO|stpaa: detected topology change. | |
118 | stp|INFO|stp111: detected topology change. | |
119 | stp|INFO|stp111: detected topology change. | |
120 | stp|INFO|stp111: detected topology change. | |
121 | stp|INFO|stp111: detected topology change. | |
122 | ]) | |
123 | AT_CLEANUP | |
124 | ||
125 | AT_SETUP([STP.io.1.1: Link Failure]) | |
126 | AT_KEYWORDS([STP]) | |
127 | AT_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 | |
133 | bridge 0 0x111 = a b c | |
134 | bridge 1 0x222 = a b c | |
135 | run 1000 | |
136 | check 0 = root | |
137 | check 1 = F:10 B B | |
138 | bridge 1 = 0 _ _ | |
139 | run 1000 | |
140 | check 0 = root | |
141 | check 1 = F F:10 B | |
142 | bridge 1 = X _ _ | |
143 | run 1000 | |
144 | check 0 = root | |
145 | check 1 = D F:10 B | |
146 | bridge 1 = _ 0 _ | |
147 | run 1000 | |
148 | check 0 = root | |
149 | check 1 = D F F:10 | |
150 | bridge 1 = _ X _ | |
151 | run 1000 | |
152 | check 0 = root | |
153 | check 1 = D D F:10 | |
154 | ]) | |
155 | AT_CHECK([ovstest test-stp test-stp-iol-io-1.1], [0], [], [dnl | |
156 | stp|INFO|stp111: detected topology change. | |
157 | stp|INFO|stp111: detected topology change. | |
158 | stp|INFO|stp111: detected topology change. | |
159 | stp|INFO|stp222: detected topology change. | |
160 | stp|INFO|stp111: detected topology change. | |
161 | ]) | |
162 | AT_CLEANUP | |
163 | ||
164 | AT_SETUP([STP.io.1.2: Repeated Network]) | |
165 | AT_KEYWORDS([STP]) | |
166 | AT_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 | |
171 | bridge 0 0x111 = a a | |
172 | bridge 1 0x222 = a a | |
173 | run 1000 | |
174 | check 0 = rootid:0x111 F B | |
175 | check 1 = rootid:0x111 F:10 B | |
176 | bridge 1 = a^0x90 _ | |
177 | run 1000 | |
178 | check 0 = rootid:0x111 F B | |
179 | check 1 = rootid:0x111 B F:10 | |
180 | ]) | |
181 | AT_CHECK([ovstest test-stp test-stp-iol-io-1.2], [0], [], [dnl | |
182 | stp|INFO|stp111: detected topology change. | |
183 | stp|INFO|stp222: detected topology change. | |
184 | stp|INFO|stp111: detected topology change. | |
185 | ]) | |
186 | AT_CLEANUP | |
187 | ||
188 | AT_SETUP([STP.io.1.4: Network Initialization]) | |
189 | AT_KEYWORDS([STP]) | |
190 | AT_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 | |
195 | bridge 0 0x111 = a b c | |
196 | bridge 1 0x222 = b d e | |
197 | bridge 2 0x333 = a d f | |
198 | bridge 3 0x444 = c e f | |
199 | run 1000 | |
200 | check 0 = root | |
201 | check 1 = F:10 F F | |
202 | check 2 = F:10 B F | |
203 | check 3 = F:10 B B | |
204 | ]) | |
205 | AT_CHECK([ovstest test-stp test-stp-iol-io-1.4], [0], [], [dnl | |
206 | stp|INFO|stp111: detected topology change. | |
207 | stp|INFO|stp111: detected topology change. | |
208 | stp|INFO|stp111: detected topology change. | |
209 | stp|INFO|stp222: detected topology change. | |
210 | stp|INFO|stp222: detected topology change. | |
211 | ]) | |
212 | AT_CLEANUP | |
213 | ||
214 | AT_SETUP([STP.io.1.5: Topology Change]) | |
215 | AT_KEYWORDS([STP]) | |
216 | AT_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 | |
221 | bridge 0 0x111 = a b d c | |
222 | bridge 1 0x222 = a b f e | |
223 | bridge 2 0x333 = c d g h | |
224 | bridge 3 0x444 = e f g h | |
225 | run 1000 | |
226 | check 0 = root | |
227 | check 1 = F:10 B F F | |
228 | check 2 = B F:10 F F | |
229 | check 3 = B F:20 B B | |
230 | bridge 1^0x7000 | |
231 | run 1000 | |
232 | check 0 = F:10 B F F | |
233 | check 1 = root | |
234 | check 2 = B F:20 B B | |
235 | check 3 = B F:10 F F | |
236 | bridge 2^0x6000 | |
237 | run 1000 | |
238 | check 0 = F F B F:10 | |
239 | check 1 = F:20 B B B | |
240 | check 2 = root | |
241 | check 3 = F F F:10 B | |
242 | bridge 3^0x5000 | |
243 | run 1000 | |
244 | check 0 = B B B F:20 | |
245 | check 1 = F F B F:10 | |
246 | check 2 = F F F:10 B | |
247 | check 3 = root | |
248 | bridge 0^0x4000 | |
249 | bridge 1^0x4001 | |
250 | bridge 2^0x4002 | |
251 | bridge 3^0x4003 | |
252 | run 1000 | |
253 | check 0 = root | |
254 | check 1 = F:10 B F F | |
255 | check 2 = B F:10 F F | |
256 | check 3 = B F:20 B B | |
257 | ]) | |
258 | AT_CHECK([ovstest test-stp test-stp-iol-io-1.5], [0], [], [dnl | |
259 | stp|INFO|stp111: detected topology change. | |
260 | stp|INFO|stp111: detected topology change. | |
261 | stp|INFO|stp111: detected topology change. | |
262 | stp|INFO|stp111: detected topology change. | |
263 | stp|INFO|stp222: detected topology change. | |
264 | ]) | |
265 | AT_CLEANUP | |
266 | ||
267 | AT_SETUP([STP.op.1.1 and STP.op.1.2]) | |
268 | AT_KEYWORDS([STP]) | |
269 | AT_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 | |
275 | bridge 0 0x123 = | |
276 | check 0 = root | |
277 | ]) | |
278 | AT_CHECK([ovstest test-stp test-stp-iol-op-1.1]) | |
279 | AT_CLEANUP | |
280 | ||
281 | AT_SETUP([STP.op.1.4: All Ports Initialized to Designated Ports]) | |
282 | AT_KEYWORDS([STP]) | |
283 | AT_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 | |
288 | bridge 0 0x123 = a b c d e f | |
289 | check 0 = Li Li Li Li Li Li | |
290 | run 1000 | |
291 | check 0 = F F F F F F | |
292 | ]) | |
293 | AT_CHECK([ovstest test-stp test-stp-iol-op-1.4], [0], [], [dnl | |
294 | stp|INFO|stp123: detected topology change. | |
295 | stp|INFO|stp123: detected topology change. | |
296 | stp|INFO|stp123: detected topology change. | |
297 | stp|INFO|stp123: detected topology change. | |
298 | stp|INFO|stp123: detected topology change. | |
299 | ]) | |
300 | AT_CLEANUP | |
301 | ||
302 | AT_SETUP([STP.op.3.1: Root Bridge Selection: Root ID Values]) | |
303 | AT_KEYWORDS([STP]) | |
304 | AT_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 | |
309 | bridge 0 0x111 = a | |
310 | bridge 1 0x222 = a | |
311 | check 0 = rootid:0x111 Li | |
312 | check 1 = rootid:0x222 Li | |
313 | run 1000 | |
314 | check 0 = rootid:0x111 root | |
315 | check 1 = rootid:0x111 F:10 | |
316 | ]) | |
317 | AT_CHECK([ovstest test-stp test-stp-iol-op-3.1], [0], [], [dnl | |
318 | stp|INFO|stp111: detected topology change. | |
319 | ]) | |
320 | AT_CLEANUP | |
321 | ||
322 | AT_SETUP([STP.op.3.3: Root Bridge Selection: Bridge ID Values]) | |
323 | AT_KEYWORDS([STP]) | |
324 | AT_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 | |
329 | bridge 0 0x333^0x6000 = a | |
330 | bridge 1 0x222^0x7000 = b | |
331 | bridge 2 0x111 = a b | |
332 | run 1000 | |
333 | check 0 = rootid:0x333^0x6000 root | |
334 | check 1 = rootid:0x333^0x6000 F:20 | |
335 | check 2 = rootid:0x333^0x6000 F:10 F | |
336 | ]) | |
337 | AT_CHECK([ovstest test-stp test-stp-iol-op-3.3], [0], [], [dnl | |
338 | stp|INFO|stp333: detected topology change. | |
339 | stp|INFO|stp111: detected topology change. | |
340 | stp|INFO|stp111: detected topology change. | |
341 | stp|INFO|stp333: detected topology change. | |
342 | ]) | |
343 | AT_CLEANUP | |
344 | ||
345 | AT_SETUP([STP.op.3.3: Root Bridge Selection: Bridge ID Values]) | |
346 | AT_KEYWORDS([STP]) | |
347 | AT_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 | |
352 | bridge 0 0x333^0x6000 = a | |
353 | bridge 1 0x222^0x7000 = b | |
354 | bridge 2 0x111 = a b | |
355 | run 1000 | |
356 | check 0 = rootid:0x333^0x6000 root | |
357 | check 1 = rootid:0x333^0x6000 F:20 | |
358 | check 2 = rootid:0x333^0x6000 F:10 F | |
359 | ]) | |
360 | AT_CHECK([ovstest test-stp test-stp-iol-op-3.4], [0], [], [dnl | |
361 | stp|INFO|stp333: detected topology change. | |
362 | stp|INFO|stp111: detected topology change. | |
363 | stp|INFO|stp111: detected topology change. | |
364 | stp|INFO|stp333: detected topology change. | |
365 | ]) | |
366 | AT_CLEANUP | |
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). | |
370 | m4_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 | ']]) | |
375 | m4_define([FILTER_STP_TOPOLOGY], [[ | |
376 | grep 'STP state change' | sed ' | |
377 | s/.*ofproto_dpif|.*|port .*:/port <>:/ | |
378 | ']]) | |
379 | ||
380 | m4_define([FILTER_STP_TOPOLOGY_LISTENING], [[ | |
381 | grep 'disabled to listening' | sed ' | |
382 | s/.*ofproto_dpif|.*|port .*:/port <>:/ | |
383 | ']]) | |
384 | ||
385 | m4_define([FILTER_STP_TOPOLOGY_FORWARDING], [[ | |
386 | grep 'learning to forwarding' | sed ' | |
387 | s/.*ofproto_dpif|.*|port .*:/port <>:/ | |
388 | ']]) | |
389 | ||
390 | AT_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 | |
394 | OVS_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 | ||
404 | AT_CHECK([ovs-appctl vlog/set ofproto_dpif:dbg]) | |
405 | ||
406 | AT_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 | ]) | |
410 | AT_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 | ]) | |
414 | AT_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 | ]) | |
418 | AT_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 | ||
423 | ovs-appctl netdev-dummy/set-admin-state up | |
424 | ovs-appctl time/stop | |
425 | ||
426 | AT_CHECK([ovs-ofctl add-flow br0 "in_port=7 icmp actions=1"]) | |
427 | AT_CHECK([ovs-ofctl add-flow br0 "in_port=1 icmp actions=7"]) | |
428 | AT_CHECK([ovs-ofctl add-flow br1 "in_port=8 icmp actions=2"]) | |
429 | AT_CHECK([ovs-ofctl add-flow br1 "in_port=2 icmp actions=8"]) | |
430 | ||
431 | # give time for STP to move initially | |
432 | ovs-appctl time/warp 6000 3000 | |
433 | ||
434 | AT_CHECK([cat ovs-vswitchd.log | FILTER_STP_TOPOLOGY_LISTENING], [0], [dnl | |
435 | port <>: STP state changed from disabled to listening | |
436 | port <>: STP state changed from disabled to listening | |
437 | ]) | |
438 | ||
439 | 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 | |
440 | >> STP not in forwarding state, skipping output | |
441 | ]) | |
442 | 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 | |
443 | >> STP not in forwarding state, skipping output | |
444 | ]) | |
445 | ||
446 | # give time for STP to synchronize | |
447 | ovs-appctl time/warp 30000 3000 | |
448 | ||
449 | AT_CHECK([cat ovs-vswitchd.log | FILTER_STP_TOPOLOGY], [0], [dnl | |
450 | port <>: STP state changed from disabled to listening | |
451 | port <>: STP state changed from disabled to listening | |
452 | port <>: STP state changed from listening to learning | |
453 | port <>: STP state changed from listening to learning | |
454 | port <>: STP state changed from learning to forwarding | |
455 | port <>: STP state changed from learning to forwarding | |
456 | ]) | |
457 | ||
458 | 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 | |
459 | Datapath actions: 1 | |
460 | ]) | |
461 | 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 | |
462 | Datapath actions: 2 | |
463 | ]) | |
464 | ||
465 | AT_CLEANUP | |
466 | ||
467 | AT_SETUP([STP - flush the fdb and mdb when topology changed]) | |
468 | OVS_VSWITCHD_START([]) | |
469 | ||
470 | # setting as below, the br0 will be root bridge and p5 will be blocked. | |
471 | AT_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 | ||
489 | AT_CHECK([ovs-appctl vlog/set ofproto_dpif:dbg]) | |
490 | AT_CHECK([ovs-appctl vlog/set ofproto_dpif_xlate:dbg]) | |
491 | ||
492 | AT_CHECK([ovs-ofctl add-flow br0 action=normal]) | |
493 | AT_CHECK([ovs-ofctl add-flow br1 action=normal]) | |
494 | AT_CHECK([ovs-ofctl add-flow br2 action=normal]) | |
495 | ||
496 | AT_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 | ||
511 | ovs-appctl netdev-dummy/set-admin-state up | |
512 | ovs-appctl time/stop | |
513 | ||
514 | # give time for STP to move initially | |
515 | ovs-appctl time/warp 6000 3000 | |
516 | ||
517 | AT_CHECK([cat ovs-vswitchd.log | FILTER_STP_TOPOLOGY_LISTENING], [0], [dnl | |
518 | port <>: STP state changed from disabled to listening | |
519 | port <>: STP state changed from disabled to listening | |
520 | port <>: STP state changed from disabled to listening | |
521 | port <>: STP state changed from disabled to listening | |
522 | port <>: STP state changed from disabled to listening | |
523 | port <>: STP state changed from disabled to listening | |
524 | ]) | |
525 | ||
526 | # give time for STP to synchronize | |
527 | ovs-appctl time/warp 30000 3000 | |
528 | ||
529 | AT_CHECK([cat ovs-vswitchd.log | FILTER_STP_TOPOLOGY_FORWARDING], [0], [dnl | |
530 | port <>: STP state changed from learning to forwarding | |
531 | port <>: STP state changed from learning to forwarding | |
532 | port <>: STP state changed from learning to forwarding | |
533 | port <>: STP state changed from learning to forwarding | |
534 | port <>: STP state changed from learning to forwarding | |
535 | ]) | |
536 | ||
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. | |
546 | ovs-appctl time/warp 36000 1000 | |
547 | ||
548 | # root bridge sends query packet | |
549 | # we don't want to lose that message, so send it twice | |
550 | AT_CHECK([ovs-appctl netdev-dummy/receive br0 \ | |
551 | '01005E010101000C29A027D18100000108004500001C000100004002CBCBAC102201E00101011114EEEB00000000']) | |
552 | ||
553 | ovs-appctl time/warp 1000 | |
554 | AT_CHECK([ovs-appctl netdev-dummy/receive br0 \ | |
555 | '01005E010101000C29A027D18100000108004500001C000100004002CBCBAC102201E00101011114EEEB00000000']) | |
556 | ||
557 | OVS_WAIT_UNTIL([ovs-appctl fdb/show br0 | grep '00:0c:29:a0:27:d1']) | |
558 | OVS_WAIT_UNTIL([ovs-appctl fdb/show br1 | grep '00:0c:29:a0:27:d1']) | |
559 | OVS_WAIT_UNTIL([ovs-appctl fdb/show br2 | grep '00:0c:29:a0:27:d1']) | |
560 | ||
561 | OVS_WAIT_UNTIL([ovs-appctl mdb/show br0 | grep 'querier']) | |
562 | OVS_WAIT_UNTIL([ovs-appctl mdb/show br1 | grep 'querier']) | |
563 | OVS_WAIT_UNTIL([ovs-appctl mdb/show br2 | grep 'querier']) | |
564 | ||
565 | # Make sure that validation of flows was before changing of topology. | |
566 | ovs-appctl revalidator/wait | |
567 | ||
568 | # del p2 on the br0, the topology will be changed | |
569 | AT_CHECK([ovs-vsctl del-port br0 p2]) | |
570 | ||
571 | # give time for STP to synchronize | |
572 | ovs-appctl time/warp 36000 3000 | |
573 | ||
574 | # check fdb and mdb | |
575 | AT_CHECK([ovs-appctl fdb/show br0], [0], [dnl | |
576 | port VLAN MAC Age | |
577 | ]) | |
578 | AT_CHECK([ovs-appctl fdb/show br1], [0], [dnl | |
579 | port VLAN MAC Age | |
580 | ]) | |
581 | AT_CHECK([ovs-appctl fdb/show br2], [0], [dnl | |
582 | port VLAN MAC Age | |
583 | ]) | |
584 | ||
585 | AT_CHECK([ovs-appctl mdb/show br0], [0], [dnl | |
586 | port VLAN GROUP Age | |
587 | ]) | |
588 | AT_CHECK([ovs-appctl mdb/show br1], [0], [dnl | |
589 | port VLAN GROUP Age | |
590 | ]) | |
591 | AT_CHECK([ovs-appctl mdb/show br2], [0], [dnl | |
592 | port VLAN GROUP Age | |
593 | ]) | |
594 | ||
595 | AT_CLEANUP | |
596 | ||
597 | AT_SETUP([STP - check link-state when stp is running]) | |
598 | OVS_VSWITCHD_START([]) | |
599 | ||
600 | AT_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 | ||
607 | AT_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 | ||
616 | ovs-appctl netdev-dummy/set-admin-state up | |
617 | ovs-appctl time/stop | |
618 | ||
619 | # give time for STP to move initially | |
620 | ovs-appctl time/warp 31000 1000 | |
621 | ||
622 | AT_CHECK([ovs-appctl stp/show br0 | grep p1], [0], [dnl | |
623 | p1 designated forwarding 19 128.1 | |
624 | ]) | |
625 | AT_CHECK([ovs-appctl stp/show br0 | grep p2], [0], [dnl | |
626 | p2 designated forwarding 19 128.2 | |
627 | ]) | |
628 | ||
629 | # add a stp port | |
630 | AT_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 | ||
636 | ovs-appctl netdev-dummy/set-admin-state p3 down | |
637 | ||
638 | # We should not show the p3 because its link-state is down | |
639 | AT_CHECK([ovs-appctl stp/show br0 | grep p1], [0], [dnl | |
640 | p1 designated forwarding 19 128.1 | |
641 | ]) | |
642 | AT_CHECK([ovs-appctl stp/show br0 | grep p2], [0], [dnl | |
643 | p2 designated forwarding 19 128.2 | |
644 | ]) | |
645 | AT_CHECK([ovs-appctl stp/show br0 | grep p3], [1], [dnl | |
646 | ]) | |
647 | ||
648 | ovs-appctl netdev-dummy/set-admin-state p3 up | |
649 | ||
650 | AT_CHECK([ovs-appctl stp/show br0 | grep p1], [0], [dnl | |
651 | p1 designated forwarding 19 128.1 | |
652 | ]) | |
653 | AT_CHECK([ovs-appctl stp/show br0 | grep p2], [0], [dnl | |
654 | p2 designated forwarding 19 128.2 | |
655 | ]) | |
656 | AT_CHECK([ovs-appctl stp/show br0 | grep p3], [0], [dnl | |
657 | p3 designated listening 19 128.3 | |
658 | ]) | |
659 | ||
660 | ||
661 | OVS_VSWITCHD_STOP | |
662 | AT_CLEANUP |