blob: 0428f4b8915a571e86f9b278b3da2c8ea52675fb [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
17class ControllerAccess(OltBaseTest):
18 """Verify openflow access from OLT device"""
19
20 def runTest(self):
21 logging.info("Running ControllerAccess test")
22
23 # implicitly testing access to the openflow device
24 # and deleting all residual flows and groups
25 delete_all_flows(self.controller)
26 delete_all_groups(self.controller)
27
28
29class TestScenario1SingleOnu(OltBaseTest):
30 """
Zsolt Haraszti5b8b39c2016-03-02 22:25:51 -080031 Run a comprehensive test scenrario on the OLT, with one ONU.
Zsolt Harasztif5c6aba2016-03-02 11:41:22 -080032
33 Plan:
34
Zsolt Haraszti5b8b39c2016-03-02 22:25:51 -080035 0. Reset the OLT into a clean state
36 1. Setup the OLT to pass authentication (EAPOL) to controller
37 from any port, and test it.
38 2. Setup the OLT to pass unicast traffic for the ONU
Zsolt Harasztif5c6aba2016-03-02 11:41:22 -080039 3. Verify that unicast traffic works in both directions (use a few hundred frames in both ways)
40 4. Setup IGMP forwarding toward the controller
41 5. Send periodic IGMP queries out toward the ONU and verify its arrival
42 6. Send in an IGMP join request for one channel (specific multicast address) and verify that
43 the controller receives it.
44 7. Setup flows for forwarding multicast traffic from the OLT port toward the ONU(s)
45 8. Verify that multicast packets can reach the ONU
46 9. Verify that bidirectional unicast traffic still works across the PON
47 10. Change channel to a new multicast group and verify both multicast receiption as well as
48 unicast traffic works. This step involves:
49 - sending a leave message by the ONU to the controller and verify its reception
50 - sending a join message and verify its reception
51 - removing the existing multicast flow
52 - adding a new multicast flow
53 - verify that original flow no longer flows
54 - verify new flow
55 - verify that unicast still works
56 11. Add a second channel while keeping the existing one. Verify all what needs to be verified
57 (similar as above)
58 12. Add two more multicast channels, and verify everything
59 13. Flip a channel for one of the multicast channels, and verify everything
60 14. Tear down the test.
61 """
62
63 def runTest(self):
64 logging.info("Running %s" % self.__class__.__name__)
65
66 # Some constants
Zsolt Harasztica3e1452016-03-02 23:02:09 -080067 s_vlan_id = 111
Zsolt Harasztid0571402016-03-02 18:40:50 -080068 mcast_vlan_id = 140
Zsolt Harasztif5c6aba2016-03-02 11:41:22 -080069 mcast_groups = Thing(
70 ch1="230.10.10.10",
71 ch2="231.11.11.11",
72 ch3="232.12.12.12",
Zsolt Harasztid0571402016-03-02 18:40:50 -080073 ch4="233.13.13.13",
74 ch5="234.14.14.14"
Zsolt Harasztif5c6aba2016-03-02 11:41:22 -080075 )
76 onu1 = Thing(
Zsolt Harasztid0571402016-03-02 18:40:50 -080077 port=onu_port,
Zsolt Harasztif5c6aba2016-03-02 11:41:22 -080078 ip="13.14.14.13",
79 mac="b6:b8:3e:fb:1a:3f",
Zsolt Harasztica3e1452016-03-02 23:02:09 -080080 c_vlan_id=13
Zsolt Harasztif5c6aba2016-03-02 11:41:22 -080081 )
82
Zsolt Haraszti5b8b39c2016-03-02 22:25:51 -080083 # 0. Reset the OLT into a clean state
Zsolt Harasztif5c6aba2016-03-02 11:41:22 -080084 self.resetOlt()
85
Zsolt Haraszti5b8b39c2016-03-02 22:25:51 -080086 # 1. Setup the OLT to pass authentication (EAPOL) to controller
87 # from any port, and test it.
88 self.installEapolRule()
89 self.sendEapolIn()
90
91 # 2. Setup the OLT to pass unicast traffic for the ONU1
Zsolt Harasztica3e1452016-03-02 23:02:09 -080092 self.installDoubleTaggingRules(s_vlan_id, onu1.c_vlan_id, self.getCookieBlock())
Zsolt Harasztif5c6aba2016-03-02 11:41:22 -080093
94 # 3. Verify that unicast traffic works in both directions (use a few hundred frames in both ways)
Zsolt Harasztica3e1452016-03-02 23:02:09 -080095 self.testPacketFlow(s_vlan_id, onu1.c_vlan_id) # this tests just one packet in each way
96 self.testSustainedPacketFlow(s_vlan_id, onu1.c_vlan_id, 100)
Zsolt Harasztif5c6aba2016-03-02 11:41:22 -080097
98 # 4. Setup IGMP forwarding toward the controller
Zsolt Haraszti5b8b39c2016-03-02 22:25:51 -080099 self.installIgmpRule(self.getCookieBlock())
Zsolt Harasztica3e1452016-03-02 23:02:09 -0800100 self.testSustainedPacketFlow(s_vlan_id, onu1.c_vlan_id, 10) # to check that unicast still flows
Zsolt Harasztid0571402016-03-02 18:40:50 -0800101
Zsolt Harasztif5c6aba2016-03-02 11:41:22 -0800102 # 5. Send periodic IGMP queries out toward the ONU and verify its arrival
Zsolt Harasztid0571402016-03-02 18:40:50 -0800103 self.testIgmpQueryOut()
Zsolt Harasztica3e1452016-03-02 23:02:09 -0800104 self.testSustainedPacketFlow(s_vlan_id, onu1.c_vlan_id, 10) # to check that unicast still flows
Zsolt Harasztid0571402016-03-02 18:40:50 -0800105
Zsolt Harasztif5c6aba2016-03-02 11:41:22 -0800106 # 6. Send in an IGMP join request for one channel (specific multicast address) and verify that
107 # the controller receives it.
Zsolt Harasztid0571402016-03-02 18:40:50 -0800108 self.sendIgmpReport(join=[mcast_groups.ch1])
109
Zsolt Harasztif5c6aba2016-03-02 11:41:22 -0800110 # 7. Setup flows for forwarding multicast traffic from the OLT port toward the ONU(s)
Zsolt Harasztid0571402016-03-02 18:40:50 -0800111 ch1_cookie = self.getCookieBlock()
112 ch1_group_id = 1
113 self.setupMcastChannel(mcast_groups.ch1, mcast_vlan_id, [onu1.port], ch1_group_id, ch1_cookie)
114
Zsolt Harasztif5c6aba2016-03-02 11:41:22 -0800115 # 8. Verify that multicast packets can reach the ONU
Zsolt Harasztid0571402016-03-02 18:40:50 -0800116 self.testMcastFlow(mcast_groups.ch1, mcast_vlan_id, [onu1.port], 10)
117
Zsolt Harasztif5c6aba2016-03-02 11:41:22 -0800118 # 9. Verify that bidirectional unicast traffic still works across the PON
Zsolt Harasztica3e1452016-03-02 23:02:09 -0800119 self.testSustainedPacketFlow(s_vlan_id, onu1.c_vlan_id, 10) # to check that unicast still flows
Zsolt Harasztid0571402016-03-02 18:40:50 -0800120
Zsolt Harasztif5c6aba2016-03-02 11:41:22 -0800121 # 10. Change channel to a new multicast group and verify both multicast receiption as well as
122 # unicast traffic works. This step involves:
123 # - sending a leave message by the ONU to the controller and verify its reception
124 # - sending a join message and verify its reception
125 # - removing the existing multicast flow
126 # - adding a new multicast flow
127 # - verify that original flow no longer flows
128 # - verify new flow
129 # - verify that unicast still works
Zsolt Harasztid0571402016-03-02 18:40:50 -0800130 self.sendIgmpReport(leave=[mcast_groups.ch1], join=[mcast_groups.ch2])
131 self.removeMcastChannel(mcast_groups.ch1, mcast_vlan_id, [onu1.port], ch1_group_id, ch1_cookie)
132 ch2_cookie = self.getCookieBlock()
133 ch2_group_id = 2
134 self.setupMcastChannel(mcast_groups.ch2, mcast_vlan_id, [onu1.port], ch2_group_id, ch2_cookie)
135 self.testMcastFlow(mcast_groups.ch1, mcast_vlan_id, [onu1.port], expect_to_be_blocked=True)
136 self.testMcastFlow(mcast_groups.ch2, mcast_vlan_id, [onu1.port], 10)
Zsolt Harasztica3e1452016-03-02 23:02:09 -0800137 self.testSustainedPacketFlow(s_vlan_id, onu1.c_vlan_id, 10) # to check that unicast still flows
Zsolt Harasztid0571402016-03-02 18:40:50 -0800138
Zsolt Harasztif5c6aba2016-03-02 11:41:22 -0800139 # 11. Add a second channel while keeping the existing one. Verify all what needs to be verified
140 # (similar as above)
Zsolt Harasztid0571402016-03-02 18:40:50 -0800141 self.sendIgmpReport(join=[mcast_groups.ch2, mcast_groups.ch3])
142 ch3_cookie = self.getCookieBlock()
143 ch3_group_id = 3
144 self.setupMcastChannel(mcast_groups.ch3, mcast_vlan_id, [onu1.port], ch3_group_id, ch3_cookie)
145 self.testMcastFlow(mcast_groups.ch1, mcast_vlan_id, [onu1.port], expect_to_be_blocked=True)
146 self.testMcastFlow(mcast_groups.ch2, mcast_vlan_id, [onu1.port], 10)
147 self.testMcastFlow(mcast_groups.ch3, mcast_vlan_id, [onu1.port], 10)
Zsolt Harasztica3e1452016-03-02 23:02:09 -0800148 self.testSustainedPacketFlow(s_vlan_id, onu1.c_vlan_id, 10) # to check that unicast still flows
Zsolt Harasztid0571402016-03-02 18:40:50 -0800149
150 # 12. Add two more multicast channels, and verify everything again
151 self.sendIgmpReport(join=[mcast_groups.ch2, mcast_groups.ch3, mcast_groups.ch4, mcast_groups.ch5])
152 ch4_cookie = self.getCookieBlock()
153 ch4_group_id = 4
154 self.setupMcastChannel(mcast_groups.ch4, mcast_vlan_id, [onu1.port], ch4_group_id, ch4_cookie)
155 ch5_cookie = self.getCookieBlock()
156 ch5_group_id = 5
157 self.setupMcastChannel(mcast_groups.ch5, mcast_vlan_id, [onu1.port], ch5_group_id, ch5_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)
161 self.testMcastFlow(mcast_groups.ch4, mcast_vlan_id, [onu1.port], 10)
162 self.testMcastFlow(mcast_groups.ch5, mcast_vlan_id, [onu1.port], 10)
Zsolt Harasztica3e1452016-03-02 23:02:09 -0800163 self.testSustainedPacketFlow(s_vlan_id, onu1.c_vlan_id, 10) # to check that unicast still flows
Zsolt Harasztid0571402016-03-02 18:40:50 -0800164
165 # 13. Flip a channel for one of the multicast channels, and verify everything (ch3 -> ch1)
166 self.sendIgmpReport(join=[mcast_groups.ch1, mcast_groups.ch2, mcast_groups.ch4, mcast_groups.ch5],
167 leave=[mcast_groups.ch3])
168 self.removeMcastChannel(mcast_groups.ch3, mcast_vlan_id, [onu1.port], ch3_group_id, ch3_cookie)
169 ## reusing the same group id and cookie
170 self.setupMcastChannel(mcast_groups.ch1, mcast_vlan_id, [onu1.port], ch1_group_id, ch1_cookie)
171 self.testMcastFlow(mcast_groups.ch1, mcast_vlan_id, [onu1.port], 10)
172 self.testMcastFlow(mcast_groups.ch2, mcast_vlan_id, [onu1.port], 10)
173 self.testMcastFlow(mcast_groups.ch3, mcast_vlan_id, [onu1.port], expect_to_be_blocked=True)
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 Harasztica3e1452016-03-02 23:02:09 -0800176 self.testSustainedPacketFlow(s_vlan_id, onu1.c_vlan_id, 10) # to check that unicast still flows
Zsolt Harasztif5c6aba2016-03-02 11:41:22 -0800177
178 # 14. Tear down the test.
179 self.resetOlt()
Zsolt Haraszti5b8b39c2016-03-02 22:25:51 -0800180
181
182class TestScenario2TwoOnus(OltBaseTest):
183 """
184 Run a comprehensive test scenario involving the OLT and two ONUs.
185
186 Plan:
187
188 0. Reset the OLT into a clean state
189
190 1. Setup the OLT to pass authentication (EAPOL) to controller from ONU1
191 and test it.
192 2. Setup the OLT to pass unicast traffic for the ONU1
193 3. Verify that unicast traffic works in both directions (use a few hundred frames in both ways)
194 4. Setup IGMP forwarding toward the controller
195 5. Send periodic IGMP queries out toward the ONU1 and verify its arrival
196 6. Send in an IGMP join request for one channel (specific multicast address) and verify that
197 the controller receives it.
198 7. Setup flows for forwarding multicast traffic from the OLT port toward ONU1
199 8. Verify that multicast packets can reach ONU1
200 9. Verify that bidirectional unicast traffic still works across the PON
201 10. Change channel to a new multicast group and verify both multicast receiption as well as
202 unicast traffic works. This step involves:
203 - sending a leave message by the ONU to the controller and verify its reception
204 - sending a join message and verify its reception
205 - removing the existing multicast flow
206 - adding a new multicast flow
207 - verify that original flow no longer flows
208 - verify new flow
209 - verify that unicast still works
210 11. Add a second channel while keeping the existing one. Verify all what needs to be verified
211 (similar as above) - at this point ONU1 is tuned into ch2 and ch3
212
213 12. Setup the OLT to pass authentication (EAPOL) to controller from ONU2
214 and test it.
215 13. Setup the OLT to pass unicast traffic for the ONU2
216 14. Verify that unicast traffic works in both directions (use a few hundred frames in both ways)
217
218 15. Verify that both ONUs can send/receive unicast and ONU1 can still see its 2 channels
219
220 16. Setup IGMP forwarding toward the controller
221 17. Send periodic IGMP queries out toward the ONU2 and verify its arrival
222 18. Send in an IGMP join request for one channel (specific multicast address) and verify that
223 the controller receives it.
224 19. Setup flows for forwarding multicast traffic from the OLT port toward ONU2
225 20. Verify that multicast packets can reach ONU2
226 21. Verify that bidirectional unicast traffic still works across the PON for both ONUs
227 22. Change channel to a new multicast group and verify both multicast receiption as well as
228 unicast traffic works. This step involves:
229 - sending a leave message by the ONU to the controller and verify its reception
230 - sending a join message and verify its reception
231 - removing the existing multicast flow
232 - adding a new multicast flow
233 - verify that original flow no longer flows
234 - verify new flow
235 - verify that unicast still works
236 - verify everything for ONU1 too
237 23. Add a second channel while keeping the existing one. Verify all what needs to be verified
238 (similar as above) - at this point ONU1 is tuned into ch2 and ch3 and ONU2 is
239 tuned to ch2 and ch5
240
241 24. Flip a channel for ONU1 and verify everything
242 25. Tear down the test.
243
244 """
245
Zsolt Harasztica3e1452016-03-02 23:02:09 -0800246 def runTest(self):
247 logging.info("Running %s" % self.__class__.__name__)
248
249 # Some constants
250 s_vlan_id = 111
251 mcast_vlan_id = 140
252 mcast_groups = Thing(
253 ch1="230.10.10.10",
254 ch2="231.11.11.11",
255 ch3="232.12.12.12",
256 ch4="233.13.13.13",
257 ch5="234.14.14.14"
258 )
259 onu1 = Thing(
260 port=onu_port,
261 ip="13.14.14.13",
262 mac="b6:b8:3e:fb:1a:3f",
263 c_vlan_id=13
264 )
265 onu2 = Thing(
266 port=onu_port2,
267 ip="113.114.114.113",
268 mac="b6:b8:3e:fb:aa:aa",
269 c_vlan_id=913
270 )
271
272 # 0. Reset the OLT into a clean state
273 self.resetOlt()
274
275 # 1. Setup the OLT to pass authentication (EAPOL) to controller from ONU1
276 # and test it.
277 self.installEapolRule()
278 self.sendEapolIn()
279
280 # 2. Setup the OLT to pass unicast traffic for the ONU1
281 self.installDoubleTaggingRules(s_vlan_id, onu1.c_vlan_id, self.getCookieBlock())
282
283 # 3. Verify that unicast traffic works in both directions (use a few hundred frames in both ways)
284 self.testPacketFlow(s_vlan_id, onu1.c_vlan_id) # this tests just one packet in each way
285 self.testSustainedPacketFlow(s_vlan_id, onu1.c_vlan_id, 100)
286
287 # 4. Setup IGMP forwarding toward the controller
288 self.installIgmpRule(self.getCookieBlock())
289 self.testSustainedPacketFlow(s_vlan_id, onu1.c_vlan_id, 10) # to check that unicast still flows
290
291 # 5. Send periodic IGMP queries out toward the ONU1 and verify its arrival
292 self.testIgmpQueryOut()
293 self.testSustainedPacketFlow(s_vlan_id, onu1.c_vlan_id, 10) # to check that unicast still flows
294
295 # 6. Send in an IGMP join request for one channel (specific multicast address) and verify that
296 # the controller receives it.
297 self.sendIgmpReport(join=[mcast_groups.ch1])
298
299 # 7. Setup flows for forwarding multicast traffic from the OLT port toward ONU1
300 ch1_cookie = self.getCookieBlock()
301 ch1_group_id = 1
302 self.setupMcastChannel(mcast_groups.ch1, mcast_vlan_id, [onu1.port], ch1_group_id, ch1_cookie)
303
304 # 8. Verify that multicast packets can reach ONU1
305 self.testMcastFlow(mcast_groups.ch1, mcast_vlan_id, [onu1.port], 10)
306
307 # 9. Verify that bidirectional unicast traffic still works across the PON
308 self.testSustainedPacketFlow(s_vlan_id, onu1.c_vlan_id, 10) # to check that unicast still flows
309
310 # 10. Change channel to a new multicast group and verify both multicast receiption as well as
311 # unicast traffic works. This step involves:
312 # - sending a leave message by the ONU to the controller and verify its reception
313 # - sending a join message and verify its reception
314 # - removing the existing multicast flow
315 # - adding a new multicast flow
316 # - verify that original flow no longer flows
317 # - verify new flow
318 # - verify that unicast still works
319 self.sendIgmpReport(leave=[mcast_groups.ch1], join=[mcast_groups.ch2])
320 self.removeMcastChannel(mcast_groups.ch1, mcast_vlan_id, [onu1.port], ch1_group_id, ch1_cookie)
321 ch2_cookie = self.getCookieBlock()
322 ch2_group_id = 2
323 self.setupMcastChannel(mcast_groups.ch2, mcast_vlan_id, [onu1.port], ch2_group_id, ch2_cookie)
324 self.testMcastFlow(mcast_groups.ch1, mcast_vlan_id, [onu1.port], expect_to_be_blocked=True)
325 self.testMcastFlow(mcast_groups.ch2, mcast_vlan_id, [onu1.port], 10)
326 self.testSustainedPacketFlow(s_vlan_id, onu1.c_vlan_id, 10) # to check that unicast still flows
327
328 # 11. Add a second channel while keeping the existing one. Verify all what needs to be verified
329 # (similar as above) - at this point ONU1 is tuned into ch2 and ch3
330 self.sendIgmpReport(join=[mcast_groups.ch2, mcast_groups.ch3])
331 ch3_cookie = self.getCookieBlock()
332 ch3_group_id = 3
333 self.setupMcastChannel(mcast_groups.ch3, mcast_vlan_id, [onu1.port], ch3_group_id, ch3_cookie)
334 self.testMcastFlow(mcast_groups.ch1, mcast_vlan_id, [onu1.port], expect_to_be_blocked=True)
335 self.testMcastFlow(mcast_groups.ch2, mcast_vlan_id, [onu1.port], 10)
336 self.testMcastFlow(mcast_groups.ch3, mcast_vlan_id, [onu1.port], 10)
337 self.testSustainedPacketFlow(s_vlan_id, onu1.c_vlan_id, 10) # to check that unicast still flows
338
339 # 12. Setup the OLT to pass authentication (EAPOL) to controller from ONU2
340 # and test it.
341 self.installEapolRule(onu_port2)
342 self.sendEapolIn(onu_port2)
343
344 # 13. Setup the OLT to pass unicast traffic for the ONU2
345 self.installDoubleTaggingRules(s_vlan_id, onu2.c_vlan_id, self.getCookieBlock(), onu_port2)
346
347 # 14. Verify that unicast traffic works in both directions (use a few hundred frames in both ways)
348 self.testPacketFlow(s_vlan_id, onu2.c_vlan_id, onu_port2) # this tests just one packet in each way
349 self.testSustainedPacketFlow(s_vlan_id, onu2.c_vlan_id, 100, onu=onu_port2)
350
351 # 15. Verify that both ONU1 can send/receive unicast and ONU1 can still see its 2 channels
352 self.testMcastFlow(mcast_groups.ch2, mcast_vlan_id, [onu1.port], 10)
353 self.testMcastFlow(mcast_groups.ch3, mcast_vlan_id, [onu1.port], 10)
354 self.testSustainedPacketFlow(s_vlan_id, onu1.c_vlan_id, 10) # to check that unicast still flows
355
356 # 16. Setup IGMP forwarding toward the controller
357 # Note: this is actually not needed since the rule is not port specific - maybe it should be?
358 #self.installIgmpRule(self.getCookieBlock())
359 #self.testSustainedPacketFlow(s_vlan_id, onu1.c_vlan_id, 10) # to check that unicast still flows
360
361 # 17. Send periodic IGMP queries out toward the ONU2 and verify its arrival
362 self.testIgmpQueryOut(onu_port2)
363 self.testSustainedPacketFlow(s_vlan_id, onu1.c_vlan_id, 10) # to check that unicast still flows
364 self.testSustainedPacketFlow(s_vlan_id, onu2.c_vlan_id, 10, onu=onu_port2) # to check that unicast still flows
365
366 # 18. Send in an IGMP join request for one channel (specific multicast address) and verify that
367 # the controller receives it.
368 self.sendIgmpReport(join=[mcast_groups.ch1], onu=onu_port2)
369
370 # 19. Setup flows for forwarding multicast traffic from the OLT port toward ONU2: ch1
371 self.setupMcastChannel(mcast_groups.ch1, mcast_vlan_id, [onu2.port], ch1_group_id, ch1_cookie)
372
373 # 20. Verify that ch1 multicast packets can reach ONU2, but not ONU1
374 self.testMcastFlow(mcast_groups.ch1, mcast_vlan_id, [onu2.port], 10)
375 self.testMcastFlow(mcast_groups.ch1, mcast_vlan_id, [onu1.port], expect_to_be_blocked=True)
376
377 # 21. Verify that bidirectional unicast traffic still works across the PON for both ONUs
378 self.testSustainedPacketFlow(s_vlan_id, onu1.c_vlan_id, 10)
379 self.testSustainedPacketFlow(s_vlan_id, onu2.c_vlan_id, 10, onu=onu_port2)
380
381 # 22. Change channel to a new multicast group and verify both multicast receiption as well as
382 # unicast traffic works. This step involves:
383 # - sending a leave message by the ONU to the controller and verify its reception
384 # - sending a join message and verify its reception
385 # - removing the existing multicast flow
386 # - adding a new multicast flow
387 # - verify that original flow no longer flows
388 # - verify new flow
389 # - verify that unicast still works
390 # - verify everything for ONU1 too
391 self.sendIgmpReport(join=[mcast_groups.ch2], leave=[mcast_groups.ch1], onu=onu2.port)
392 self.removeMcastChannel(mcast_groups.ch1, mcast_vlan_id, [onu2.port], ch1_group_id, ch1_cookie)
393 self.updateMcastChannel(ch2_group_id, port_list=[onu1.port, onu2.port])
394 self.testMcastFlow(mcast_groups.ch1, mcast_vlan_id, [onu1.port, onu2.port], expect_to_be_blocked=True)
395 self.testMcastFlow(mcast_groups.ch2, mcast_vlan_id, [onu1.port, onu2.port])
396 self.testMcastFlow(mcast_groups.ch3, mcast_vlan_id, [onu1.port])
397 self.testSustainedPacketFlow(s_vlan_id, onu1.c_vlan_id)
398 self.testSustainedPacketFlow(s_vlan_id, onu2.c_vlan_id, onu=onu_port2)
399
400 # 23. Add a second channel for ONU2 while keeping the existing one. Verify all what needs to be verified
401 # (similar as above) - at this point ONU1 is tuned into ch2 and ch3 and ONU2 is
402 # tuned to ch2 and ch5
403 self.sendIgmpReport(join=[mcast_groups.ch2, mcast_groups.ch5], onu=onu2.port)
404 ch5_cookie = self.getCookieBlock()
405 ch5_group_id = 5
406 self.setupMcastChannel(mcast_groups.ch5, mcast_vlan_id, [onu2.port], ch5_group_id, ch5_cookie)
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.testMcastFlow(mcast_groups.ch5, mcast_vlan_id, [onu2.port])
411 self.testSustainedPacketFlow(s_vlan_id, onu1.c_vlan_id)
412 self.testSustainedPacketFlow(s_vlan_id, onu2.c_vlan_id, onu=onu_port2)
413
414 # 24. Flip a channel for ONU1 and verify everything (ch3 -> ch4)
415 self.sendIgmpReport(leave=[mcast_groups.ch3], join=[mcast_groups.ch2, mcast_groups.ch4], onu=onu1.port)
416 self.removeMcastChannel(mcast_groups.ch3, mcast_vlan_id, [onu1.port], ch3_group_id, ch3_cookie)
417 ch4_cookie = self.getCookieBlock()
418 ch4_group_id = 4
419 self.setupMcastChannel(mcast_groups.ch4, mcast_vlan_id, [onu1.port], ch4_group_id, ch4_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, onu2.port], expect_to_be_blocked=True)
423 self.testMcastFlow(mcast_groups.ch4, mcast_vlan_id, [onu1.port])
424 self.testMcastFlow(mcast_groups.ch5, mcast_vlan_id, [onu2.port])
425 self.testSustainedPacketFlow(s_vlan_id, onu1.c_vlan_id)
426 self.testSustainedPacketFlow(s_vlan_id, onu2.c_vlan_id, onu=onu_port2)
427
428 # 25. Tear down the test.
429 self.resetOlt()