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 from time
import sleep
56 pytestmark
= pytest
.mark
.pimd
58 # Save the Current Working Directory to find configuration files.
59 CWD
= os
.path
.dirname(os
.path
.realpath(__file__
))
60 sys
.path
.append(os
.path
.join(CWD
, "../"))
61 sys
.path
.append(os
.path
.join(CWD
, "../lib/"))
63 # Required to instantiate the topology builder class.
65 # pylint: disable=C0413
66 # Import topogen and topotest helpers
67 from lib
.topogen
import Topogen
, get_topogen
68 from lib
.micronet_compat
import Topo
70 from lib
.common_config
import (
77 reset_config_on_routers
,
80 shutdown_bringup_interface
,
85 required_linux_kernel_version
,
93 verify_pim_interface_traffic
,
99 clear_ip_pim_interface_traffic
,
102 from lib
.topolog
import logger
103 from lib
.topojson
import build_topo_from_json
, build_config_from_json
106 pytestmark
= [pytest
.mark
.pimd
]
111 i4-----c1-------------c2---i5
114 i1-----l1------r2-----f1---i2
120 i1, i2, i3. i4, i5, i6, i7, i8 - FRR running iperf to send IGMP
130 GROUP_RANGE
= "225.0.0.0/8"
131 IGMP_JOIN
= "225.1.1.1"
139 IGMP_JOIN_RANGE_1
= ["225.1.1.1", "225.1.1.2", "225.1.1.3", "225.1.1.4", "225.1.1.5"]
147 IGMP_JOIN_RANGE_2
= ["226.1.1.1", "226.1.1.2", "226.1.1.3", "226.1.1.4", "226.1.1.5"]
156 IGMP_JOIN_RANGE_3
= ["227.1.1.1", "227.1.1.2", "227.1.1.3", "227.1.1.4", "227.1.1.5"]
159 def setup_module(mod
):
161 Sets up the pytest environment
166 # Required linux kernel version for this suite to run.
167 result
= required_linux_kernel_version("4.19")
168 if result
is not True:
169 pytest
.skip("Kernel requirements are not met")
171 testsuite_run_time
= time
.asctime(time
.localtime(time
.time()))
172 logger
.info("Testsuite start time: {}".format(testsuite_run_time
))
173 logger
.info("=" * 40)
174 logger
.info("Master Topology: \n {}".format(TOPOLOGY
))
176 logger
.info("Running setup_module to create topology")
178 json_file
= "{}/multicast_pim_sm_topo2.json".format(CWD
)
179 tgen
= Topogen(json_file
, mod
.__name
__)
181 topo
= tgen
.json_topo
182 # ... and here it calls Mininet initialization functions.
184 # get list of daemons needs to be started for this suite.
185 daemons
= topo_daemons(tgen
, topo
)
187 # Starting topology, create tmp files which are loaded to routers
188 # to start deamons and then start routers
189 start_topology(tgen
, daemons
)
191 # Don"t run this test if we have any failure.
192 if tgen
.routers_have_failure():
193 pytest
.skip(tgen
.errors
)
195 # Creating configuration from JSON
196 build_config_from_json(tgen
, topo
)
198 logger
.info("Running setup_module() done")
201 def teardown_module():
202 """Teardown the pytest environment"""
204 logger
.info("Running teardown_module to delete topology")
208 # Kill any iperfs we left running.
211 # Stop toplogy and Remove tmp files
215 "Testsuite end time: {}".format(time
.asctime(time
.localtime(time
.time())))
217 logger
.info("=" * 40)
220 #####################################################
224 #####################################################
227 def config_to_send_igmp_join_and_traffic(
228 tgen
, topo
, tc_name
, iperf
, iperf_intf
, GROUP_RANGE
, join
=False, traffic
=False
231 API to do pre-configuration to send IGMP join and multicast
236 * `tgen`: topogen object
237 * `topo`: input json data
238 * `tc_name`: caller test case name
239 * `iperf`: router running iperf
240 * `iperf_intf`: interface name router running iperf
241 * `GROUP_RANGE`: group range
242 * `join`: IGMP join, default False
243 * `traffic`: multicast traffic, default False
247 # Add route to kernal
248 result
= addKernelRoute(tgen
, iperf
, iperf_intf
, GROUP_RANGE
)
249 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
252 # Add route to kernal
253 result
= addKernelRoute(tgen
, iperf
, iperf_intf
, GROUP_RANGE
)
254 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
256 router_list
= tgen
.routers()
257 for router
in router_list
.keys():
261 rnode
= router_list
[router
]
262 rnode
.run("echo 2 > /proc/sys/net/ipv4/conf/all/rp_filter")
267 def verify_state_incremented(state_before
, state_after
):
269 API to compare interface traffic state incrementing
273 * `state_before` : State dictionary for any particular instance
274 * `state_after` : State dictionary for any particular instance
277 for router
, state_data
in state_before
.items():
278 for state
, value
in state_data
.items():
279 if state_before
[router
][state
] >= state_after
[router
][state
]:
281 "[DUT: %s]: state %s value has not"
282 " incremented, Initial value: %s, "
283 "Current value: %s [FAILED!!]"
287 state_before
[router
][state
],
288 state_after
[router
][state
],
294 "[DUT: %s]: State %s value is "
295 "incremented, Initial value: %s, Current value: %s"
299 state_before
[router
][state
],
300 state_after
[router
][state
],
306 def test_verify_mroute_and_traffic_when_pimd_restarted_p2(request
):
308 TC_17: Verify (*,G) and (S,G) present and multicast traffic resume,
309 after restart of PIMd daemon
313 tc_name
= request
.node
.name
314 write_test_header(tc_name
)
316 # Don"t run this test if we have any failure.
317 if tgen
.routers_have_failure():
318 pytest
.skip(tgen
.errors
)
320 # Creating configuration from JSON
322 clear_ip_mroute(tgen
)
323 reset_config_on_routers(tgen
)
324 clear_ip_pim_interface_traffic(tgen
, topo
)
326 step("Configure static RP for (226.1.1.1-5) in c1")
327 step("Configure static RP for (232.1.1.1-5) in c2")
329 _GROUP_RANGE
= GROUP_RANGE_2
+ GROUP_RANGE_3
330 _IGMP_JOIN_RANGE
= IGMP_JOIN_RANGE_2
+ IGMP_JOIN_RANGE_3
337 "rp_addr": topo
["routers"]["c1"]["links"]["lo"]["ipv4"].split(
340 "group_addr_range": GROUP_RANGE_2
,
349 "rp_addr": topo
["routers"]["c2"]["links"]["lo"]["ipv4"].split(
352 "group_addr_range": GROUP_RANGE_3
,
359 result
= create_pim_config(tgen
, topo
, input_dict
)
360 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
363 "Enable IGMP on FRR1 interface and send IGMP join "
364 "(226.1.1.1-5) and (232.1.1.1-5)"
367 "Configure IGMP interface on FRR3 and send IGMP join"
368 " for group (226.1.1.1-5, 232.1.1.1-5)"
372 "f1": {"igmp": {"interfaces": {"f1-i8-eth2": {"igmp": {"version": "2"}}}}}
374 result
= create_igmp_config(tgen
, topo
, input_dict
)
375 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
377 input_join
= {"i1": "i1-l1-eth0", "i8": "i8-f1-eth0"}
379 for recvr
, recvr_intf
in input_join
.items():
380 result
= config_to_send_igmp_join_and_traffic(
381 tgen
, topo
, tc_name
, recvr
, recvr_intf
, _GROUP_RANGE
, join
=True
383 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
385 result
= iperfSendIGMPJoin(tgen
, recvr
, _IGMP_JOIN_RANGE
, join_interval
=1)
386 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
389 "Connect one source to c2 and send multicast traffic all"
390 " the receivers (226.1.1.1-5, 232.1.1.1-5)"
393 "Send multicast traffic from FRR3 to all the receivers "
394 "(226.1.1.1-5, 232.1.1.1-5)"
397 input_src
= {"i2": "i2-f1-eth0", "i5": "i5-c2-eth0"}
399 for src
, src_intf
in input_src
.items():
400 result
= config_to_send_igmp_join_and_traffic(
401 tgen
, topo
, tc_name
, src
, src_intf
, _GROUP_RANGE
, traffic
=True
403 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
405 result
= iperfSendTraffic(tgen
, src
, _IGMP_JOIN_RANGE
, 32, 2500)
406 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
408 # Verifying mroutes before PIMd restart, fetching uptime
410 source
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
412 {"dut": "f1", "src_address": "*", "iif": "f1-c2-eth0", "oil": "f1-i8-eth2"},
413 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "f1-i8-eth2"},
415 for data
in input_dict
:
416 result
= verify_ip_mroutes(
424 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
426 for data
in input_dict
:
427 result
= verify_upstream_iif(
428 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
430 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
432 step("Restart Pimd process on FRR3 node")
433 kill_router_daemons(tgen
, "f1", ["pimd"])
434 start_router_daemons(tgen
, "f1", ["pimd"])
436 for data
in input_dict
:
437 result
= verify_ip_mroutes(
445 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
448 "After restart of PIMd verify pim nbr is up , IGMP groups"
449 " received , and (*,G) (S,G) entries populated again ,"
450 " Verify using 'show ip pim neighbor' , 'show ip igmp groups'"
454 result
= verify_pim_neighbors(tgen
, topo
)
455 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
458 interface
= "f1-i8-eth2"
459 result
= verify_igmp_groups(tgen
, dut
, interface
, _IGMP_JOIN_RANGE
)
460 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
462 for data
in input_dict
:
463 result
= verify_upstream_iif(
464 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
466 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
468 step("Stop the traffic and restart PIMd immediately on FRR3 node")
471 shutdown_bringup_interface(tgen
, dut
, intf
, False)
473 kill_router_daemons(tgen
, "f1", ["pimd"])
474 start_router_daemons(tgen
, "f1", ["pimd"])
477 "After PIM process come , all the none of (S,G) mroute should"
478 " present on FRR3 'show ip mroute' "
482 {"dut": "f1", "src_address": "*", "iif": "f1-c2-eth0", "oil": "f1-i8-eth2"}
484 for data
in input_dict
:
485 result
= verify_ip_mroutes(
493 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
496 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "none"}
498 for data
in input_dict
:
499 result
= verify_ip_mroutes(
510 ), "Testcase {} : Failed \n mroutes are still present \n Error: {}".format(
513 logger
.info("Expected Behavior: {}".format(result
))
515 write_test_footer(tc_name
)
518 def test_verify_mroute_and_traffic_when_frr_restarted_p2(request
):
520 TC_18: Verify (*,G) and (S,G) present and multicast traffic resume after
521 FRR service stop and start
525 tc_name
= request
.node
.name
526 write_test_header(tc_name
)
528 # Don"t run this test if we have any failure.
529 if tgen
.routers_have_failure():
530 pytest
.skip(tgen
.errors
)
532 # Creating configuration from JSON
534 clear_ip_mroute(tgen
)
535 reset_config_on_routers(tgen
)
536 clear_ip_pim_interface_traffic(tgen
, topo
)
538 step("Configure static RP for (226.1.1.1-5) in c1")
539 step("Configure static RP for (232.1.1.1-5) in c2")
541 _GROUP_RANGE
= GROUP_RANGE_2
+ GROUP_RANGE_3
542 _IGMP_JOIN_RANGE
= IGMP_JOIN_RANGE_2
+ IGMP_JOIN_RANGE_3
549 "rp_addr": topo
["routers"]["c1"]["links"]["lo"]["ipv4"].split(
552 "group_addr_range": GROUP_RANGE_2
,
561 "rp_addr": topo
["routers"]["c2"]["links"]["lo"]["ipv4"].split(
564 "group_addr_range": GROUP_RANGE_3
,
571 result
= create_pim_config(tgen
, topo
, input_dict
)
572 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
575 "Enable IGMP on FRR1 interface and send IGMP join "
576 "(226.1.1.1-5) and (232.1.1.1-5)"
579 "Configure IGMP interface on FRR3 and send IGMP join"
580 " for group (226.1.1.1-5, 232.1.1.1-5)"
584 "f1": {"igmp": {"interfaces": {"f1-i8-eth2": {"igmp": {"version": "2"}}}}}
586 result
= create_igmp_config(tgen
, topo
, input_dict
)
587 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
589 input_join
= {"i1": "i1-l1-eth0", "i8": "i8-f1-eth0"}
591 for recvr
, recvr_intf
in input_join
.items():
592 result
= config_to_send_igmp_join_and_traffic(
593 tgen
, topo
, tc_name
, recvr
, recvr_intf
, _GROUP_RANGE
, join
=True
595 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
597 result
= iperfSendIGMPJoin(tgen
, recvr
, _IGMP_JOIN_RANGE
, join_interval
=1)
598 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
601 "Connect one source to c2 and send multicast traffic all"
602 " the receivers (226.1.1.1-5, 232.1.1.1-5)"
605 "Send multicast traffic from FRR3 to all the receivers "
606 "(226.1.1.1-5, 232.1.1.1-5)"
609 input_src
= {"i2": "i2-f1-eth0", "i5": "i5-c2-eth0"}
611 for src
, src_intf
in input_src
.items():
612 result
= config_to_send_igmp_join_and_traffic(
613 tgen
, topo
, tc_name
, src
, src_intf
, _GROUP_RANGE
, traffic
=True
615 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
617 result
= iperfSendTraffic(tgen
, src
, _IGMP_JOIN_RANGE
, 32, 2500)
618 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
620 step("Verifying mroutes before FRR restart, fetching uptime")
622 source
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
624 {"dut": "f1", "src_address": "*", "iif": "f1-c2-eth0", "oil": "f1-i8-eth2"},
625 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "f1-i8-eth2"},
627 for data
in input_dict
:
628 result
= verify_ip_mroutes(
636 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
638 for data
in input_dict
:
639 result
= verify_upstream_iif(
640 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
642 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
644 step("Stop and Start the FRR services on FRR3 node")
645 stop_router(tgen
, "f1")
646 start_router(tgen
, "f1")
648 for data
in input_dict
:
649 result
= verify_ip_mroutes(
657 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
660 "After stop and start of FRR service verify pim nbr is up "
661 "IGMP groups received , and (*,G) (S,G) entries populated again"
662 " Verify using 'show ip pim neighbor' , 'show ip igmp groups'"
666 result
= verify_pim_neighbors(tgen
, topo
)
667 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
670 interface
= "f1-i8-eth2"
671 result
= verify_igmp_groups(tgen
, dut
, interface
, _IGMP_JOIN_RANGE
)
672 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
674 for data
in input_dict
:
675 result
= verify_upstream_iif(
676 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
678 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
680 step("Stop the traffic and stop and start the FRR services on" " FRR3 node")
681 shutdown_bringup_interface(tgen
, "i2", "i2-f1-eth0", False)
683 stop_router(tgen
, "f1")
684 start_router(tgen
, "f1")
687 "After stop and start of FRR services , all the none of (S,G)"
688 " mroute should present on FRR3 node verify using "
693 {"dut": "f1", "src_address": "*", "iif": "f1-c2-eth0", "oil": "f1-i8-eth2"}
695 for data
in input_dict
:
696 result
= verify_ip_mroutes(
704 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
707 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "none"}
709 for data
in input_dict
:
710 result
= verify_ip_mroutes(
721 ), "Testcase {} : Failed \n mroutes are still present \n Error: {}".format(
724 logger
.info("Expected Behavior: {}".format(result
))
726 write_test_footer(tc_name
)
729 def test_verify_SPT_switchover_when_RPT_and_SPT_path_is_different_p0(request
):
731 TC_10: Verify SPT switchover working when RPT and SPT path is
736 tc_name
= request
.node
.name
737 write_test_header(tc_name
)
739 # Don"t run this test if we have any failure.
740 if tgen
.routers_have_failure():
741 pytest
.skip(tgen
.errors
)
743 # Creating configuration from JSON
745 clear_ip_mroute(tgen
)
746 reset_config_on_routers(tgen
)
747 clear_ip_pim_interface_traffic(tgen
, topo
)
749 step("Configure static RP for (226.1.1.1-5) and " "(232.1.1.1-5) in c2")
751 _GROUP_RANGE
= GROUP_RANGE_2
+ GROUP_RANGE_3
752 _IGMP_JOIN_RANGE
= IGMP_JOIN_RANGE_2
+ IGMP_JOIN_RANGE_3
759 "rp_addr": topo
["routers"]["c2"]["links"]["lo"]["ipv4"].split(
762 "group_addr_range": _GROUP_RANGE
,
769 result
= create_pim_config(tgen
, topo
, input_dict
)
770 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
773 "Enable IGMP on FRR1 interface and send IGMP join "
774 "(226.1.1.1-5) and (232.1.1.1-5)"
777 result
= config_to_send_igmp_join_and_traffic(
778 tgen
, topo
, tc_name
, "i1", "i1-l1-eth0", _GROUP_RANGE
, join
=True
780 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
782 result
= iperfSendIGMPJoin(tgen
, "i1", _IGMP_JOIN_RANGE
, join_interval
=1)
783 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
785 step("Send multicast traffic from FRR3 to '226.1.1.1-5'" ", '232.1.1.1-5' receiver")
787 result
= config_to_send_igmp_join_and_traffic(
788 tgen
, topo
, tc_name
, "i2", "i2-f1-eth0", _GROUP_RANGE
, traffic
=True
790 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
792 step("registerRx and registerStopTx value before traffic sent")
793 state_dict
= {"c2": {"c2-f1-eth1": ["registerRx", "registerStopTx"]}}
794 state_before
= verify_pim_interface_traffic(tgen
, state_dict
)
797 ), "Testcase {} : Failed \n state_before is not dictionary \nError: {}".format(
801 result
= iperfSendTraffic(tgen
, "i2", _IGMP_JOIN_RANGE
, 32, 2500)
802 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
805 "Verify in FRR3 sending initial packet to RP using"
806 " 'show ip mroute' and mroute OIL is towards RP."
809 result
= verify_ip_mroutes(
815 ["f1-c2-eth0", "f1-r2-eth3"],
817 assert result
is True, "Testcase {} : " "Failed Error: {}".format(tc_name
, result
)
819 result
= verify_ip_mroutes(
820 tgen
, "f1", "10.0.5.2", _IGMP_JOIN_RANGE
, "f1-i2-eth1", "f1-r2-eth3"
822 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
825 " After spt switchover traffic is flowing between"
826 " (LHR(FRR1)-FHR(FRR3)) and (S,G) OIL is updated toward FRR1"
827 " 'show ip mroute' and 'show ip pim upstream'"
830 source
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
832 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "f1-r2-eth3"},
833 {"dut": "l1", "src_address": source
, "iif": "l1-r2-eth4", "oil": "l1-i1-eth1"},
835 for data
in input_dict
:
836 result
= verify_ip_mroutes(
844 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
846 for data
in input_dict
:
847 result
= verify_upstream_iif(
848 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
850 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
852 step("Stop the traffic to all the receivers")
854 kill_iperf(tgen
, "i2", "remove_traffic")
857 "Null register packet being send periodically from FRR3 to RP, "
858 "verify using show ip mroute on RP, have (S, G) entries null OIL"
859 " 'show ip mroute' and verify show ip pim interface traffic"
860 "(In RP Register msg should be received and Register stop should"
864 {"dut": "c2", "src_address": source
, "iif": "c2-f1-eth1", "oil": "none"}
866 for data
in input_dict
:
867 result
= verify_ip_mroutes(
875 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
877 step("registerRx and registerStopTx value after traffic sent")
878 state_after
= verify_pim_interface_traffic(tgen
, state_dict
)
881 ), "Testcase {} : Failed \n state_before is not dictionary \nError: {}".format(
885 result
= verify_state_incremented(state_before
, state_after
)
886 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
888 write_test_footer(tc_name
)
891 def test_verify_mroute_after_shut_noshut_of_upstream_interface_p1(request
):
893 TC_15: Verify (S,G) and (*,G) mroute after shut / no shut of upstream
898 tc_name
= request
.node
.name
899 write_test_header(tc_name
)
901 # Don"t run this test if we have any failure.
902 if tgen
.routers_have_failure():
903 pytest
.skip(tgen
.errors
)
905 # Creating configuration from JSON
907 clear_ip_mroute(tgen
)
908 reset_config_on_routers(tgen
)
909 clear_ip_pim_interface_traffic(tgen
, topo
)
911 step("Configure static RP for (226.1.1.1-5) in c1")
912 step("Configure static RP for (232.1.1.1-5) in c2")
914 _GROUP_RANGE
= GROUP_RANGE_2
+ GROUP_RANGE_3
915 _IGMP_JOIN_RANGE
= IGMP_JOIN_RANGE_2
+ IGMP_JOIN_RANGE_3
922 "rp_addr": topo
["routers"]["c1"]["links"]["lo"]["ipv4"].split(
925 "group_addr_range": GROUP_RANGE_2
,
934 "rp_addr": topo
["routers"]["c2"]["links"]["lo"]["ipv4"].split(
937 "group_addr_range": GROUP_RANGE_3
,
944 result
= create_pim_config(tgen
, topo
, input_dict
)
945 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
948 "Enable IGMP on FRR1 interface and send IGMP join "
949 "(226.1.1.1-5) and (232.1.1.1-5)"
952 "Configure IGMP interface on FRR3 and send IGMP join"
953 " for group (226.1.1.1-5, 232.1.1.1-5)"
957 "f1": {"igmp": {"interfaces": {"f1-i8-eth2": {"igmp": {"version": "2"}}}}}
959 result
= create_igmp_config(tgen
, topo
, input_dict
)
960 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
962 input_join
= {"i1": "i1-l1-eth0", "i8": "i8-f1-eth0"}
964 for recvr
, recvr_intf
in input_join
.items():
965 result
= config_to_send_igmp_join_and_traffic(
966 tgen
, topo
, tc_name
, recvr
, recvr_intf
, _GROUP_RANGE
, join
=True
968 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
970 result
= iperfSendIGMPJoin(tgen
, recvr
, _IGMP_JOIN_RANGE
, join_interval
=1)
971 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
974 "Connect one source to c2 and send multicast traffic all"
975 " the receivers (226.1.1.1-5, 232.1.1.1-5)"
978 "Send multicast traffic from FRR3 to all the receivers "
979 "(226.1.1.1-5, 232.1.1.1-5)"
982 input_src
= {"i2": "i2-f1-eth0", "i5": "i5-c2-eth0"}
984 for src
, src_intf
in input_src
.items():
985 result
= config_to_send_igmp_join_and_traffic(
986 tgen
, topo
, tc_name
, src
, src_intf
, _GROUP_RANGE
, traffic
=True
988 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
990 result
= iperfSendTraffic(tgen
, src
, _IGMP_JOIN_RANGE
, 32, 2500)
991 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
994 "FRR3 (S,G) has one OIL for local receiver one toward c2"
995 " verify 'show ip mroute' and 'show ip pim upstream'"
998 source
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
1000 {"dut": "f1", "src_address": "*", "iif": "f1-c2-eth0", "oil": "f1-i8-eth2"},
1001 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "f1-i8-eth2"},
1003 for data
in input_dict
:
1004 result
= verify_ip_mroutes(
1007 data
["src_address"],
1012 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1014 for data
in input_dict
:
1015 result
= verify_upstream_iif(
1016 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_2
1018 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1020 step("Shut and No shut interface connected from FHR (FRR3)" " to c2")
1023 shutdown_bringup_interface(tgen
, dut
, intf
, False)
1024 shutdown_bringup_interface(tgen
, dut
, intf
, True)
1026 step("Shut and No shut interface connected from LHR (FRR1)" " to c1")
1029 shutdown_bringup_interface(tgen
, dut
, intf
, False)
1030 shutdown_bringup_interface(tgen
, dut
, intf
, True)
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
)
1043 step("Shut and No shut FRR1 and FRR3 interface")
1044 shutdown_bringup_interface(tgen
, "l1", "l1-r2-eth4", False)
1045 shutdown_bringup_interface(tgen
, dut
, intf
, True)
1047 shutdown_bringup_interface(tgen
, "f1", "f1-r2-eth3", False)
1048 shutdown_bringup_interface(tgen
, dut
, intf
, True)
1051 "After shut/no shut of interface , verify traffic resume to all"
1052 "the receivers (S,G) OIL update for all the receivers"
1055 for data
in input_dict
:
1056 result
= verify_ip_mroutes(
1059 data
["src_address"],
1064 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1067 "Shut FRR1, FRR3 interface , clear mroute in FRR1"
1068 " and No shut FRR1, FRR3 interface "
1072 shutdown_bringup_interface(tgen
, dut
, intf
, False)
1076 shutdown_bringup_interface(tgen
, dut
, intf
, False)
1080 shutdown_bringup_interface(tgen
, dut
, intf
, True)
1084 shutdown_bringup_interface(tgen
, dut
, intf
, True)
1086 clear_ip_mroute(tgen
, "l1")
1087 clear_ip_mroute(tgen
, "l1")
1090 "After no shut, verify traffic resume to all the receivers"
1091 " (S,G) OIL update for all the receivers"
1094 for data
in input_dict
:
1095 result
= verify_ip_mroutes(
1098 data
["src_address"],
1103 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1106 "Shut and no shut upstream interface from FRR1 to FRR2 and "
1107 "cisco immediate after mroute/upstream got cleared"
1111 intf_l1_r2
= "l1-r2-eth4"
1112 shutdown_bringup_interface(tgen
, dut
, intf_l1_r2
, False)
1114 intf_l1_c1
= "l1-c1-eth0"
1115 shutdown_bringup_interface(tgen
, dut
, intf_l1_c1
, False)
1118 result
= verify_upstream_iif(
1119 tgen
, "l1", "Unknown", source
, IGMP_JOIN_RANGE_2
, expected
=False
1121 assert result
is not True, (
1122 "Testcase {} : Failed Error: \n "
1123 "mroutes are still present, after waiting for 10 mins".format(tc_name
)
1126 step("No shut the Source interface just after the upstream is expired" " from FRR1")
1127 shutdown_bringup_interface(tgen
, dut
, intf_l1_r2
, True)
1128 shutdown_bringup_interface(tgen
, dut
, intf_l1_c1
, True)
1130 for data
in input_dict
:
1131 result
= verify_ip_mroutes(
1134 data
["src_address"],
1139 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1141 step("Stop the traffic to all the receivers")
1144 for data
in input_dict
:
1145 result
= verify_ip_mroutes(
1148 data
["src_address"],
1156 ), "Testcase {} : Failed \n mroutes are still present \n Error: {}".format(
1159 logger
.info("Expected Behavior: {}".format(result
))
1161 write_test_footer(tc_name
)
1164 def test_verify_mroute_when_receiver_is_outside_frr_p0(request
):
1166 TC_7: Verify mroute detail when receiver is present
1170 tgen
= get_topogen()
1171 tc_name
= request
.node
.name
1172 write_test_header(tc_name
)
1174 # Don"t run this test if we have any failure.
1175 if tgen
.routers_have_failure():
1176 pytest
.skip(tgen
.errors
)
1178 # Creating configuration from JSON
1180 clear_ip_mroute(tgen
)
1181 reset_config_on_routers(tgen
)
1182 clear_ip_pim_interface_traffic(tgen
, topo
)
1184 step("Configure static RP on c1 for group range " "(226.1.1.1-5) and (232.1.1.1-5)")
1186 _GROUP_RANGE
= GROUP_RANGE_2
+ GROUP_RANGE_3
1187 _IGMP_JOIN_RANGE
= IGMP_JOIN_RANGE_2
+ IGMP_JOIN_RANGE_3
1194 "rp_addr": topo
["routers"]["c1"]["links"]["lo"]["ipv4"].split(
1197 "group_addr_range": _GROUP_RANGE
,
1204 result
= create_pim_config(tgen
, topo
, input_dict
)
1205 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1208 "Enable IGMP on FRR1 interface and send IGMP join"
1209 " (226.1.1.1-5) and (232.1.1.1-5)"
1211 result
= config_to_send_igmp_join_and_traffic(
1212 tgen
, topo
, tc_name
, "i1", "i1-l1-eth0", _GROUP_RANGE
, join
=True
1214 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1216 result
= iperfSendIGMPJoin(tgen
, "i1", _IGMP_JOIN_RANGE
, join_interval
=1)
1217 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1220 "Send multicast traffic from FRR3 to all the receivers "
1221 "(226.1.1.1-5) and (232.1.1.1-5)"
1223 result
= config_to_send_igmp_join_and_traffic(
1224 tgen
, topo
, tc_name
, "i2", "i2-f1-eth0", _GROUP_RANGE
, traffic
=True
1226 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1228 result
= iperfSendTraffic(tgen
, "i2", _IGMP_JOIN_RANGE
, 32, 2500)
1229 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1232 "Configure one more receiver in c2 enable IGMP and send"
1233 " join (226.1.1.1-5) and (232.1.1.1-5)"
1236 "c2": {"igmp": {"interfaces": {"c2-i5-eth2": {"igmp": {"version": "2"}}}}}
1238 result
= create_igmp_config(tgen
, topo
, input_dict
)
1239 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1241 result
= config_to_send_igmp_join_and_traffic(
1242 tgen
, topo
, tc_name
, "i5", "i5-c2-eth0", _GROUP_RANGE
, join
=True
1244 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1246 result
= iperfSendIGMPJoin(tgen
, "i5", _IGMP_JOIN_RANGE
, join_interval
=1)
1247 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1249 step("FRR1 has 10 (*.G) and 10 (S,G) verify using 'show ip mroute count'")
1251 "All the receiver are receiving traffic on FRR1 and (S,G) OIL is toward"
1252 "receivers, verify using 'show ip mroute' 'show ip pim upstream'"
1255 "All the receiver are receiving traffic on c2 and (S,G) OIL is "
1256 "toward receivers, verify using 'show ip mroute' 'show ip pim upstream'"
1259 source
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
1261 {"dut": "l1", "src_address": "*", "iif": "l1-c1-eth0", "oil": "l1-i1-eth1"},
1262 {"dut": "l1", "src_address": source
, "iif": "l1-r2-eth4", "oil": "l1-i1-eth1"},
1263 {"dut": "c2", "src_address": "*", "iif": "c2-c1-eth0", "oil": "c2-i5-eth2"},
1264 {"dut": "c2", "src_address": source
, "iif": "c2-f1-eth1", "oil": "c2-i5-eth2"},
1266 for data
in input_dict
:
1267 result
= verify_ip_mroutes(
1270 data
["src_address"],
1275 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1278 "FRR3 has (S,G) OIL created toward c1/c2 receiver and FRR1 receiver"
1279 "'show ip pim state'"
1282 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "f1-c2-eth0"},
1283 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "f1-r2-eth3"},
1285 for data
in input_dict
:
1286 result
= verify_pim_state(
1292 data
["src_address"],
1294 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1296 for data
in input_dict
:
1297 result
= verify_upstream_iif(
1298 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
1300 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1302 write_test_footer(tc_name
)
1305 def test_verify_mroute_when_FRR_is_FHR_and_LHR_p0(request
):
1307 TC_8: Verify mroute when FRR is acting as FHR and LHR
1310 tgen
= get_topogen()
1311 tc_name
= request
.node
.name
1312 write_test_header(tc_name
)
1314 # Don"t run this test if we have any failure.
1315 if tgen
.routers_have_failure():
1316 pytest
.skip(tgen
.errors
)
1318 # Creating configuration from JSON
1320 clear_ip_mroute(tgen
)
1321 reset_config_on_routers(tgen
)
1322 clear_ip_pim_interface_traffic(tgen
, topo
)
1324 step("Configure static RP for group range (226.1.1.1-5) and " "(232.1.1.1-5) on c1")
1325 _GROUP_RANGE
= GROUP_RANGE_2
+ GROUP_RANGE_3
1326 _IGMP_JOIN_RANGE
= IGMP_JOIN_RANGE_2
+ IGMP_JOIN_RANGE_3
1333 "rp_addr": topo
["routers"]["c1"]["links"]["lo"]["ipv4"].split(
1336 "group_addr_range": _GROUP_RANGE
,
1343 result
= create_pim_config(tgen
, topo
, input_dict
)
1344 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1347 "Enable IGMP on FRR1 interface and send IGMP join (226.1.1.1-5)"
1348 " and (232.1.1.1-5)"
1351 "Configure receiver on FRR3 with igmp and pim enabled and "
1352 "send IGMP join (226.1.1.1-5) and (232.1.1.1-5)"
1355 "Send multicast traffic from FRR3 to all the receivers "
1356 "(226.1.1.1-5) and (232.1.1.1-5)"
1359 result
= config_to_send_igmp_join_and_traffic(
1360 tgen
, topo
, tc_name
, "i1", "i1-l1-eth0", _GROUP_RANGE
, join
=True
1362 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1364 result
= config_to_send_igmp_join_and_traffic(
1365 tgen
, topo
, tc_name
, "i2", "i2-f1-eth0", _GROUP_RANGE
, traffic
=True
1367 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1369 step("Send IGMP join (226.1.1.1-5, 232.1.1.1-5) to LHR(l1)")
1370 result
= iperfSendIGMPJoin(tgen
, "i1", _IGMP_JOIN_RANGE
, join_interval
=1)
1371 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1373 step("Send multicast traffic from FRR3 to '226.1.1.1-5'" ", '232.1.1.1-5' receiver")
1374 result
= iperfSendTraffic(tgen
, "i2", _IGMP_JOIN_RANGE
, 32, 2500)
1375 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1378 "Configure receiver in f1 enable IGMP and send"
1379 " join (226.1.1.1-5) and (232.1.1.1-5)"
1382 step("Configure one IGMP interface on f1 node and send IGMP" " join (225.1.1.1)")
1384 "f1": {"igmp": {"interfaces": {"f1-i8-eth2": {"igmp": {"version": "2"}}}}}
1386 result
= create_igmp_config(tgen
, topo
, input_dict
)
1387 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1389 result
= config_to_send_igmp_join_and_traffic(
1390 tgen
, topo
, tc_name
, "i8", "i8-f1-eth0", _GROUP_RANGE
, join
=True
1392 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1394 result
= iperfSendIGMPJoin(tgen
, "i8", _IGMP_JOIN_RANGE
, join_interval
=1)
1395 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1397 "l1 and f1 has 10 IGMP groups (226.1.1.1-5, 232.1.1.1-5),"
1398 " verify using 'show ip igmp groups'"
1401 interface
= "l1-i1-eth1"
1402 result
= verify_igmp_groups(tgen
, dut
, interface
, _IGMP_JOIN_RANGE
)
1403 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1406 interface
= "f1-i8-eth2"
1407 result
= verify_igmp_groups(tgen
, dut
, interface
, _IGMP_JOIN_RANGE
)
1408 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1411 "l1 , f1 has 10 (*,G) and 10 (S,G) for groups "
1412 "(226.1.1.1-5, 232.1.1.1-5), verify using "
1416 source
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
1418 {"dut": "f1", "src_address": "*", "iif": "f1-c2-eth0", "oil": "f1-i8-eth2"},
1419 {"dut": "f1", "src_address": source
, "iif": "f1-i2-eth1", "oil": "f1-r2-eth3"},
1420 {"dut": "l1", "src_address": "*", "iif": "l1-c1-eth0", "oil": "l1-i1-eth1"},
1421 {"dut": "l1", "src_address": source
, "iif": "l1-r2-eth4", "oil": "l1-i1-eth1"},
1423 for data
in input_dict
:
1424 result
= verify_ip_mroutes(
1427 data
["src_address"],
1432 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1434 step("Join timer is running in FHR and LHR , verify using" " 'show ip pim state'")
1436 for data
in input_dict
:
1437 result
= verify_pim_state(
1443 data
["src_address"],
1445 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1447 # Stop the multicast traffic
1448 step("Stop the traffic to all the receivers")
1452 "After traffic stopped , verify (*,G) entries are not flushed"
1453 " out from FRR1 node verify using 'show ip mroute' "
1457 {"dut": "f1", "src_address": "*", "iif": "f1-c2-eth0", "oil": "f1-i8-eth2"},
1458 {"dut": "l1", "src_address": "*", "iif": "l1-c1-eth0", "oil": "l1-i1-eth1"},
1460 for data
in input_dict
:
1461 result
= verify_ip_mroutes(
1464 data
["src_address"],
1469 assert result
is True, (
1470 "Testcase {} : Failed Error mroutes were flushed.".format(tc_name
)
1474 "After traffic stopped , verify (S,G) entries are flushed out"
1475 " from FRR1 node verify using 'show ip mroute' "
1479 {"dut": "l1", "src_address": source
, "iif": "l1-r2-eth4", "oil": "l1-i1-eth1"},
1480 {"dut": "f1", "src_address": source
, "iif": "i2-f1-eth0", "oil": "f1-r2-eth3"},
1483 for data
in input_dict
:
1484 result
= verify_ip_mroutes(
1487 data
["src_address"],
1493 assert result
is not True, (
1494 "Testcase {} : Failed Error: \nmroutes are still present".format(tc_name
)
1497 write_test_footer(tc_name
)
1500 def test_verify_mroute_when_5_different_receiver_joining_same_sources_p0(request
):
1502 TC_20: Verify mroute detail when 5 different receiver joining
1506 tgen
= get_topogen()
1507 tc_name
= request
.node
.name
1508 write_test_header(tc_name
)
1510 # Don"t run this test if we have any failure.
1511 if tgen
.routers_have_failure():
1512 pytest
.skip(tgen
.errors
)
1514 # Creating configuration from JSON
1516 clear_ip_mroute(tgen
)
1517 reset_config_on_routers(tgen
)
1518 clear_ip_pim_interface_traffic(tgen
, topo
)
1520 step("Configure static RP for (226.1.1.1-5) in c1")
1521 step("Configure static RP for (232.1.1.1-5) in c2")
1523 _GROUP_RANGE
= GROUP_RANGE_2
+ GROUP_RANGE_3
1524 _IGMP_JOIN_RANGE
= IGMP_JOIN_RANGE_2
+ IGMP_JOIN_RANGE_3
1531 "rp_addr": topo
["routers"]["c1"]["links"]["lo"]["ipv4"].split(
1534 "group_addr_range": GROUP_RANGE_2
,
1543 "rp_addr": topo
["routers"]["c2"]["links"]["lo"]["ipv4"].split(
1546 "group_addr_range": GROUP_RANGE_3
,
1553 result
= create_pim_config(tgen
, topo
, input_dict
)
1554 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1557 "Configure 2 IGMP interface on FRR1 and send IGMP join"
1558 "for group (226.1.1.1-5, 232.1.1.1-5) from both the interface"
1561 "Configure 2 IGMP interface on FRR3 and send IGMP join for"
1562 " group (226.1.1.1-5, 232.1.1.1-5) from both the interface"
1565 "Configure 1 IGMP interface on c2 and send IGMP join for"
1566 "group (226.1.1.1-5, 232.1.1.1-5)"
1573 "f1-i8-eth2": {"igmp": {"version": "2"}},
1574 "f1-i2-eth1": {"igmp": {"version": "2"}},
1578 "l1": {"igmp": {"interfaces": {"l1-i6-eth2": {"igmp": {"version": "2"}}}}},
1580 result
= create_igmp_config(tgen
, topo
, input_dict
)
1581 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1590 for recvr
, recvr_intf
in input_join
.items():
1591 result
= config_to_send_igmp_join_and_traffic(
1592 tgen
, topo
, tc_name
, recvr
, recvr_intf
, _GROUP_RANGE
, join
=True
1594 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1596 result
= iperfSendIGMPJoin(tgen
, recvr
, _IGMP_JOIN_RANGE
, join_interval
=1)
1597 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1598 step("Configure one source in FRR2 , one in c1")
1600 "Send multicast traffic from both the sources to all the"
1601 "receivers (226.1.1.1-5, 232.1.1.1-5)"
1604 input_src
= {"i3": "i3-r2-eth0"}
1606 for src
, src_intf
in input_src
.items():
1607 result
= config_to_send_igmp_join_and_traffic(
1608 tgen
, topo
, tc_name
, src
, src_intf
, _GROUP_RANGE
, traffic
=True
1610 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1612 result
= iperfSendTraffic(tgen
, src
, _IGMP_JOIN_RANGE
, 32, 2500)
1613 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1615 "After all the IGMP groups received with correct port using"
1616 " 'show ip igmp groups' in FRR1, FRR3, c2"
1619 interface
= "l1-i6-eth2"
1620 result
= verify_igmp_groups(tgen
, dut
, interface
, _IGMP_JOIN_RANGE
)
1621 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1624 interface
= "f1-i8-eth2"
1625 result
= verify_igmp_groups(tgen
, dut
, interface
, _IGMP_JOIN_RANGE
)
1626 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1629 "(*,G) entries got created with upstream interface RP connected"
1630 " port using 'show ip pim upstream' in FRR1, FRR3, c2"
1633 "(S,G) entries created for all the receiver after starting the"
1634 " source , traffic is reaching to all the receiver , verify OIL"
1635 " of (S,G) is receiver port using 'show ip mroute' in FRR1, "
1639 source
= topo
["routers"]["i3"]["links"]["r2"]["ipv4"].split("/")[0]
1641 {"dut": "l1", "src_address": source
, "iif": ["l1-r2-eth4", "l1-c1-eth0"],
1642 "oil": ["l1-i1-eth1", "l1-i6-eth2"]},
1643 {"dut": "f1", "src_address": source
, "iif": "f1-r2-eth3", "oil": "f1-i8-eth2"},
1645 for data
in input_dict_all
:
1646 result
= verify_ip_mroutes(
1649 data
["src_address"],
1654 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1656 for data
in input_dict_all
:
1657 result
= verify_upstream_iif(
1658 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
1660 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1662 step("Shut the receiver interface one by one on FRR1 node")
1663 shutdown_bringup_interface(tgen
, "l1", "l1-i1-eth1", False)
1664 shutdown_bringup_interface(tgen
, "l1", "l1-i6-eth2", False)
1667 "After shut the receiver port verify traffic is stopped immediately"
1668 " and (S,G) got timeout immediately in FRR1, FRR3, c2"
1671 {"dut": "l1", "src_address": source
, "iif": "l1-r2-eth4", "oil": "l1-i1-eth1"}
1673 for data
in input_dict
:
1674 result
= verify_ip_mroutes(
1677 data
["src_address"],
1685 ), "Testcase {} : Failed \n mroutes are still present \n Error: {}".format(
1688 logger
.info("Expected Behavior: {}".format(result
))
1691 "No traffic impact observed on other receivers verify using"
1692 " 'show ip mroute' "
1695 {"dut": "f1", "src_address": source
, "iif": "f1-r2-eth3", "oil": "f1-i8-eth2"}
1697 for data
in input_dict
:
1698 result
= verify_ip_mroutes(
1701 data
["src_address"],
1706 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1708 step("No shut the receiver interface one by one on FRR1 node")
1709 shutdown_bringup_interface(tgen
, "l1", "l1-i1-eth1", True)
1710 shutdown_bringup_interface(tgen
, "l1", "l1-i6-eth2", True)
1713 "After no shut of receivers all the mroute entries got populated"
1714 ", no duplicate entries present in mroute"
1717 for data
in input_dict_all
:
1718 result
= verify_ip_mroutes(
1721 data
["src_address"],
1726 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1728 write_test_footer(tc_name
)
1731 def test_verify_oil_iif_for_mroute_after_shut_noshut_source_interface_p1(request
):
1733 TC_22: Verify OIL and IIF detail updated in (S,G) mroute after shut
1734 and no shut of the source interface
1737 tgen
= get_topogen()
1738 tc_name
= request
.node
.name
1739 write_test_header(tc_name
)
1741 # Don"t run this test if we have any failure.
1742 if tgen
.routers_have_failure():
1743 pytest
.skip(tgen
.errors
)
1745 # Creating configuration from JSON
1747 clear_ip_mroute(tgen
)
1748 reset_config_on_routers(tgen
)
1749 clear_ip_pim_interface_traffic(tgen
, topo
)
1751 step("Configure static RP for (226.1.1.1-5) in c1")
1752 step("Configure static RP for (232.1.1.1-5) in c2")
1754 _GROUP_RANGE
= GROUP_RANGE_2
+ GROUP_RANGE_3
1755 _IGMP_JOIN_RANGE
= IGMP_JOIN_RANGE_2
+ IGMP_JOIN_RANGE_3
1762 "rp_addr": topo
["routers"]["c1"]["links"]["lo"]["ipv4"].split(
1765 "group_addr_range": GROUP_RANGE_2
,
1774 "rp_addr": topo
["routers"]["c2"]["links"]["lo"]["ipv4"].split(
1777 "group_addr_range": GROUP_RANGE_3
,
1784 result
= create_pim_config(tgen
, topo
, input_dict
)
1785 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1788 "Configure IGMP interface on FRR1 and FRR3 and send IGMP join"
1789 " for group (226.1.1.1-5, 232.1.1.1-5)"
1793 "f1": {"igmp": {"interfaces": {"f1-i8-eth2": {"igmp": {"version": "2"}}}}}
1795 result
= create_igmp_config(tgen
, topo
, input_dict
)
1796 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1798 input_join
= {"i1": "i1-l1-eth0", "i8": "i8-f1-eth0"}
1800 for recvr
, recvr_intf
in input_join
.items():
1801 result
= config_to_send_igmp_join_and_traffic(
1802 tgen
, topo
, tc_name
, recvr
, recvr_intf
, _GROUP_RANGE
, join
=True
1804 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1806 result
= iperfSendIGMPJoin(tgen
, recvr
, _IGMP_JOIN_RANGE
, join_interval
=1)
1807 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1809 step("Configure 1 source in FRR1 , 1 in FRR3")
1811 "Send multicast traffic from both the sources to all the "
1812 "receivers (226.1.1.1-5, 232.1.1.1-5)"
1815 input_src
= {"i6": "i6-l1-eth0", "i2": "i2-f1-eth0"}
1817 for src
, src_intf
in input_src
.items():
1818 result
= config_to_send_igmp_join_and_traffic(
1819 tgen
, topo
, tc_name
, src
, src_intf
, _GROUP_RANGE
, traffic
=True
1821 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1823 result
= iperfSendTraffic(tgen
, src
, _IGMP_JOIN_RANGE
, 32, 2500)
1824 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1827 "*,G) is created and (S,G) created on FRR1 and FRR3 for both"
1828 " the source verify using 'show ip mroute' and "
1829 " 'show ip pim upstream' to check the upstream interface"
1833 source_i6
= topo
["routers"]["i6"]["links"]["l1"]["ipv4"].split("/")[0]
1834 source_i2
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
1836 {"dut": "l1", "src_address": "*", "iif": "l1-c1-eth0", "oil": "l1-i1-eth1"},
1839 "src_address": source_i2
,
1840 "iif": "l1-r2-eth4",
1841 "oil": "l1-i1-eth1",
1845 "src_address": source_i6
,
1846 "iif": "l1-i6-eth2",
1847 "oil": "l1-i1-eth1",
1849 {"dut": "f1", "src_address": "*", "iif": "f1-c2-eth0", "oil": "f1-i8-eth2"},
1852 "src_address": source_i2
,
1853 "iif": "f1-i2-eth1",
1854 "oil": "f1-i8-eth2",
1858 "src_address": source_i6
,
1859 "iif": "f1-r2-eth3",
1860 "oil": "f1-i8-eth2",
1863 for data
in input_dict_all
:
1864 result
= verify_ip_mroutes(
1867 data
["src_address"],
1872 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1874 for data
in input_dict_all
:
1875 result
= verify_upstream_iif(
1876 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
1878 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1880 step("Shut the source interface one by one on FRR1")
1881 shutdown_bringup_interface(tgen
, "f1", "f1-i2-eth1", False)
1884 "After shut of ource interface from FRR3 verify all the (S,G) "
1885 "entries flushed out from FRR3 node 'show ip pim upstream' "
1886 " 'show ip mroute' "
1889 result
= verify_ip_mroutes(
1900 ), "Testcase {} : Failed \n mroutes are" " still present \n Error: {}".format(
1903 logger
.info("Expected Behavior: {}".format(result
))
1905 result
= verify_upstream_iif(
1906 tgen
, "f1", "Unknown", "10.0.5.2", _IGMP_JOIN_RANGE
, joinState
="NotJoined"
1908 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1910 write_test_footer(tc_name
)
1913 if __name__
== "__main__":
1914 args
= ["-s"] + sys
.argv
[1:]
1915 sys
.exit(pytest
.main(args
))