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 verify_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)"
326 "f1": {"igmp": {"interfaces": {"f1-i8-eth2": {"igmp": {"version": "2", "query": {"query-interval": 15}}}}}}
328 result
= create_igmp_config(tgen
, topo
, input_dict
)
329 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
331 input_join
= {"i1": "i1-l1-eth0", "i8": "i8-f1-eth0"}
333 for recvr
, recvr_intf
in input_join
.items():
334 result
= app_helper
.run_join(recvr
, _IGMP_JOIN_RANGE
, join_intf
=recvr_intf
)
335 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
338 "Connect one source to c2 and send multicast traffic all"
339 " the receivers (226.1.1.1-5, 232.1.1.1-5)"
342 "Send multicast traffic from FRR3 to all the receivers "
343 "(226.1.1.1-5, 232.1.1.1-5)"
346 input_src
= {"i2": "i2-f1-eth0", "i5": "i5-c2-eth0"}
348 for src
, src_intf
in input_src
.items():
349 result
= app_helper
.run_traffic(src
, _IGMP_JOIN_RANGE
, bind_intf
=src_intf
)
350 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
352 # Verifying mroutes before PIMd restart, fetching uptime
354 source
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
356 {"dut": "f1", "src_address": "*", "iif": "f1-c2-eth0", "oil": "f1-i8-eth2"},
357 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "f1-i8-eth2"},
359 for data
in input_dict
:
360 result
= verify_ip_mroutes(
368 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
370 for data
in input_dict
:
371 result
= verify_upstream_iif(
372 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
374 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
376 step("Restart Pimd process on FRR3 node")
377 kill_router_daemons(tgen
, "f1", ["pimd"])
378 start_router_daemons(tgen
, "f1", ["pimd"])
380 for data
in input_dict
:
381 result
= verify_ip_mroutes(
389 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
392 "After restart of PIMd verify pim nbr is up , IGMP groups"
393 " received , and (*,G) (S,G) entries populated again ,"
394 " Verify using 'show ip pim neighbor' , 'show ip igmp groups'"
398 result
= verify_pim_neighbors(tgen
, topo
)
399 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
402 interface
= "f1-i8-eth2"
403 result
= verify_igmp_groups(tgen
, dut
, interface
, _IGMP_JOIN_RANGE
)
404 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
406 for data
in input_dict
:
407 result
= verify_upstream_iif(
408 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
410 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
412 step("Stop the traffic and restart PIMd immediately on FRR3 node")
415 shutdown_bringup_interface(tgen
, dut
, intf
, False)
417 kill_router_daemons(tgen
, "f1", ["pimd"])
418 start_router_daemons(tgen
, "f1", ["pimd"])
421 "After PIM process come , all the none of (S,G) mroute should"
422 " present on FRR3 'show ip mroute' "
426 {"dut": "f1", "src_address": "*", "iif": "f1-c2-eth0", "oil": "f1-i8-eth2"}
428 for data
in input_dict
:
429 result
= verify_ip_mroutes(
437 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
440 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "none"}
442 for data
in input_dict
:
443 result
= verify_ip_mroutes(
454 ), "Testcase {} : Failed \n mroutes are still present \n Error: {}".format(
457 logger
.info("Expected Behavior: {}".format(result
))
459 write_test_footer(tc_name
)
462 def test_verify_mroute_and_traffic_when_frr_restarted_p2(request
):
464 TC_18: Verify (*,G) and (S,G) present and multicast traffic resume after
465 FRR service stop and start
469 tc_name
= request
.node
.name
470 write_test_header(tc_name
)
472 # Don"t run this test if we have any failure.
473 if tgen
.routers_have_failure():
474 pytest
.skip(tgen
.errors
)
476 # Creating configuration from JSON
477 app_helper
.stop_all_hosts()
478 clear_ip_mroute(tgen
)
479 reset_config_on_routers(tgen
)
480 clear_ip_pim_interface_traffic(tgen
, topo
)
482 step("Configure static RP for (226.1.1.1-5) in c1")
483 step("Configure static RP for (232.1.1.1-5) in c2")
485 _GROUP_RANGE
= GROUP_RANGE_2
+ GROUP_RANGE_3
486 _IGMP_JOIN_RANGE
= IGMP_JOIN_RANGE_2
+ IGMP_JOIN_RANGE_3
493 "rp_addr": topo
["routers"]["c1"]["links"]["lo"]["ipv4"].split(
496 "group_addr_range": GROUP_RANGE_2
,
505 "rp_addr": topo
["routers"]["c2"]["links"]["lo"]["ipv4"].split(
508 "group_addr_range": GROUP_RANGE_3
,
515 result
= create_pim_config(tgen
, topo
, input_dict
)
516 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
519 "Enable IGMP on FRR1 interface and send IGMP join "
520 "(226.1.1.1-5) and (232.1.1.1-5)"
523 "Configure IGMP interface on FRR3 and send IGMP join"
524 " for group (226.1.1.1-5, 232.1.1.1-5)"
528 "f1": {"igmp": {"interfaces": {"f1-i8-eth2": {"igmp": {"version": "2", "query": {"query-interval": 15}}}}}}
530 result
= create_igmp_config(tgen
, topo
, input_dict
)
531 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
533 input_join
= {"i1": "i1-l1-eth0", "i8": "i8-f1-eth0"}
535 for recvr
, recvr_intf
in input_join
.items():
536 result
= app_helper
.run_join(recvr
, _IGMP_JOIN_RANGE
, join_intf
=recvr_intf
)
537 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
540 "Connect one source to c2 and send multicast traffic all"
541 " the receivers (226.1.1.1-5, 232.1.1.1-5)"
544 "Send multicast traffic from FRR3 to all the receivers "
545 "(226.1.1.1-5, 232.1.1.1-5)"
548 input_src
= {"i2": "i2-f1-eth0", "i5": "i5-c2-eth0"}
550 for src
, src_intf
in input_src
.items():
551 result
= app_helper
.run_traffic(src
, _IGMP_JOIN_RANGE
, bind_intf
=src_intf
)
552 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
554 step("Verifying mroutes before FRR restart, fetching uptime")
556 source
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
558 {"dut": "f1", "src_address": "*", "iif": "f1-c2-eth0", "oil": "f1-i8-eth2"},
559 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "f1-i8-eth2"},
561 for data
in input_dict
:
562 result
= verify_ip_mroutes(
570 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
572 for data
in input_dict
:
573 result
= verify_upstream_iif(
574 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
576 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
578 step("Stop and Start the FRR services on FRR3 node")
579 stop_router(tgen
, "f1")
580 start_router(tgen
, "f1")
582 for data
in input_dict
:
583 result
= verify_ip_mroutes(
591 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
594 "After stop and start of FRR service verify pim nbr is up "
595 "IGMP groups received , and (*,G) (S,G) entries populated again"
596 " Verify using 'show ip pim neighbor' , 'show ip igmp groups'"
600 result
= verify_pim_neighbors(tgen
, topo
)
601 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
604 interface
= "f1-i8-eth2"
605 result
= verify_igmp_groups(tgen
, dut
, interface
, _IGMP_JOIN_RANGE
)
606 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
608 for data
in input_dict
:
609 result
= verify_upstream_iif(
610 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
612 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
614 step("Stop the traffic and stop and start the FRR services on" " FRR3 node")
615 shutdown_bringup_interface(tgen
, "i2", "i2-f1-eth0", False)
617 stop_router(tgen
, "f1")
618 start_router(tgen
, "f1")
621 "After stop and start of FRR services , all the none of (S,G)"
622 " mroute should present on FRR3 node verify using "
627 {"dut": "f1", "src_address": "*", "iif": "f1-c2-eth0", "oil": "f1-i8-eth2"}
629 for data
in input_dict
:
630 result
= verify_ip_mroutes(
638 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
641 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "none"}
643 for data
in input_dict
:
644 result
= verify_ip_mroutes(
655 ), "Testcase {} : Failed \n mroutes are still present \n Error: {}".format(
658 logger
.info("Expected Behavior: {}".format(result
))
660 write_test_footer(tc_name
)
663 def test_verify_SPT_switchover_when_RPT_and_SPT_path_is_different_p0(request
):
665 TC_10: Verify SPT switchover working when RPT and SPT path is
670 tc_name
= request
.node
.name
671 write_test_header(tc_name
)
673 # Don"t run this test if we have any failure.
674 if tgen
.routers_have_failure():
675 pytest
.skip(tgen
.errors
)
677 # Creating configuration from JSON
678 app_helper
.stop_all_hosts()
679 clear_ip_mroute(tgen
)
680 reset_config_on_routers(tgen
)
681 clear_ip_pim_interface_traffic(tgen
, topo
)
683 step("Configure static RP for (226.1.1.1-5) and " "(232.1.1.1-5) in c2")
685 _GROUP_RANGE
= GROUP_RANGE_2
+ GROUP_RANGE_3
686 _IGMP_JOIN_RANGE
= IGMP_JOIN_RANGE_2
+ IGMP_JOIN_RANGE_3
693 "rp_addr": topo
["routers"]["c2"]["links"]["lo"]["ipv4"].split(
696 "group_addr_range": _GROUP_RANGE
,
703 result
= create_pim_config(tgen
, topo
, input_dict
)
704 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
707 "Enable IGMP on FRR1 interface and send IGMP join "
708 "(226.1.1.1-5) and (232.1.1.1-5)"
711 result
= app_helper
.run_join("i1", _IGMP_JOIN_RANGE
, "l1")
712 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
714 step("Send multicast traffic from FRR3 to '226.1.1.1-5'" ", '232.1.1.1-5' receiver")
716 step("registerRx and registerStopTx value before traffic sent")
717 state_dict
= {"c2": {"c2-f1-eth1": ["registerRx", "registerStopTx"]}}
718 state_before
= verify_pim_interface_traffic(tgen
, state_dict
)
721 ), "Testcase {} : Failed \n state_before is not dictionary \nError: {}".format(
725 result
= app_helper
.run_traffic("i2", _IGMP_JOIN_RANGE
, "f1")
726 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
729 "Verify in FRR3 sending initial packet to RP using"
730 " 'show ip mroute' and mroute OIL is towards RP."
733 result
= verify_ip_mroutes(
739 ["f1-c2-eth0", "f1-r2-eth3"],
741 assert result
is True, "Testcase {} : " "Failed Error: {}".format(tc_name
, result
)
743 result
= verify_ip_mroutes(
744 tgen
, "f1", "10.0.5.2", _IGMP_JOIN_RANGE
, "f1-i2-eth1", "f1-r2-eth3"
746 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
749 " After spt switchover traffic is flowing between"
750 " (LHR(FRR1)-FHR(FRR3)) and (S,G) OIL is updated toward FRR1"
751 " 'show ip mroute' and 'show ip pim upstream'"
754 source
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
756 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "f1-r2-eth3"},
757 {"dut": "l1", "src_address": source
, "iif": "l1-r2-eth4", "oil": "l1-i1-eth1"},
759 for data
in input_dict
:
760 result
= verify_ip_mroutes(
768 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
770 for data
in input_dict
:
771 result
= verify_upstream_iif(
772 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
774 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
776 step("Stop the traffic to all the receivers")
778 app_helper
.stop_host("i2")
781 "Null register packet being send periodically from FRR3 to RP, "
782 "verify using show ip mroute on RP, have (S, G) entries null OIL"
783 " 'show ip mroute' and verify show ip pim interface traffic"
784 "(In RP Register msg should be received and Register stop should"
788 {"dut": "c2", "src_address": source
, "iif": "c2-f1-eth1", "oil": "none"}
790 for data
in input_dict
:
791 result
= verify_ip_mroutes(
799 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
801 step("registerRx and registerStopTx value after traffic sent")
802 state_after
= verify_pim_interface_traffic(tgen
, state_dict
)
805 ), "Testcase {} : Failed \n state_before is not dictionary \nError: {}".format(
809 result
= verify_state_incremented(state_before
, state_after
)
810 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
812 write_test_footer(tc_name
)
815 def test_verify_mroute_after_shut_noshut_of_upstream_interface_p1(request
):
817 TC_15: Verify (S,G) and (*,G) mroute after shut / no shut of upstream
822 tc_name
= request
.node
.name
823 write_test_header(tc_name
)
825 # Don"t run this test if we have any failure.
826 if tgen
.routers_have_failure():
827 pytest
.skip(tgen
.errors
)
829 # Creating configuration from JSON
830 app_helper
.stop_all_hosts()
831 clear_ip_mroute(tgen
)
832 reset_config_on_routers(tgen
)
833 clear_ip_pim_interface_traffic(tgen
, topo
)
835 step("Configure static RP for (226.1.1.1-5) in c1")
836 step("Configure static RP for (232.1.1.1-5) in c2")
838 _GROUP_RANGE
= GROUP_RANGE_2
+ GROUP_RANGE_3
839 _IGMP_JOIN_RANGE
= IGMP_JOIN_RANGE_2
+ IGMP_JOIN_RANGE_3
846 "rp_addr": topo
["routers"]["c1"]["links"]["lo"]["ipv4"].split(
849 "group_addr_range": GROUP_RANGE_2
,
858 "rp_addr": topo
["routers"]["c2"]["links"]["lo"]["ipv4"].split(
861 "group_addr_range": GROUP_RANGE_3
,
868 result
= create_pim_config(tgen
, topo
, input_dict
)
869 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
872 "Enable IGMP on FRR1 interface and send IGMP join "
873 "(226.1.1.1-5) and (232.1.1.1-5)"
876 "Configure IGMP interface on FRR3 and send IGMP join"
877 " for group (226.1.1.1-5, 232.1.1.1-5)"
881 "f1": {"igmp": {"interfaces": {"f1-i8-eth2": {"igmp": {"version": "2", "query": {"query-interval": 15}}}}}}
883 result
= create_igmp_config(tgen
, topo
, input_dict
)
884 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
886 input_join
= {"i1": "i1-l1-eth0", "i8": "i8-f1-eth0"}
888 for recvr
, recvr_intf
in input_join
.items():
889 result
= app_helper
.run_join(recvr
, _IGMP_JOIN_RANGE
, join_intf
=recvr_intf
)
890 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
893 "Connect one source to c2 and send multicast traffic all"
894 " the receivers (226.1.1.1-5, 232.1.1.1-5)"
897 "Send multicast traffic from FRR3 to all the receivers "
898 "(226.1.1.1-5, 232.1.1.1-5)"
901 input_src
= {"i2": "i2-f1-eth0", "i5": "i5-c2-eth0"}
903 for src
, src_intf
in input_src
.items():
904 result
= app_helper
.run_traffic(src
, _IGMP_JOIN_RANGE
, bind_intf
=src_intf
)
905 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
908 "FRR3 (S,G) has one OIL for local receiver one toward c2"
909 " verify 'show ip mroute' and 'show ip pim upstream'"
912 source
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
914 {"dut": "f1", "src_address": "*", "iif": "f1-c2-eth0", "oil": "f1-i8-eth2"},
915 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "f1-i8-eth2"},
917 for data
in input_dict
:
918 result
= verify_ip_mroutes(
926 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
928 for data
in input_dict
:
929 result
= verify_upstream_iif(
930 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_2
932 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
934 step("Shut and No shut interface connected from FHR (FRR3)" " to c2")
937 shutdown_bringup_interface(tgen
, dut
, intf
, False)
938 shutdown_bringup_interface(tgen
, dut
, intf
, True)
940 step("Shut and No shut interface connected from LHR (FRR1)" " to c1")
943 shutdown_bringup_interface(tgen
, dut
, intf
, False)
944 shutdown_bringup_interface(tgen
, dut
, intf
, True)
946 for data
in input_dict
:
947 result
= verify_ip_mroutes(
955 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
957 step("Shut and No shut FRR1 and FRR3 interface")
958 shutdown_bringup_interface(tgen
, "l1", "l1-r2-eth4", False)
959 shutdown_bringup_interface(tgen
, dut
, intf
, True)
961 shutdown_bringup_interface(tgen
, "f1", "f1-r2-eth3", False)
962 shutdown_bringup_interface(tgen
, dut
, intf
, True)
965 "After shut/no shut of interface , verify traffic resume to all"
966 "the receivers (S,G) OIL update for all the receivers"
969 for data
in input_dict
:
970 result
= verify_ip_mroutes(
978 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
981 "Shut FRR1, FRR3 interface , clear mroute in FRR1"
982 " and No shut FRR1, FRR3 interface "
986 shutdown_bringup_interface(tgen
, dut
, intf
, False)
990 shutdown_bringup_interface(tgen
, dut
, intf
, False)
994 shutdown_bringup_interface(tgen
, dut
, intf
, True)
998 shutdown_bringup_interface(tgen
, dut
, intf
, True)
1000 clear_ip_mroute(tgen
, "l1")
1001 clear_ip_mroute(tgen
, "l1")
1004 "After no shut, verify traffic resume to all the receivers"
1005 " (S,G) OIL update for all the receivers"
1008 for data
in input_dict
:
1009 result
= verify_ip_mroutes(
1012 data
["src_address"],
1017 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1020 "Shut and no shut upstream interface from FRR1 to FRR2 and "
1021 "cisco immediate after mroute/upstream got cleared"
1025 intf_l1_r2
= "l1-r2-eth4"
1026 shutdown_bringup_interface(tgen
, dut
, intf_l1_r2
, False)
1028 intf_l1_c1
= "l1-c1-eth0"
1029 shutdown_bringup_interface(tgen
, dut
, intf_l1_c1
, False)
1032 result
= verify_upstream_iif(
1033 tgen
, "l1", "Unknown", source
, IGMP_JOIN_RANGE_2
, expected
=False
1035 assert result
is not True, (
1036 "Testcase {} : Failed Error: \n "
1037 "mroutes are still present, after waiting for 10 mins".format(tc_name
)
1040 step("No shut the Source interface just after the upstream is expired" " from FRR1")
1041 shutdown_bringup_interface(tgen
, dut
, intf_l1_r2
, True)
1042 shutdown_bringup_interface(tgen
, dut
, intf_l1_c1
, True)
1044 for data
in input_dict
:
1045 result
= verify_ip_mroutes(
1048 data
["src_address"],
1053 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1055 step("Stop the traffic to all the receivers")
1056 app_helper
.stop_all_hosts()
1058 for data
in input_dict
:
1059 result
= verify_ip_mroutes(
1062 data
["src_address"],
1070 ), "Testcase {} : Failed \n mroutes are still present \n Error: {}".format(
1073 logger
.info("Expected Behavior: {}".format(result
))
1075 write_test_footer(tc_name
)
1078 def test_verify_mroute_when_receiver_is_outside_frr_p0(request
):
1080 TC_7: Verify mroute detail when receiver is present
1084 tgen
= get_topogen()
1085 tc_name
= request
.node
.name
1086 write_test_header(tc_name
)
1088 # Don"t run this test if we have any failure.
1089 if tgen
.routers_have_failure():
1090 pytest
.skip(tgen
.errors
)
1092 # Creating configuration from JSON
1093 app_helper
.stop_all_hosts()
1094 clear_ip_mroute(tgen
)
1095 reset_config_on_routers(tgen
)
1096 clear_ip_pim_interface_traffic(tgen
, topo
)
1098 step("Configure static RP on c1 for group range " "(226.1.1.1-5) and (232.1.1.1-5)")
1100 _GROUP_RANGE
= GROUP_RANGE_2
+ GROUP_RANGE_3
1101 _IGMP_JOIN_RANGE
= IGMP_JOIN_RANGE_2
+ IGMP_JOIN_RANGE_3
1108 "rp_addr": topo
["routers"]["c1"]["links"]["lo"]["ipv4"].split(
1111 "group_addr_range": _GROUP_RANGE
,
1118 result
= create_pim_config(tgen
, topo
, input_dict
)
1119 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1122 "Enable IGMP on FRR1 interface and send IGMP join"
1123 " (226.1.1.1-5) and (232.1.1.1-5)"
1125 result
= app_helper
.run_join("i1", _IGMP_JOIN_RANGE
, "l1")
1126 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1129 "Send multicast traffic from FRR3 to all the receivers "
1130 "(226.1.1.1-5) and (232.1.1.1-5)"
1132 result
= app_helper
.run_traffic("i2", _IGMP_JOIN_RANGE
, "f1")
1133 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1136 "Configure one more receiver in c2 enable IGMP and send"
1137 " join (226.1.1.1-5) and (232.1.1.1-5)"
1140 "c2": {"igmp": {"interfaces": {"c2-i5-eth2": {"igmp": {"version": "2", "query": {"query-interval": 15}}}}}}
1142 result
= create_igmp_config(tgen
, topo
, input_dict
)
1143 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1145 result
= app_helper
.run_join("i5", _IGMP_JOIN_RANGE
, "c2")
1146 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1148 step("FRR1 has 10 (*.G) and 10 (S,G) verify using 'show ip mroute count'")
1150 "All the receiver are receiving traffic on FRR1 and (S,G) OIL is toward"
1151 "receivers, verify using 'show ip mroute' 'show ip pim upstream'"
1154 "All the receiver are receiving traffic on c2 and (S,G) OIL is "
1155 "toward receivers, verify using 'show ip mroute' 'show ip pim upstream'"
1158 source
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
1160 {"dut": "l1", "src_address": "*", "iif": "l1-c1-eth0", "oil": "l1-i1-eth1"},
1161 {"dut": "l1", "src_address": source
, "iif": "l1-r2-eth4", "oil": "l1-i1-eth1"},
1162 {"dut": "c2", "src_address": "*", "iif": "c2-c1-eth0", "oil": "c2-i5-eth2"},
1163 {"dut": "c2", "src_address": source
, "iif": "c2-f1-eth1", "oil": "c2-i5-eth2"},
1165 for data
in input_dict
:
1166 result
= verify_ip_mroutes(
1169 data
["src_address"],
1174 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1177 "FRR3 has (S,G) OIL created toward c1/c2 receiver and FRR1 receiver"
1178 "'show ip pim state'"
1181 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "f1-c2-eth0"},
1182 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "f1-r2-eth3"},
1184 for data
in input_dict
:
1185 result
= verify_pim_state(
1191 data
["src_address"],
1193 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1195 for data
in input_dict
:
1196 result
= verify_upstream_iif(
1197 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
1199 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1201 write_test_footer(tc_name
)
1204 def test_verify_mroute_when_FRR_is_FHR_and_LHR_p0(request
):
1206 TC_8: Verify mroute when FRR is acting as FHR and LHR
1209 tgen
= get_topogen()
1210 tc_name
= request
.node
.name
1211 write_test_header(tc_name
)
1213 # Don"t run this test if we have any failure.
1214 if tgen
.routers_have_failure():
1215 pytest
.skip(tgen
.errors
)
1217 # Creating configuration from JSON
1218 app_helper
.stop_all_hosts()
1219 clear_ip_mroute(tgen
)
1220 reset_config_on_routers(tgen
)
1221 clear_ip_pim_interface_traffic(tgen
, topo
)
1223 step("Configure static RP for group range (226.1.1.1-5) and " "(232.1.1.1-5) on c1")
1224 _GROUP_RANGE
= GROUP_RANGE_2
+ GROUP_RANGE_3
1225 _IGMP_JOIN_RANGE
= IGMP_JOIN_RANGE_2
+ IGMP_JOIN_RANGE_3
1232 "rp_addr": topo
["routers"]["c1"]["links"]["lo"]["ipv4"].split(
1235 "group_addr_range": _GROUP_RANGE
,
1242 result
= create_pim_config(tgen
, topo
, input_dict
)
1243 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1246 "Enable IGMP on FRR1 interface and send IGMP join (226.1.1.1-5)"
1247 " and (232.1.1.1-5)"
1250 "Configure receiver on FRR3 with igmp and pim enabled and "
1251 "send IGMP join (226.1.1.1-5) and (232.1.1.1-5)"
1254 "Send multicast traffic from FRR3 to all the receivers "
1255 "(226.1.1.1-5) and (232.1.1.1-5)"
1258 step("Send IGMP join (226.1.1.1-5, 232.1.1.1-5) to LHR(l1)")
1259 result
= app_helper
.run_join("i1", _IGMP_JOIN_RANGE
, "l1")
1260 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1262 step("Send multicast traffic from FRR3 to '226.1.1.1-5'" ", '232.1.1.1-5' receiver")
1263 result
= app_helper
.run_traffic("i2", _IGMP_JOIN_RANGE
, "f1")
1264 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1267 "Configure receiver in f1 enable IGMP and send"
1268 " join (226.1.1.1-5) and (232.1.1.1-5)"
1271 step("Configure one IGMP interface on f1 node and send IGMP" " join (225.1.1.1)")
1273 "f1": {"igmp": {"interfaces": {"f1-i8-eth2": {"igmp": {"version": "2", "query": {"query-interval": 15}}}}}}
1275 result
= create_igmp_config(tgen
, topo
, input_dict
)
1276 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1278 result
= app_helper
.run_join("i8", _IGMP_JOIN_RANGE
, "f1")
1279 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1281 "l1 and f1 has 10 IGMP groups (226.1.1.1-5, 232.1.1.1-5),"
1282 " verify using 'show ip igmp groups'"
1285 interface
= "l1-i1-eth1"
1286 result
= verify_igmp_groups(tgen
, dut
, interface
, _IGMP_JOIN_RANGE
)
1287 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1290 interface
= "f1-i8-eth2"
1291 result
= verify_igmp_groups(tgen
, dut
, interface
, _IGMP_JOIN_RANGE
)
1292 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1295 "l1 , f1 has 10 (*,G) and 10 (S,G) for groups "
1296 "(226.1.1.1-5, 232.1.1.1-5), verify using "
1300 source
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
1302 {"dut": "f1", "src_address": "*", "iif": "f1-c2-eth0", "oil": "f1-i8-eth2"},
1303 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "f1-r2-eth3"},
1304 {"dut": "l1", "src_address": "*", "iif": "l1-c1-eth0", "oil": "l1-i1-eth1"},
1305 {"dut": "l1", "src_address": source
, "iif": "l1-r2-eth4", "oil": "l1-i1-eth1"},
1307 for data
in input_dict
:
1308 result
= verify_ip_mroutes(
1311 data
["src_address"],
1316 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1318 step("Join timer is running in FHR and LHR , verify using" " 'show ip pim state'")
1320 for data
in input_dict
:
1321 result
= verify_pim_state(
1327 data
["src_address"],
1329 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1331 # Stop the multicast traffic
1332 step("Stop the traffic to all the receivers")
1333 app_helper
.stop_all_hosts()
1336 "After traffic stopped , verify (*,G) entries are not flushed"
1337 " out from FRR1 node verify using 'show ip mroute' "
1341 {"dut": "f1", "src_address": "*", "iif": "f1-c2-eth0", "oil": "f1-i8-eth2"},
1342 {"dut": "l1", "src_address": "*", "iif": "l1-c1-eth0", "oil": "l1-i1-eth1"},
1344 for data
in input_dict
:
1345 result
= verify_ip_mroutes(
1348 data
["src_address"],
1353 assert result
is True, (
1354 "Testcase {} : Failed Error mroutes were flushed.".format(tc_name
)
1358 "After traffic stopped , verify (S,G) entries are flushed out"
1359 " from FRR1 node verify using 'show ip mroute' "
1363 {"dut": "l1", "src_address": source
, "iif": "l1-r2-eth4", "oil": "l1-i1-eth1"},
1364 {"dut": "f1", "src_address": source
, "iif": "i2-f1-eth0", "oil": "f1-r2-eth3"},
1367 for data
in input_dict
:
1368 result
= verify_ip_mroutes(
1371 data
["src_address"],
1377 assert result
is not True, (
1378 "Testcase {} : Failed Error: \nmroutes are still present".format(tc_name
)
1381 write_test_footer(tc_name
)
1384 def test_verify_mroute_when_5_different_receiver_joining_same_sources_p0(request
):
1386 TC_20: Verify mroute detail when 5 different receiver joining
1390 tgen
= get_topogen()
1391 tc_name
= request
.node
.name
1392 write_test_header(tc_name
)
1394 # Don"t run this test if we have any failure.
1395 if tgen
.routers_have_failure():
1396 pytest
.skip(tgen
.errors
)
1398 # Creating configuration from JSON
1399 app_helper
.stop_all_hosts()
1400 clear_ip_mroute(tgen
)
1401 reset_config_on_routers(tgen
)
1402 clear_ip_pim_interface_traffic(tgen
, topo
)
1404 step("Configure static RP for (226.1.1.1-5) in c1")
1405 step("Configure static RP for (232.1.1.1-5) in c2")
1407 _GROUP_RANGE
= GROUP_RANGE_2
+ GROUP_RANGE_3
1408 _IGMP_JOIN_RANGE
= IGMP_JOIN_RANGE_2
+ IGMP_JOIN_RANGE_3
1415 "rp_addr": topo
["routers"]["c1"]["links"]["lo"]["ipv4"].split(
1418 "group_addr_range": GROUP_RANGE_2
,
1427 "rp_addr": topo
["routers"]["c2"]["links"]["lo"]["ipv4"].split(
1430 "group_addr_range": GROUP_RANGE_3
,
1437 result
= create_pim_config(tgen
, topo
, input_dict
)
1438 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1441 "Configure 2 IGMP interface on FRR1 and send IGMP join"
1442 "for group (226.1.1.1-5, 232.1.1.1-5) from both the interface"
1445 "Configure 2 IGMP interface on FRR3 and send IGMP join for"
1446 " group (226.1.1.1-5, 232.1.1.1-5) from both the interface"
1449 "Configure 1 IGMP interface on c2 and send IGMP join for"
1450 "group (226.1.1.1-5, 232.1.1.1-5)"
1457 "f1-i8-eth2": {"igmp": {"version": "2", "query": {"query-interval": 15}}},
1458 "f1-i2-eth1": {"igmp": {"version": "2", "query": {"query-interval": 15}}},
1462 "l1": {"igmp": {"interfaces": {"l1-i6-eth2": {"igmp": {"version": "2", "query": {"query-interval": 15}}}}}},
1464 result
= create_igmp_config(tgen
, topo
, input_dict
)
1465 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1474 for recvr
, recvr_intf
in input_join
.items():
1475 result
= app_helper
.run_join(recvr
, _IGMP_JOIN_RANGE
, join_intf
=recvr_intf
)
1476 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1478 step("Configure one source in FRR2 , one in c1")
1480 "Send multicast traffic from both the sources to all the"
1481 "receivers (226.1.1.1-5, 232.1.1.1-5)"
1484 input_src
= {"i3": "i3-r2-eth0"}
1486 for src
, src_intf
in input_src
.items():
1487 result
= app_helper
.run_traffic(src
, _IGMP_JOIN_RANGE
, bind_intf
=src_intf
)
1488 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1490 "After all the IGMP groups received with correct port using"
1491 " 'show ip igmp groups' in FRR1, FRR3, c2"
1494 interface
= "l1-i6-eth2"
1495 result
= verify_igmp_groups(tgen
, dut
, interface
, _IGMP_JOIN_RANGE
)
1496 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1499 interface
= "f1-i8-eth2"
1500 result
= verify_igmp_groups(tgen
, dut
, interface
, _IGMP_JOIN_RANGE
)
1501 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1504 "(*,G) entries got created with upstream interface RP connected"
1505 " port using 'show ip pim upstream' in FRR1, FRR3, c2"
1508 "(S,G) entries created for all the receiver after starting the"
1509 " source , traffic is reaching to all the receiver , verify OIL"
1510 " of (S,G) is receiver port using 'show ip mroute' in FRR1, "
1514 source
= topo
["routers"]["i3"]["links"]["r2"]["ipv4"].split("/")[0]
1516 {"dut": "l1", "src_address": source
, "iif": ["l1-r2-eth4", "l1-c1-eth0"],
1517 "oil": ["l1-i1-eth1", "l1-i6-eth2"]},
1518 {"dut": "f1", "src_address": source
, "iif": "f1-r2-eth3", "oil": "f1-i8-eth2"},
1520 for data
in input_dict_all
:
1521 result
= verify_ip_mroutes(
1524 data
["src_address"],
1529 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1531 for data
in input_dict_all
:
1532 result
= verify_upstream_iif(
1533 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
1535 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1537 step("Shut the receiver interface one by one on FRR1 node")
1538 shutdown_bringup_interface(tgen
, "l1", "l1-i1-eth1", False)
1539 shutdown_bringup_interface(tgen
, "l1", "l1-i6-eth2", False)
1542 "After shut the receiver port verify traffic is stopped immediately"
1543 " and (S,G) got timeout immediately in FRR1, FRR3, c2"
1546 {"dut": "l1", "src_address": source
, "iif": "l1-r2-eth4", "oil": "l1-i1-eth1"}
1548 for data
in input_dict
:
1549 result
= verify_ip_mroutes(
1552 data
["src_address"],
1560 ), "Testcase {} : Failed \n mroutes are still present \n Error: {}".format(
1563 logger
.info("Expected Behavior: {}".format(result
))
1566 "No traffic impact observed on other receivers verify using"
1567 " 'show ip mroute' "
1570 {"dut": "f1", "src_address": source
, "iif": "f1-r2-eth3", "oil": "f1-i8-eth2"}
1572 for data
in input_dict
:
1573 result
= verify_ip_mroutes(
1576 data
["src_address"],
1581 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1583 step("No shut the receiver interface one by one on FRR1 node")
1584 shutdown_bringup_interface(tgen
, "l1", "l1-i1-eth1", True)
1585 shutdown_bringup_interface(tgen
, "l1", "l1-i6-eth2", True)
1588 "After no shut of receivers all the mroute entries got populated"
1589 ", no duplicate entries present in mroute"
1592 for data
in input_dict_all
:
1593 result
= verify_ip_mroutes(
1596 data
["src_address"],
1601 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1603 write_test_footer(tc_name
)
1606 def test_verify_oil_iif_for_mroute_after_shut_noshut_source_interface_p1(request
):
1608 TC_22: Verify OIL and IIF detail updated in (S,G) mroute after shut
1609 and no shut of the source interface
1612 tgen
= get_topogen()
1613 tc_name
= request
.node
.name
1614 write_test_header(tc_name
)
1616 # Don"t run this test if we have any failure.
1617 if tgen
.routers_have_failure():
1618 pytest
.skip(tgen
.errors
)
1620 # Creating configuration from JSON
1621 app_helper
.stop_all_hosts()
1622 clear_ip_mroute(tgen
)
1623 reset_config_on_routers(tgen
)
1624 clear_ip_pim_interface_traffic(tgen
, topo
)
1626 step("Configure static RP for (226.1.1.1-5) in c1")
1627 step("Configure static RP for (232.1.1.1-5) in c2")
1629 _GROUP_RANGE
= GROUP_RANGE_2
+ GROUP_RANGE_3
1630 _IGMP_JOIN_RANGE
= IGMP_JOIN_RANGE_2
+ IGMP_JOIN_RANGE_3
1637 "rp_addr": topo
["routers"]["c1"]["links"]["lo"]["ipv4"].split(
1640 "group_addr_range": GROUP_RANGE_2
,
1649 "rp_addr": topo
["routers"]["c2"]["links"]["lo"]["ipv4"].split(
1652 "group_addr_range": GROUP_RANGE_3
,
1659 result
= create_pim_config(tgen
, topo
, input_dict
)
1660 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1663 "Configure IGMP interface on FRR1 and FRR3 and send IGMP join"
1664 " for group (226.1.1.1-5, 232.1.1.1-5)"
1668 "f1": {"igmp": {"interfaces": {"f1-i8-eth2": {"igmp": {"version": "2", "query": {"query-interval": 15}}}}}}
1670 result
= create_igmp_config(tgen
, topo
, input_dict
)
1671 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1673 input_join
= {"i1": "i1-l1-eth0", "i8": "i8-f1-eth0"}
1675 for recvr
, recvr_intf
in input_join
.items():
1676 result
= app_helper
.run_join(recvr
, _IGMP_JOIN_RANGE
, join_intf
=recvr_intf
)
1677 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1679 step("Configure 1 source in FRR1 , 1 in FRR3")
1681 "Send multicast traffic from both the sources to all the "
1682 "receivers (226.1.1.1-5, 232.1.1.1-5)"
1685 input_src
= {"i6": "i6-l1-eth0", "i2": "i2-f1-eth0"}
1687 for src
, src_intf
in input_src
.items():
1688 result
= app_helper
.run_traffic(src
, _IGMP_JOIN_RANGE
, bind_intf
=src_intf
)
1689 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1692 "*,G) is created and (S,G) created on FRR1 and FRR3 for both"
1693 " the source verify using 'show ip mroute' and "
1694 " 'show ip pim upstream' to check the upstream interface"
1698 source_i6
= topo
["routers"]["i6"]["links"]["l1"]["ipv4"].split("/")[0]
1699 source_i2
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
1701 {"dut": "l1", "src_address": "*", "iif": "l1-c1-eth0", "oil": "l1-i1-eth1"},
1704 "src_address": source_i2
,
1705 "iif": "l1-r2-eth4",
1706 "oil": "l1-i1-eth1",
1710 "src_address": source_i6
,
1711 "iif": "l1-i6-eth2",
1712 "oil": "l1-i1-eth1",
1714 {"dut": "f1", "src_address": "*", "iif": "f1-c2-eth0", "oil": "f1-i8-eth2"},
1717 "src_address": source_i2
,
1718 "iif": "f1-i2-eth1",
1719 "oil": "f1-i8-eth2",
1723 "src_address": source_i6
,
1724 "iif": "f1-r2-eth3",
1725 "oil": "f1-i8-eth2",
1728 for data
in input_dict_all
:
1729 result
= verify_ip_mroutes(
1732 data
["src_address"],
1737 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1739 for data
in input_dict_all
:
1740 result
= verify_upstream_iif(
1741 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
1743 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1745 step("Shut the source interface one by one on FRR1")
1746 shutdown_bringup_interface(tgen
, "f1", "f1-i2-eth1", False)
1749 "After shut of ource interface from FRR3 verify all the (S,G) "
1750 "entries flushed out from FRR3 node 'show ip pim upstream' "
1751 " 'show ip mroute' "
1754 result
= verify_ip_mroutes(
1765 ), "Testcase {} : Failed \n mroutes are" " still present \n Error: {}".format(
1768 logger
.info("Expected Behavior: {}".format(result
))
1770 result
= verify_upstream_iif(
1771 tgen
, "f1", "Unknown", "10.0.5.2", _IGMP_JOIN_RANGE
, joinState
="NotJoined"
1773 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1775 write_test_footer(tc_name
)
1778 if __name__
== "__main__":
1779 args
= ["-s"] + sys
.argv
[1:]
1780 sys
.exit(pytest
.main(args
))