blob: e8ea2e9ad51b27c5b03daa7a0423533d55de12dc [file] [log] [blame]
Zsolt Harasztif5c6aba2016-03-02 11:41:22 -08001'''
2More complex (composite) test-cases for the OLT
3'''
4
5import logging
6from oftest.testutils import *
7from oltbase import OltBaseTest
Zsolt Harasztid0571402016-03-02 18:40:50 -08008from oltconstants import *
9
Zsolt Harasztif5c6aba2016-03-02 11:41:22 -080010
11class Thing(object):
12 """An object we can stash arbitrary attributes for easy reach"""
13 def __init__(self, **kws):
14 self.__dict__.update(kws)
15
16
Zsolt Haraszti5360d032016-03-02 23:02:09 -080017class EapolInOnly(OltBaseTest):
18 def runTest(self):
19 self.resetOlt()
20 self.installEapolRule()
21 self.sendEapolIn()
22
23
24class EapolOutOnly(OltBaseTest):
25 def runTest(self):
26 self.resetOlt()
27 self.sendEapolOut()
28
29
Zsolt Harasztif5c6aba2016-03-02 11:41:22 -080030class ControllerAccess(OltBaseTest):
31 """Verify openflow access from OLT device"""
32
33 def runTest(self):
34 logging.info("Running ControllerAccess test")
35
36 # implicitly testing access to the openflow device
37 # and deleting all residual flows and groups
38 delete_all_flows(self.controller)
39 delete_all_groups(self.controller)
40
41
42class TestScenario1SingleOnu(OltBaseTest):
43 """
Zsolt Haraszti5b8b39c2016-03-02 22:25:51 -080044 Run a comprehensive test scenrario on the OLT, with one ONU.
Zsolt Harasztif5c6aba2016-03-02 11:41:22 -080045
46 Plan:
47
Zsolt Haraszti5b8b39c2016-03-02 22:25:51 -080048 0. Reset the OLT into a clean state
49 1. Setup the OLT to pass authentication (EAPOL) to controller
50 from any port, and test it.
51 2. Setup the OLT to pass unicast traffic for the ONU
Zsolt Harasztif5c6aba2016-03-02 11:41:22 -080052 3. Verify that unicast traffic works in both directions (use a few hundred frames in both ways)
53 4. Setup IGMP forwarding toward the controller
54 5. Send periodic IGMP queries out toward the ONU and verify its arrival
55 6. Send in an IGMP join request for one channel (specific multicast address) and verify that
56 the controller receives it.
57 7. Setup flows for forwarding multicast traffic from the OLT port toward the ONU(s)
58 8. Verify that multicast packets can reach the ONU
59 9. Verify that bidirectional unicast traffic still works across the PON
60 10. Change channel to a new multicast group and verify both multicast receiption as well as
61 unicast traffic works. This step involves:
62 - sending a leave message by the ONU to the controller and verify its reception
63 - sending a join message and verify its reception
64 - removing the existing multicast flow
65 - adding a new multicast flow
66 - verify that original flow no longer flows
67 - verify new flow
68 - verify that unicast still works
69 11. Add a second channel while keeping the existing one. Verify all what needs to be verified
70 (similar as above)
71 12. Add two more multicast channels, and verify everything
72 13. Flip a channel for one of the multicast channels, and verify everything
73 14. Tear down the test.
74 """
75
76 def runTest(self):
77 logging.info("Running %s" % self.__class__.__name__)
78
79 # Some constants
Zsolt Haraszti5360d032016-03-02 23:02:09 -080080 s_vlan_id = 111
Zsolt Harasztid0571402016-03-02 18:40:50 -080081 mcast_vlan_id = 140
Zsolt Harasztif5c6aba2016-03-02 11:41:22 -080082 mcast_groups = Thing(
83 ch1="230.10.10.10",
84 ch2="231.11.11.11",
85 ch3="232.12.12.12",
Zsolt Harasztid0571402016-03-02 18:40:50 -080086 ch4="233.13.13.13",
87 ch5="234.14.14.14"
Zsolt Harasztif5c6aba2016-03-02 11:41:22 -080088 )
89 onu1 = Thing(
Zsolt Harasztid0571402016-03-02 18:40:50 -080090 port=onu_port,
Zsolt Harasztif5c6aba2016-03-02 11:41:22 -080091 ip="13.14.14.13",
92 mac="b6:b8:3e:fb:1a:3f",
Zsolt Haraszti5360d032016-03-02 23:02:09 -080093 c_vlan_id=13
Zsolt Harasztif5c6aba2016-03-02 11:41:22 -080094 )
95
Zsolt Haraszti5b8b39c2016-03-02 22:25:51 -080096 # 0. Reset the OLT into a clean state
Zsolt Harasztif5c6aba2016-03-02 11:41:22 -080097 self.resetOlt()
98
Zsolt Haraszti5b8b39c2016-03-02 22:25:51 -080099 # 1. Setup the OLT to pass authentication (EAPOL) to controller
100 # from any port, and test it.
101 self.installEapolRule()
102 self.sendEapolIn()
103
104 # 2. Setup the OLT to pass unicast traffic for the ONU1
Zsolt Haraszti5360d032016-03-02 23:02:09 -0800105 self.installDoubleTaggingRules(s_vlan_id, onu1.c_vlan_id, self.getCookieBlock())
Zsolt Harasztif5c6aba2016-03-02 11:41:22 -0800106
107 # 3. Verify that unicast traffic works in both directions (use a few hundred frames in both ways)
Zsolt Haraszti5360d032016-03-02 23:02:09 -0800108 self.testPacketFlow(s_vlan_id, onu1.c_vlan_id) # this tests just one packet in each way
109 self.testSustainedPacketFlow(s_vlan_id, onu1.c_vlan_id, 100)
Zsolt Harasztif5c6aba2016-03-02 11:41:22 -0800110
111 # 4. Setup IGMP forwarding toward the controller
Zsolt Haraszti5b8b39c2016-03-02 22:25:51 -0800112 self.installIgmpRule(self.getCookieBlock())
Zsolt Haraszti5360d032016-03-02 23:02:09 -0800113 self.testSustainedPacketFlow(s_vlan_id, onu1.c_vlan_id, 10) # to check that unicast still flows
Zsolt Harasztid0571402016-03-02 18:40:50 -0800114
Zsolt Harasztif5c6aba2016-03-02 11:41:22 -0800115 # 5. Send periodic IGMP queries out toward the ONU and verify its arrival
Zsolt Harasztid0571402016-03-02 18:40:50 -0800116 self.testIgmpQueryOut()
Zsolt Haraszti5360d032016-03-02 23:02:09 -0800117 self.testSustainedPacketFlow(s_vlan_id, onu1.c_vlan_id, 10) # to check that unicast still flows
Zsolt Harasztid0571402016-03-02 18:40:50 -0800118
Zsolt Harasztif5c6aba2016-03-02 11:41:22 -0800119 # 6. Send in an IGMP join request for one channel (specific multicast address) and verify that
120 # the controller receives it.
Zsolt Harasztid0571402016-03-02 18:40:50 -0800121 self.sendIgmpReport(join=[mcast_groups.ch1])
122
Zsolt Harasztif5c6aba2016-03-02 11:41:22 -0800123 # 7. Setup flows for forwarding multicast traffic from the OLT port toward the ONU(s)
Zsolt Harasztid0571402016-03-02 18:40:50 -0800124 ch1_cookie = self.getCookieBlock()
125 ch1_group_id = 1
126 self.setupMcastChannel(mcast_groups.ch1, mcast_vlan_id, [onu1.port], ch1_group_id, ch1_cookie)
127
Zsolt Harasztif5c6aba2016-03-02 11:41:22 -0800128 # 8. Verify that multicast packets can reach the ONU
Zsolt Harasztid0571402016-03-02 18:40:50 -0800129 self.testMcastFlow(mcast_groups.ch1, mcast_vlan_id, [onu1.port], 10)
130
Zsolt Harasztif5c6aba2016-03-02 11:41:22 -0800131 # 9. Verify that bidirectional unicast traffic still works across the PON
Zsolt Haraszti5360d032016-03-02 23:02:09 -0800132 self.testSustainedPacketFlow(s_vlan_id, onu1.c_vlan_id, 10) # to check that unicast still flows
Zsolt Harasztid0571402016-03-02 18:40:50 -0800133
Zsolt Harasztif5c6aba2016-03-02 11:41:22 -0800134 # 10. Change channel to a new multicast group and verify both multicast receiption as well as
135 # unicast traffic works. This step involves:
136 # - sending a leave message by the ONU to the controller and verify its reception
137 # - sending a join message and verify its reception
138 # - removing the existing multicast flow
139 # - adding a new multicast flow
140 # - verify that original flow no longer flows
141 # - verify new flow
142 # - verify that unicast still works
Zsolt Harasztid0571402016-03-02 18:40:50 -0800143 self.sendIgmpReport(leave=[mcast_groups.ch1], join=[mcast_groups.ch2])
144 self.removeMcastChannel(mcast_groups.ch1, mcast_vlan_id, [onu1.port], ch1_group_id, ch1_cookie)
145 ch2_cookie = self.getCookieBlock()
146 ch2_group_id = 2
147 self.setupMcastChannel(mcast_groups.ch2, mcast_vlan_id, [onu1.port], ch2_group_id, ch2_cookie)
148 self.testMcastFlow(mcast_groups.ch1, mcast_vlan_id, [onu1.port], expect_to_be_blocked=True)
149 self.testMcastFlow(mcast_groups.ch2, mcast_vlan_id, [onu1.port], 10)
Zsolt Haraszti5360d032016-03-02 23:02:09 -0800150 self.testSustainedPacketFlow(s_vlan_id, onu1.c_vlan_id, 10) # to check that unicast still flows
Zsolt Harasztid0571402016-03-02 18:40:50 -0800151
Zsolt Harasztif5c6aba2016-03-02 11:41:22 -0800152 # 11. Add a second channel while keeping the existing one. Verify all what needs to be verified
153 # (similar as above)
Zsolt Harasztid0571402016-03-02 18:40:50 -0800154 self.sendIgmpReport(join=[mcast_groups.ch2, mcast_groups.ch3])
155 ch3_cookie = self.getCookieBlock()
156 ch3_group_id = 3
157 self.setupMcastChannel(mcast_groups.ch3, mcast_vlan_id, [onu1.port], ch3_group_id, ch3_cookie)
158 self.testMcastFlow(mcast_groups.ch1, mcast_vlan_id, [onu1.port], expect_to_be_blocked=True)
159 self.testMcastFlow(mcast_groups.ch2, mcast_vlan_id, [onu1.port], 10)
160 self.testMcastFlow(mcast_groups.ch3, mcast_vlan_id, [onu1.port], 10)
Zsolt Haraszti5360d032016-03-02 23:02:09 -0800161 self.testSustainedPacketFlow(s_vlan_id, onu1.c_vlan_id, 10) # to check that unicast still flows
Zsolt Harasztid0571402016-03-02 18:40:50 -0800162
163 # 12. Add two more multicast channels, and verify everything again
164 self.sendIgmpReport(join=[mcast_groups.ch2, mcast_groups.ch3, mcast_groups.ch4, mcast_groups.ch5])
165 ch4_cookie = self.getCookieBlock()
166 ch4_group_id = 4
167 self.setupMcastChannel(mcast_groups.ch4, mcast_vlan_id, [onu1.port], ch4_group_id, ch4_cookie)
168 ch5_cookie = self.getCookieBlock()
169 ch5_group_id = 5
170 self.setupMcastChannel(mcast_groups.ch5, mcast_vlan_id, [onu1.port], ch5_group_id, ch5_cookie)
171 self.testMcastFlow(mcast_groups.ch1, mcast_vlan_id, [onu1.port], expect_to_be_blocked=True)
172 self.testMcastFlow(mcast_groups.ch2, mcast_vlan_id, [onu1.port], 10)
173 self.testMcastFlow(mcast_groups.ch3, mcast_vlan_id, [onu1.port], 10)
174 self.testMcastFlow(mcast_groups.ch4, mcast_vlan_id, [onu1.port], 10)
175 self.testMcastFlow(mcast_groups.ch5, mcast_vlan_id, [onu1.port], 10)
Zsolt Haraszti5360d032016-03-02 23:02:09 -0800176 self.testSustainedPacketFlow(s_vlan_id, onu1.c_vlan_id, 10) # to check that unicast still flows
Zsolt Harasztid0571402016-03-02 18:40:50 -0800177
178 # 13. Flip a channel for one of the multicast channels, and verify everything (ch3 -> ch1)
179 self.sendIgmpReport(join=[mcast_groups.ch1, mcast_groups.ch2, mcast_groups.ch4, mcast_groups.ch5],
180 leave=[mcast_groups.ch3])
181 self.removeMcastChannel(mcast_groups.ch3, mcast_vlan_id, [onu1.port], ch3_group_id, ch3_cookie)
182 ## reusing the same group id and cookie
183 self.setupMcastChannel(mcast_groups.ch1, mcast_vlan_id, [onu1.port], ch1_group_id, ch1_cookie)
184 self.testMcastFlow(mcast_groups.ch1, mcast_vlan_id, [onu1.port], 10)
185 self.testMcastFlow(mcast_groups.ch2, mcast_vlan_id, [onu1.port], 10)
186 self.testMcastFlow(mcast_groups.ch3, mcast_vlan_id, [onu1.port], expect_to_be_blocked=True)
187 self.testMcastFlow(mcast_groups.ch4, mcast_vlan_id, [onu1.port], 10)
188 self.testMcastFlow(mcast_groups.ch5, mcast_vlan_id, [onu1.port], 10)
Zsolt Haraszti5360d032016-03-02 23:02:09 -0800189 self.testSustainedPacketFlow(s_vlan_id, onu1.c_vlan_id, 10) # to check that unicast still flows
Zsolt Harasztif5c6aba2016-03-02 11:41:22 -0800190
191 # 14. Tear down the test.
192 self.resetOlt()
Zsolt Haraszti5b8b39c2016-03-02 22:25:51 -0800193
194
195class TestScenario2TwoOnus(OltBaseTest):
196 """
197 Run a comprehensive test scenario involving the OLT and two ONUs.
198
199 Plan:
200
201 0. Reset the OLT into a clean state
202
203 1. Setup the OLT to pass authentication (EAPOL) to controller from ONU1
204 and test it.
205 2. Setup the OLT to pass unicast traffic for the ONU1
206 3. Verify that unicast traffic works in both directions (use a few hundred frames in both ways)
207 4. Setup IGMP forwarding toward the controller
208 5. Send periodic IGMP queries out toward the ONU1 and verify its arrival
209 6. Send in an IGMP join request for one channel (specific multicast address) and verify that
210 the controller receives it.
211 7. Setup flows for forwarding multicast traffic from the OLT port toward ONU1
212 8. Verify that multicast packets can reach ONU1
213 9. Verify that bidirectional unicast traffic still works across the PON
214 10. Change channel to a new multicast group and verify both multicast receiption as well as
215 unicast traffic works. This step involves:
216 - sending a leave message by the ONU to the controller and verify its reception
217 - sending a join message and verify its reception
218 - removing the existing multicast flow
219 - adding a new multicast flow
220 - verify that original flow no longer flows
221 - verify new flow
222 - verify that unicast still works
223 11. Add a second channel while keeping the existing one. Verify all what needs to be verified
224 (similar as above) - at this point ONU1 is tuned into ch2 and ch3
225
226 12. Setup the OLT to pass authentication (EAPOL) to controller from ONU2
227 and test it.
228 13. Setup the OLT to pass unicast traffic for the ONU2
229 14. Verify that unicast traffic works in both directions (use a few hundred frames in both ways)
230
231 15. Verify that both ONUs can send/receive unicast and ONU1 can still see its 2 channels
232
233 16. Setup IGMP forwarding toward the controller
234 17. Send periodic IGMP queries out toward the ONU2 and verify its arrival
235 18. Send in an IGMP join request for one channel (specific multicast address) and verify that
236 the controller receives it.
237 19. Setup flows for forwarding multicast traffic from the OLT port toward ONU2
238 20. Verify that multicast packets can reach ONU2
239 21. Verify that bidirectional unicast traffic still works across the PON for both ONUs
240 22. Change channel to a new multicast group and verify both multicast receiption as well as
241 unicast traffic works. This step involves:
242 - sending a leave message by the ONU to the controller and verify its reception
243 - sending a join message and verify its reception
244 - removing the existing multicast flow
245 - adding a new multicast flow
246 - verify that original flow no longer flows
247 - verify new flow
248 - verify that unicast still works
249 - verify everything for ONU1 too
250 23. Add a second channel while keeping the existing one. Verify all what needs to be verified
251 (similar as above) - at this point ONU1 is tuned into ch2 and ch3 and ONU2 is
252 tuned to ch2 and ch5
253
254 24. Flip a channel for ONU1 and verify everything
255 25. Tear down the test.
256
257 """
258
Zsolt Haraszti5360d032016-03-02 23:02:09 -0800259 def runTest(self):
260 logging.info("Running %s" % self.__class__.__name__)
261
262 # Some constants
263 s_vlan_id = 111
264 mcast_vlan_id = 140
265 mcast_groups = Thing(
266 ch1="230.10.10.10",
267 ch2="231.11.11.11",
268 ch3="232.12.12.12",
269 ch4="233.13.13.13",
270 ch5="234.14.14.14"
271 )
272 onu1 = Thing(
273 port=onu_port,
274 ip="13.14.14.13",
275 mac="b6:b8:3e:fb:1a:3f",
276 c_vlan_id=13
277 )
278 onu2 = Thing(
279 port=onu_port2,
280 ip="113.114.114.113",
281 mac="b6:b8:3e:fb:aa:aa",
282 c_vlan_id=913
283 )
284
285 # 0. Reset the OLT into a clean state
286 self.resetOlt()
287
288 # 1. Setup the OLT to pass authentication (EAPOL) to controller from ONU1
289 # and test it.
290 self.installEapolRule()
291 self.sendEapolIn()
292
293 # 2. Setup the OLT to pass unicast traffic for the ONU1
294 self.installDoubleTaggingRules(s_vlan_id, onu1.c_vlan_id, self.getCookieBlock())
295
296 # 3. Verify that unicast traffic works in both directions (use a few hundred frames in both ways)
297 self.testPacketFlow(s_vlan_id, onu1.c_vlan_id) # this tests just one packet in each way
298 self.testSustainedPacketFlow(s_vlan_id, onu1.c_vlan_id, 100)
299
300 # 4. Setup IGMP forwarding toward the controller
301 self.installIgmpRule(self.getCookieBlock())
302 self.testSustainedPacketFlow(s_vlan_id, onu1.c_vlan_id, 10) # to check that unicast still flows
303
304 # 5. Send periodic IGMP queries out toward the ONU1 and verify its arrival
305 self.testIgmpQueryOut()
306 self.testSustainedPacketFlow(s_vlan_id, onu1.c_vlan_id, 10) # to check that unicast still flows
307
308 # 6. Send in an IGMP join request for one channel (specific multicast address) and verify that
309 # the controller receives it.
310 self.sendIgmpReport(join=[mcast_groups.ch1])
311
312 # 7. Setup flows for forwarding multicast traffic from the OLT port toward ONU1
313 ch1_cookie = self.getCookieBlock()
314 ch1_group_id = 1
315 self.setupMcastChannel(mcast_groups.ch1, mcast_vlan_id, [onu1.port], ch1_group_id, ch1_cookie)
316
317 # 8. Verify that multicast packets can reach ONU1
318 self.testMcastFlow(mcast_groups.ch1, mcast_vlan_id, [onu1.port], 10)
319
320 # 9. Verify that bidirectional unicast traffic still works across the PON
321 self.testSustainedPacketFlow(s_vlan_id, onu1.c_vlan_id, 10) # to check that unicast still flows
322
323 # 10. Change channel to a new multicast group and verify both multicast receiption as well as
324 # unicast traffic works. This step involves:
325 # - sending a leave message by the ONU to the controller and verify its reception
326 # - sending a join message and verify its reception
327 # - removing the existing multicast flow
328 # - adding a new multicast flow
329 # - verify that original flow no longer flows
330 # - verify new flow
331 # - verify that unicast still works
332 self.sendIgmpReport(leave=[mcast_groups.ch1], join=[mcast_groups.ch2])
333 self.removeMcastChannel(mcast_groups.ch1, mcast_vlan_id, [onu1.port], ch1_group_id, ch1_cookie)
334 ch2_cookie = self.getCookieBlock()
335 ch2_group_id = 2
336 self.setupMcastChannel(mcast_groups.ch2, mcast_vlan_id, [onu1.port], ch2_group_id, ch2_cookie)
337 self.testMcastFlow(mcast_groups.ch1, mcast_vlan_id, [onu1.port], expect_to_be_blocked=True)
338 self.testMcastFlow(mcast_groups.ch2, mcast_vlan_id, [onu1.port], 10)
339 self.testSustainedPacketFlow(s_vlan_id, onu1.c_vlan_id, 10) # to check that unicast still flows
340
341 # 11. Add a second channel while keeping the existing one. Verify all what needs to be verified
342 # (similar as above) - at this point ONU1 is tuned into ch2 and ch3
343 self.sendIgmpReport(join=[mcast_groups.ch2, mcast_groups.ch3])
344 ch3_cookie = self.getCookieBlock()
345 ch3_group_id = 3
346 self.setupMcastChannel(mcast_groups.ch3, mcast_vlan_id, [onu1.port], ch3_group_id, ch3_cookie)
347 self.testMcastFlow(mcast_groups.ch1, mcast_vlan_id, [onu1.port], expect_to_be_blocked=True)
348 self.testMcastFlow(mcast_groups.ch2, mcast_vlan_id, [onu1.port], 10)
349 self.testMcastFlow(mcast_groups.ch3, mcast_vlan_id, [onu1.port], 10)
350 self.testSustainedPacketFlow(s_vlan_id, onu1.c_vlan_id, 10) # to check that unicast still flows
351
352 # 12. Setup the OLT to pass authentication (EAPOL) to controller from ONU2
353 # and test it.
354 self.installEapolRule(onu_port2)
355 self.sendEapolIn(onu_port2)
356
357 # 13. Setup the OLT to pass unicast traffic for the ONU2
358 self.installDoubleTaggingRules(s_vlan_id, onu2.c_vlan_id, self.getCookieBlock(), onu_port2)
359
360 # 14. Verify that unicast traffic works in both directions (use a few hundred frames in both ways)
361 self.testPacketFlow(s_vlan_id, onu2.c_vlan_id, onu_port2) # this tests just one packet in each way
362 self.testSustainedPacketFlow(s_vlan_id, onu2.c_vlan_id, 100, onu=onu_port2)
363
364 # 15. Verify that both ONU1 can send/receive unicast and ONU1 can still see its 2 channels
365 self.testMcastFlow(mcast_groups.ch2, mcast_vlan_id, [onu1.port], 10)
366 self.testMcastFlow(mcast_groups.ch3, mcast_vlan_id, [onu1.port], 10)
367 self.testSustainedPacketFlow(s_vlan_id, onu1.c_vlan_id, 10) # to check that unicast still flows
368
369 # 16. Setup IGMP forwarding toward the controller
370 # Note: this is actually not needed since the rule is not port specific - maybe it should be?
371 #self.installIgmpRule(self.getCookieBlock())
372 #self.testSustainedPacketFlow(s_vlan_id, onu1.c_vlan_id, 10) # to check that unicast still flows
373
374 # 17. Send periodic IGMP queries out toward the ONU2 and verify its arrival
375 self.testIgmpQueryOut(onu_port2)
376 self.testSustainedPacketFlow(s_vlan_id, onu1.c_vlan_id, 10) # to check that unicast still flows
377 self.testSustainedPacketFlow(s_vlan_id, onu2.c_vlan_id, 10, onu=onu_port2) # to check that unicast still flows
378
379 # 18. Send in an IGMP join request for one channel (specific multicast address) and verify that
380 # the controller receives it.
381 self.sendIgmpReport(join=[mcast_groups.ch1], onu=onu_port2)
382
383 # 19. Setup flows for forwarding multicast traffic from the OLT port toward ONU2: ch1
384 self.setupMcastChannel(mcast_groups.ch1, mcast_vlan_id, [onu2.port], ch1_group_id, ch1_cookie)
385
386 # 20. Verify that ch1 multicast packets can reach ONU2, but not ONU1
387 self.testMcastFlow(mcast_groups.ch1, mcast_vlan_id, [onu2.port], 10)
388 self.testMcastFlow(mcast_groups.ch1, mcast_vlan_id, [onu1.port], expect_to_be_blocked=True)
389
390 # 21. Verify that bidirectional unicast traffic still works across the PON for both ONUs
391 self.testSustainedPacketFlow(s_vlan_id, onu1.c_vlan_id, 10)
392 self.testSustainedPacketFlow(s_vlan_id, onu2.c_vlan_id, 10, onu=onu_port2)
393
394 # 22. Change channel to a new multicast group and verify both multicast receiption as well as
395 # unicast traffic works. This step involves:
396 # - sending a leave message by the ONU to the controller and verify its reception
397 # - sending a join message and verify its reception
398 # - removing the existing multicast flow
399 # - adding a new multicast flow
400 # - verify that original flow no longer flows
401 # - verify new flow
402 # - verify that unicast still works
403 # - verify everything for ONU1 too
404 self.sendIgmpReport(join=[mcast_groups.ch2], leave=[mcast_groups.ch1], onu=onu2.port)
405 self.removeMcastChannel(mcast_groups.ch1, mcast_vlan_id, [onu2.port], ch1_group_id, ch1_cookie)
406 self.updateMcastChannel(ch2_group_id, port_list=[onu1.port, onu2.port])
407 self.testMcastFlow(mcast_groups.ch1, mcast_vlan_id, [onu1.port, onu2.port], expect_to_be_blocked=True)
408 self.testMcastFlow(mcast_groups.ch2, mcast_vlan_id, [onu1.port, onu2.port])
409 self.testMcastFlow(mcast_groups.ch3, mcast_vlan_id, [onu1.port])
410 self.testSustainedPacketFlow(s_vlan_id, onu1.c_vlan_id)
411 self.testSustainedPacketFlow(s_vlan_id, onu2.c_vlan_id, onu=onu_port2)
412
413 # 23. Add a second channel for ONU2 while keeping the existing one. Verify all what needs to be verified
414 # (similar as above) - at this point ONU1 is tuned into ch2 and ch3 and ONU2 is
415 # tuned to ch2 and ch5
416 self.sendIgmpReport(join=[mcast_groups.ch2, mcast_groups.ch5], onu=onu2.port)
417 ch5_cookie = self.getCookieBlock()
418 ch5_group_id = 5
419 self.setupMcastChannel(mcast_groups.ch5, mcast_vlan_id, [onu2.port], ch5_group_id, ch5_cookie)
420 self.testMcastFlow(mcast_groups.ch1, mcast_vlan_id, [onu1.port, onu2.port], expect_to_be_blocked=True)
421 self.testMcastFlow(mcast_groups.ch2, mcast_vlan_id, [onu1.port, onu2.port])
422 self.testMcastFlow(mcast_groups.ch3, mcast_vlan_id, [onu1.port])
423 self.testMcastFlow(mcast_groups.ch5, mcast_vlan_id, [onu2.port])
424 self.testSustainedPacketFlow(s_vlan_id, onu1.c_vlan_id)
425 self.testSustainedPacketFlow(s_vlan_id, onu2.c_vlan_id, onu=onu_port2)
426
427 # 24. Flip a channel for ONU1 and verify everything (ch3 -> ch4)
428 self.sendIgmpReport(leave=[mcast_groups.ch3], join=[mcast_groups.ch2, mcast_groups.ch4], onu=onu1.port)
429 self.removeMcastChannel(mcast_groups.ch3, mcast_vlan_id, [onu1.port], ch3_group_id, ch3_cookie)
430 ch4_cookie = self.getCookieBlock()
431 ch4_group_id = 4
432 self.setupMcastChannel(mcast_groups.ch4, mcast_vlan_id, [onu1.port], ch4_group_id, ch4_cookie)
433 self.testMcastFlow(mcast_groups.ch1, mcast_vlan_id, [onu1.port, onu2.port], expect_to_be_blocked=True)
434 self.testMcastFlow(mcast_groups.ch2, mcast_vlan_id, [onu1.port, onu2.port])
435 self.testMcastFlow(mcast_groups.ch3, mcast_vlan_id, [onu1.port, onu2.port], expect_to_be_blocked=True)
436 self.testMcastFlow(mcast_groups.ch4, mcast_vlan_id, [onu1.port])
437 self.testMcastFlow(mcast_groups.ch5, mcast_vlan_id, [onu2.port])
438 self.testSustainedPacketFlow(s_vlan_id, onu1.c_vlan_id)
439 self.testSustainedPacketFlow(s_vlan_id, onu2.c_vlan_id, onu=onu_port2)
440
441 # 25. Tear down the test.
442 self.resetOlt()