]>
Commit | Line | Data |
---|---|---|
9efd308e DV |
1 | AT_BANNER([Rapid Spanning Tree Protocol unit tests]) |
2 | ||
3 | AT_SETUP([RSTP Single bridge]) | |
4 | AT_KEYWORDS([RSTP]) | |
5 | AT_DATA([test-rstp-num1], | |
6 | [bridge 0 0x111 = a b | |
7 | run 1000 | |
8 | check 0 = root | |
9 | ]) | |
10 | AT_CHECK([ovstest test-rstp test-rstp-num1], [0], []) | |
11 | AT_CLEANUP | |
12 | ||
13 | AT_SETUP([RSTP Link failure]) | |
14 | AT_KEYWORDS([RSTP]) | |
15 | AT_DATA([test-rstp-num2], | |
16 | [bridge 0 0x111 = a b | |
17 | bridge 1 0x222 = a c | |
18 | bridge 2 0x333 = b c | |
19 | run 1000 | |
20 | check 0 = root | |
21 | check 1 = F:200000 F | |
22 | check 2 = F:200000 Di | |
23 | # Link b goes down | |
24 | bridge 2 = X c | |
25 | run 1000 | |
26 | check 1 = F:200000 F | |
27 | check 2 = D F:400000 | |
28 | ]) | |
29 | AT_CHECK([ovstest test-rstp test-rstp-num2], [0], []) | |
30 | AT_CLEANUP | |
31 | ||
32 | AT_SETUP([RSTP Double link Failure]) | |
33 | AT_KEYWORDS([RSTP]) | |
34 | AT_DATA([test-rstp-num3], | |
35 | [bridge 0 0x111 = a b | |
36 | bridge 1 0x222 = a c d | |
37 | bridge 2 0x333 = b c e | |
38 | bridge 3 0x444 = d f | |
39 | bridge 4 0x555 = e f | |
40 | run 1000 | |
41 | check 0 = root | |
42 | check 1 = F:200000 F F | |
43 | check 2 = F:200000 Di F | |
44 | check 3 = F:400000 F | |
45 | check 4 = F:400000 Di | |
46 | # Link b goes down | |
47 | bridge 2 = X c e | |
48 | run 1000 | |
49 | check 0 = root | |
50 | check 1 = F:200000 F F | |
51 | check 2 = D F:400000 F | |
52 | check 3 = F:400000 F | |
53 | check 4 = F:600000 Di | |
54 | # Link e goes down | |
55 | bridge 4 = X f | |
56 | run 1000 | |
57 | check 0 = root | |
58 | check 1 = F:200000 F F | |
59 | check 2 = D F:400000 F | |
60 | check 3 = F:400000 F | |
61 | check 4 = D F:600000 | |
62 | # Link f cost changes | |
63 | bridge 4 = X f:100000 | |
64 | run 1000 | |
65 | check 4 = D F:500000 | |
66 | # Bridge 4 becomes root and | |
67 | bridge 4 ^ 31000 | |
68 | run 1000 | |
69 | check 4 = root | |
70 | ]) | |
71 | AT_CHECK([ovstest test-rstp test-rstp-num3], [0], []) | |
72 | AT_CLEANUP | |
73 | ||
74 | AT_SETUP([RSTP example from IEEE 802.1D-2004 figures 17.4 and 17.5]) | |
75 | AT_KEYWORDS([RSTP]) | |
76 | AT_DATA([test-rstp-ieee802.1d-2004-fig17.4], | |
77 | [bridge 0 0x111 = a b e c | |
78 | bridge 1 0x222 = a b d f | |
79 | bridge 2 0x333 = c d l j h g | |
80 | bridge 3 0x444 = e f n m k i | |
81 | bridge 4 0x555 = g i 0 0 | |
82 | bridge 5 0x666 = h k 0 0 | |
83 | bridge 6 0x777 = j m 0 0 | |
84 | bridge 7 0x888 = l n 0 0 | |
85 | run 1000 | |
86 | check 0 = root | |
87 | check 1 = F:200000 Di F F | |
88 | check 2 = F:200000 Di F F F F | |
89 | check 3 = F:200000 Di F F F F | |
90 | check 4 = F:400000 Di F F | |
91 | check 5 = F:400000 Di F F | |
92 | check 6 = F:400000 Di F F | |
93 | check 7 = F:400000 Di F F | |
94 | ||
95 | # Now connect two ports of bridge 7 to the same LAN. | |
96 | bridge 7 = l n o o | |
97 | # Same results except for bridge 7: | |
98 | run 1000 | |
99 | check 0 = root | |
100 | check 1 = F:200000 Di F F | |
101 | check 2 = F:200000 Di F F F F | |
102 | check 3 = F:200000 Di F F F F | |
103 | check 4 = F:400000 Di F F | |
104 | check 5 = F:400000 Di F F | |
105 | check 6 = F:400000 Di F F | |
106 | check 7 = F:400000 Di F Di | |
107 | ]) | |
108 | AT_CHECK([ovstest test-rstp test-rstp-ieee802.1d-2004-fig17.4], [0], []) | |
109 | AT_CLEANUP | |
110 | ||
111 | AT_SETUP([RSTP example from IEEE 802.1D-2004 figure 17.6]) | |
112 | AT_KEYWORDS([RSTP]) | |
113 | AT_DATA([test-rstp-ieee802.1d-2004-fig17.6], | |
114 | [bridge 0 0x111 = a b l | |
115 | bridge 1 0x222 = b c d | |
116 | bridge 2 0x333 = d e f | |
117 | bridge 3 0x444 = f g h | |
118 | bridge 4 0x555 = j h i | |
119 | bridge 5 0x666 = l j k | |
120 | run 1000 | |
121 | check 0 = root | |
122 | check 1 = F:200000 F F | |
123 | check 2 = F:400000 F F | |
124 | check 3 = F:600000 F Di | |
125 | check 4 = F:400000 F F | |
126 | check 5 = F:200000 F F | |
127 | ]) | |
128 | AT_CHECK([ovstest test-rstp test-rstp-ieee802.1d-2004-fig17.6], [0], []) | |
129 | AT_CLEANUP | |
130 | ||
131 | AT_SETUP([RSTP example from IEEE 802.1D-2004 figure 17.7]) | |
132 | AT_KEYWORDS([RSTP]) | |
133 | AT_DATA([test-rstp-ieee802.1d-2004-fig17.7], | |
134 | [bridge 0 0x000 = b | |
135 | bridge 1 0x111 = a b d f h g e c | |
136 | bridge 2 0x222 = g h j l n m k i | |
137 | run 1000 | |
138 | check 0 = root | |
139 | check 1 = F F:200000 F F F F F F | |
140 | check 2 = Di F:400000 F F F F F F | |
141 | # Link g priority increment | |
142 | bridge 1 = a b d f h g^112 e c | |
143 | run 1000 | |
144 | check 0 = root | |
145 | check 1 = F F:200000 F F F F F F | |
146 | check 2 = F:400000 Di F F F F F F | |
147 | ]) | |
148 | AT_CHECK([ovstest test-rstp test-rstp-ieee802.1d-2004-fig17.7], [0], []) | |
149 | AT_CLEANUP | |
9a0bb428 | 150 | |
9a0bb428 JR |
151 | m4_define([FILTER_STP_TOPOLOGY], [[ |
152 | grep 'STP state changed' | sed ' | |
153 | s/.*ofproto_dpif|.*|// | |
154 | ']]) | |
155 | ||
156 | AT_SETUP([RSTP - dummy interface]) | |
157 | # Create br0 with interfaces p1 and p7 | |
158 | # and br1 with interfaces p2 and p8 | |
159 | # with p1 and p2 connected via unix domain socket | |
160 | OVS_VSWITCHD_START( | |
161 | [set port br0 other_config:rstp-enable=false -- \ | |
162 | set bridge br0 rstp_enable=true -- \ | |
163 | add-br br1 -- \ | |
164 | set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \ | |
165 | set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \ | |
166 | fail-mode=secure -- \ | |
167 | set port br1 other_config:rstp-enable=false -- \ | |
f025bcb7 JR |
168 | set bridge br1 rstp_enable=false -- \ |
169 | ]) | |
9a0bb428 JR |
170 | |
171 | AT_CHECK([ovs-vsctl add-port br0 p1 -- \ | |
172 | set interface p1 type=dummy options:pstream=punix:$OVS_RUNDIR/p0.sock ofport_request=1 -- \ | |
173 | set port p1 other_config:rstp-enable=true -- \ | |
174 | ]) | |
175 | AT_CHECK([ovs-vsctl add-port br0 p7 -- \ | |
176 | set interface p7 ofport_request=7 type=dummy -- \ | |
177 | set port p7 other_config:rstp-enable=false -- \ | |
178 | ]) | |
179 | AT_CHECK([ovs-vsctl add-port br1 p2 -- \ | |
180 | set interface p2 type=dummy options:stream=unix:$OVS_RUNDIR/p0.sock ofport_request=2 -- \ | |
f025bcb7 | 181 | set port p2 other_config:rstp-enable=false -- \ |
9a0bb428 JR |
182 | ]) |
183 | AT_CHECK([ovs-vsctl add-port br1 p8 -- \ | |
184 | set interface p8 ofport_request=8 type=dummy -- \ | |
185 | set port p8 other_config:rstp-enable=false -- \ | |
186 | ]) | |
187 | ||
f025bcb7 JR |
188 | # |
189 | # RSTP needs link to be in admin-state up, netdev-dummy is by default down | |
190 | # | |
191 | AT_CHECK([ovs-appctl netdev-dummy/set-admin-state p1 up], [], [dnl | |
192 | OK | |
193 | ]) | |
194 | ||
195 | # | |
196 | # Turn RSTP on in br1 after the ports have been added. | |
197 | # | |
198 | AT_CHECK([ovs-vsctl set bridge br1 rstp_enable=true]) | |
199 | ||
9a0bb428 JR |
200 | ovs-appctl time/stop |
201 | ||
202 | AT_CHECK([ovs-ofctl add-flow br0 "in_port=7 icmp actions=1"]) | |
203 | AT_CHECK([ovs-ofctl add-flow br0 "in_port=1 icmp actions=7"]) | |
204 | AT_CHECK([ovs-ofctl add-flow br1 "in_port=8 icmp actions=2"]) | |
205 | AT_CHECK([ovs-ofctl add-flow br1 "in_port=2 icmp actions=8"]) | |
206 | ||
f025bcb7 JR |
207 | AT_CHECK([ovs-vsctl set port p2 other_config:rstp-enable=true]) |
208 | ||
0b5d64f6 | 209 | OVS_WAIT_UNTIL([test `cat ovs-vswitchd.log | FILTER_STP_TOPOLOGY | wc -l` -ge 2]) |
9a0bb428 JR |
210 | AT_CHECK([cat ovs-vswitchd.log | FILTER_STP_TOPOLOGY], [0], [dnl |
211 | port p1: RSTP state changed from Disabled to Discarding | |
212 | port p2: RSTP state changed from Disabled to Discarding | |
213 | ]) | |
214 | ||
215 | 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 | |
2d9b49dd | 216 | >> RSTP not in forwarding state, skipping output |
9a0bb428 JR |
217 | ]) |
218 | 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 | |
2d9b49dd | 219 | >> RSTP not in forwarding state, skipping output |
9a0bb428 JR |
220 | ]) |
221 | ||
222 | # | |
223 | # RSTP needs link to be in admin-state up, netdev-dummy is by default down | |
224 | # | |
f025bcb7 | 225 | AT_CHECK([ovs-appctl netdev-dummy/set-admin-state p2 up], [], [dnl |
9a0bb428 JR |
226 | OK |
227 | ]) | |
228 | ||
37a4efd1 JR |
229 | # give time for RSTP to move initially |
230 | ||
231 | ovs-appctl time/warp 1000 | |
232 | ovs-appctl time/warp 1000 | |
233 | ||
0b5d64f6 | 234 | OVS_WAIT_UNTIL([test `cat ovs-vswitchd.log | FILTER_STP_TOPOLOGY | wc -l` -ge 4]) |
9a0bb428 JR |
235 | AT_CHECK([cat ovs-vswitchd.log | FILTER_STP_TOPOLOGY], [0], [dnl |
236 | port p1: RSTP state changed from Disabled to Discarding | |
237 | port p2: RSTP state changed from Disabled to Discarding | |
238 | port p2: RSTP state changed from Discarding to Forwarding | |
239 | port p1: RSTP state changed from Discarding to Forwarding | |
240 | ]) | |
241 | ||
242 | 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 | |
243 | Datapath actions: 1 | |
244 | ]) | |
245 | 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 | |
246 | Datapath actions: 2 | |
247 | ]) | |
248 | ||
f025bcb7 JR |
249 | AT_CHECK([ovs-vsctl del-br br1]) |
250 | ||
251 | AT_CHECK([ovs-vsctl del-port br0 p7]) | |
252 | AT_CHECK([ovs-vsctl del-port br0 p1]) | |
253 | ||
9a0bb428 JR |
254 | OVS_VSWITCHD_STOP |
255 | AT_CLEANUP |