2 # SPDX-License-Identifier: ISC
5 # Copyright (c) 2019 by VMware, Inc. ("VMware")
6 # Used Copyright (c) 2018 by Network Device Education Foundation,
7 # Inc. ("NetDEF") in this file.
11 Following tests are covered to test Multicast basic functionality:
18 r0-----r1-------------r3-----r5
24 - Create topology (setup module)
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
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
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
53 TC_17 : Verify prune is send to higher preferred RP when higher preferred RP
55 TC_18 : Verify RPF interface updated in mroute when higher preferred RP gets
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
61 TC_21_1 : Verify OIF and RFP for (*,G) and (S,G) when static RP configure in
63 TC_21_2 : Verify OIF and RFP for (*,G) and (S,G) when static RP configure in
65 TC_22_1 : Verify OIF and RPF for (*,G) and (S,G) when static RP configure in
67 TC_22_2 : Verify OIF and RPF for (*,G) and (S,G) when static RP configure in
69 TC_23 : Verify (*,G) and (S,G) populated correctly when RPT and SPT path are
71 TC_24 : Verify (*,G) and (S,G) populated correctly when SPT and RPT share the
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
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
90 from time
import sleep
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/"))
99 # Required to instantiate the topology builder class.
101 # pylint: disable=C0413
102 # Import topogen and topotest helpers
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
108 from lib
.common_config
import (
112 reset_config_on_routers
,
114 shutdown_bringup_interface
,
116 start_router_daemons
,
117 create_static_routes
,
119 from lib
.pim
import (
123 verify_join_state_and_timer
,
125 verify_pim_neighbors
,
126 get_pim_interface_traffic
,
129 clear_pim_interface_traffic
,
130 clear_igmp_interfaces
,
131 clear_pim_interfaces
,
137 pytestmark
= [pytest
.mark
.pimd
, pytest
.mark
.staticd
]
141 GROUP_RANGE_ALL
= "224.0.0.0/4"
142 GROUP_RANGE
= "225.1.1.1/32"
143 GROUP_RANGE_LIST_1
= [
150 GROUP_RANGE_LIST_2
= [
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
= [
167 SOURCE_ADDRESS
= "10.0.6.2"
171 def build_topo(tgen
):
174 # Building topology from json file
175 build_topo_from_json(tgen
, TOPO
)
178 def setup_module(mod
):
180 Sets up the pytest environment
185 testsuite_run_time
= time
.asctime(time
.localtime(time
.time()))
186 logger
.info("Testsuite start time: %s", testsuite_run_time
)
187 logger
.info("=" * 40)
194 r0-----r1-------------r3-----r5
200 logger
.info("Master Topology: \n %s", topology
)
202 logger
.info("Running setup_module to create topology")
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
__)
208 TOPO
= tgen
.json_topo
210 # ... and here it calls Mininet initialization functions.
212 # Starting topology, create tmp files which are loaded to routers
213 # to start daemons and then start routers
216 # Don"t run this test if we have any failure.
217 if tgen
.routers_have_failure():
218 pytest
.skip(tgen
.errors
)
220 # Creating configuration from JSON
221 build_config_from_json(tgen
, TOPO
)
223 # Verify PIM neighbors
224 result
= verify_pim_neighbors(tgen
, TOPO
)
225 assert result
is True, "setup_module :Failed \n Error:" " {}".format(result
)
227 # XXX Replace this using "with McastTesterHelper()... " in each test if possible.
229 app_helper
= McastTesterHelper(tgen
)
231 logger
.info("Running setup_module() done")
234 def teardown_module():
235 """Teardown the pytest environment"""
237 logger
.info("Running teardown_module to delete topology")
243 # Stop toplogy and Remove tmp files
246 logger
.info("Testsuite end time: %s", time
.asctime(time
.localtime(time
.time())))
247 logger
.info("=" * 40)
250 #####################################################
254 #####################################################
257 def verify_mroute_repopulated(uptime_before
, uptime_after
):
259 API to compare uptime for mroutes
263 * `uptime_before` : Uptime dictionary for any particular instance
264 * `uptime_after` : Uptime dictionary for any particular instance
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
]):
271 "mroute (%s, %s) has not come"
272 " up after mroute clear [FAILED!!]" % (source
, group
)
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")
279 errormsg
= "mroute (%s, %s) is not " "repopulated [FAILED!!]" % (
285 logger
.info("mroute (%s, %s) is " "repopulated [PASSED!!]", source
, group
)
290 def verify_state_incremented(state_before
, state_after
):
292 API to compare interface traffic state incrementing
296 * `state_before` : State dictionary for any particular instance
297 * `state_after` : State dictionary for any particular instance
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
]:
304 "[DUT: %s]: state %s value has not"
305 " incremented, Initial value: %s, "
306 "Current value: %s [FAILED!!]"
310 state_before
[router
][state
],
311 state_after
[router
][state
],
317 "[DUT: %s]: State %s value is "
318 "incremented, Initial value: %s, Current value: %s"
322 state_before
[router
][state
],
323 state_after
[router
][state
],
329 def test_restart_pimd_process_p2(request
):
331 TC_26_P2: Restart the PIMd process and verify PIM upstream and mroutes
337 r0-----r1-------------r3-----r5
347 tc_name
= request
.node
.name
348 write_test_header(tc_name
)
350 # Don"t run this test if we have any failure.
351 if tgen
.routers_have_failure():
352 pytest
.skip(tgen
.errors
)
354 step("Creating configuration from JSON")
355 reset_config_on_routers(tgen
)
356 app_helper
.stop_all_hosts()
358 clear_pim_interface_traffic(tgen
, TOPO
)
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")
366 step("r2: Verify RP info")
368 rp_address
= "1.0.2.17"
370 result
= verify_pim_rp_info(
371 tgen
, TOPO
, dut
, GROUP_RANGE_ALL
, oif
, rp_address
, SOURCE
373 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
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
)
379 step("r1: Verify IGMP groups")
382 result
= verify_igmp_groups(tgen
, dut
, oif
, GROUP_ADDRESS
)
383 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
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
)
389 step("r1: Verify (*, G) upstream IIF interface")
391 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
)
392 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
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
)
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
)
402 step("r1: Verify (S, G) upstream IIF interface")
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
)
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
)
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
)
415 step("r2: Verify (*, G) upstream IIF interface")
418 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
)
419 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
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
)
425 step("r2: Verify (*, G) ip mroutes")
427 result
= verify_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
)
428 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
430 step("r3: Verify (S, G) upstream IIF interface")
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
)
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
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
)
447 step("r3: Verify (S, G) ip mroutes")
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
)
455 logger
.info("waiting for 10 sec to make sure old mroute time is higher")
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
461 assert isinstance(uptime_before
, dict), "Testcase{} : Failed Error: {}".format(
465 step("r1: Kill pimd process")
466 kill_router_daemons(tgen
, "r1", ["pimd"])
468 step("r1 : Start pimd process")
469 start_router_daemons(tgen
, "r1", ["pimd"])
471 logger
.info("Waiting for 5sec to get PIMd restarted and mroute" " re-learned..")
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
478 assert isinstance(uptime_after
, dict), "Testcase{} : Failed Error: {}".format(
482 result
= verify_mroute_repopulated(uptime_before
, uptime_after
)
483 assert result
is True, "Testcase{} : Failed Error: {}".format(tc_name
, result
)
485 write_test_footer(tc_name
)
488 def test_multiple_groups_same_RP_address_p2(request
):
490 TC_27_P2: Configure multiple groups (10 grps) with same RP address
496 r0-----r1-------------r3-----r5
504 tc_name
= request
.node
.name
505 write_test_header(tc_name
)
507 # Don"t run this test if we have any failure.
508 if tgen
.routers_have_failure():
509 pytest
.skip(tgen
.errors
)
511 step("Creating configuration from JSON")
512 reset_config_on_routers(tgen
)
513 app_helper
.stop_all_hosts()
515 clear_pim_interface_traffic(tgen
, TOPO
)
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")
529 step("r2: verify rp-info")
531 rp_address
= "1.0.2.17"
533 result
= verify_pim_rp_info(
534 tgen
, TOPO
, dut
, GROUP_RANGE_ALL
, oif
, rp_address
, SOURCE
536 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
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
)
543 step("r1: Verify IGMP groups")
546 result
= verify_igmp_groups(tgen
, dut
, oif
, group_address_list
)
547 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
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
)
553 step("r1: Verify (*, G) upstream IIF interface")
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
)
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
)
563 step("r1: Verify (*, G) ip mroutes")
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
)
568 step("r1: Verify (S, G) upstream IIF interface")
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
)
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
577 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
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
)
583 step("r2: Verify (*, G) upstream IIF interface")
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
)
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
)
593 step("r2: Verify (*, G) ip mroutes")
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
)
598 step("r3: Verify (S, G) upstream IIF interface")
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
)
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
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
)
615 step("r3: Verify (S, G) ip mroutes")
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
)
620 step("r2: Verify (S, G) upstream IIF interface")
623 result
= verify_upstream_iif(
624 tgen
, dut
, iif
, SOURCE_ADDRESS
, group_address_list
, joinState
="NotJoined"
626 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
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
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
)
639 step("r2: Verify (S, G) ip mroutes")
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
)
644 step("r1: Delete RP configuration")
650 "rp_addr": "1.0.2.17",
651 "group_addr_range": GROUP_RANGE_ALL
,
659 result
= create_pim_config(tgen
, TOPO
, input_dict
)
660 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
662 step("r1: Shut the interface r1-r2-eth1 from R1 to R2")
665 shutdown_bringup_interface(tgen
, dut
, intf
, False)
667 step("r1: No Shut the interface r1-r2-eth1 from R1 to R2")
669 shutdown_bringup_interface(tgen
, dut
, intf
, True)
671 step("r1: Configure RP")
677 "rp_addr": "1.0.2.17",
678 "group_addr_range": GROUP_RANGE_ALL
,
685 result
= create_pim_config(tgen
, TOPO
, input_dict
)
686 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
688 step("r1: Shut the interface r1-r0-eth0 from R1 to R2")
690 shutdown_bringup_interface(tgen
, dut
, intf
, False)
692 step("r1: No Shut the interface r1-r0-eth0 from R1 to R2")
694 shutdown_bringup_interface(tgen
, dut
, intf
, True)
696 step("r1: Verify (*, G) upstream IIF interface")
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
)
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
)
706 step("r1: Verify (*, G) ip mroutes")
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
)
711 step("r1: Verify (S, G) upstream IIF interface")
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
)
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
720 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
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
)
726 step("r2: Verify (*, G) upstream IIF interface")
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
)
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
)
736 step("r2: Verify (*, G) ip mroutes")
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
)
741 step("r2: Verify (S, G) upstream IIF interface")
744 result
= verify_upstream_iif(
745 tgen
, dut
, iif
, SOURCE_ADDRESS
, group_address_list
, joinState
="NotJoined"
747 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
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
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
)
760 step("r2: Verify (S, G) ip mroutes")
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
)
765 step("r3: Verify (S, G) upstream IIF interface")
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
)
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
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
)
782 step("r3: Verify (S, G) ip mroutes")
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
)
787 write_test_footer(tc_name
)
790 def test_multiple_groups_different_RP_address_p2(request
):
792 TC_28_P2: Verify IIF and OIL in updated in mroute when upstream interface
799 r0-----r1-------------r3-----r5
809 tc_name
= request
.node
.name
810 write_test_header(tc_name
)
812 # Don"t run this test if we have any failure.
813 if tgen
.routers_have_failure():
814 pytest
.skip(tgen
.errors
)
816 step("Creating configuration from JSON")
817 reset_config_on_routers(tgen
)
818 app_helper
.stop_all_hosts()
820 clear_pim_interface_traffic(tgen
, TOPO
)
822 step("Delete existing RP configuration")
828 "rp_addr": "1.0.2.17",
829 "group_addr_range": GROUP_RANGE_ALL
,
836 result
= create_pim_config(tgen
, TOPO
, input_dict
)
837 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
844 "rp_addr": "1.0.2.17",
845 "group_addr_range": GROUP_RANGE_LIST_1
,
854 "rp_addr": "1.0.4.17",
855 "group_addr_range": GROUP_RANGE_LIST_2
,
861 result
= create_pim_config(tgen
, TOPO
, input_dict
)
862 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
864 step("r2: Verify RP info")
866 rp_address
= "1.0.2.17"
868 result
= verify_pim_rp_info(
869 tgen
, TOPO
, dut
, GROUP_RANGE_LIST_1
, oif
, rp_address
, SOURCE
871 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
873 step("r4: Verify RP info")
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
879 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
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
)
886 step("r1: Verify IGMP groups")
889 result
= verify_igmp_groups(tgen
, dut
, oif
, group_address_list
)
890 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
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
)
896 step("r1: Verify (*, G) upstream IIF interface")
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
)
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
)
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
)
910 step("r1: Verify (S, G) upstream IIF interface")
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
)
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
919 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
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
)
925 step("r2: Verify (*, G) upstream IIF interface")
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
)
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
)
935 step("r2: Verify (*, G) ip mroutes")
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
)
940 step("r2: Verify (S, G) upstream IIF interface")
942 result
= verify_upstream_iif(
943 tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_1
, joinState
="NotJoined"
945 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
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
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
)
958 step("r2: Verify (S, G) ip mroutes")
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
)
963 step("r3: Verify (S, G) upstream IIF interface")
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
)
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
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
)
980 step("r3: Verify (S, G) ip mroutes")
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
)
985 step("r1: Verify (*, G) upstream IIF interface")
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
)
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
)
995 step("r1: Verify (*, G) ip mroutes")
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
)
1000 step("r1: Verify (S, G) upstream IIF interface")
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
)
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
1009 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
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
)
1015 step("r4: Verify (*, G) upstream IIF interface")
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
)
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
)
1025 step("r4: Verify (*, G) ip mroutes")
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
)
1030 step("r4: Verify (S, G) upstream IIF interface")
1032 result
= verify_upstream_iif(
1033 tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_2
, joinState
="NotJoined"
1035 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
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
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
)
1048 step("r4: Verify (S, G) ip mroutes")
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
)
1053 step("r3: Verify (S, G) upstream IIF interface")
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
)
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
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
)
1070 step("r3: Verify (S, G) ip mroutes")
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
)
1075 step("Delete RP configuration")
1081 "rp_addr": "1.0.2.17",
1082 "group_addr_range": GROUP_RANGE_LIST_1
,
1092 "rp_addr": "1.0.4.17",
1093 "group_addr_range": GROUP_RANGE_LIST_2
,
1100 result
= create_pim_config(tgen
, TOPO
, input_dict
)
1101 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1103 step("r1, r2, r3, r4: Re-configure RP")
1109 "rp_addr": "1.0.2.17",
1110 "group_addr_range": GROUP_RANGE_LIST_1
,
1119 "rp_addr": "1.0.4.17",
1120 "group_addr_range": GROUP_RANGE_LIST_2
,
1126 result
= create_pim_config(tgen
, TOPO
, input_dict
)
1127 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1129 step("r1: Shut the interface r1-r2-eth1 from R1 to R2")
1132 shutdown_bringup_interface(tgen
, dut
, intf
, False)
1134 step("r1: No shut the interface r1-r2-eth1 from R1 to R2")
1137 shutdown_bringup_interface(tgen
, dut
, intf
, True)
1139 step("r1: Shut the interface r1-r2-eth1 from R1 to R4")
1142 shutdown_bringup_interface(tgen
, dut
, intf
, False)
1144 step("r1: No shut the interface r1-r2-eth1 from R1 to r4")
1147 shutdown_bringup_interface(tgen
, dut
, intf
, True)
1149 step("r1: Shut the interface r1-r0-eth0 from R1 to R0")
1152 shutdown_bringup_interface(tgen
, dut
, intf
, False)
1154 step("r1: No Shut the interface r1-r0-eth0 from R1 to R0")
1157 shutdown_bringup_interface(tgen
, dut
, intf
, True)
1159 step("r1: Verify (*, G) upstream IIF interface")
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
)
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
)
1169 step("r1: Verify (*, G) ip mroutes")
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
)
1174 step("r1: Verify (S, G) upstream IIF interface")
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
)
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
1183 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
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
)
1189 step("r2: Verify (*, G) upstream IIF interface")
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
)
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
)
1199 step("r2: Verify (*, G) ip mroutes")
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
)
1204 step("r2: Verify (S, G) upstream IIF interface")
1206 result
= verify_upstream_iif(
1207 tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_1
, joinState
="NotJoined"
1209 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
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
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
)
1222 step("r2: Verify (S, G) ip mroutes")
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
)
1227 step("r3: Verify (S, G) upstream IIF interface")
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
)
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
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
)
1244 step("r3: Verify (S, G) ip mroutes")
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
)
1249 step("r1: Verify (*, G) upstream IIF interface")
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
)
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
)
1259 step("r1: Verify (*, G) ip mroutes")
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
)
1264 step("r1: Verify (S, G) upstream IIF interface")
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
)
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
1273 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
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
)
1279 step("r4: Verify (*, G) upstream IIF interface")
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
)
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
)
1289 step("r4: Verify (*, G) ip mroutes")
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
)
1294 step("r4: Verify (S, G) upstream IIF interface")
1296 result
= verify_upstream_iif(
1297 tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_2
, joinState
="NotJoined"
1299 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
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
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
)
1312 step("r4: Verify (S, G) ip mroutes")
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
)
1317 step("r3: Verify (S, G) upstream IIF interface")
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
)
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
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
)
1334 step("r3: Verify (S, G) ip mroutes")
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
)
1339 write_test_footer(tc_name
)
1342 def test_shutdown_primary_path_p1(request
):
1344 TC_30_P1: Verify IIF and OIL change to other path after shut the primary
1351 r0-----r1-------------r3
1354 tgen
= get_topogen()
1355 tc_name
= request
.node
.name
1356 write_test_header(tc_name
)
1358 # Don"t run this test if we have any failure.
1359 if tgen
.routers_have_failure():
1360 pytest
.skip(tgen
.errors
)
1362 step("Creating configuration from JSON")
1363 reset_config_on_routers(tgen
)
1364 app_helper
.stop_all_hosts()
1366 clear_pim_interface_traffic(tgen
, TOPO
)
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")
1376 step("r1: Verify RP info")
1378 rp_address
= "1.0.2.17"
1380 result
= verify_pim_rp_info(
1381 tgen
, TOPO
, dut
, GROUP_RANGE_ALL
, iif
, rp_address
, SOURCE
1383 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
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
)
1389 step("r1: Verify IGMP groups")
1391 result
= verify_igmp_groups(tgen
, dut
, oif
, GROUP_ADDRESS
)
1392 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
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
)
1398 step("r2: Verify (*, G) ip mroutes")
1402 result
= verify_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
)
1403 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1405 step("r1: Shut the interface r1-r2-eth1 from R1 to R2")
1408 shutdown_bringup_interface(tgen
, dut
, intf
, False)
1411 "Verify after shut the R1 to R2 link , verify join is reaching to RP"
1415 logger
.info("Waiting for 110 sec only if test run with crucible")
1417 step("r1: Verify (*, G) ip mroutes")
1421 result
= verify_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
)
1422 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1424 step("r2: Verify (*, G) ip mroutes")
1428 result
= verify_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
)
1429 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1431 step("r3: Verify (*, G) ip mroutes")
1435 result
= verify_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
)
1436 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1438 step("r3: Shut the link from R1 to R3 from R3 node")
1441 shutdown_bringup_interface(tgen
, dut
, intf
, False)
1444 "Verify after shut of R1 to R3 link , verify (*,G) entries got"
1445 " cleared from all the node R1, R2, R3"
1448 step("r1: Verify (*, G) ip mroutes")
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
)
1459 step("r2: Verify (*, G) ip mroutes")
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
)
1470 step("r3: Verify (*, G) ip mroutes")
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
)
1482 step("r3: No shutdown the link from R1 to R3 from R3 node")
1485 shutdown_bringup_interface(tgen
, dut
, intf
, True)
1487 step("r1: Verify (*, G) ip mroutes")
1491 result
= verify_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
)
1492 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1494 step("r2: Verify (*, G) ip mroutes")
1498 result
= verify_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
)
1499 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1501 step("r3: Verify (*, G) ip mroutes")
1505 result
= verify_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
)
1506 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1508 step("r1: No shutdown the link from R1 to R2 from R1 node")
1511 shutdown_bringup_interface(tgen
, dut
, intf
, True)
1513 step("r1: Verify (*, G) ip mroutes")
1517 result
= verify_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
)
1518 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1520 step("r2: Verify (*, G) ip mroutes")
1524 result
= verify_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
)
1525 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1527 write_test_footer(tc_name
)
1530 def test_delete_RP_shut_noshut_upstream_interface_p1(request
):
1532 TC_31_P1: Verify RP info and (*,G) mroute after deleting the RP and shut /
1533 no shut the RPF interface.
1538 r0-----r1-------------r3
1541 tgen
= get_topogen()
1542 tc_name
= request
.node
.name
1543 write_test_header(tc_name
)
1545 # Don"t run this test if we have any failure.
1546 if tgen
.routers_have_failure():
1547 pytest
.skip(tgen
.errors
)
1549 step("Creating configuration from JSON")
1550 reset_config_on_routers(tgen
)
1551 app_helper
.stop_all_hosts()
1553 clear_pim_interface_traffic(tgen
, TOPO
)
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")
1561 step("r1: Verify RP info")
1563 rp_address
= "1.0.2.17"
1565 result
= verify_pim_rp_info(
1566 tgen
, TOPO
, dut
, GROUP_RANGE_ALL
, iif
, rp_address
, SOURCE
1568 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
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
)
1574 step("r1: Verify IGMP groups")
1577 result
= verify_igmp_groups(tgen
, dut
, oif
, GROUP_ADDRESS
)
1578 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
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
)
1584 step("r2: Verify (*, G) ip mroutes created")
1588 result
= verify_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
)
1589 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1591 step("r1: Delete RP configuration")
1593 # Delete RP configuration
1599 "rp_addr": "1.0.2.17",
1600 "group_addr_range": GROUP_RANGE_ALL
,
1608 result
= create_pim_config(tgen
, TOPO
, input_dict
)
1609 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1611 step("r1: Shut the interface r1-r2-eth1 from R1 to R2")
1614 shutdown_bringup_interface(tgen
, dut
, intf
, False)
1616 step("r1: No shutdown the interface r1-r2-eth1 from R1 to R2")
1619 shutdown_bringup_interface(tgen
, dut
, intf
, True)
1621 step("r1: Shutdown the OIL interface r1-r0-eth0 from R1 to R0 ")
1624 shutdown_bringup_interface(tgen
, dut
, intf
, False)
1626 step("r1: No shutdown the OIL interface r1-r0-eth0 from R1 to R0")
1629 shutdown_bringup_interface(tgen
, dut
, intf
, True)
1631 step("r1: Verify (*, G) ip mroutes cleared")
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
)
1643 step("r2: Verify (*, G) ip mroutes cleared")
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
)
1655 write_test_footer(tc_name
)
1658 def test_delete_RP_shut_noshut_RP_interface_p1(request
):
1660 TC_32_P1: Verify RP info and (*,G) mroute after deleting the RP and shut/
1661 no shut the RPF interface
1667 r0-----r1-------------r3
1670 tgen
= get_topogen()
1671 tc_name
= request
.node
.name
1672 write_test_header(tc_name
)
1674 # Don"t run this test if we have any failure.
1675 if tgen
.routers_have_failure():
1676 pytest
.skip(tgen
.errors
)
1678 step("Creating configuration from JSON")
1679 reset_config_on_routers(tgen
)
1680 app_helper
.stop_all_hosts()
1682 clear_pim_interface_traffic(tgen
, TOPO
)
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")
1690 step("r1: Verify RP info")
1692 rp_address
= "1.0.2.17"
1694 result
= verify_pim_rp_info(
1695 tgen
, TOPO
, dut
, GROUP_RANGE_ALL
, iif
, rp_address
, SOURCE
1697 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
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
)
1703 step("r1: Verify IGMP groups")
1705 result
= verify_igmp_groups(tgen
, dut
, oif
, GROUP_ADDRESS
)
1706 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
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
)
1712 step("r2: Verify (*, G) ip mroutes created")
1716 result
= verify_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
)
1717 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1719 step("r2: Delete RP configuration")
1721 # Delete RP configuration
1727 "rp_addr": "1.0.2.17",
1728 "group_addr_range": GROUP_RANGE_ALL
,
1736 result
= create_pim_config(tgen
, TOPO
, input_dict
)
1737 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1739 step("r2: Shut the RP interface lo")
1742 shutdown_bringup_interface(tgen
, dut
, intf
, False)
1744 step("r1: Shut the interface r1-r2-eth1 towards RP")
1747 shutdown_bringup_interface(tgen
, dut
, intf
, False)
1749 step("r1: Shut the interface r1-r3-eth2 towards RP")
1752 shutdown_bringup_interface(tgen
, dut
, intf
, False)
1754 step("r1: Verify (*, G) ip mroutes cleared")
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
)
1766 step("r2: Verify (*, G) ip mroutes cleared")
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
)
1778 write_test_footer(tc_name
)
1781 if __name__
== "__main__":
1782 ARGS
= ["-s"] + sys
.argv
[1:]
1783 sys
.exit(pytest
.main(ARGS
))