4 # Copyright (c) 2020 by VMware, Inc. ("VMware")
5 # Used Copyright (c) 2018 by Network Device Education Foundation,
6 # Inc. ("NetDEF") in this file.
8 # Permission to use, copy, modify, and/or distribute this software
9 # for any purpose with or without fee is hereby granted, provided
10 # that the above copyright notice and this permission notice appear
13 # THE SOFTWARE IS PROVIDED "AS IS" AND VMWARE DISCLAIMS ALL WARRANTIES
14 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL VMWARE BE LIABLE FOR
16 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
17 # DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
18 # WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
19 # ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
24 Following tests are covered to test multicast pim sm:
27 - Create topology (setup module)
30 Following tests are covered:
31 1. TC_17: Verify (*,G) and (S,G) present and multicast traffic resume,
32 after restart of PIMd daemon
33 2. TC_18: Verify (*,G) and (S,G) present and multicast traffic resume after
34 FRR service stop and start
35 3. TC_10: Verify SPT switchover working when RPT and SPT path is
37 4. TC_15: Verify (S,G) and (*,G) mroute after shut / no shut of upstream
39 5. TC_7: Verify mroute detail when receiver is present
41 6. TC_8: Verify mroute when FRR is acting as FHR and LHR
42 7. TC_20: Verify mroute detail when 5 different receiver joining
44 8. TC_22: Verify OIL and IIF detail updated in (S,G) mroute after shut
45 and no shut of the source interface
53 pytestmark
= pytest
.mark
.pimd
55 # Save the Current Working Directory to find configuration files.
56 CWD
= os
.path
.dirname(os
.path
.realpath(__file__
))
57 sys
.path
.append(os
.path
.join(CWD
, "../"))
58 sys
.path
.append(os
.path
.join(CWD
, "../lib/"))
60 # Required to instantiate the topology builder class.
62 # pylint: disable=C0413
63 # Import topogen and topotest helpers
64 from lib
.topogen
import Topogen
, get_topogen
66 from lib
.common_config
import (
71 reset_config_on_routers
,
72 shutdown_bringup_interface
,
77 required_linux_kernel_version
,
85 get_pim_interface_traffic
,
90 clear_ip_pim_interface_traffic
,
93 from lib
.topolog
import logger
94 from lib
.topojson
import build_config_from_json
97 pytestmark
= [pytest
.mark
.pimd
]
102 i4-----c1-------------c2---i5
105 i1-----l1------r2-----f1---i2
111 i1, i2, i3. i4, i5, i6, i7, i8 - FRR running iperf to send IGMP
121 GROUP_RANGE
= "225.0.0.0/8"
122 IGMP_JOIN
= "225.1.1.1"
130 IGMP_JOIN_RANGE_1
= ["225.1.1.1", "225.1.1.2", "225.1.1.3", "225.1.1.4", "225.1.1.5"]
138 IGMP_JOIN_RANGE_2
= ["226.1.1.1", "226.1.1.2", "226.1.1.3", "226.1.1.4", "226.1.1.5"]
147 IGMP_JOIN_RANGE_3
= ["227.1.1.1", "227.1.1.2", "227.1.1.3", "227.1.1.4", "227.1.1.5"]
150 def setup_module(mod
):
152 Sets up the pytest environment
157 # Required linux kernel version for this suite to run.
158 result
= required_linux_kernel_version("4.19")
159 if result
is not True:
160 pytest
.skip("Kernel requirements are not met")
162 testsuite_run_time
= time
.asctime(time
.localtime(time
.time()))
163 logger
.info("Testsuite start time: {}".format(testsuite_run_time
))
164 logger
.info("=" * 40)
165 logger
.info("Master Topology: \n {}".format(TOPOLOGY
))
167 logger
.info("Running setup_module to create topology")
169 json_file
= "{}/multicast_pim_sm_topo2.json".format(CWD
)
170 tgen
= Topogen(json_file
, mod
.__name
__)
172 topo
= tgen
.json_topo
173 # ... and here it calls Mininet initialization functions.
175 # get list of daemons needs to be started for this suite.
176 daemons
= topo_daemons(tgen
, topo
)
178 # Starting topology, create tmp files which are loaded to routers
179 # to start deamons and then start routers
180 start_topology(tgen
, daemons
)
182 # Don"t run this test if we have any failure.
183 if tgen
.routers_have_failure():
184 pytest
.skip(tgen
.errors
)
186 # Creating configuration from JSON
187 build_config_from_json(tgen
, topo
)
189 # XXX Replace this using "with McastTesterHelper()... " in each test if possible.
191 app_helper
= McastTesterHelper(tgen
)
193 logger
.info("Running setup_module() done")
196 def teardown_module():
197 """Teardown the pytest environment"""
199 logger
.info("Running teardown_module to delete topology")
205 # Stop toplogy and Remove tmp files
209 "Testsuite end time: {}".format(time
.asctime(time
.localtime(time
.time())))
211 logger
.info("=" * 40)
214 #####################################################
218 #####################################################
221 def verify_state_incremented(state_before
, state_after
):
223 API to compare interface traffic state incrementing
227 * `state_before` : State dictionary for any particular instance
228 * `state_after` : State dictionary for any particular instance
231 for router
, state_data
in state_before
.items():
232 for state
, value
in state_data
.items():
233 if state_before
[router
][state
] >= state_after
[router
][state
]:
235 "[DUT: %s]: state %s value has not"
236 " incremented, Initial value: %s, "
237 "Current value: %s [FAILED!!]"
241 state_before
[router
][state
],
242 state_after
[router
][state
],
248 "[DUT: %s]: State %s value is "
249 "incremented, Initial value: %s, Current value: %s"
253 state_before
[router
][state
],
254 state_after
[router
][state
],
260 def test_verify_mroute_and_traffic_when_pimd_restarted_p2(request
):
262 TC_17: Verify (*,G) and (S,G) present and multicast traffic resume,
263 after restart of PIMd daemon
267 tc_name
= request
.node
.name
268 write_test_header(tc_name
)
270 # Don"t run this test if we have any failure.
271 if tgen
.routers_have_failure():
272 pytest
.skip(tgen
.errors
)
274 # Creating configuration from JSON
275 app_helper
.stop_all_hosts()
276 clear_ip_mroute(tgen
)
277 reset_config_on_routers(tgen
)
278 clear_ip_pim_interface_traffic(tgen
, topo
)
280 step("Configure static RP for (226.1.1.1-5) in c1")
281 step("Configure static RP for (232.1.1.1-5) in c2")
283 _GROUP_RANGE
= GROUP_RANGE_2
+ GROUP_RANGE_3
284 _IGMP_JOIN_RANGE
= IGMP_JOIN_RANGE_2
+ IGMP_JOIN_RANGE_3
291 "rp_addr": topo
["routers"]["c1"]["links"]["lo"]["ipv4"].split(
294 "group_addr_range": GROUP_RANGE_2
,
303 "rp_addr": topo
["routers"]["c2"]["links"]["lo"]["ipv4"].split(
306 "group_addr_range": GROUP_RANGE_3
,
313 result
= create_pim_config(tgen
, topo
, input_dict
)
314 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
317 "Enable IGMP on FRR1 interface and send IGMP join "
318 "(226.1.1.1-5) and (232.1.1.1-5)"
321 "Configure IGMP interface on FRR3 and send IGMP join"
322 " for group (226.1.1.1-5, 232.1.1.1-5)"
330 "igmp": {"version": "2", "query": {"query-interval": 15}}
336 result
= create_igmp_config(tgen
, topo
, input_dict
)
337 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
339 input_join
= {"i1": "i1-l1-eth0", "i8": "i8-f1-eth0"}
341 for recvr
, recvr_intf
in input_join
.items():
342 result
= app_helper
.run_join(recvr
, _IGMP_JOIN_RANGE
, join_intf
=recvr_intf
)
343 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
346 "Connect one source to c2 and send multicast traffic all"
347 " the receivers (226.1.1.1-5, 232.1.1.1-5)"
350 "Send multicast traffic from FRR3 to all the receivers "
351 "(226.1.1.1-5, 232.1.1.1-5)"
354 input_src
= {"i2": "i2-f1-eth0", "i5": "i5-c2-eth0"}
356 for src
, src_intf
in input_src
.items():
357 result
= app_helper
.run_traffic(src
, _IGMP_JOIN_RANGE
, bind_intf
=src_intf
)
358 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
360 # Verifying mroutes before PIMd restart, fetching uptime
362 source
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
364 {"dut": "f1", "src_address": "*", "iif": "f1-c2-eth0", "oil": "f1-i8-eth2"},
365 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "f1-i8-eth2"},
367 for data
in input_dict
:
368 result
= verify_ip_mroutes(
376 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
378 for data
in input_dict
:
379 result
= verify_upstream_iif(
380 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
382 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
384 step("Restart Pimd process on FRR3 node")
385 kill_router_daemons(tgen
, "f1", ["pimd"])
386 start_router_daemons(tgen
, "f1", ["pimd"])
388 for data
in input_dict
:
389 result
= verify_ip_mroutes(
397 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
400 "After restart of PIMd verify pim nbr is up , IGMP groups"
401 " received , and (*,G) (S,G) entries populated again ,"
402 " Verify using 'show ip pim neighbor' , 'show ip igmp groups'"
406 result
= verify_pim_neighbors(tgen
, topo
)
407 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
410 interface
= "f1-i8-eth2"
411 result
= verify_igmp_groups(tgen
, dut
, interface
, _IGMP_JOIN_RANGE
)
412 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
414 for data
in input_dict
:
415 result
= verify_upstream_iif(
416 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
418 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
420 step("Stop the traffic and restart PIMd immediately on FRR3 node")
423 shutdown_bringup_interface(tgen
, dut
, intf
, False)
425 kill_router_daemons(tgen
, "f1", ["pimd"])
426 start_router_daemons(tgen
, "f1", ["pimd"])
429 "After PIM process come , all the none of (S,G) mroute should"
430 " present on FRR3 'show ip mroute' "
434 {"dut": "f1", "src_address": "*", "iif": "f1-c2-eth0", "oil": "f1-i8-eth2"}
436 for data
in input_dict
:
437 result
= verify_ip_mroutes(
445 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
448 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "none"}
450 for data
in input_dict
:
451 result
= verify_ip_mroutes(
462 ), "Testcase {} : Failed \n mroutes are still present \n Error: {}".format(
465 logger
.info("Expected Behavior: {}".format(result
))
467 write_test_footer(tc_name
)
470 def test_verify_mroute_and_traffic_when_frr_restarted_p2(request
):
472 TC_18: Verify (*,G) and (S,G) present and multicast traffic resume after
473 FRR service stop and start
477 tc_name
= request
.node
.name
478 write_test_header(tc_name
)
480 # Don"t run this test if we have any failure.
481 if tgen
.routers_have_failure():
482 pytest
.skip(tgen
.errors
)
484 # Creating configuration from JSON
485 app_helper
.stop_all_hosts()
486 clear_ip_mroute(tgen
)
487 reset_config_on_routers(tgen
)
488 clear_ip_pim_interface_traffic(tgen
, topo
)
490 step("Configure static RP for (226.1.1.1-5) in c1")
491 step("Configure static RP for (232.1.1.1-5) in c2")
493 _GROUP_RANGE
= GROUP_RANGE_2
+ GROUP_RANGE_3
494 _IGMP_JOIN_RANGE
= IGMP_JOIN_RANGE_2
+ IGMP_JOIN_RANGE_3
501 "rp_addr": topo
["routers"]["c1"]["links"]["lo"]["ipv4"].split(
504 "group_addr_range": GROUP_RANGE_2
,
513 "rp_addr": topo
["routers"]["c2"]["links"]["lo"]["ipv4"].split(
516 "group_addr_range": GROUP_RANGE_3
,
523 result
= create_pim_config(tgen
, topo
, input_dict
)
524 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
527 "Enable IGMP on FRR1 interface and send IGMP join "
528 "(226.1.1.1-5) and (232.1.1.1-5)"
531 "Configure IGMP interface on FRR3 and send IGMP join"
532 " for group (226.1.1.1-5, 232.1.1.1-5)"
540 "igmp": {"version": "2", "query": {"query-interval": 15}}
546 result
= create_igmp_config(tgen
, topo
, input_dict
)
547 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
549 input_join
= {"i1": "i1-l1-eth0", "i8": "i8-f1-eth0"}
551 for recvr
, recvr_intf
in input_join
.items():
552 result
= app_helper
.run_join(recvr
, _IGMP_JOIN_RANGE
, join_intf
=recvr_intf
)
553 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
556 "Connect one source to c2 and send multicast traffic all"
557 " the receivers (226.1.1.1-5, 232.1.1.1-5)"
560 "Send multicast traffic from FRR3 to all the receivers "
561 "(226.1.1.1-5, 232.1.1.1-5)"
564 input_src
= {"i2": "i2-f1-eth0", "i5": "i5-c2-eth0"}
566 for src
, src_intf
in input_src
.items():
567 result
= app_helper
.run_traffic(src
, _IGMP_JOIN_RANGE
, bind_intf
=src_intf
)
568 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
570 step("Verifying mroutes before FRR restart, fetching uptime")
572 source
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
574 {"dut": "f1", "src_address": "*", "iif": "f1-c2-eth0", "oil": "f1-i8-eth2"},
575 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "f1-i8-eth2"},
577 for data
in input_dict
:
578 result
= verify_ip_mroutes(
586 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
588 for data
in input_dict
:
589 result
= verify_upstream_iif(
590 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
592 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
594 step("Stop and Start the FRR services on FRR3 node")
595 stop_router(tgen
, "f1")
596 start_router(tgen
, "f1")
598 for data
in input_dict
:
599 result
= verify_ip_mroutes(
607 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
610 "After stop and start of FRR service verify pim nbr is up "
611 "IGMP groups received , and (*,G) (S,G) entries populated again"
612 " Verify using 'show ip pim neighbor' , 'show ip igmp groups'"
616 result
= verify_pim_neighbors(tgen
, topo
)
617 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
620 interface
= "f1-i8-eth2"
621 result
= verify_igmp_groups(tgen
, dut
, interface
, _IGMP_JOIN_RANGE
)
622 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
624 for data
in input_dict
:
625 result
= verify_upstream_iif(
626 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
628 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
630 step("Stop the traffic and stop and start the FRR services on" " FRR3 node")
631 shutdown_bringup_interface(tgen
, "i2", "i2-f1-eth0", False)
633 stop_router(tgen
, "f1")
634 start_router(tgen
, "f1")
637 "After stop and start of FRR services , all the none of (S,G)"
638 " mroute should present on FRR3 node verify using "
643 {"dut": "f1", "src_address": "*", "iif": "f1-c2-eth0", "oil": "f1-i8-eth2"}
645 for data
in input_dict
:
646 result
= verify_ip_mroutes(
654 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
657 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "none"}
659 for data
in input_dict
:
660 result
= verify_ip_mroutes(
671 ), "Testcase {} : Failed \n mroutes are still present \n Error: {}".format(
674 logger
.info("Expected Behavior: {}".format(result
))
676 write_test_footer(tc_name
)
679 def test_verify_SPT_switchover_when_RPT_and_SPT_path_is_different_p0(request
):
681 TC_10: Verify SPT switchover working when RPT and SPT path is
686 tc_name
= request
.node
.name
687 write_test_header(tc_name
)
689 # Don"t run this test if we have any failure.
690 if tgen
.routers_have_failure():
691 pytest
.skip(tgen
.errors
)
693 # Creating configuration from JSON
694 app_helper
.stop_all_hosts()
695 clear_ip_mroute(tgen
)
696 reset_config_on_routers(tgen
)
697 clear_ip_pim_interface_traffic(tgen
, topo
)
699 step("Configure static RP for (226.1.1.1-5) and " "(232.1.1.1-5) in c2")
701 _GROUP_RANGE
= GROUP_RANGE_2
+ GROUP_RANGE_3
702 _IGMP_JOIN_RANGE
= IGMP_JOIN_RANGE_2
+ IGMP_JOIN_RANGE_3
709 "rp_addr": topo
["routers"]["c2"]["links"]["lo"]["ipv4"].split(
712 "group_addr_range": _GROUP_RANGE
,
719 result
= create_pim_config(tgen
, topo
, input_dict
)
720 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
723 "Enable IGMP on FRR1 interface and send IGMP join "
724 "(226.1.1.1-5) and (232.1.1.1-5)"
727 result
= app_helper
.run_join("i1", _IGMP_JOIN_RANGE
, "l1")
728 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
730 step("Send multicast traffic from FRR3 to '226.1.1.1-5'" ", '232.1.1.1-5' receiver")
732 step("registerRx and registerStopTx value before traffic sent")
733 state_dict
= {"c2": {"c2-f1-eth1": ["registerRx", "registerStopTx"]}}
734 state_before
= get_pim_interface_traffic(tgen
, state_dict
)
737 ), "Testcase {} : Failed \n state_before is not dictionary \nError: {}".format(
741 result
= app_helper
.run_traffic("i2", _IGMP_JOIN_RANGE
, "f1")
742 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
745 "Verify in FRR3 sending initial packet to RP using"
746 " 'show ip mroute' and mroute OIL is towards RP."
749 result
= verify_ip_mroutes(
755 ["f1-c2-eth0", "f1-r2-eth3"],
757 assert result
is True, "Testcase {} : " "Failed Error: {}".format(tc_name
, result
)
759 result
= verify_ip_mroutes(
760 tgen
, "f1", "10.0.5.2", _IGMP_JOIN_RANGE
, "f1-i2-eth1", "f1-r2-eth3"
762 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
765 " After spt switchover traffic is flowing between"
766 " (LHR(FRR1)-FHR(FRR3)) and (S,G) OIL is updated toward FRR1"
767 " 'show ip mroute' and 'show ip pim upstream'"
770 source
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
772 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "f1-r2-eth3"},
773 {"dut": "l1", "src_address": source
, "iif": "l1-r2-eth4", "oil": "l1-i1-eth1"},
775 for data
in input_dict
:
776 result
= verify_ip_mroutes(
784 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
786 for data
in input_dict
:
787 result
= verify_upstream_iif(
788 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
790 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
792 step("Stop the traffic to all the receivers")
794 app_helper
.stop_host("i2")
797 "Null register packet being send periodically from FRR3 to RP, "
798 "verify using show ip mroute on RP, have (S, G) entries null OIL"
799 " 'show ip mroute' and verify show ip pim interface traffic"
800 "(In RP Register msg should be received and Register stop should"
804 {"dut": "c2", "src_address": source
, "iif": "c2-f1-eth1", "oil": "none"}
806 for data
in input_dict
:
807 result
= verify_ip_mroutes(
815 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
817 step("registerRx and registerStopTx value after traffic sent")
818 state_after
= get_pim_interface_traffic(tgen
, state_dict
)
821 ), "Testcase {} : Failed \n state_before is not dictionary \nError: {}".format(
825 result
= verify_state_incremented(state_before
, state_after
)
826 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
828 write_test_footer(tc_name
)
831 def test_verify_mroute_after_shut_noshut_of_upstream_interface_p1(request
):
833 TC_15: Verify (S,G) and (*,G) mroute after shut / no shut of upstream
838 tc_name
= request
.node
.name
839 write_test_header(tc_name
)
841 # Don"t run this test if we have any failure.
842 if tgen
.routers_have_failure():
843 pytest
.skip(tgen
.errors
)
845 # Creating configuration from JSON
846 app_helper
.stop_all_hosts()
847 clear_ip_mroute(tgen
)
848 reset_config_on_routers(tgen
)
849 clear_ip_pim_interface_traffic(tgen
, topo
)
851 step("Configure static RP for (226.1.1.1-5) in c1")
852 step("Configure static RP for (232.1.1.1-5) in c2")
854 _GROUP_RANGE
= GROUP_RANGE_2
+ GROUP_RANGE_3
855 _IGMP_JOIN_RANGE
= IGMP_JOIN_RANGE_2
+ IGMP_JOIN_RANGE_3
862 "rp_addr": topo
["routers"]["c1"]["links"]["lo"]["ipv4"].split(
865 "group_addr_range": GROUP_RANGE_2
,
874 "rp_addr": topo
["routers"]["c2"]["links"]["lo"]["ipv4"].split(
877 "group_addr_range": GROUP_RANGE_3
,
884 result
= create_pim_config(tgen
, topo
, input_dict
)
885 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
888 "Enable IGMP on FRR1 interface and send IGMP join "
889 "(226.1.1.1-5) and (232.1.1.1-5)"
892 "Configure IGMP interface on FRR3 and send IGMP join"
893 " for group (226.1.1.1-5, 232.1.1.1-5)"
901 "igmp": {"version": "2", "query": {"query-interval": 15}}
907 result
= create_igmp_config(tgen
, topo
, input_dict
)
908 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
910 input_join
= {"i1": "i1-l1-eth0", "i8": "i8-f1-eth0"}
912 for recvr
, recvr_intf
in input_join
.items():
913 result
= app_helper
.run_join(recvr
, _IGMP_JOIN_RANGE
, join_intf
=recvr_intf
)
914 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
917 "Connect one source to c2 and send multicast traffic all"
918 " the receivers (226.1.1.1-5, 232.1.1.1-5)"
921 "Send multicast traffic from FRR3 to all the receivers "
922 "(226.1.1.1-5, 232.1.1.1-5)"
925 input_src
= {"i2": "i2-f1-eth0", "i5": "i5-c2-eth0"}
927 for src
, src_intf
in input_src
.items():
928 result
= app_helper
.run_traffic(src
, _IGMP_JOIN_RANGE
, bind_intf
=src_intf
)
929 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
932 "FRR3 (S,G) has one OIL for local receiver one toward c2"
933 " verify 'show ip mroute' and 'show ip pim upstream'"
936 source
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
938 {"dut": "f1", "src_address": "*", "iif": "f1-c2-eth0", "oil": "f1-i8-eth2"},
939 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "f1-i8-eth2"},
941 for data
in input_dict
:
942 result
= verify_ip_mroutes(
950 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
952 for data
in input_dict
:
953 result
= verify_upstream_iif(
954 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_2
956 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
958 step("Shut and No shut interface connected from FHR (FRR3)" " to c2")
961 shutdown_bringup_interface(tgen
, dut
, intf
, False)
962 shutdown_bringup_interface(tgen
, dut
, intf
, True)
964 step("Shut and No shut interface connected from LHR (FRR1)" " to c1")
967 shutdown_bringup_interface(tgen
, dut
, intf
, False)
968 shutdown_bringup_interface(tgen
, dut
, intf
, True)
970 for data
in input_dict
:
971 result
= verify_ip_mroutes(
979 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
981 step("Shut and No shut FRR1 and FRR3 interface")
982 shutdown_bringup_interface(tgen
, "l1", "l1-r2-eth4", False)
983 shutdown_bringup_interface(tgen
, dut
, intf
, True)
985 shutdown_bringup_interface(tgen
, "f1", "f1-r2-eth3", False)
986 shutdown_bringup_interface(tgen
, dut
, intf
, True)
989 "After shut/no shut of interface , verify traffic resume to all"
990 "the receivers (S,G) OIL update for all the receivers"
993 for data
in input_dict
:
994 result
= verify_ip_mroutes(
1002 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1005 "Shut FRR1, FRR3 interface , clear mroute in FRR1"
1006 " and No shut FRR1, FRR3 interface "
1010 shutdown_bringup_interface(tgen
, dut
, intf
, False)
1014 shutdown_bringup_interface(tgen
, dut
, intf
, False)
1018 shutdown_bringup_interface(tgen
, dut
, intf
, True)
1022 shutdown_bringup_interface(tgen
, dut
, intf
, True)
1024 clear_ip_mroute(tgen
, "l1")
1025 clear_ip_mroute(tgen
, "l1")
1028 "After no shut, verify traffic resume to all the receivers"
1029 " (S,G) OIL update for all the receivers"
1032 for data
in input_dict
:
1033 result
= verify_ip_mroutes(
1036 data
["src_address"],
1041 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1044 "Shut and no shut upstream interface from FRR1 to FRR2 and "
1045 "cisco immediate after mroute/upstream got cleared"
1049 intf_l1_r2
= "l1-r2-eth4"
1050 shutdown_bringup_interface(tgen
, dut
, intf_l1_r2
, False)
1052 intf_l1_c1
= "l1-c1-eth0"
1053 shutdown_bringup_interface(tgen
, dut
, intf_l1_c1
, False)
1055 result
= verify_upstream_iif(
1056 tgen
, "l1", "Unknown", source
, IGMP_JOIN_RANGE_2
, expected
=False
1058 assert result
is not True, (
1059 "Testcase {} : Failed Error: \n "
1060 "mroutes are still present, after waiting for 10 mins".format(tc_name
)
1063 step("No shut the Source interface just after the upstream is expired" " from FRR1")
1064 shutdown_bringup_interface(tgen
, dut
, intf_l1_r2
, True)
1065 shutdown_bringup_interface(tgen
, dut
, intf_l1_c1
, True)
1067 for data
in input_dict
:
1068 result
= verify_ip_mroutes(
1071 data
["src_address"],
1076 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1078 step("Stop the traffic to all the receivers")
1079 app_helper
.stop_all_hosts()
1081 for data
in input_dict
:
1082 result
= verify_ip_mroutes(
1085 data
["src_address"],
1093 ), "Testcase {} : Failed \n mroutes are still present \n Error: {}".format(
1096 logger
.info("Expected Behavior: {}".format(result
))
1098 write_test_footer(tc_name
)
1101 def test_verify_mroute_when_receiver_is_outside_frr_p0(request
):
1103 TC_7: Verify mroute detail when receiver is present
1107 tgen
= get_topogen()
1108 tc_name
= request
.node
.name
1109 write_test_header(tc_name
)
1111 # Don"t run this test if we have any failure.
1112 if tgen
.routers_have_failure():
1113 pytest
.skip(tgen
.errors
)
1115 # Creating configuration from JSON
1116 app_helper
.stop_all_hosts()
1117 clear_ip_mroute(tgen
)
1118 reset_config_on_routers(tgen
)
1119 clear_ip_pim_interface_traffic(tgen
, topo
)
1121 step("Configure static RP on c1 for group range " "(226.1.1.1-5) and (232.1.1.1-5)")
1123 _GROUP_RANGE
= GROUP_RANGE_2
+ GROUP_RANGE_3
1124 _IGMP_JOIN_RANGE
= IGMP_JOIN_RANGE_2
+ IGMP_JOIN_RANGE_3
1131 "rp_addr": topo
["routers"]["c1"]["links"]["lo"]["ipv4"].split(
1134 "group_addr_range": _GROUP_RANGE
,
1141 result
= create_pim_config(tgen
, topo
, input_dict
)
1142 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1145 "Enable IGMP on FRR1 interface and send IGMP join"
1146 " (226.1.1.1-5) and (232.1.1.1-5)"
1148 result
= app_helper
.run_join("i1", _IGMP_JOIN_RANGE
, "l1")
1149 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1152 "Send multicast traffic from FRR3 to all the receivers "
1153 "(226.1.1.1-5) and (232.1.1.1-5)"
1155 result
= app_helper
.run_traffic("i2", _IGMP_JOIN_RANGE
, "f1")
1156 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1159 "Configure one more receiver in c2 enable IGMP and send"
1160 " join (226.1.1.1-5) and (232.1.1.1-5)"
1167 "igmp": {"version": "2", "query": {"query-interval": 15}}
1173 result
= create_igmp_config(tgen
, topo
, input_dict
)
1174 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1176 result
= app_helper
.run_join("i5", _IGMP_JOIN_RANGE
, "c2")
1177 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1179 step("FRR1 has 10 (*.G) and 10 (S,G) verify using 'show ip mroute count'")
1181 "All the receiver are receiving traffic on FRR1 and (S,G) OIL is toward"
1182 "receivers, verify using 'show ip mroute' 'show ip pim upstream'"
1185 "All the receiver are receiving traffic on c2 and (S,G) OIL is "
1186 "toward receivers, verify using 'show ip mroute' 'show ip pim upstream'"
1189 source
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
1191 {"dut": "l1", "src_address": "*", "iif": "l1-c1-eth0", "oil": "l1-i1-eth1"},
1192 {"dut": "l1", "src_address": source
, "iif": "l1-r2-eth4", "oil": "l1-i1-eth1"},
1193 {"dut": "c2", "src_address": "*", "iif": "c2-c1-eth0", "oil": "c2-i5-eth2"},
1194 {"dut": "c2", "src_address": source
, "iif": "c2-f1-eth1", "oil": "c2-i5-eth2"},
1196 for data
in input_dict
:
1197 result
= verify_ip_mroutes(
1200 data
["src_address"],
1205 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1208 "FRR3 has (S,G) OIL created toward c1/c2 receiver and FRR1 receiver"
1209 "'show ip pim state'"
1212 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "f1-c2-eth0"},
1213 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "f1-r2-eth3"},
1215 for data
in input_dict
:
1216 result
= verify_pim_state(
1222 data
["src_address"],
1224 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1226 for data
in input_dict
:
1227 result
= verify_upstream_iif(
1228 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
1230 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1232 write_test_footer(tc_name
)
1235 def test_verify_mroute_when_FRR_is_FHR_and_LHR_p0(request
):
1237 TC_8: Verify mroute when FRR is acting as FHR and LHR
1240 tgen
= get_topogen()
1241 tc_name
= request
.node
.name
1242 write_test_header(tc_name
)
1244 # Don"t run this test if we have any failure.
1245 if tgen
.routers_have_failure():
1246 pytest
.skip(tgen
.errors
)
1248 # Creating configuration from JSON
1249 app_helper
.stop_all_hosts()
1250 clear_ip_mroute(tgen
)
1251 reset_config_on_routers(tgen
)
1252 clear_ip_pim_interface_traffic(tgen
, topo
)
1254 step("Configure static RP for group range (226.1.1.1-5) and " "(232.1.1.1-5) on c1")
1255 _GROUP_RANGE
= GROUP_RANGE_2
+ GROUP_RANGE_3
1256 _IGMP_JOIN_RANGE
= IGMP_JOIN_RANGE_2
+ IGMP_JOIN_RANGE_3
1263 "rp_addr": topo
["routers"]["c1"]["links"]["lo"]["ipv4"].split(
1266 "group_addr_range": _GROUP_RANGE
,
1273 result
= create_pim_config(tgen
, topo
, input_dict
)
1274 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1277 "Enable IGMP on FRR1 interface and send IGMP join (226.1.1.1-5)"
1278 " and (232.1.1.1-5)"
1281 "Configure receiver on FRR3 with igmp and pim enabled and "
1282 "send IGMP join (226.1.1.1-5) and (232.1.1.1-5)"
1285 "Send multicast traffic from FRR3 to all the receivers "
1286 "(226.1.1.1-5) and (232.1.1.1-5)"
1289 step("Send IGMP join (226.1.1.1-5, 232.1.1.1-5) to LHR(l1)")
1290 result
= app_helper
.run_join("i1", _IGMP_JOIN_RANGE
, "l1")
1291 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1293 step("Send multicast traffic from FRR3 to '226.1.1.1-5'" ", '232.1.1.1-5' receiver")
1294 result
= app_helper
.run_traffic("i2", _IGMP_JOIN_RANGE
, "f1")
1295 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1298 "Configure receiver in f1 enable IGMP and send"
1299 " join (226.1.1.1-5) and (232.1.1.1-5)"
1302 step("Configure one IGMP interface on f1 node and send IGMP" " join (225.1.1.1)")
1308 "igmp": {"version": "2", "query": {"query-interval": 15}}
1314 result
= create_igmp_config(tgen
, topo
, input_dict
)
1315 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1317 result
= app_helper
.run_join("i8", _IGMP_JOIN_RANGE
, "f1")
1318 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1320 "l1 and f1 has 10 IGMP groups (226.1.1.1-5, 232.1.1.1-5),"
1321 " verify using 'show ip igmp groups'"
1324 interface
= "l1-i1-eth1"
1325 result
= verify_igmp_groups(tgen
, dut
, interface
, _IGMP_JOIN_RANGE
)
1326 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1329 interface
= "f1-i8-eth2"
1330 result
= verify_igmp_groups(tgen
, dut
, interface
, _IGMP_JOIN_RANGE
)
1331 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1334 "l1 , f1 has 10 (*,G) and 10 (S,G) for groups "
1335 "(226.1.1.1-5, 232.1.1.1-5), verify using "
1339 source
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
1341 {"dut": "f1", "src_address": "*", "iif": "f1-c2-eth0", "oil": "f1-i8-eth2"},
1342 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "f1-r2-eth3"},
1343 {"dut": "l1", "src_address": "*", "iif": "l1-c1-eth0", "oil": "l1-i1-eth1"},
1344 {"dut": "l1", "src_address": source
, "iif": "l1-r2-eth4", "oil": "l1-i1-eth1"},
1346 for data
in input_dict
:
1347 result
= verify_ip_mroutes(
1350 data
["src_address"],
1355 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1357 step("Join timer is running in FHR and LHR , verify using" " 'show ip pim state'")
1359 for data
in input_dict
:
1360 result
= verify_pim_state(
1366 data
["src_address"],
1368 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1370 # Stop the multicast traffic
1371 step("Stop the traffic to all the receivers")
1372 app_helper
.stop_all_hosts()
1375 "After traffic stopped , verify (*,G) entries are not flushed"
1376 " out from FRR1 node verify using 'show ip mroute' "
1380 {"dut": "f1", "src_address": "*", "iif": "f1-c2-eth0", "oil": "f1-i8-eth2"},
1381 {"dut": "l1", "src_address": "*", "iif": "l1-c1-eth0", "oil": "l1-i1-eth1"},
1383 for data
in input_dict
:
1384 result
= verify_ip_mroutes(
1387 data
["src_address"],
1394 ), "Testcase {} : Failed Error mroutes were flushed.".format(tc_name
)
1397 "After traffic stopped , verify (S,G) entries are flushed out"
1398 " from FRR1 node verify using 'show ip mroute' "
1402 {"dut": "l1", "src_address": source
, "iif": "l1-r2-eth4", "oil": "l1-i1-eth1"},
1403 {"dut": "f1", "src_address": source
, "iif": "i2-f1-eth0", "oil": "f1-r2-eth3"},
1406 for data
in input_dict
:
1407 result
= verify_ip_mroutes(
1410 data
["src_address"],
1418 ), "Testcase {} : Failed Error: \nmroutes are still present".format(tc_name
)
1420 write_test_footer(tc_name
)
1423 def test_verify_mroute_when_5_different_receiver_joining_same_sources_p0(request
):
1425 TC_20: Verify mroute detail when 5 different receiver joining
1429 tgen
= get_topogen()
1430 tc_name
= request
.node
.name
1431 write_test_header(tc_name
)
1433 # Don"t run this test if we have any failure.
1434 if tgen
.routers_have_failure():
1435 pytest
.skip(tgen
.errors
)
1437 # Creating configuration from JSON
1438 app_helper
.stop_all_hosts()
1439 clear_ip_mroute(tgen
)
1440 reset_config_on_routers(tgen
)
1441 clear_ip_pim_interface_traffic(tgen
, topo
)
1443 step("Configure static RP for (226.1.1.1-5) in c1")
1444 step("Configure static RP for (232.1.1.1-5) in c2")
1446 _GROUP_RANGE
= GROUP_RANGE_2
+ GROUP_RANGE_3
1447 _IGMP_JOIN_RANGE
= IGMP_JOIN_RANGE_2
+ IGMP_JOIN_RANGE_3
1454 "rp_addr": topo
["routers"]["c1"]["links"]["lo"]["ipv4"].split(
1457 "group_addr_range": GROUP_RANGE_2
,
1466 "rp_addr": topo
["routers"]["c2"]["links"]["lo"]["ipv4"].split(
1469 "group_addr_range": GROUP_RANGE_3
,
1476 result
= create_pim_config(tgen
, topo
, input_dict
)
1477 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1480 "Configure 2 IGMP interface on FRR1 and send IGMP join"
1481 "for group (226.1.1.1-5, 232.1.1.1-5) from both the interface"
1484 "Configure 2 IGMP interface on FRR3 and send IGMP join for"
1485 " group (226.1.1.1-5, 232.1.1.1-5) from both the interface"
1488 "Configure 1 IGMP interface on c2 and send IGMP join for"
1489 "group (226.1.1.1-5, 232.1.1.1-5)"
1497 "igmp": {"version": "2", "query": {"query-interval": 15}}
1500 "igmp": {"version": "2", "query": {"query-interval": 15}}
1509 "igmp": {"version": "2", "query": {"query-interval": 15}}
1515 result
= create_igmp_config(tgen
, topo
, input_dict
)
1516 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1525 for recvr
, recvr_intf
in input_join
.items():
1526 result
= app_helper
.run_join(recvr
, _IGMP_JOIN_RANGE
, join_intf
=recvr_intf
)
1527 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1529 step("Configure one source in FRR2 , one in c1")
1531 "Send multicast traffic from both the sources to all the"
1532 "receivers (226.1.1.1-5, 232.1.1.1-5)"
1535 input_src
= {"i3": "i3-r2-eth0"}
1537 for src
, src_intf
in input_src
.items():
1538 result
= app_helper
.run_traffic(src
, _IGMP_JOIN_RANGE
, bind_intf
=src_intf
)
1539 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1541 "After all the IGMP groups received with correct port using"
1542 " 'show ip igmp groups' in FRR1, FRR3, c2"
1545 interface
= "l1-i6-eth2"
1546 result
= verify_igmp_groups(tgen
, dut
, interface
, _IGMP_JOIN_RANGE
)
1547 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1550 interface
= "f1-i8-eth2"
1551 result
= verify_igmp_groups(tgen
, dut
, interface
, _IGMP_JOIN_RANGE
)
1552 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1555 "(*,G) entries got created with upstream interface RP connected"
1556 " port using 'show ip pim upstream' in FRR1, FRR3, c2"
1559 "(S,G) entries created for all the receiver after starting the"
1560 " source , traffic is reaching to all the receiver , verify OIL"
1561 " of (S,G) is receiver port using 'show ip mroute' in FRR1, "
1565 source
= topo
["routers"]["i3"]["links"]["r2"]["ipv4"].split("/")[0]
1569 "src_address": source
,
1570 "iif": ["l1-r2-eth4", "l1-c1-eth0"],
1571 "oil": ["l1-i1-eth1", "l1-i6-eth2"],
1573 {"dut": "f1", "src_address": source
, "iif": "f1-r2-eth3", "oil": "f1-i8-eth2"},
1575 for data
in input_dict_all
:
1576 result
= verify_ip_mroutes(
1579 data
["src_address"],
1584 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1586 for data
in input_dict_all
:
1587 result
= verify_upstream_iif(
1588 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
1590 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1592 step("Shut the receiver interface one by one on FRR1 node")
1593 shutdown_bringup_interface(tgen
, "l1", "l1-i1-eth1", False)
1594 shutdown_bringup_interface(tgen
, "l1", "l1-i6-eth2", False)
1597 "After shut the receiver port verify traffic is stopped immediately"
1598 " and (S,G) got timeout immediately in FRR1, FRR3, c2"
1601 {"dut": "l1", "src_address": source
, "iif": "l1-r2-eth4", "oil": "l1-i1-eth1"}
1603 for data
in input_dict
:
1604 result
= verify_ip_mroutes(
1607 data
["src_address"],
1615 ), "Testcase {} : Failed \n mroutes are still present \n Error: {}".format(
1618 logger
.info("Expected Behavior: {}".format(result
))
1621 "No traffic impact observed on other receivers verify using"
1622 " 'show ip mroute' "
1625 {"dut": "f1", "src_address": source
, "iif": "f1-r2-eth3", "oil": "f1-i8-eth2"}
1627 for data
in input_dict
:
1628 result
= verify_ip_mroutes(
1631 data
["src_address"],
1636 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1638 step("No shut the receiver interface one by one on FRR1 node")
1639 shutdown_bringup_interface(tgen
, "l1", "l1-i1-eth1", True)
1640 shutdown_bringup_interface(tgen
, "l1", "l1-i6-eth2", True)
1643 "After no shut of receivers all the mroute entries got populated"
1644 ", no duplicate entries present in mroute"
1647 for data
in input_dict_all
:
1648 result
= verify_ip_mroutes(
1651 data
["src_address"],
1656 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1658 write_test_footer(tc_name
)
1661 def test_verify_oil_iif_for_mroute_after_shut_noshut_source_interface_p1(request
):
1663 TC_22: Verify OIL and IIF detail updated in (S,G) mroute after shut
1664 and no shut of the source interface
1667 tgen
= get_topogen()
1668 tc_name
= request
.node
.name
1669 write_test_header(tc_name
)
1671 # Don"t run this test if we have any failure.
1672 if tgen
.routers_have_failure():
1673 pytest
.skip(tgen
.errors
)
1675 # Creating configuration from JSON
1676 app_helper
.stop_all_hosts()
1677 clear_ip_mroute(tgen
)
1678 reset_config_on_routers(tgen
)
1679 clear_ip_pim_interface_traffic(tgen
, topo
)
1681 step("Configure static RP for (226.1.1.1-5) in c1")
1682 step("Configure static RP for (232.1.1.1-5) in c2")
1684 _GROUP_RANGE
= GROUP_RANGE_2
+ GROUP_RANGE_3
1685 _IGMP_JOIN_RANGE
= IGMP_JOIN_RANGE_2
+ IGMP_JOIN_RANGE_3
1692 "rp_addr": topo
["routers"]["c1"]["links"]["lo"]["ipv4"].split(
1695 "group_addr_range": GROUP_RANGE_2
,
1704 "rp_addr": topo
["routers"]["c2"]["links"]["lo"]["ipv4"].split(
1707 "group_addr_range": GROUP_RANGE_3
,
1714 result
= create_pim_config(tgen
, topo
, input_dict
)
1715 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1718 "Configure IGMP interface on FRR1 and FRR3 and send IGMP join"
1719 " for group (226.1.1.1-5, 232.1.1.1-5)"
1727 "igmp": {"version": "2", "query": {"query-interval": 15}}
1733 result
= create_igmp_config(tgen
, topo
, input_dict
)
1734 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1736 input_join
= {"i1": "i1-l1-eth0", "i8": "i8-f1-eth0"}
1738 for recvr
, recvr_intf
in input_join
.items():
1739 result
= app_helper
.run_join(recvr
, _IGMP_JOIN_RANGE
, join_intf
=recvr_intf
)
1740 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1742 step("Configure 1 source in FRR1 , 1 in FRR3")
1744 "Send multicast traffic from both the sources to all the "
1745 "receivers (226.1.1.1-5, 232.1.1.1-5)"
1748 input_src
= {"i6": "i6-l1-eth0", "i2": "i2-f1-eth0"}
1750 for src
, src_intf
in input_src
.items():
1751 result
= app_helper
.run_traffic(src
, _IGMP_JOIN_RANGE
, bind_intf
=src_intf
)
1752 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1755 "*,G) is created and (S,G) created on FRR1 and FRR3 for both"
1756 " the source verify using 'show ip mroute' and "
1757 " 'show ip pim upstream' to check the upstream interface"
1761 source_i6
= topo
["routers"]["i6"]["links"]["l1"]["ipv4"].split("/")[0]
1762 source_i2
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
1764 {"dut": "l1", "src_address": "*", "iif": "l1-c1-eth0", "oil": "l1-i1-eth1"},
1767 "src_address": source_i2
,
1768 "iif": "l1-r2-eth4",
1769 "oil": "l1-i1-eth1",
1773 "src_address": source_i6
,
1774 "iif": "l1-i6-eth2",
1775 "oil": "l1-i1-eth1",
1777 {"dut": "f1", "src_address": "*", "iif": "f1-c2-eth0", "oil": "f1-i8-eth2"},
1780 "src_address": source_i2
,
1781 "iif": "f1-i2-eth1",
1782 "oil": "f1-i8-eth2",
1786 "src_address": source_i6
,
1787 "iif": "f1-r2-eth3",
1788 "oil": "f1-i8-eth2",
1791 for data
in input_dict_all
:
1792 result
= verify_ip_mroutes(
1795 data
["src_address"],
1800 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1802 for data
in input_dict_all
:
1803 result
= verify_upstream_iif(
1804 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
1806 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1808 step("Shut the source interface one by one on FRR1")
1809 shutdown_bringup_interface(tgen
, "f1", "f1-i2-eth1", False)
1812 "After shut of ource interface from FRR3 verify all the (S,G) "
1813 "entries flushed out from FRR3 node 'show ip pim upstream' "
1814 " 'show ip mroute' "
1817 result
= verify_ip_mroutes(
1828 ), "Testcase {} : Failed \n mroutes are" " still present \n Error: {}".format(
1831 logger
.info("Expected Behavior: {}".format(result
))
1833 result
= verify_upstream_iif(
1834 tgen
, "f1", "Unknown", "10.0.5.2", _IGMP_JOIN_RANGE
, joinState
="NotJoined"
1836 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1838 write_test_footer(tc_name
)
1841 if __name__
== "__main__":
1842 args
= ["-s"] + sys
.argv
[1:]
1843 sys
.exit(pytest
.main(args
))