4 # Copyright (c) 2022 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 uplink:
26 1. Verify mroutes OIL and IIF updated correctly when receivers present inside
28 2. Verify mroutes OIL and IIF updated correctly when source present inside
30 3. Verify Mroutes and BSM forwarding when edge is transit node
31 4. Verify mroutes updated correctly after source interface shut/no shut
32 5. Verify mroutes updated correctly after receiver interface shut/no shut
33 6. Verify mroute updated correctly after sending IGMP prune and join
34 7. Verify mroute updated correctly after clear mroute
35 8. Verify (*,G) mroute entries after changing the RP configuration
36 9. Verify mroute entries after FRR service stop and start
45 # Save the Current Working Directory to find configuration files.
46 CWD
= os
.path
.dirname(os
.path
.realpath(__file__
))
47 sys
.path
.append(os
.path
.join(CWD
, "../"))
48 sys
.path
.append(os
.path
.join(CWD
, "../lib/"))
50 # Required to instantiate the topology builder class.
52 # pylint: disable=C0413
53 # Import topogen and topotest helpers
54 from lib
.topogen
import Topogen
, get_topogen
56 from lib
.common_config
import (
61 reset_config_on_routers
,
62 shutdown_bringup_interface
,
66 required_linux_kernel_version
,
68 from lib
.bgp
import create_router_bgp
74 clear_pim_interface_traffic
,
77 verify_multicast_traffic
,
79 verify_pim_interface_traffic
,
83 from lib
.topolog
import logger
84 from lib
.topojson
import build_config_from_json
94 IGMP_JOIN_RANGE_1
= ["225.1.1.1", "225.1.1.2", "225.1.1.3", "225.1.1.4", "225.1.1.5"]
102 IGMP_JOIN_RANGE_2
= ["226.1.1.1", "226.1.1.2", "226.1.1.3", "226.1.1.4", "226.1.1.5"]
110 IGMP_JOIN_RANGE_3
= ["227.1.1.1", "227.1.1.2", "227.1.1.3", "227.1.1.4", "227.1.1.5"]
122 pytestmark
= [pytest
.mark
.pimd
]
125 def setup_module(mod
):
127 Sets up the pytest environment
132 # Required linux kernel version for this suite to run.
133 result
= required_linux_kernel_version("4.19")
134 if result
is not True:
135 pytest
.skip("Kernel requirements are not met")
137 testsuite_run_time
= time
.asctime(time
.localtime(time
.time()))
138 logger
.info("Testsuite start time: {}".format(testsuite_run_time
))
139 logger
.info("=" * 40)
141 logger
.info("Running setup_module to create topology")
143 testdir
= os
.path
.dirname(os
.path
.realpath(__file__
))
144 json_file
= "{}/multicast_pim_uplink_topo1.json".format(testdir
)
145 tgen
= Topogen(json_file
, mod
.__name
__)
147 topo
= tgen
.json_topo
148 # ... and here it calls Mininet initialization functions.
150 # Starting topology, create tmp files which are loaded to routers
151 # to start deamons and then start routers
154 # Don"t run this test if we have any failure.
155 if tgen
.routers_have_failure():
156 pytest
.skip(tgen
.errors
)
158 # Creating configuration from JSON
159 build_config_from_json(tgen
, tgen
.json_topo
)
162 get_interfaces_names(topo
)
164 # XXX Replace this using "with McastTesterHelper()... " in each test if possible.
166 app_helper
= McastTesterHelper(tgen
)
168 logger
.info("Running setup_module() done")
171 def teardown_module():
172 """Teardown the pytest environment"""
174 logger
.info("Running teardown_module to delete topology")
180 # Stop toplogy and Remove tmp files
184 "Testsuite end time: {}".format(time
.asctime(time
.localtime(time
.time())))
186 logger
.info("=" * 40)
189 #####################################################
193 #####################################################
196 def get_interfaces_names(topo
):
198 API to fetch interfaces names and create list, which further would be used
203 * `topo` : inout JSON data
206 for link
in range(1, 5):
208 intf
= topo
["routers"]["r1"]["links"]["r2-link{}".format(link
)]["interface"]
209 r1_r2_links
.append(intf
)
211 intf
= topo
["routers"]["r1"]["links"]["r3-link{}".format(link
)]["interface"]
212 r1_r3_links
.append(intf
)
214 intf
= topo
["routers"]["r2"]["links"]["r1-link{}".format(link
)]["interface"]
215 r2_r1_links
.append(intf
)
217 intf
= topo
["routers"]["r3"]["links"]["r1-link{}".format(link
)]["interface"]
218 r3_r1_links
.append(intf
)
220 intf
= topo
["routers"]["r2"]["links"]["r4-link{}".format(link
)]["interface"]
221 r2_r4_links
.append(intf
)
223 intf
= topo
["routers"]["r4"]["links"]["r2-link{}".format(link
)]["interface"]
224 r4_r2_links
.append(intf
)
226 intf
= topo
["routers"]["r4"]["links"]["r3-link{}".format(link
)]["interface"]
227 r4_r3_links
.append(intf
)
230 def configure_static_routes_for_rp_reachability(tgen
, topo
):
232 API to configure static routes for rp reachability
236 * `topo` : inout JSON data
239 for i
in range(1, 5):
245 topo
["routers"]["r2"]["links"]["lo"]["ipv4"],
246 topo
["routers"]["i6"]["links"]["r4"]["ipv4"],
247 topo
["routers"]["i7"]["links"]["r4"]["ipv4"],
248 topo
["routers"]["r4"]["links"]["lo"]["ipv4"],
250 "next_hop": topo
["routers"]["r2"]["links"][
251 "r1-link{}".format(i
)
252 ]["ipv4"].split("/")[0],
256 topo
["routers"]["r3"]["links"]["lo"]["ipv4"],
257 topo
["routers"]["i6"]["links"]["r4"]["ipv4"],
258 topo
["routers"]["i7"]["links"]["r4"]["ipv4"],
259 topo
["routers"]["r4"]["links"]["lo"]["ipv4"],
261 "next_hop": topo
["routers"]["r3"]["links"][
262 "r1-link{}".format(i
)
263 ]["ipv4"].split("/")[0],
271 topo
["routers"]["i6"]["links"]["r4"]["ipv4"],
272 topo
["routers"]["i7"]["links"]["r4"]["ipv4"],
273 topo
["routers"]["r4"]["links"]["lo"]["ipv4"],
274 topo
["routers"]["r3"]["links"]["lo"]["ipv4"],
276 "next_hop": topo
["routers"]["r4"]["links"][
277 "r2-link{}".format(i
)
278 ]["ipv4"].split("/")[0],
282 topo
["routers"]["r1"]["links"]["lo"]["ipv4"],
283 topo
["routers"]["r3"]["links"]["lo"]["ipv4"],
284 topo
["routers"]["i1"]["links"]["r1"]["ipv4"],
285 topo
["routers"]["i2"]["links"]["r1"]["ipv4"],
287 "next_hop": topo
["routers"]["r1"]["links"][
288 "r2-link{}".format(i
)
289 ]["ipv4"].split("/")[0],
297 topo
["routers"]["r4"]["links"]["lo"]["ipv4"],
298 topo
["routers"]["i6"]["links"]["r4"]["ipv4"],
299 topo
["routers"]["i7"]["links"]["r4"]["ipv4"],
300 topo
["routers"]["r2"]["links"]["lo"]["ipv4"],
302 "next_hop": topo
["routers"]["r4"]["links"][
303 "r3-link{}".format(i
)
304 ]["ipv4"].split("/")[0],
308 topo
["routers"]["r1"]["links"]["lo"]["ipv4"],
309 topo
["routers"]["i1"]["links"]["r1"]["ipv4"],
310 topo
["routers"]["i2"]["links"]["r1"]["ipv4"],
311 topo
["routers"]["r2"]["links"]["lo"]["ipv4"],
313 "next_hop": topo
["routers"]["r1"]["links"][
314 "r3-link{}".format(i
)
315 ]["ipv4"].split("/")[0],
323 topo
["routers"]["r3"]["links"]["lo"]["ipv4"],
324 topo
["routers"]["i1"]["links"]["r1"]["ipv4"],
325 topo
["routers"]["i2"]["links"]["r1"]["ipv4"],
326 topo
["routers"]["r1"]["links"]["lo"]["ipv4"],
328 "next_hop": topo
["routers"]["r3"]["links"][
329 "r4-link{}".format(i
)
330 ]["ipv4"].split("/")[0],
334 topo
["routers"]["r2"]["links"]["lo"]["ipv4"],
335 topo
["routers"]["i1"]["links"]["r1"]["ipv4"],
336 topo
["routers"]["i2"]["links"]["r1"]["ipv4"],
337 topo
["routers"]["r1"]["links"]["lo"]["ipv4"],
339 "next_hop": topo
["routers"]["r2"]["links"][
340 "r4-link{}".format(i
)
341 ]["ipv4"].split("/")[0],
347 result
= create_static_routes(tgen
, static_routes
)
348 assert result
is True, "API {} : Failed Error: {}".format(
349 sys
._getframe
().f_code
.co_name
, result
353 def verify_state_incremented(state_before
, state_after
):
355 API to compare interface traffic state incrementing
359 * `state_before` : State dictionary for any particular instance
360 * `state_after` : State dictionary for any particular instance
363 for router
, state_data
in state_before
.items():
364 for state
, value
in state_data
.items():
365 if state_before
[router
][state
] > state_after
[router
][state
]:
367 "[DUT: %s]: state %s value has not"
368 " incremented, Initial value: %s, "
369 "Current value: %s [FAILED!!]"
373 state_before
[router
][state
],
374 state_after
[router
][state
],
380 "[DUT: %s]: State %s value is "
381 "incremented, Initial value: %s, Current value: %s"
385 state_before
[router
][state
],
386 state_after
[router
][state
],
392 #####################################################
396 #####################################################
399 def test_mroutes_updated_with_correct_oil_iif_when_receiver_is_in_and_outside_DUT_p0(
403 Verify mroutes OIL and IIF updated correctly when receivers present inside
408 tc_name
= request
.node
.name
409 write_test_header(tc_name
)
411 # Creating configuration from JSON
412 app_helper
.stop_all_hosts()
414 reset_config_on_routers(tgen
)
415 clear_pim_interface_traffic(tgen
, topo
)
417 # Don"t run this test if we have any failure.
418 if tgen
.routers_have_failure():
419 pytest
.skip(tgen
.errors
)
421 step("Enable IGMP on DUT and R4 interface")
422 intf_r1_i1
= topo
["routers"]["r1"]["links"]["i1"]["interface"]
423 intf_r4_i7
= topo
["routers"]["r4"]["links"]["i7"]["interface"]
424 for dut
, intf
in zip(["r1", "r4"], [intf_r1_i1
, intf_r4_i7
]):
425 input_dict
= {dut
: {"igmp": {"interfaces": {intf
: {"igmp": {"version": "2"}}}}}}
427 result
= create_igmp_config(tgen
, topo
, input_dict
)
428 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
430 step("Send IGMP joins from DUT and R4 for group range 225.1.1.1-5")
432 "i1": topo
["routers"]["i1"]["links"]["r1"]["interface"],
433 "i7": topo
["routers"]["i7"]["links"]["r4"]["interface"],
436 for recvr
, recvr_intf
in input_join
.items():
437 result
= app_helper
.run_join(recvr
, IGMP_JOIN_RANGE_1
, join_intf
=recvr_intf
)
438 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
440 step("Configure RP as R2 for group range 225.1.1.1-5")
447 "rp_addr": topo
["routers"]["r2"]["links"]["lo"]["ipv4"].split(
450 "group_addr_range": GROUP_RANGE_1
,
457 result
= create_pim_config(tgen
, topo
, input_dict
)
458 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
460 step("Done in base config: " "Configure EBGP peering between all the nodes")
462 step("Done in base config: " "Enable PIM on all the interfaces of all the nodes")
464 step("Send traffic from R4 for group range 225.1.1.1-5")
466 input_src
= {"i6": topo
["routers"]["i6"]["links"]["r4"]["interface"]}
468 result
= app_helper
.run_traffic("i6", IGMP_JOIN_RANGE_1
, "r4")
469 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
472 "IGMP groups are received on DUT and R4 verify using 'show ip igmp groups'"
473 " and 'show ip igmp groups json'"
476 intf_r1_i1
= topo
["routers"]["r1"]["links"]["i1"]["interface"]
477 result
= verify_igmp_groups(tgen
, "r1", intf_r1_i1
, IGMP_JOIN_RANGE_1
)
478 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
480 intf_r4_i7
= topo
["routers"]["r4"]["links"]["i7"]["interface"]
481 result
= verify_igmp_groups(tgen
, "r4", intf_r4_i7
, IGMP_JOIN_RANGE_1
)
482 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
484 step("(*,G) IIF and OIL updated on both the nodes")
487 "(S,G) IIF updated towards shortest path to source on both the nodes "
488 ", verify using 'show ip mroute' and 'show ip mroute json'"
491 source_i6
= topo
["routers"]["i6"]["links"]["r4"]["ipv4"].split("/")[0]
492 input_dict_star_sg
= [
496 "iif": r1_r2_links
+ r1_r3_links
,
497 "oil": topo
["routers"]["r1"]["links"]["i1"]["interface"],
502 "iif": r4_r2_links
+ r4_r3_links
,
503 "oil": topo
["routers"]["r4"]["links"]["i7"]["interface"],
507 "src_address": source_i6
,
508 "iif": r1_r2_links
+ r1_r3_links
,
509 "oil": topo
["routers"]["r1"]["links"]["i1"]["interface"],
513 "src_address": source_i6
,
514 "iif": topo
["routers"]["r4"]["links"]["i6"]["interface"],
515 "oil": topo
["routers"]["r4"]["links"]["i7"]["interface"],
519 for data
in input_dict_star_sg
:
520 result
= verify_mroutes(
528 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
531 "OIL is updated and traffic is received for all the groups on both "
532 "the nodes , verify using 'show ip multicast'; 'show ip multicast json'"
535 intf_r4_i6
= topo
["routers"]["r4"]["links"]["i6"]["interface"]
536 intf_r1_i1
= topo
["routers"]["r1"]["links"]["i1"]["interface"]
538 "r1": {"traffic_sent": [intf_r1_i1
]},
539 "r4": {"traffic_received": [intf_r4_i6
]},
541 result
= verify_multicast_traffic(tgen
, input_traffic
)
542 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
544 step("Random shut of upstream interface from DUT side")
545 for i
in range(1, 5, 2):
546 intf
= topo
["routers"]["r1"]["links"]["r2-link{}".format(i
)]["interface"]
547 shutdown_bringup_interface(tgen
, "r1", intf
, False)
550 "After shut of upstream interface from DUT verify mroutes has moved "
551 "to another interface (R2 or R3) and updated with correct OIL/IIF using"
552 " 'show ip mroute json'"
555 for data
in input_dict_star_sg
:
556 if data
["src_address"] == "*":
557 result
= verify_mroutes(
565 assert result
is True, "Testcase {} : Failed Error: {}".format(
569 step("Random no shut of upstream interface from DUT side")
570 for i
in range(1, 5, 2):
571 intf
= topo
["routers"]["r1"]["links"]["r2-link{}".format(i
)]["interface"]
572 shutdown_bringup_interface(tgen
, "r1", intf
, True)
575 "After no shut of upstream interface from DUT verify no change on"
576 "mroute using 'show ip mroute json'; 'show ip upstream json'"
579 for data
in input_dict_star_sg
:
580 if data
["src_address"] == "*":
581 result
= verify_mroutes(
589 assert result
is True, "Testcase {} : Failed Error: {}".format(
593 result
= verify_upstream_iif(
594 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
596 assert result
is True, "Testcase {} : Failed Error: {}".format(
600 step("Shut of upstream interface in alternate fashion from R4 side")
601 for i
in range(1, 5, 2):
602 intf
= topo
["routers"]["r4"]["links"]["r2-link{}".format(i
)]["interface"]
603 shutdown_bringup_interface(tgen
, "r4", intf
, False)
606 "After shut of upstream interface from R4 verify mroutes has moved "
607 "to another interface (R2 or R3) and updated with correct OIL/IIF using"
608 " 'show ip mroute json'"
611 for data
in input_dict_star_sg
:
612 if data
["src_address"] == "*":
613 result
= verify_mroutes(
621 assert result
is True, "Testcase {} : Failed Error: {}".format(
625 step("No shut of upstream interface in alternate fashion from R4 side")
626 for i
in range(1, 5, 2):
627 intf
= topo
["routers"]["r4"]["links"]["r2-link{}".format(i
)]["interface"]
628 shutdown_bringup_interface(tgen
, "r4", intf
, True)
631 "After no shut of upstream interface from DUT verify no change on"
632 "mroute using 'show ip mroute json'; 'show ip upstream json'"
635 for data
in input_dict_star_sg
:
636 if data
["src_address"] == "*":
637 result
= verify_mroutes(
645 assert result
is True, "Testcase {} : Failed Error: {}".format(
649 result
= verify_upstream_iif(
650 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
652 assert result
is True, "Testcase {} : Failed Error: {}".format(
657 "Send different IGMP joins from DUT and R4 for group range (From DUT "
658 "225.1.1.1-5 and from R4 226.1.1.1-5)"
661 result
= app_helper
.run_join("i7", IGMP_JOIN_RANGE_2
, "r4")
662 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
664 step("Send traffic for all the groups from R4")
666 input_src
= {"i6": topo
["routers"]["i6"]["links"]["r4"]["interface"]}
667 result
= app_helper
.run_traffic("i6", IGMP_JOIN_RANGE_1
+ IGMP_JOIN_RANGE_2
, "r4")
668 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
671 "IGMP groups are received on DUT and R4 verify using 'show ip igmp groups'"
672 " and 'show ip igmp groups json'"
675 intf_r1_i1
= topo
["routers"]["r1"]["links"]["i1"]["interface"]
676 result
= verify_igmp_groups(tgen
, "r1", intf_r1_i1
, IGMP_JOIN_RANGE_1
)
677 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
679 intf_r4_i7
= topo
["routers"]["r4"]["links"]["i7"]["interface"]
680 result
= verify_igmp_groups(
681 tgen
, "r4", intf_r4_i7
, IGMP_JOIN_RANGE_1
+ IGMP_JOIN_RANGE_2
683 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
685 step("(*,G) IIF and OIL updated on both the nodes")
687 for data
in input_dict_star_sg
:
688 if data
["src_address"] == "*":
689 result
= verify_mroutes(
697 assert result
is True, "Testcase {} : Failed Error: {}".format(
702 "(S,G) IIF updated towards shortest path to source on both the nodes "
703 ", verify using 'show ip mroute' and 'show ip mroute json'"
706 for data
in input_dict_star_sg
:
707 if data
["src_address"] != "*":
708 result
= verify_mroutes(
716 assert result
is True, "Testcase {} : Failed Error: {}".format(
721 "OIL is updated and traffic is received for all the groups on both "
722 "the nodes , verify using 'show ip multicast'; 'show ip multicast json'"
725 intf_r4_i6
= topo
["routers"]["r4"]["links"]["i6"]["interface"]
726 intf_r1_i1
= topo
["routers"]["r1"]["links"]["i1"]["interface"]
728 "r1": {"traffic_sent": [intf_r1_i1
]},
729 "r4": {"traffic_received": [intf_r4_i6
]},
731 result
= verify_multicast_traffic(tgen
, input_traffic
)
732 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
734 step("Random shut of upstream interface from DUT side")
735 for i
in range(1, 5, 2):
736 intf
= topo
["routers"]["r1"]["links"]["r2-link{}".format(i
)]["interface"]
737 shutdown_bringup_interface(tgen
, "r1", intf
, False)
740 "After shut of upstream interface from DUT verify mroutes has moved "
741 "to another interface (R2 or R3) and updated with correct OIL/IIF using"
742 " 'show ip mroute json'"
745 for data
in input_dict_star_sg
:
746 if data
["src_address"] == "*":
747 result
= verify_mroutes(
755 assert result
is True, "Testcase {} : Failed Error: {}".format(
759 step("Random no shut of upstream interface from DUT side")
760 for i
in range(1, 5, 2):
761 intf
= topo
["routers"]["r1"]["links"]["r2-link{}".format(i
)]["interface"]
762 shutdown_bringup_interface(tgen
, "r1", intf
, True)
765 "After no shut of upstream interface from DUT verify no change on"
766 "mroute using 'show ip mroute json'; 'show ip upstream json'"
769 for data
in input_dict_star_sg
:
770 if data
["src_address"] == "*":
771 result
= verify_mroutes(
779 assert result
is True, "Testcase {} : Failed Error: {}".format(
783 result
= verify_upstream_iif(
784 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
786 assert result
is True, "Testcase {} : Failed Error: {}".format(
790 write_test_footer(tc_name
)
793 def test_mroutes_updated_with_correct_oil_iif_when_source_is_in_and_outside_DUT_p0(
797 Verify mroutes OIL and IIF updated correctly when source present inside
802 tc_name
= request
.node
.name
803 write_test_header(tc_name
)
805 # Creating configuration from JSON
806 app_helper
.stop_all_hosts()
808 reset_config_on_routers(tgen
)
809 clear_pim_interface_traffic(tgen
, topo
)
811 # Don"t run this test if we have any failure.
812 if tgen
.routers_have_failure():
813 pytest
.skip(tgen
.errors
)
815 step("Enable IGMP on DUT and R4 interface")
816 intf_r1_i1
= topo
["routers"]["r1"]["links"]["i1"]["interface"]
817 intf_r4_i7
= topo
["routers"]["r4"]["links"]["i7"]["interface"]
818 for dut
, intf
in zip(["r1", "r4"], [intf_r1_i1
, intf_r4_i7
]):
819 input_dict
= {dut
: {"igmp": {"interfaces": {intf
: {"igmp": {"version": "2"}}}}}}
821 result
= create_igmp_config(tgen
, topo
, input_dict
)
822 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
824 step("Send IGMP joins from DUT and R4 for group range 225.1.1.1-5")
826 "i1": topo
["routers"]["i1"]["links"]["r1"]["interface"],
827 "i7": topo
["routers"]["i7"]["links"]["r4"]["interface"],
830 for recvr
, recvr_intf
in input_join
.items():
831 result
= app_helper
.run_join(recvr
, IGMP_JOIN_RANGE_1
, join_intf
=recvr_intf
)
832 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
834 step("Configure RP as R2 for group range 225.1.1.1-5")
841 "rp_addr": topo
["routers"]["r2"]["links"]["lo"]["ipv4"].split(
844 "group_addr_range": GROUP_RANGE_1
,
851 result
= create_pim_config(tgen
, topo
, input_dict
)
852 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
854 step("Done in base config: " "Configure EBGP peering between all the nodes")
856 step("Done in base config: " "Enable PIM on all the interfaces of all the nodes")
858 step("Send traffic from R4 for group range 225.1.1.1-5")
860 result
= app_helper
.run_traffic("i6", IGMP_JOIN_RANGE_1
, "r4")
861 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
864 "IGMP groups are received on DUT and R4 verify using 'show ip igmp groups'"
865 " and 'show ip igmp groups json'"
868 intf_r1_i1
= topo
["routers"]["r1"]["links"]["i1"]["interface"]
869 result
= verify_igmp_groups(tgen
, "r1", intf_r1_i1
, IGMP_JOIN_RANGE_1
)
870 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
872 intf_r4_i7
= topo
["routers"]["r4"]["links"]["i7"]["interface"]
873 result
= verify_igmp_groups(tgen
, "r4", intf_r4_i7
, IGMP_JOIN_RANGE_1
)
874 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
876 step("(*,G) IIF and OIL updated on both the nodes")
879 "(S,G) IIF updated towards shortest path to source on both the nodes "
880 ", verify using 'show ip mroute' and 'show ip mroute json'"
883 source_i6
= topo
["routers"]["i6"]["links"]["r4"]["ipv4"].split("/")[0]
884 input_dict_star_sg
= [
888 "iif": r1_r2_links
+ r1_r3_links
,
889 "oil": topo
["routers"]["r1"]["links"]["i1"]["interface"],
894 "iif": r4_r2_links
+ r4_r3_links
,
895 "oil": topo
["routers"]["r4"]["links"]["i7"]["interface"],
899 "src_address": source_i6
,
900 "iif": r1_r2_links
+ r1_r3_links
,
901 "oil": topo
["routers"]["r1"]["links"]["i1"]["interface"],
905 "src_address": source_i6
,
906 "iif": topo
["routers"]["r4"]["links"]["i6"]["interface"],
907 "oil": topo
["routers"]["r4"]["links"]["i7"]["interface"],
911 for data
in input_dict_star_sg
:
912 result
= verify_mroutes(
920 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
923 "OIL is updated and traffic is received for all the groups on both "
924 "the nodes , verify using 'show ip multicast'; 'show ip multicast json'"
927 intf_r4_i6
= topo
["routers"]["r4"]["links"]["i6"]["interface"]
928 intf_r1_i1
= topo
["routers"]["r1"]["links"]["i1"]["interface"]
930 "r1": {"traffic_sent": [intf_r1_i1
]},
931 "r4": {"traffic_received": [intf_r4_i6
]},
933 result
= verify_multicast_traffic(tgen
, input_traffic
)
934 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
936 step("Random shut of upstream interface from DUT side")
937 for i
in range(1, 5, 2):
938 intf
= topo
["routers"]["r1"]["links"]["r2-link{}".format(i
)]["interface"]
939 shutdown_bringup_interface(tgen
, "r1", intf
, False)
942 "After shut of upstream interface from DUT verify mroutes has moved "
943 "to another interface (R2 or R3) and updated with correct OIL/IIF using"
944 " 'show ip mroute json'"
947 for data
in input_dict_star_sg
:
948 if data
["src_address"] == "*":
949 result
= verify_mroutes(
957 assert result
is True, "Testcase {} : Failed Error: {}".format(
961 step("Random no shut of upstream interface from DUT side")
962 for i
in range(1, 5, 2):
963 intf
= topo
["routers"]["r1"]["links"]["r2-link{}".format(i
)]["interface"]
964 shutdown_bringup_interface(tgen
, "r1", intf
, True)
967 "After no shut of upstream interface from DUT verify no change on"
968 "mroute using 'show ip mroute json'; 'show ip upstream json'"
971 for data
in input_dict_star_sg
:
972 if data
["src_address"] == "*":
973 result
= verify_mroutes(
981 assert result
is True, "Testcase {} : Failed Error: {}".format(
985 step("Random shut of upstream interface from R4 side")
986 for i
in range(1, 5, 2):
987 intf
= topo
["routers"]["r4"]["links"]["r2-link{}".format(i
)]["interface"]
988 shutdown_bringup_interface(tgen
, "r4", intf
, False)
991 "After shut of upstream interface from R4 verify mroutes has moved "
992 "to another interface (R2 or R3) and updated with correct OIL/IIF using"
993 " 'show ip mroute json'"
996 for data
in input_dict_star_sg
:
997 if data
["src_address"] == "*":
998 result
= verify_mroutes(
1001 data
["src_address"],
1006 assert result
is True, "Testcase {} : Failed Error: {}".format(
1010 step("Random no shut of upstream interface from R4 side")
1011 for i
in range(1, 5, 2):
1012 intf
= topo
["routers"]["r4"]["links"]["r2-link{}".format(i
)]["interface"]
1013 shutdown_bringup_interface(tgen
, "r4", intf
, True)
1016 "After no shut of upstream interface from DUT verify no change on"
1017 "mroute using 'show ip mroute json'; 'show ip upstream json'"
1020 for data
in input_dict_star_sg
:
1021 if data
["src_address"] == "*":
1022 result
= verify_mroutes(
1025 data
["src_address"],
1030 assert result
is True, "Testcase {} : Failed Error: {}".format(
1035 "Send different IGMP joins from DUT and R4 for group range (From DUT "
1036 "225.1.1.1-5 and from R4 226.1.1.1-5)"
1039 result
= app_helper
.run_join("i7", IGMP_JOIN_RANGE_2
, "r4")
1040 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1042 step("Send traffic for all the groups from R4")
1044 result
= app_helper
.run_traffic("i6", IGMP_JOIN_RANGE_1
+ IGMP_JOIN_RANGE_2
, "r4")
1045 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1048 "IGMP groups are received on DUT and R4 verify using 'show ip igmp groups'"
1049 " and 'show ip igmp groups json'"
1052 intf_r1_i1
= topo
["routers"]["r1"]["links"]["i1"]["interface"]
1053 result
= verify_igmp_groups(tgen
, "r1", intf_r1_i1
, IGMP_JOIN_RANGE_1
)
1054 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1056 intf_r4_i7
= topo
["routers"]["r4"]["links"]["i7"]["interface"]
1057 result
= verify_igmp_groups(
1058 tgen
, "r4", intf_r4_i7
, IGMP_JOIN_RANGE_1
+ IGMP_JOIN_RANGE_2
1060 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1062 step("(*,G) IIF and OIL updated on both the nodes")
1064 for data
in input_dict_star_sg
:
1065 if data
["src_address"] == "*":
1066 result
= verify_mroutes(
1069 data
["src_address"],
1074 assert result
is True, "Testcase {} : Failed Error: {}".format(
1079 "(S,G) IIF updated towards shortest path to source on both the nodes "
1080 ", verify using 'show ip mroute' and 'show ip mroute json'"
1083 for data
in input_dict_star_sg
:
1084 if data
["src_address"] != "*":
1085 result
= verify_mroutes(
1088 data
["src_address"],
1093 assert result
is True, "Testcase {} : Failed Error: {}".format(
1098 "OIL is updated and traffic is received for all the groups on both "
1099 "the nodes , verify using 'show ip multicast'; 'show ip multicast json'"
1102 intf_r4_i6
= topo
["routers"]["r4"]["links"]["i6"]["interface"]
1103 intf_r1_i1
= topo
["routers"]["r1"]["links"]["i1"]["interface"]
1105 "r1": {"traffic_sent": [intf_r1_i1
]},
1106 "r4": {"traffic_received": [intf_r4_i6
]},
1108 result
= verify_multicast_traffic(tgen
, input_traffic
)
1109 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1111 step("Random shut and no shut of upstream interface from DUT side")
1113 step("Random shut of upstream interface from DUT side")
1114 for i
in range(1, 5, 2):
1115 intf
= topo
["routers"]["r1"]["links"]["r2-link{}".format(i
)]["interface"]
1116 shutdown_bringup_interface(tgen
, "r1", intf
, False)
1119 "After shut of upstream interface from DUT verify mroutes has moved "
1120 "to another interface (R2 or R3) and updated with correct OIL/IIF using"
1121 " 'show ip mroute json'"
1124 for data
in input_dict_star_sg
:
1125 if data
["src_address"] == "*":
1126 result
= verify_mroutes(
1129 data
["src_address"],
1134 assert result
is True, "Testcase {} : Failed Error: {}".format(
1138 step("Random no shut of upstream interface from DUT side")
1139 for i
in range(1, 5, 2):
1140 intf
= topo
["routers"]["r1"]["links"]["r2-link{}".format(i
)]["interface"]
1141 shutdown_bringup_interface(tgen
, "r1", intf
, True)
1144 "After no shut of upstream interface from DUT verify no change on"
1145 "mroute using 'show ip mroute json'; 'show ip upstream json'"
1148 for data
in input_dict_star_sg
:
1149 if data
["src_address"] == "*":
1150 result
= verify_mroutes(
1153 data
["src_address"],
1158 assert result
is True, "Testcase {} : Failed Error: {}".format(
1162 write_test_footer(tc_name
)
1165 def test_verify_mroutes_forwarding_p0(request
):
1167 Verify Mroutes and BSM forwarding when edge is transit node
1170 tgen
= get_topogen()
1171 tc_name
= request
.node
.name
1172 write_test_header(tc_name
)
1174 # Creating configuration from JSON
1175 app_helper
.stop_all_hosts()
1177 reset_config_on_routers(tgen
)
1178 clear_pim_interface_traffic(tgen
, topo
)
1180 # Don"t run this test if we have any failure.
1181 if tgen
.routers_have_failure():
1182 pytest
.skip(tgen
.errors
)
1184 step("To make DUT as transit node , shut all the links from R3 to R4 nodes")
1185 for i
in range(1, 5):
1186 intf
= topo
["routers"]["r3"]["links"]["r4-link{}".format(i
)]["interface"]
1187 shutdown_bringup_interface(tgen
, "r3", intf
, False)
1189 intf
= topo
["routers"]["r4"]["links"]["r3-link{}".format(i
)]["interface"]
1190 shutdown_bringup_interface(tgen
, "r4", intf
, False)
1192 step("Enable IGMP on DUT and R3 interface")
1193 intf_r1_i1
= topo
["routers"]["r1"]["links"]["i1"]["interface"]
1194 intf_r3_i5
= topo
["routers"]["r3"]["links"]["i5"]["interface"]
1195 for dut
, intf
in zip(["r1", "r3"], [intf_r1_i1
, intf_r3_i5
]):
1196 input_dict
= {dut
: {"igmp": {"interfaces": {intf
: {"igmp": {"version": "2"}}}}}}
1198 result
= create_igmp_config(tgen
, topo
, input_dict
)
1199 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1201 step("Send IGMP joins from DUT and R4 for group range 226.1.1.1-5")
1203 "i1": topo
["routers"]["i1"]["links"]["r1"]["interface"],
1204 "i5": topo
["routers"]["i5"]["links"]["r3"]["interface"],
1207 for recvr
, recvr_intf
in input_join
.items():
1208 result
= app_helper
.run_join(recvr
, IGMP_JOIN_RANGE_2
, join_intf
=recvr_intf
)
1209 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1211 step("Configure RP as R2 for group range 226.1.1.1-5")
1218 "rp_addr": topo
["routers"]["r2"]["links"]["lo"]["ipv4"].split(
1221 "group_addr_range": GROUP_RANGE_2
,
1228 result
= create_pim_config(tgen
, topo
, input_dict
)
1229 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1231 step("Done in base config: " "Configure EBGP peering between all the nodes")
1233 step("Done in base config: " "Enable PIM on all the interfaces of all the nodes")
1235 step("Send traffic from R4 for group range 226.1.1.1-5")
1238 "i6": topo
["routers"]["i6"]["links"]["r4"]["interface"],
1239 "i2": topo
["routers"]["i2"]["links"]["r1"]["interface"],
1242 for src
, src_intf
in input_src
.items():
1243 result
= app_helper
.run_traffic(src
, IGMP_JOIN_RANGE_2
, bind_intf
=src_intf
)
1244 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1247 "BSR and candidate RP info populated in R3 node verify using "
1248 "'show ip pim rp-info json'"
1251 rp_addr_r2
= topo
["routers"]["r2"]["links"]["lo"]["ipv4"].split("/")[0]
1253 result
= verify_pim_rp_info(
1254 tgen
, topo
, "r2", GROUP_RANGE_2
, "lo", rp_addr_r2
, "Static"
1256 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1258 step("(*,G) IIF and OIL updated on both the nodes")
1261 "(S,G) IIF updated towards shortest path to source on both the nodes "
1262 ", verify using 'show ip mroute' and 'show ip mroute json'"
1266 "DUT created (*,G) and (S,G) entries as transit node for 226.1.1.1-5 "
1267 "mroutes , OIL is local received and toward R3"
1270 source_i6
= topo
["routers"]["i6"]["links"]["r4"]["ipv4"].split("/")[0]
1271 source_i2
= topo
["routers"]["i2"]["links"]["r1"]["ipv4"].split("/")[0]
1272 input_dict_star_sg
= [
1276 "iif": r1_r2_links
+ r1_r3_links
,
1277 "oil": r1_r3_links
+ [topo
["routers"]["r1"]["links"]["i1"]["interface"]],
1281 "src_address": source_i2
,
1282 "iif": topo
["routers"]["r1"]["links"]["i2"]["interface"],
1283 "oil": r1_r3_links
+ [topo
["routers"]["r1"]["links"]["i1"]["interface"]],
1287 "src_address": source_i6
,
1288 "iif": r1_r2_links
+ r1_r3_links
,
1289 "oil": r1_r3_links
+ [topo
["routers"]["r1"]["links"]["i1"]["interface"]],
1295 "oil": topo
["routers"]["r3"]["links"]["i5"]["interface"],
1299 "src_address": source_i2
,
1301 "oil": topo
["routers"]["r3"]["links"]["i5"]["interface"],
1305 "src_address": source_i6
,
1307 "oil": topo
["routers"]["r3"]["links"]["i5"]["interface"],
1311 for data
in input_dict_star_sg
:
1312 result
= verify_mroutes(
1315 data
["src_address"],
1320 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1323 "OIL is updated and traffic is received for all the groups on both "
1324 "the nodes , verify using 'show ip multicast'; 'show ip multicast json'"
1327 intf_r3_i5
= topo
["routers"]["r3"]["links"]["i5"]["interface"]
1328 intf_r1_i2
= topo
["routers"]["r1"]["links"]["i1"]["interface"]
1330 "r3": {"traffic_sent": [intf_r3_i5
]},
1331 "r1": {"traffic_sent": [intf_r1_i2
]},
1333 result
= verify_multicast_traffic(tgen
, input_traffic
)
1334 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1337 "Send different join from R3 (232.1.1.1-5) and traffic "
1338 "from R4 for same range"
1341 input_join
= {"i5": topo
["routers"]["i5"]["links"]["r3"]["interface"]}
1342 result
= app_helper
.run_join("i5", IGMP_JOIN_RANGE_3
, "r3")
1343 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1350 "rp_addr": topo
["routers"]["r2"]["links"]["lo"]["ipv4"].split(
1353 "group_addr_range": GROUP_RANGE_3
,
1360 result
= create_pim_config(tgen
, topo
, input_dict
)
1361 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1363 input_src
= {"i6": topo
["routers"]["i6"]["links"]["r4"]["interface"]}
1364 result
= app_helper
.run_traffic("i6", IGMP_JOIN_RANGE_3
, "r4")
1365 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1367 step("For different join (232.1.1.1-5) DUT created mroute OIL toward R3 only")
1369 source_i6
= topo
["routers"]["i6"]["links"]["r4"]["ipv4"].split("/")[0]
1371 {"dut": "r1", "src_address": "*", "iif": r1_r2_links
, "oil": r1_r3_links
},
1372 {"dut": "r1", "src_address": source_i6
, "iif": r1_r2_links
, "oil": r1_r3_links
},
1375 for data
in input_dict_sg
:
1376 result
= verify_mroutes(
1379 data
["src_address"],
1384 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1386 result
= verify_upstream_iif(
1387 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_3
1389 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1391 step("Shut from DUT to R2 and no shut from DUT")
1393 for i
in range(1, 5):
1394 intf
= topo
["routers"]["r1"]["links"]["r2-link{}".format(i
)]["interface"]
1395 shutdown_bringup_interface(tgen
, "r1", intf
, False)
1398 "After Shut (R1-R2) link from DUT, verify IIF on DUT changed to "
1399 "different uplink interface on DUT 'show ip mroute json' for R4 so "
1406 "src_address": source_i2
,
1407 "iif": topo
["routers"]["r1"]["links"]["i2"]["interface"],
1408 "oil": r1_r3_links
+ [topo
["routers"]["r1"]["links"]["i1"]["interface"]],
1412 for data
in input_dict_sg
:
1413 result
= verify_mroutes(
1416 data
["src_address"],
1421 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1423 step("Traffic is received fine for R4 source 'show ip multicast json' on DUT")
1425 result
= verify_multicast_traffic(tgen
, input_traffic
)
1426 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1428 step("No shut from DUT to R2 and no shut from DUT")
1430 for i
in range(1, 5):
1431 intf
= topo
["routers"]["r1"]["links"]["r2-link{}".format(i
)]["interface"]
1432 shutdown_bringup_interface(tgen
, "r1", intf
, True)
1434 for data
in input_dict_sg
:
1435 result
= verify_mroutes(
1438 data
["src_address"],
1443 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1445 step("Shut and no shut DUT to R2 within 30 sec from DUT")
1447 for i
in range(1, 5):
1448 intf
= topo
["routers"]["r1"]["links"]["r2-link{}".format(i
)]["interface"]
1449 shutdown_bringup_interface(tgen
, "r1", intf
, False)
1451 for i
in range(1, 5):
1452 intf
= topo
["routers"]["r1"]["links"]["r2-link{}".format(i
)]["interface"]
1453 shutdown_bringup_interface(tgen
, "r1", intf
, True)
1456 "Shut and No shut in 30 sec time , verify on R2 added 2 entries in mroute "
1457 ", shut link OIL got timeout after sometime"
1460 for data
in input_dict_star_sg
:
1461 result
= verify_mroutes(
1464 data
["src_address"],
1469 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1471 result
= verify_upstream_iif(
1472 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_2
1474 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1476 write_test_footer(tc_name
)
1479 def test_mroutes_updated_correctly_after_source_interface_shut_noshut_p1(request
):
1481 Verify mroutes updated correctly after source interface shut/no shut
1484 tgen
= get_topogen()
1485 tc_name
= request
.node
.name
1486 write_test_header(tc_name
)
1488 # Creating configuration from JSON
1489 app_helper
.stop_all_hosts()
1491 reset_config_on_routers(tgen
)
1492 clear_pim_interface_traffic(tgen
, topo
)
1494 # Don"t run this test if we have any failure.
1495 if tgen
.routers_have_failure():
1496 pytest
.skip(tgen
.errors
)
1498 step("Enable IGMP on DUT and R4 interface")
1499 intf_r1_i1
= topo
["routers"]["r1"]["links"]["i1"]["interface"]
1500 intf_r4_i7
= topo
["routers"]["r4"]["links"]["i7"]["interface"]
1501 for dut
, intf
in zip(["r1", "r4"], [intf_r1_i1
, intf_r4_i7
]):
1502 input_dict
= {dut
: {"igmp": {"interfaces": {intf
: {"igmp": {"version": "2"}}}}}}
1504 result
= create_igmp_config(tgen
, topo
, input_dict
)
1505 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1507 step("Send IGMP joins from DUT and R4 for group range 225.1.1.1-5")
1509 "i1": topo
["routers"]["i1"]["links"]["r1"]["interface"],
1510 "i7": topo
["routers"]["i7"]["links"]["r4"]["interface"],
1513 for recvr
, recvr_intf
in input_join
.items():
1514 result
= app_helper
.run_join(recvr
, IGMP_JOIN_RANGE_1
, join_intf
=recvr_intf
)
1515 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1517 step("Configure RP as R2 for group range 225.1.1.1-5")
1524 "rp_addr": topo
["routers"]["r2"]["links"]["lo"]["ipv4"].split(
1527 "group_addr_range": GROUP_RANGE_1
,
1534 result
= create_pim_config(tgen
, topo
, input_dict
)
1535 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1537 step("Done in base config: " "Configure EBGP peering between all the nodes")
1539 step("Done in base config: " "Enable PIM on all the interfaces of all the nodes")
1541 step("Send traffic from R4 for group range 225.1.1.1-5")
1542 step("Send traffic from DUT for group range 225.1.1.1-5")
1545 "i6": topo
["routers"]["i6"]["links"]["r4"]["interface"],
1546 "i2": topo
["routers"]["i2"]["links"]["r1"]["interface"],
1549 for src
, src_intf
in input_src
.items():
1550 result
= app_helper
.run_traffic(src
, IGMP_JOIN_RANGE_1
, bind_intf
=src_intf
)
1551 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1553 step("(*,G) IIF and OIL updated on both the nodes")
1555 input_dict_starg
= [
1559 "iif": r1_r2_links
+ r1_r3_links
,
1560 "oil": topo
["routers"]["r1"]["links"]["i1"]["interface"],
1565 "iif": r4_r2_links
+ r4_r3_links
,
1566 "oil": topo
["routers"]["r4"]["links"]["i7"]["interface"],
1570 for data
in input_dict_starg
:
1571 result
= verify_mroutes(
1574 data
["src_address"],
1579 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1581 result
= verify_upstream_iif(
1582 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
1584 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1587 "(S,G) IIF updated towards shortest path to source on both the nodes "
1588 ", verify using 'show ip mroute' and 'show ip mroute json'"
1591 source_i6
= topo
["routers"]["i6"]["links"]["r4"]["ipv4"].split("/")[0]
1592 source_i2
= topo
["routers"]["i2"]["links"]["r1"]["ipv4"].split("/")[0]
1596 "src_address": source_i6
,
1597 "iif": r1_r2_links
+ r1_r3_links
,
1598 "oil": topo
["routers"]["r1"]["links"]["i1"]["interface"],
1602 "src_address": source_i2
,
1603 "iif": topo
["routers"]["r1"]["links"]["i2"]["interface"],
1604 "oil": r1_r3_links
+ [topo
["routers"]["r1"]["links"]["i1"]["interface"]],
1608 "src_address": source_i6
,
1609 "iif": topo
["routers"]["r4"]["links"]["i6"]["interface"],
1610 "oil": topo
["routers"]["r4"]["links"]["i7"]["interface"],
1614 "src_address": source_i2
,
1615 "iif": r4_r2_links
+ r4_r3_links
,
1616 "oil": topo
["routers"]["r4"]["links"]["i7"]["interface"],
1620 for data
in input_dict_sg
:
1621 result
= verify_mroutes(
1624 data
["src_address"],
1629 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1632 "OIL is updated and traffic is received for all the groups on both "
1633 "the nodes , verify using 'show ip multicast'; 'show ip multicast json'"
1636 intf_r4_i6
= topo
["routers"]["r4"]["links"]["i6"]["interface"]
1637 intf_r1_i1
= topo
["routers"]["r1"]["links"]["i1"]["interface"]
1639 "r1": {"traffic_sent": [intf_r1_i1
]},
1640 "r4": {"traffic_received": [intf_r4_i6
]},
1642 result
= verify_multicast_traffic(tgen
, input_traffic
)
1643 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1645 step("On R1 for local IGMP receivers, OIL towards RP is removed")
1650 "src_address": source_i2
,
1651 "iif": topo
["routers"]["r1"]["links"]["i2"]["interface"],
1652 "oil": topo
["routers"]["r1"]["links"]["i2"]["interface"],
1656 for data
in input_dict
:
1657 result
= verify_mroutes(
1660 data
["src_address"],
1668 ), "Testcase {} : Failed " "Mroute IIF and OIF are same \n Error: {}".format(
1672 step("Shut and No shut source interface multiple time")
1674 for i
in range(0, 2):
1675 step("Shut and no shut the source interface from DUT")
1676 intf_r1_i2
= topo
["routers"]["r1"]["links"]["i2"]["interface"]
1677 shutdown_bringup_interface(tgen
, "r1", intf_r1_i2
, False)
1678 shutdown_bringup_interface(tgen
, "r1", intf_r1_i2
, True)
1681 "After shut/no shut of source interface verify all the (S,G) "
1682 "got re-learn and IIF/OIF pointing any of the links from R2 or "
1683 "R3 verify using 'show ip mroute json'"
1687 "(S,G) OIL on R1 has only respective receiver port and uplink port "
1688 " , RP side oil is removed"
1691 for data
in input_dict_sg
:
1692 result
= verify_mroutes(
1695 data
["src_address"],
1700 assert result
is True, "Testcase {} : Failed Error: {}".format(
1704 step("No change seen on (*,G) mroutes")
1706 for data
in input_dict_starg
:
1707 result
= verify_mroutes(
1710 data
["src_address"],
1715 assert result
is True, "Testcase {} : Failed Error: {}".format(
1720 "Traffic is received for all the groups , verify using "
1721 "'show ip multicast count json'"
1724 result
= verify_multicast_traffic(tgen
, input_traffic
)
1725 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1727 step("Shut and no shut the source interface from R4")
1729 intf_r4_i6
= topo
["routers"]["r4"]["links"]["i6"]["interface"]
1730 shutdown_bringup_interface(tgen
, "r4", intf_r4_i6
, False)
1731 shutdown_bringup_interface(tgen
, "r4", intf_r4_i6
, True)
1734 "After shut/no shut of source interface verify all the (S,G) "
1735 "got re-learn and IIF/OIF pointing any of the links from R2 or "
1736 "R3 verify using 'show ip mroute json'"
1740 "(S,G) OIL on R1 has only respective receiver port and uplink port "
1741 " , RP side oil is removed"
1744 for data
in input_dict_sg
:
1745 result
= verify_mroutes(
1748 data
["src_address"],
1753 assert result
is True, "Testcase {} : Failed Error: {}".format(
1757 step("No change seen on (*,G) mroutes")
1759 for data
in input_dict_starg
:
1760 result
= verify_mroutes(
1763 data
["src_address"],
1768 assert result
is True, "Testcase {} : Failed Error: {}".format(
1773 "Traffic is received for all the groups , verify using "
1774 "'show ip multicast count json'"
1777 result
= verify_multicast_traffic(tgen
, input_traffic
)
1778 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1781 "Shut source interface from R4 and no shut immediate after the "
1782 "same source upstream expires from DUT"
1785 intf_r4_i6
= topo
["routers"]["r4"]["links"]["i6"]["interface"]
1786 shutdown_bringup_interface(tgen
, "r4", intf_r4_i6
, False)
1787 shutdown_bringup_interface(tgen
, "r4", intf_r4_i6
, True)
1790 "After no shut verify mroutes populated and multicast traffic resume ,"
1791 " verify using 'show ip mroute json' 'show ip multicast count json'"
1794 for data
in input_dict_sg
:
1795 result
= verify_mroutes(
1798 data
["src_address"],
1803 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1805 result
= verify_multicast_traffic(tgen
, input_traffic
)
1806 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1809 "Shut source interface from DUT and no shut immediate after the "
1810 "same source upstream expires from R4"
1813 intf_r1_i2
= topo
["routers"]["r1"]["links"]["i2"]["interface"]
1814 shutdown_bringup_interface(tgen
, "r1", intf_r1_i2
, False)
1815 shutdown_bringup_interface(tgen
, "r1", intf_r1_i2
, True)
1818 "After no shut verify mroutes populated and multicast traffic resume ,"
1819 " verify using 'show ip mroute json' 'show ip multicast count json'"
1822 for data
in input_dict_sg
:
1823 result
= verify_mroutes(
1826 data
["src_address"],
1831 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1833 result
= verify_multicast_traffic(tgen
, input_traffic
)
1834 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1836 write_test_footer(tc_name
)
1839 def test_mroutes_updated_correctly_after_receiver_interface_shut_noshut_p1(request
):
1841 Verify mroutes updated correctly after receiver interface shut/no shut
1844 tgen
= get_topogen()
1845 tc_name
= request
.node
.name
1846 write_test_header(tc_name
)
1848 # Creating configuration from JSON
1849 app_helper
.stop_all_hosts()
1851 reset_config_on_routers(tgen
)
1852 clear_pim_interface_traffic(tgen
, topo
)
1854 # Don"t run this test if we have any failure.
1855 if tgen
.routers_have_failure():
1856 pytest
.skip(tgen
.errors
)
1858 step("Enable IGMP on DUT and R4 interface")
1859 intf_r1_i1
= topo
["routers"]["r1"]["links"]["i1"]["interface"]
1860 intf_r4_i7
= topo
["routers"]["r4"]["links"]["i7"]["interface"]
1861 for dut
, intf
in zip(["r1", "r4"], [intf_r1_i1
, intf_r4_i7
]):
1862 input_dict
= {dut
: {"igmp": {"interfaces": {intf
: {"igmp": {"version": "2"}}}}}}
1864 result
= create_igmp_config(tgen
, topo
, input_dict
)
1865 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1867 step("Send IGMP joins from DUT and R4 for group range 225.1.1.1-5")
1869 "i1": topo
["routers"]["i1"]["links"]["r1"]["interface"],
1870 "i7": topo
["routers"]["i7"]["links"]["r4"]["interface"],
1873 for recvr
, recvr_intf
in input_join
.items():
1874 result
= app_helper
.run_join(recvr
, IGMP_JOIN_RANGE_1
, join_intf
=recvr_intf
)
1875 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1877 step("Configure RP as R2 for group range 225.1.1.1-5")
1884 "rp_addr": topo
["routers"]["r2"]["links"]["lo"]["ipv4"].split(
1887 "group_addr_range": GROUP_RANGE_1
,
1894 result
= create_pim_config(tgen
, topo
, input_dict
)
1895 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1897 step("Done in base config: " "Configure EBGP peering between all the nodes")
1899 step("Done in base config: " "Enable PIM on all the interfaces of all the nodes")
1901 step("Send traffic from R4 for group range 225.1.1.1-5")
1903 result
= app_helper
.run_traffic("i6", IGMP_JOIN_RANGE_1
, "r4")
1904 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1906 step("Send traffic from DUT for group range 225.1.1.1-5")
1908 result
= app_helper
.run_traffic("i2", IGMP_JOIN_RANGE_1
, "r1")
1909 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1911 step("(*,G) IIF and OIL updated on both the nodes")
1913 input_dict_starg
= [
1917 "iif_r1_r2": r1_r2_links
+ r1_r3_links
,
1918 "oil": topo
["routers"]["r1"]["links"]["i1"]["interface"],
1923 "iif_r1_r2": r4_r2_links
+ r4_r3_links
,
1924 "oil": topo
["routers"]["r4"]["links"]["i7"]["interface"],
1928 for data
in input_dict_starg
:
1929 result
= verify_mroutes(
1932 data
["src_address"],
1937 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1939 result
= verify_upstream_iif(
1940 tgen
, data
["dut"], data
["iif_r1_r2"], data
["src_address"], IGMP_JOIN_RANGE_1
1942 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1945 "(S,G) IIF updated towards shortest path to source on both the nodes "
1946 ", verify using 'show ip mroute' and 'show ip mroute json'"
1949 source_i6
= topo
["routers"]["i6"]["links"]["r4"]["ipv4"].split("/")[0]
1950 source_i2
= topo
["routers"]["i2"]["links"]["r1"]["ipv4"].split("/")[0]
1954 "src_address": source_i6
,
1955 "iif": r1_r2_links
+ r1_r3_links
,
1956 "oil": topo
["routers"]["r1"]["links"]["i1"]["interface"],
1960 "src_address": source_i2
,
1961 "iif": topo
["routers"]["r1"]["links"]["i2"]["interface"],
1962 "oil": r1_r3_links
+ [topo
["routers"]["r1"]["links"]["i1"]["interface"]],
1966 "src_address": source_i6
,
1967 "iif": topo
["routers"]["r4"]["links"]["i6"]["interface"],
1968 "oil": topo
["routers"]["r4"]["links"]["i7"]["interface"],
1972 "src_address": source_i2
,
1973 "iif": r4_r2_links
+ r4_r3_links
,
1974 "oil": topo
["routers"]["r4"]["links"]["i7"]["interface"],
1978 for data
in input_dict_sg
:
1979 result
= verify_mroutes(
1982 data
["src_address"],
1987 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1990 "OIL is updated and traffic is received for all the groups on both "
1991 "the nodes , verify using 'show ip multicast'; 'show ip multicast json'"
1994 intf_r4_i6
= topo
["routers"]["r4"]["links"]["i6"]["interface"]
1995 intf_r1_i1
= topo
["routers"]["r1"]["links"]["i1"]["interface"]
1997 "r1": {"traffic_sent": [intf_r1_i1
]},
1998 "r4": {"traffic_received": [intf_r4_i6
]},
2000 result
= verify_multicast_traffic(tgen
, input_traffic
)
2001 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2003 step("Shut and no shut the source interface from DUT")
2004 for i
in range(1, 5):
2005 intf
= topo
["routers"]["r1"]["links"]["r2-link{}".format(i
)]["interface"]
2006 shutdown_bringup_interface(tgen
, "r1", intf
, False)
2008 for i
in range(1, 5):
2009 intf
= topo
["routers"]["r1"]["links"]["r2-link{}".format(i
)]["interface"]
2010 shutdown_bringup_interface(tgen
, "r1", intf
, True)
2013 "After shut/no shut of source interface verify all the (S,G) "
2014 "got re-learn and IIF/OIF pointing any of the links from R2 or "
2015 "R3 verify using 'show ip mroute json'"
2019 "(S,G) OIL on R1 has only respective receiver port and uplink port "
2020 " , RP side oil is removed"
2023 for data
in input_dict_sg
:
2024 result
= verify_mroutes(
2027 data
["src_address"],
2032 assert result
is True, "Testcase {} : Failed Error: {}".format(
2037 "Traffic is received for all the groups , verify using "
2038 "'show ip multicast count json'"
2041 result
= verify_multicast_traffic(tgen
, input_traffic
)
2042 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2044 step("Shut the receiver interface from R4")
2045 for i
in range(1, 5):
2046 intf
= topo
["routers"]["r4"]["links"]["r2-link{}".format(i
)]["interface"]
2047 shutdown_bringup_interface(tgen
, "r4", intf
, False)
2049 for i
in range(1, 5):
2050 intf
= topo
["routers"]["r4"]["links"]["r2-link{}".format(i
)]["interface"]
2051 shutdown_bringup_interface(tgen
, "r4", intf
, True)
2054 "After shut/no shut of source interface verify all the (S,G) "
2055 "got re-learn and IIF/OIF pointing any of the links from R2 or "
2056 "R3 verify using 'show ip mroute json'"
2060 "(S,G) OIL on R1 has only respective receiver port and uplink port "
2061 " , RP side oil is removed"
2064 for data
in input_dict_sg
:
2065 result
= verify_mroutes(
2068 data
["src_address"],
2073 assert result
is True, "Testcase {} : Failed Error: {}".format(
2078 "Traffic is received for all the groups , verify using "
2079 "'show ip multicast count json'"
2082 result
= verify_multicast_traffic(tgen
, input_traffic
)
2083 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2086 "Shut and no shut the receiver interface from DUT after PIM upstream" " timeout"
2089 for i
in range(1, 5):
2090 intf
= topo
["routers"]["r1"]["links"]["r2-link{}".format(i
)]["interface"]
2091 shutdown_bringup_interface(tgen
, "r1", intf
, False)
2093 for i
in range(1, 5):
2094 intf
= topo
["routers"]["r1"]["links"]["r2-link{}".format(i
)]["interface"]
2095 shutdown_bringup_interface(tgen
, "r1", intf
, True)
2097 for data
in input_dict_sg
:
2098 result
= verify_mroutes(
2101 data
["src_address"],
2106 assert result
is True, "Testcase {} : Failed Error: {}".format(
2111 "Traffic is received for all the groups , verify using "
2112 "'show ip multicast count json'"
2115 result
= verify_multicast_traffic(tgen
, input_traffic
)
2116 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2119 "Shut and no shut the receiver interface from R4 after PIM upstream " "timeout"
2122 for i
in range(1, 5):
2123 intf
= topo
["routers"]["r4"]["links"]["r2-link{}".format(i
)]["interface"]
2124 shutdown_bringup_interface(tgen
, "r4", intf
, False)
2126 for i
in range(1, 5):
2127 intf
= topo
["routers"]["r4"]["links"]["r2-link{}".format(i
)]["interface"]
2128 shutdown_bringup_interface(tgen
, "r4", intf
, True)
2130 for data
in input_dict_sg
:
2131 result
= verify_mroutes(
2134 data
["src_address"],
2139 assert result
is True, "Testcase {} : Failed Error: {}".format(
2144 "Traffic is received for all the groups , verify using "
2145 "'show ip multicast count json'"
2148 result
= verify_multicast_traffic(tgen
, input_traffic
)
2149 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2151 write_test_footer(tc_name
)
2154 def test_mroutes_updated_after_sending_IGMP_prune_and_join_p1(request
):
2156 Verify mroute updated correctly after sending IGMP prune and join
2159 tgen
= get_topogen()
2160 tc_name
= request
.node
.name
2161 write_test_header(tc_name
)
2163 # Creating configuration from JSON
2164 app_helper
.stop_all_hosts()
2166 reset_config_on_routers(tgen
)
2167 clear_pim_interface_traffic(tgen
, topo
)
2169 # Don"t run this test if we have any failure.
2170 if tgen
.routers_have_failure():
2171 pytest
.skip(tgen
.errors
)
2173 step("Enable IGMP on DUT and R4 interface")
2174 intf_r1_i1
= topo
["routers"]["r1"]["links"]["i1"]["interface"]
2175 intf_r4_i7
= topo
["routers"]["r4"]["links"]["i7"]["interface"]
2176 for dut
, intf
in zip(["r1", "r4"], [intf_r1_i1
, intf_r4_i7
]):
2177 input_dict
= {dut
: {"igmp": {"interfaces": {intf
: {"igmp": {"version": "2"}}}}}}
2179 result
= create_igmp_config(tgen
, topo
, input_dict
)
2180 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2182 step("Send IGMP joins from DUT and R4 for group range 225.1.1.1-5")
2184 "i1": topo
["routers"]["i1"]["links"]["r1"]["interface"],
2185 "i7": topo
["routers"]["i7"]["links"]["r4"]["interface"],
2188 for recvr
, recvr_intf
in input_join
.items():
2189 result
= app_helper
.run_join(recvr
, IGMP_JOIN_RANGE_1
, join_intf
=recvr_intf
)
2190 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2192 step("Configure RP as R2 for group range 225.1.1.1-5")
2199 "rp_addr": topo
["routers"]["r2"]["links"]["lo"]["ipv4"].split(
2202 "group_addr_range": GROUP_RANGE_1
,
2209 result
= create_pim_config(tgen
, topo
, input_dict
)
2210 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2212 step("Done in base config: " "Configure EBGP peering between all the nodes")
2214 step("Done in base config: " "Enable PIM on all the interfaces of all the nodes")
2216 step("Send traffic from R4 for group range 225.1.1.1-5")
2217 step("Send traffic from DUT for group range 225.1.1.1-5")
2220 "i6": topo
["routers"]["i6"]["links"]["r4"]["interface"],
2221 "i2": topo
["routers"]["i2"]["links"]["r1"]["interface"],
2224 for src
, src_intf
in input_src
.items():
2225 result
= app_helper
.run_traffic(src
, IGMP_JOIN_RANGE_1
, bind_intf
=src_intf
)
2226 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2228 step("(*,G) IIF and OIL updated on both the nodes")
2230 input_dict_starg
= [
2234 "iif_r1_r2": r1_r2_links
+ r1_r3_links
,
2235 "oil": topo
["routers"]["r1"]["links"]["i1"]["interface"],
2240 "iif_r1_r2": r4_r2_links
+ r4_r3_links
,
2241 "oil": topo
["routers"]["r4"]["links"]["i7"]["interface"],
2245 for data
in input_dict_starg
:
2246 result
= verify_mroutes(
2249 data
["src_address"],
2254 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2256 result
= verify_upstream_iif(
2257 tgen
, data
["dut"], data
["iif_r1_r2"], data
["src_address"], IGMP_JOIN_RANGE_1
2259 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2262 "(S,G) IIF updated towards shortest path to source on both the nodes "
2263 ", verify using 'show ip mroute' and 'show ip mroute json'"
2266 source_i6
= topo
["routers"]["i6"]["links"]["r4"]["ipv4"].split("/")[0]
2267 source_i2
= topo
["routers"]["i2"]["links"]["r1"]["ipv4"].split("/")[0]
2271 "src_address": source_i6
,
2272 "iif": r1_r2_links
+ r1_r3_links
,
2273 "oil": topo
["routers"]["r1"]["links"]["i1"]["interface"],
2277 "src_address": source_i2
,
2278 "iif": topo
["routers"]["r1"]["links"]["i2"]["interface"],
2279 "oil": topo
["routers"]["r1"]["links"]["i1"]["interface"],
2283 "src_address": source_i6
,
2284 "iif": topo
["routers"]["r4"]["links"]["i6"]["interface"],
2285 "oil": topo
["routers"]["r4"]["links"]["i7"]["interface"],
2289 "src_address": source_i2
,
2290 "iif": r4_r2_links
+ r4_r3_links
,
2291 "oil": topo
["routers"]["r4"]["links"]["i7"]["interface"],
2295 for data
in input_dict_sg
:
2296 result
= verify_mroutes(
2299 data
["src_address"],
2304 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2307 "OIL is updated and traffic is received for all the groups on both "
2308 "the nodes , verify using 'show ip multicast'; 'show ip multicast json'"
2311 intf_r4_i6
= topo
["routers"]["r4"]["links"]["i6"]["interface"]
2312 intf_r1_i1
= topo
["routers"]["r1"]["links"]["i1"]["interface"]
2314 "r1": {"traffic_sent": [intf_r1_i1
]},
2315 "r4": {"traffic_received": [intf_r4_i6
]},
2317 result
= verify_multicast_traffic(tgen
, input_traffic
)
2318 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2320 step("Send IGMP prune and join for receivers connected on DUT")
2321 step("Send IGMP prune and join for receivers connected on R4")
2323 app_helper
.stop_all_hosts()
2326 "After sending prune verify (*,G) and (S,G) entries got cleared "
2327 "from all the nodes"
2330 for data
in input_dict_starg
:
2331 result
= verify_mroutes(
2334 data
["src_address"],
2342 ), "Testcase {} : Failed " " mroute are still present \n Error: {}".format(
2346 for data
in input_dict_sg
:
2347 result
= verify_mroutes(
2350 data
["src_address"],
2358 ), "Testcase {} : Failed " " mroute are still present \n Error: {}".format(
2363 "After sending joins verify (*,G) and (S,G) entries got populated "
2364 "again correct OIL and IIF info (any of the link of R2 or R3) verify "
2365 "using 'show ip mroute json'"
2368 for recvr
, recvr_intf
in input_join
.items():
2369 result
= app_helper
.run_join(recvr
, IGMP_JOIN_RANGE_1
, join_intf
=recvr_intf
)
2370 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2372 for src
, src_intf
in input_src
.items():
2373 result
= app_helper
.run_traffic(src
, IGMP_JOIN_RANGE_1
, bind_intf
=src_intf
)
2374 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2376 for data
in input_dict_starg
:
2377 result
= verify_mroutes(
2380 data
["src_address"],
2385 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2387 for data
in input_dict_sg
:
2388 result
= verify_mroutes(
2391 data
["src_address"],
2396 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2399 "Multicast traffic receiver for all the groups verify using "
2400 "'show ip multicast count'"
2404 "r1": {"traffic_sent": [intf_r1_i1
]},
2405 "r4": {"traffic_received": [intf_r4_i6
]},
2407 result
= verify_multicast_traffic(tgen
, input_traffic
)
2408 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2410 write_test_footer(tc_name
)
2413 def test_mroutes_updated_after_after_clear_mroute_p1(request
):
2415 Verify mroute updated correctly after clear mroute
2418 tgen
= get_topogen()
2419 tc_name
= request
.node
.name
2420 write_test_header(tc_name
)
2422 # Creating configuration from JSON
2423 app_helper
.stop_all_hosts()
2425 reset_config_on_routers(tgen
)
2426 clear_pim_interface_traffic(tgen
, topo
)
2428 # Don"t run this test if we have any failure.
2429 if tgen
.routers_have_failure():
2430 pytest
.skip(tgen
.errors
)
2432 step("Enable IGMP on DUT and R4 interface")
2433 intf_r1_i1
= topo
["routers"]["r1"]["links"]["i1"]["interface"]
2434 intf_r4_i7
= topo
["routers"]["r4"]["links"]["i7"]["interface"]
2435 for dut
, intf
in zip(["r1", "r4"], [intf_r1_i1
, intf_r4_i7
]):
2436 input_dict
= {dut
: {"igmp": {"interfaces": {intf
: {"igmp": {"version": "2"}}}}}}
2438 result
= create_igmp_config(tgen
, topo
, input_dict
)
2439 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2441 step("Send IGMP joins from DUT and R4 for group range 225.1.1.1-5")
2443 "i1": topo
["routers"]["i1"]["links"]["r1"]["interface"],
2444 "i7": topo
["routers"]["i7"]["links"]["r4"]["interface"],
2447 for recvr
, recvr_intf
in input_join
.items():
2448 result
= app_helper
.run_join(recvr
, IGMP_JOIN_RANGE_1
, join_intf
=recvr_intf
)
2449 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2451 step("Configure RP as R2 for group range 225.1.1.1-5")
2458 "rp_addr": topo
["routers"]["r2"]["links"]["lo"]["ipv4"].split(
2461 "group_addr_range": GROUP_RANGE_1
,
2468 result
= create_pim_config(tgen
, topo
, input_dict
)
2469 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2471 step("Done in base config: " "Configure EBGP peering between all the nodes")
2473 step("Done in base config: " "Enable PIM on all the interfaces of all the nodes")
2475 step("Send traffic from R4 for group range 225.1.1.1-5")
2476 step("Send traffic from DUT for group range 225.1.1.1-5")
2479 "i6": topo
["routers"]["i6"]["links"]["r4"]["interface"],
2480 "i2": topo
["routers"]["i2"]["links"]["r1"]["interface"],
2483 for src
, src_intf
in input_src
.items():
2484 result
= app_helper
.run_traffic(src
, IGMP_JOIN_RANGE_1
, bind_intf
=src_intf
)
2485 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2487 step("(*,G) IIF and OIL updated on both the nodes")
2489 input_dict_starg
= [
2493 "iif_r1_r2": r1_r2_links
+ r1_r3_links
,
2494 "oil": topo
["routers"]["r1"]["links"]["i1"]["interface"],
2499 "iif_r1_r2": r4_r2_links
+ r4_r3_links
,
2500 "oil": topo
["routers"]["r4"]["links"]["i7"]["interface"],
2504 for data
in input_dict_starg
:
2505 result
= verify_mroutes(
2508 data
["src_address"],
2513 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2515 result
= verify_upstream_iif(
2516 tgen
, data
["dut"], data
["iif_r1_r2"], data
["src_address"], IGMP_JOIN_RANGE_1
2518 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2521 "(S,G) IIF updated towards shortest path to source on both the nodes "
2522 ", verify using 'show ip mroute' and 'show ip mroute json'"
2525 source_i6
= topo
["routers"]["i6"]["links"]["r4"]["ipv4"].split("/")[0]
2526 source_i2
= topo
["routers"]["i2"]["links"]["r1"]["ipv4"].split("/")[0]
2530 "src_address": source_i6
,
2531 "iif": r1_r2_links
+ r1_r3_links
,
2532 "oil": topo
["routers"]["r1"]["links"]["i1"]["interface"],
2536 "src_address": source_i2
,
2537 "iif": topo
["routers"]["r1"]["links"]["i2"]["interface"],
2538 "oil": topo
["routers"]["r1"]["links"]["i1"]["interface"],
2542 "src_address": source_i6
,
2543 "iif": topo
["routers"]["r4"]["links"]["i6"]["interface"],
2544 "oil": topo
["routers"]["r4"]["links"]["i7"]["interface"],
2548 "src_address": source_i2
,
2549 "iif": r4_r2_links
+ r4_r3_links
,
2550 "oil": topo
["routers"]["r4"]["links"]["i7"]["interface"],
2554 for data
in input_dict_sg
:
2555 result
= verify_mroutes(
2558 data
["src_address"],
2563 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2566 "OIL is updated and traffic is received for all the groups on both "
2567 "the nodes , verify using 'show ip multicast'; 'show ip multicast json'"
2570 intf_r4_i6
= topo
["routers"]["r4"]["links"]["i6"]["interface"]
2571 intf_r1_i1
= topo
["routers"]["r1"]["links"]["i1"]["interface"]
2573 "r1": {"traffic_sent": [intf_r1_i1
]},
2574 "r4": {"traffic_received": [intf_r4_i6
]},
2576 result
= verify_multicast_traffic(tgen
, input_traffic
)
2577 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2579 step("Clear ip mroute from DUT")
2580 clear_mroute(tgen
, "r1")
2582 step("Clear ip mroute from r4")
2583 clear_mroute(tgen
, "r4")
2586 "Multicast traffic receiver for all the groups verify using "
2587 "'show ip multicast count'"
2590 intf_r4_i6
= topo
["routers"]["r4"]["links"]["i6"]["interface"]
2591 intf_r1_i1
= topo
["routers"]["r1"]["links"]["i1"]["interface"]
2593 "r1": {"traffic_sent": [intf_r1_i1
]},
2594 "r4": {"traffic_received": [intf_r4_i6
]},
2596 result
= verify_multicast_traffic(tgen
, input_traffic
)
2597 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2599 write_test_footer(tc_name
)
2602 def test_mroutes_updated_after_changing_rp_config_p1(request
):
2604 Verify (*,G) mroute entries after changing the RP configuration
2607 tgen
= get_topogen()
2608 tc_name
= request
.node
.name
2609 write_test_header(tc_name
)
2611 # Creating configuration from JSON
2612 app_helper
.stop_all_hosts()
2614 reset_config_on_routers(tgen
)
2615 clear_pim_interface_traffic(tgen
, topo
)
2617 # Don"t run this test if we have any failure.
2618 if tgen
.routers_have_failure():
2619 pytest
.skip(tgen
.errors
)
2621 step("Unconfigure BGP from all nodes as using static routes")
2624 DUT
= ["r1", "r2", "r3", "r4"]
2625 ASN
= [100, 200, 300, 400]
2626 for dut
, asn
in zip(DUT
, ASN
):
2627 temp
= {dut
: {"bgp": {}}}
2628 input_dict
.update(temp
)
2630 temp
[dut
]["bgp"].update({"local_as": asn
, "delete": True})
2632 result
= create_router_bgp(tgen
, topo
, input_dict
)
2633 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2635 step("Enable IGMP on DUT and R4 interface")
2636 intf_r1_i1
= topo
["routers"]["r1"]["links"]["i1"]["interface"]
2637 intf_r4_i7
= topo
["routers"]["r4"]["links"]["i7"]["interface"]
2638 for dut
, intf
in zip(["r1", "r4"], [intf_r1_i1
, intf_r4_i7
]):
2639 input_dict
= {dut
: {"igmp": {"interfaces": {intf
: {"igmp": {"version": "2"}}}}}}
2641 result
= create_igmp_config(tgen
, topo
, input_dict
)
2642 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2644 step("Send IGMP joins from DUT and R4 for group range 225.1.1.1-5")
2646 "i1": topo
["routers"]["i1"]["links"]["r1"]["interface"],
2647 "i7": topo
["routers"]["i7"]["links"]["r4"]["interface"],
2650 for recvr
, recvr_intf
in input_join
.items():
2651 result
= app_helper
.run_join(recvr
, IGMP_JOIN_RANGE_1
, join_intf
=recvr_intf
)
2652 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2654 step("Configure RP as R2 for group range 225.1.1.1-5")
2661 "rp_addr": topo
["routers"]["r2"]["links"]["lo"]["ipv4"].split(
2664 "group_addr_range": GROUP_RANGE_1
,
2671 result
= create_pim_config(tgen
, topo
, input_dict
)
2672 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2674 step("Configure static routes between nodes for making RP and source" "reachable")
2676 configure_static_routes_for_rp_reachability(tgen
, topo
)
2678 step("Done in base config: " "Enable PIM on all the interfaces of all the nodes")
2680 step("Send traffic from R4 for group range 225.1.1.1-5")
2681 step("Send traffic from DUT for group range 225.1.1.1-5")
2684 "i6": topo
["routers"]["i6"]["links"]["r4"]["interface"],
2685 "i2": topo
["routers"]["i2"]["links"]["r1"]["interface"],
2688 for src
, src_intf
in input_src
.items():
2689 result
= app_helper
.run_traffic(src
, IGMP_JOIN_RANGE_1
, bind_intf
=src_intf
)
2690 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2692 step("(*,G) IIF and OIL updated on both the nodes")
2695 "(S,G) IIF updated towards shortest path to source on both the nodes "
2696 ", verify using 'show ip mroute' and 'show ip mroute json'"
2699 source_i6
= topo
["routers"]["i6"]["links"]["r4"]["ipv4"].split("/")[0]
2700 source_i2
= topo
["routers"]["i2"]["links"]["r1"]["ipv4"].split("/")[0]
2701 input_dict_star_sg
= [
2705 "iif": r1_r2_links
+ r1_r3_links
,
2706 "oil": topo
["routers"]["r1"]["links"]["i1"]["interface"],
2711 "iif": r4_r2_links
+ r4_r3_links
,
2712 "oil": topo
["routers"]["r4"]["links"]["i7"]["interface"],
2716 "src_address": source_i6
,
2717 "iif": r1_r2_links
+ r1_r3_links
,
2718 "oil": topo
["routers"]["r1"]["links"]["i1"]["interface"],
2722 "src_address": source_i2
,
2723 "iif": topo
["routers"]["r1"]["links"]["i2"]["interface"],
2724 "oil": topo
["routers"]["r1"]["links"]["i1"]["interface"],
2728 "src_address": source_i6
,
2729 "iif": topo
["routers"]["r4"]["links"]["i6"]["interface"],
2730 "oil": topo
["routers"]["r4"]["links"]["i7"]["interface"],
2734 "src_address": source_i2
,
2735 "iif": r4_r2_links
+ r4_r3_links
,
2736 "oil": topo
["routers"]["r4"]["links"]["i7"]["interface"],
2740 for data
in input_dict_star_sg
:
2741 result
= verify_mroutes(
2744 data
["src_address"],
2749 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2752 "OIL is updated and traffic is received for all the groups on both "
2753 "the nodes , verify using 'show ip multicast'; 'show ip multicast json'"
2756 intf_r4_i6
= topo
["routers"]["r4"]["links"]["i6"]["interface"]
2757 intf_r1_i1
= topo
["routers"]["r1"]["links"]["i1"]["interface"]
2759 "r1": {"traffic_sent": [intf_r1_i1
]},
2760 "r4": {"traffic_received": [intf_r4_i6
]},
2762 result
= verify_multicast_traffic(tgen
, input_traffic
)
2763 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2766 "Verify RP has (S,G) with none OIL or Upstream should be present using 'show ip mroute json'"
2767 " 'show ip pim upstream json'"
2770 source_i6
= topo
["routers"]["i6"]["links"]["r4"]["ipv4"].split("/")[0]
2771 source_i2
= topo
["routers"]["i2"]["links"]["r1"]["ipv4"].split("/")[0]
2772 input_dict_star_sg
= [
2773 {"dut": "r2", "src_address": source_i2
, "iif": r2_r1_links
, "oil": r2_r4_links
},
2774 {"dut": "r2", "src_address": source_i6
, "iif": r2_r4_links
, "oil": r2_r1_links
},
2777 for data
in input_dict_star_sg
:
2778 result
= verify_mroutes(
2781 data
["src_address"],
2786 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2788 result
= verify_upstream_iif(
2789 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
2791 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2793 step("Verify pim interface traffic before changing RP")
2795 intf_traffic
= topo
["routers"]["r4"]["links"]["r3-link1"]["interface"]
2796 state_dict
= {"r4": {intf_traffic
: ["registerStopRx"]}}
2797 state_before
= verify_pim_interface_traffic(tgen
, state_dict
)
2800 ), "Testcase{} : Failed \n state_before is not dictionary \n " "Error: {}".format(
2804 step("Change the RP to R3 loopback for same group range (225.1.1.1-5)")
2811 "rp_addr": topo
["routers"]["r2"]["links"]["lo"]["ipv4"].split(
2814 "group_addr_range": GROUP_RANGE_1
,
2824 "rp_addr": topo
["routers"]["r3"]["links"]["lo"]["ipv4"].split(
2827 "group_addr_range": GROUP_RANGE_1
+ GROUP_RANGE_2
,
2834 result
= create_pim_config(tgen
, topo
, input_dict
)
2835 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2838 "After changing the RP to R3 , verify (S,G) with none OIL and "
2839 "upstream got cleared from R2 and created on R3 verify using "
2840 "'show ip mroute json'; 'show ip pim upstream json'"
2843 for data
in input_dict_star_sg
:
2844 if data
["src_address"] != "*":
2845 result
= verify_mroutes(
2848 data
["src_address"],
2853 assert result
is True, "Testcase {} : Failed Error: {}".format(
2857 result
= verify_upstream_iif(
2858 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
2860 assert result
is True, "Testcase {} : Failed Error: {}".format(
2864 step("(*,G) IIF on DUT is changed towards R3, verify using 'show ip mroute json'")
2866 input_dict_star_g
= [
2871 "oil": topo
["routers"]["r1"]["links"]["i1"]["interface"],
2875 for data
in input_dict_star_g
:
2876 result
= verify_mroutes(
2879 data
["src_address"],
2884 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2887 "R4 is sending null register packets to R3 'show ip pim multicast traffic json'"
2889 step("Verify pim interface traffic after changing RP")
2891 state_after
= verify_pim_interface_traffic(tgen
, state_dict
)
2894 ), "Testcase{} : Failed \n state_before is not dictionary \n " "Error: {}".format(
2898 result
= verify_state_incremented(state_before
, state_after
)
2899 assert result
is True, "Testcase{} : Failed Error: {}".format(tc_name
, result
)
2901 step("Send new IGMP join for new group range (226.1.1.1-5)")
2904 "i1": topo
["routers"]["i1"]["links"]["r1"]["interface"],
2905 "i7": topo
["routers"]["i7"]["links"]["r4"]["interface"],
2908 for recvr
, recvr_intf
in input_join
.items():
2909 result
= app_helper
.run_join(recvr
, IGMP_JOIN_RANGE_2
, join_intf
=recvr_intf
)
2910 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2912 step("Send traffic from R4 to same group range")
2915 "i6": topo
["routers"]["i6"]["links"]["r4"]["interface"],
2916 "i2": topo
["routers"]["i2"]["links"]["r1"]["interface"],
2919 for src
, src_intf
in input_src
.items():
2920 result
= app_helper
.run_traffic(src
, IGMP_JOIN_RANGE_2
, bind_intf
=src_intf
)
2921 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2923 step("(*.G) and (S,G) on LHR for group range (226.1.1.1-5)")
2925 "(*,G) joins sent towards new RP (R3) , mroute created verify using "
2926 "'show ip mroute json'"
2929 for data
in input_dict_star_sg
:
2930 result
= verify_mroutes(
2933 data
["src_address"],
2938 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2940 result
= verify_upstream_iif(
2941 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_2
2943 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2946 "Traffic is received for groups (226.1.1.1-5) , (S,G) mroute updated "
2947 "in DUT and R4 node verify using 'show ip multicast json'"
2950 result
= verify_multicast_traffic(tgen
, input_traffic
)
2951 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2953 step("Delete and Add the RP for group range 225.1.1.1-5 on DUT")
2960 "rp_addr": topo
["routers"]["r3"]["links"]["lo"]["ipv4"].split(
2963 "group_addr_range": GROUP_RANGE_1
,
2971 result
= create_pim_config(tgen
, topo
, input_dict
)
2972 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2975 "After delete of RP verify mroute got uninstall from DUT IIF updated as "
2976 "unknown in PIM state using 'show ip mroute' 'show ip pim state json'"
2979 "No impact seen to on data path as RP config removed after SPT switchover "
2980 "verify uptime and traffic using 'show ip mroute' 'show ip mroute count json'"
2983 for data
in input_dict_star_sg
:
2984 if data
["src_address"] == "*":
2985 result
= verify_mroutes(
2988 data
["src_address"],
2994 assert result
is not True, (
2995 "Testcase {} : Failed "
2996 "(*,G) entried are still present \n Error: {}".format(tc_name
, result
)
3000 result
= verify_mroutes(
3003 data
["src_address"],
3008 assert result
is True, "Testcase {} : Failed Error: {}".format(
3012 iif
= topo
["routers"]["r1"]["links"]["i2"]["interface"]
3013 oil
= topo
["routers"]["r1"]["links"]["i1"]["interface"]
3014 result
= verify_pim_state(tgen
, "r1", iif
, oil
, IGMP_JOIN_RANGE_1
, expected
=False)
3015 assert result
is not True, (
3016 "Testcase {} :Failed "
3017 "PIM state is not unknown after deleting RP \n Error: {}".format(
3027 "rp_addr": topo
["routers"]["r3"]["links"]["lo"]["ipv4"].split(
3030 "group_addr_range": GROUP_RANGE_1
,
3037 result
= create_pim_config(tgen
, topo
, input_dict
)
3038 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3041 "After Adding the RP verify IIF updated again towards RP , and DUT"
3042 " sending register packets towards RP, verify using 'show ip mroute'"
3043 " and 'show ip pim int traffic'"
3046 "No impact seen to on data path as RP config removed after SPT "
3047 "switchover verify uptime and traffic using 'show ip mroute' "
3048 "'show ip mroute count json'"
3051 for data
in input_dict_star_sg
:
3052 result
= verify_mroutes(
3055 data
["src_address"],
3060 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3062 result
= verify_multicast_traffic(tgen
, input_traffic
)
3063 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3065 write_test_footer(tc_name
)
3068 def test_mroutes_after_restart_frr_services_p2(request
):
3070 Verify mroute entries after FRR service stop and start
3073 tgen
= get_topogen()
3074 tc_name
= request
.node
.name
3075 write_test_header(tc_name
)
3077 # Creating configuration from JSON
3078 app_helper
.stop_all_hosts()
3080 reset_config_on_routers(tgen
)
3081 clear_pim_interface_traffic(tgen
, topo
)
3083 # Don"t run this test if we have any failure.
3084 if tgen
.routers_have_failure():
3085 pytest
.skip(tgen
.errors
)
3087 step("Enable IGMP on DUT and R4 interface")
3088 intf_r1_i1
= topo
["routers"]["r1"]["links"]["i1"]["interface"]
3089 intf_r4_i7
= topo
["routers"]["r4"]["links"]["i7"]["interface"]
3090 for dut
, intf
in zip(["r1", "r4"], [intf_r1_i1
, intf_r4_i7
]):
3091 input_dict
= {dut
: {"igmp": {"interfaces": {intf
: {"igmp": {"version": "2"}}}}}}
3093 result
= create_igmp_config(tgen
, topo
, input_dict
)
3094 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
3096 step("Send IGMP joins from DUT and R4 for group range 225.1.1.1-5")
3098 "i1": topo
["routers"]["i1"]["links"]["r1"]["interface"],
3099 "i7": topo
["routers"]["i7"]["links"]["r4"]["interface"],
3102 for recvr
, recvr_intf
in input_join
.items():
3103 result
= app_helper
.run_join(recvr
, IGMP_JOIN_RANGE_1
, join_intf
=recvr_intf
)
3104 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
3106 step("Configure RP as R2 for group range 225.1.1.1-5")
3113 "rp_addr": topo
["routers"]["r2"]["links"]["lo"]["ipv4"].split(
3116 "group_addr_range": GROUP_RANGE_1
,
3123 result
= create_pim_config(tgen
, topo
, input_dict
)
3124 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3126 step("Done in base config: " "Configure EBGP peering between all the nodes")
3128 step("Done in base config: " "Enable PIM on all the interfaces of all the nodes")
3130 step("Send traffic from R4 for group range 225.1.1.1-5")
3132 result
= app_helper
.run_traffic("i6", IGMP_JOIN_RANGE_1
, "r4")
3133 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3135 step("Send traffic from DUT for group range 225.1.1.1-5")
3137 result
= app_helper
.run_traffic("i2", IGMP_JOIN_RANGE_1
, "r1")
3138 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3140 step("(*,G) IIF and OIL updated on both the nodes")
3143 "(S,G) IIF updated towards shortest path to source on both the nodes "
3144 ", verify using 'show ip mroute' and 'show ip mroute json'"
3147 source_i6
= topo
["routers"]["i6"]["links"]["r4"]["ipv4"].split("/")[0]
3148 source_i2
= topo
["routers"]["i2"]["links"]["r1"]["ipv4"].split("/")[0]
3149 input_dict_star_sg
= [
3153 "iif": r1_r2_links
+ r1_r3_links
,
3154 "oil": topo
["routers"]["r1"]["links"]["i1"]["interface"],
3159 "iif": r4_r2_links
+ r4_r3_links
,
3160 "oil": topo
["routers"]["r4"]["links"]["i7"]["interface"],
3164 "src_address": source_i6
,
3165 "iif": r1_r2_links
+ r1_r3_links
,
3166 "oil": topo
["routers"]["r1"]["links"]["i1"]["interface"],
3170 "src_address": source_i2
,
3171 "iif": r1_r2_links
+ [topo
["routers"]["r1"]["links"]["i2"]["interface"]],
3172 "oil": topo
["routers"]["r1"]["links"]["i1"]["interface"],
3176 "src_address": source_i6
,
3177 "iif": topo
["routers"]["r4"]["links"]["i6"]["interface"],
3178 "oil": topo
["routers"]["r4"]["links"]["i7"]["interface"],
3182 "src_address": source_i2
,
3183 "iif": r4_r2_links
+ r4_r3_links
,
3184 "oil": topo
["routers"]["r4"]["links"]["i7"]["interface"],
3188 for data
in input_dict_star_sg
:
3189 result
= verify_mroutes(
3192 data
["src_address"],
3197 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3200 "OIL is updated and traffic is received for all the groups on both "
3201 "the nodes , verify using 'show ip multicast'; 'show ip multicast json'"
3204 intf_r4_i6
= topo
["routers"]["r4"]["links"]["i6"]["interface"]
3205 intf_r1_i1
= topo
["routers"]["r1"]["links"]["i1"]["interface"]
3207 "r1": {"traffic_sent": [intf_r1_i1
]},
3208 "r4": {"traffic_received": [intf_r4_i6
]},
3210 result
= verify_multicast_traffic(tgen
, input_traffic
)
3211 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3213 step("Stop the FRR services using kill -9 pid(s) from DUT")
3214 stop_router(tgen
, "r1")
3216 step("Start the FRR services from DUT")
3217 start_router(tgen
, "r1")
3219 step("(*,G) IIF and OIL updated on both the nodes")
3221 for data
in input_dict_star_sg
:
3222 if data
["src_address"] == "*":
3223 result
= verify_mroutes(
3226 data
["src_address"],
3231 assert result
is True, "Testcase {} : Failed Error: {}".format(
3236 "(S,G) IIF updated towards shortest path to source on both the nodes "
3237 ", verify using 'show ip mroute' and 'show ip mroute json'"
3240 for data
in input_dict_star_sg
:
3241 if data
["src_address"] != "*":
3242 result
= verify_mroutes(
3245 data
["src_address"],
3250 assert result
is True, "Testcase {} : Failed Error: {}".format(
3255 "OIL is updated and traffic is received for all the groups on both "
3256 "the nodes , verify using 'show ip multicast'; 'show ip multicast json'"
3259 intf_r4_i6
= topo
["routers"]["r4"]["links"]["i6"]["interface"]
3260 intf_r1_i1
= topo
["routers"]["r1"]["links"]["i1"]["interface"]
3262 "r1": {"traffic_sent": [intf_r1_i1
]},
3263 "r4": {"traffic_received": [intf_r4_i6
]},
3265 result
= verify_multicast_traffic(tgen
, input_traffic
)
3266 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3268 step("Stop the traffic and do frr services stop/start")
3269 app_helper
.stop_all_hosts()
3271 stop_router(tgen
, "r1")
3272 start_router(tgen
, "r1")
3275 "FRR services started with new PID , (S,G) not present "
3276 "on DUT and R4 , verify using 'show ip mroute json'"
3279 for data
in input_dict_star_sg
:
3280 if data
["src_address"] != "*":
3281 result
= verify_mroutes(
3284 data
["src_address"],
3292 ), "Testcase {}: Failed " "mroutes are still present \n Error: {}".format(
3296 step("Stop FRR on R4 node")
3298 stop_router(tgen
, "r4")
3301 "After stop of FRR on R4 node verify mroute on DUT should be "
3302 "pimreg/prune state"
3304 step("No OIL created toward R2 on R11 node")
3306 for data
in input_dict_star_sg
:
3307 result
= verify_mroutes(
3310 data
["src_address"],
3318 ), "Testcase {} : Failed " " Mroutes are still present \n Error: {}".format(
3322 step("Start FRR on R4 node")
3324 start_router(tgen
, "r4")
3326 write_test_footer(tc_name
)
3329 if __name__
== "__main__":
3330 args
= ["-s"] + sys
.argv
[1:]
3331 sys
.exit(pytest
.main(args
))