]> git.proxmox.com Git - mirror_frr.git/blob - tests/topotests/multicast_pim_static_rp_topo1/test_multicast_pim_static_rp2.py
Merge pull request #12798 from donaldsharp/rib_match_multicast
[mirror_frr.git] / tests / topotests / multicast_pim_static_rp_topo1 / test_multicast_pim_static_rp2.py
1 #!/usr/bin/env python
2 # SPDX-License-Identifier: ISC
3
4 #
5 # Copyright (c) 2019 by VMware, Inc. ("VMware")
6 # Used Copyright (c) 2018 by Network Device Education Foundation,
7 # Inc. ("NetDEF") in this file.
8 #
9
10 """
11 Following tests are covered to test Multicast basic functionality:
12
13 Topology:
14
15 _______r2_____
16 | |
17 iperf | | iperf
18 r0-----r1-------------r3-----r5
19 | |
20 |_____________|
21 r4
22
23 Test steps
24 - Create topology (setup module)
25 - Bring up topology
26
27 TC_1 : Verify upstream interfaces(IIF) and join state are updated properly
28 after adding and deleting the static RP
29 TC_2 : Verify IIF and OIL in "show ip pim state" updated properly after
30 adding and deleting the static RP
31 TC_3: (*, G) Mroute entry are cleared when static RP gets deleted
32 TC_4: Verify (*,G) prune is send towards the RP after deleting the static RP
33 TC_5: Verify OIF entry for RP is cleared when RP becomes unreachable
34 TC_6: Verify IIF and OIL in "show ip pim state" updated properly when RP
35 becomes unreachable
36 TC_7 : Verify upstream interfaces(IIF) and join state are updated properly
37 after adding and deleting the static RP
38 TC_8: Verify (*,G) prune is send towards the RP when RP becomes unreachable
39 TC_9 : Verify RP configured after IGMP join received, PIM join towards RP is
40 sent immediately
41 TC_10 : Verify RP becomes reachable after IGMP join received, PIM join
42 towards RP is sent immediately
43 TC_11 : Verify PIM join send towards the higher preferred RP
44 TC_12 : Verify PIM prune send towards the lower preferred RP
45 TC_13 : Verify RPF interface is updated in mroute (kernel) when higher
46 preferred overlapping RP configured
47 TC_14 : Verify IIF and OIL in "show ip pim state" updated properly when higher
48 preferred overlapping RP configured
49 TC_15 : Verify upstream interfaces(IIF) and join state are updated when higher
50 preferred overlapping RP is configured
51 TC_16 : Verify join is send to lower preferred RP, when higher preferred RP
52 gets deleted
53 TC_17 : Verify prune is send to higher preferred RP when higher preferred RP
54 gets deleted
55 TC_18 : Verify RPF interface updated in mroute when higher preferred RP gets
56 deleted
57 TC_19 : Verify IIF and OIL in "show ip pim state" updated when higher
58 preferred overlapping RP is deleted
59 TC_20 : Verify PIM upstream IIF updated when higher preferred overlapping RP
60 deleted
61 TC_21_1 : Verify OIF and RFP for (*,G) and (S,G) when static RP configure in
62 LHR router
63 TC_21_2 : Verify OIF and RFP for (*,G) and (S,G) when static RP configure in
64 LHR router
65 TC_22_1 : Verify OIF and RPF for (*,G) and (S,G) when static RP configure in
66 FHR router
67 TC_22_2 : Verify OIF and RPF for (*,G) and (S,G) when static RP configure in
68 FHR router
69 TC_23 : Verify (*,G) and (S,G) populated correctly when RPT and SPT path are
70 different
71 TC_24 : Verify (*,G) and (S,G) populated correctly when SPT and RPT share the
72 same path
73 TC_25 : Verify (*,G) and (S,G) populated correctly after clearing the PIM ,
74 IGMP and mroutes joins
75 TC_26 : Restart the PIMd process and verify PIM joins , and mroutes entries
76 TC_27 : Configure multiple groups (10 grps) with same RP address
77 TC_28 : Configure multiple groups (10 grps) with different RP address
78 TC_29 : Verify IIF and OIL in updated in mroute when upstream interface
79 configure as RP
80 TC_30 : Verify IIF and OIL change to other path after shut the primary path
81 TC_31 : Verify RP info and (*,G) mroute after deleting the RP and shut / no
82 shut the RPF interface.
83 TC_32 : Verify RP info and (*,G) mroute after deleting the RP and shut / no
84 shut the RPF interface
85 """
86
87 import os
88 import sys
89 import time
90 from time import sleep
91 import datetime
92 import pytest
93
94 # Save the Current Working Directory to find configuration files.
95 CWD = os.path.dirname(os.path.realpath(__file__))
96 sys.path.append(os.path.join(CWD, "../"))
97 sys.path.append(os.path.join(CWD, "../lib/"))
98
99 # Required to instantiate the topology builder class.
100
101 # pylint: disable=C0413
102 # Import topogen and topotest helpers
103
104 from lib.topogen import Topogen, get_topogen
105 from lib.topolog import logger
106 from lib.topojson import build_topo_from_json, build_config_from_json
107
108 from lib.common_config import (
109 start_topology,
110 write_test_header,
111 write_test_footer,
112 reset_config_on_routers,
113 step,
114 shutdown_bringup_interface,
115 kill_router_daemons,
116 start_router_daemons,
117 create_static_routes,
118 )
119 from lib.pim import (
120 create_pim_config,
121 verify_igmp_groups,
122 verify_upstream_iif,
123 verify_join_state_and_timer,
124 verify_mroutes,
125 verify_pim_neighbors,
126 get_pim_interface_traffic,
127 verify_pim_rp_info,
128 verify_pim_state,
129 clear_pim_interface_traffic,
130 clear_igmp_interfaces,
131 clear_pim_interfaces,
132 clear_mroute,
133 clear_mroute_verify,
134 McastTesterHelper,
135 )
136
137 pytestmark = [pytest.mark.pimd, pytest.mark.staticd]
138
139
140 # Global variables
141 GROUP_RANGE_ALL = "224.0.0.0/4"
142 GROUP_RANGE = "225.1.1.1/32"
143 GROUP_RANGE_LIST_1 = [
144 "225.1.1.1/32",
145 "225.1.1.2/32",
146 "225.1.1.3/32",
147 "225.1.1.4/32",
148 "225.1.1.5/32",
149 ]
150 GROUP_RANGE_LIST_2 = [
151 "225.1.1.6/32",
152 "225.1.1.7/32",
153 "225.1.1.8/32",
154 "225.1.1.9/32",
155 "225.1.1.10/32",
156 ]
157 GROUP_ADDRESS = "225.1.1.1"
158 GROUP_ADDRESS_LIST_1 = ["225.1.1.1", "225.1.1.2", "225.1.1.3", "225.1.1.4", "225.1.1.5"]
159 GROUP_ADDRESS_LIST_2 = [
160 "225.1.1.6",
161 "225.1.1.7",
162 "225.1.1.8",
163 "225.1.1.9",
164 "225.1.1.10",
165 ]
166 STAR = "*"
167 SOURCE_ADDRESS = "10.0.6.2"
168 SOURCE = "Static"
169
170
171 def build_topo(tgen):
172 """Build function"""
173
174 # Building topology from json file
175 build_topo_from_json(tgen, TOPO)
176
177
178 def setup_module(mod):
179 """
180 Sets up the pytest environment
181
182 * `mod`: module name
183 """
184
185 testsuite_run_time = time.asctime(time.localtime(time.time()))
186 logger.info("Testsuite start time: %s", testsuite_run_time)
187 logger.info("=" * 40)
188
189 topology = """
190
191 _______r2_____
192 | |
193 iperf | | iperf
194 r0-----r1-------------r3-----r5
195 | |
196 |_____________|
197 r4
198
199 """
200 logger.info("Master Topology: \n %s", topology)
201
202 logger.info("Running setup_module to create topology")
203
204 # This function initiates the topology build with Topogen...
205 json_file = "{}/multicast_pim_static_rp.json".format(CWD)
206 tgen = Topogen(json_file, mod.__name__)
207 global TOPO
208 TOPO = tgen.json_topo
209
210 # ... and here it calls Mininet initialization functions.
211
212 # Starting topology, create tmp files which are loaded to routers
213 # to start daemons and then start routers
214 start_topology(tgen)
215
216 # Don"t run this test if we have any failure.
217 if tgen.routers_have_failure():
218 pytest.skip(tgen.errors)
219
220 # Creating configuration from JSON
221 build_config_from_json(tgen, TOPO)
222
223 # Verify PIM neighbors
224 result = verify_pim_neighbors(tgen, TOPO)
225 assert result is True, "setup_module :Failed \n Error:" " {}".format(result)
226
227 # XXX Replace this using "with McastTesterHelper()... " in each test if possible.
228 global app_helper
229 app_helper = McastTesterHelper(tgen)
230
231 logger.info("Running setup_module() done")
232
233
234 def teardown_module():
235 """Teardown the pytest environment"""
236
237 logger.info("Running teardown_module to delete topology")
238
239 tgen = get_topogen()
240
241 app_helper.cleanup()
242
243 # Stop toplogy and Remove tmp files
244 tgen.stop_topology()
245
246 logger.info("Testsuite end time: %s", time.asctime(time.localtime(time.time())))
247 logger.info("=" * 40)
248
249
250 #####################################################
251 #
252 # Testcases
253 #
254 #####################################################
255
256
257 def verify_mroute_repopulated(uptime_before, uptime_after):
258 """
259 API to compare uptime for mroutes
260
261 Parameters
262 ----------
263 * `uptime_before` : Uptime dictionary for any particular instance
264 * `uptime_after` : Uptime dictionary for any particular instance
265 """
266
267 for group in uptime_before.keys():
268 for source in uptime_before[group].keys():
269 if set(uptime_before[group]) != set(uptime_after[group]):
270 errormsg = (
271 "mroute (%s, %s) has not come"
272 " up after mroute clear [FAILED!!]" % (source, group)
273 )
274 return errormsg
275
276 d_1 = datetime.datetime.strptime(uptime_before[group][source], "%H:%M:%S")
277 d_2 = datetime.datetime.strptime(uptime_after[group][source], "%H:%M:%S")
278 if d_2 >= d_1:
279 errormsg = "mroute (%s, %s) is not " "repopulated [FAILED!!]" % (
280 source,
281 group,
282 )
283 return errormsg
284
285 logger.info("mroute (%s, %s) is " "repopulated [PASSED!!]", source, group)
286
287 return True
288
289
290 def verify_state_incremented(state_before, state_after):
291 """
292 API to compare interface traffic state incrementing
293
294 Parameters
295 ----------
296 * `state_before` : State dictionary for any particular instance
297 * `state_after` : State dictionary for any particular instance
298 """
299
300 for router, state_data in state_before.items():
301 for state, _ in state_data.items():
302 if state_before[router][state] >= state_after[router][state]:
303 errormsg = (
304 "[DUT: %s]: state %s value has not"
305 " incremented, Initial value: %s, "
306 "Current value: %s [FAILED!!]"
307 % (
308 router,
309 state,
310 state_before[router][state],
311 state_after[router][state],
312 )
313 )
314 return errormsg
315
316 logger.info(
317 "[DUT: %s]: State %s value is "
318 "incremented, Initial value: %s, Current value: %s"
319 " [PASSED!!]",
320 router,
321 state,
322 state_before[router][state],
323 state_after[router][state],
324 )
325
326 return True
327
328
329 def test_restart_pimd_process_p2(request):
330 """
331 TC_26_P2: Restart the PIMd process and verify PIM upstream and mroutes
332 entries
333 Topology used:
334 ________r2_____
335 | |
336 iperf | | iperf
337 r0-----r1-------------r3-----r5
338 | |
339 |_____________|
340 r4
341 r1 : LHR
342 r2 : RP
343 r3 : FHR
344 """
345
346 tgen = get_topogen()
347 tc_name = request.node.name
348 write_test_header(tc_name)
349
350 # Don"t run this test if we have any failure.
351 if tgen.routers_have_failure():
352 pytest.skip(tgen.errors)
353
354 step("Creating configuration from JSON")
355 reset_config_on_routers(tgen)
356 app_helper.stop_all_hosts()
357 clear_mroute(tgen)
358 clear_pim_interface_traffic(tgen, TOPO)
359
360 step("Enable IGMP on r1 interface and send IGMP join (225.1.1.1) to R1")
361 step("Configure RP on r3 (loopback interface) for the group range" " 224.0.0.0/4")
362 step("Enable the PIM on all the interfaces of r1, r2, r3 and r4 routers")
363 step("Send multicast traffic from R3")
364 step("Restart the PIMd process")
365
366 step("r2: Verify RP info")
367 dut = "r2"
368 rp_address = "1.0.2.17"
369 oif = "lo"
370 result = verify_pim_rp_info(
371 tgen, TOPO, dut, GROUP_RANGE_ALL, oif, rp_address, SOURCE
372 )
373 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
374
375 step("r0: Send IGMP join")
376 result = app_helper.run_join("r0", GROUP_ADDRESS, "r1")
377 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
378
379 step("r1: Verify IGMP groups")
380 dut = "r1"
381 oif = "r1-r0-eth0"
382 result = verify_igmp_groups(tgen, dut, oif, GROUP_ADDRESS)
383 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
384
385 step("r5: Send multicast traffic for group 225.1.1.1")
386 result = app_helper.run_traffic("r5", GROUP_ADDRESS, "r3")
387 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
388
389 step("r1: Verify (*, G) upstream IIF interface")
390 iif = "r1-r2-eth1"
391 result = verify_upstream_iif(tgen, dut, iif, STAR, GROUP_ADDRESS)
392 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
393
394 step("r1: Verify (*, G) upstream join state and join timer")
395 result = verify_join_state_and_timer(tgen, dut, iif, STAR, GROUP_ADDRESS)
396 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
397
398 step("r1: Verify (*, G) ip mroutes")
399 result = verify_mroutes(tgen, dut, STAR, GROUP_ADDRESS, iif, oif)
400 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
401
402 step("r1: Verify (S, G) upstream IIF interface")
403 iif = "r1-r3-eth2"
404 result = verify_upstream_iif(tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS)
405 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
406
407 step("r1: Verify (S, G) upstream join state and join timer")
408 result = verify_join_state_and_timer(tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS)
409 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
410
411 step("r1: Verify (S, G) ip mroutes")
412 result = verify_mroutes(tgen, dut, SOURCE_ADDRESS, GROUP_ADDRESS, iif, oif)
413 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
414
415 step("r2: Verify (*, G) upstream IIF interface")
416 dut = "r2"
417 iif = "lo"
418 result = verify_upstream_iif(tgen, dut, iif, STAR, GROUP_ADDRESS)
419 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
420
421 step("r2: Verify (*, G) upstream join state and join timer")
422 result = verify_join_state_and_timer(tgen, dut, iif, STAR, GROUP_ADDRESS)
423 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
424
425 step("r2: Verify (*, G) ip mroutes")
426 oif = "r2-r1-eth0"
427 result = verify_mroutes(tgen, dut, STAR, GROUP_ADDRESS, iif, oif)
428 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
429
430 step("r3: Verify (S, G) upstream IIF interface")
431 dut = "r3"
432 iif = "r3-r5-eth3"
433 result = verify_upstream_iif(tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS)
434 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
435
436 step("r3: Verify (S, G) upstream join state and join timer")
437 result = verify_join_state_and_timer(
438 tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS, expected=False
439 )
440 assert result is not True, (
441 "Testcase {} : Failed \n "
442 "Expected: [{}]: Upstream Join State should not be Joined and "
443 "join timer should not run\n "
444 "Found: {}".format(tc_name, dut, result)
445 )
446
447 step("r3: Verify (S, G) ip mroutes")
448 oif = "r3-r1-eth0"
449 result = verify_mroutes(tgen, dut, SOURCE_ADDRESS, GROUP_ADDRESS, iif, oif)
450 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
451
452 dut = "r1"
453 iif = "r1-r2-eth1"
454 oil = "r1-r0-eth0"
455 logger.info("waiting for 10 sec to make sure old mroute time is higher")
456 sleep(10)
457 # Why do we then wait 60 seconds below before checking the routes?
458 uptime_before = verify_mroutes(
459 tgen, dut, STAR, GROUP_ADDRESS, iif, oil, return_uptime=True, mwait=60
460 )
461 assert isinstance(uptime_before, dict), "Testcase{} : Failed Error: {}".format(
462 tc_name, result
463 )
464
465 step("r1: Kill pimd process")
466 kill_router_daemons(tgen, "r1", ["pimd"])
467
468 step("r1 : Start pimd process")
469 start_router_daemons(tgen, "r1", ["pimd"])
470
471 logger.info("Waiting for 5sec to get PIMd restarted and mroute" " re-learned..")
472 sleep(5)
473
474 # Why do we then wait 10 seconds below before checking the routes?
475 uptime_after = verify_mroutes(
476 tgen, dut, STAR, GROUP_ADDRESS, iif, oil, return_uptime=True, mwait=10
477 )
478 assert isinstance(uptime_after, dict), "Testcase{} : Failed Error: {}".format(
479 tc_name, result
480 )
481
482 result = verify_mroute_repopulated(uptime_before, uptime_after)
483 assert result is True, "Testcase{} : Failed Error: {}".format(tc_name, result)
484
485 write_test_footer(tc_name)
486
487
488 def test_multiple_groups_same_RP_address_p2(request):
489 """
490 TC_27_P2: Configure multiple groups (10 grps) with same RP address
491
492 Topology used:
493 ________r2_____
494 | |
495 iperf | | iperf
496 r0-----r1-------------r3-----r5
497
498 r1 : LHR
499 r2 : RP
500 r3 : FHR
501 """
502
503 tgen = get_topogen()
504 tc_name = request.node.name
505 write_test_header(tc_name)
506
507 # Don"t run this test if we have any failure.
508 if tgen.routers_have_failure():
509 pytest.skip(tgen.errors)
510
511 step("Creating configuration from JSON")
512 reset_config_on_routers(tgen)
513 app_helper.stop_all_hosts()
514 clear_mroute(tgen)
515 clear_pim_interface_traffic(tgen, TOPO)
516
517 step("Enable IGMP on r1 interface and send IGMP join (225.1.1.1) to r1")
518 step("Configure RP on r2 (loopback interface) for the group range" "225.1.1.0/24")
519 step("Enable the PIM on all the interfaces of r1-r2-r3")
520 step("Send multicast traffic from r5 to all the groups")
521 step("r1 : Remove the groups to RP mapping one by one")
522 step("r1: Shut the upstream interfaces")
523 step("r1: No shut the upstream interfaces")
524 step("r1: Configure the RP again")
525 step("r1: Shut the receiver interfaces")
526 step("r1: No Shut the receiver interfaces")
527 step("r2: Verify RP info")
528
529 step("r2: verify rp-info")
530 dut = "r2"
531 rp_address = "1.0.2.17"
532 oif = "lo"
533 result = verify_pim_rp_info(
534 tgen, TOPO, dut, GROUP_RANGE_ALL, oif, rp_address, SOURCE
535 )
536 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
537
538 group_address_list = GROUP_ADDRESS_LIST_1 + GROUP_ADDRESS_LIST_2
539 step("r0: Send IGMP join for 10 groups")
540 result = app_helper.run_join("r0", group_address_list, "r1")
541 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
542
543 step("r1: Verify IGMP groups")
544 dut = "r1"
545 oif = "r1-r0-eth0"
546 result = verify_igmp_groups(tgen, dut, oif, group_address_list)
547 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
548
549 step("r5: Send multicast traffic for group 225.1.1.1")
550 result = app_helper.run_traffic("r5", group_address_list, "r3")
551 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
552
553 step("r1: Verify (*, G) upstream IIF interface")
554 dut = "r1"
555 iif = "r1-r2-eth1"
556 result = verify_upstream_iif(tgen, dut, iif, STAR, group_address_list)
557 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
558
559 step("r1: Verify (*, G) upstream join state and join timer")
560 result = verify_join_state_and_timer(tgen, dut, iif, STAR, group_address_list)
561 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
562
563 step("r1: Verify (*, G) ip mroutes")
564 oif = "r1-r0-eth0"
565 result = verify_mroutes(tgen, dut, STAR, group_address_list, iif, oif)
566 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
567
568 step("r1: Verify (S, G) upstream IIF interface")
569 iif = "r1-r3-eth2"
570 result = verify_upstream_iif(tgen, dut, iif, SOURCE_ADDRESS, group_address_list)
571 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
572
573 step("r1: Verify (S, G) upstream join state and join timer")
574 result = verify_join_state_and_timer(
575 tgen, dut, iif, SOURCE_ADDRESS, group_address_list
576 )
577 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
578
579 step("r1: Verify (S, G) ip mroutes")
580 result = verify_mroutes(tgen, dut, SOURCE_ADDRESS, group_address_list, iif, oif)
581 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
582
583 step("r2: Verify (*, G) upstream IIF interface")
584 dut = "r2"
585 iif = "lo"
586 result = verify_upstream_iif(tgen, dut, iif, STAR, group_address_list)
587 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
588
589 step("r2: Verify (*, G) upstream join state and join timer")
590 result = verify_join_state_and_timer(tgen, dut, iif, STAR, group_address_list)
591 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
592
593 step("r2: Verify (*, G) ip mroutes")
594 oif = "r2-r1-eth0"
595 result = verify_mroutes(tgen, dut, STAR, group_address_list, iif, oif)
596 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
597
598 step("r3: Verify (S, G) upstream IIF interface")
599 dut = "r3"
600 iif = "r3-r5-eth3"
601 result = verify_upstream_iif(tgen, dut, iif, SOURCE_ADDRESS, group_address_list)
602 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
603
604 step("r3: Verify (S, G) upstream join state and join timer")
605 result = verify_join_state_and_timer(
606 tgen, dut, iif, SOURCE_ADDRESS, group_address_list, expected=False
607 )
608 assert result is not True, (
609 "Testcase {} : Failed \n "
610 "Expected: [{}]: Upstream Join State should not be Joined and "
611 "join timer should not run\n "
612 "Found: {}".format(tc_name, dut, result)
613 )
614
615 step("r3: Verify (S, G) ip mroutes")
616 oif = "r3-r1-eth0"
617 result = verify_mroutes(tgen, dut, SOURCE_ADDRESS, group_address_list, iif, oif)
618 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
619
620 step("r2: Verify (S, G) upstream IIF interface")
621 dut = "r2"
622 iif = "r2-r3-eth1"
623 result = verify_upstream_iif(
624 tgen, dut, iif, SOURCE_ADDRESS, group_address_list, joinState="NotJoined"
625 )
626 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
627
628 step("r2: Verify (S, G) upstream join state and join timer")
629 result = verify_join_state_and_timer(
630 tgen, dut, iif, SOURCE_ADDRESS, group_address_list, expected=False
631 )
632 assert result is not True, (
633 "Testcase {} : Failed \n "
634 "Expected: [{}]: Upstream Join State should not be Joined and "
635 "join timer should not run\n "
636 "Found: {}".format(tc_name, dut, result)
637 )
638
639 step("r2: Verify (S, G) ip mroutes")
640 oif = "none"
641 result = verify_mroutes(tgen, dut, SOURCE_ADDRESS, group_address_list, iif, oif)
642 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
643
644 step("r1: Delete RP configuration")
645 input_dict = {
646 "r1": {
647 "pim": {
648 "rp": [
649 {
650 "rp_addr": "1.0.2.17",
651 "group_addr_range": GROUP_RANGE_ALL,
652 "delete": True,
653 }
654 ]
655 }
656 }
657 }
658
659 result = create_pim_config(tgen, TOPO, input_dict)
660 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
661
662 step("r1: Shut the interface r1-r2-eth1 from R1 to R2")
663 dut = "r1"
664 intf = "r1-r2-eth1"
665 shutdown_bringup_interface(tgen, dut, intf, False)
666
667 step("r1: No Shut the interface r1-r2-eth1 from R1 to R2")
668 intf = "r1-r2-eth1"
669 shutdown_bringup_interface(tgen, dut, intf, True)
670
671 step("r1: Configure RP")
672 input_dict = {
673 "r1": {
674 "pim": {
675 "rp": [
676 {
677 "rp_addr": "1.0.2.17",
678 "group_addr_range": GROUP_RANGE_ALL,
679 }
680 ]
681 }
682 }
683 }
684
685 result = create_pim_config(tgen, TOPO, input_dict)
686 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
687
688 step("r1: Shut the interface r1-r0-eth0 from R1 to R2")
689 intf = "r1-r0-eth0"
690 shutdown_bringup_interface(tgen, dut, intf, False)
691
692 step("r1: No Shut the interface r1-r0-eth0 from R1 to R2")
693 intf = "r1-r0-eth0"
694 shutdown_bringup_interface(tgen, dut, intf, True)
695
696 step("r1: Verify (*, G) upstream IIF interface")
697 dut = "r1"
698 iif = "r1-r2-eth1"
699 result = verify_upstream_iif(tgen, dut, iif, STAR, group_address_list)
700 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
701
702 step("r1: Verify (*, G) upstream join state and join timer")
703 result = verify_join_state_and_timer(tgen, dut, iif, STAR, group_address_list)
704 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
705
706 step("r1: Verify (*, G) ip mroutes")
707 oif = "r1-r0-eth0"
708 result = verify_mroutes(tgen, dut, STAR, group_address_list, iif, oif)
709 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
710
711 step("r1: Verify (S, G) upstream IIF interface")
712 iif = "r1-r3-eth2"
713 result = verify_upstream_iif(tgen, dut, iif, SOURCE_ADDRESS, group_address_list)
714 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
715
716 step("r1: Verify (S, G) upstream join state and join timer")
717 result = verify_join_state_and_timer(
718 tgen, dut, iif, SOURCE_ADDRESS, group_address_list
719 )
720 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
721
722 step("r1: Verify (S, G) ip mroutes")
723 result = verify_mroutes(tgen, dut, SOURCE_ADDRESS, group_address_list, iif, oif)
724 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
725
726 step("r2: Verify (*, G) upstream IIF interface")
727 dut = "r2"
728 iif = "lo"
729 result = verify_upstream_iif(tgen, dut, iif, STAR, group_address_list)
730 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
731
732 step("r2: Verify (*, G) upstream join state and join timer")
733 result = verify_join_state_and_timer(tgen, dut, iif, STAR, group_address_list)
734 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
735
736 step("r2: Verify (*, G) ip mroutes")
737 oif = "r2-r1-eth0"
738 result = verify_mroutes(tgen, dut, STAR, group_address_list, iif, oif)
739 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
740
741 step("r2: Verify (S, G) upstream IIF interface")
742 dut = "r2"
743 iif = "r2-r3-eth1"
744 result = verify_upstream_iif(
745 tgen, dut, iif, SOURCE_ADDRESS, group_address_list, joinState="NotJoined"
746 )
747 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
748
749 step("r2: Verify (S, G) upstream join state and join timer")
750 result = verify_join_state_and_timer(
751 tgen, dut, iif, SOURCE_ADDRESS, group_address_list, expected=False
752 )
753 assert result is not True, (
754 "Testcase {} : Failed \n "
755 "Expected: [{}]: Upstream Join State should not be Joined and "
756 "join timer should not run\n "
757 "Found: {}".format(tc_name, dut, result)
758 )
759
760 step("r2: Verify (S, G) ip mroutes")
761 oif = "none"
762 result = verify_mroutes(tgen, dut, SOURCE_ADDRESS, group_address_list, iif, oif)
763 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
764
765 step("r3: Verify (S, G) upstream IIF interface")
766 dut = "r3"
767 iif = "r3-r5-eth3"
768 result = verify_upstream_iif(tgen, dut, iif, SOURCE_ADDRESS, group_address_list)
769 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
770
771 step("r3: Verify (S, G) upstream join state and join timer")
772 result = verify_join_state_and_timer(
773 tgen, dut, iif, SOURCE_ADDRESS, group_address_list, expected=False
774 )
775 assert result is not True, (
776 "Testcase {} : Failed \n "
777 "Expected: [{}]: Upstream Join State should not be Joined and "
778 "join timer should not run\n "
779 "Found: {}".format(tc_name, dut, result)
780 )
781
782 step("r3: Verify (S, G) ip mroutes")
783 oif = "r3-r1-eth0"
784 result = verify_mroutes(tgen, dut, SOURCE_ADDRESS, group_address_list, iif, oif)
785 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
786
787 write_test_footer(tc_name)
788
789
790 def test_multiple_groups_different_RP_address_p2(request):
791 """
792 TC_28_P2: Verify IIF and OIL in updated in mroute when upstream interface
793 configure as RP
794
795 Topology used:
796 ________r2_____
797 | |
798 iperf | | iperf
799 r0-----r1-------------r3-----r5
800 | |
801 |_____________|
802 r4
803 r1 : LHR
804 r2 & r4 : RP
805 r3 : FHR
806 """
807
808 tgen = get_topogen()
809 tc_name = request.node.name
810 write_test_header(tc_name)
811
812 # Don"t run this test if we have any failure.
813 if tgen.routers_have_failure():
814 pytest.skip(tgen.errors)
815
816 step("Creating configuration from JSON")
817 reset_config_on_routers(tgen)
818 app_helper.stop_all_hosts()
819 clear_mroute(tgen)
820 clear_pim_interface_traffic(tgen, TOPO)
821
822 step("Delete existing RP configuration")
823 input_dict = {
824 "r2": {
825 "pim": {
826 "rp": [
827 {
828 "rp_addr": "1.0.2.17",
829 "group_addr_range": GROUP_RANGE_ALL,
830 "delete": True,
831 }
832 ]
833 }
834 }
835 }
836 result = create_pim_config(tgen, TOPO, input_dict)
837 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
838
839 input_dict = {
840 "r2": {
841 "pim": {
842 "rp": [
843 {
844 "rp_addr": "1.0.2.17",
845 "group_addr_range": GROUP_RANGE_LIST_1,
846 }
847 ]
848 }
849 },
850 "r4": {
851 "pim": {
852 "rp": [
853 {
854 "rp_addr": "1.0.4.17",
855 "group_addr_range": GROUP_RANGE_LIST_2,
856 }
857 ]
858 }
859 },
860 }
861 result = create_pim_config(tgen, TOPO, input_dict)
862 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
863
864 step("r2: Verify RP info")
865 dut = "r2"
866 rp_address = "1.0.2.17"
867 oif = "lo"
868 result = verify_pim_rp_info(
869 tgen, TOPO, dut, GROUP_RANGE_LIST_1, oif, rp_address, SOURCE
870 )
871 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
872
873 step("r4: Verify RP info")
874 dut = "r4"
875 rp_address = "1.0.4.17"
876 result = verify_pim_rp_info(
877 tgen, TOPO, dut, GROUP_RANGE_LIST_2, oif, rp_address, SOURCE
878 )
879 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
880
881 group_address_list = GROUP_ADDRESS_LIST_1 + GROUP_ADDRESS_LIST_2
882 step("r0: Send IGMP join")
883 result = app_helper.run_join("r0", group_address_list, "r1")
884 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
885
886 step("r1: Verify IGMP groups")
887 dut = "r1"
888 oif = "r1-r0-eth0"
889 result = verify_igmp_groups(tgen, dut, oif, group_address_list)
890 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
891
892 step("r5: Send multicast traffic for group 225.1.1.1")
893 result = app_helper.run_traffic("r5", group_address_list, "r3")
894 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
895
896 step("r1: Verify (*, G) upstream IIF interface")
897 dut = "r1"
898 iif = "r1-r2-eth1"
899 result = verify_upstream_iif(tgen, dut, iif, STAR, GROUP_ADDRESS_LIST_1)
900 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
901
902 step("r1: Verify (*, G) upstream join state and join timer")
903 result = verify_join_state_and_timer(tgen, dut, iif, STAR, GROUP_ADDRESS_LIST_1)
904 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
905
906 step("r1: Verify (*, G) ip mroutes")
907 result = verify_mroutes(tgen, dut, STAR, GROUP_ADDRESS_LIST_1, iif, oif)
908 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
909
910 step("r1: Verify (S, G) upstream IIF interface")
911 iif = "r1-r3-eth2"
912 result = verify_upstream_iif(tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS_LIST_1)
913 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
914
915 step("r1: Verify (S, G) upstream join state and join timer")
916 result = verify_join_state_and_timer(
917 tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS_LIST_1
918 )
919 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
920
921 step("r1: Verify (S, G) ip mroutes")
922 result = verify_mroutes(tgen, dut, SOURCE_ADDRESS, GROUP_ADDRESS_LIST_1, iif, oif)
923 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
924
925 step("r2: Verify (*, G) upstream IIF interface")
926 dut = "r2"
927 iif = "lo"
928 result = verify_upstream_iif(tgen, dut, iif, STAR, GROUP_ADDRESS_LIST_1)
929 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
930
931 step("r2: Verify (*, G) upstream join state and join timer")
932 result = verify_join_state_and_timer(tgen, dut, iif, STAR, GROUP_ADDRESS_LIST_1)
933 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
934
935 step("r2: Verify (*, G) ip mroutes")
936 oif = "r2-r1-eth0"
937 result = verify_mroutes(tgen, dut, STAR, GROUP_ADDRESS_LIST_1, iif, oif)
938 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
939
940 step("r2: Verify (S, G) upstream IIF interface")
941 iif = "r2-r3-eth1"
942 result = verify_upstream_iif(
943 tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS_LIST_1, joinState="NotJoined"
944 )
945 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
946
947 step("r2: Verify (S, G) upstream join state and join timer")
948 result = verify_join_state_and_timer(
949 tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS_LIST_1, expected=False
950 )
951 assert result is not True, (
952 "Testcase {} : Failed \n "
953 "Expected: [{}]: Upstream Join State should not be Joined and "
954 "join timer should not run\n "
955 "Found: {}".format(tc_name, dut, result)
956 )
957
958 step("r2: Verify (S, G) ip mroutes")
959 oif = "none"
960 result = verify_mroutes(tgen, dut, SOURCE_ADDRESS, GROUP_ADDRESS_LIST_1, iif, oif)
961 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
962
963 step("r3: Verify (S, G) upstream IIF interface")
964 dut = "r3"
965 iif = "r3-r5-eth3"
966 result = verify_upstream_iif(tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS_LIST_1)
967 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
968
969 step("r3: Verify (S, G) upstream join state and join timer")
970 result = verify_join_state_and_timer(
971 tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS_LIST_1, expected=False
972 )
973 assert result is not True, (
974 "Testcase {} : Failed \n "
975 "Expected: [{}]: Upstream Join State should not be Joined and "
976 "join timer should not run\n "
977 "Found: {}".format(tc_name, dut, result)
978 )
979
980 step("r3: Verify (S, G) ip mroutes")
981 oif = "r3-r1-eth0"
982 result = verify_mroutes(tgen, dut, SOURCE_ADDRESS, GROUP_ADDRESS_LIST_1, iif, oif)
983 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
984
985 step("r1: Verify (*, G) upstream IIF interface")
986 dut = "r1"
987 iif = "r1-r4-eth3"
988 result = verify_upstream_iif(tgen, dut, iif, STAR, GROUP_ADDRESS_LIST_2)
989 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
990
991 step("r1: Verify (*, G) upstream join state and join timer")
992 result = verify_join_state_and_timer(tgen, dut, iif, STAR, GROUP_ADDRESS_LIST_2)
993 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
994
995 step("r1: Verify (*, G) ip mroutes")
996 oif = "r1-r0-eth0"
997 result = verify_mroutes(tgen, dut, STAR, GROUP_ADDRESS_LIST_2, iif, oif)
998 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
999
1000 step("r1: Verify (S, G) upstream IIF interface")
1001 iif = "r1-r3-eth2"
1002 result = verify_upstream_iif(tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS_LIST_2)
1003 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1004
1005 step("r1: Verify (S, G) upstream join state and join timer")
1006 result = verify_join_state_and_timer(
1007 tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS_LIST_2
1008 )
1009 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1010
1011 step("r1: Verify (S, G) ip mroutes")
1012 result = verify_mroutes(tgen, dut, SOURCE_ADDRESS, GROUP_ADDRESS_LIST_2, iif, oif)
1013 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1014
1015 step("r4: Verify (*, G) upstream IIF interface")
1016 dut = "r4"
1017 iif = "lo"
1018 result = verify_upstream_iif(tgen, dut, iif, STAR, GROUP_ADDRESS_LIST_2)
1019 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1020
1021 step("r4: Verify (*, G) upstream join state and join timer")
1022 result = verify_join_state_and_timer(tgen, dut, iif, STAR, GROUP_ADDRESS_LIST_2)
1023 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1024
1025 step("r4: Verify (*, G) ip mroutes")
1026 oif = "r4-r1-eth0"
1027 result = verify_mroutes(tgen, dut, STAR, GROUP_ADDRESS_LIST_2, iif, oif)
1028 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1029
1030 step("r4: Verify (S, G) upstream IIF interface")
1031 iif = "r4-r3-eth1"
1032 result = verify_upstream_iif(
1033 tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS_LIST_2, joinState="NotJoined"
1034 )
1035 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1036
1037 step("r4: Verify (S, G) upstream join state and join timer")
1038 result = verify_join_state_and_timer(
1039 tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS_LIST_2, expected=False
1040 )
1041 assert result is not True, (
1042 "Testcase {} : Failed \n "
1043 "Expected: [{}]: Upstream Join State should not be Joined and "
1044 "join timer should not run\n "
1045 "Found: {}".format(tc_name, dut, result)
1046 )
1047
1048 step("r4: Verify (S, G) ip mroutes")
1049 oif = "none"
1050 result = verify_mroutes(tgen, dut, SOURCE_ADDRESS, GROUP_ADDRESS_LIST_2, iif, oif)
1051 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1052
1053 step("r3: Verify (S, G) upstream IIF interface")
1054 dut = "r3"
1055 iif = "r3-r5-eth3"
1056 result = verify_upstream_iif(tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS_LIST_2)
1057 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1058
1059 step("r3: Verify (S, G) upstream join state and join timer")
1060 result = verify_join_state_and_timer(
1061 tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS_LIST_2, expected=False
1062 )
1063 assert result is not True, (
1064 "Testcase {} : Failed \n "
1065 "Expected: [{}]: Upstream Join State should not be Joined and "
1066 "join timer should not run\n "
1067 "Found: {}".format(tc_name, dut, result)
1068 )
1069
1070 step("r3: Verify (S, G) ip mroutes")
1071 oif = "r3-r1-eth0"
1072 result = verify_mroutes(tgen, dut, SOURCE_ADDRESS, GROUP_ADDRESS_LIST_2, iif, oif)
1073 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1074
1075 step("Delete RP configuration")
1076 input_dict = {
1077 "r2": {
1078 "pim": {
1079 "rp": [
1080 {
1081 "rp_addr": "1.0.2.17",
1082 "group_addr_range": GROUP_RANGE_LIST_1,
1083 "delete": True,
1084 }
1085 ]
1086 }
1087 },
1088 "r4": {
1089 "pim": {
1090 "rp": [
1091 {
1092 "rp_addr": "1.0.4.17",
1093 "group_addr_range": GROUP_RANGE_LIST_2,
1094 "delete": True,
1095 }
1096 ]
1097 }
1098 },
1099 }
1100 result = create_pim_config(tgen, TOPO, input_dict)
1101 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1102
1103 step("r1, r2, r3, r4: Re-configure RP")
1104 input_dict = {
1105 "r2": {
1106 "pim": {
1107 "rp": [
1108 {
1109 "rp_addr": "1.0.2.17",
1110 "group_addr_range": GROUP_RANGE_LIST_1,
1111 }
1112 ]
1113 }
1114 },
1115 "r4": {
1116 "pim": {
1117 "rp": [
1118 {
1119 "rp_addr": "1.0.4.17",
1120 "group_addr_range": GROUP_RANGE_LIST_2,
1121 }
1122 ]
1123 }
1124 },
1125 }
1126 result = create_pim_config(tgen, TOPO, input_dict)
1127 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1128
1129 step("r1: Shut the interface r1-r2-eth1 from R1 to R2")
1130 dut = "r1"
1131 intf = "r1-r2-eth1"
1132 shutdown_bringup_interface(tgen, dut, intf, False)
1133
1134 step("r1: No shut the interface r1-r2-eth1 from R1 to R2")
1135 dut = "r1"
1136 intf = "r1-r2-eth1"
1137 shutdown_bringup_interface(tgen, dut, intf, True)
1138
1139 step("r1: Shut the interface r1-r2-eth1 from R1 to R4")
1140 dut = "r1"
1141 intf = "r1-r4-eth3"
1142 shutdown_bringup_interface(tgen, dut, intf, False)
1143
1144 step("r1: No shut the interface r1-r2-eth1 from R1 to r4")
1145 dut = "r1"
1146 intf = "r1-r4-eth3"
1147 shutdown_bringup_interface(tgen, dut, intf, True)
1148
1149 step("r1: Shut the interface r1-r0-eth0 from R1 to R0")
1150 dut = "r1"
1151 intf = "r1-r0-eth0"
1152 shutdown_bringup_interface(tgen, dut, intf, False)
1153
1154 step("r1: No Shut the interface r1-r0-eth0 from R1 to R0")
1155 dut = "r1"
1156 intf = "r1-r0-eth0"
1157 shutdown_bringup_interface(tgen, dut, intf, True)
1158
1159 step("r1: Verify (*, G) upstream IIF interface")
1160 dut = "r1"
1161 iif = "r1-r2-eth1"
1162 result = verify_upstream_iif(tgen, dut, iif, STAR, GROUP_ADDRESS_LIST_1)
1163 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1164
1165 step("r1: Verify (*, G) upstream join state and join timer")
1166 result = verify_join_state_and_timer(tgen, dut, iif, STAR, GROUP_ADDRESS_LIST_1)
1167 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1168
1169 step("r1: Verify (*, G) ip mroutes")
1170 oif = "r1-r0-eth0"
1171 result = verify_mroutes(tgen, dut, STAR, GROUP_ADDRESS_LIST_1, iif, oif)
1172 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1173
1174 step("r1: Verify (S, G) upstream IIF interface")
1175 iif = "r1-r3-eth2"
1176 result = verify_upstream_iif(tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS_LIST_1)
1177 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1178
1179 step("r1: Verify (S, G) upstream join state and join timer")
1180 result = verify_join_state_and_timer(
1181 tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS_LIST_1
1182 )
1183 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1184
1185 step("r1: Verify (S, G) ip mroutes")
1186 result = verify_mroutes(tgen, dut, SOURCE_ADDRESS, GROUP_ADDRESS_LIST_1, iif, oif)
1187 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1188
1189 step("r2: Verify (*, G) upstream IIF interface")
1190 dut = "r2"
1191 iif = "lo"
1192 result = verify_upstream_iif(tgen, dut, iif, STAR, GROUP_ADDRESS_LIST_1)
1193 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1194
1195 step("r2: Verify (*, G) upstream join state and join timer")
1196 result = verify_join_state_and_timer(tgen, dut, iif, STAR, GROUP_ADDRESS_LIST_1)
1197 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1198
1199 step("r2: Verify (*, G) ip mroutes")
1200 oif = "r2-r1-eth0"
1201 result = verify_mroutes(tgen, dut, STAR, GROUP_ADDRESS_LIST_1, iif, oif)
1202 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1203
1204 step("r2: Verify (S, G) upstream IIF interface")
1205 iif = "r2-r3-eth1"
1206 result = verify_upstream_iif(
1207 tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS_LIST_1, joinState="NotJoined"
1208 )
1209 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1210
1211 step("r2: Verify (S, G) upstream join state and join timer")
1212 result = verify_join_state_and_timer(
1213 tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS_LIST_1, expected=False
1214 )
1215 assert result is not True, (
1216 "Testcase {} : Failed \n "
1217 "Expected: [{}]: Upstream Join State should not be Joined and "
1218 "join timer should not run\n "
1219 "Found: {}".format(tc_name, dut, result)
1220 )
1221
1222 step("r2: Verify (S, G) ip mroutes")
1223 oif = "none"
1224 result = verify_mroutes(tgen, dut, SOURCE_ADDRESS, GROUP_ADDRESS_LIST_1, iif, oif)
1225 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1226
1227 step("r3: Verify (S, G) upstream IIF interface")
1228 dut = "r3"
1229 iif = "r3-r5-eth3"
1230 result = verify_upstream_iif(tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS_LIST_1)
1231 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1232
1233 step("r3: Verify (S, G) upstream join state and join timer")
1234 result = verify_join_state_and_timer(
1235 tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS_LIST_1, expected=False
1236 )
1237 assert result is not True, (
1238 "Testcase {} : Failed \n "
1239 "Expected: [{}]: Upstream Join State should not be Joined and "
1240 "join timer should not run\n "
1241 "Found: {}".format(tc_name, dut, result)
1242 )
1243
1244 step("r3: Verify (S, G) ip mroutes")
1245 oif = "r3-r1-eth0"
1246 result = verify_mroutes(tgen, dut, SOURCE_ADDRESS, GROUP_ADDRESS_LIST_1, iif, oif)
1247 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1248
1249 step("r1: Verify (*, G) upstream IIF interface")
1250 dut = "r1"
1251 iif = "r1-r4-eth3"
1252 result = verify_upstream_iif(tgen, dut, iif, STAR, GROUP_ADDRESS_LIST_2)
1253 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1254
1255 step("r1: Verify (*, G) upstream join state and join timer")
1256 result = verify_join_state_and_timer(tgen, dut, iif, STAR, GROUP_ADDRESS_LIST_2)
1257 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1258
1259 step("r1: Verify (*, G) ip mroutes")
1260 oif = "r1-r0-eth0"
1261 result = verify_mroutes(tgen, dut, STAR, GROUP_ADDRESS_LIST_2, iif, oif)
1262 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1263
1264 step("r1: Verify (S, G) upstream IIF interface")
1265 iif = "r1-r3-eth2"
1266 result = verify_upstream_iif(tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS_LIST_2)
1267 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1268
1269 step("r1: Verify (S, G) upstream join state and join timer")
1270 result = verify_join_state_and_timer(
1271 tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS_LIST_2
1272 )
1273 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1274
1275 step("r1: Verify (S, G) ip mroutes")
1276 result = verify_mroutes(tgen, dut, SOURCE_ADDRESS, GROUP_ADDRESS_LIST_2, iif, oif)
1277 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1278
1279 step("r4: Verify (*, G) upstream IIF interface")
1280 dut = "r4"
1281 iif = "lo"
1282 result = verify_upstream_iif(tgen, dut, iif, STAR, GROUP_ADDRESS_LIST_2)
1283 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1284
1285 step("r4: Verify (*, G) upstream join state and join timer")
1286 result = verify_join_state_and_timer(tgen, dut, iif, STAR, GROUP_ADDRESS_LIST_2)
1287 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1288
1289 step("r4: Verify (*, G) ip mroutes")
1290 oif = "r4-r1-eth0"
1291 result = verify_mroutes(tgen, dut, STAR, GROUP_ADDRESS_LIST_2, iif, oif)
1292 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1293
1294 step("r4: Verify (S, G) upstream IIF interface")
1295 iif = "r4-r3-eth1"
1296 result = verify_upstream_iif(
1297 tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS_LIST_2, joinState="NotJoined"
1298 )
1299 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1300
1301 step("r4: Verify (S, G) upstream join state and join timer")
1302 result = verify_join_state_and_timer(
1303 tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS_LIST_2, expected=False
1304 )
1305 assert result is not True, (
1306 "Testcase {} : Failed \n "
1307 "Expected: [{}]: Upstream Join State should not be Joined and "
1308 "join timer should not run\n "
1309 "Found: {}".format(tc_name, dut, result)
1310 )
1311
1312 step("r4: Verify (S, G) ip mroutes")
1313 oif = "none"
1314 result = verify_mroutes(tgen, dut, SOURCE_ADDRESS, GROUP_ADDRESS_LIST_2, iif, oif)
1315 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1316
1317 step("r3: Verify (S, G) upstream IIF interface")
1318 dut = "r3"
1319 iif = "r3-r5-eth3"
1320 result = verify_upstream_iif(tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS_LIST_2)
1321 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1322
1323 step("r3: Verify (S, G) upstream join state and join timer")
1324 result = verify_join_state_and_timer(
1325 tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS_LIST_2, expected=False
1326 )
1327 assert result is not True, (
1328 "Testcase {} : Failed \n "
1329 "Expected: [{}]: Upstream Join State should not be Joined and "
1330 "join timer should not run\n "
1331 "Found: {}".format(tc_name, dut, result)
1332 )
1333
1334 step("r3: Verify (S, G) ip mroutes")
1335 oif = "r3-r1-eth0"
1336 result = verify_mroutes(tgen, dut, SOURCE_ADDRESS, GROUP_ADDRESS_LIST_2, iif, oif)
1337 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1338
1339 write_test_footer(tc_name)
1340
1341
1342 def test_shutdown_primary_path_p1(request):
1343 """
1344 TC_30_P1: Verify IIF and OIL change to other path after shut the primary
1345 path
1346
1347 Topology used:
1348 ________r2_____
1349 | |
1350 iperf | |
1351 r0-----r1-------------r3
1352 """
1353
1354 tgen = get_topogen()
1355 tc_name = request.node.name
1356 write_test_header(tc_name)
1357
1358 # Don"t run this test if we have any failure.
1359 if tgen.routers_have_failure():
1360 pytest.skip(tgen.errors)
1361
1362 step("Creating configuration from JSON")
1363 reset_config_on_routers(tgen)
1364 app_helper.stop_all_hosts()
1365 clear_mroute(tgen)
1366 clear_pim_interface_traffic(tgen, TOPO)
1367
1368 # Steps to execute
1369 step("Enable IGMP on r1 interface")
1370 step("Configure RP on r2 (loopback interface) for the group range" " 224.0.0.0/4")
1371 step("r1: Shut the link from r1 to r2")
1372 step("r3: Shut the link from r1 to r3")
1373 step("r1: No shut the link from r1 to r2")
1374 step("r3: No shut the link from r1 to r3")
1375
1376 step("r1: Verify RP info")
1377 dut = "r1"
1378 rp_address = "1.0.2.17"
1379 iif = "r1-r2-eth1"
1380 result = verify_pim_rp_info(
1381 tgen, TOPO, dut, GROUP_RANGE_ALL, iif, rp_address, SOURCE
1382 )
1383 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1384
1385 step("r0: Send IGMP join")
1386 result = app_helper.run_join("r0", GROUP_ADDRESS, "r1")
1387 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1388
1389 step("r1: Verify IGMP groups")
1390 oif = "r1-r0-eth0"
1391 result = verify_igmp_groups(tgen, dut, oif, GROUP_ADDRESS)
1392 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1393
1394 step("r1: Verify (*, G) ip mroutes")
1395 result = verify_mroutes(tgen, dut, STAR, GROUP_ADDRESS, iif, oif)
1396 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1397
1398 step("r2: Verify (*, G) ip mroutes")
1399 dut = "r2"
1400 iif = "lo"
1401 oif = "r2-r1-eth0"
1402 result = verify_mroutes(tgen, dut, STAR, GROUP_ADDRESS, iif, oif)
1403 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1404
1405 step("r1: Shut the interface r1-r2-eth1 from R1 to R2")
1406 dut = "r1"
1407 intf = "r1-r2-eth1"
1408 shutdown_bringup_interface(tgen, dut, intf, False)
1409
1410 step(
1411 "Verify after shut the R1 to R2 link , verify join is reaching to RP"
1412 "via other path"
1413 )
1414
1415 logger.info("Waiting for 110 sec only if test run with crucible")
1416
1417 step("r1: Verify (*, G) ip mroutes")
1418 dut = "r1"
1419 iif = "r1-r3-eth2"
1420 oif = "r1-r0-eth0"
1421 result = verify_mroutes(tgen, dut, STAR, GROUP_ADDRESS, iif, oif)
1422 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1423
1424 step("r2: Verify (*, G) ip mroutes")
1425 dut = "r2"
1426 iif = "lo"
1427 oif = "r2-r3-eth1"
1428 result = verify_mroutes(tgen, dut, STAR, GROUP_ADDRESS, iif, oif)
1429 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1430
1431 step("r3: Verify (*, G) ip mroutes")
1432 dut = "r3"
1433 iif = "r3-r2-eth1"
1434 oif = "r3-r1-eth0"
1435 result = verify_mroutes(tgen, dut, STAR, GROUP_ADDRESS, iif, oif)
1436 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1437
1438 step("r3: Shut the link from R1 to R3 from R3 node")
1439 dut = "r3"
1440 intf = "r3-r1-eth0"
1441 shutdown_bringup_interface(tgen, dut, intf, False)
1442
1443 step(
1444 "Verify after shut of R1 to R3 link , verify (*,G) entries got"
1445 " cleared from all the node R1, R2, R3"
1446 )
1447
1448 step("r1: Verify (*, G) ip mroutes")
1449 dut = "r1"
1450 iif = "r1-r3-eth2"
1451 oif = "r1-r0-eth0"
1452 result = verify_mroutes(tgen, dut, STAR, GROUP_ADDRESS, iif, oif, expected=False)
1453 assert result is not True, (
1454 "Testcase {} : Failed \n "
1455 "Expected: [{}]: mroute (*, G) should be cleared \n"
1456 "Found: {}".format(tc_name, dut, result)
1457 )
1458
1459 step("r2: Verify (*, G) ip mroutes")
1460 dut = "r2"
1461 iif = "lo"
1462 oif = "r2-r3-eth1"
1463 result = verify_mroutes(tgen, dut, STAR, GROUP_ADDRESS, iif, oif, expected=False)
1464 assert result is not True, (
1465 "Testcase {} : Failed \n "
1466 "Expected: [{}]: mroute (*, G) should be cleared \n"
1467 "Found: {}".format(tc_name, dut, result)
1468 )
1469
1470 step("r3: Verify (*, G) ip mroutes")
1471 dut = "r3"
1472 iif = "r3-r2-eth1"
1473 oif = "r3-r1-eth0"
1474 result = verify_mroutes(tgen, dut, STAR, GROUP_ADDRESS, iif, oif, expected=False)
1475 assert result is not True, (
1476 "Testcase {} : Failed \n "
1477 "Expected: [{}]: mroute (*, G) should be cleared after shutting"
1478 "link from R1 to R3 \n"
1479 "Found: {}".format(tc_name, dut, result)
1480 )
1481
1482 step("r3: No shutdown the link from R1 to R3 from R3 node")
1483 dut = "r3"
1484 intf = "r3-r1-eth0"
1485 shutdown_bringup_interface(tgen, dut, intf, True)
1486
1487 step("r1: Verify (*, G) ip mroutes")
1488 dut = "r1"
1489 iif = "r1-r3-eth2"
1490 oif = "r1-r0-eth0"
1491 result = verify_mroutes(tgen, dut, STAR, GROUP_ADDRESS, iif, oif)
1492 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1493
1494 step("r2: Verify (*, G) ip mroutes")
1495 dut = "r2"
1496 iif = "lo"
1497 oif = "r2-r3-eth1"
1498 result = verify_mroutes(tgen, dut, STAR, GROUP_ADDRESS, iif, oif)
1499 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1500
1501 step("r3: Verify (*, G) ip mroutes")
1502 dut = "r3"
1503 iif = "r3-r2-eth1"
1504 oif = "r3-r1-eth0"
1505 result = verify_mroutes(tgen, dut, STAR, GROUP_ADDRESS, iif, oif)
1506 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1507
1508 step("r1: No shutdown the link from R1 to R2 from R1 node")
1509 dut = "r1"
1510 intf = "r1-r2-eth1"
1511 shutdown_bringup_interface(tgen, dut, intf, True)
1512
1513 step("r1: Verify (*, G) ip mroutes")
1514 dut = "r1"
1515 iif = "r1-r2-eth1"
1516 oif = "r1-r0-eth0"
1517 result = verify_mroutes(tgen, dut, STAR, GROUP_ADDRESS, iif, oif)
1518 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1519
1520 step("r2: Verify (*, G) ip mroutes")
1521 dut = "r2"
1522 iif = "lo"
1523 oif = "r2-r1-eth0"
1524 result = verify_mroutes(tgen, dut, STAR, GROUP_ADDRESS, iif, oif)
1525 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1526
1527 write_test_footer(tc_name)
1528
1529
1530 def test_delete_RP_shut_noshut_upstream_interface_p1(request):
1531 """
1532 TC_31_P1: Verify RP info and (*,G) mroute after deleting the RP and shut /
1533 no shut the RPF interface.
1534 Topology used:
1535 ________r2_____
1536 | |
1537 iperf | |
1538 r0-----r1-------------r3
1539 """
1540
1541 tgen = get_topogen()
1542 tc_name = request.node.name
1543 write_test_header(tc_name)
1544
1545 # Don"t run this test if we have any failure.
1546 if tgen.routers_have_failure():
1547 pytest.skip(tgen.errors)
1548
1549 step("Creating configuration from JSON")
1550 reset_config_on_routers(tgen)
1551 app_helper.stop_all_hosts()
1552 clear_mroute(tgen)
1553 clear_pim_interface_traffic(tgen, TOPO)
1554
1555 step("Enable IGMP on r1 interface")
1556 step("Configure RP on r2 (loopback interface) for the group range" " 224.0.0.0/4")
1557 step("r1: Delete the RP config")
1558 step("r1: Shut and no shut the upstream interface (R1-R2) connected link")
1559 step("r1: Shut and no shut the OIL interface")
1560
1561 step("r1: Verify RP info")
1562 dut = "r1"
1563 rp_address = "1.0.2.17"
1564 iif = "r1-r2-eth1"
1565 result = verify_pim_rp_info(
1566 tgen, TOPO, dut, GROUP_RANGE_ALL, iif, rp_address, SOURCE
1567 )
1568 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1569
1570 step("r0: Send IGMP join")
1571 result = app_helper.run_join("r0", GROUP_ADDRESS, "r1")
1572 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1573
1574 step("r1: Verify IGMP groups")
1575 dut = "r1"
1576 oif = "r1-r0-eth0"
1577 result = verify_igmp_groups(tgen, dut, oif, GROUP_ADDRESS)
1578 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1579
1580 step("r1: Verify (*, G) ip mroutes created")
1581 result = verify_mroutes(tgen, dut, STAR, GROUP_ADDRESS, iif, oif)
1582 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1583
1584 step("r2: Verify (*, G) ip mroutes created")
1585 dut = "r2"
1586 iif = "lo"
1587 oif = "r2-r1-eth0"
1588 result = verify_mroutes(tgen, dut, STAR, GROUP_ADDRESS, iif, oif)
1589 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1590
1591 step("r1: Delete RP configuration")
1592
1593 # Delete RP configuration
1594 input_dict = {
1595 "r1": {
1596 "pim": {
1597 "rp": [
1598 {
1599 "rp_addr": "1.0.2.17",
1600 "group_addr_range": GROUP_RANGE_ALL,
1601 "delete": True,
1602 }
1603 ]
1604 }
1605 }
1606 }
1607
1608 result = create_pim_config(tgen, TOPO, input_dict)
1609 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1610
1611 step("r1: Shut the interface r1-r2-eth1 from R1 to R2")
1612 dut = "r1"
1613 intf = "r1-r2-eth1"
1614 shutdown_bringup_interface(tgen, dut, intf, False)
1615
1616 step("r1: No shutdown the interface r1-r2-eth1 from R1 to R2")
1617 dut = "r1"
1618 intf = "r1-r2-eth1"
1619 shutdown_bringup_interface(tgen, dut, intf, True)
1620
1621 step("r1: Shutdown the OIL interface r1-r0-eth0 from R1 to R0 ")
1622 dut = "r1"
1623 intf = "r1-r0-eth0"
1624 shutdown_bringup_interface(tgen, dut, intf, False)
1625
1626 step("r1: No shutdown the OIL interface r1-r0-eth0 from R1 to R0")
1627 dut = "r1"
1628 intf = "r1-r0-eth0"
1629 shutdown_bringup_interface(tgen, dut, intf, True)
1630
1631 step("r1: Verify (*, G) ip mroutes cleared")
1632 dut = "r1"
1633 iif = "r1-r2-eth1"
1634 oif = "r1-r0-eth0"
1635 result = verify_mroutes(tgen, dut, STAR, GROUP_ADDRESS, iif, oif, expected=False)
1636 assert result is not True, (
1637 "Testcase {} : Failed \n "
1638 "Expected: [{}]: mroute (*, G) should be cleared after shutting"
1639 "link from R1 to R0 \n"
1640 "Found: {}".format(tc_name, dut, result)
1641 )
1642
1643 step("r2: Verify (*, G) ip mroutes cleared")
1644 dut = "r2"
1645 iif = "lo"
1646 oif = "r2-r1-eth0"
1647 result = verify_mroutes(tgen, dut, STAR, GROUP_ADDRESS, iif, oif, expected=False)
1648 assert result is not True, (
1649 "Testcase {} : Failed \n "
1650 "Expected: [{}]: mroute (*, G) should be cleared after shutting"
1651 "link from R1 to R0 \n"
1652 "Found: {}".format(tc_name, dut, result)
1653 )
1654
1655 write_test_footer(tc_name)
1656
1657
1658 def test_delete_RP_shut_noshut_RP_interface_p1(request):
1659 """
1660 TC_32_P1: Verify RP info and (*,G) mroute after deleting the RP and shut/
1661 no shut the RPF interface
1662
1663 Topology used:
1664 ________r2_____
1665 | |
1666 iperf | |
1667 r0-----r1-------------r3
1668 """
1669
1670 tgen = get_topogen()
1671 tc_name = request.node.name
1672 write_test_header(tc_name)
1673
1674 # Don"t run this test if we have any failure.
1675 if tgen.routers_have_failure():
1676 pytest.skip(tgen.errors)
1677
1678 step("Creating configuration from JSON")
1679 reset_config_on_routers(tgen)
1680 app_helper.stop_all_hosts()
1681 clear_mroute(tgen)
1682 clear_pim_interface_traffic(tgen, TOPO)
1683
1684 step("Enable IGMP on r1 interface")
1685 step("Configure RP on r2 (lo) for the group range" " 224.0.0.0/4")
1686 step("r2: Delete the RP configuration")
1687 step("r2: Shut the RP interface (lo)")
1688 step("r1: Shut the interface(r1-r2-eth1, r1-r3-eth2) towards rp")
1689
1690 step("r1: Verify RP info")
1691 dut = "r1"
1692 rp_address = "1.0.2.17"
1693 iif = "r1-r2-eth1"
1694 result = verify_pim_rp_info(
1695 tgen, TOPO, dut, GROUP_RANGE_ALL, iif, rp_address, SOURCE
1696 )
1697 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1698
1699 step("r0: Send IGMP join")
1700 result = app_helper.run_join("r0", GROUP_ADDRESS, "r1")
1701 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1702
1703 step("r1: Verify IGMP groups")
1704 oif = "r1-r0-eth0"
1705 result = verify_igmp_groups(tgen, dut, oif, GROUP_ADDRESS)
1706 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1707
1708 step("r1: Verify (*, G) ip mroutes created")
1709 result = verify_mroutes(tgen, dut, STAR, GROUP_ADDRESS, iif, oif)
1710 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1711
1712 step("r2: Verify (*, G) ip mroutes created")
1713 dut = "r2"
1714 iif = "lo"
1715 oif = "r2-r1-eth0"
1716 result = verify_mroutes(tgen, dut, STAR, GROUP_ADDRESS, iif, oif)
1717 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1718
1719 step("r2: Delete RP configuration")
1720
1721 # Delete RP configuration
1722 input_dict = {
1723 "r2": {
1724 "pim": {
1725 "rp": [
1726 {
1727 "rp_addr": "1.0.2.17",
1728 "group_addr_range": GROUP_RANGE_ALL,
1729 "delete": True,
1730 }
1731 ]
1732 }
1733 }
1734 }
1735
1736 result = create_pim_config(tgen, TOPO, input_dict)
1737 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1738
1739 step("r2: Shut the RP interface lo")
1740 dut = "r2"
1741 intf = "lo"
1742 shutdown_bringup_interface(tgen, dut, intf, False)
1743
1744 step("r1: Shut the interface r1-r2-eth1 towards RP")
1745 dut = "r1"
1746 intf = "r1-r2-eth1"
1747 shutdown_bringup_interface(tgen, dut, intf, False)
1748
1749 step("r1: Shut the interface r1-r3-eth2 towards RP")
1750 dut = "r1"
1751 intf = "r1-r3-eth2"
1752 shutdown_bringup_interface(tgen, dut, intf, False)
1753
1754 step("r1: Verify (*, G) ip mroutes cleared")
1755 dut = "r1"
1756 iif = "r1-r2-eth1"
1757 oif = "r1-r0-eth0"
1758 result = verify_mroutes(tgen, dut, STAR, GROUP_ADDRESS, iif, oif, expected=False)
1759 assert result is not True, (
1760 "Testcase {} : Failed \n "
1761 "Expected: [{}]: mroute (*, G) should be cleared after shutting"
1762 "link from R2 to R3 \n"
1763 "Found: {}".format(tc_name, dut, result)
1764 )
1765
1766 step("r2: Verify (*, G) ip mroutes cleared")
1767 dut = "r2"
1768 iif = "lo"
1769 oif = "r2-r1-eth0"
1770 result = verify_mroutes(tgen, dut, STAR, GROUP_ADDRESS, iif, oif, expected=False)
1771 assert result is not True, (
1772 "Testcase {} : Failed \n "
1773 "Expected: [{}]: mroute (*, G) should be cleared after shutting"
1774 "link from R2 to R3 \n"
1775 "Found: {}".format(tc_name, dut, result)
1776 )
1777
1778 write_test_footer(tc_name)
1779
1780
1781 if __name__ == "__main__":
1782 ARGS = ["-s"] + sys.argv[1:]
1783 sys.exit(pytest.main(ARGS))