2 # SPDX-License-Identifier: ISC
5 # Copyright (c) 2020 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 pim sm:
14 - Create topology (setup module)
17 Following tests are covered:
18 1. TC_17: Verify (*,G) and (S,G) present and multicast traffic resume,
19 after restart of PIMd daemon
20 2. TC_18: Verify (*,G) and (S,G) present and multicast traffic resume after
21 FRR service stop and start
22 3. TC_10: Verify SPT switchover working when RPT and SPT path is
24 4. TC_15: Verify (S,G) and (*,G) mroute after shut / no shut of upstream
26 5. TC_7: Verify mroute detail when receiver is present
28 6. TC_8: Verify mroute when FRR is acting as FHR and LHR
29 7. TC_20: Verify mroute detail when 5 different receiver joining
31 8. TC_22: Verify OIL and IIF detail updated in (S,G) mroute after shut
32 and no shut of the source interface
40 pytestmark
= pytest
.mark
.pimd
42 # Save the Current Working Directory to find configuration files.
43 CWD
= os
.path
.dirname(os
.path
.realpath(__file__
))
44 sys
.path
.append(os
.path
.join(CWD
, "../"))
45 sys
.path
.append(os
.path
.join(CWD
, "../lib/"))
47 # Required to instantiate the topology builder class.
49 # pylint: disable=C0413
50 # Import topogen and topotest helpers
51 from lib
.topogen
import Topogen
, get_topogen
53 from lib
.common_config
import (
58 reset_config_on_routers
,
59 shutdown_bringup_interface
,
64 required_linux_kernel_version
,
72 get_pim_interface_traffic
,
77 clear_pim_interface_traffic
,
80 from lib
.topolog
import logger
81 from lib
.topojson
import build_config_from_json
84 pytestmark
= [pytest
.mark
.pimd
]
89 i4-----c1-------------c2---i5
92 i1-----l1------r2-----f1---i2
98 i1, i2, i3. i4, i5, i6, i7, i8 - FRR running iperf to send IGMP
108 GROUP_RANGE
= "225.0.0.0/8"
109 IGMP_JOIN
= "225.1.1.1"
117 IGMP_JOIN_RANGE_1
= ["225.1.1.1", "225.1.1.2", "225.1.1.3", "225.1.1.4", "225.1.1.5"]
125 IGMP_JOIN_RANGE_2
= ["226.1.1.1", "226.1.1.2", "226.1.1.3", "226.1.1.4", "226.1.1.5"]
134 IGMP_JOIN_RANGE_3
= ["227.1.1.1", "227.1.1.2", "227.1.1.3", "227.1.1.4", "227.1.1.5"]
137 def setup_module(mod
):
139 Sets up the pytest environment
144 # Required linux kernel version for this suite to run.
145 result
= required_linux_kernel_version("4.19")
146 if result
is not True:
147 pytest
.skip("Kernel version should be >= 4.19")
149 testsuite_run_time
= time
.asctime(time
.localtime(time
.time()))
150 logger
.info("Testsuite start time: {}".format(testsuite_run_time
))
151 logger
.info("=" * 40)
152 logger
.info("Master Topology: \n {}".format(TOPOLOGY
))
154 logger
.info("Running setup_module to create topology")
156 json_file
= "{}/multicast_pim_sm_topo2.json".format(CWD
)
157 tgen
= Topogen(json_file
, mod
.__name
__)
159 topo
= tgen
.json_topo
160 # ... and here it calls Mininet initialization functions.
162 # Starting topology, create tmp files which are loaded to routers
163 # to start daemons and then start routers
166 # Don"t run this test if we have any failure.
167 if tgen
.routers_have_failure():
168 pytest
.skip(tgen
.errors
)
170 # Creating configuration from JSON
171 build_config_from_json(tgen
, topo
)
173 # XXX Replace this using "with McastTesterHelper()... " in each test if possible.
175 app_helper
= McastTesterHelper(tgen
)
177 logger
.info("Running setup_module() done")
180 def teardown_module():
181 """Teardown the pytest environment"""
183 logger
.info("Running teardown_module to delete topology")
189 # Stop toplogy and Remove tmp files
193 "Testsuite end time: {}".format(time
.asctime(time
.localtime(time
.time())))
195 logger
.info("=" * 40)
198 #####################################################
202 #####################################################
205 def verify_state_incremented(state_before
, state_after
):
207 API to compare interface traffic state incrementing
211 * `state_before` : State dictionary for any particular instance
212 * `state_after` : State dictionary for any particular instance
215 for router
, state_data
in state_before
.items():
216 for state
, value
in state_data
.items():
217 if state_before
[router
][state
] >= state_after
[router
][state
]:
219 "[DUT: %s]: state %s value has not"
220 " incremented, Initial value: %s, "
221 "Current value: %s [FAILED!!]"
225 state_before
[router
][state
],
226 state_after
[router
][state
],
232 "[DUT: %s]: State %s value is "
233 "incremented, Initial value: %s, Current value: %s"
237 state_before
[router
][state
],
238 state_after
[router
][state
],
244 def test_verify_mroute_and_traffic_when_pimd_restarted_p2(request
):
246 TC_17: Verify (*,G) and (S,G) present and multicast traffic resume,
247 after restart of PIMd daemon
251 tc_name
= request
.node
.name
252 write_test_header(tc_name
)
254 # Don"t run this test if we have any failure.
255 if tgen
.routers_have_failure():
256 pytest
.skip(tgen
.errors
)
258 # Creating configuration from JSON
259 app_helper
.stop_all_hosts()
261 reset_config_on_routers(tgen
)
262 clear_pim_interface_traffic(tgen
, topo
)
264 step("Configure static RP for (226.1.1.1-5) in c1")
265 step("Configure static RP for (232.1.1.1-5) in c2")
267 _GROUP_RANGE
= GROUP_RANGE_2
+ GROUP_RANGE_3
268 _IGMP_JOIN_RANGE
= IGMP_JOIN_RANGE_2
+ IGMP_JOIN_RANGE_3
275 "rp_addr": topo
["routers"]["c1"]["links"]["lo"]["ipv4"].split(
278 "group_addr_range": GROUP_RANGE_2
,
287 "rp_addr": topo
["routers"]["c2"]["links"]["lo"]["ipv4"].split(
290 "group_addr_range": GROUP_RANGE_3
,
297 result
= create_pim_config(tgen
, topo
, input_dict
)
298 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
301 "Enable IGMP on FRR1 interface and send IGMP join "
302 "(226.1.1.1-5) and (232.1.1.1-5)"
305 "Configure IGMP interface on FRR3 and send IGMP join"
306 " for group (226.1.1.1-5, 232.1.1.1-5)"
314 "igmp": {"version": "2", "query": {"query-interval": 15}}
320 result
= create_igmp_config(tgen
, topo
, input_dict
)
321 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
323 input_join
= {"i1": "i1-l1-eth0", "i8": "i8-f1-eth0"}
325 for recvr
, recvr_intf
in input_join
.items():
326 result
= app_helper
.run_join(recvr
, _IGMP_JOIN_RANGE
, join_intf
=recvr_intf
)
327 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
330 "Connect one source to c2 and send multicast traffic all"
331 " the receivers (226.1.1.1-5, 232.1.1.1-5)"
334 "Send multicast traffic from FRR3 to all the receivers "
335 "(226.1.1.1-5, 232.1.1.1-5)"
338 input_src
= {"i2": "i2-f1-eth0", "i5": "i5-c2-eth0"}
340 for src
, src_intf
in input_src
.items():
341 result
= app_helper
.run_traffic(src
, _IGMP_JOIN_RANGE
, bind_intf
=src_intf
)
342 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
344 # Verifying mroutes before PIMd restart, fetching uptime
346 source
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
348 {"dut": "f1", "src_address": "*", "iif": "f1-c2-eth0", "oil": "f1-i8-eth2"},
349 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "f1-i8-eth2"},
351 for data
in input_dict
:
352 result
= verify_mroutes(
360 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
362 for data
in input_dict
:
363 result
= verify_upstream_iif(
364 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
366 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
368 step("Restart Pimd process on FRR3 node")
369 kill_router_daemons(tgen
, "f1", ["pimd"])
370 start_router_daemons(tgen
, "f1", ["pimd"])
372 for data
in input_dict
:
373 result
= verify_mroutes(
381 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
384 "After restart of PIMd verify pim nbr is up , IGMP groups"
385 " received , and (*,G) (S,G) entries populated again ,"
386 " Verify using 'show ip pim neighbor' , 'show ip igmp groups'"
390 result
= verify_pim_neighbors(tgen
, topo
)
391 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
394 interface
= "f1-i8-eth2"
395 result
= verify_igmp_groups(tgen
, dut
, interface
, _IGMP_JOIN_RANGE
)
396 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
398 for data
in input_dict
:
399 result
= verify_upstream_iif(
400 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
402 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
404 step("Stop the traffic and restart PIMd immediately on FRR3 node")
407 shutdown_bringup_interface(tgen
, dut
, intf
, False)
409 kill_router_daemons(tgen
, "f1", ["pimd"])
410 start_router_daemons(tgen
, "f1", ["pimd"])
413 "After PIM process come , all the none of (S,G) mroute should"
414 " present on FRR3 'show ip mroute' "
418 {"dut": "f1", "src_address": "*", "iif": "f1-c2-eth0", "oil": "f1-i8-eth2"}
420 for data
in input_dict
:
421 result
= verify_mroutes(
429 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
432 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "none"}
434 for data
in input_dict
:
435 result
= verify_mroutes(
444 assert result
is not True, (
445 "Testcase {} : Failed \n "
446 "Expected: [{}]: mroute (S, G) should not be present in mroute table \n "
447 "Found: {}".format(tc_name
, data
["dut"], result
)
450 write_test_footer(tc_name
)
453 def test_verify_mroute_and_traffic_when_frr_restarted_p2(request
):
455 TC_18: Verify (*,G) and (S,G) present and multicast traffic resume after
456 FRR service stop and start
460 tc_name
= request
.node
.name
461 write_test_header(tc_name
)
463 # Don"t run this test if we have any failure.
464 if tgen
.routers_have_failure():
465 pytest
.skip(tgen
.errors
)
467 # Creating configuration from JSON
468 app_helper
.stop_all_hosts()
470 reset_config_on_routers(tgen
)
471 clear_pim_interface_traffic(tgen
, topo
)
473 step("Configure static RP for (226.1.1.1-5) in c1")
474 step("Configure static RP for (232.1.1.1-5) in c2")
476 _GROUP_RANGE
= GROUP_RANGE_2
+ GROUP_RANGE_3
477 _IGMP_JOIN_RANGE
= IGMP_JOIN_RANGE_2
+ IGMP_JOIN_RANGE_3
484 "rp_addr": topo
["routers"]["c1"]["links"]["lo"]["ipv4"].split(
487 "group_addr_range": GROUP_RANGE_2
,
496 "rp_addr": topo
["routers"]["c2"]["links"]["lo"]["ipv4"].split(
499 "group_addr_range": GROUP_RANGE_3
,
506 result
= create_pim_config(tgen
, topo
, input_dict
)
507 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
510 "Enable IGMP on FRR1 interface and send IGMP join "
511 "(226.1.1.1-5) and (232.1.1.1-5)"
514 "Configure IGMP interface on FRR3 and send IGMP join"
515 " for group (226.1.1.1-5, 232.1.1.1-5)"
523 "igmp": {"version": "2", "query": {"query-interval": 15}}
529 result
= create_igmp_config(tgen
, topo
, input_dict
)
530 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
532 input_join
= {"i1": "i1-l1-eth0", "i8": "i8-f1-eth0"}
534 for recvr
, recvr_intf
in input_join
.items():
535 result
= app_helper
.run_join(recvr
, _IGMP_JOIN_RANGE
, join_intf
=recvr_intf
)
536 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
539 "Connect one source to c2 and send multicast traffic all"
540 " the receivers (226.1.1.1-5, 232.1.1.1-5)"
543 "Send multicast traffic from FRR3 to all the receivers "
544 "(226.1.1.1-5, 232.1.1.1-5)"
547 input_src
= {"i2": "i2-f1-eth0", "i5": "i5-c2-eth0"}
549 for src
, src_intf
in input_src
.items():
550 result
= app_helper
.run_traffic(src
, _IGMP_JOIN_RANGE
, bind_intf
=src_intf
)
551 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
553 step("Verifying mroutes before FRR restart, fetching uptime")
555 source
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
557 {"dut": "f1", "src_address": "*", "iif": "f1-c2-eth0", "oil": "f1-i8-eth2"},
558 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "f1-i8-eth2"},
560 for data
in input_dict
:
561 result
= verify_mroutes(
569 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
571 for data
in input_dict
:
572 result
= verify_upstream_iif(
573 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
575 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
577 step("Stop and Start the FRR services on FRR3 node")
578 stop_router(tgen
, "f1")
579 start_router(tgen
, "f1")
581 for data
in input_dict
:
582 result
= verify_mroutes(
590 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
593 "After stop and start of FRR service verify pim nbr is up "
594 "IGMP groups received , and (*,G) (S,G) entries populated again"
595 " Verify using 'show ip pim neighbor' , 'show ip igmp groups'"
599 result
= verify_pim_neighbors(tgen
, topo
)
600 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
603 interface
= "f1-i8-eth2"
604 result
= verify_igmp_groups(tgen
, dut
, interface
, _IGMP_JOIN_RANGE
)
605 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
607 for data
in input_dict
:
608 result
= verify_upstream_iif(
609 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
611 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
613 step("Stop the traffic and stop and start the FRR services on" " FRR3 node")
614 shutdown_bringup_interface(tgen
, "i2", "i2-f1-eth0", False)
616 stop_router(tgen
, "f1")
617 start_router(tgen
, "f1")
620 "After stop and start of FRR services , all the none of (S,G)"
621 " mroute should present on FRR3 node verify using "
626 {"dut": "f1", "src_address": "*", "iif": "f1-c2-eth0", "oil": "f1-i8-eth2"}
628 for data
in input_dict
:
629 result
= verify_mroutes(
637 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
640 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "none"}
642 for data
in input_dict
:
643 result
= verify_mroutes(
652 assert result
is not True, (
653 "Testcase {} : Failed \n "
654 "Expected: [{}]: mroute (S, G) should not be present in mroute table \n "
655 "Found: {}".format(tc_name
, data
["dut"], result
)
658 write_test_footer(tc_name
)
661 def test_verify_SPT_switchover_when_RPT_and_SPT_path_is_different_p0(request
):
663 TC_10: Verify SPT switchover working when RPT and SPT path is
668 tc_name
= request
.node
.name
669 write_test_header(tc_name
)
671 # Don"t run this test if we have any failure.
672 if tgen
.routers_have_failure():
673 pytest
.skip(tgen
.errors
)
675 # Creating configuration from JSON
676 app_helper
.stop_all_hosts()
678 reset_config_on_routers(tgen
)
679 clear_pim_interface_traffic(tgen
, topo
)
681 step("Configure static RP for (226.1.1.1-5) and " "(232.1.1.1-5) in c2")
683 _GROUP_RANGE
= GROUP_RANGE_2
+ GROUP_RANGE_3
684 _IGMP_JOIN_RANGE
= IGMP_JOIN_RANGE_2
+ IGMP_JOIN_RANGE_3
691 "rp_addr": topo
["routers"]["c2"]["links"]["lo"]["ipv4"].split(
694 "group_addr_range": _GROUP_RANGE
,
701 result
= create_pim_config(tgen
, topo
, input_dict
)
702 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
705 "Enable IGMP on FRR1 interface and send IGMP join "
706 "(226.1.1.1-5) and (232.1.1.1-5)"
709 result
= app_helper
.run_join("i1", _IGMP_JOIN_RANGE
, "l1")
710 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
712 step("Send multicast traffic from FRR3 to '226.1.1.1-5'" ", '232.1.1.1-5' receiver")
714 step("registerRx and registerStopTx value before traffic sent")
715 state_dict
= {"c2": {"c2-f1-eth1": ["registerRx", "registerStopTx"]}}
716 state_before
= get_pim_interface_traffic(tgen
, state_dict
)
719 ), "Testcase {} : Failed \n state_before is not dictionary \nError: {}".format(
723 result
= app_helper
.run_traffic("i2", _IGMP_JOIN_RANGE
, "f1")
724 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
727 "Verify in FRR3 sending initial packet to RP using"
728 " 'show ip mroute' and mroute OIL is towards RP."
731 result
= verify_mroutes(
737 ["f1-c2-eth0", "f1-r2-eth3"],
739 assert result
is True, "Testcase {} : " "Failed Error: {}".format(tc_name
, result
)
741 result
= verify_mroutes(
742 tgen
, "f1", "10.0.5.2", _IGMP_JOIN_RANGE
, "f1-i2-eth1", "f1-r2-eth3"
744 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
747 " After spt switchover traffic is flowing between"
748 " (LHR(FRR1)-FHR(FRR3)) and (S,G) OIL is updated toward FRR1"
749 " 'show ip mroute' and 'show ip pim upstream'"
752 source
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
754 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "f1-r2-eth3"},
755 {"dut": "l1", "src_address": source
, "iif": "l1-r2-eth4", "oil": "l1-i1-eth1"},
757 for data
in input_dict
:
758 result
= verify_mroutes(
766 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
768 for data
in input_dict
:
769 result
= verify_upstream_iif(
770 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
772 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
774 step("Stop the traffic to all the receivers")
776 app_helper
.stop_host("i2")
779 "Null register packet being send periodically from FRR3 to RP, "
780 "verify using show ip mroute on RP, have (S, G) entries null OIL"
781 " 'show ip mroute' and verify show ip pim interface traffic"
782 "(In RP Register msg should be received and Register stop should"
786 {"dut": "c2", "src_address": source
, "iif": "c2-f1-eth1", "oil": "none"}
788 for data
in input_dict
:
789 result
= verify_mroutes(
797 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
799 step("registerRx and registerStopTx value after traffic sent")
800 state_after
= get_pim_interface_traffic(tgen
, state_dict
)
803 ), "Testcase {} : Failed \n state_before is not dictionary \nError: {}".format(
807 result
= verify_state_incremented(state_before
, state_after
)
808 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
810 write_test_footer(tc_name
)
813 def test_verify_mroute_after_shut_noshut_of_upstream_interface_p1(request
):
815 TC_15: Verify (S,G) and (*,G) mroute after shut / no shut of upstream
820 tc_name
= request
.node
.name
821 write_test_header(tc_name
)
823 # Don"t run this test if we have any failure.
824 if tgen
.routers_have_failure():
825 pytest
.skip(tgen
.errors
)
827 # Creating configuration from JSON
828 app_helper
.stop_all_hosts()
830 reset_config_on_routers(tgen
)
831 clear_pim_interface_traffic(tgen
, topo
)
833 step("Configure static RP for (226.1.1.1-5) in c1")
834 step("Configure static RP for (232.1.1.1-5) in c2")
836 _GROUP_RANGE
= GROUP_RANGE_2
+ GROUP_RANGE_3
837 _IGMP_JOIN_RANGE
= IGMP_JOIN_RANGE_2
+ IGMP_JOIN_RANGE_3
844 "rp_addr": topo
["routers"]["c1"]["links"]["lo"]["ipv4"].split(
847 "group_addr_range": GROUP_RANGE_2
,
856 "rp_addr": topo
["routers"]["c2"]["links"]["lo"]["ipv4"].split(
859 "group_addr_range": GROUP_RANGE_3
,
866 result
= create_pim_config(tgen
, topo
, input_dict
)
867 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
870 "Enable IGMP on FRR1 interface and send IGMP join "
871 "(226.1.1.1-5) and (232.1.1.1-5)"
874 "Configure IGMP interface on FRR3 and send IGMP join"
875 " for group (226.1.1.1-5, 232.1.1.1-5)"
883 "igmp": {"version": "2", "query": {"query-interval": 15}}
889 result
= create_igmp_config(tgen
, topo
, input_dict
)
890 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
892 input_join
= {"i1": "i1-l1-eth0", "i8": "i8-f1-eth0"}
894 for recvr
, recvr_intf
in input_join
.items():
895 result
= app_helper
.run_join(recvr
, _IGMP_JOIN_RANGE
, join_intf
=recvr_intf
)
896 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
899 "Connect one source to c2 and send multicast traffic all"
900 " the receivers (226.1.1.1-5, 232.1.1.1-5)"
903 "Send multicast traffic from FRR3 to all the receivers "
904 "(226.1.1.1-5, 232.1.1.1-5)"
907 input_src
= {"i2": "i2-f1-eth0", "i5": "i5-c2-eth0"}
909 for src
, src_intf
in input_src
.items():
910 result
= app_helper
.run_traffic(src
, _IGMP_JOIN_RANGE
, bind_intf
=src_intf
)
911 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
914 "FRR3 (S,G) has one OIL for local receiver one toward c2"
915 " verify 'show ip mroute' and 'show ip pim upstream'"
918 source
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
920 {"dut": "f1", "src_address": "*", "iif": "f1-c2-eth0", "oil": "f1-i8-eth2"},
921 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "f1-i8-eth2"},
923 for data
in input_dict
:
924 result
= verify_mroutes(
932 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
934 for data
in input_dict
:
935 result
= verify_upstream_iif(
936 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_2
938 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
940 step("Shut and No shut interface connected from FHR (FRR3)" " to c2")
943 shutdown_bringup_interface(tgen
, dut
, intf
, False)
944 shutdown_bringup_interface(tgen
, dut
, intf
, True)
946 step("Shut and No shut interface connected from LHR (FRR1)" " to c1")
949 shutdown_bringup_interface(tgen
, dut
, intf
, False)
950 shutdown_bringup_interface(tgen
, dut
, intf
, True)
952 for data
in input_dict
:
953 result
= verify_mroutes(
961 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
963 step("Shut and No shut FRR1 and FRR3 interface")
964 shutdown_bringup_interface(tgen
, "l1", "l1-r2-eth4", False)
965 shutdown_bringup_interface(tgen
, dut
, intf
, True)
967 shutdown_bringup_interface(tgen
, "f1", "f1-r2-eth3", False)
968 shutdown_bringup_interface(tgen
, dut
, intf
, True)
971 "After shut/no shut of interface , verify traffic resume to all"
972 "the receivers (S,G) OIL update for all the receivers"
975 for data
in input_dict
:
976 result
= verify_mroutes(
984 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
987 "Shut FRR1, FRR3 interface , clear mroute in FRR1"
988 " and No shut FRR1, FRR3 interface "
992 shutdown_bringup_interface(tgen
, dut
, intf
, False)
996 shutdown_bringup_interface(tgen
, dut
, intf
, False)
1000 shutdown_bringup_interface(tgen
, dut
, intf
, True)
1004 shutdown_bringup_interface(tgen
, dut
, intf
, True)
1006 clear_mroute(tgen
, "l1")
1007 clear_mroute(tgen
, "l1")
1010 "After no shut, verify traffic resume to all the receivers"
1011 " (S,G) OIL update for all the receivers"
1014 for data
in input_dict
:
1015 result
= verify_mroutes(
1018 data
["src_address"],
1023 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1026 "Shut and no shut upstream interface from FRR1 to FRR2 and "
1027 "cisco immediate after mroute/upstream got cleared"
1031 intf_l1_r2
= "l1-r2-eth4"
1032 shutdown_bringup_interface(tgen
, dut
, intf_l1_r2
, False)
1034 intf_l1_c1
= "l1-c1-eth0"
1035 shutdown_bringup_interface(tgen
, dut
, intf_l1_c1
, False)
1037 result
= verify_upstream_iif(
1038 tgen
, "l1", "Unknown", source
, IGMP_JOIN_RANGE_2
, expected
=False
1040 assert result
is not True, (
1041 "Testcase {} : Failed \n "
1042 "Expected: [{}]: Upstream IIF should be unknown \n "
1043 "Found: {}".format(tc_name
, "l1", result
)
1046 step("No shut the Source interface just after the upstream is expired" " from FRR1")
1047 shutdown_bringup_interface(tgen
, dut
, intf_l1_r2
, True)
1048 shutdown_bringup_interface(tgen
, dut
, intf_l1_c1
, True)
1050 for data
in input_dict
:
1051 result
= verify_mroutes(
1054 data
["src_address"],
1059 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1061 step("Stop the traffic to all the receivers")
1062 app_helper
.stop_all_hosts()
1064 for data
in input_dict
:
1065 result
= verify_mroutes(
1068 data
["src_address"],
1074 assert result
is not True, (
1075 "Testcase {} : Failed \n "
1076 "Expected: [{}]: mroute (S, G) should not be present in mroute table \n "
1077 "Found: {}".format(tc_name
, data
["dut"], result
)
1080 write_test_footer(tc_name
)
1083 def test_verify_mroute_when_receiver_is_outside_frr_p0(request
):
1085 TC_7: Verify mroute detail when receiver is present
1089 tgen
= get_topogen()
1090 tc_name
= request
.node
.name
1091 write_test_header(tc_name
)
1093 # Don"t run this test if we have any failure.
1094 if tgen
.routers_have_failure():
1095 pytest
.skip(tgen
.errors
)
1097 # Creating configuration from JSON
1098 app_helper
.stop_all_hosts()
1100 reset_config_on_routers(tgen
)
1101 clear_pim_interface_traffic(tgen
, topo
)
1103 step("Configure static RP on c1 for group range " "(226.1.1.1-5) and (232.1.1.1-5)")
1105 _GROUP_RANGE
= GROUP_RANGE_2
+ GROUP_RANGE_3
1106 _IGMP_JOIN_RANGE
= IGMP_JOIN_RANGE_2
+ IGMP_JOIN_RANGE_3
1113 "rp_addr": topo
["routers"]["c1"]["links"]["lo"]["ipv4"].split(
1116 "group_addr_range": _GROUP_RANGE
,
1123 result
= create_pim_config(tgen
, topo
, input_dict
)
1124 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1127 "Enable IGMP on FRR1 interface and send IGMP join"
1128 " (226.1.1.1-5) and (232.1.1.1-5)"
1130 result
= app_helper
.run_join("i1", _IGMP_JOIN_RANGE
, "l1")
1131 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1134 "Send multicast traffic from FRR3 to all the receivers "
1135 "(226.1.1.1-5) and (232.1.1.1-5)"
1137 result
= app_helper
.run_traffic("i2", _IGMP_JOIN_RANGE
, "f1")
1138 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1141 "Configure one more receiver in c2 enable IGMP and send"
1142 " join (226.1.1.1-5) and (232.1.1.1-5)"
1149 "igmp": {"version": "2", "query": {"query-interval": 15}}
1155 result
= create_igmp_config(tgen
, topo
, input_dict
)
1156 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1158 result
= app_helper
.run_join("i5", _IGMP_JOIN_RANGE
, "c2")
1159 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1161 step("FRR1 has 10 (*.G) and 10 (S,G) verify using 'show ip mroute count'")
1163 "All the receiver are receiving traffic on FRR1 and (S,G) OIL is toward"
1164 "receivers, verify using 'show ip mroute' 'show ip pim upstream'"
1167 "All the receiver are receiving traffic on c2 and (S,G) OIL is "
1168 "toward receivers, verify using 'show ip mroute' 'show ip pim upstream'"
1171 source
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
1173 {"dut": "l1", "src_address": "*", "iif": "l1-c1-eth0", "oil": "l1-i1-eth1"},
1174 {"dut": "l1", "src_address": source
, "iif": "l1-r2-eth4", "oil": "l1-i1-eth1"},
1175 {"dut": "c2", "src_address": "*", "iif": "c2-c1-eth0", "oil": "c2-i5-eth2"},
1176 {"dut": "c2", "src_address": source
, "iif": "c2-f1-eth1", "oil": "c2-i5-eth2"},
1178 for data
in input_dict
:
1179 result
= verify_mroutes(
1182 data
["src_address"],
1187 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1190 "FRR3 has (S,G) OIL created toward c1/c2 receiver and FRR1 receiver"
1191 "'show ip pim state'"
1194 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "f1-c2-eth0"},
1195 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "f1-r2-eth3"},
1197 for data
in input_dict
:
1198 result
= verify_pim_state(
1204 data
["src_address"],
1206 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1208 for data
in input_dict
:
1209 result
= verify_upstream_iif(
1210 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
1212 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1214 write_test_footer(tc_name
)
1217 def test_verify_mroute_when_FRR_is_FHR_and_LHR_p0(request
):
1219 TC_8: Verify mroute when FRR is acting as FHR and LHR
1222 tgen
= get_topogen()
1223 tc_name
= request
.node
.name
1224 write_test_header(tc_name
)
1226 # Don"t run this test if we have any failure.
1227 if tgen
.routers_have_failure():
1228 pytest
.skip(tgen
.errors
)
1230 # Creating configuration from JSON
1231 app_helper
.stop_all_hosts()
1233 reset_config_on_routers(tgen
)
1234 clear_pim_interface_traffic(tgen
, topo
)
1236 step("Configure static RP for group range (226.1.1.1-5) and " "(232.1.1.1-5) on c1")
1237 _GROUP_RANGE
= GROUP_RANGE_2
+ GROUP_RANGE_3
1238 _IGMP_JOIN_RANGE
= IGMP_JOIN_RANGE_2
+ IGMP_JOIN_RANGE_3
1245 "rp_addr": topo
["routers"]["c1"]["links"]["lo"]["ipv4"].split(
1248 "group_addr_range": _GROUP_RANGE
,
1255 result
= create_pim_config(tgen
, topo
, input_dict
)
1256 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1259 "Enable IGMP on FRR1 interface and send IGMP join (226.1.1.1-5)"
1260 " and (232.1.1.1-5)"
1263 "Configure receiver on FRR3 with igmp and pim enabled and "
1264 "send IGMP join (226.1.1.1-5) and (232.1.1.1-5)"
1267 "Send multicast traffic from FRR3 to all the receivers "
1268 "(226.1.1.1-5) and (232.1.1.1-5)"
1271 step("Send IGMP join (226.1.1.1-5, 232.1.1.1-5) to LHR(l1)")
1272 result
= app_helper
.run_join("i1", _IGMP_JOIN_RANGE
, "l1")
1273 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1275 step("Send multicast traffic from FRR3 to '226.1.1.1-5'" ", '232.1.1.1-5' receiver")
1276 result
= app_helper
.run_traffic("i2", _IGMP_JOIN_RANGE
, "f1")
1277 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1280 "Configure receiver in f1 enable IGMP and send"
1281 " join (226.1.1.1-5) and (232.1.1.1-5)"
1284 step("Configure one IGMP interface on f1 node and send IGMP" " join (225.1.1.1)")
1290 "igmp": {"version": "2", "query": {"query-interval": 15}}
1296 result
= create_igmp_config(tgen
, topo
, input_dict
)
1297 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1299 result
= app_helper
.run_join("i8", _IGMP_JOIN_RANGE
, "f1")
1300 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1302 "l1 and f1 has 10 IGMP groups (226.1.1.1-5, 232.1.1.1-5),"
1303 " verify using 'show ip igmp groups'"
1306 interface
= "l1-i1-eth1"
1307 result
= verify_igmp_groups(tgen
, dut
, interface
, _IGMP_JOIN_RANGE
)
1308 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1311 interface
= "f1-i8-eth2"
1312 result
= verify_igmp_groups(tgen
, dut
, interface
, _IGMP_JOIN_RANGE
)
1313 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1316 "l1 , f1 has 10 (*,G) and 10 (S,G) for groups "
1317 "(226.1.1.1-5, 232.1.1.1-5), verify using "
1321 source
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
1323 {"dut": "f1", "src_address": "*", "iif": "f1-c2-eth0", "oil": "f1-i8-eth2"},
1324 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "f1-r2-eth3"},
1325 {"dut": "l1", "src_address": "*", "iif": "l1-c1-eth0", "oil": "l1-i1-eth1"},
1326 {"dut": "l1", "src_address": source
, "iif": "l1-r2-eth4", "oil": "l1-i1-eth1"},
1328 for data
in input_dict
:
1329 result
= verify_mroutes(
1332 data
["src_address"],
1337 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1339 step("Join timer is running in FHR and LHR , verify using" " 'show ip pim state'")
1341 for data
in input_dict
:
1342 result
= verify_pim_state(
1348 data
["src_address"],
1350 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1352 # Stop the multicast traffic
1353 step("Stop the traffic to all the receivers")
1354 app_helper
.stop_all_hosts()
1357 "After traffic stopped , verify (*,G) entries are not flushed"
1358 " out from FRR1 node verify using 'show ip mroute' "
1362 {"dut": "f1", "src_address": "*", "iif": "f1-c2-eth0", "oil": "f1-i8-eth2"},
1363 {"dut": "l1", "src_address": "*", "iif": "l1-c1-eth0", "oil": "l1-i1-eth1"},
1365 for data
in input_dict
:
1366 result
= verify_mroutes(
1369 data
["src_address"],
1376 ), "Testcase {} : Failed Error mroutes were flushed.".format(tc_name
)
1379 "After traffic stopped , verify (S,G) entries are flushed out"
1380 " from FRR1 node verify using 'show ip mroute' "
1384 {"dut": "l1", "src_address": source
, "iif": "l1-r2-eth4", "oil": "l1-i1-eth1"},
1385 {"dut": "f1", "src_address": source
, "iif": "i2-f1-eth0", "oil": "f1-r2-eth3"},
1388 for data
in input_dict
:
1389 result
= verify_mroutes(
1392 data
["src_address"],
1398 assert result
is not True, (
1399 "Testcase {} : Failed \n "
1400 "Expected: [{}]: mroute (S, G) should not be present in mroute table \n "
1401 "Found: {}".format(tc_name
, data
["dut"], result
)
1404 write_test_footer(tc_name
)
1407 def test_verify_mroute_when_5_different_receiver_joining_same_sources_p0(request
):
1409 TC_20: Verify mroute detail when 5 different receiver joining
1413 tgen
= get_topogen()
1414 tc_name
= request
.node
.name
1415 write_test_header(tc_name
)
1417 # Don"t run this test if we have any failure.
1418 if tgen
.routers_have_failure():
1419 pytest
.skip(tgen
.errors
)
1421 # Creating configuration from JSON
1422 app_helper
.stop_all_hosts()
1424 reset_config_on_routers(tgen
)
1425 clear_pim_interface_traffic(tgen
, topo
)
1427 step("Configure static RP for (226.1.1.1-5) in c1")
1428 step("Configure static RP for (232.1.1.1-5) in c2")
1430 _GROUP_RANGE
= GROUP_RANGE_2
+ GROUP_RANGE_3
1431 _IGMP_JOIN_RANGE
= IGMP_JOIN_RANGE_2
+ IGMP_JOIN_RANGE_3
1438 "rp_addr": topo
["routers"]["c1"]["links"]["lo"]["ipv4"].split(
1441 "group_addr_range": GROUP_RANGE_2
,
1450 "rp_addr": topo
["routers"]["c2"]["links"]["lo"]["ipv4"].split(
1453 "group_addr_range": GROUP_RANGE_3
,
1460 result
= create_pim_config(tgen
, topo
, input_dict
)
1461 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1464 "Configure 2 IGMP interface on FRR1 and send IGMP join"
1465 "for group (226.1.1.1-5, 232.1.1.1-5) from both the interface"
1468 "Configure 2 IGMP interface on FRR3 and send IGMP join for"
1469 " group (226.1.1.1-5, 232.1.1.1-5) from both the interface"
1472 "Configure 1 IGMP interface on c2 and send IGMP join for"
1473 "group (226.1.1.1-5, 232.1.1.1-5)"
1481 "igmp": {"version": "2", "query": {"query-interval": 15}}
1484 "igmp": {"version": "2", "query": {"query-interval": 15}}
1493 "igmp": {"version": "2", "query": {"query-interval": 15}}
1499 result
= create_igmp_config(tgen
, topo
, input_dict
)
1500 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1509 for recvr
, recvr_intf
in input_join
.items():
1510 result
= app_helper
.run_join(recvr
, _IGMP_JOIN_RANGE
, join_intf
=recvr_intf
)
1511 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1513 step("Configure one source in FRR2 , one in c1")
1515 "Send multicast traffic from both the sources to all the"
1516 "receivers (226.1.1.1-5, 232.1.1.1-5)"
1519 input_src
= {"i3": "i3-r2-eth0"}
1521 for src
, src_intf
in input_src
.items():
1522 result
= app_helper
.run_traffic(src
, _IGMP_JOIN_RANGE
, bind_intf
=src_intf
)
1523 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1525 "After all the IGMP groups received with correct port using"
1526 " 'show ip igmp groups' in FRR1, FRR3, c2"
1529 interface
= "l1-i6-eth2"
1530 result
= verify_igmp_groups(tgen
, dut
, interface
, _IGMP_JOIN_RANGE
)
1531 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1534 interface
= "f1-i8-eth2"
1535 result
= verify_igmp_groups(tgen
, dut
, interface
, _IGMP_JOIN_RANGE
)
1536 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1539 "(*,G) entries got created with upstream interface RP connected"
1540 " port using 'show ip pim upstream' in FRR1, FRR3, c2"
1543 "(S,G) entries created for all the receiver after starting the"
1544 " source , traffic is reaching to all the receiver , verify OIL"
1545 " of (S,G) is receiver port using 'show ip mroute' in FRR1, "
1549 source
= topo
["routers"]["i3"]["links"]["r2"]["ipv4"].split("/")[0]
1553 "src_address": source
,
1554 "iif": ["l1-r2-eth4", "l1-c1-eth0"],
1555 "oil": ["l1-i1-eth1", "l1-i6-eth2"],
1557 {"dut": "f1", "src_address": source
, "iif": "f1-r2-eth3", "oil": "f1-i8-eth2"},
1559 for data
in input_dict_all
:
1560 result
= verify_mroutes(
1563 data
["src_address"],
1568 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1570 for data
in input_dict_all
:
1571 result
= verify_upstream_iif(
1572 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
1574 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1576 step("Shut the receiver interface one by one on FRR1 node")
1577 shutdown_bringup_interface(tgen
, "l1", "l1-i1-eth1", False)
1578 shutdown_bringup_interface(tgen
, "l1", "l1-i6-eth2", False)
1581 "After shut the receiver port verify traffic is stopped immediately"
1582 " and (S,G) got timeout immediately in FRR1, FRR3, c2"
1585 {"dut": "l1", "src_address": source
, "iif": "l1-r2-eth4", "oil": "l1-i1-eth1"}
1587 for data
in input_dict
:
1588 result
= verify_mroutes(
1591 data
["src_address"],
1597 assert result
is not True, (
1598 "Testcase {} : Failed \n "
1599 "Expected: [{}]: mroute (S, G) should not be present in mroute table \n "
1600 "Found: {}".format(tc_name
, data
["dut"], result
)
1604 "No traffic impact observed on other receivers verify using"
1605 " 'show ip mroute' "
1608 {"dut": "f1", "src_address": source
, "iif": "f1-r2-eth3", "oil": "f1-i8-eth2"}
1610 for data
in input_dict
:
1611 result
= verify_mroutes(
1614 data
["src_address"],
1619 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1621 step("No shut the receiver interface one by one on FRR1 node")
1622 shutdown_bringup_interface(tgen
, "l1", "l1-i1-eth1", True)
1623 shutdown_bringup_interface(tgen
, "l1", "l1-i6-eth2", True)
1626 "After no shut of receivers all the mroute entries got populated"
1627 ", no duplicate entries present in mroute"
1630 for data
in input_dict_all
:
1631 result
= verify_mroutes(
1634 data
["src_address"],
1639 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1641 write_test_footer(tc_name
)
1644 def test_verify_oil_iif_for_mroute_after_shut_noshut_source_interface_p1(request
):
1646 TC_22: Verify OIL and IIF detail updated in (S,G) mroute after shut
1647 and no shut of the source interface
1650 tgen
= get_topogen()
1651 tc_name
= request
.node
.name
1652 write_test_header(tc_name
)
1654 # Don"t run this test if we have any failure.
1655 if tgen
.routers_have_failure():
1656 pytest
.skip(tgen
.errors
)
1658 # Creating configuration from JSON
1659 app_helper
.stop_all_hosts()
1661 reset_config_on_routers(tgen
)
1662 clear_pim_interface_traffic(tgen
, topo
)
1664 step("Configure static RP for (226.1.1.1-5) in c1")
1665 step("Configure static RP for (232.1.1.1-5) in c2")
1667 _GROUP_RANGE
= GROUP_RANGE_2
+ GROUP_RANGE_3
1668 _IGMP_JOIN_RANGE
= IGMP_JOIN_RANGE_2
+ IGMP_JOIN_RANGE_3
1675 "rp_addr": topo
["routers"]["c1"]["links"]["lo"]["ipv4"].split(
1678 "group_addr_range": GROUP_RANGE_2
,
1687 "rp_addr": topo
["routers"]["c2"]["links"]["lo"]["ipv4"].split(
1690 "group_addr_range": GROUP_RANGE_3
,
1697 result
= create_pim_config(tgen
, topo
, input_dict
)
1698 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1701 "Configure IGMP interface on FRR1 and FRR3 and send IGMP join"
1702 " for group (226.1.1.1-5, 232.1.1.1-5)"
1710 "igmp": {"version": "2", "query": {"query-interval": 15}}
1716 result
= create_igmp_config(tgen
, topo
, input_dict
)
1717 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1719 input_join
= {"i1": "i1-l1-eth0", "i8": "i8-f1-eth0"}
1721 for recvr
, recvr_intf
in input_join
.items():
1722 result
= app_helper
.run_join(recvr
, _IGMP_JOIN_RANGE
, join_intf
=recvr_intf
)
1723 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1725 step("Configure 1 source in FRR1 , 1 in FRR3")
1727 "Send multicast traffic from both the sources to all the "
1728 "receivers (226.1.1.1-5, 232.1.1.1-5)"
1731 input_src
= {"i6": "i6-l1-eth0", "i2": "i2-f1-eth0"}
1733 for src
, src_intf
in input_src
.items():
1734 result
= app_helper
.run_traffic(src
, _IGMP_JOIN_RANGE
, bind_intf
=src_intf
)
1735 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1738 "*,G) is created and (S,G) created on FRR1 and FRR3 for both"
1739 " the source verify using 'show ip mroute' and "
1740 " 'show ip pim upstream' to check the upstream interface"
1744 source_i6
= topo
["routers"]["i6"]["links"]["l1"]["ipv4"].split("/")[0]
1745 source_i2
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
1747 {"dut": "l1", "src_address": "*", "iif": "l1-c1-eth0", "oil": "l1-i1-eth1"},
1750 "src_address": source_i2
,
1751 "iif": "l1-r2-eth4",
1752 "oil": "l1-i1-eth1",
1756 "src_address": source_i6
,
1757 "iif": "l1-i6-eth2",
1758 "oil": "l1-i1-eth1",
1760 {"dut": "f1", "src_address": "*", "iif": "f1-c2-eth0", "oil": "f1-i8-eth2"},
1763 "src_address": source_i2
,
1764 "iif": "f1-i2-eth1",
1765 "oil": "f1-i8-eth2",
1769 "src_address": source_i6
,
1770 "iif": "f1-r2-eth3",
1771 "oil": "f1-i8-eth2",
1774 for data
in input_dict_all
:
1775 result
= verify_mroutes(
1778 data
["src_address"],
1783 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1785 for data
in input_dict_all
:
1786 result
= verify_upstream_iif(
1787 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
1789 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1791 step("Shut the source interface one by one on FRR1")
1792 shutdown_bringup_interface(tgen
, "f1", "f1-i2-eth1", False)
1795 "After shut of ource interface from FRR3 verify all the (S,G) "
1796 "entries flushed out from FRR3 node 'show ip pim upstream' "
1797 " 'show ip mroute' "
1800 result
= verify_mroutes(
1809 assert result
is not True, (
1810 "Testcase {} : Failed \n "
1811 "Expected: [{}]: mroute (S, G) should not be present in mroute table \n "
1812 "Found: {}".format(tc_name
, data
["dut"], result
)
1815 result
= verify_upstream_iif(
1816 tgen
, "f1", "Unknown", "10.0.5.2", _IGMP_JOIN_RANGE
, joinState
="NotJoined"
1818 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1820 write_test_footer(tc_name
)
1823 if __name__
== "__main__":
1824 args
= ["-s"] + sys
.argv
[1:]
1825 sys
.exit(pytest
.main(args
))