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_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 version should be >= 4.19")
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 # Starting topology, create tmp files which are loaded to routers
176 # to start daemons and then start routers
179 # Don"t run this test if we have any failure.
180 if tgen
.routers_have_failure():
181 pytest
.skip(tgen
.errors
)
183 # Creating configuration from JSON
184 build_config_from_json(tgen
, topo
)
186 # XXX Replace this using "with McastTesterHelper()... " in each test if possible.
188 app_helper
= McastTesterHelper(tgen
)
190 logger
.info("Running setup_module() done")
193 def teardown_module():
194 """Teardown the pytest environment"""
196 logger
.info("Running teardown_module to delete topology")
202 # Stop toplogy and Remove tmp files
206 "Testsuite end time: {}".format(time
.asctime(time
.localtime(time
.time())))
208 logger
.info("=" * 40)
211 #####################################################
215 #####################################################
218 def verify_state_incremented(state_before
, state_after
):
220 API to compare interface traffic state incrementing
224 * `state_before` : State dictionary for any particular instance
225 * `state_after` : State dictionary for any particular instance
228 for router
, state_data
in state_before
.items():
229 for state
, value
in state_data
.items():
230 if state_before
[router
][state
] >= state_after
[router
][state
]:
232 "[DUT: %s]: state %s value has not"
233 " incremented, Initial value: %s, "
234 "Current value: %s [FAILED!!]"
238 state_before
[router
][state
],
239 state_after
[router
][state
],
245 "[DUT: %s]: State %s value is "
246 "incremented, Initial value: %s, Current value: %s"
250 state_before
[router
][state
],
251 state_after
[router
][state
],
257 def test_verify_mroute_and_traffic_when_pimd_restarted_p2(request
):
259 TC_17: Verify (*,G) and (S,G) present and multicast traffic resume,
260 after restart of PIMd daemon
264 tc_name
= request
.node
.name
265 write_test_header(tc_name
)
267 # Don"t run this test if we have any failure.
268 if tgen
.routers_have_failure():
269 pytest
.skip(tgen
.errors
)
271 # Creating configuration from JSON
272 app_helper
.stop_all_hosts()
274 reset_config_on_routers(tgen
)
275 clear_pim_interface_traffic(tgen
, topo
)
277 step("Configure static RP for (226.1.1.1-5) in c1")
278 step("Configure static RP for (232.1.1.1-5) in c2")
280 _GROUP_RANGE
= GROUP_RANGE_2
+ GROUP_RANGE_3
281 _IGMP_JOIN_RANGE
= IGMP_JOIN_RANGE_2
+ IGMP_JOIN_RANGE_3
288 "rp_addr": topo
["routers"]["c1"]["links"]["lo"]["ipv4"].split(
291 "group_addr_range": GROUP_RANGE_2
,
300 "rp_addr": topo
["routers"]["c2"]["links"]["lo"]["ipv4"].split(
303 "group_addr_range": GROUP_RANGE_3
,
310 result
= create_pim_config(tgen
, topo
, input_dict
)
311 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
314 "Enable IGMP on FRR1 interface and send IGMP join "
315 "(226.1.1.1-5) and (232.1.1.1-5)"
318 "Configure IGMP interface on FRR3 and send IGMP join"
319 " for group (226.1.1.1-5, 232.1.1.1-5)"
327 "igmp": {"version": "2", "query": {"query-interval": 15}}
333 result
= create_igmp_config(tgen
, topo
, input_dict
)
334 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
336 input_join
= {"i1": "i1-l1-eth0", "i8": "i8-f1-eth0"}
338 for recvr
, recvr_intf
in input_join
.items():
339 result
= app_helper
.run_join(recvr
, _IGMP_JOIN_RANGE
, join_intf
=recvr_intf
)
340 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
343 "Connect one source to c2 and send multicast traffic all"
344 " the receivers (226.1.1.1-5, 232.1.1.1-5)"
347 "Send multicast traffic from FRR3 to all the receivers "
348 "(226.1.1.1-5, 232.1.1.1-5)"
351 input_src
= {"i2": "i2-f1-eth0", "i5": "i5-c2-eth0"}
353 for src
, src_intf
in input_src
.items():
354 result
= app_helper
.run_traffic(src
, _IGMP_JOIN_RANGE
, bind_intf
=src_intf
)
355 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
357 # Verifying mroutes before PIMd restart, fetching uptime
359 source
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
361 {"dut": "f1", "src_address": "*", "iif": "f1-c2-eth0", "oil": "f1-i8-eth2"},
362 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "f1-i8-eth2"},
364 for data
in input_dict
:
365 result
= verify_mroutes(
373 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
375 for data
in input_dict
:
376 result
= verify_upstream_iif(
377 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
379 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
381 step("Restart Pimd process on FRR3 node")
382 kill_router_daemons(tgen
, "f1", ["pimd"])
383 start_router_daemons(tgen
, "f1", ["pimd"])
385 for data
in input_dict
:
386 result
= verify_mroutes(
394 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
397 "After restart of PIMd verify pim nbr is up , IGMP groups"
398 " received , and (*,G) (S,G) entries populated again ,"
399 " Verify using 'show ip pim neighbor' , 'show ip igmp groups'"
403 result
= verify_pim_neighbors(tgen
, topo
)
404 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
407 interface
= "f1-i8-eth2"
408 result
= verify_igmp_groups(tgen
, dut
, interface
, _IGMP_JOIN_RANGE
)
409 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
411 for data
in input_dict
:
412 result
= verify_upstream_iif(
413 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
415 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
417 step("Stop the traffic and restart PIMd immediately on FRR3 node")
420 shutdown_bringup_interface(tgen
, dut
, intf
, False)
422 kill_router_daemons(tgen
, "f1", ["pimd"])
423 start_router_daemons(tgen
, "f1", ["pimd"])
426 "After PIM process come , all the none of (S,G) mroute should"
427 " present on FRR3 'show ip mroute' "
431 {"dut": "f1", "src_address": "*", "iif": "f1-c2-eth0", "oil": "f1-i8-eth2"}
433 for data
in input_dict
:
434 result
= verify_mroutes(
442 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
445 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "none"}
447 for data
in input_dict
:
448 result
= verify_mroutes(
457 assert result
is not True, (
458 "Testcase {} : Failed \n "
459 "Expected: [{}]: mroute (S, G) should not be present in mroute table \n "
460 "Found: {}".format(tc_name
, data
["dut"], result
)
463 write_test_footer(tc_name
)
466 def test_verify_mroute_and_traffic_when_frr_restarted_p2(request
):
468 TC_18: Verify (*,G) and (S,G) present and multicast traffic resume after
469 FRR service stop and start
473 tc_name
= request
.node
.name
474 write_test_header(tc_name
)
476 # Don"t run this test if we have any failure.
477 if tgen
.routers_have_failure():
478 pytest
.skip(tgen
.errors
)
480 # Creating configuration from JSON
481 app_helper
.stop_all_hosts()
483 reset_config_on_routers(tgen
)
484 clear_pim_interface_traffic(tgen
, topo
)
486 step("Configure static RP for (226.1.1.1-5) in c1")
487 step("Configure static RP for (232.1.1.1-5) in c2")
489 _GROUP_RANGE
= GROUP_RANGE_2
+ GROUP_RANGE_3
490 _IGMP_JOIN_RANGE
= IGMP_JOIN_RANGE_2
+ IGMP_JOIN_RANGE_3
497 "rp_addr": topo
["routers"]["c1"]["links"]["lo"]["ipv4"].split(
500 "group_addr_range": GROUP_RANGE_2
,
509 "rp_addr": topo
["routers"]["c2"]["links"]["lo"]["ipv4"].split(
512 "group_addr_range": GROUP_RANGE_3
,
519 result
= create_pim_config(tgen
, topo
, input_dict
)
520 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
523 "Enable IGMP on FRR1 interface and send IGMP join "
524 "(226.1.1.1-5) and (232.1.1.1-5)"
527 "Configure IGMP interface on FRR3 and send IGMP join"
528 " for group (226.1.1.1-5, 232.1.1.1-5)"
536 "igmp": {"version": "2", "query": {"query-interval": 15}}
542 result
= create_igmp_config(tgen
, topo
, input_dict
)
543 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
545 input_join
= {"i1": "i1-l1-eth0", "i8": "i8-f1-eth0"}
547 for recvr
, recvr_intf
in input_join
.items():
548 result
= app_helper
.run_join(recvr
, _IGMP_JOIN_RANGE
, join_intf
=recvr_intf
)
549 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
552 "Connect one source to c2 and send multicast traffic all"
553 " the receivers (226.1.1.1-5, 232.1.1.1-5)"
556 "Send multicast traffic from FRR3 to all the receivers "
557 "(226.1.1.1-5, 232.1.1.1-5)"
560 input_src
= {"i2": "i2-f1-eth0", "i5": "i5-c2-eth0"}
562 for src
, src_intf
in input_src
.items():
563 result
= app_helper
.run_traffic(src
, _IGMP_JOIN_RANGE
, bind_intf
=src_intf
)
564 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
566 step("Verifying mroutes before FRR restart, fetching uptime")
568 source
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
570 {"dut": "f1", "src_address": "*", "iif": "f1-c2-eth0", "oil": "f1-i8-eth2"},
571 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "f1-i8-eth2"},
573 for data
in input_dict
:
574 result
= verify_mroutes(
582 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
584 for data
in input_dict
:
585 result
= verify_upstream_iif(
586 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
588 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
590 step("Stop and Start the FRR services on FRR3 node")
591 stop_router(tgen
, "f1")
592 start_router(tgen
, "f1")
594 for data
in input_dict
:
595 result
= verify_mroutes(
603 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
606 "After stop and start of FRR service verify pim nbr is up "
607 "IGMP groups received , and (*,G) (S,G) entries populated again"
608 " Verify using 'show ip pim neighbor' , 'show ip igmp groups'"
612 result
= verify_pim_neighbors(tgen
, topo
)
613 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
616 interface
= "f1-i8-eth2"
617 result
= verify_igmp_groups(tgen
, dut
, interface
, _IGMP_JOIN_RANGE
)
618 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
620 for data
in input_dict
:
621 result
= verify_upstream_iif(
622 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
624 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
626 step("Stop the traffic and stop and start the FRR services on" " FRR3 node")
627 shutdown_bringup_interface(tgen
, "i2", "i2-f1-eth0", False)
629 stop_router(tgen
, "f1")
630 start_router(tgen
, "f1")
633 "After stop and start of FRR services , all the none of (S,G)"
634 " mroute should present on FRR3 node verify using "
639 {"dut": "f1", "src_address": "*", "iif": "f1-c2-eth0", "oil": "f1-i8-eth2"}
641 for data
in input_dict
:
642 result
= verify_mroutes(
650 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
653 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "none"}
655 for data
in input_dict
:
656 result
= verify_mroutes(
665 assert result
is not True, (
666 "Testcase {} : Failed \n "
667 "Expected: [{}]: mroute (S, G) should not be present in mroute table \n "
668 "Found: {}".format(tc_name
, data
["dut"], result
)
671 write_test_footer(tc_name
)
674 def test_verify_SPT_switchover_when_RPT_and_SPT_path_is_different_p0(request
):
676 TC_10: Verify SPT switchover working when RPT and SPT path is
681 tc_name
= request
.node
.name
682 write_test_header(tc_name
)
684 # Don"t run this test if we have any failure.
685 if tgen
.routers_have_failure():
686 pytest
.skip(tgen
.errors
)
688 # Creating configuration from JSON
689 app_helper
.stop_all_hosts()
691 reset_config_on_routers(tgen
)
692 clear_pim_interface_traffic(tgen
, topo
)
694 step("Configure static RP for (226.1.1.1-5) and " "(232.1.1.1-5) in c2")
696 _GROUP_RANGE
= GROUP_RANGE_2
+ GROUP_RANGE_3
697 _IGMP_JOIN_RANGE
= IGMP_JOIN_RANGE_2
+ IGMP_JOIN_RANGE_3
704 "rp_addr": topo
["routers"]["c2"]["links"]["lo"]["ipv4"].split(
707 "group_addr_range": _GROUP_RANGE
,
714 result
= create_pim_config(tgen
, topo
, input_dict
)
715 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
718 "Enable IGMP on FRR1 interface and send IGMP join "
719 "(226.1.1.1-5) and (232.1.1.1-5)"
722 result
= app_helper
.run_join("i1", _IGMP_JOIN_RANGE
, "l1")
723 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
725 step("Send multicast traffic from FRR3 to '226.1.1.1-5'" ", '232.1.1.1-5' receiver")
727 step("registerRx and registerStopTx value before traffic sent")
728 state_dict
= {"c2": {"c2-f1-eth1": ["registerRx", "registerStopTx"]}}
729 state_before
= get_pim_interface_traffic(tgen
, state_dict
)
732 ), "Testcase {} : Failed \n state_before is not dictionary \nError: {}".format(
736 result
= app_helper
.run_traffic("i2", _IGMP_JOIN_RANGE
, "f1")
737 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
740 "Verify in FRR3 sending initial packet to RP using"
741 " 'show ip mroute' and mroute OIL is towards RP."
744 result
= verify_mroutes(
750 ["f1-c2-eth0", "f1-r2-eth3"],
752 assert result
is True, "Testcase {} : " "Failed Error: {}".format(tc_name
, result
)
754 result
= verify_mroutes(
755 tgen
, "f1", "10.0.5.2", _IGMP_JOIN_RANGE
, "f1-i2-eth1", "f1-r2-eth3"
757 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
760 " After spt switchover traffic is flowing between"
761 " (LHR(FRR1)-FHR(FRR3)) and (S,G) OIL is updated toward FRR1"
762 " 'show ip mroute' and 'show ip pim upstream'"
765 source
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
767 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "f1-r2-eth3"},
768 {"dut": "l1", "src_address": source
, "iif": "l1-r2-eth4", "oil": "l1-i1-eth1"},
770 for data
in input_dict
:
771 result
= verify_mroutes(
779 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
781 for data
in input_dict
:
782 result
= verify_upstream_iif(
783 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
785 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
787 step("Stop the traffic to all the receivers")
789 app_helper
.stop_host("i2")
792 "Null register packet being send periodically from FRR3 to RP, "
793 "verify using show ip mroute on RP, have (S, G) entries null OIL"
794 " 'show ip mroute' and verify show ip pim interface traffic"
795 "(In RP Register msg should be received and Register stop should"
799 {"dut": "c2", "src_address": source
, "iif": "c2-f1-eth1", "oil": "none"}
801 for data
in input_dict
:
802 result
= verify_mroutes(
810 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
812 step("registerRx and registerStopTx value after traffic sent")
813 state_after
= get_pim_interface_traffic(tgen
, state_dict
)
816 ), "Testcase {} : Failed \n state_before is not dictionary \nError: {}".format(
820 result
= verify_state_incremented(state_before
, state_after
)
821 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
823 write_test_footer(tc_name
)
826 def test_verify_mroute_after_shut_noshut_of_upstream_interface_p1(request
):
828 TC_15: Verify (S,G) and (*,G) mroute after shut / no shut of upstream
833 tc_name
= request
.node
.name
834 write_test_header(tc_name
)
836 # Don"t run this test if we have any failure.
837 if tgen
.routers_have_failure():
838 pytest
.skip(tgen
.errors
)
840 # Creating configuration from JSON
841 app_helper
.stop_all_hosts()
843 reset_config_on_routers(tgen
)
844 clear_pim_interface_traffic(tgen
, topo
)
846 step("Configure static RP for (226.1.1.1-5) in c1")
847 step("Configure static RP for (232.1.1.1-5) in c2")
849 _GROUP_RANGE
= GROUP_RANGE_2
+ GROUP_RANGE_3
850 _IGMP_JOIN_RANGE
= IGMP_JOIN_RANGE_2
+ IGMP_JOIN_RANGE_3
857 "rp_addr": topo
["routers"]["c1"]["links"]["lo"]["ipv4"].split(
860 "group_addr_range": GROUP_RANGE_2
,
869 "rp_addr": topo
["routers"]["c2"]["links"]["lo"]["ipv4"].split(
872 "group_addr_range": GROUP_RANGE_3
,
879 result
= create_pim_config(tgen
, topo
, input_dict
)
880 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
883 "Enable IGMP on FRR1 interface and send IGMP join "
884 "(226.1.1.1-5) and (232.1.1.1-5)"
887 "Configure IGMP interface on FRR3 and send IGMP join"
888 " for group (226.1.1.1-5, 232.1.1.1-5)"
896 "igmp": {"version": "2", "query": {"query-interval": 15}}
902 result
= create_igmp_config(tgen
, topo
, input_dict
)
903 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
905 input_join
= {"i1": "i1-l1-eth0", "i8": "i8-f1-eth0"}
907 for recvr
, recvr_intf
in input_join
.items():
908 result
= app_helper
.run_join(recvr
, _IGMP_JOIN_RANGE
, join_intf
=recvr_intf
)
909 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
912 "Connect one source to c2 and send multicast traffic all"
913 " the receivers (226.1.1.1-5, 232.1.1.1-5)"
916 "Send multicast traffic from FRR3 to all the receivers "
917 "(226.1.1.1-5, 232.1.1.1-5)"
920 input_src
= {"i2": "i2-f1-eth0", "i5": "i5-c2-eth0"}
922 for src
, src_intf
in input_src
.items():
923 result
= app_helper
.run_traffic(src
, _IGMP_JOIN_RANGE
, bind_intf
=src_intf
)
924 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
927 "FRR3 (S,G) has one OIL for local receiver one toward c2"
928 " verify 'show ip mroute' and 'show ip pim upstream'"
931 source
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
933 {"dut": "f1", "src_address": "*", "iif": "f1-c2-eth0", "oil": "f1-i8-eth2"},
934 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "f1-i8-eth2"},
936 for data
in input_dict
:
937 result
= verify_mroutes(
945 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
947 for data
in input_dict
:
948 result
= verify_upstream_iif(
949 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_2
951 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
953 step("Shut and No shut interface connected from FHR (FRR3)" " to c2")
956 shutdown_bringup_interface(tgen
, dut
, intf
, False)
957 shutdown_bringup_interface(tgen
, dut
, intf
, True)
959 step("Shut and No shut interface connected from LHR (FRR1)" " to c1")
962 shutdown_bringup_interface(tgen
, dut
, intf
, False)
963 shutdown_bringup_interface(tgen
, dut
, intf
, True)
965 for data
in input_dict
:
966 result
= verify_mroutes(
974 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
976 step("Shut and No shut FRR1 and FRR3 interface")
977 shutdown_bringup_interface(tgen
, "l1", "l1-r2-eth4", False)
978 shutdown_bringup_interface(tgen
, dut
, intf
, True)
980 shutdown_bringup_interface(tgen
, "f1", "f1-r2-eth3", False)
981 shutdown_bringup_interface(tgen
, dut
, intf
, True)
984 "After shut/no shut of interface , verify traffic resume to all"
985 "the receivers (S,G) OIL update for all the receivers"
988 for data
in input_dict
:
989 result
= verify_mroutes(
997 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1000 "Shut FRR1, FRR3 interface , clear mroute in FRR1"
1001 " and No shut FRR1, FRR3 interface "
1005 shutdown_bringup_interface(tgen
, dut
, intf
, False)
1009 shutdown_bringup_interface(tgen
, dut
, intf
, False)
1013 shutdown_bringup_interface(tgen
, dut
, intf
, True)
1017 shutdown_bringup_interface(tgen
, dut
, intf
, True)
1019 clear_mroute(tgen
, "l1")
1020 clear_mroute(tgen
, "l1")
1023 "After no shut, verify traffic resume to all the receivers"
1024 " (S,G) OIL update for all the receivers"
1027 for data
in input_dict
:
1028 result
= verify_mroutes(
1031 data
["src_address"],
1036 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1039 "Shut and no shut upstream interface from FRR1 to FRR2 and "
1040 "cisco immediate after mroute/upstream got cleared"
1044 intf_l1_r2
= "l1-r2-eth4"
1045 shutdown_bringup_interface(tgen
, dut
, intf_l1_r2
, False)
1047 intf_l1_c1
= "l1-c1-eth0"
1048 shutdown_bringup_interface(tgen
, dut
, intf_l1_c1
, False)
1050 result
= verify_upstream_iif(
1051 tgen
, "l1", "Unknown", source
, IGMP_JOIN_RANGE_2
, expected
=False
1053 assert result
is not True, (
1054 "Testcase {} : Failed \n "
1055 "Expected: [{}]: Upstream IIF should be unknown \n "
1056 "Found: {}".format(tc_name
, "l1", result
)
1059 step("No shut the Source interface just after the upstream is expired" " from FRR1")
1060 shutdown_bringup_interface(tgen
, dut
, intf_l1_r2
, True)
1061 shutdown_bringup_interface(tgen
, dut
, intf_l1_c1
, True)
1063 for data
in input_dict
:
1064 result
= verify_mroutes(
1067 data
["src_address"],
1072 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1074 step("Stop the traffic to all the receivers")
1075 app_helper
.stop_all_hosts()
1077 for data
in input_dict
:
1078 result
= verify_mroutes(
1081 data
["src_address"],
1087 assert result
is not True, (
1088 "Testcase {} : Failed \n "
1089 "Expected: [{}]: mroute (S, G) should not be present in mroute table \n "
1090 "Found: {}".format(tc_name
, data
["dut"], result
)
1093 write_test_footer(tc_name
)
1096 def test_verify_mroute_when_receiver_is_outside_frr_p0(request
):
1098 TC_7: Verify mroute detail when receiver is present
1102 tgen
= get_topogen()
1103 tc_name
= request
.node
.name
1104 write_test_header(tc_name
)
1106 # Don"t run this test if we have any failure.
1107 if tgen
.routers_have_failure():
1108 pytest
.skip(tgen
.errors
)
1110 # Creating configuration from JSON
1111 app_helper
.stop_all_hosts()
1113 reset_config_on_routers(tgen
)
1114 clear_pim_interface_traffic(tgen
, topo
)
1116 step("Configure static RP on c1 for group range " "(226.1.1.1-5) and (232.1.1.1-5)")
1118 _GROUP_RANGE
= GROUP_RANGE_2
+ GROUP_RANGE_3
1119 _IGMP_JOIN_RANGE
= IGMP_JOIN_RANGE_2
+ IGMP_JOIN_RANGE_3
1126 "rp_addr": topo
["routers"]["c1"]["links"]["lo"]["ipv4"].split(
1129 "group_addr_range": _GROUP_RANGE
,
1136 result
= create_pim_config(tgen
, topo
, input_dict
)
1137 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1140 "Enable IGMP on FRR1 interface and send IGMP join"
1141 " (226.1.1.1-5) and (232.1.1.1-5)"
1143 result
= app_helper
.run_join("i1", _IGMP_JOIN_RANGE
, "l1")
1144 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1147 "Send multicast traffic from FRR3 to all the receivers "
1148 "(226.1.1.1-5) and (232.1.1.1-5)"
1150 result
= app_helper
.run_traffic("i2", _IGMP_JOIN_RANGE
, "f1")
1151 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1154 "Configure one more receiver in c2 enable IGMP and send"
1155 " join (226.1.1.1-5) and (232.1.1.1-5)"
1162 "igmp": {"version": "2", "query": {"query-interval": 15}}
1168 result
= create_igmp_config(tgen
, topo
, input_dict
)
1169 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1171 result
= app_helper
.run_join("i5", _IGMP_JOIN_RANGE
, "c2")
1172 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1174 step("FRR1 has 10 (*.G) and 10 (S,G) verify using 'show ip mroute count'")
1176 "All the receiver are receiving traffic on FRR1 and (S,G) OIL is toward"
1177 "receivers, verify using 'show ip mroute' 'show ip pim upstream'"
1180 "All the receiver are receiving traffic on c2 and (S,G) OIL is "
1181 "toward receivers, verify using 'show ip mroute' 'show ip pim upstream'"
1184 source
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
1186 {"dut": "l1", "src_address": "*", "iif": "l1-c1-eth0", "oil": "l1-i1-eth1"},
1187 {"dut": "l1", "src_address": source
, "iif": "l1-r2-eth4", "oil": "l1-i1-eth1"},
1188 {"dut": "c2", "src_address": "*", "iif": "c2-c1-eth0", "oil": "c2-i5-eth2"},
1189 {"dut": "c2", "src_address": source
, "iif": "c2-f1-eth1", "oil": "c2-i5-eth2"},
1191 for data
in input_dict
:
1192 result
= verify_mroutes(
1195 data
["src_address"],
1200 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1203 "FRR3 has (S,G) OIL created toward c1/c2 receiver and FRR1 receiver"
1204 "'show ip pim state'"
1207 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "f1-c2-eth0"},
1208 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "f1-r2-eth3"},
1210 for data
in input_dict
:
1211 result
= verify_pim_state(
1217 data
["src_address"],
1219 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1221 for data
in input_dict
:
1222 result
= verify_upstream_iif(
1223 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
1225 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1227 write_test_footer(tc_name
)
1230 def test_verify_mroute_when_FRR_is_FHR_and_LHR_p0(request
):
1232 TC_8: Verify mroute when FRR is acting as FHR and LHR
1235 tgen
= get_topogen()
1236 tc_name
= request
.node
.name
1237 write_test_header(tc_name
)
1239 # Don"t run this test if we have any failure.
1240 if tgen
.routers_have_failure():
1241 pytest
.skip(tgen
.errors
)
1243 # Creating configuration from JSON
1244 app_helper
.stop_all_hosts()
1246 reset_config_on_routers(tgen
)
1247 clear_pim_interface_traffic(tgen
, topo
)
1249 step("Configure static RP for group range (226.1.1.1-5) and " "(232.1.1.1-5) on c1")
1250 _GROUP_RANGE
= GROUP_RANGE_2
+ GROUP_RANGE_3
1251 _IGMP_JOIN_RANGE
= IGMP_JOIN_RANGE_2
+ IGMP_JOIN_RANGE_3
1258 "rp_addr": topo
["routers"]["c1"]["links"]["lo"]["ipv4"].split(
1261 "group_addr_range": _GROUP_RANGE
,
1268 result
= create_pim_config(tgen
, topo
, input_dict
)
1269 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1272 "Enable IGMP on FRR1 interface and send IGMP join (226.1.1.1-5)"
1273 " and (232.1.1.1-5)"
1276 "Configure receiver on FRR3 with igmp and pim enabled and "
1277 "send IGMP join (226.1.1.1-5) and (232.1.1.1-5)"
1280 "Send multicast traffic from FRR3 to all the receivers "
1281 "(226.1.1.1-5) and (232.1.1.1-5)"
1284 step("Send IGMP join (226.1.1.1-5, 232.1.1.1-5) to LHR(l1)")
1285 result
= app_helper
.run_join("i1", _IGMP_JOIN_RANGE
, "l1")
1286 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1288 step("Send multicast traffic from FRR3 to '226.1.1.1-5'" ", '232.1.1.1-5' receiver")
1289 result
= app_helper
.run_traffic("i2", _IGMP_JOIN_RANGE
, "f1")
1290 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1293 "Configure receiver in f1 enable IGMP and send"
1294 " join (226.1.1.1-5) and (232.1.1.1-5)"
1297 step("Configure one IGMP interface on f1 node and send IGMP" " join (225.1.1.1)")
1303 "igmp": {"version": "2", "query": {"query-interval": 15}}
1309 result
= create_igmp_config(tgen
, topo
, input_dict
)
1310 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1312 result
= app_helper
.run_join("i8", _IGMP_JOIN_RANGE
, "f1")
1313 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1315 "l1 and f1 has 10 IGMP groups (226.1.1.1-5, 232.1.1.1-5),"
1316 " verify using 'show ip igmp groups'"
1319 interface
= "l1-i1-eth1"
1320 result
= verify_igmp_groups(tgen
, dut
, interface
, _IGMP_JOIN_RANGE
)
1321 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1324 interface
= "f1-i8-eth2"
1325 result
= verify_igmp_groups(tgen
, dut
, interface
, _IGMP_JOIN_RANGE
)
1326 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1329 "l1 , f1 has 10 (*,G) and 10 (S,G) for groups "
1330 "(226.1.1.1-5, 232.1.1.1-5), verify using "
1334 source
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
1336 {"dut": "f1", "src_address": "*", "iif": "f1-c2-eth0", "oil": "f1-i8-eth2"},
1337 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "f1-r2-eth3"},
1338 {"dut": "l1", "src_address": "*", "iif": "l1-c1-eth0", "oil": "l1-i1-eth1"},
1339 {"dut": "l1", "src_address": source
, "iif": "l1-r2-eth4", "oil": "l1-i1-eth1"},
1341 for data
in input_dict
:
1342 result
= verify_mroutes(
1345 data
["src_address"],
1350 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1352 step("Join timer is running in FHR and LHR , verify using" " 'show ip pim state'")
1354 for data
in input_dict
:
1355 result
= verify_pim_state(
1361 data
["src_address"],
1363 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1365 # Stop the multicast traffic
1366 step("Stop the traffic to all the receivers")
1367 app_helper
.stop_all_hosts()
1370 "After traffic stopped , verify (*,G) entries are not flushed"
1371 " out from FRR1 node verify using 'show ip mroute' "
1375 {"dut": "f1", "src_address": "*", "iif": "f1-c2-eth0", "oil": "f1-i8-eth2"},
1376 {"dut": "l1", "src_address": "*", "iif": "l1-c1-eth0", "oil": "l1-i1-eth1"},
1378 for data
in input_dict
:
1379 result
= verify_mroutes(
1382 data
["src_address"],
1389 ), "Testcase {} : Failed Error mroutes were flushed.".format(tc_name
)
1392 "After traffic stopped , verify (S,G) entries are flushed out"
1393 " from FRR1 node verify using 'show ip mroute' "
1397 {"dut": "l1", "src_address": source
, "iif": "l1-r2-eth4", "oil": "l1-i1-eth1"},
1398 {"dut": "f1", "src_address": source
, "iif": "i2-f1-eth0", "oil": "f1-r2-eth3"},
1401 for data
in input_dict
:
1402 result
= verify_mroutes(
1405 data
["src_address"],
1411 assert result
is not True, (
1412 "Testcase {} : Failed \n "
1413 "Expected: [{}]: mroute (S, G) should not be present in mroute table \n "
1414 "Found: {}".format(tc_name
, data
["dut"], result
)
1417 write_test_footer(tc_name
)
1420 def test_verify_mroute_when_5_different_receiver_joining_same_sources_p0(request
):
1422 TC_20: Verify mroute detail when 5 different receiver joining
1426 tgen
= get_topogen()
1427 tc_name
= request
.node
.name
1428 write_test_header(tc_name
)
1430 # Don"t run this test if we have any failure.
1431 if tgen
.routers_have_failure():
1432 pytest
.skip(tgen
.errors
)
1434 # Creating configuration from JSON
1435 app_helper
.stop_all_hosts()
1437 reset_config_on_routers(tgen
)
1438 clear_pim_interface_traffic(tgen
, topo
)
1440 step("Configure static RP for (226.1.1.1-5) in c1")
1441 step("Configure static RP for (232.1.1.1-5) in c2")
1443 _GROUP_RANGE
= GROUP_RANGE_2
+ GROUP_RANGE_3
1444 _IGMP_JOIN_RANGE
= IGMP_JOIN_RANGE_2
+ IGMP_JOIN_RANGE_3
1451 "rp_addr": topo
["routers"]["c1"]["links"]["lo"]["ipv4"].split(
1454 "group_addr_range": GROUP_RANGE_2
,
1463 "rp_addr": topo
["routers"]["c2"]["links"]["lo"]["ipv4"].split(
1466 "group_addr_range": GROUP_RANGE_3
,
1473 result
= create_pim_config(tgen
, topo
, input_dict
)
1474 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1477 "Configure 2 IGMP interface on FRR1 and send IGMP join"
1478 "for group (226.1.1.1-5, 232.1.1.1-5) from both the interface"
1481 "Configure 2 IGMP interface on FRR3 and send IGMP join for"
1482 " group (226.1.1.1-5, 232.1.1.1-5) from both the interface"
1485 "Configure 1 IGMP interface on c2 and send IGMP join for"
1486 "group (226.1.1.1-5, 232.1.1.1-5)"
1494 "igmp": {"version": "2", "query": {"query-interval": 15}}
1497 "igmp": {"version": "2", "query": {"query-interval": 15}}
1506 "igmp": {"version": "2", "query": {"query-interval": 15}}
1512 result
= create_igmp_config(tgen
, topo
, input_dict
)
1513 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1522 for recvr
, recvr_intf
in input_join
.items():
1523 result
= app_helper
.run_join(recvr
, _IGMP_JOIN_RANGE
, join_intf
=recvr_intf
)
1524 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1526 step("Configure one source in FRR2 , one in c1")
1528 "Send multicast traffic from both the sources to all the"
1529 "receivers (226.1.1.1-5, 232.1.1.1-5)"
1532 input_src
= {"i3": "i3-r2-eth0"}
1534 for src
, src_intf
in input_src
.items():
1535 result
= app_helper
.run_traffic(src
, _IGMP_JOIN_RANGE
, bind_intf
=src_intf
)
1536 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1538 "After all the IGMP groups received with correct port using"
1539 " 'show ip igmp groups' in FRR1, FRR3, c2"
1542 interface
= "l1-i6-eth2"
1543 result
= verify_igmp_groups(tgen
, dut
, interface
, _IGMP_JOIN_RANGE
)
1544 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1547 interface
= "f1-i8-eth2"
1548 result
= verify_igmp_groups(tgen
, dut
, interface
, _IGMP_JOIN_RANGE
)
1549 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1552 "(*,G) entries got created with upstream interface RP connected"
1553 " port using 'show ip pim upstream' in FRR1, FRR3, c2"
1556 "(S,G) entries created for all the receiver after starting the"
1557 " source , traffic is reaching to all the receiver , verify OIL"
1558 " of (S,G) is receiver port using 'show ip mroute' in FRR1, "
1562 source
= topo
["routers"]["i3"]["links"]["r2"]["ipv4"].split("/")[0]
1566 "src_address": source
,
1567 "iif": ["l1-r2-eth4", "l1-c1-eth0"],
1568 "oil": ["l1-i1-eth1", "l1-i6-eth2"],
1570 {"dut": "f1", "src_address": source
, "iif": "f1-r2-eth3", "oil": "f1-i8-eth2"},
1572 for data
in input_dict_all
:
1573 result
= verify_mroutes(
1576 data
["src_address"],
1581 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1583 for data
in input_dict_all
:
1584 result
= verify_upstream_iif(
1585 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
1587 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1589 step("Shut the receiver interface one by one on FRR1 node")
1590 shutdown_bringup_interface(tgen
, "l1", "l1-i1-eth1", False)
1591 shutdown_bringup_interface(tgen
, "l1", "l1-i6-eth2", False)
1594 "After shut the receiver port verify traffic is stopped immediately"
1595 " and (S,G) got timeout immediately in FRR1, FRR3, c2"
1598 {"dut": "l1", "src_address": source
, "iif": "l1-r2-eth4", "oil": "l1-i1-eth1"}
1600 for data
in input_dict
:
1601 result
= verify_mroutes(
1604 data
["src_address"],
1610 assert result
is not True, (
1611 "Testcase {} : Failed \n "
1612 "Expected: [{}]: mroute (S, G) should not be present in mroute table \n "
1613 "Found: {}".format(tc_name
, data
["dut"], result
)
1617 "No traffic impact observed on other receivers verify using"
1618 " 'show ip mroute' "
1621 {"dut": "f1", "src_address": source
, "iif": "f1-r2-eth3", "oil": "f1-i8-eth2"}
1623 for data
in input_dict
:
1624 result
= verify_mroutes(
1627 data
["src_address"],
1632 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1634 step("No shut the receiver interface one by one on FRR1 node")
1635 shutdown_bringup_interface(tgen
, "l1", "l1-i1-eth1", True)
1636 shutdown_bringup_interface(tgen
, "l1", "l1-i6-eth2", True)
1639 "After no shut of receivers all the mroute entries got populated"
1640 ", no duplicate entries present in mroute"
1643 for data
in input_dict_all
:
1644 result
= verify_mroutes(
1647 data
["src_address"],
1652 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1654 write_test_footer(tc_name
)
1657 def test_verify_oil_iif_for_mroute_after_shut_noshut_source_interface_p1(request
):
1659 TC_22: Verify OIL and IIF detail updated in (S,G) mroute after shut
1660 and no shut of the source interface
1663 tgen
= get_topogen()
1664 tc_name
= request
.node
.name
1665 write_test_header(tc_name
)
1667 # Don"t run this test if we have any failure.
1668 if tgen
.routers_have_failure():
1669 pytest
.skip(tgen
.errors
)
1671 # Creating configuration from JSON
1672 app_helper
.stop_all_hosts()
1674 reset_config_on_routers(tgen
)
1675 clear_pim_interface_traffic(tgen
, topo
)
1677 step("Configure static RP for (226.1.1.1-5) in c1")
1678 step("Configure static RP for (232.1.1.1-5) in c2")
1680 _GROUP_RANGE
= GROUP_RANGE_2
+ GROUP_RANGE_3
1681 _IGMP_JOIN_RANGE
= IGMP_JOIN_RANGE_2
+ IGMP_JOIN_RANGE_3
1688 "rp_addr": topo
["routers"]["c1"]["links"]["lo"]["ipv4"].split(
1691 "group_addr_range": GROUP_RANGE_2
,
1700 "rp_addr": topo
["routers"]["c2"]["links"]["lo"]["ipv4"].split(
1703 "group_addr_range": GROUP_RANGE_3
,
1710 result
= create_pim_config(tgen
, topo
, input_dict
)
1711 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1714 "Configure IGMP interface on FRR1 and FRR3 and send IGMP join"
1715 " for group (226.1.1.1-5, 232.1.1.1-5)"
1723 "igmp": {"version": "2", "query": {"query-interval": 15}}
1729 result
= create_igmp_config(tgen
, topo
, input_dict
)
1730 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1732 input_join
= {"i1": "i1-l1-eth0", "i8": "i8-f1-eth0"}
1734 for recvr
, recvr_intf
in input_join
.items():
1735 result
= app_helper
.run_join(recvr
, _IGMP_JOIN_RANGE
, join_intf
=recvr_intf
)
1736 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1738 step("Configure 1 source in FRR1 , 1 in FRR3")
1740 "Send multicast traffic from both the sources to all the "
1741 "receivers (226.1.1.1-5, 232.1.1.1-5)"
1744 input_src
= {"i6": "i6-l1-eth0", "i2": "i2-f1-eth0"}
1746 for src
, src_intf
in input_src
.items():
1747 result
= app_helper
.run_traffic(src
, _IGMP_JOIN_RANGE
, bind_intf
=src_intf
)
1748 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1751 "*,G) is created and (S,G) created on FRR1 and FRR3 for both"
1752 " the source verify using 'show ip mroute' and "
1753 " 'show ip pim upstream' to check the upstream interface"
1757 source_i6
= topo
["routers"]["i6"]["links"]["l1"]["ipv4"].split("/")[0]
1758 source_i2
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
1760 {"dut": "l1", "src_address": "*", "iif": "l1-c1-eth0", "oil": "l1-i1-eth1"},
1763 "src_address": source_i2
,
1764 "iif": "l1-r2-eth4",
1765 "oil": "l1-i1-eth1",
1769 "src_address": source_i6
,
1770 "iif": "l1-i6-eth2",
1771 "oil": "l1-i1-eth1",
1773 {"dut": "f1", "src_address": "*", "iif": "f1-c2-eth0", "oil": "f1-i8-eth2"},
1776 "src_address": source_i2
,
1777 "iif": "f1-i2-eth1",
1778 "oil": "f1-i8-eth2",
1782 "src_address": source_i6
,
1783 "iif": "f1-r2-eth3",
1784 "oil": "f1-i8-eth2",
1787 for data
in input_dict_all
:
1788 result
= verify_mroutes(
1791 data
["src_address"],
1796 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1798 for data
in input_dict_all
:
1799 result
= verify_upstream_iif(
1800 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
1802 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1804 step("Shut the source interface one by one on FRR1")
1805 shutdown_bringup_interface(tgen
, "f1", "f1-i2-eth1", False)
1808 "After shut of ource interface from FRR3 verify all the (S,G) "
1809 "entries flushed out from FRR3 node 'show ip pim upstream' "
1810 " 'show ip mroute' "
1813 result
= verify_mroutes(
1822 assert result
is not True, (
1823 "Testcase {} : Failed \n "
1824 "Expected: [{}]: mroute (S, G) should not be present in mroute table \n "
1825 "Found: {}".format(tc_name
, data
["dut"], result
)
1828 result
= verify_upstream_iif(
1829 tgen
, "f1", "Unknown", "10.0.5.2", _IGMP_JOIN_RANGE
, joinState
="NotJoined"
1831 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1833 write_test_footer(tc_name
)
1836 if __name__
== "__main__":
1837 args
= ["-s"] + sys
.argv
[1:]
1838 sys
.exit(pytest
.main(args
))