2 # SPDX-License-Identifier: ISC
5 # Copyright (c) 2020 by VMware, Inc. ("VMware")
6 # Used Copyright (c) 2018 by Network Device Education Foundation,
7 # Inc. ("NetDEF") in this file.
11 Following tests are covered to test multicast pim sm:
14 - Create topology (setup module)
17 Following tests are covered:
19 1. verify oil when join prune sent scenario_1 p0
20 2. verify oil when join prune sent scenario_2 p0
21 3. shut noshut source interface when upstream cleared from LHR p0(
22 4. shut noshut receiver interface when upstream cleared from LHR p0(
23 5. verify igmp clis p0
24 6. verify igmp cli generate query once p0
25 7. verify remove add igmp config to receiver interface p0
26 8. verify remove add igmp commands when pim configured p0
27 9. verify remove add pim commands when igmp configured p0
28 10. pim dr priority p0
29 11. pim hello timer p0
30 12. Verify mroute after removing RP sending IGMP prune p2
31 13. Verify prune is sent to LHR and FHR when PIM nbr went down
32 14. Verify mroute flag in LHR and FHR node
33 15. Verify IGMP prune processed correctly when same join received from IGMP and PIM
34 16. Verify multicast traffic flowing fine, when LHR connected to RP
35 17. Verify multicast traffic is flowing fine when FHR is connected to RP
44 from time
import sleep
48 pytestmark
= pytest
.mark
.pimd
50 # Save the Current Working Directory to find configuration files.
51 CWD
= os
.path
.dirname(os
.path
.realpath(__file__
))
52 sys
.path
.append(os
.path
.join(CWD
, "../"))
53 sys
.path
.append(os
.path
.join(CWD
, "../lib/"))
55 # Required to instantiate the topology builder class.
57 # pylint: disable=C0413
58 # Import topogen and topotest helpers
59 from lib
import topotest
60 from lib
.topogen
import Topogen
, TopoRouter
, get_topogen
61 from lib
.common_config
import (
66 reset_config_on_routers
,
67 shutdown_bringup_interface
,
70 required_linux_kernel_version
,
79 clear_pim_interface_traffic
,
84 verify_multicast_traffic
,
86 verify_multicast_flag_state
,
88 verify_pim_interface_traffic
,
90 from lib
.topolog
import logger
91 from lib
.topojson
import build_config_from_json
93 CWD
= os
.path
.dirname(os
.path
.realpath(__file__
))
94 pytestmark
= pytest
.mark
.pimd
98 i4-----c1-------------c2---i5
101 i1-----l1------r2-----f1---i2
107 i1, i2, i3. i4, i5, i6, i7, i8 - FRR running iperf to send IGMP
118 GROUP_RANGE
= "225.0.0.0/8"
119 IGMP_GROUP
= "225.1.1.1/32"
120 IGMP_JOIN
= "225.1.1.1"
121 VLAN_INTF_ADRESS_1
= "10.0.8.3/24"
129 IGMP_JOIN_RANGE_1
= ["225.1.1.1", "225.1.1.2", "225.1.1.3", "225.1.1.4", "225.1.1.5"]
137 IGMP_JOIN_RANGE_2
= ["226.1.1.1", "226.1.1.2", "226.1.1.3", "226.1.1.4", "226.1.1.5"]
145 IGMP_JOIN_RANGE_3
= ["227.1.1.1", "227.1.1.2", "227.1.1.3", "227.1.1.4", "227.1.1.5"]
147 SAME_VLAN_IP_1
= {"ip": "10.1.1.1", "subnet": "255.255.255.0", "cidr": "24"}
148 SAME_VLAN_IP_2
= {"ip": "10.1.1.2", "subnet": "255.255.255.0", "cidr": "24"}
149 SAME_VLAN_IP_3
= {"ip": "10.1.1.3", "subnet": "255.255.255.0", "cidr": "24"}
150 SAME_VLAN_IP_4
= {"ip": "10.1.1.4", "subnet": "255.255.255.0", "cidr": "24"}
153 def setup_module(mod
):
155 Sets up the pytest environment
160 # Required linux kernel version for this suite to run.
161 result
= required_linux_kernel_version("4.19")
162 if result
is not True:
163 pytest
.skip("Kernel version should be >= 4.19")
165 testsuite_run_time
= time
.asctime(time
.localtime(time
.time()))
166 logger
.info("Testsuite start time: {}".format(testsuite_run_time
))
167 logger
.info("=" * 40)
168 logger
.info("Master Topology: \n {}".format(TOPOLOGY
))
170 logger
.info("Running setup_module to create topology")
172 json_file
= "{}/multicast_pim_sm_topo3.json".format(CWD
)
173 tgen
= Topogen(json_file
, mod
.__name
__)
175 topo
= tgen
.json_topo
176 # ... and here it calls Mininet initialization functions.
178 # Starting topology, create tmp files which are loaded to routers
179 # to start daemons and then start routers
182 # Don"t run this test if we have any failure.
183 if tgen
.routers_have_failure():
184 pytest
.skip(tgen
.errors
)
186 # Creating configuration from JSON
187 build_config_from_json(tgen
, topo
)
189 # XXX Replace this using "with McastTesterHelper()... " in each test if possible.
191 app_helper
= McastTesterHelper(tgen
)
193 logger
.info("Running setup_module() done")
196 def teardown_module():
197 """Teardown the pytest environment"""
199 logger
.info("Running teardown_module to delete topology")
205 # Stop toplogy and Remove tmp files
209 "Testsuite end time: {}".format(time
.asctime(time
.localtime(time
.time())))
211 logger
.info("=" * 40)
214 #####################################################
218 #####################################################
221 def verify_mroute_repopulated(uptime_before
, uptime_after
):
223 API to compare uptime for mroutes
227 * `uptime_before` : Uptime dictionary for any particular instance
228 * `uptime_after` : Uptime dictionary for any particular instance
231 for group
in uptime_before
.keys():
232 for source
in uptime_before
[group
].keys():
233 if set(uptime_before
[group
]) != set(uptime_after
[group
]):
235 "mroute (%s, %s) has not come"
236 " up after mroute clear [FAILED!!]" % (source
, group
)
240 d1
= datetime
.datetime
.strptime(uptime_before
[group
][source
], "%H:%M:%S")
241 d2
= datetime
.datetime
.strptime(uptime_after
[group
][source
], "%H:%M:%S")
243 errormsg
= "mroute (%s, %s) is not " "repopulated [FAILED!!]" % (
249 logger
.info("mroute (%s, %s) is " "repopulated [PASSED!!]", source
, group
)
254 def verify_state_incremented(state_before
, state_after
):
256 API to compare interface traffic state incrementing
260 * `state_before` : State dictionary for any particular instance
261 * `state_after` : State dictionary for any particular instance
264 for ttype
, v1
in state_before
.items():
265 for intf
, v2
in v1
.items():
266 for state
, value
in v2
.items():
267 if value
>= state_after
[ttype
][intf
][state
]:
268 errormsg
= "[DUT: %s]: state %s value has not incremented, Initial value: %s, Current value: %s [FAILED!!]" % (
272 state_after
[ttype
][intf
][state
],
277 "[DUT: %s]: State %s value is incremented, Initial value: %s, Current value: %s [PASSED!!]",
281 state_after
[ttype
][intf
][state
],
287 def find_v2_query_msg_in_tcpdump(tgen
, router
, message
, count
, cap_file
):
289 Find v2 query messages in tcpdump file
293 * `tgen` : Topology handler
294 * `router` : Device under test
295 * `cap_file` : tcp dump file name
299 filepath
= os
.path
.join(tgen
.logdir
, router
, cap_file
)
300 with
open(filepath
) as f
:
301 if len(re
.findall("{}".format(message
), f
.read())) < count
:
302 errormsg
= "[DUT: %s]: Verify Message: %s in tcpdump" " [FAILED!!]" % (
309 "[DUT: %s]: Found message: %s in tcpdump " " count: %s [PASSED!!]",
317 def find_tos_in_tcpdump(tgen
, router
, message
, cap_file
):
319 Find v2 query messages in tcpdump file
323 * `tgen` : Topology handler
324 * `router` : Device under test
325 * `cap_file` : tcp dump file name
329 filepath
= os
.path
.join(tgen
.logdir
, router
, cap_file
)
330 with
open(filepath
) as f
:
332 if len(re
.findall(message
, f
.read())) < 1:
333 errormsg
= "[DUT: %s]: Verify Message: %s in tcpdump" " [FAILED!!]" % (
340 "[DUT: %s]: Found message: %s in tcpdump " "[PASSED!!]", router
, message
345 def verify_pim_stats_increament(stats_before
, stats_after
):
347 API to compare pim interface control plane traffic
351 * `stats_before` : Stats dictionary for any particular instance
352 * `stats_after` : Stats dictionary for any particular instance
355 for router
, stats_data
in stats_before
.items():
356 for stats
, value
in stats_data
.items():
357 if stats_before
[router
][stats
] >= stats_after
[router
][stats
]:
359 "[DUT: %s]: state %s value has not"
360 " incremented, Initial value: %s, "
361 "Current value: %s [FAILED!!]"
365 stats_before
[router
][stats
],
366 stats_after
[router
][stats
],
372 "[DUT: %s]: State %s value is "
373 "incremented, Initial value: %s, Current value: %s"
377 stats_before
[router
][stats
],
378 stats_after
[router
][stats
],
384 def test_verify_oil_when_join_prune_sent_scenario_1_p1(request
):
387 Verify OIL detail updated in (S,G) and (*,G) mroute when IGMP
392 tc_name
= request
.node
.name
393 write_test_header(tc_name
)
395 # Don"t run this test if we have any failure.
396 if tgen
.routers_have_failure():
397 pytest
.skip(tgen
.errors
)
399 # Creating configuration from JSON
400 app_helper
.stop_all_hosts()
402 reset_config_on_routers(tgen
)
403 clear_pim_interface_traffic(tgen
, topo
)
404 check_router_status(tgen
)
406 step("Enable the PIM on all the interfaces of FRR1, FRR2, FRR3")
408 "Enable IGMP of FRR1 interface and send IGMP joins "
409 " from FRR1 node for group range (226.1.1.1-5)"
412 "Enable IGMP of FRR3 interface and send IGMP joins "
413 " from FRR3 node for group range (226.1.1.1-5)"
416 intf_f1_i8
= topo
["routers"]["f1"]["links"]["i8"]["interface"]
422 "igmp": {"version": "2", "query": {"query-interval": 15}}
428 result
= create_igmp_config(tgen
, topo
, input_dict
)
429 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
432 "i1": topo
["routers"]["i1"]["links"]["l1"]["interface"],
433 "i8": topo
["routers"]["i8"]["links"]["f1"]["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 static RP for (226.1.1.1-5) in R2")
447 "rp_addr": topo
["routers"]["r2"]["links"]["lo"]["ipv4"].split(
450 "group_addr_range": GROUP_RANGE
,
457 result
= create_pim_config(tgen
, topo
, input_dict
)
458 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
461 "Configure one source on FRR3 for all the groups and send" " multicast traffic"
464 input_src
= {"i2": topo
["routers"]["i2"]["links"]["f1"]["interface"]}
466 for src
, src_intf
in input_src
.items():
467 result
= app_helper
.run_traffic(src
, IGMP_JOIN_RANGE_1
, bind_intf
=src_intf
)
468 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
470 source_i2
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
475 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
476 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
480 "src_address": source_i2
,
481 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
482 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
488 "oil": topo
["routers"]["r2"]["links"]["l1"]["interface"],
492 "src_address": source_i2
,
493 "iif": topo
["routers"]["r2"]["links"]["f1"]["interface"],
494 "oil": topo
["routers"]["r2"]["links"]["l1"]["interface"],
499 "iif": topo
["routers"]["f1"]["links"]["r2"]["interface"],
500 "oil": topo
["routers"]["f1"]["links"]["i8"]["interface"],
504 "src_address": source_i2
,
505 "iif": topo
["routers"]["f1"]["links"]["i2"]["interface"],
506 "oil": topo
["routers"]["f1"]["links"]["r2"]["interface"],
510 step("Verify mroutes and iff upstream")
512 for data
in input_dict_all
:
513 result
= verify_mroutes(
521 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
523 for data
in input_dict_all
:
524 result
= verify_upstream_iif(
525 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
527 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
529 step("Send the IGMP prune from ixia to (226.1.1.1-5) receiver on " "FRR1 node")
531 intf_l1_i1
= topo
["routers"]["l1"]["links"]["i1"]["interface"]
532 shutdown_bringup_interface(tgen
, "l1", intf_l1_i1
, False)
535 "After receiving the IGMP prune from FRR1 , verify traffic "
536 "immediately stopped for this receiver 'show ip multicast'"
539 input_traffic
= {"l1": {"traffic_sent": [intf_l1_i1
]}}
540 result
= verify_multicast_traffic(tgen
, input_traffic
, expected
=False)
541 assert result
is not True, (
542 "Testcase {} : Failed \n "
543 "Expected: [{}]: Multicast traffic should be stopped \n "
544 "Found: {}".format(tc_name
, "l1", result
)
548 "IGMP groups are remove from FRR1 node 'show ip igmp groups'"
549 " FRR3 IGMP still present"
553 result
= verify_igmp_groups(
554 tgen
, dut
, intf_l1_i1
, IGMP_JOIN_RANGE_1
, expected
=False
556 assert result
is not True, (
557 "Testcase {} : Failed \n "
558 "Expected: [{}]: IGMP groups should be deleted \n "
559 "Found: {}".format(tc_name
, dut
, result
)
563 result
= verify_igmp_groups(tgen
, dut
, intf_f1_i8
, IGMP_JOIN_RANGE_1
)
564 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
567 "(*,G) and (S,G) OIL got removed immediately after receiving"
568 " prune 'show ip pim state' and 'show ip mroute' on FRR1 node,"
569 " no impact on FRR3 receiver"
576 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
577 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
581 "src_address": source_i2
,
582 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
583 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
587 step("Verify mroutes and iff upstream")
589 for data
in input_dict_l1
:
590 result
= verify_mroutes(
599 assert result
is not True, (
600 "Testcase {} : Failed \n "
601 "Expected: [{}]: mroute (S, G) should not be present in mroute table \n "
602 "Found: {}".format(tc_name
, data
["dut"], result
)
605 for data
in input_dict_l1
:
606 result
= verify_upstream_iif(
614 assert result
is not True, (
615 "Testcase {} : Failed \n "
616 "Expected: [{}]: Upstream IIF {} should not be present \n "
617 "Found: {}".format(tc_name
, data
["dut"], data
["iif"], result
)
624 "iif": topo
["routers"]["f1"]["links"]["r2"]["interface"],
625 "oil": topo
["routers"]["f1"]["links"]["i8"]["interface"],
629 "src_address": source_i2
,
630 "iif": topo
["routers"]["f1"]["links"]["i2"]["interface"],
631 "oil": topo
["routers"]["f1"]["links"]["i8"]["interface"],
635 step("Verify mroutes and iff upstream")
637 for data
in input_dict_f1
:
638 result
= verify_mroutes(
646 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
648 for data
in input_dict_f1
:
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(tc_name
, result
)
654 step("Send the IGMP prune from ixia to (226.1.1.1-5) receiver on " " FRR3 node")
656 intf_f1_i8
= topo
["routers"]["f1"]["links"]["i8"]["interface"]
657 shutdown_bringup_interface(tgen
, "f1", intf_f1_i8
, False)
660 "After receiving the IGMP prune from FRR3s , verify traffic "
661 "immediately stopped for this receiver 'show ip multicast'"
664 input_traffic
= {"f1": {"traffic_sent": [intf_f1_i8
]}}
665 result
= verify_multicast_traffic(tgen
, input_traffic
, expected
=False)
666 assert result
is not True, (
667 "Testcase {} : Failed \n "
668 "Expected: [{}]: Multicast traffic should be stopped \n "
669 "Found: {}".format(tc_name
, "f1", result
)
673 "IGMP groups are remove from FRR1 node 'show ip igmp groups'"
674 " FRR3 IGMP still present"
678 result
= verify_igmp_groups(
679 tgen
, dut
, intf_f1_i8
, IGMP_JOIN_RANGE_1
, expected
=False
681 assert result
is not True, (
682 "Testcase {} : Failed \n "
683 "Expected: [{}]: IGMP groups should be deleted \n "
684 "Found: {}".format(tc_name
, dut
, result
)
688 "(*,G) and (S,G) OIL got prune state (none) from all the nodes"
689 "FRR1, FRR3 verify using 'show ip mroute'"
696 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
697 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
701 "src_address": source_i2
,
702 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
703 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
707 step("Verify mroutes and iff upstream")
709 for data
in input_dict_l1
:
710 result
= verify_mroutes(
719 assert result
is not True, (
720 "Testcase {} : Failed \n "
721 "Expected: [{}]: mroute (S, G) should not be present in mroute table \n "
722 "Found: {}".format(tc_name
, data
["dut"], result
)
725 for data
in input_dict_l1
:
726 result
= verify_upstream_iif(
734 assert result
is not True, (
735 "Testcase {} : Failed \n "
736 "Expected: [{}]: Upstream IIF {} should not be present \n "
737 "Found: {}".format(tc_name
, data
["dut"], data
["iif"], result
)
740 shutdown_bringup_interface(tgen
, "f1", intf_f1_i8
, True)
741 shutdown_bringup_interface(tgen
, "l1", intf_l1_i1
, True)
743 for data
in input_dict_l1
:
744 result
= verify_upstream_iif(
745 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
747 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
749 write_test_footer(tc_name
)
752 def test_verify_oil_when_join_prune_sent_scenario_2_p1(request
):
754 TC_21_2: Verify OIL detail updated in (S,G) and (*,G) mroute when IGMP
759 tc_name
= request
.node
.name
760 write_test_header(tc_name
)
762 # Don"t run this test if we have any failure.
763 if tgen
.routers_have_failure():
764 pytest
.skip(tgen
.errors
)
766 # Creating configuration from JSON
767 app_helper
.stop_all_hosts()
769 reset_config_on_routers(tgen
)
770 clear_pim_interface_traffic(tgen
, topo
)
771 check_router_status(tgen
)
773 step("Removing FRR3 to simulate topo " "FHR(FRR1)---LHR(FRR2)")
775 intf_l1_c1
= topo
["routers"]["l1"]["links"]["c1"]["interface"]
776 intf_f1_c2
= topo
["routers"]["f1"]["links"]["c2"]["interface"]
777 intf_f1_r2
= topo
["routers"]["f1"]["links"]["r2"]["interface"]
778 shutdown_bringup_interface(tgen
, "l1", intf_l1_c1
, False)
779 shutdown_bringup_interface(tgen
, "f1", intf_f1_c2
, False)
780 shutdown_bringup_interface(tgen
, "f1", intf_f1_r2
, False)
782 step("Enable the PIM on all the interfaces of FRR1, FRR2")
784 "Enable IGMP of FRR1 interface and send IGMP joins "
785 " from FRR1 node for group range (226.1.1.1-5)"
788 "Enable IGMP of FRR3 interface and send IGMP joins "
789 " from FRR3 node for group range (226.1.1.1-5)"
792 intf_r2_i3
= topo
["routers"]["r2"]["links"]["i3"]["interface"]
798 "igmp": {"version": "2", "query": {"query-interval": 15}}
804 result
= create_igmp_config(tgen
, topo
, input_dict
)
805 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
808 "i1": topo
["routers"]["i1"]["links"]["l1"]["interface"],
809 "i3": topo
["routers"]["i3"]["links"]["r2"]["interface"],
812 for recvr
, recvr_intf
in input_join
.items():
813 result
= app_helper
.run_join(recvr
, IGMP_JOIN_RANGE_1
, join_intf
=recvr_intf
)
814 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
816 step("Configure static RP for (226.1.1.1-5) in R2")
823 "rp_addr": topo
["routers"]["r2"]["links"]["lo"]["ipv4"].split(
826 "group_addr_range": GROUP_RANGE
,
833 result
= create_pim_config(tgen
, topo
, input_dict
)
834 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
839 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
840 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
846 "oil": topo
["routers"]["r2"]["links"]["l1"]["interface"],
852 "oil": topo
["routers"]["r2"]["links"]["i3"]["interface"],
856 step("Verify mroutes and iff upstream")
858 for data
in input_dict_all
:
859 result
= verify_mroutes(
867 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
869 for data
in input_dict_all
:
870 result
= verify_upstream_iif(
871 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
873 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
875 step("Send the IGMP prune from ixia to (226.1.1.1-5) receiver on " "FRR3(r2) node")
877 intf_r2_i3
= topo
["routers"]["r2"]["links"]["i3"]["interface"]
878 shutdown_bringup_interface(tgen
, "r2", intf_r2_i3
, False)
881 "After sending IGMP prune from FRR3(r2) node verify (*,G) OIL "
882 "immediately removed for local receiver mroute should have "
883 " PIM protocol , IGMP should be removed verify using "
884 "'show ip mroute' no impact seen on FRR1(l1) (*,G)"
892 "oil": topo
["routers"]["r2"]["links"]["i3"]["interface"],
896 for data
in input_dict_r2
:
897 result
= verify_mroutes(
906 assert result
is not True, (
907 "Testcase {} : Failed \n "
908 "Expected: [{}]: mroute (S, G) should not be present in mroute table \n "
909 "Found: {}".format(tc_name
, data
["dut"], result
)
916 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
917 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
923 "oil": topo
["routers"]["r2"]["links"]["l1"]["interface"],
927 step("Verify mroutes and iff upstream")
929 for data
in input_dict_l1_r2
:
930 result
= verify_mroutes(
938 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
940 step("Send the IGMP prune from ixia to (226.1.1.1-5) receiver on " "FRR1(l1) node")
942 intf_l1_i1
= topo
["routers"]["l1"]["links"]["i1"]["interface"]
943 shutdown_bringup_interface(tgen
, "l1", intf_l1_i1
, False)
946 "After sending IGMP prune from FRR1 node verify (*,G) OIL"
947 "got removed immediately from FRR1 node"
954 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
955 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
959 for data
in input_dict_l1
:
960 result
= verify_mroutes(
969 assert result
is not True, (
970 "Testcase {} : Failed \n "
971 "Expected: [{}]: mroute (S, G) should not be present in mroute table \n "
972 "Found: {}".format(tc_name
, data
["dut"], result
)
975 step("After prune is sent verify upstream got removed in FRR1 node")
977 for data
in input_dict_l1
:
978 result
= verify_upstream_iif(
986 assert result
is not True, (
987 "Testcase {} : Failed \n "
988 "Expected: [{}]: Upstream IIF {} should not be present \n "
989 "Found: {}".format(tc_name
, data
["dut"], data
["iif"], result
)
992 write_test_footer(tc_name
)
995 def test_shut_noshut_source_interface_when_upstream_cleared_from_LHR_p1(request
):
997 TC_26: Verify shut/no shut of source interface after upstream got cleared
1001 tgen
= get_topogen()
1002 tc_name
= request
.node
.name
1003 write_test_header(tc_name
)
1005 # Don"t run this test if we have any failure.
1006 if tgen
.routers_have_failure():
1007 pytest
.skip(tgen
.errors
)
1009 # Creating configuration from JSON
1010 app_helper
.stop_all_hosts()
1012 reset_config_on_routers(tgen
)
1013 clear_pim_interface_traffic(tgen
, topo
)
1014 check_router_status(tgen
)
1016 step("Enable the PIM on all the interfaces of FRR1, R2 and FRR3" " routers")
1017 step("Enable IGMP on FRR1 interface and send IGMP join " "(225.1.1.1-225.1.1.10)")
1019 input_join
= {"i1": topo
["routers"]["i1"]["links"]["l1"]["interface"]}
1021 for recvr
, recvr_intf
in input_join
.items():
1022 result
= app_helper
.run_join(recvr
, IGMP_JOIN_RANGE_1
, join_intf
=recvr_intf
)
1023 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1025 step("Configure RP on R2 (loopback interface) for " "the group range 225.0.0.0/8")
1032 "rp_addr": topo
["routers"]["r2"]["links"]["lo"]["ipv4"].split(
1035 "group_addr_range": GROUP_RANGE_1
,
1042 result
= create_pim_config(tgen
, topo
, input_dict
)
1043 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1045 step("Send multicast traffic from FRR3 to 225.1.1.1-225.1.1.10" " receiver")
1047 input_src
= {"i2": topo
["routers"]["i2"]["links"]["f1"]["interface"]}
1049 for src
, src_intf
in input_src
.items():
1050 result
= app_helper
.run_traffic(src
, IGMP_JOIN_RANGE_1
, bind_intf
=src_intf
)
1051 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1054 "'show ip mroute' showing correct RPF and OIF interface for (*,G)"
1055 " and (S,G) entries on all the nodes"
1058 source_i2
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
1063 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
1064 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
1068 "src_address": source_i2
,
1069 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
1070 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
1076 "oil": topo
["routers"]["r2"]["links"]["l1"]["interface"],
1080 "src_address": source_i2
,
1081 "iif": topo
["routers"]["r2"]["links"]["f1"]["interface"],
1082 "oil": topo
["routers"]["r2"]["links"]["l1"]["interface"],
1086 "src_address": source_i2
,
1087 "iif": topo
["routers"]["f1"]["links"]["i2"]["interface"],
1088 "oil": topo
["routers"]["f1"]["links"]["r2"]["interface"],
1093 "'show ip pim upstream' and 'show ip pim upstream-rpf' showing"
1094 " correct OIL and IIF on all the nodes"
1097 for data
in input_dict_all
:
1098 result
= verify_mroutes(
1101 data
["src_address"],
1106 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1108 for data
in input_dict_all
:
1109 result
= verify_upstream_iif(
1110 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
1112 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1114 step("Shut the source interface from FRR3")
1115 intf_f1_i2
= topo
["routers"]["f1"]["links"]["i2"]["interface"]
1116 shutdown_bringup_interface(tgen
, "f1", intf_f1_i2
, False)
1119 "After shut of source interface verify (S,G) mroutes are cleared"
1120 " from all the nodes"
1123 intf_f1_r2
= topo
["routers"]["f1"]["links"]["r2"]["interface"]
1124 result
= verify_mroutes(
1125 tgen
, "f1", source_i2
, IGMP_JOIN_RANGE_1
, intf_f1_i2
, intf_f1_r2
, expected
=False
1127 assert result
is not True, (
1128 "Testcase {} : Failed \n "
1129 "Expected: [{}]: mroute (S, G) should not be present in mroute table \n "
1130 "Found: {}".format(tc_name
, "f1", result
)
1134 "After waiting for (S,G) timeout from FRR1 for same"
1135 " source verify that (S,G) is flushed from FRR1 node"
1136 " 'show ip pim upstream' 'show ip mroute' "
1139 result
= verify_upstream_iif(
1140 tgen
, "l1", "Unknown", source_i2
, IGMP_JOIN_RANGE_1
, expected
=False
1142 assert result
is not True, (
1143 "Testcase {} : Failed \n "
1144 "Expected: [{}]: Upstream IIF should be Unknown \n "
1145 "Found: {}".format(tc_name
, "l1", result
)
1148 step("No shut the Source interface just after the upstream is expired" " from FRR1")
1149 shutdown_bringup_interface(tgen
, "f1", intf_f1_i2
, True)
1152 "After no shut of source interface , verify all the (S,G) is "
1153 " populated again on 'show ip mroute' 'show ip pim upstream' "
1154 " with proper OIL and IIF detail"
1157 for data
in input_dict_all
:
1158 result
= verify_mroutes(
1161 data
["src_address"],
1166 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1168 for data
in input_dict_all
:
1169 result
= verify_upstream_iif(
1170 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
1172 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1174 step("shut and no shut the source interface immediately")
1175 shutdown_bringup_interface(tgen
, "f1", intf_f1_i2
, False)
1176 shutdown_bringup_interface(tgen
, "f1", intf_f1_i2
, True)
1179 "All the mroutes got updated with proper OIL after no shut of"
1180 "interface verify using 'show ip mroute'"
1183 for data
in input_dict_all
:
1184 result
= verify_mroutes(
1187 data
["src_address"],
1192 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1194 for data
in input_dict_all
:
1195 result
= verify_upstream_iif(
1196 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
1198 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1200 write_test_footer(tc_name
)
1203 def test_shut_noshut_receiver_interface_when_upstream_cleared_from_LHR_p1(request
):
1205 TC_27: Verify shut/no shut of receiver interface after upstream got
1209 tgen
= get_topogen()
1210 tc_name
= request
.node
.name
1211 write_test_header(tc_name
)
1213 # Don"t run this test if we have any failure.
1214 if tgen
.routers_have_failure():
1215 pytest
.skip(tgen
.errors
)
1217 # Creating configuration from JSON
1218 app_helper
.stop_all_hosts()
1220 reset_config_on_routers(tgen
)
1221 clear_pim_interface_traffic(tgen
, topo
)
1222 check_router_status(tgen
)
1224 step("Enable the PIM on all the interfaces of FRR1, R2 and FRR3" " routers")
1225 step("Enable IGMP on FRR1 interface and send IGMP join " "(225.1.1.1-225.1.1.10)")
1227 input_join
= {"i1": topo
["routers"]["i1"]["links"]["l1"]["interface"]}
1229 for recvr
, recvr_intf
in input_join
.items():
1230 result
= app_helper
.run_join(recvr
, IGMP_JOIN_RANGE_1
, join_intf
=recvr_intf
)
1231 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1233 step("Configure RP on R2 (loopback interface) for " "the group range 225.0.0.0/8")
1240 "rp_addr": topo
["routers"]["r2"]["links"]["lo"]["ipv4"].split(
1243 "group_addr_range": GROUP_RANGE_1
,
1250 result
= create_pim_config(tgen
, topo
, input_dict
)
1251 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1253 step("Send multicast traffic from FRR3 to 225.1.1.1-225.1.1.10" " receiver")
1255 input_src
= {"i2": topo
["routers"]["i2"]["links"]["f1"]["interface"]}
1257 for src
, src_intf
in input_src
.items():
1258 result
= app_helper
.run_traffic(src
, IGMP_JOIN_RANGE_1
, bind_intf
=src_intf
)
1259 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1262 "'show ip mroute' showing correct RPF and OIF interface for (*,G)"
1263 " and (S,G) entries on all the nodes"
1266 source_i2
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
1271 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
1272 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
1276 "src_address": source_i2
,
1277 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
1278 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
1284 "oil": topo
["routers"]["r2"]["links"]["l1"]["interface"],
1288 "src_address": source_i2
,
1289 "iif": topo
["routers"]["r2"]["links"]["f1"]["interface"],
1290 "oil": topo
["routers"]["r2"]["links"]["l1"]["interface"],
1294 "src_address": source_i2
,
1295 "iif": topo
["routers"]["f1"]["links"]["i2"]["interface"],
1296 "oil": topo
["routers"]["f1"]["links"]["r2"]["interface"],
1300 for data
in input_dict_all
:
1301 result
= verify_mroutes(
1304 data
["src_address"],
1309 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1312 "'show ip pim upstream' and 'show ip pim upstream-rpf' showing"
1313 " correct OIL and IIF on all the nodes"
1316 for data
in input_dict_all
:
1317 result
= verify_upstream_iif(
1318 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
1320 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1322 step("Shut the source interface FRR1")
1323 intf_l1_i1
= topo
["routers"]["l1"]["links"]["i1"]["interface"]
1324 intf_f1_i2
= topo
["routers"]["f1"]["links"]["i2"]["interface"]
1325 intf_f1_r2
= topo
["routers"]["f1"]["links"]["r2"]["interface"]
1326 shutdown_bringup_interface(tgen
, "l1", intf_l1_i1
, False)
1329 "After waiting for (S,G) timeout from FRR1 for same"
1330 " source verify that (S,G) is flushed from FRR1 node"
1331 " 'show ip pim upstream' 'show ip mroute' "
1334 result
= verify_upstream_iif(
1335 tgen
, "l1", "Unknown", source_i2
, IGMP_JOIN_RANGE_1
, expected
=False
1337 assert result
is not True, (
1338 "Testcase {} : Failed \n "
1339 "Expected: [{}]: Upstream IIF should be Unknown \n "
1340 "Found: {}".format(tc_name
, "l1", result
)
1343 step("No shut the Source interface just after the upstream is expired" " from FRR1")
1344 shutdown_bringup_interface(tgen
, "l1", intf_l1_i1
, True)
1347 "After no shut of source interface , verify all the (S,G) is "
1348 " populated again on 'show ip mroute' 'show ip pim upstream' "
1349 " with proper OIL and IIF detail"
1352 for data
in input_dict_all
:
1353 result
= verify_mroutes(
1356 data
["src_address"],
1361 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1363 for data
in input_dict_all
:
1364 result
= verify_upstream_iif(
1365 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
1367 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1369 step("shut and no shut the source interface immediately")
1370 shutdown_bringup_interface(tgen
, "f1", intf_f1_i2
, False)
1371 shutdown_bringup_interface(tgen
, "f1", intf_f1_i2
, True)
1374 "After no shut of receiver interface , verify all the (S,G) is "
1375 "populated again on 'show ip mroute' 'show ip pim upstream' "
1376 "with proper OIL and IIF detail"
1379 for data
in input_dict_all
:
1380 result
= verify_mroutes(
1383 data
["src_address"],
1388 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1390 for data
in input_dict_all
:
1391 result
= verify_upstream_iif(
1392 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
1394 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1396 write_test_footer(tc_name
)
1399 def test_verify_remove_add_igmp_config_to_receiver_interface_p0(request
):
1401 TC_33: Verify removing and adding IGMP config from the receiver interface
1403 tgen
= get_topogen()
1404 tc_name
= request
.node
.name
1405 write_test_header(tc_name
)
1407 # Don"t run this test if we have any failure.
1408 if tgen
.routers_have_failure():
1409 pytest
.skip(tgen
.errors
)
1411 # Creating configuration from JSON
1412 app_helper
.stop_all_hosts()
1414 reset_config_on_routers(tgen
)
1415 clear_pim_interface_traffic(tgen
, topo
)
1416 check_router_status(tgen
)
1418 step("Enable PIM on all routers")
1419 step("Enable IGMP on FRR1 interface and send IGMP join " "(225.1.1.1-225.1.1.10)")
1421 input_join
= {"i1": topo
["routers"]["i1"]["links"]["l1"]["interface"]}
1423 for recvr
, recvr_intf
in input_join
.items():
1424 result
= app_helper
.run_join(recvr
, IGMP_JOIN_RANGE_1
, join_intf
=recvr_intf
)
1425 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1427 step("Configure RP for (226.1.1.1-5) and (232.1.1.1-5) in cisco-1(f1)")
1434 "rp_addr": topo
["routers"]["r2"]["links"]["lo"]["ipv4"].split(
1437 "group_addr_range": GROUP_RANGE
,
1444 result
= create_pim_config(tgen
, topo
, input_dict
)
1445 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1447 step("Configure source on FRR3 and start the traffic for" " (225.1.1.1-225.1.1.10)")
1449 input_src
= {"i2": topo
["routers"]["i2"]["links"]["f1"]["interface"]}
1451 for src
, src_intf
in input_src
.items():
1452 result
= app_helper
.run_traffic(src
, IGMP_JOIN_RANGE_1
, bind_intf
=src_intf
)
1453 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1455 step("Configure source on FRR1 and start the traffic for" " (225.1.1.1-225.1.1.10)")
1457 input_src
= {"i6": topo
["routers"]["i6"]["links"]["l1"]["interface"]}
1459 for src
, src_intf
in input_src
.items():
1460 result
= app_helper
.run_traffic(src
, IGMP_JOIN_RANGE_1
, bind_intf
=src_intf
)
1461 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1463 source_i6
= topo
["routers"]["i6"]["links"]["l1"]["ipv4"].split("/")[0]
1464 source_i2
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
1469 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
1470 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
1474 "src_address": source_i6
,
1475 "iif": topo
["routers"]["l1"]["links"]["i6"]["interface"],
1476 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
1480 "src_address": source_i2
,
1481 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
1482 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
1488 "oil": topo
["routers"]["r2"]["links"]["l1"]["interface"],
1492 "src_address": source_i2
,
1493 "iif": topo
["routers"]["f1"]["links"]["i2"]["interface"],
1494 "oil": topo
["routers"]["f1"]["links"]["r2"]["interface"],
1498 for data
in input_dict_all
:
1499 result
= verify_mroutes(
1502 data
["src_address"],
1507 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1509 for data
in input_dict_all
:
1510 result
= verify_upstream_iif(
1511 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
1513 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1515 # IGMP JSON verification
1516 step("Verify IGMP group and source JSON for single interface and group")
1517 router
= tgen
.gears
["l1"]
1519 reffile
= os
.path
.join(CWD
, "igmp_group_all_detail.json")
1520 expected
= json
.loads(open(reffile
).read())
1521 test_func
= functools
.partial(
1522 topotest
.router_json_cmp
,
1524 "show ip igmp vrf default groups detail json",
1527 _
, res
= topotest
.run_and_expect(test_func
, None, count
=60, wait
=2)
1528 assertmsg
= "IGMP group detailed output on l1 for all interfaces and all groups is not as expected. Expected: {}".format(
1531 assert res
is None, assertmsg
1533 reffile
= os
.path
.join(CWD
, "igmp_single_if_group_all_brief.json")
1534 expected
= json
.loads(open(reffile
).read())
1535 test_func
= functools
.partial(
1536 topotest
.router_json_cmp
,
1538 "show ip igmp vrf default groups l1-i1-eth1 json",
1541 _
, res
= topotest
.run_and_expect(test_func
, None, count
=60, wait
=2)
1542 assertmsg
= "IGMP group output on l1 for all groups in interface l1-i1-eth1 is not as expected. Expected: {}".format(
1545 assert res
is None, assertmsg
1547 reffile
= os
.path
.join(CWD
, "igmp_single_if_group_all_detail.json")
1548 expected
= json
.loads(open(reffile
).read())
1549 test_func
= functools
.partial(
1550 topotest
.router_json_cmp
,
1552 "show ip igmp vrf default groups l1-i1-eth1 detail json",
1555 _
, res
= topotest
.run_and_expect(test_func
, None, count
=60, wait
=2)
1556 assertmsg
= "IGMP group detailed output on l1 for all groups in interface l1-i1-eth1 is not as expected. Expected: {}".format(
1559 assert res
is None, assertmsg
1561 reffile
= os
.path
.join(CWD
, "igmp_single_if_single_group_brief.json")
1562 expected
= json
.loads(open(reffile
).read())
1563 test_func
= functools
.partial(
1564 topotest
.router_json_cmp
,
1566 "show ip igmp vrf default groups l1-i1-eth1 225.1.1.5 json",
1569 _
, res
= topotest
.run_and_expect(test_func
, None, count
=60, wait
=2)
1570 assertmsg
= "IGMP group output on l1 for interface l1-i1-eth1 and group 225.1.1.5 is not as expected. Expected: {}".format(
1573 assert res
is None, assertmsg
1575 reffile
= os
.path
.join(CWD
, "igmp_single_if_single_group_detail.json")
1576 expected
= json
.loads(open(reffile
).read())
1577 test_func
= functools
.partial(
1578 topotest
.router_json_cmp
,
1580 "show ip igmp vrf default groups l1-i1-eth1 225.1.1.5 detail json",
1583 _
, res
= topotest
.run_and_expect(test_func
, None, count
=60, wait
=2)
1584 assertmsg
= "IGMP group detailed output on l1 for interface l1-i1-eth1 and group 225.1.1.5 is not as expected. Expected: {}".format(
1587 assert res
is None, assertmsg
1589 reffile
= os
.path
.join(CWD
, "igmp_source_single_if_group_all.json")
1590 expected
= json
.loads(open(reffile
).read())
1591 test_func
= functools
.partial(
1592 topotest
.router_json_cmp
,
1594 "show ip igmp sources l1-i1-eth1 json",
1597 _
, res
= topotest
.run_and_expect(test_func
, None, count
=60, wait
=2)
1598 assertmsg
= "IGMP source output on l1 for interface l1-i1-eth1 is not as expected. Expected: {}".format(
1601 assert res
is None, assertmsg
1603 reffile
= os
.path
.join(CWD
, "igmp_source_single_if_single_group.json")
1604 expected
= json
.loads(open(reffile
).read())
1605 test_func
= functools
.partial(
1606 topotest
.router_json_cmp
,
1608 "show ip igmp sources l1-i1-eth1 225.1.1.4 json",
1611 _
, res
= topotest
.run_and_expect(test_func
, None, count
=60, wait
=2)
1612 assertmsg
= "IGMP source output on l1 for interface l1-i1-eth1 and group 225.1.1.4 is not as expected. Expected: {}".format(
1615 assert res
is None, assertmsg
1618 "Remove igmp 'no ip igmp' and 'no ip igmp version 2' from"
1619 " receiver interface of FRR1"
1622 intf_l1_i1
= topo
["routers"]["l1"]["links"]["i1"]["interface"]
1637 result
= create_igmp_config(tgen
, topo
, input_dict_2
)
1638 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1640 step("IGMP join removed from FRR1 , verify using " "'show ip igmp groups json'")
1643 interface
= topo
["routers"]["l1"]["links"]["i1"]["interface"]
1644 result
= verify_igmp_groups(tgen
, dut
, interface
, IGMP_JOIN_RANGE_1
, expected
=False)
1645 assert result
is not True, (
1646 "Testcase {} : Failed \n "
1647 "Expected: [{}]: IGMP groups should not be present \n "
1648 "Found: {}".format(tc_name
, dut
, result
)
1651 intf_l1_r2
= topo
["routers"]["l1"]["links"]["r2"]["interface"]
1652 intf_l1_i1
= topo
["routers"]["l1"]["links"]["i1"]["interface"]
1653 intf_f1_r2
= topo
["routers"]["f1"]["links"]["r2"]["interface"]
1654 intf_f1_i2
= topo
["routers"]["f1"]["links"]["i2"]["interface"]
1656 "l1": {"traffic_received": [intf_l1_r2
], "traffic_sent": [intf_l1_i1
]},
1657 "f1": {"traffic_sent": [intf_f1_r2
], "traffic_received": [intf_f1_i2
]},
1659 result
= verify_multicast_traffic(tgen
, input_traffic
)
1660 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1663 "Configure igmp 'ip igmp' and 'ip igmp version 2' from "
1664 "receiver interface of FRR1"
1672 "igmp": {"version": "2", "query": {"query-interval": 15}}
1678 result
= create_igmp_config(tgen
, topo
, input_dict_2
)
1679 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1682 "After adding IGMP on receiver interface verify (S,G) and (*,G)"
1683 " entries got populated and traffic is resumed on FRR1 and FRR3 node"
1687 "Verify OIL/IIF and drJoinDesired using 'show ip mroute , and traffic"
1688 " using show ip pim upstream and show ip multicast'"
1691 for data
in input_dict_all
:
1692 result
= verify_mroutes(
1695 data
["src_address"],
1700 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1702 for data
in input_dict_all
:
1703 result
= verify_upstream_iif(
1704 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
1706 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1708 result
= verify_multicast_traffic(tgen
, input_traffic
)
1709 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1711 step("Verify that no core is observed")
1712 if tgen
.routers_have_failure():
1713 assert False, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1716 "Remove igmp 'no ip igmp' and 'no ip igmp version 2' from"
1717 " receiver interface of FRR1"
1735 result
= create_igmp_config(tgen
, topo
, input_dict_2
)
1736 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1738 step("IGMP join removed from FRR1 , verify using " "'show ip igmp groups json'")
1741 interface
= topo
["routers"]["l1"]["links"]["i1"]["interface"]
1742 result
= verify_igmp_groups(tgen
, dut
, interface
, IGMP_JOIN_RANGE_1
, expected
=False)
1743 assert result
is not True, (
1744 "Testcase {} : Failed \n "
1745 "Expected: [{}]: IGMP groups should not be present \n "
1746 "Found: {}".format(tc_name
, dut
, result
)
1749 result
= verify_multicast_traffic(tgen
, input_traffic
)
1750 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1753 "Configure igmp 'ip igmp' and 'ip igmp version 2' from "
1754 "receiver interface of FRR1"
1762 "igmp": {"version": "2", "query": {"query-interval": 15}}
1768 result
= create_igmp_config(tgen
, topo
, input_dict_2
)
1769 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1772 "After adding IGMP on receiver interface verify (S,G) and (*,G)"
1773 " entries got populated and traffic is resumed on FRR1 and FRR3 node"
1777 "Verify OIL/IIF and drJoinDesired using 'show ip mroute , and traffic"
1778 " using show ip pim upstream and show ip multicast'"
1781 input_dict_l1_f1
= [
1785 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
1786 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
1790 "src_address": source_i6
,
1791 "iif": topo
["routers"]["l1"]["links"]["i6"]["interface"],
1792 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
1796 "src_address": source_i2
,
1797 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
1798 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
1802 "src_address": source_i2
,
1803 "iif": topo
["routers"]["f1"]["links"]["i2"]["interface"],
1804 "oil": topo
["routers"]["f1"]["links"]["r2"]["interface"],
1808 for data
in input_dict_l1_f1
:
1809 result
= verify_mroutes(
1812 data
["src_address"],
1817 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1819 for data
in input_dict_l1_f1
:
1820 result
= verify_upstream_iif(
1821 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
1823 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1825 result
= verify_multicast_traffic(tgen
, input_traffic
)
1826 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1828 step("Verify that no core is observed")
1829 if tgen
.routers_have_failure():
1830 assert False, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1832 step("Remove ip igmp and send igmp prune from FRR1 interface")
1848 result
= create_igmp_config(tgen
, topo
, input_dict_2
)
1849 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1851 "Verification: After removing igmp 'no ip igmp' and "
1852 " sending prune verify mroute and upstream got removed"
1853 " from FRR1 verify using 'show ip mroute' and "
1854 "'show ip pim upstream'"
1858 iif
= topo
["routers"]["l1"]["links"]["i6"]["interface"]
1859 oil
= topo
["routers"]["l1"]["links"]["i1"]["interface"]
1861 result
= verify_mroutes(
1862 tgen
, dut
, source
, IGMP_JOIN_RANGE_1
, iif
, oil
, expected
=False
1864 assert result
is not True, (
1865 "Testcase {} : Failed \n "
1866 "Expected: [{}]: mroute (S, G) should not be present in mroute table \n "
1867 "Found: {}".format(tc_name
, dut
, result
)
1870 write_test_footer(tc_name
)
1873 def test_verify_remove_add_igmp_commands_when_pim_configured_p0(request
):
1875 TC_34: Verify removing and adding IGMP commands when PIM is already
1879 tgen
= get_topogen()
1880 tc_name
= request
.node
.name
1881 write_test_header(tc_name
)
1883 # Don"t run this test if we have any failure.
1884 if tgen
.routers_have_failure():
1885 pytest
.skip(tgen
.errors
)
1887 # Creating configuration from JSON
1888 app_helper
.stop_all_hosts()
1890 reset_config_on_routers(tgen
)
1891 clear_pim_interface_traffic(tgen
, topo
)
1892 check_router_status(tgen
)
1894 step("Enable PIM on all routers")
1895 step("Enable IGMP on FRR1 interface and send IGMP join " "(225.1.1.1-225.1.1.10)")
1897 input_join
= {"i1": topo
["routers"]["i1"]["links"]["l1"]["interface"]}
1899 for recvr
, recvr_intf
in input_join
.items():
1900 result
= app_helper
.run_join(recvr
, IGMP_JOIN_RANGE_1
, join_intf
=recvr_intf
)
1901 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1903 step("Configure RP for (226.1.1.1-5) and (232.1.1.1-5) in cisco-1(f1)")
1910 "rp_addr": topo
["routers"]["r2"]["links"]["lo"]["ipv4"].split(
1913 "group_addr_range": GROUP_RANGE
,
1920 result
= create_pim_config(tgen
, topo
, input_dict
)
1921 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1923 step("Configure source on FRR3 and start the traffic for" " (225.1.1.1-225.1.1.10)")
1925 input_src
= {"i2": topo
["routers"]["i2"]["links"]["f1"]["interface"]}
1927 for src
, src_intf
in input_src
.items():
1928 result
= app_helper
.run_traffic(src
, IGMP_JOIN_RANGE_1
, bind_intf
=src_intf
)
1929 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1931 step("Configure source on FRR1 and start the traffic for" " (225.1.1.1-225.1.1.10)")
1933 input_src
= {"i6": topo
["routers"]["i6"]["links"]["l1"]["interface"]}
1935 for src
, src_intf
in input_src
.items():
1936 result
= app_helper
.run_traffic(src
, IGMP_JOIN_RANGE_1
, bind_intf
=src_intf
)
1937 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1939 source_i6
= topo
["routers"]["i6"]["links"]["l1"]["ipv4"].split("/")[0]
1940 source_i2
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
1945 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
1946 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
1950 "src_address": source_i6
,
1951 "iif": topo
["routers"]["l1"]["links"]["i6"]["interface"],
1952 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
1956 "src_address": source_i2
,
1957 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
1958 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
1964 "oil": topo
["routers"]["r2"]["links"]["l1"]["interface"],
1968 "src_address": source_i2
,
1969 "iif": topo
["routers"]["f1"]["links"]["i2"]["interface"],
1970 "oil": topo
["routers"]["f1"]["links"]["r2"]["interface"],
1974 for data
in input_dict_all
:
1975 result
= verify_mroutes(
1978 data
["src_address"],
1983 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1985 for data
in input_dict_all
:
1986 result
= verify_upstream_iif(
1987 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
1989 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1992 "Verification: After configuring IGMP related config , "
1993 "verify config is present in the interface "
1994 "'show ip igmp interface ensxx json'"
1997 intf_l1_i1
= topo
["routers"]["l1"]["links"]["i1"]["interface"]
2006 "query-max-response-time": 40,
2007 "query-interval": 5,
2016 result
= verify_igmp_config(tgen
, input_dict_1
)
2017 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2020 "Remove igmp 'no ip igmp' and 'no ip igmp version 2' from"
2021 " receiver interface of FRR1"
2039 result
= create_igmp_config(tgen
, topo
, input_dict_2
)
2040 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2043 "Verification: After removing the config CLI got removed "
2044 "'show ip igmp interface ensxx json'"
2047 result
= verify_igmp_config(tgen
, input_dict_1
, expected
=False)
2048 assert result
is not True, (
2049 "Testcase {} : Failed \n "
2050 "Expected: [{}]: IGMP interface should be removed \n "
2051 "Found: {}".format(tc_name
, data
["dut"], result
)
2054 step("Verify that no core is observed")
2055 if tgen
.routers_have_failure():
2056 assert False, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2058 step("Configure 'ip igmp last-member-query-count 10' on FRR1" " receiver interface")
2064 "l1-i1-eth1": {"igmp": {"query": {"last-member-query-count": 5}}}
2069 result
= create_igmp_config(tgen
, topo
, input_dict_3
)
2070 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2072 result
= verify_igmp_config(tgen
, input_dict_3
)
2073 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2075 step("Remove 'ip igmp last-member-query-count 10' on FRR1" " receiver interface")
2083 "query": {"last-member-query-count": "", "delete": True}
2090 result
= create_igmp_config(tgen
, topo
, input_dict_3
)
2091 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2097 "l1-i1-eth1": {"igmp": {"query": {"last-member-query-count": 2}}}
2102 result
= verify_igmp_config(tgen
, input_dict_3
)
2103 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2105 step("Verify that no core is observed")
2106 if tgen
.routers_have_failure():
2107 assert False, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2110 "Configure 'ip igmp last-member-query-interval 20' on FRR1"
2111 " receiver interface"
2119 "igmp": {"query": {"last-member-query-interval": 20}}
2125 result
= create_igmp_config(tgen
, topo
, input_dict_3
)
2126 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2128 result
= verify_igmp_config(tgen
, input_dict_3
)
2129 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2131 step("Remove 'ip igmp last-member-query-count 10' on FRR1" " receiver interface")
2139 "query": {"last-member-query-interval": "", "delete": True}
2146 result
= create_igmp_config(tgen
, topo
, input_dict_3
)
2147 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2154 "igmp": {"query": {"last-member-query-interval": 10}}
2160 result
= verify_igmp_config(tgen
, input_dict_3
)
2161 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2163 step("Verify that no core is observed")
2164 if tgen
.routers_have_failure():
2165 assert False, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2167 write_test_footer(tc_name
)
2170 def test_verify_remove_add_pim_commands_when_igmp_configured_p1(request
):
2172 TC_35: Verify removing and adding PIM commands when IGMP is already
2176 tgen
= get_topogen()
2177 tc_name
= request
.node
.name
2178 write_test_header(tc_name
)
2180 # Don"t run this test if we have any failure.
2181 if tgen
.routers_have_failure():
2182 pytest
.skip(tgen
.errors
)
2184 # Creating configuration from JSON
2185 app_helper
.stop_all_hosts()
2187 reset_config_on_routers(tgen
)
2188 clear_pim_interface_traffic(tgen
, topo
)
2189 check_router_status(tgen
)
2191 step("Configure 'ip pim' on receiver interface on FRR1")
2192 step("Enable PIM on all routers")
2193 step("Enable IGMP on FRR1 interface and send IGMP join " "(225.1.1.1-225.1.1.10)")
2195 input_join
= {"i1": topo
["routers"]["i1"]["links"]["l1"]["interface"]}
2197 for recvr
, recvr_intf
in input_join
.items():
2198 result
= app_helper
.run_join(recvr
, IGMP_JOIN_RANGE_1
, join_intf
=recvr_intf
)
2199 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2201 step("Configure RP for (226.1.1.1-5) and (232.1.1.1-5) in cisco-1(f1)")
2208 "rp_addr": topo
["routers"]["r2"]["links"]["lo"]["ipv4"].split(
2211 "group_addr_range": GROUP_RANGE
,
2218 result
= create_pim_config(tgen
, topo
, input_dict
)
2219 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2221 step("Remove 'no ip pim' on receiver interface on FRR1")
2223 intf_l1_i1
= topo
["routers"]["l1"]["links"]["i1"]["interface"]
2225 "l1": {"raw_config": ["interface {}".format(intf_l1_i1
), "no ip pim"]}
2227 result
= apply_raw_config(tgen
, raw_config
)
2228 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2230 step("Verify that no core is observed")
2231 if tgen
.routers_have_failure():
2232 assert False, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2234 step("Configure 'ip pim bsm' on receiver interface on FRR1")
2237 "l1": {"raw_config": ["interface {}".format(intf_l1_i1
), "ip pim bsm"]}
2239 result
= apply_raw_config(tgen
, raw_config
)
2240 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2242 step("Remove 'no ip pim bsm' on receiver interface on FRR1")
2245 "l1": {"raw_config": ["interface {}".format(intf_l1_i1
), "no ip pim bsm"]}
2247 result
= apply_raw_config(tgen
, raw_config
)
2248 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2250 step("Verify that no core is observed")
2251 if tgen
.routers_have_failure():
2252 assert False, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2254 step("Configure 'ip pim drpriority' on receiver interface on FRR1")
2258 "raw_config": ["interface {}".format(intf_l1_i1
), "ip pim drpriority 10"]
2261 result
= apply_raw_config(tgen
, raw_config
)
2262 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2265 "Verification: After configuring PIM related config, "
2266 "verify config is present in the interface "
2267 "'show ip pim interface ensxx json'"
2270 input_dict_dr
= {"l1": {"pim": {"interfaces": {intf_l1_i1
: {"drPriority": 10}}}}}
2271 result
= verify_pim_config(tgen
, input_dict_dr
)
2272 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2274 step("Remove 'no ip pim drpriority' on receiver interface on FRR1")
2278 "raw_config": ["interface {}".format(intf_l1_i1
), "no ip pim drpriority 10"]
2281 result
= apply_raw_config(tgen
, raw_config
)
2282 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2285 "Verification: After removing the config CLI got removed "
2286 "'show ip pim interface ensxx json'"
2289 input_dict_dr
= {"l1": {"pim": {"interfaces": {intf_l1_i1
: {"drPriority": 1}}}}}
2290 result
= verify_pim_config(tgen
, input_dict_dr
)
2291 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2293 step("Verify that no core is observed")
2294 if tgen
.routers_have_failure():
2295 assert False, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2297 step("Configure 'ip pim hello' on receiver interface on FRR1")
2300 "l1": {"raw_config": ["interface {}".format(intf_l1_i1
), "ip pim hello 50"]}
2302 result
= apply_raw_config(tgen
, raw_config
)
2303 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2306 "Verification: After configuring PIM related config, "
2307 "verify config is present in the interface "
2308 "'show ip pim interface ensxx json'"
2311 input_dict_dr
= {"l1": {"pim": {"interfaces": {intf_l1_i1
: {"helloPeriod": 50}}}}}
2312 result
= verify_pim_config(tgen
, input_dict_dr
)
2313 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2315 step("Remove 'no ip pim hello' on receiver interface on FRR1")
2318 "l1": {"raw_config": ["interface {}".format(intf_l1_i1
), "no ip pim hello"]}
2320 result
= apply_raw_config(tgen
, raw_config
)
2321 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2324 "Verification: After removing the config CLI got removed "
2325 "'show ip pim interface ensxx json'"
2328 input_dict_dr
= {"l1": {"pim": {"interfaces": {intf_l1_i1
: {"helloPeriod": 30}}}}}
2329 result
= verify_pim_config(tgen
, input_dict_dr
)
2330 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2332 step("Verify that no core is observed")
2333 if tgen
.routers_have_failure():
2334 assert False, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2336 step("Configure 'ip pim unicast-bsm' on receiver interface on FRR1")
2339 "l1": {"raw_config": ["interface {}".format(intf_l1_i1
), "ip pim unicast-bsm"]}
2341 result
= apply_raw_config(tgen
, raw_config
)
2342 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2344 step("Remove 'no ip pim hello' on receiver interface on FRR1")
2348 "raw_config": ["interface {}".format(intf_l1_i1
), "no ip pim unicast-bsm"]
2351 result
= apply_raw_config(tgen
, raw_config
)
2352 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2354 step("Verify that no core is observed")
2355 if tgen
.routers_have_failure():
2356 assert False, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2358 write_test_footer(tc_name
)
2361 def test_pim_dr_priority_p0(request
):
2363 TC_36: Verify highest DR priority become the PIM DR
2366 tgen
= get_topogen()
2367 tc_name
= request
.node
.name
2368 write_test_header(tc_name
)
2370 # Don"t run this test if we have any failure.
2371 if tgen
.routers_have_failure():
2372 pytest
.skip(tgen
.errors
)
2374 # Creating configuration from JSON
2375 app_helper
.stop_all_hosts()
2377 reset_config_on_routers(tgen
)
2378 clear_pim_interface_traffic(tgen
, topo
)
2379 check_router_status(tgen
)
2381 step("Configure 'ip pim' on receiver interface on FRR1")
2382 step("Enable PIM on all routers")
2383 step("Enable IGMP on FRR1 interface and send IGMP join " "(225.1.1.1-225.1.1.10)")
2385 input_join
= {"i1": topo
["routers"]["i1"]["links"]["l1"]["interface"]}
2387 for recvr
, recvr_intf
in input_join
.items():
2388 result
= app_helper
.run_join(recvr
, IGMP_JOIN_RANGE_1
, join_intf
=recvr_intf
)
2389 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2391 step("Configure RP for (226.1.1.1-5) and (232.1.1.1-5) in cisco-1(f1)")
2398 "rp_addr": topo
["routers"]["r2"]["links"]["lo"]["ipv4"].split(
2401 "group_addr_range": GROUP_RANGE
,
2408 result
= create_pim_config(tgen
, topo
, input_dict
)
2409 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2411 input_src
= {"i2": topo
["routers"]["i2"]["links"]["f1"]["interface"]}
2413 for src
, src_intf
in input_src
.items():
2414 result
= app_helper
.run_traffic(src
, IGMP_JOIN_RANGE_1
, bind_intf
=src_intf
)
2415 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2417 source_i2
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
2422 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
2423 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
2427 "src_address": source_i2
,
2428 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
2429 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
2435 "oil": topo
["routers"]["r2"]["links"]["l1"]["interface"],
2439 "src_address": source_i2
,
2440 "iif": topo
["routers"]["f1"]["links"]["i2"]["interface"],
2441 "oil": topo
["routers"]["f1"]["links"]["r2"]["interface"],
2445 for data
in input_dict_all
:
2446 result
= verify_mroutes(
2449 data
["src_address"],
2454 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2456 for data
in input_dict_all
:
2457 result
= verify_upstream_iif(
2458 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
2460 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2462 step("Configure 'ip pim drpriority 10' on receiver interface on FRR1(LHR)")
2464 intf_l1_r2
= topo
["routers"]["l1"]["links"]["r2"]["interface"]
2467 "raw_config": ["interface {}".format(intf_l1_r2
), "ip pim drpriority 10"]
2470 result
= apply_raw_config(tgen
, raw_config
)
2471 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2474 "DR config is successful on FRR1 node , verify using "
2475 " 'show ip pim interface json'"
2478 input_dict_dr
= {"l1": {"pim": {"interfaces": {intf_l1_r2
: {"drPriority": 10}}}}}
2479 result
= verify_pim_config(tgen
, input_dict_dr
)
2480 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2482 for data
in input_dict_all
:
2483 result
= verify_mroutes(
2486 data
["src_address"],
2491 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2493 for data
in input_dict_all
:
2494 result
= verify_upstream_iif(
2495 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
2497 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2499 step("Configure 'ip pim drpriority 20' on receiver interface on FRR3(FHR)")
2501 intf_f1_r2
= topo
["routers"]["f1"]["links"]["r2"]["interface"]
2504 "raw_config": ["interface {}".format(intf_f1_r2
), "ip pim drpriority 20"]
2507 result
= apply_raw_config(tgen
, raw_config
)
2508 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2511 "DR config is successful on FRR3 node , verify using "
2512 " 'show ip pim interface json'"
2515 input_dict_dr
= {"f1": {"pim": {"interfaces": {intf_f1_r2
: {"drPriority": 20}}}}}
2516 result
= verify_pim_config(tgen
, input_dict_dr
)
2517 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2519 for data
in input_dict_all
:
2520 result
= verify_mroutes(
2523 data
["src_address"],
2528 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2530 for data
in input_dict_all
:
2531 result
= verify_upstream_iif(
2532 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
2534 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2537 "PIM is enable on FRR1, FRR2 interface and neighbor is up, "
2538 " verify using 'show ip pim interface'"
2541 result
= verify_pim_interface(tgen
, topo
, "l1")
2542 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2544 result
= verify_pim_interface(tgen
, topo
, "f1")
2545 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2548 "Highet IP become PIM DR , verify using "
2549 "'show ip pim interface json' and 'show ip pim neighbor'"
2551 step("Highest priority become PIM DR")
2553 dr_address
= topo
["routers"]["l1"]["links"]["r2"]["ipv4"].split("/")[0]
2555 "l1": {"pim": {"interfaces": {intf_l1_r2
: {"drAddress": dr_address
}}}}
2557 result
= verify_pim_config(tgen
, input_dict_dr
)
2558 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2560 dr_address
= topo
["routers"]["f1"]["links"]["r2"]["ipv4"].split("/")[0]
2562 "f1": {"pim": {"interfaces": {intf_f1_r2
: {"drAddress": dr_address
}}}}
2564 result
= verify_pim_config(tgen
, input_dict_dr
)
2565 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2567 step("Remove 'no ip pim drpriority' on receiver interface on FRR1")
2571 "raw_config": ["interface {}".format(intf_l1_r2
), "no ip pim drpriority 10"]
2574 result
= apply_raw_config(tgen
, raw_config
)
2575 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2577 step("Remove 'no ip pim drpriority' on receiver interface on FRR3")
2581 "raw_config": ["interface {}".format(intf_f1_r2
), "no ip pim drpriority 20"]
2584 result
= apply_raw_config(tgen
, raw_config
)
2585 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2588 "After removing drpriority , config got removed from both the "
2589 "nodes and highest IP become PIM DR"
2592 input_dict_dr
= {"l1": {"pim": {"interfaces": {intf_l1_r2
: {"drPriority": 1}}}}}
2593 result
= verify_pim_config(tgen
, input_dict_dr
)
2594 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2596 input_dict_dr
= {"f1": {"pim": {"interfaces": {intf_f1_r2
: {"drPriority": 1}}}}}
2597 result
= verify_pim_config(tgen
, input_dict_dr
)
2598 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2600 dr_address
= topo
["routers"]["r2"]["links"]["l1"]["ipv4"].split("/")[0]
2602 "l1": {"pim": {"interfaces": {intf_l1_r2
: {"drAddress": dr_address
}}}}
2604 result
= verify_pim_config(tgen
, input_dict_dr
)
2605 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2607 dr_address
= topo
["routers"]["r2"]["links"]["f1"]["ipv4"].split("/")[0]
2609 "f1": {"pim": {"interfaces": {intf_f1_r2
: {"drAddress": dr_address
}}}}
2611 result
= verify_pim_config(tgen
, input_dict_dr
)
2612 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2614 for data
in input_dict_all
:
2615 result
= verify_mroutes(
2618 data
["src_address"],
2623 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2625 for data
in input_dict_all
:
2626 result
= verify_upstream_iif(
2627 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
2629 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2631 write_test_footer(tc_name
)
2634 def test_pim_hello_timer_p1(request
):
2636 TC_37: Verify PIM hello is sent on configured timer
2639 tgen
= get_topogen()
2640 tc_name
= request
.node
.name
2641 write_test_header(tc_name
)
2643 # Don"t run this test if we have any failure.
2644 if tgen
.routers_have_failure():
2645 pytest
.skip(tgen
.errors
)
2647 # Creating configuration from JSON
2648 app_helper
.stop_all_hosts()
2650 reset_config_on_routers(tgen
)
2651 clear_pim_interface_traffic(tgen
, topo
)
2652 check_router_status(tgen
)
2654 step("Configure 'ip pim' on receiver interface on FRR1")
2655 step("Enable PIM on all routers")
2656 step("Enable IGMP on FRR1 interface and send IGMP join " "(225.1.1.1-225.1.1.10)")
2658 input_join
= {"i1": topo
["routers"]["i1"]["links"]["l1"]["interface"]}
2660 for recvr
, recvr_intf
in input_join
.items():
2661 result
= app_helper
.run_join(recvr
, IGMP_JOIN_RANGE_1
, join_intf
=recvr_intf
)
2662 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2664 step("Configure RP for (226.1.1.1-5) and (232.1.1.1-5) in cisco-1(f1)")
2671 "rp_addr": topo
["routers"]["r2"]["links"]["lo"]["ipv4"].split(
2674 "group_addr_range": GROUP_RANGE
,
2681 result
= create_pim_config(tgen
, topo
, input_dict
)
2682 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2684 step("Configure PIM hello interval timer 100 on FRR1 node (FRR1-FRR2 link)")
2686 intf_l1_r2
= topo
["routers"]["l1"]["links"]["r2"]["interface"]
2688 "l1": {"raw_config": ["interface {}".format(intf_l1_r2
), "ip pim hello 100"]}
2690 result
= apply_raw_config(tgen
, raw_config
)
2691 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2694 "PIM hello interval is configured on interface verify using "
2695 "'show ip pim interface'"
2698 input_dict_hello
= {
2699 "l1": {"pim": {"interfaces": {intf_l1_r2
: {"helloPeriod": 100}}}}
2701 result
= verify_pim_config(tgen
, input_dict_hello
)
2702 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2704 step("Modify hello timer to 180 and then 50sec")
2706 intf_l1_r2
= topo
["routers"]["l1"]["links"]["r2"]["interface"]
2708 "l1": {"raw_config": ["interface {}".format(intf_l1_r2
), "ip pim hello 180"]}
2710 result
= apply_raw_config(tgen
, raw_config
)
2711 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2714 "PIM hello interval is configured on interface verify using "
2715 "'show ip pim interface'"
2718 input_dict_hello
= {
2719 "l1": {"pim": {"interfaces": {intf_l1_r2
: {"helloPeriod": 180}}}}
2721 result
= verify_pim_config(tgen
, input_dict_hello
)
2722 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2724 intf_l1_r2
= topo
["routers"]["l1"]["links"]["r2"]["interface"]
2726 "l1": {"raw_config": ["interface {}".format(intf_l1_r2
), "ip pim hello 50"]}
2728 result
= apply_raw_config(tgen
, raw_config
)
2729 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2732 "PIM hello interval is configured on interface verify using "
2733 "'show ip pim interface'"
2736 input_dict_hello
= {
2737 "l1": {"pim": {"interfaces": {intf_l1_r2
: {"helloPeriod": 50}}}}
2739 result
= verify_pim_config(tgen
, input_dict_hello
)
2740 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2742 step("Verify that no core is observed")
2743 if tgen
.routers_have_failure():
2744 assert False, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2746 write_test_footer(tc_name
)
2749 def test_mroute_after_removing_RP_sending_IGMP_prune_p2(request
):
2751 TC_39 Verify mroute after removing the RP and sending IGMP prune
2754 tgen
= get_topogen()
2755 tc_name
= request
.node
.name
2756 write_test_header(tc_name
)
2758 # Don"t run this test if we have any failure.
2759 if tgen
.routers_have_failure():
2760 pytest
.skip(tgen
.errors
)
2762 # Creating configuration from JSON
2763 app_helper
.stop_all_hosts()
2765 reset_config_on_routers(tgen
)
2766 clear_pim_interface_traffic(tgen
, topo
)
2767 check_router_status(tgen
)
2770 "Remove cisco connected link to simulate topo "
2771 "LHR(FRR1(f1))----RP(cisco(f1)---FHR(FRR3(l1))"
2774 intf_l1_c1
= topo
["routers"]["l1"]["links"]["c1"]["interface"]
2775 intf_f1_c2
= topo
["routers"]["f1"]["links"]["c2"]["interface"]
2776 shutdown_bringup_interface(tgen
, "l1", intf_l1_c1
, False)
2777 shutdown_bringup_interface(tgen
, "f1", intf_f1_c2
, False)
2779 step("Enable the PIM on all the interfaces of FRR1, FRR2, FRR3")
2781 "Enable IGMP of FRR1 interface and send IGMP joins "
2782 " from FRR1 node for group range (225.1.1.1-5)"
2785 intf_f1_i8
= topo
["routers"]["f1"]["links"]["i8"]["interface"]
2791 "igmp": {"version": "2", "query": {"query-interval": 15}}
2797 result
= create_igmp_config(tgen
, topo
, input_dict
)
2798 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2800 input_join
= {"i8": topo
["routers"]["i8"]["links"]["f1"]["interface"]}
2802 for recvr
, recvr_intf
in input_join
.items():
2803 result
= app_helper
.run_join(recvr
, IGMP_JOIN_RANGE_1
, join_intf
=recvr_intf
)
2804 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2806 step("Configure static RP for (225.1.1.1-5) as R2")
2813 "rp_addr": topo
["routers"]["r2"]["links"]["lo"]["ipv4"].split(
2816 "group_addr_range": GROUP_RANGE
,
2823 result
= create_pim_config(tgen
, topo
, input_dict
)
2824 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2827 "Send traffic from FHR to all the groups ( 225.1.1.1 to 225.1.1.5) and send"
2828 " multicast traffic"
2831 input_src
= {"i6": topo
["routers"]["i6"]["links"]["l1"]["interface"]}
2833 for src
, src_intf
in input_src
.items():
2834 result
= app_helper
.run_traffic(src
, IGMP_JOIN_RANGE_1
, bind_intf
=src_intf
)
2835 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2837 source_i2
= topo
["routers"]["i6"]["links"]["l1"]["ipv4"].split("/")[0]
2842 "src_address": source_i2
,
2843 "iif": topo
["routers"]["l1"]["links"]["i6"]["interface"],
2844 "oil": topo
["routers"]["l1"]["links"]["r2"]["interface"],
2849 "iif": topo
["routers"]["f1"]["links"]["r2"]["interface"],
2850 "oil": topo
["routers"]["f1"]["links"]["i8"]["interface"],
2854 "src_address": source_i2
,
2855 "iif": topo
["routers"]["f1"]["links"]["r2"]["interface"],
2856 "oil": topo
["routers"]["f1"]["links"]["i8"]["interface"],
2860 step("Verify mroutes and iff upstream")
2862 for data
in input_dict_all
:
2863 result
= verify_mroutes(
2866 data
["src_address"],
2871 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2873 for data
in input_dict_all
:
2874 result
= verify_upstream_iif(
2875 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
2877 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2879 step("Remove the RP config for both the range from all the nodes")
2886 "rp_addr": topo
["routers"]["r2"]["links"]["lo"]["ipv4"].split(
2889 "group_addr_range": GROUP_RANGE
,
2897 result
= create_pim_config(tgen
, topo
, input_dict
)
2898 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2900 input_dict_starg
= [
2904 "iif": topo
["routers"]["f1"]["links"]["r2"]["interface"],
2905 "oil": topo
["routers"]["f1"]["links"]["i8"]["interface"],
2912 "src_address": source_i2
,
2913 "iif": topo
["routers"]["l1"]["links"]["i6"]["interface"],
2914 "oil": topo
["routers"]["l1"]["links"]["r2"]["interface"],
2918 "src_address": source_i2
,
2919 "iif": topo
["routers"]["f1"]["links"]["r2"]["interface"],
2920 "oil": topo
["routers"]["f1"]["links"]["i8"]["interface"],
2924 for data
in input_dict_starg
:
2925 result
= verify_mroutes(
2928 data
["src_address"],
2934 assert result
is not True, (
2935 "Testcase {} : Failed \n "
2936 "Expected: [{}]: mroute (S, G) should not be present in mroute table \n "
2937 "Found: {}".format(tc_name
, data
["dut"], result
)
2940 for data
in input_dict_sg
:
2941 result
= verify_mroutes(
2944 data
["src_address"],
2949 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2951 step("Send prune from receiver-1 (using ctrl+c) on iperf interface")
2952 app_helper
.stop_all_hosts()
2954 intf_f1_i8
= topo
["routers"]["f1"]["links"]["i8"]["interface"]
2955 input_traffic
= {"f1": {"traffic_sent": [intf_f1_i8
]}}
2956 traffic_before
= verify_multicast_traffic(tgen
, input_traffic
, return_traffic
=True)
2957 assert isinstance(traffic_before
, dict), (
2958 "Testcase {} : Failed \n traffic_before is not dictionary \n "
2959 "Error: {}".format(tc_name
, result
)
2962 step("IGMP groups are remove from FRR1 node 'show ip igmp groups'")
2965 result
= verify_igmp_groups(
2966 tgen
, dut
, intf_f1_i8
, IGMP_JOIN_RANGE_1
, expected
=False
2968 assert result
is not True, (
2969 "Testcase {} : Failed \n "
2970 "Expected: [{}]: IGMP groups should not present \n "
2971 "Found: {}".format(tc_name
, dut
, result
)
2975 "After receiving the IGMP prune from FRR1 , verify traffic "
2976 "immediately stopped for this receiver 'show ip multicast'"
2979 intf_f1_i8
= topo
["routers"]["f1"]["links"]["i8"]["interface"]
2980 input_traffic
= {"f1": {"traffic_sent": [intf_f1_i8
]}}
2981 traffic_after
= verify_multicast_traffic(tgen
, input_traffic
, return_traffic
=True)
2982 assert isinstance(traffic_after
, dict), (
2983 "Testcase {} : Failed \n traffic_after is not dictionary \n "
2984 "Error: {}".format(tc_name
, result
)
2987 result
= verify_state_incremented(traffic_before
, traffic_after
)
2988 assert result
is not True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2989 logger
.info("Expected Behaviour: {}".format(result
))
2991 step("Configure static RP for (225.1.1.1-5) as R2 loopback interface")
2998 "rp_addr": topo
["routers"]["r2"]["links"]["lo"]["ipv4"].split(
3001 "group_addr_range": GROUP_RANGE
,
3008 result
= create_pim_config(tgen
, topo
, input_dict
)
3009 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3011 step("Send IGMP joins again from LHR,check IGMP joins and starg received")
3013 for recvr
, recvr_intf
in input_join
.items():
3014 result
= app_helper
.run_join(recvr
, IGMP_JOIN_RANGE_1
, join_intf
=recvr_intf
)
3015 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
3017 for data
in input_dict_starg
:
3018 result
= verify_mroutes(
3021 data
["src_address"],
3026 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3028 step("Send traffic from FHR and verify mroute upstream")
3030 for src
, src_intf
in input_src
.items():
3031 result
= app_helper
.run_traffic(src
, IGMP_JOIN_RANGE_1
, bind_intf
=src_intf
)
3032 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3034 source_i2
= topo
["routers"]["i6"]["links"]["l1"]["ipv4"].split("/")[0]
3036 for data
in input_dict_sg
:
3037 result
= verify_mroutes(
3040 data
["src_address"],
3045 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3047 write_test_footer(tc_name
)
3050 def test_prune_sent_to_LHR_and_FHR_when_PIMnbr_down_p2(request
):
3052 TC_38 Verify prune is sent to LHR and FHR when PIM nbr went down
3055 tgen
= get_topogen()
3056 tc_name
= request
.node
.name
3057 write_test_header(tc_name
)
3059 # Don"t run this test if we have any failure.
3060 if tgen
.routers_have_failure():
3061 pytest
.skip(tgen
.errors
)
3063 # Creating configuration from JSON
3064 app_helper
.stop_all_hosts()
3066 reset_config_on_routers(tgen
)
3067 clear_pim_interface_traffic(tgen
, topo
)
3068 check_router_status(tgen
)
3071 "Remove cisco connected link to simulate topo "
3072 "LHR(FRR1(f1))----RP(cisco(f1)---FHR(FRR3(l1))"
3075 intf_l1_c1
= topo
["routers"]["l1"]["links"]["c1"]["interface"]
3076 intf_f1_c2
= topo
["routers"]["f1"]["links"]["c2"]["interface"]
3077 shutdown_bringup_interface(tgen
, "l1", intf_l1_c1
, False)
3078 shutdown_bringup_interface(tgen
, "f1", intf_f1_c2
, False)
3080 step("Enable the PIM on all the interfaces of FRR1, FRR2, FRR3")
3082 "Enable IGMP of FRR1 interface and send IGMP joins "
3083 " from FRR1 node for group range (225.1.1.1-5)"
3086 intf_f1_i8
= topo
["routers"]["f1"]["links"]["i8"]["interface"]
3092 "igmp": {"version": "2", "query": {"query-interval": 15}}
3098 result
= create_igmp_config(tgen
, topo
, input_dict
)
3099 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
3101 input_join
= {"i8": topo
["routers"]["i8"]["links"]["f1"]["interface"]}
3103 for recvr
, recvr_intf
in input_join
.items():
3104 result
= app_helper
.run_join(recvr
, IGMP_JOIN_RANGE_1
, join_intf
=recvr_intf
)
3105 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
3107 step("Configure static RP for (225.1.1.1-5) as R2")
3114 "rp_addr": topo
["routers"]["r2"]["links"]["lo"]["ipv4"].split(
3117 "group_addr_range": GROUP_RANGE
,
3124 result
= create_pim_config(tgen
, topo
, input_dict
)
3125 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3128 "Send traffic from FHR to all the groups ( 225.1.1.1 to 225.1.1.5) and send"
3129 " multicast traffic"
3133 "i6": topo
["routers"]["i6"]["links"]["l1"]["interface"],
3134 "i2": topo
["routers"]["i2"]["links"]["f1"]["interface"],
3137 for src
, src_intf
in input_src
.items():
3138 result
= app_helper
.run_traffic(src
, IGMP_JOIN_RANGE_1
, bind_intf
=src_intf
)
3139 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3141 source_i2
= topo
["routers"]["i6"]["links"]["l1"]["ipv4"].split("/")[0]
3142 source_i1
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
3147 "src_address": source_i2
,
3148 "iif": topo
["routers"]["l1"]["links"]["i6"]["interface"],
3149 "oil": topo
["routers"]["l1"]["links"]["r2"]["interface"],
3154 "iif": topo
["routers"]["f1"]["links"]["r2"]["interface"],
3155 "oil": topo
["routers"]["f1"]["links"]["i8"]["interface"],
3159 "src_address": source_i1
,
3160 "iif": topo
["routers"]["f1"]["links"]["i2"]["interface"],
3161 "oil": topo
["routers"]["f1"]["links"]["i8"]["interface"],
3165 "src_address": source_i2
,
3166 "iif": topo
["routers"]["f1"]["links"]["r2"]["interface"],
3167 "oil": topo
["routers"]["f1"]["links"]["i8"]["interface"],
3171 step("Verify mroutes and iff upstream")
3173 for data
in input_dict_all
:
3174 result
= verify_mroutes(
3177 data
["src_address"],
3182 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3184 for data
in input_dict_all
:
3185 result
= verify_upstream_iif(
3186 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
3188 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3189 step("Verify mcast traffic received")
3190 intf_f1_i8
= topo
["routers"]["f1"]["links"]["i8"]["interface"]
3191 input_traffic
= {"f1": {"traffic_sent": [intf_f1_i8
]}}
3193 result
= verify_multicast_traffic(tgen
, input_traffic
)
3194 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3196 step("Shut the link from LHR to RP from RP node")
3198 intf_r2_f1
= topo
["routers"]["r2"]["links"]["f1"]["interface"]
3199 shutdown_bringup_interface(tgen
, "r2", intf_r2_f1
, False)
3201 step("Verify RP info after Shut the link from LHR to RP from RP node")
3203 rp_address
= "1.0.5.17"
3205 result
= verify_pim_rp_info(
3206 tgen
, topo
, dut
, GROUP_RANGE_1
, "Unknown", rp_address
, SOURCE
3208 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3210 input_dict_starg
= [
3214 "iif": topo
["routers"]["f1"]["links"]["r2"]["interface"],
3215 "oil": topo
["routers"]["f1"]["links"]["i8"]["interface"],
3219 input_dict_sg_i2
= [
3222 "src_address": source_i2
,
3223 "iif": topo
["routers"]["l1"]["links"]["i6"]["interface"],
3224 "oil": topo
["routers"]["l1"]["links"]["r2"]["interface"],
3228 "src_address": source_i2
,
3229 "iif": topo
["routers"]["f1"]["links"]["r2"]["interface"],
3230 "oil": topo
["routers"]["f1"]["links"]["i8"]["interface"],
3234 input_dict_sg_i1
= [
3237 "src_address": source_i1
,
3238 "iif": topo
["routers"]["f1"]["links"]["i2"]["interface"],
3239 "oil": topo
["routers"]["f1"]["links"]["i8"]["interface"],
3243 input_dict_sg_i2_l1
= [
3246 "src_address": source_i2
,
3247 "iif": topo
["routers"]["l1"]["links"]["i6"]["interface"],
3248 "oil": topo
["routers"]["l1"]["links"]["r2"]["interface"],
3252 step("Verify mroute after Shut the link from LHR to RP from RP node")
3254 for data
in input_dict_starg
:
3255 result
= verify_mroutes(
3258 data
["src_address"],
3264 assert result
is not True, (
3265 "Testcase {} : Failed \n "
3266 "Expected: [{}]: mroute (S, G) should not be present in mroute table \n "
3267 "Found: {}".format(tc_name
, data
["dut"], result
)
3270 for data
in input_dict_sg_i1
:
3271 result
= verify_mroutes(
3274 data
["src_address"],
3279 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3281 step("Verify upstream after Shut the link from LHR to RP from RP node")
3283 for data
in input_dict_starg
:
3284 result
= verify_upstream_iif(
3288 data
["src_address"],
3292 assert result
is not True, (
3293 "Testcase {} : Failed \n "
3294 "Expected: [{}]: Upstream IIF interface {} should not be present\n"
3295 "Found: {}".format(tc_name
, data
["dut"], data
["iif"], result
)
3298 for data
in input_dict_sg_i1
:
3299 result
= verify_upstream_iif(
3300 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
3302 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3304 step("No shut the link from LHR to RP from RP node")
3306 intf_r2_f1
= topo
["routers"]["r2"]["links"]["f1"]["interface"]
3307 shutdown_bringup_interface(tgen
, "r2", intf_r2_f1
, True)
3309 step("Verify RP info after No shut the link from LHR to RP from RP node")
3311 rp_address
= "1.0.5.17"
3313 result
= verify_pim_rp_info(
3314 tgen
, topo
, dut
, GROUP_RANGE_1
, "Unknown", rp_address
, SOURCE
, expected
=False
3316 assert result
is not True, (
3317 "Testcase {} : Failed \n "
3318 "Expected: [{}]: RP IIF should be updated as Unknown \n "
3319 "Found: {}".format(tc_name
, dut
, result
)
3322 step("Verify mroute after No shut the link from LHR to RP from RP node")
3324 for data
in input_dict_starg
:
3325 result
= verify_mroutes(
3328 data
["src_address"],
3333 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3335 for data
in input_dict_sg_i2
:
3336 result
= verify_mroutes(
3339 data
["src_address"],
3344 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3346 for data
in input_dict_sg_i1
:
3347 result
= verify_mroutes(
3350 data
["src_address"],
3355 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3357 step("Verify upstrem after No shut the link from LHR to RP from RP node")
3359 for data
in input_dict_starg
:
3360 result
= verify_upstream_iif(
3361 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
3363 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3365 for data
in input_dict_sg_i1
:
3366 result
= verify_upstream_iif(
3367 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
3369 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3371 for data
in input_dict_sg_i2
:
3372 result
= verify_upstream_iif(
3373 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
3375 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3377 step("Verify mcast traffic received after noshut LHR to RP from RP node")
3379 intf_f1_i8
= topo
["routers"]["f1"]["links"]["i8"]["interface"]
3380 input_traffic
= {"f1": {"traffic_sent": [intf_f1_i8
]}}
3381 result
= verify_multicast_traffic(tgen
, input_traffic
)
3382 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3384 step("Shut the link from FHR to RP from RP node")
3386 intf_r2_l1
= topo
["routers"]["r2"]["links"]["l1"]["interface"]
3387 shutdown_bringup_interface(tgen
, "r2", intf_r2_l1
, False)
3389 step("Verify RP info after Shut the link from FHR to RP from RP node")
3391 rp_address
= "1.0.5.17"
3393 result
= verify_pim_rp_info(
3394 tgen
, topo
, dut
, GROUP_RANGE_1
, "Unknown", rp_address
, SOURCE
3396 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3398 step("Verify mroute after Shut the link from FHR to RP from RP node")
3400 for data
in input_dict_starg
:
3401 result
= verify_mroutes(
3404 data
["src_address"],
3409 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3411 for data
in input_dict_sg_i1
:
3412 result
= verify_mroutes(
3415 data
["src_address"],
3420 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3422 step("Verify upstream after Shut the link from FHR to RP from RP node")
3424 for data
in input_dict_starg
:
3425 result
= verify_upstream_iif(
3426 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
3428 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3430 for data
in input_dict_sg_i1
:
3431 result
= verify_upstream_iif(
3432 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
3434 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3436 for data
in input_dict_sg_i2_l1
:
3437 result
= verify_upstream_iif(
3441 data
["src_address"],
3445 assert result
is not True, (
3446 "Testcase {} : Failed \n "
3447 "Expected: [{}]: Upstream IIF interface {} should not be present"
3448 " after shutting link from RP to FHR \n"
3449 "Found: {}".format(tc_name
, data
["dut"], data
["iif"], result
)
3452 step(" No shut the link from FHR to RP from RP node")
3454 intf_r2_l1
= topo
["routers"]["r2"]["links"]["l1"]["interface"]
3455 shutdown_bringup_interface(tgen
, "r2", intf_r2_l1
, True)
3457 step("Verify RP info after Noshut the link from FHR to RP from RP node")
3460 rp_address
= "1.0.5.17"
3462 result
= verify_pim_rp_info(
3463 tgen
, topo
, dut
, GROUP_RANGE_1
, "Unknown", rp_address
, SOURCE
, expected
=False
3465 assert result
is not True, (
3466 "Testcase {} : Failed \n "
3467 "Expected: [{}]: RP IIF should be updated as Unknown \n"
3468 "Found: {}".format(tc_name
, dut
, result
)
3471 step("Verify mroute after Noshut the link from FHR to RP from RP node")
3473 for data
in input_dict_starg
:
3474 result
= verify_mroutes(
3477 data
["src_address"],
3482 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3484 for data
in input_dict_sg_i2
:
3485 result
= verify_mroutes(
3488 data
["src_address"],
3493 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3495 for data
in input_dict_sg_i1
:
3496 result
= verify_mroutes(
3499 data
["src_address"],
3504 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3506 step("Verify mroute after Noshut the link from FHR to RP from RP node")
3508 for data
in input_dict_starg
:
3509 result
= verify_upstream_iif(
3510 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
3512 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3514 for data
in input_dict_sg_i1
:
3515 result
= verify_upstream_iif(
3516 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
3518 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3520 for data
in input_dict_sg_i2
:
3521 result
= verify_upstream_iif(
3522 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
3524 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3526 step("Verify mcast traffic received after noshut FHR to RP from RP node")
3527 intf_f1_i8
= topo
["routers"]["f1"]["links"]["i8"]["interface"]
3528 input_traffic
= {"f1": {"traffic_sent": [intf_f1_i8
]}}
3529 result
= verify_multicast_traffic(tgen
, input_traffic
)
3530 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3532 step("Shut the link from FHR to RP from FHR node")
3534 intf_l1_r2
= topo
["routers"]["l1"]["links"]["r2"]["interface"]
3535 shutdown_bringup_interface(tgen
, "l1", intf_l1_r2
, False)
3537 step("Verify PIM Nbrs after Shut the link from FHR to RP from FHR node")
3539 step("Verify RP info after Shut the link from FHR to RP from FHR node")
3541 rp_address
= "1.0.5.17"
3543 result
= verify_pim_rp_info(
3544 tgen
, topo
, dut
, GROUP_RANGE_1
, "Unknown", rp_address
, SOURCE
3546 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3548 step("Verify mroute after Shut the link from FHR to RP from FHR node")
3550 for data
in input_dict_starg
:
3551 result
= verify_mroutes(
3554 data
["src_address"],
3559 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3561 for data
in input_dict_sg_i1
:
3562 result
= verify_mroutes(
3565 data
["src_address"],
3570 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3572 step("Verify upstream after Shut the link from FHR to RP from FHR node")
3573 for data
in input_dict_starg
:
3574 result
= verify_upstream_iif(
3575 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
3577 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3579 for data
in input_dict_sg_i1
:
3580 result
= verify_upstream_iif(
3581 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
3583 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3585 for data
in input_dict_sg_i2_l1
:
3586 result
= verify_upstream_iif(
3590 data
["src_address"],
3594 assert result
is not True, (
3595 "Testcase {} : Failed \n "
3596 "Expected: [{}]: Upstream IIF interface {} should not be present"
3597 " after shutting link from FHR to RP \n"
3598 "Found: {}".format(tc_name
, data
["dut"], data
["iif"], result
)
3601 step(" No shut the link from FHR to RP from FHR node")
3603 intf_l1_r2
= topo
["routers"]["l1"]["links"]["r2"]["interface"]
3604 shutdown_bringup_interface(tgen
, "l1", intf_l1_r2
, True)
3606 step("Verify RP info after No Shut the link from FHR to RP from FHR node")
3608 rp_address
= "1.0.5.17"
3610 result
= verify_pim_rp_info(
3611 tgen
, topo
, dut
, GROUP_RANGE_1
, "Unknown", rp_address
, SOURCE
, expected
=False
3613 assert result
is not True, (
3614 "Testcase {} : Failed \n "
3615 "Expected: [{}]: RP IIF should be updated as Unknown \n"
3616 "Found: {}".format(tc_name
, dut
, result
)
3619 step("Verify mroute after No Shut the link from FHR to RP from FHR node")
3621 for data
in input_dict_starg
:
3622 result
= verify_mroutes(
3625 data
["src_address"],
3630 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3632 for data
in input_dict_sg_i2
:
3633 result
= verify_mroutes(
3636 data
["src_address"],
3641 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3643 for data
in input_dict_sg_i1
:
3644 result
= verify_mroutes(
3647 data
["src_address"],
3652 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3654 step("Verify upstream after No Shut the link from FHR to RP from FHR node")
3656 for data
in input_dict_starg
:
3657 result
= verify_upstream_iif(
3658 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
3660 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3662 for data
in input_dict_sg_i1
:
3663 result
= verify_upstream_iif(
3664 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
3666 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3668 for data
in input_dict_sg_i2
:
3669 result
= verify_upstream_iif(
3670 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
3672 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3674 step("Verify mcast traffic received after noshut FHR to RP from FHR node")
3675 intf_f1_i8
= topo
["routers"]["f1"]["links"]["i8"]["interface"]
3676 input_traffic
= {"f1": {"traffic_sent": [intf_f1_i8
]}}
3677 result
= verify_multicast_traffic(tgen
, input_traffic
)
3678 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3680 write_test_footer(tc_name
)
3683 def test_mroute_flags_p1(request
):
3685 TC_47 Verify mroute flag in LHR and FHR node
3688 tgen
= get_topogen()
3689 tc_name
= request
.node
.name
3690 write_test_header(tc_name
)
3692 # Don"t run this test if we have any failure.
3693 if tgen
.routers_have_failure():
3694 pytest
.skip(tgen
.errors
)
3696 # Creating configuration from JSON
3697 app_helper
.stop_all_hosts()
3699 reset_config_on_routers(tgen
)
3700 clear_pim_interface_traffic(tgen
, topo
)
3701 check_router_status(tgen
)
3704 "Remove cisco connected link to simulate topo "
3705 "LHR(FRR1(f1))----RP(cisco(f1)---FHR(FRR3(l1))"
3708 intf_l1_c1
= topo
["routers"]["l1"]["links"]["c1"]["interface"]
3709 intf_f1_c2
= topo
["routers"]["f1"]["links"]["c2"]["interface"]
3710 shutdown_bringup_interface(tgen
, "l1", intf_l1_c1
, False)
3711 shutdown_bringup_interface(tgen
, "f1", intf_f1_c2
, False)
3713 step("Enable the PIM on all the interfaces of FRR1, FRR2, FRR3")
3715 "Enable IGMP of FRR1 interface and send IGMP joins "
3716 " from FRR1 node for group range (225.1.1.1-5)"
3719 intf_f1_i8
= topo
["routers"]["f1"]["links"]["i8"]["interface"]
3725 "igmp": {"version": "2", "query": {"query-interval": 15}}
3731 result
= create_igmp_config(tgen
, topo
, input_dict
)
3732 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
3734 input_join
= {"i8": topo
["routers"]["i8"]["links"]["f1"]["interface"]}
3736 for recvr
, recvr_intf
in input_join
.items():
3737 result
= app_helper
.run_join(recvr
, IGMP_JOIN_RANGE_1
, join_intf
=recvr_intf
)
3738 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
3740 step("Configure static RP for (225.1.1.1-5) as R2")
3747 "rp_addr": topo
["routers"]["r2"]["links"]["lo"]["ipv4"].split(
3750 "group_addr_range": GROUP_RANGE
,
3757 result
= create_pim_config(tgen
, topo
, input_dict
)
3758 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3761 "Send traffic from FHR to all the groups ( 225.1.1.1 to 225.1.1.5) and send"
3762 " multicast traffic"
3766 "i6": topo
["routers"]["i6"]["links"]["l1"]["interface"],
3767 "i2": topo
["routers"]["i2"]["links"]["f1"]["interface"],
3770 for src
, src_intf
in input_src
.items():
3771 result
= app_helper
.run_traffic(src
, IGMP_JOIN_RANGE_1
, bind_intf
=src_intf
)
3772 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3774 source_i2
= topo
["routers"]["i6"]["links"]["l1"]["ipv4"].split("/")[0]
3775 source_i1
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
3780 "src_address": source_i2
,
3781 "iif": topo
["routers"]["l1"]["links"]["i6"]["interface"],
3782 "oil": topo
["routers"]["l1"]["links"]["r2"]["interface"],
3787 "iif": topo
["routers"]["f1"]["links"]["r2"]["interface"],
3788 "oil": topo
["routers"]["f1"]["links"]["i8"]["interface"],
3792 "src_address": source_i1
,
3793 "iif": topo
["routers"]["f1"]["links"]["i2"]["interface"],
3794 "oil": topo
["routers"]["f1"]["links"]["i8"]["interface"],
3798 "src_address": source_i2
,
3799 "iif": topo
["routers"]["f1"]["links"]["r2"]["interface"],
3800 "oil": topo
["routers"]["f1"]["links"]["i8"]["interface"],
3804 step("Verify mroutes and iff upstream")
3806 for data
in input_dict_all
:
3807 result
= verify_mroutes(
3810 data
["src_address"],
3815 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3817 result
= verify_upstream_iif(
3818 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
3820 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3823 step("verify flag for (*,G) on f1")
3826 result
= verify_multicast_flag_state(
3827 tgen
, dut
, src_address
, IGMP_JOIN_RANGE_1
, flag
3829 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3831 step("verify flag for (S,G) on f1 for Remote spurce ")
3832 src_address
= source_i2
3834 result
= verify_multicast_flag_state(
3835 tgen
, dut
, src_address
, IGMP_JOIN_RANGE_1
, flag
3837 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3839 write_test_footer(tc_name
)
3842 def test_verify_multicast_traffic_when_LHR_connected_to_RP_p1(request
):
3844 TC_11: Verify multicast traffic flowing fine, when LHR connected to RP
3846 FHR(FRR3(l1))---LHR(FRR1(r2)----RP(FRR2(f1))
3849 tgen
= get_topogen()
3850 tc_name
= request
.node
.name
3851 write_test_header(tc_name
)
3853 # Don"t run this test if we have any failure.
3854 if tgen
.routers_have_failure():
3855 pytest
.skip(tgen
.errors
)
3857 # Creating configuration from JSON
3858 app_helper
.stop_all_hosts()
3860 reset_config_on_routers(tgen
)
3861 clear_pim_interface_traffic(tgen
, topo
)
3862 check_router_status(tgen
)
3865 "Remove FRR3 to cisco connected link to simulate topo "
3866 "FHR(FRR3(l1))---LHR(FRR1(r2)----RP(FRR2(f1))"
3869 intf_l1_c1
= topo
["routers"]["l1"]["links"]["c1"]["interface"]
3870 intf_f1_c2
= topo
["routers"]["f1"]["links"]["c2"]["interface"]
3871 shutdown_bringup_interface(tgen
, "l1", intf_l1_c1
, False)
3872 shutdown_bringup_interface(tgen
, "f1", intf_f1_c2
, False)
3874 step("Disable IGMP config from l1")
3889 result
= create_igmp_config(tgen
, topo
, input_dict_2
)
3890 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
3892 step("Enable the PIM on all the interfaces of FRR1, R2 and FRR3" " routers")
3894 "Enable IGMP on FRR1(r2) interface and send IGMP join (226.1.1.1-5)"
3895 " and (232.1.1.1-5)"
3898 intf_r2_i3
= topo
["routers"]["r2"]["links"]["i3"]["interface"]
3904 "igmp": {"version": "2", "query": {"query-interval": 15}}
3910 result
= create_igmp_config(tgen
, topo
, input_dict
)
3911 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
3913 _GROUP_RANGE
= GROUP_RANGE_2
+ GROUP_RANGE_3
3914 _IGMP_JOIN_RANGE
= IGMP_JOIN_RANGE_2
+ IGMP_JOIN_RANGE_3
3916 input_join
= {"i3": topo
["routers"]["i3"]["links"]["r2"]["interface"]}
3918 for recvr
, recvr_intf
in input_join
.items():
3919 result
= app_helper
.run_join(recvr
, _IGMP_JOIN_RANGE
, join_intf
=recvr_intf
)
3920 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
3922 step("Configure RP for (226.1.1.1-5) and (232.1.1.1-5) in (f1)")
3929 "rp_addr": topo
["routers"]["f1"]["links"]["lo"]["ipv4"].split(
3932 "group_addr_range": _GROUP_RANGE
,
3939 result
= create_pim_config(tgen
, topo
, input_dict
)
3940 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3942 step("Send multicast traffic from FRR3 to 225.1.1.1-225.1.1.10" " receiver")
3944 input_src
= {"i1": topo
["routers"]["i1"]["links"]["l1"]["interface"]}
3946 for src
, src_intf
in input_src
.items():
3947 result
= app_helper
.run_traffic(src
, _IGMP_JOIN_RANGE
, bind_intf
=src_intf
)
3948 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3951 "'show ip mroute' showing correct RPF and OIF interface for (*,G)"
3952 " and (S,G) entries on all the nodes"
3955 source_i1
= topo
["routers"]["i1"]["links"]["l1"]["ipv4"].split("/")[0]
3959 "src_address": source_i1
,
3960 "iif": topo
["routers"]["l1"]["links"]["i1"]["interface"],
3961 "oil": topo
["routers"]["l1"]["links"]["r2"]["interface"],
3966 "iif": topo
["routers"]["r2"]["links"]["f1"]["interface"],
3967 "oil": topo
["routers"]["r2"]["links"]["i3"]["interface"],
3971 "src_address": source_i1
,
3972 "iif": topo
["routers"]["r2"]["links"]["l1"]["interface"],
3973 "oil": topo
["routers"]["r2"]["links"]["i3"]["interface"],
3977 for data
in input_dict_all
:
3978 result
= verify_mroutes(
3981 data
["src_address"],
3986 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3988 for data
in input_dict_all
:
3989 result
= verify_upstream_iif(
3990 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
3992 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3995 "Multicast traffic is flowing for all the groups verify"
3996 "using 'show ip multicast'"
3999 intf_l1_i1
= topo
["routers"]["l1"]["links"]["i1"]["interface"]
4000 intf_r2_l1
= topo
["routers"]["r2"]["links"]["l1"]["interface"]
4001 intf_r2_f1
= topo
["routers"]["r2"]["links"]["f1"]["interface"]
4002 intf_r2_i3
= topo
["routers"]["r2"]["links"]["i3"]["interface"]
4003 intf_f1_r2
= topo
["routers"]["f1"]["links"]["r2"]["interface"]
4005 "l1": {"traffic_received": [intf_l1_i1
]},
4006 "r2": {"traffic_received": [intf_r2_l1
], "traffic_sent": [intf_r2_i3
]},
4008 result
= verify_multicast_traffic(tgen
, input_traffic
)
4009 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4011 step("Shut and No shut the receiver port")
4013 intf_r2_i3
= topo
["routers"]["r2"]["links"]["i3"]["interface"]
4014 shutdown_bringup_interface(tgen
, "r2", intf_r2_i3
, False)
4017 "Verification: After Shut of receiver port, Verify (*,G) and "
4018 "(S,G) got removed from LHR node (FRR1) using 'show ip mroute'"
4025 "iif": topo
["routers"]["r2"]["links"]["f1"]["interface"],
4026 "oil": topo
["routers"]["r2"]["links"]["i3"]["interface"],
4030 "src_address": source_i1
,
4031 "iif": topo
["routers"]["r2"]["links"]["l1"]["interface"],
4032 "oil": topo
["routers"]["r2"]["links"]["i3"]["interface"],
4036 for data
in input_dict_r2
:
4037 result
= verify_mroutes(
4040 data
["src_address"],
4046 assert result
is not True, (
4047 "Testcase {} : Failed \n "
4048 "Expected: [{}]: mroute (S, G) should not be present in mroute table \n "
4049 "Found: {}".format(tc_name
, data
["dut"], result
)
4052 shutdown_bringup_interface(tgen
, "r2", intf_r2_i3
, True)
4055 "Verification: After No shut of receiver port , Verify (*,G)"
4056 " and (S,G) got populated on LHR node (FRR1) using "
4057 "'show ip mroute' 'show ip pim upstream'"
4060 for data
in input_dict_r2
:
4061 result
= verify_mroutes(
4064 data
["src_address"],
4069 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4071 for data
in input_dict_r2
:
4072 result
= verify_upstream_iif(
4073 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
4075 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4078 "Multicast traffic is resumed for all the groups verify "
4079 "using 'show ip multicast'"
4082 result
= verify_multicast_traffic(tgen
, input_traffic
)
4083 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4085 step("Shut and No shut the source port")
4087 intf_l1_i1
= topo
["routers"]["l1"]["links"]["i1"]["interface"]
4088 shutdown_bringup_interface(tgen
, "l1", intf_l1_i1
, False)
4091 "Verification: After Shut of source port, Verify (*,G) and "
4092 "(S,G) got removed from LHR node (FRR1) using 'show ip mroute'"
4098 "src_address": source_i1
,
4099 "iif": topo
["routers"]["l1"]["links"]["i1"]["interface"],
4100 "oil": topo
["routers"]["l1"]["links"]["r2"]["interface"],
4104 for data
in input_dict_l1
:
4105 result
= verify_mroutes(
4108 data
["src_address"],
4114 assert result
is not True, (
4115 "Testcase {} : Failed \n "
4116 "Expected: [{}]: mroute (S, G) should not be present in mroute table \n "
4117 "Found: {}".format(tc_name
, data
["dut"], result
)
4120 shutdown_bringup_interface(tgen
, "l1", intf_l1_i1
, True)
4123 "Verification: After No shut of source port , Verify (*,G)"
4124 " and (S,G) got populated on LHR node (FRR1) using "
4125 "'show ip mroute' 'show ip pim upstream'"
4128 for data
in input_dict_l1
:
4129 result
= verify_mroutes(
4132 data
["src_address"],
4137 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4139 for data
in input_dict_l1
:
4140 result
= verify_upstream_iif(
4141 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
4143 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4146 "Multicast traffic is resumed for all the groups verify "
4147 "using 'show ip multicast'"
4150 result
= verify_multicast_traffic(tgen
, input_traffic
)
4151 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4153 step("Shut and No shut of LHR to cisco port from LHR side")
4155 intf_r2_f1
= topo
["routers"]["r2"]["links"]["f1"]["interface"]
4156 shutdown_bringup_interface(tgen
, "r2", intf_r2_f1
, False)
4159 "Verification: After Shut of source port, Verify (S,G) got "
4160 "removed from LHR and FHR using 'show ip mroute'"
4163 input_dict_r2_f1
= [
4167 "iif": topo
["routers"]["r2"]["links"]["f1"]["interface"],
4168 "oil": topo
["routers"]["r2"]["links"]["i3"]["interface"],
4174 "oil": topo
["routers"]["f1"]["links"]["r2"]["interface"],
4178 for data
in input_dict_r2_f1
:
4179 result
= verify_mroutes(
4182 data
["src_address"],
4188 assert result
is not True, (
4189 "Testcase {} : Failed \n "
4190 "Expected: [{}]: mroute (S, G) should not be present in mroute table \n "
4191 "Found: {}".format(tc_name
, data
["dut"], result
)
4194 shutdown_bringup_interface(tgen
, "r2", intf_r2_f1
, True)
4197 "Verification: After No shut of source port , Verify (*,G)"
4198 " and (S,G) got populated on LHR node (FRR1) using "
4199 "'show ip mroute' 'show ip pim upstream'"
4202 for data
in input_dict_all
:
4203 result
= verify_mroutes(
4206 data
["src_address"],
4211 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4213 for data
in input_dict_all
:
4214 result
= verify_upstream_iif(
4215 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
4217 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4220 "Multicast traffic is resumed for all the groups verify "
4221 "using 'show ip multicast'"
4224 input_traffic_r2
= {
4225 "r2": {"traffic_received": [intf_r2_l1
], "traffic_sent": [intf_r2_i3
]}
4227 result
= verify_multicast_traffic(tgen
, input_traffic_r2
)
4228 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4230 step("Shut and no shut of FHR to LHR port from FHR side")
4232 intf_l1_r2
= topo
["routers"]["l1"]["links"]["r2"]["interface"]
4233 shutdown_bringup_interface(tgen
, "l1", intf_l1_r2
, False)
4236 "Verification: After Shut of LHR to FHR port, Verify (S,G)"
4237 "got removed from LHR 'show ip mroute'"
4242 iif
= topo
["routers"]["r2"]["links"]["f1"]["interface"]
4243 oil
= topo
["routers"]["r2"]["links"]["i3"]["interface"]
4245 result
= verify_mroutes(tgen
, dut
, src_address
, _IGMP_JOIN_RANGE
, iif
, oil
)
4246 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4248 src_address
= source_i1
4249 iif
= topo
["routers"]["r2"]["links"]["l1"]["interface"]
4250 oil
= topo
["routers"]["r2"]["links"]["i3"]["interface"]
4252 result
= verify_mroutes(
4253 tgen
, dut
, src_address
, _IGMP_JOIN_RANGE
, iif
, oil
, expected
=False
4255 assert result
is not True, (
4256 "Testcase {} : Failed \n "
4257 "Expected: [{}]: mroute (S, G) should not be present in mroute table \n "
4258 "Found: {}".format(tc_name
, dut
, result
)
4261 shutdown_bringup_interface(tgen
, "l1", intf_l1_r2
, True)
4264 "Verification: After No shut of source port , Verify (*,G)"
4265 " and (S,G) got populated on LHR node (FRR1) using "
4266 "'show ip mroute' 'show ip pim upstream'"
4269 for data
in input_dict_all
:
4270 result
= verify_mroutes(
4273 data
["src_address"],
4278 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4280 for data
in input_dict_all
:
4281 result
= verify_upstream_iif(
4282 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
4284 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4287 "Multicast traffic is resumed for all the groups verify "
4288 "using 'show ip multicast'"
4291 result
= verify_multicast_traffic(tgen
, input_traffic_r2
)
4292 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4294 write_test_footer(tc_name
)
4297 def test_verify_multicast_traffic_when_FHR_connected_to_RP_p1(request
):
4299 TC_12: Verify multicast traffic is flowing fine when FHR is connected to RP
4301 LHR(FRR1)---FHR(FRR3)----RP(FRR2)
4304 tgen
= get_topogen()
4305 tc_name
= request
.node
.name
4306 write_test_header(tc_name
)
4308 # Don"t run this test if we have any failure.
4309 if tgen
.routers_have_failure():
4310 pytest
.skip(tgen
.errors
)
4312 # Creating configuration from JSON
4313 app_helper
.stop_all_hosts()
4315 reset_config_on_routers(tgen
)
4316 clear_pim_interface_traffic(tgen
, topo
)
4317 check_router_status(tgen
)
4320 "Remove FRR3 to FRR2 connected link to simulate topo "
4321 "FHR(FRR3)---LHR(FRR1)----RP(FFR2)"
4324 intf_l1_c1
= topo
["routers"]["l1"]["links"]["c1"]["interface"]
4325 intf_f1_c2
= topo
["routers"]["f1"]["links"]["c2"]["interface"]
4326 shutdown_bringup_interface(tgen
, "l1", intf_l1_c1
, False)
4327 shutdown_bringup_interface(tgen
, "f1", intf_f1_c2
, False)
4329 step("Enable the PIM on all the interfaces of FRR1, R2 and FRR3" " routers")
4330 step("Enable IGMP on FRR1(l1) interface and send IGMP join " " and (225.1.1.1-5)")
4332 _GROUP_RANGE
= GROUP_RANGE_2
+ GROUP_RANGE_3
4333 _IGMP_JOIN_RANGE
= IGMP_JOIN_RANGE_2
+ IGMP_JOIN_RANGE_3
4335 input_join
= {"i1": topo
["routers"]["i1"]["links"]["l1"]["interface"]}
4337 for recvr
, recvr_intf
in input_join
.items():
4338 result
= app_helper
.run_join(recvr
, _IGMP_JOIN_RANGE
, join_intf
=recvr_intf
)
4339 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
4341 step("Configure RP for (225.1.1.1-5) in (f1)")
4348 "rp_addr": topo
["routers"]["f1"]["links"]["lo"]["ipv4"].split(
4351 "group_addr_range": _GROUP_RANGE
,
4358 result
= create_pim_config(tgen
, topo
, input_dict
)
4359 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4361 step("Send multicast traffic from FRR3(r2) to 225.1.1.1-225.1.1.10" " receiver")
4363 input_src
= {"i3": topo
["routers"]["i3"]["links"]["r2"]["interface"]}
4365 for src
, src_intf
in input_src
.items():
4366 result
= app_helper
.run_traffic(src
, _IGMP_JOIN_RANGE
, bind_intf
=src_intf
)
4367 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4370 "'show ip mroute' showing correct RPF and OIF interface for (*,G)"
4371 " and (S,G) entries on all the nodes"
4374 source_i3
= topo
["routers"]["i3"]["links"]["r2"]["ipv4"].split("/")[0]
4379 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
4380 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
4384 "src_address": source_i3
,
4385 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
4386 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
4391 "iif": topo
["routers"]["r2"]["links"]["f1"]["interface"],
4392 "oil": topo
["routers"]["r2"]["links"]["l1"]["interface"],
4396 "src_address": source_i3
,
4397 "iif": topo
["routers"]["r2"]["links"]["i3"]["interface"],
4398 "oil": topo
["routers"]["r2"]["links"]["l1"]["interface"],
4402 for data
in input_dict_all
:
4403 result
= verify_mroutes(
4406 data
["src_address"],
4411 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4413 for data
in input_dict_all
:
4414 result
= verify_upstream_iif(
4415 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
4417 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4419 intf_l1_r2
= topo
["routers"]["l1"]["links"]["r2"]["interface"]
4420 intf_f1_r2
= topo
["routers"]["f1"]["links"]["r2"]["interface"]
4421 intf_l1_i1
= topo
["routers"]["l1"]["links"]["i1"]["interface"]
4423 "l1": {"traffic_received": [intf_l1_r2
], "traffic_sent": [intf_l1_i1
]}
4425 result
= verify_multicast_traffic(tgen
, input_traffic
)
4426 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4428 step("Shut the receiver(l1) port in 1 min interval")
4430 shutdown_bringup_interface(tgen
, "l1", intf_l1_i1
, False)
4433 "Verification: After Shut of receiver port, Verify (*,G) and "
4434 "(S,G) got removed from LHR node (FRR1) using 'show ip mroute'"
4440 "src_address": source_i3
,
4441 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
4442 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
4446 for data
in input_dict_l1
:
4447 result
= verify_mroutes(
4450 data
["src_address"],
4456 assert result
is not True, (
4457 "Testcase {} : Failed \n "
4458 "Expected: [{}]: mroute (S, G) should not be present in mroute table \n "
4459 "Found: {}".format(tc_name
, data
["dut"], result
)
4462 step("No shut the receiver(l1) port in 1 min interval")
4464 shutdown_bringup_interface(tgen
, "l1", intf_l1_i1
, True)
4467 "Verification: After No shut of receiver port , Verify (*,G)"
4468 " and (S,G) got populated on LHR node (FRR1) using "
4469 "'show ip mroute' 'show ip pim upstream'"
4472 for data
in input_dict_l1
:
4473 result
= verify_mroutes(
4476 data
["src_address"],
4481 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4483 for data
in input_dict_l1
:
4484 result
= verify_upstream_iif(
4485 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
4487 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4489 result
= verify_multicast_traffic(tgen
, input_traffic
)
4490 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4492 step("Shut the source(r2) port in 1 min interval")
4494 intf_r2_i3
= topo
["routers"]["r2"]["links"]["i3"]["interface"]
4495 shutdown_bringup_interface(tgen
, "r2", intf_r2_i3
, False)
4498 "Verification: After Shut of source port, Verify (S,G) got "
4499 "removed from FHR using 'show ip mroute'"
4505 "src_address": source_i3
,
4506 "iif": topo
["routers"]["r2"]["links"]["i3"]["interface"],
4507 "oil": topo
["routers"]["r2"]["links"]["l1"]["interface"],
4511 for data
in input_dict_r2
:
4512 result
= verify_mroutes(
4515 data
["src_address"],
4521 assert result
is not True, (
4522 "Testcase {} : Failed \n "
4523 "Expected: [{}]: mroute (S, G) should not be present in mroute table \n "
4524 "Found: {}".format(tc_name
, data
["dut"], result
)
4527 step("No shut the source(r2) port in 1 min interval")
4529 shutdown_bringup_interface(tgen
, "r2", intf_r2_i3
, True)
4532 "Verification: After No shut of source port , Verify (*,G)"
4533 " and (S,G) got populated on LHR and FHR using "
4534 "'show ip mroute' 'show ip pim upstream'"
4537 for data
in input_dict_r2
:
4538 result
= verify_mroutes(
4541 data
["src_address"],
4546 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4548 for data
in input_dict_r2
:
4549 result
= verify_upstream_iif(
4550 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
4552 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4554 result
= verify_multicast_traffic(tgen
, input_traffic
)
4555 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4557 step("Shut FHR to RP port from FHR side")
4559 intf_r2_f1
= topo
["routers"]["r2"]["links"]["f1"]["interface"]
4560 shutdown_bringup_interface(tgen
, "r2", intf_r2_f1
, False)
4563 "Verification: After Shut of FHR to cisco port, Verify (*,G) "
4564 "got removed from FHR and cisco node using 'show ip mroute'"
4567 input_dict_all_star
= [
4571 "iif": topo
["routers"]["r2"]["links"]["f1"]["interface"],
4572 "oil": topo
["routers"]["r2"]["links"]["l1"]["interface"],
4578 "oil": topo
["routers"]["f1"]["links"]["r2"]["interface"],
4582 for data
in input_dict_all_star
:
4583 result
= verify_mroutes(
4586 data
["src_address"],
4592 assert result
is not True, (
4593 "Testcase {} : Failed \n "
4594 "Expected: [{}]: mroute (S, G) should not be present in mroute table \n "
4595 "Found: {}".format(tc_name
, data
["dut"], result
)
4598 write_test_footer(tc_name
)
4601 def test_PIM_passive_p1(request
):
4603 TC Verify PIM passive functionality"
4606 tgen
= get_topogen()
4607 tc_name
= request
.node
.name
4608 write_test_header(tc_name
)
4609 app_helper
.stop_all_hosts()
4610 # Creating configuration from JSON
4612 if tgen
.routers_have_failure():
4613 check_router_status(tgen
)
4614 reset_config_on_routers(tgen
)
4615 clear_pim_interface_traffic(tgen
, topo
)
4617 step("Enable the PIM on all the interfaces of FRR1, FRR2, FRR3")
4619 "Enable IGMP of FRR1 interface and send IGMP joins "
4620 " from FRR1 node for group range (225.1.1.1-5)"
4623 intf_c1_i4
= topo
["routers"]["c1"]["links"]["i4"]["interface"]
4626 "configure PIM passive on receiver interface to verify no impact on IGMP join"
4627 "and multicast traffic on pim passive interface"
4631 "c1": {"raw_config": ["interface {}".format(intf_c1_i4
), "ip pim passive"]}
4633 result
= apply_raw_config(tgen
, raw_config
)
4634 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4636 step("configure IGMPv2 and send IGMP joinon on PIM passive interface")
4638 "c1": {"igmp": {"interfaces": {intf_c1_i4
: {"igmp": {"version": "2"}}}}}
4640 result
= create_igmp_config(tgen
, topo
, input_dict
)
4641 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
4643 input_join
= {"i4": topo
["routers"]["i4"]["links"]["c1"]["interface"]}
4644 for recvr
, recvr_intf
in input_join
.items():
4645 result
= app_helper
.run_join(recvr
, IGMP_JOIN_RANGE_1
, join_intf
=recvr_intf
)
4646 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
4648 step("Configure static RP for (225.1.1.1-5) as R2")
4655 "rp_addr": topo
["routers"]["r2"]["links"]["lo"]["ipv4"].split(
4658 "group_addr_range": GROUP_RANGE_1
,
4665 result
= create_pim_config(tgen
, topo
, input_dict
)
4666 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4668 step("Send Mcast traffic from C2 to all the groups ( 225.1.1.1 to 225.1.1.5)")
4670 input_src
= {"i5": topo
["routers"]["i5"]["links"]["c2"]["interface"]}
4671 for src
, src_intf
in input_src
.items():
4672 result
= app_helper
.run_traffic(src
, IGMP_JOIN_RANGE_1
, bind_intf
=src_intf
)
4673 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4675 source_i5
= topo
["routers"]["i5"]["links"]["c2"]["ipv4"].split("/")[0]
4677 input_dict_starg
= [
4681 "iif": topo
["routers"]["c1"]["links"]["l1"]["interface"],
4682 "oil": topo
["routers"]["c1"]["links"]["i4"]["interface"],
4689 "src_address": source_i5
,
4690 "iif": topo
["routers"]["c1"]["links"]["c2"]["interface"],
4691 "oil": topo
["routers"]["c1"]["links"]["i4"]["interface"],
4695 step("(*,G) and (S,G) created on f1 and node verify using 'show ip mroute'")
4697 for data
in input_dict_sg
:
4698 result
= verify_mroutes(
4701 data
["src_address"],
4706 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4708 for data
in input_dict_sg
:
4709 result
= verify_mroutes(
4712 data
["src_address"],
4717 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4719 for data
in input_dict_starg
:
4720 result
= verify_mroutes(
4723 data
["src_address"],
4728 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4730 intf_c1_c2
= topo
["routers"]["c1"]["links"]["c2"]["interface"]
4731 intf_c2_c1
= topo
["routers"]["c2"]["links"]["c1"]["interface"]
4734 "configure PIM passive on upstream interface to verify"
4735 "hello tx/rx counts are not incremented"
4738 # Changing hello timer to 3sec for checking more number of packets
4743 "interface {}".format(intf_c1_c2
),
4748 "c2": {"raw_config": ["interface {}".format(intf_c2_c1
), "ip pim hello 3"]},
4750 result
= apply_raw_config(tgen
, raw_config
)
4751 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4753 step("verify PIM hello tx/rx stats on C1")
4756 intf_c1_c2
: ["helloTx", "helloRx"],
4760 logger
.info("waiting for 5 sec config to get apply and hello count update")
4763 c1_state_before
= verify_pim_interface_traffic(tgen
, state_dict
)
4765 c1_state_before
, dict
4766 ), "Testcase{} : Failed \n state_before is not dictionary \n " "Error: {}".format(
4771 "sleeping for 30 sec hello interval timer to verify count are not increamented"
4775 c1_state_after
= verify_pim_interface_traffic(tgen
, state_dict
)
4777 c1_state_after
, dict
4778 ), "Testcase{} : Failed \n state_before is not dictionary \n " "Error: {}".format(
4782 step("verify stats not increamented on c1")
4783 result
= verify_pim_stats_increament(c1_state_before
, c1_state_after
)
4786 ), "Testcase{} : Failed Error: {}" "stats incremented".format(tc_name
, result
)
4788 step("No impact observed on mroutes")
4789 for data
in input_dict_sg
:
4790 result
= verify_mroutes(
4793 data
["src_address"],
4798 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4800 for data
in input_dict_sg
:
4801 result
= verify_mroutes(
4804 data
["src_address"],
4809 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4811 for data
in input_dict_starg
:
4812 result
= verify_mroutes(
4815 data
["src_address"],
4820 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4822 step("remove PIM passive and verify hello tx/rx is increamented")
4826 "interface {}".format(intf_c1_c2
),
4827 "no ip pim passive",
4832 result
= apply_raw_config(tgen
, raw_config
)
4833 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4835 logger
.info("waiting for 30 sec for pim hello to receive")
4838 c1_state_after
= verify_pim_interface_traffic(tgen
, state_dict
)
4840 c1_state_after
, dict
4841 ), "Testcase{} : Failed \n state_before is not dictionary \n " "Error: {}".format(
4845 step("verify stats increamented on c1 after removing pim passive")
4846 result
= verify_pim_stats_increament(c1_state_before
, c1_state_after
)
4847 assert result
is True, "Testcase{} : Failed Error: {}" "stats incremented".format(
4851 write_test_footer(tc_name
)
4854 if __name__
== "__main__":
4855 args
= ["-s"] + sys
.argv
[1:]
4856 sys
.exit(pytest
.main(args
))