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
46 pytestmark
= pytest
.mark
.pimd
48 # Save the Current Working Directory to find configuration files.
49 CWD
= os
.path
.dirname(os
.path
.realpath(__file__
))
50 sys
.path
.append(os
.path
.join(CWD
, "../"))
51 sys
.path
.append(os
.path
.join(CWD
, "../lib/"))
53 # Required to instantiate the topology builder class.
55 # pylint: disable=C0413
56 # Import topogen and topotest helpers
57 from lib
.topogen
import Topogen
, get_topogen
59 from lib
.common_config
import (
64 reset_config_on_routers
,
65 shutdown_bringup_interface
,
68 required_linux_kernel_version
,
77 clear_pim_interface_traffic
,
82 verify_multicast_traffic
,
84 verify_multicast_flag_state
,
86 verify_pim_interface_traffic
,
88 from lib
.topolog
import logger
89 from lib
.topojson
import build_config_from_json
91 CWD
= os
.path
.dirname(os
.path
.realpath(__file__
))
92 pytestmark
= pytest
.mark
.pimd
96 i4-----c1-------------c2---i5
99 i1-----l1------r2-----f1---i2
105 i1, i2, i3. i4, i5, i6, i7, i8 - FRR running iperf to send IGMP
116 GROUP_RANGE
= "225.0.0.0/8"
117 IGMP_GROUP
= "225.1.1.1/32"
118 IGMP_JOIN
= "225.1.1.1"
119 VLAN_INTF_ADRESS_1
= "10.0.8.3/24"
127 IGMP_JOIN_RANGE_1
= ["225.1.1.1", "225.1.1.2", "225.1.1.3", "225.1.1.4", "225.1.1.5"]
135 IGMP_JOIN_RANGE_2
= ["226.1.1.1", "226.1.1.2", "226.1.1.3", "226.1.1.4", "226.1.1.5"]
143 IGMP_JOIN_RANGE_3
= ["227.1.1.1", "227.1.1.2", "227.1.1.3", "227.1.1.4", "227.1.1.5"]
145 SAME_VLAN_IP_1
= {"ip": "10.1.1.1", "subnet": "255.255.255.0", "cidr": "24"}
146 SAME_VLAN_IP_2
= {"ip": "10.1.1.2", "subnet": "255.255.255.0", "cidr": "24"}
147 SAME_VLAN_IP_3
= {"ip": "10.1.1.3", "subnet": "255.255.255.0", "cidr": "24"}
148 SAME_VLAN_IP_4
= {"ip": "10.1.1.4", "subnet": "255.255.255.0", "cidr": "24"}
151 def setup_module(mod
):
153 Sets up the pytest environment
158 # Required linux kernel version for this suite to run.
159 result
= required_linux_kernel_version("4.19")
160 if result
is not True:
161 pytest
.skip("Kernel version should be >= 4.19")
163 testsuite_run_time
= time
.asctime(time
.localtime(time
.time()))
164 logger
.info("Testsuite start time: {}".format(testsuite_run_time
))
165 logger
.info("=" * 40)
166 logger
.info("Master Topology: \n {}".format(TOPOLOGY
))
168 logger
.info("Running setup_module to create topology")
170 json_file
= "{}/multicast_pim_sm_topo3.json".format(CWD
)
171 tgen
= Topogen(json_file
, mod
.__name
__)
173 topo
= tgen
.json_topo
174 # ... and here it calls Mininet initialization functions.
176 # Starting topology, create tmp files which are loaded to routers
177 # to start daemons and then start routers
180 # Don"t run this test if we have any failure.
181 if tgen
.routers_have_failure():
182 pytest
.skip(tgen
.errors
)
184 # Creating configuration from JSON
185 build_config_from_json(tgen
, topo
)
187 # XXX Replace this using "with McastTesterHelper()... " in each test if possible.
189 app_helper
= McastTesterHelper(tgen
)
191 logger
.info("Running setup_module() done")
194 def teardown_module():
195 """Teardown the pytest environment"""
197 logger
.info("Running teardown_module to delete topology")
203 # Stop toplogy and Remove tmp files
207 "Testsuite end time: {}".format(time
.asctime(time
.localtime(time
.time())))
209 logger
.info("=" * 40)
212 #####################################################
216 #####################################################
219 def verify_mroute_repopulated(uptime_before
, uptime_after
):
221 API to compare uptime for mroutes
225 * `uptime_before` : Uptime dictionary for any particular instance
226 * `uptime_after` : Uptime dictionary for any particular instance
229 for group
in uptime_before
.keys():
230 for source
in uptime_before
[group
].keys():
231 if set(uptime_before
[group
]) != set(uptime_after
[group
]):
233 "mroute (%s, %s) has not come"
234 " up after mroute clear [FAILED!!]" % (source
, group
)
238 d1
= datetime
.datetime
.strptime(uptime_before
[group
][source
], "%H:%M:%S")
239 d2
= datetime
.datetime
.strptime(uptime_after
[group
][source
], "%H:%M:%S")
241 errormsg
= "mroute (%s, %s) is not " "repopulated [FAILED!!]" % (
247 logger
.info("mroute (%s, %s) is " "repopulated [PASSED!!]", source
, group
)
252 def verify_state_incremented(state_before
, state_after
):
254 API to compare interface traffic state incrementing
258 * `state_before` : State dictionary for any particular instance
259 * `state_after` : State dictionary for any particular instance
262 for ttype
, v1
in state_before
.items():
263 for intf
, v2
in v1
.items():
264 for state
, value
in v2
.items():
265 if value
>= state_after
[ttype
][intf
][state
]:
266 errormsg
= "[DUT: %s]: state %s value has not incremented, Initial value: %s, Current value: %s [FAILED!!]" % (
270 state_after
[ttype
][intf
][state
],
275 "[DUT: %s]: State %s value is incremented, Initial value: %s, Current value: %s [PASSED!!]",
279 state_after
[ttype
][intf
][state
],
285 def find_v2_query_msg_in_tcpdump(tgen
, router
, message
, count
, cap_file
):
287 Find v2 query messages in tcpdump file
291 * `tgen` : Topology handler
292 * `router` : Device under test
293 * `cap_file` : tcp dump file name
297 filepath
= os
.path
.join(tgen
.logdir
, router
, cap_file
)
298 with
open(filepath
) as f
:
299 if len(re
.findall("{}".format(message
), f
.read())) < count
:
300 errormsg
= "[DUT: %s]: Verify Message: %s in tcpdump" " [FAILED!!]" % (
307 "[DUT: %s]: Found message: %s in tcpdump " " count: %s [PASSED!!]",
315 def find_tos_in_tcpdump(tgen
, router
, message
, cap_file
):
317 Find v2 query messages in tcpdump file
321 * `tgen` : Topology handler
322 * `router` : Device under test
323 * `cap_file` : tcp dump file name
327 filepath
= os
.path
.join(tgen
.logdir
, router
, cap_file
)
328 with
open(filepath
) as f
:
330 if len(re
.findall(message
, f
.read())) < 1:
331 errormsg
= "[DUT: %s]: Verify Message: %s in tcpdump" " [FAILED!!]" % (
338 "[DUT: %s]: Found message: %s in tcpdump " "[PASSED!!]", router
, message
343 def verify_pim_stats_increament(stats_before
, stats_after
):
345 API to compare pim interface control plane traffic
349 * `stats_before` : Stats dictionary for any particular instance
350 * `stats_after` : Stats dictionary for any particular instance
353 for router
, stats_data
in stats_before
.items():
354 for stats
, value
in stats_data
.items():
355 if stats_before
[router
][stats
] >= stats_after
[router
][stats
]:
357 "[DUT: %s]: state %s value has not"
358 " incremented, Initial value: %s, "
359 "Current value: %s [FAILED!!]"
363 stats_before
[router
][stats
],
364 stats_after
[router
][stats
],
370 "[DUT: %s]: State %s value is "
371 "incremented, Initial value: %s, Current value: %s"
375 stats_before
[router
][stats
],
376 stats_after
[router
][stats
],
382 def test_verify_oil_when_join_prune_sent_scenario_1_p1(request
):
385 Verify OIL detail updated in (S,G) and (*,G) mroute when IGMP
390 tc_name
= request
.node
.name
391 write_test_header(tc_name
)
393 # Don"t run this test if we have any failure.
394 if tgen
.routers_have_failure():
395 pytest
.skip(tgen
.errors
)
397 # Creating configuration from JSON
398 app_helper
.stop_all_hosts()
400 reset_config_on_routers(tgen
)
401 clear_pim_interface_traffic(tgen
, topo
)
402 check_router_status(tgen
)
404 step("Enable the PIM on all the interfaces of FRR1, FRR2, FRR3")
406 "Enable IGMP of FRR1 interface and send IGMP joins "
407 " from FRR1 node for group range (226.1.1.1-5)"
410 "Enable IGMP of FRR3 interface and send IGMP joins "
411 " from FRR3 node for group range (226.1.1.1-5)"
414 intf_f1_i8
= topo
["routers"]["f1"]["links"]["i8"]["interface"]
420 "igmp": {"version": "2", "query": {"query-interval": 15}}
426 result
= create_igmp_config(tgen
, topo
, input_dict
)
427 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
430 "i1": topo
["routers"]["i1"]["links"]["l1"]["interface"],
431 "i8": topo
["routers"]["i8"]["links"]["f1"]["interface"],
434 for recvr
, recvr_intf
in input_join
.items():
435 result
= app_helper
.run_join(recvr
, IGMP_JOIN_RANGE_1
, join_intf
=recvr_intf
)
436 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
438 step("Configure static RP for (226.1.1.1-5) in R2")
445 "rp_addr": topo
["routers"]["r2"]["links"]["lo"]["ipv4"].split(
448 "group_addr_range": GROUP_RANGE
,
455 result
= create_pim_config(tgen
, topo
, input_dict
)
456 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
459 "Configure one source on FRR3 for all the groups and send" " multicast traffic"
462 input_src
= {"i2": topo
["routers"]["i2"]["links"]["f1"]["interface"]}
464 for src
, src_intf
in input_src
.items():
465 result
= app_helper
.run_traffic(src
, IGMP_JOIN_RANGE_1
, bind_intf
=src_intf
)
466 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
468 source_i2
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
473 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
474 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
478 "src_address": source_i2
,
479 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
480 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
486 "oil": topo
["routers"]["r2"]["links"]["l1"]["interface"],
490 "src_address": source_i2
,
491 "iif": topo
["routers"]["r2"]["links"]["f1"]["interface"],
492 "oil": topo
["routers"]["r2"]["links"]["l1"]["interface"],
497 "iif": topo
["routers"]["f1"]["links"]["r2"]["interface"],
498 "oil": topo
["routers"]["f1"]["links"]["i8"]["interface"],
502 "src_address": source_i2
,
503 "iif": topo
["routers"]["f1"]["links"]["i2"]["interface"],
504 "oil": topo
["routers"]["f1"]["links"]["r2"]["interface"],
508 step("Verify mroutes and iff upstream")
510 for data
in input_dict_all
:
511 result
= verify_mroutes(
519 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
521 for data
in input_dict_all
:
522 result
= verify_upstream_iif(
523 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
525 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
527 step("Send the IGMP prune from ixia to (226.1.1.1-5) receiver on " "FRR1 node")
529 intf_l1_i1
= topo
["routers"]["l1"]["links"]["i1"]["interface"]
530 shutdown_bringup_interface(tgen
, "l1", intf_l1_i1
, False)
533 "After receiving the IGMP prune from FRR1 , verify traffic "
534 "immediately stopped for this receiver 'show ip multicast'"
537 input_traffic
= {"l1": {"traffic_sent": [intf_l1_i1
]}}
538 result
= verify_multicast_traffic(tgen
, input_traffic
, expected
=False)
539 assert result
is not True, (
540 "Testcase {} : Failed \n "
541 "Expected: [{}]: Multicast traffic should be stopped \n "
542 "Found: {}".format(tc_name
, "l1", result
)
546 "IGMP groups are remove from FRR1 node 'show ip igmp groups'"
547 " FRR3 IGMP still present"
551 result
= verify_igmp_groups(
552 tgen
, dut
, intf_l1_i1
, IGMP_JOIN_RANGE_1
, expected
=False
554 assert result
is not True, (
555 "Testcase {} : Failed \n "
556 "Expected: [{}]: IGMP groups should be deleted \n "
557 "Found: {}".format(tc_name
, dut
, result
)
561 result
= verify_igmp_groups(tgen
, dut
, intf_f1_i8
, IGMP_JOIN_RANGE_1
)
562 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
565 "(*,G) and (S,G) OIL got removed immediately after receiving"
566 " prune 'show ip pim state' and 'show ip mroute' on FRR1 node,"
567 " no impact on FRR3 receiver"
574 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
575 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
579 "src_address": source_i2
,
580 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
581 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
585 step("Verify mroutes and iff upstream")
587 for data
in input_dict_l1
:
588 result
= verify_mroutes(
597 assert result
is not True, (
598 "Testcase {} : Failed \n "
599 "Expected: [{}]: mroute (S, G) should not be present in mroute table \n "
600 "Found: {}".format(tc_name
, data
["dut"], result
)
603 for data
in input_dict_l1
:
604 result
= verify_upstream_iif(
612 assert result
is not True, (
613 "Testcase {} : Failed \n "
614 "Expected: [{}]: Upstream IIF {} should not be present \n "
615 "Found: {}".format(tc_name
, data
["dut"], data
["iif"], result
)
622 "iif": topo
["routers"]["f1"]["links"]["r2"]["interface"],
623 "oil": topo
["routers"]["f1"]["links"]["i8"]["interface"],
627 "src_address": source_i2
,
628 "iif": topo
["routers"]["f1"]["links"]["i2"]["interface"],
629 "oil": topo
["routers"]["f1"]["links"]["i8"]["interface"],
633 step("Verify mroutes and iff upstream")
635 for data
in input_dict_f1
:
636 result
= verify_mroutes(
644 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
646 for data
in input_dict_f1
:
647 result
= verify_upstream_iif(
648 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
650 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
652 step("Send the IGMP prune from ixia to (226.1.1.1-5) receiver on " " FRR3 node")
654 intf_f1_i8
= topo
["routers"]["f1"]["links"]["i8"]["interface"]
655 shutdown_bringup_interface(tgen
, "f1", intf_f1_i8
, False)
658 "After receiving the IGMP prune from FRR3s , verify traffic "
659 "immediately stopped for this receiver 'show ip multicast'"
662 input_traffic
= {"f1": {"traffic_sent": [intf_f1_i8
]}}
663 result
= verify_multicast_traffic(tgen
, input_traffic
, expected
=False)
664 assert result
is not True, (
665 "Testcase {} : Failed \n "
666 "Expected: [{}]: Multicast traffic should be stopped \n "
667 "Found: {}".format(tc_name
, "f1", result
)
671 "IGMP groups are remove from FRR1 node 'show ip igmp groups'"
672 " FRR3 IGMP still present"
676 result
= verify_igmp_groups(
677 tgen
, dut
, intf_f1_i8
, IGMP_JOIN_RANGE_1
, expected
=False
679 assert result
is not True, (
680 "Testcase {} : Failed \n "
681 "Expected: [{}]: IGMP groups should be deleted \n "
682 "Found: {}".format(tc_name
, dut
, result
)
686 "(*,G) and (S,G) OIL got prune state (none) from all the nodes"
687 "FRR1, FRR3 verify using 'show ip mroute'"
694 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
695 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
699 "src_address": source_i2
,
700 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
701 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
705 step("Verify mroutes and iff upstream")
707 for data
in input_dict_l1
:
708 result
= verify_mroutes(
717 assert result
is not True, (
718 "Testcase {} : Failed \n "
719 "Expected: [{}]: mroute (S, G) should not be present in mroute table \n "
720 "Found: {}".format(tc_name
, data
["dut"], result
)
723 for data
in input_dict_l1
:
724 result
= verify_upstream_iif(
732 assert result
is not True, (
733 "Testcase {} : Failed \n "
734 "Expected: [{}]: Upstream IIF {} should not be present \n "
735 "Found: {}".format(tc_name
, data
["dut"], data
["iif"], result
)
738 shutdown_bringup_interface(tgen
, "f1", intf_f1_i8
, True)
739 shutdown_bringup_interface(tgen
, "l1", intf_l1_i1
, True)
741 for data
in input_dict_l1
:
742 result
= verify_upstream_iif(
743 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
745 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
747 write_test_footer(tc_name
)
750 def test_verify_oil_when_join_prune_sent_scenario_2_p1(request
):
752 TC_21_2: Verify OIL detail updated in (S,G) and (*,G) mroute when IGMP
757 tc_name
= request
.node
.name
758 write_test_header(tc_name
)
760 # Don"t run this test if we have any failure.
761 if tgen
.routers_have_failure():
762 pytest
.skip(tgen
.errors
)
764 # Creating configuration from JSON
765 app_helper
.stop_all_hosts()
767 reset_config_on_routers(tgen
)
768 clear_pim_interface_traffic(tgen
, topo
)
769 check_router_status(tgen
)
771 step("Removing FRR3 to simulate topo " "FHR(FRR1)---LHR(FRR2)")
773 intf_l1_c1
= topo
["routers"]["l1"]["links"]["c1"]["interface"]
774 intf_f1_c2
= topo
["routers"]["f1"]["links"]["c2"]["interface"]
775 intf_f1_r2
= topo
["routers"]["f1"]["links"]["r2"]["interface"]
776 shutdown_bringup_interface(tgen
, "l1", intf_l1_c1
, False)
777 shutdown_bringup_interface(tgen
, "f1", intf_f1_c2
, False)
778 shutdown_bringup_interface(tgen
, "f1", intf_f1_r2
, False)
780 step("Enable the PIM on all the interfaces of FRR1, FRR2")
782 "Enable IGMP of FRR1 interface and send IGMP joins "
783 " from FRR1 node for group range (226.1.1.1-5)"
786 "Enable IGMP of FRR3 interface and send IGMP joins "
787 " from FRR3 node for group range (226.1.1.1-5)"
790 intf_r2_i3
= topo
["routers"]["r2"]["links"]["i3"]["interface"]
796 "igmp": {"version": "2", "query": {"query-interval": 15}}
802 result
= create_igmp_config(tgen
, topo
, input_dict
)
803 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
806 "i1": topo
["routers"]["i1"]["links"]["l1"]["interface"],
807 "i3": topo
["routers"]["i3"]["links"]["r2"]["interface"],
810 for recvr
, recvr_intf
in input_join
.items():
811 result
= app_helper
.run_join(recvr
, IGMP_JOIN_RANGE_1
, join_intf
=recvr_intf
)
812 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
814 step("Configure static RP for (226.1.1.1-5) in R2")
821 "rp_addr": topo
["routers"]["r2"]["links"]["lo"]["ipv4"].split(
824 "group_addr_range": GROUP_RANGE
,
831 result
= create_pim_config(tgen
, topo
, input_dict
)
832 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
837 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
838 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
844 "oil": topo
["routers"]["r2"]["links"]["l1"]["interface"],
850 "oil": topo
["routers"]["r2"]["links"]["i3"]["interface"],
854 step("Verify mroutes and iff upstream")
856 for data
in input_dict_all
:
857 result
= verify_mroutes(
865 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
867 for data
in input_dict_all
:
868 result
= verify_upstream_iif(
869 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
871 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
873 step("Send the IGMP prune from ixia to (226.1.1.1-5) receiver on " "FRR3(r2) node")
875 intf_r2_i3
= topo
["routers"]["r2"]["links"]["i3"]["interface"]
876 shutdown_bringup_interface(tgen
, "r2", intf_r2_i3
, False)
879 "After sending IGMP prune from FRR3(r2) node verify (*,G) OIL "
880 "immediately removed for local receiver mroute should have "
881 " PIM protocol , IGMP should be removed verify using "
882 "'show ip mroute' no impact seen on FRR1(l1) (*,G)"
890 "oil": topo
["routers"]["r2"]["links"]["i3"]["interface"],
894 for data
in input_dict_r2
:
895 result
= verify_mroutes(
904 assert result
is not True, (
905 "Testcase {} : Failed \n "
906 "Expected: [{}]: mroute (S, G) should not be present in mroute table \n "
907 "Found: {}".format(tc_name
, data
["dut"], result
)
914 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
915 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
921 "oil": topo
["routers"]["r2"]["links"]["l1"]["interface"],
925 step("Verify mroutes and iff upstream")
927 for data
in input_dict_l1_r2
:
928 result
= verify_mroutes(
936 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
938 step("Send the IGMP prune from ixia to (226.1.1.1-5) receiver on " "FRR1(l1) node")
940 intf_l1_i1
= topo
["routers"]["l1"]["links"]["i1"]["interface"]
941 shutdown_bringup_interface(tgen
, "l1", intf_l1_i1
, False)
944 "After sending IGMP prune from FRR1 node verify (*,G) OIL"
945 "got removed immediately from FRR1 node"
952 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
953 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
957 for data
in input_dict_l1
:
958 result
= verify_mroutes(
967 assert result
is not True, (
968 "Testcase {} : Failed \n "
969 "Expected: [{}]: mroute (S, G) should not be present in mroute table \n "
970 "Found: {}".format(tc_name
, data
["dut"], result
)
973 step("After prune is sent verify upstream got removed in FRR1 node")
975 for data
in input_dict_l1
:
976 result
= verify_upstream_iif(
984 assert result
is not True, (
985 "Testcase {} : Failed \n "
986 "Expected: [{}]: Upstream IIF {} should not be present \n "
987 "Found: {}".format(tc_name
, data
["dut"], data
["iif"], result
)
990 write_test_footer(tc_name
)
993 def test_shut_noshut_source_interface_when_upstream_cleared_from_LHR_p1(request
):
995 TC_26: Verify shut/no shut of source interface after upstream got cleared
1000 tc_name
= request
.node
.name
1001 write_test_header(tc_name
)
1003 # Don"t run this test if we have any failure.
1004 if tgen
.routers_have_failure():
1005 pytest
.skip(tgen
.errors
)
1007 # Creating configuration from JSON
1008 app_helper
.stop_all_hosts()
1010 reset_config_on_routers(tgen
)
1011 clear_pim_interface_traffic(tgen
, topo
)
1012 check_router_status(tgen
)
1014 step("Enable the PIM on all the interfaces of FRR1, R2 and FRR3" " routers")
1015 step("Enable IGMP on FRR1 interface and send IGMP join " "(225.1.1.1-225.1.1.10)")
1017 input_join
= {"i1": topo
["routers"]["i1"]["links"]["l1"]["interface"]}
1019 for recvr
, recvr_intf
in input_join
.items():
1020 result
= app_helper
.run_join(recvr
, IGMP_JOIN_RANGE_1
, join_intf
=recvr_intf
)
1021 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1023 step("Configure RP on R2 (loopback interface) for " "the group range 225.0.0.0/8")
1030 "rp_addr": topo
["routers"]["r2"]["links"]["lo"]["ipv4"].split(
1033 "group_addr_range": GROUP_RANGE_1
,
1040 result
= create_pim_config(tgen
, topo
, input_dict
)
1041 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1043 step("Send multicast traffic from FRR3 to 225.1.1.1-225.1.1.10" " receiver")
1045 input_src
= {"i2": topo
["routers"]["i2"]["links"]["f1"]["interface"]}
1047 for src
, src_intf
in input_src
.items():
1048 result
= app_helper
.run_traffic(src
, IGMP_JOIN_RANGE_1
, bind_intf
=src_intf
)
1049 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1052 "'show ip mroute' showing correct RPF and OIF interface for (*,G)"
1053 " and (S,G) entries on all the nodes"
1056 source_i2
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
1061 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
1062 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
1066 "src_address": source_i2
,
1067 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
1068 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
1074 "oil": topo
["routers"]["r2"]["links"]["l1"]["interface"],
1078 "src_address": source_i2
,
1079 "iif": topo
["routers"]["r2"]["links"]["f1"]["interface"],
1080 "oil": topo
["routers"]["r2"]["links"]["l1"]["interface"],
1084 "src_address": source_i2
,
1085 "iif": topo
["routers"]["f1"]["links"]["i2"]["interface"],
1086 "oil": topo
["routers"]["f1"]["links"]["r2"]["interface"],
1091 "'show ip pim upstream' and 'show ip pim upstream-rpf' showing"
1092 " correct OIL and IIF on all the nodes"
1095 for data
in input_dict_all
:
1096 result
= verify_mroutes(
1099 data
["src_address"],
1104 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1106 for data
in input_dict_all
:
1107 result
= verify_upstream_iif(
1108 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
1110 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1112 step("Shut the source interface from FRR3")
1113 intf_f1_i2
= topo
["routers"]["f1"]["links"]["i2"]["interface"]
1114 shutdown_bringup_interface(tgen
, "f1", intf_f1_i2
, False)
1117 "After shut of source interface verify (S,G) mroutes are cleared"
1118 " from all the nodes"
1121 intf_f1_r2
= topo
["routers"]["f1"]["links"]["r2"]["interface"]
1122 result
= verify_mroutes(
1123 tgen
, "f1", source_i2
, IGMP_JOIN_RANGE_1
, intf_f1_i2
, intf_f1_r2
, expected
=False
1125 assert result
is not True, (
1126 "Testcase {} : Failed \n "
1127 "Expected: [{}]: mroute (S, G) should not be present in mroute table \n "
1128 "Found: {}".format(tc_name
, "f1", result
)
1132 "After waiting for (S,G) timeout from FRR1 for same"
1133 " source verify that (S,G) is flushed from FRR1 node"
1134 " 'show ip pim upstream' 'show ip mroute' "
1137 result
= verify_upstream_iif(
1138 tgen
, "l1", "Unknown", source_i2
, IGMP_JOIN_RANGE_1
, expected
=False
1140 assert result
is not True, (
1141 "Testcase {} : Failed \n "
1142 "Expected: [{}]: Upstream IIF should be Unknown \n "
1143 "Found: {}".format(tc_name
, "l1", result
)
1146 step("No shut the Source interface just after the upstream is expired" " from FRR1")
1147 shutdown_bringup_interface(tgen
, "f1", intf_f1_i2
, True)
1150 "After no shut of source interface , verify all the (S,G) is "
1151 " populated again on 'show ip mroute' 'show ip pim upstream' "
1152 " with proper OIL and IIF detail"
1155 for data
in input_dict_all
:
1156 result
= verify_mroutes(
1159 data
["src_address"],
1164 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1166 for data
in input_dict_all
:
1167 result
= verify_upstream_iif(
1168 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
1170 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1172 step("shut and no shut the source interface immediately")
1173 shutdown_bringup_interface(tgen
, "f1", intf_f1_i2
, False)
1174 shutdown_bringup_interface(tgen
, "f1", intf_f1_i2
, True)
1177 "All the mroutes got updated with proper OIL after no shut of"
1178 "interface verify using 'show ip mroute'"
1181 for data
in input_dict_all
:
1182 result
= verify_mroutes(
1185 data
["src_address"],
1190 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1192 for data
in input_dict_all
:
1193 result
= verify_upstream_iif(
1194 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
1196 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1198 write_test_footer(tc_name
)
1201 def test_shut_noshut_receiver_interface_when_upstream_cleared_from_LHR_p1(request
):
1203 TC_27: Verify shut/no shut of receiver interface after upstream got
1207 tgen
= get_topogen()
1208 tc_name
= request
.node
.name
1209 write_test_header(tc_name
)
1211 # Don"t run this test if we have any failure.
1212 if tgen
.routers_have_failure():
1213 pytest
.skip(tgen
.errors
)
1215 # Creating configuration from JSON
1216 app_helper
.stop_all_hosts()
1218 reset_config_on_routers(tgen
)
1219 clear_pim_interface_traffic(tgen
, topo
)
1220 check_router_status(tgen
)
1222 step("Enable the PIM on all the interfaces of FRR1, R2 and FRR3" " routers")
1223 step("Enable IGMP on FRR1 interface and send IGMP join " "(225.1.1.1-225.1.1.10)")
1225 input_join
= {"i1": topo
["routers"]["i1"]["links"]["l1"]["interface"]}
1227 for recvr
, recvr_intf
in input_join
.items():
1228 result
= app_helper
.run_join(recvr
, IGMP_JOIN_RANGE_1
, join_intf
=recvr_intf
)
1229 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1231 step("Configure RP on R2 (loopback interface) for " "the group range 225.0.0.0/8")
1238 "rp_addr": topo
["routers"]["r2"]["links"]["lo"]["ipv4"].split(
1241 "group_addr_range": GROUP_RANGE_1
,
1248 result
= create_pim_config(tgen
, topo
, input_dict
)
1249 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1251 step("Send multicast traffic from FRR3 to 225.1.1.1-225.1.1.10" " receiver")
1253 input_src
= {"i2": topo
["routers"]["i2"]["links"]["f1"]["interface"]}
1255 for src
, src_intf
in input_src
.items():
1256 result
= app_helper
.run_traffic(src
, IGMP_JOIN_RANGE_1
, bind_intf
=src_intf
)
1257 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1260 "'show ip mroute' showing correct RPF and OIF interface for (*,G)"
1261 " and (S,G) entries on all the nodes"
1264 source_i2
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
1269 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
1270 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
1274 "src_address": source_i2
,
1275 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
1276 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
1282 "oil": topo
["routers"]["r2"]["links"]["l1"]["interface"],
1286 "src_address": source_i2
,
1287 "iif": topo
["routers"]["r2"]["links"]["f1"]["interface"],
1288 "oil": topo
["routers"]["r2"]["links"]["l1"]["interface"],
1292 "src_address": source_i2
,
1293 "iif": topo
["routers"]["f1"]["links"]["i2"]["interface"],
1294 "oil": topo
["routers"]["f1"]["links"]["r2"]["interface"],
1298 for data
in input_dict_all
:
1299 result
= verify_mroutes(
1302 data
["src_address"],
1307 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1310 "'show ip pim upstream' and 'show ip pim upstream-rpf' showing"
1311 " correct OIL and IIF on all the nodes"
1314 for data
in input_dict_all
:
1315 result
= verify_upstream_iif(
1316 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
1318 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1320 step("Shut the source interface FRR1")
1321 intf_l1_i1
= topo
["routers"]["l1"]["links"]["i1"]["interface"]
1322 intf_f1_i2
= topo
["routers"]["f1"]["links"]["i2"]["interface"]
1323 intf_f1_r2
= topo
["routers"]["f1"]["links"]["r2"]["interface"]
1324 shutdown_bringup_interface(tgen
, "l1", intf_l1_i1
, False)
1327 "After waiting for (S,G) timeout from FRR1 for same"
1328 " source verify that (S,G) is flushed from FRR1 node"
1329 " 'show ip pim upstream' 'show ip mroute' "
1332 result
= verify_upstream_iif(
1333 tgen
, "l1", "Unknown", source_i2
, IGMP_JOIN_RANGE_1
, expected
=False
1335 assert result
is not True, (
1336 "Testcase {} : Failed \n "
1337 "Expected: [{}]: Upstream IIF should be Unknown \n "
1338 "Found: {}".format(tc_name
, "l1", result
)
1341 step("No shut the Source interface just after the upstream is expired" " from FRR1")
1342 shutdown_bringup_interface(tgen
, "l1", intf_l1_i1
, True)
1345 "After no shut of source interface , verify all the (S,G) is "
1346 " populated again on 'show ip mroute' 'show ip pim upstream' "
1347 " with proper OIL and IIF detail"
1350 for data
in input_dict_all
:
1351 result
= verify_mroutes(
1354 data
["src_address"],
1359 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1361 for data
in input_dict_all
:
1362 result
= verify_upstream_iif(
1363 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
1365 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1367 step("shut and no shut the source interface immediately")
1368 shutdown_bringup_interface(tgen
, "f1", intf_f1_i2
, False)
1369 shutdown_bringup_interface(tgen
, "f1", intf_f1_i2
, True)
1372 "After no shut of receiver interface , verify all the (S,G) is "
1373 "populated again on 'show ip mroute' 'show ip pim upstream' "
1374 "with proper OIL and IIF detail"
1377 for data
in input_dict_all
:
1378 result
= verify_mroutes(
1381 data
["src_address"],
1386 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1388 for data
in input_dict_all
:
1389 result
= verify_upstream_iif(
1390 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
1392 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1394 write_test_footer(tc_name
)
1397 def test_verify_remove_add_igmp_config_to_receiver_interface_p0(request
):
1399 TC_33: Verify removing and adding IGMP config from the receiver interface
1401 tgen
= get_topogen()
1402 tc_name
= request
.node
.name
1403 write_test_header(tc_name
)
1405 # Don"t run this test if we have any failure.
1406 if tgen
.routers_have_failure():
1407 pytest
.skip(tgen
.errors
)
1409 # Creating configuration from JSON
1410 app_helper
.stop_all_hosts()
1412 reset_config_on_routers(tgen
)
1413 clear_pim_interface_traffic(tgen
, topo
)
1414 check_router_status(tgen
)
1416 step("Enable PIM on all routers")
1417 step("Enable IGMP on FRR1 interface and send IGMP join " "(225.1.1.1-225.1.1.10)")
1419 input_join
= {"i1": topo
["routers"]["i1"]["links"]["l1"]["interface"]}
1421 for recvr
, recvr_intf
in input_join
.items():
1422 result
= app_helper
.run_join(recvr
, IGMP_JOIN_RANGE_1
, join_intf
=recvr_intf
)
1423 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1425 step("Configure RP for (226.1.1.1-5) and (232.1.1.1-5) in cisco-1(f1)")
1432 "rp_addr": topo
["routers"]["r2"]["links"]["lo"]["ipv4"].split(
1435 "group_addr_range": GROUP_RANGE
,
1442 result
= create_pim_config(tgen
, topo
, input_dict
)
1443 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1445 step("Configure source on FRR3 and start the traffic for" " (225.1.1.1-225.1.1.10)")
1447 input_src
= {"i2": topo
["routers"]["i2"]["links"]["f1"]["interface"]}
1449 for src
, src_intf
in input_src
.items():
1450 result
= app_helper
.run_traffic(src
, IGMP_JOIN_RANGE_1
, bind_intf
=src_intf
)
1451 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1453 step("Configure source on FRR1 and start the traffic for" " (225.1.1.1-225.1.1.10)")
1455 input_src
= {"i6": topo
["routers"]["i6"]["links"]["l1"]["interface"]}
1457 for src
, src_intf
in input_src
.items():
1458 result
= app_helper
.run_traffic(src
, IGMP_JOIN_RANGE_1
, bind_intf
=src_intf
)
1459 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1461 source_i6
= topo
["routers"]["i6"]["links"]["l1"]["ipv4"].split("/")[0]
1462 source_i2
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
1467 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
1468 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
1472 "src_address": source_i6
,
1473 "iif": topo
["routers"]["l1"]["links"]["i6"]["interface"],
1474 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
1478 "src_address": source_i2
,
1479 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
1480 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
1486 "oil": topo
["routers"]["r2"]["links"]["l1"]["interface"],
1490 "src_address": source_i2
,
1491 "iif": topo
["routers"]["f1"]["links"]["i2"]["interface"],
1492 "oil": topo
["routers"]["f1"]["links"]["r2"]["interface"],
1496 for data
in input_dict_all
:
1497 result
= verify_mroutes(
1500 data
["src_address"],
1505 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1507 for data
in input_dict_all
:
1508 result
= verify_upstream_iif(
1509 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
1511 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1514 "Remove igmp 'no ip igmp' and 'no ip igmp version 2' from"
1515 " receiver interface of FRR1"
1518 intf_l1_i1
= topo
["routers"]["l1"]["links"]["i1"]["interface"]
1533 result
= create_igmp_config(tgen
, topo
, input_dict_2
)
1534 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1536 step("IGMP join removed from FRR1 , verify using " "'show ip igmp groups json'")
1539 interface
= topo
["routers"]["l1"]["links"]["i1"]["interface"]
1540 result
= verify_igmp_groups(tgen
, dut
, interface
, IGMP_JOIN_RANGE_1
, expected
=False)
1541 assert result
is not True, (
1542 "Testcase {} : Failed \n "
1543 "Expected: [{}]: IGMP groups should not be present \n "
1544 "Found: {}".format(tc_name
, dut
, result
)
1547 intf_l1_r2
= topo
["routers"]["l1"]["links"]["r2"]["interface"]
1548 intf_l1_i1
= topo
["routers"]["l1"]["links"]["i1"]["interface"]
1549 intf_f1_r2
= topo
["routers"]["f1"]["links"]["r2"]["interface"]
1550 intf_f1_i2
= topo
["routers"]["f1"]["links"]["i2"]["interface"]
1552 "l1": {"traffic_received": [intf_l1_r2
], "traffic_sent": [intf_l1_i1
]},
1553 "f1": {"traffic_sent": [intf_f1_r2
], "traffic_received": [intf_f1_i2
]},
1555 result
= verify_multicast_traffic(tgen
, input_traffic
)
1556 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1559 "Configure igmp 'ip igmp' and 'ip igmp version 2' from "
1560 "receiver interface of FRR1"
1568 "igmp": {"version": "2", "query": {"query-interval": 15}}
1574 result
= create_igmp_config(tgen
, topo
, input_dict_2
)
1575 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1578 "After adding IGMP on receiver interface verify (S,G) and (*,G)"
1579 " entries got populated and traffic is resumed on FRR1 and FRR3 node"
1583 "Verify OIL/IIF and drJoinDesired using 'show ip mroute , and traffic"
1584 " using show ip pim upstream and show ip multicast'"
1587 for data
in input_dict_all
:
1588 result
= verify_mroutes(
1591 data
["src_address"],
1596 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1598 for data
in input_dict_all
:
1599 result
= verify_upstream_iif(
1600 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
1602 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1604 result
= verify_multicast_traffic(tgen
, input_traffic
)
1605 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1607 step("Verify that no core is observed")
1608 if tgen
.routers_have_failure():
1609 assert False, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1612 "Remove igmp 'no ip igmp' and 'no ip igmp version 2' from"
1613 " receiver interface of FRR1"
1631 result
= create_igmp_config(tgen
, topo
, input_dict_2
)
1632 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1634 step("IGMP join removed from FRR1 , verify using " "'show ip igmp groups json'")
1637 interface
= topo
["routers"]["l1"]["links"]["i1"]["interface"]
1638 result
= verify_igmp_groups(tgen
, dut
, interface
, IGMP_JOIN_RANGE_1
, expected
=False)
1639 assert result
is not True, (
1640 "Testcase {} : Failed \n "
1641 "Expected: [{}]: IGMP groups should not be present \n "
1642 "Found: {}".format(tc_name
, dut
, result
)
1645 result
= verify_multicast_traffic(tgen
, input_traffic
)
1646 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1649 "Configure igmp 'ip igmp' and 'ip igmp version 2' from "
1650 "receiver interface of FRR1"
1658 "igmp": {"version": "2", "query": {"query-interval": 15}}
1664 result
= create_igmp_config(tgen
, topo
, input_dict_2
)
1665 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1668 "After adding IGMP on receiver interface verify (S,G) and (*,G)"
1669 " entries got populated and traffic is resumed on FRR1 and FRR3 node"
1673 "Verify OIL/IIF and drJoinDesired using 'show ip mroute , and traffic"
1674 " using show ip pim upstream and show ip multicast'"
1677 input_dict_l1_f1
= [
1681 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
1682 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
1686 "src_address": source_i6
,
1687 "iif": topo
["routers"]["l1"]["links"]["i6"]["interface"],
1688 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
1692 "src_address": source_i2
,
1693 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
1694 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
1698 "src_address": source_i2
,
1699 "iif": topo
["routers"]["f1"]["links"]["i2"]["interface"],
1700 "oil": topo
["routers"]["f1"]["links"]["r2"]["interface"],
1704 for data
in input_dict_l1_f1
:
1705 result
= verify_mroutes(
1708 data
["src_address"],
1713 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1715 for data
in input_dict_l1_f1
:
1716 result
= verify_upstream_iif(
1717 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
1719 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1721 result
= verify_multicast_traffic(tgen
, input_traffic
)
1722 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1724 step("Verify that no core is observed")
1725 if tgen
.routers_have_failure():
1726 assert False, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1728 step("Remove ip igmp and send igmp prune from FRR1 interface")
1744 result
= create_igmp_config(tgen
, topo
, input_dict_2
)
1745 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1747 "Verification: After removing igmp 'no ip igmp' and "
1748 " sending prune verify mroute and upstream got removed"
1749 " from FRR1 verify using 'show ip mroute' and "
1750 "'show ip pim upstream'"
1754 iif
= topo
["routers"]["l1"]["links"]["i6"]["interface"]
1755 oil
= topo
["routers"]["l1"]["links"]["i1"]["interface"]
1757 result
= verify_mroutes(
1758 tgen
, dut
, source
, IGMP_JOIN_RANGE_1
, iif
, oil
, expected
=False
1760 assert result
is not True, (
1761 "Testcase {} : Failed \n "
1762 "Expected: [{}]: mroute (S, G) should not be present in mroute table \n "
1763 "Found: {}".format(tc_name
, dut
, result
)
1766 write_test_footer(tc_name
)
1769 def test_verify_remove_add_igmp_commands_when_pim_configured_p0(request
):
1771 TC_34: Verify removing and adding IGMP commands when PIM is already
1775 tgen
= get_topogen()
1776 tc_name
= request
.node
.name
1777 write_test_header(tc_name
)
1779 # Don"t run this test if we have any failure.
1780 if tgen
.routers_have_failure():
1781 pytest
.skip(tgen
.errors
)
1783 # Creating configuration from JSON
1784 app_helper
.stop_all_hosts()
1786 reset_config_on_routers(tgen
)
1787 clear_pim_interface_traffic(tgen
, topo
)
1788 check_router_status(tgen
)
1790 step("Enable PIM on all routers")
1791 step("Enable IGMP on FRR1 interface and send IGMP join " "(225.1.1.1-225.1.1.10)")
1793 input_join
= {"i1": topo
["routers"]["i1"]["links"]["l1"]["interface"]}
1795 for recvr
, recvr_intf
in input_join
.items():
1796 result
= app_helper
.run_join(recvr
, IGMP_JOIN_RANGE_1
, join_intf
=recvr_intf
)
1797 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1799 step("Configure RP for (226.1.1.1-5) and (232.1.1.1-5) in cisco-1(f1)")
1806 "rp_addr": topo
["routers"]["r2"]["links"]["lo"]["ipv4"].split(
1809 "group_addr_range": GROUP_RANGE
,
1816 result
= create_pim_config(tgen
, topo
, input_dict
)
1817 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1819 step("Configure source on FRR3 and start the traffic for" " (225.1.1.1-225.1.1.10)")
1821 input_src
= {"i2": topo
["routers"]["i2"]["links"]["f1"]["interface"]}
1823 for src
, src_intf
in input_src
.items():
1824 result
= app_helper
.run_traffic(src
, IGMP_JOIN_RANGE_1
, bind_intf
=src_intf
)
1825 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1827 step("Configure source on FRR1 and start the traffic for" " (225.1.1.1-225.1.1.10)")
1829 input_src
= {"i6": topo
["routers"]["i6"]["links"]["l1"]["interface"]}
1831 for src
, src_intf
in input_src
.items():
1832 result
= app_helper
.run_traffic(src
, IGMP_JOIN_RANGE_1
, bind_intf
=src_intf
)
1833 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1835 source_i6
= topo
["routers"]["i6"]["links"]["l1"]["ipv4"].split("/")[0]
1836 source_i2
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
1841 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
1842 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
1846 "src_address": source_i6
,
1847 "iif": topo
["routers"]["l1"]["links"]["i6"]["interface"],
1848 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
1852 "src_address": source_i2
,
1853 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
1854 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
1860 "oil": topo
["routers"]["r2"]["links"]["l1"]["interface"],
1864 "src_address": source_i2
,
1865 "iif": topo
["routers"]["f1"]["links"]["i2"]["interface"],
1866 "oil": topo
["routers"]["f1"]["links"]["r2"]["interface"],
1870 for data
in input_dict_all
:
1871 result
= verify_mroutes(
1874 data
["src_address"],
1879 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1881 for data
in input_dict_all
:
1882 result
= verify_upstream_iif(
1883 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
1885 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1888 "Verification: After configuring IGMP related config , "
1889 "verify config is present in the interface "
1890 "'show ip igmp interface ensxx json'"
1893 intf_l1_i1
= topo
["routers"]["l1"]["links"]["i1"]["interface"]
1902 "query-max-response-time": 40,
1903 "query-interval": 5,
1912 result
= verify_igmp_config(tgen
, input_dict_1
)
1913 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1916 "Remove igmp 'no ip igmp' and 'no ip igmp version 2' from"
1917 " receiver interface of FRR1"
1935 result
= create_igmp_config(tgen
, topo
, input_dict_2
)
1936 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1939 "Verification: After removing the config CLI got removed "
1940 "'show ip igmp interface ensxx json'"
1943 result
= verify_igmp_config(tgen
, input_dict_1
, expected
=False)
1944 assert result
is not True, (
1945 "Testcase {} : Failed \n "
1946 "Expected: [{}]: IGMP interface should be removed \n "
1947 "Found: {}".format(tc_name
, data
["dut"], result
)
1950 step("Verify that no core is observed")
1951 if tgen
.routers_have_failure():
1952 assert False, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1954 step("Configure 'ip igmp last-member-query-count 10' on FRR1" " receiver interface")
1960 "l1-i1-eth1": {"igmp": {"query": {"last-member-query-count": 5}}}
1965 result
= create_igmp_config(tgen
, topo
, input_dict_3
)
1966 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1968 result
= verify_igmp_config(tgen
, input_dict_3
)
1969 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1971 step("Remove 'ip igmp last-member-query-count 10' on FRR1" " receiver interface")
1979 "query": {"last-member-query-count": "", "delete": True}
1986 result
= create_igmp_config(tgen
, topo
, input_dict_3
)
1987 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1993 "l1-i1-eth1": {"igmp": {"query": {"last-member-query-count": 2}}}
1998 result
= verify_igmp_config(tgen
, input_dict_3
)
1999 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2001 step("Verify that no core is observed")
2002 if tgen
.routers_have_failure():
2003 assert False, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2006 "Configure 'ip igmp last-member-query-interval 20' on FRR1"
2007 " receiver interface"
2015 "igmp": {"query": {"last-member-query-interval": 20}}
2021 result
= create_igmp_config(tgen
, topo
, input_dict_3
)
2022 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2024 result
= verify_igmp_config(tgen
, input_dict_3
)
2025 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2027 step("Remove 'ip igmp last-member-query-count 10' on FRR1" " receiver interface")
2035 "query": {"last-member-query-interval": "", "delete": True}
2042 result
= create_igmp_config(tgen
, topo
, input_dict_3
)
2043 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2050 "igmp": {"query": {"last-member-query-interval": 10}}
2056 result
= verify_igmp_config(tgen
, input_dict_3
)
2057 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2059 step("Verify that no core is observed")
2060 if tgen
.routers_have_failure():
2061 assert False, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2063 write_test_footer(tc_name
)
2066 def test_verify_remove_add_pim_commands_when_igmp_configured_p1(request
):
2068 TC_35: Verify removing and adding PIM commands when IGMP is already
2072 tgen
= get_topogen()
2073 tc_name
= request
.node
.name
2074 write_test_header(tc_name
)
2076 # Don"t run this test if we have any failure.
2077 if tgen
.routers_have_failure():
2078 pytest
.skip(tgen
.errors
)
2080 # Creating configuration from JSON
2081 app_helper
.stop_all_hosts()
2083 reset_config_on_routers(tgen
)
2084 clear_pim_interface_traffic(tgen
, topo
)
2085 check_router_status(tgen
)
2087 step("Configure 'ip pim' on receiver interface on FRR1")
2088 step("Enable PIM on all routers")
2089 step("Enable IGMP on FRR1 interface and send IGMP join " "(225.1.1.1-225.1.1.10)")
2091 input_join
= {"i1": topo
["routers"]["i1"]["links"]["l1"]["interface"]}
2093 for recvr
, recvr_intf
in input_join
.items():
2094 result
= app_helper
.run_join(recvr
, IGMP_JOIN_RANGE_1
, join_intf
=recvr_intf
)
2095 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2097 step("Configure RP for (226.1.1.1-5) and (232.1.1.1-5) in cisco-1(f1)")
2104 "rp_addr": topo
["routers"]["r2"]["links"]["lo"]["ipv4"].split(
2107 "group_addr_range": GROUP_RANGE
,
2114 result
= create_pim_config(tgen
, topo
, input_dict
)
2115 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2117 step("Remove 'no ip pim' on receiver interface on FRR1")
2119 intf_l1_i1
= topo
["routers"]["l1"]["links"]["i1"]["interface"]
2121 "l1": {"raw_config": ["interface {}".format(intf_l1_i1
), "no ip pim"]}
2123 result
= apply_raw_config(tgen
, raw_config
)
2124 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2126 step("Verify that no core is observed")
2127 if tgen
.routers_have_failure():
2128 assert False, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2130 step("Configure 'ip pim bsm' on receiver interface on FRR1")
2133 "l1": {"raw_config": ["interface {}".format(intf_l1_i1
), "ip pim bsm"]}
2135 result
= apply_raw_config(tgen
, raw_config
)
2136 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2138 step("Remove 'no ip pim bsm' on receiver interface on FRR1")
2141 "l1": {"raw_config": ["interface {}".format(intf_l1_i1
), "no ip pim bsm"]}
2143 result
= apply_raw_config(tgen
, raw_config
)
2144 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2146 step("Verify that no core is observed")
2147 if tgen
.routers_have_failure():
2148 assert False, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2150 step("Configure 'ip pim drpriority' on receiver interface on FRR1")
2154 "raw_config": ["interface {}".format(intf_l1_i1
), "ip pim drpriority 10"]
2157 result
= apply_raw_config(tgen
, raw_config
)
2158 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2161 "Verification: After configuring PIM related config, "
2162 "verify config is present in the interface "
2163 "'show ip pim interface ensxx json'"
2166 input_dict_dr
= {"l1": {"pim": {"interfaces": {intf_l1_i1
: {"drPriority": 10}}}}}
2167 result
= verify_pim_config(tgen
, input_dict_dr
)
2168 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2170 step("Remove 'no ip pim drpriority' on receiver interface on FRR1")
2174 "raw_config": ["interface {}".format(intf_l1_i1
), "no ip pim drpriority 10"]
2177 result
= apply_raw_config(tgen
, raw_config
)
2178 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2181 "Verification: After removing the config CLI got removed "
2182 "'show ip pim interface ensxx json'"
2185 input_dict_dr
= {"l1": {"pim": {"interfaces": {intf_l1_i1
: {"drPriority": 1}}}}}
2186 result
= verify_pim_config(tgen
, input_dict_dr
)
2187 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2189 step("Verify that no core is observed")
2190 if tgen
.routers_have_failure():
2191 assert False, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2193 step("Configure 'ip pim hello' on receiver interface on FRR1")
2196 "l1": {"raw_config": ["interface {}".format(intf_l1_i1
), "ip pim hello 50"]}
2198 result
= apply_raw_config(tgen
, raw_config
)
2199 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2202 "Verification: After configuring PIM related config, "
2203 "verify config is present in the interface "
2204 "'show ip pim interface ensxx json'"
2207 input_dict_dr
= {"l1": {"pim": {"interfaces": {intf_l1_i1
: {"helloPeriod": 50}}}}}
2208 result
= verify_pim_config(tgen
, input_dict_dr
)
2209 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2211 step("Remove 'no ip pim hello' on receiver interface on FRR1")
2214 "l1": {"raw_config": ["interface {}".format(intf_l1_i1
), "no ip pim hello"]}
2216 result
= apply_raw_config(tgen
, raw_config
)
2217 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2220 "Verification: After removing the config CLI got removed "
2221 "'show ip pim interface ensxx json'"
2224 input_dict_dr
= {"l1": {"pim": {"interfaces": {intf_l1_i1
: {"helloPeriod": 30}}}}}
2225 result
= verify_pim_config(tgen
, input_dict_dr
)
2226 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2228 step("Verify that no core is observed")
2229 if tgen
.routers_have_failure():
2230 assert False, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2232 step("Configure 'ip pim unicast-bsm' on receiver interface on FRR1")
2235 "l1": {"raw_config": ["interface {}".format(intf_l1_i1
), "ip pim unicast-bsm"]}
2237 result
= apply_raw_config(tgen
, raw_config
)
2238 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2240 step("Remove 'no ip pim hello' on receiver interface on FRR1")
2244 "raw_config": ["interface {}".format(intf_l1_i1
), "no ip pim unicast-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 write_test_footer(tc_name
)
2257 def test_pim_dr_priority_p0(request
):
2259 TC_36: Verify highest DR priority become the PIM DR
2262 tgen
= get_topogen()
2263 tc_name
= request
.node
.name
2264 write_test_header(tc_name
)
2266 # Don"t run this test if we have any failure.
2267 if tgen
.routers_have_failure():
2268 pytest
.skip(tgen
.errors
)
2270 # Creating configuration from JSON
2271 app_helper
.stop_all_hosts()
2273 reset_config_on_routers(tgen
)
2274 clear_pim_interface_traffic(tgen
, topo
)
2275 check_router_status(tgen
)
2277 step("Configure 'ip pim' on receiver interface on FRR1")
2278 step("Enable PIM on all routers")
2279 step("Enable IGMP on FRR1 interface and send IGMP join " "(225.1.1.1-225.1.1.10)")
2281 input_join
= {"i1": topo
["routers"]["i1"]["links"]["l1"]["interface"]}
2283 for recvr
, recvr_intf
in input_join
.items():
2284 result
= app_helper
.run_join(recvr
, IGMP_JOIN_RANGE_1
, join_intf
=recvr_intf
)
2285 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2287 step("Configure RP for (226.1.1.1-5) and (232.1.1.1-5) in cisco-1(f1)")
2294 "rp_addr": topo
["routers"]["r2"]["links"]["lo"]["ipv4"].split(
2297 "group_addr_range": GROUP_RANGE
,
2304 result
= create_pim_config(tgen
, topo
, input_dict
)
2305 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2307 input_src
= {"i2": topo
["routers"]["i2"]["links"]["f1"]["interface"]}
2309 for src
, src_intf
in input_src
.items():
2310 result
= app_helper
.run_traffic(src
, IGMP_JOIN_RANGE_1
, bind_intf
=src_intf
)
2311 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2313 source_i2
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
2318 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
2319 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
2323 "src_address": source_i2
,
2324 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
2325 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
2331 "oil": topo
["routers"]["r2"]["links"]["l1"]["interface"],
2335 "src_address": source_i2
,
2336 "iif": topo
["routers"]["f1"]["links"]["i2"]["interface"],
2337 "oil": topo
["routers"]["f1"]["links"]["r2"]["interface"],
2341 for data
in input_dict_all
:
2342 result
= verify_mroutes(
2345 data
["src_address"],
2350 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2352 for data
in input_dict_all
:
2353 result
= verify_upstream_iif(
2354 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
2356 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2358 step("Configure 'ip pim drpriority 10' on receiver interface on FRR1(LHR)")
2360 intf_l1_r2
= topo
["routers"]["l1"]["links"]["r2"]["interface"]
2363 "raw_config": ["interface {}".format(intf_l1_r2
), "ip pim drpriority 10"]
2366 result
= apply_raw_config(tgen
, raw_config
)
2367 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2370 "DR config is successful on FRR1 node , verify using "
2371 " 'show ip pim interface json'"
2374 input_dict_dr
= {"l1": {"pim": {"interfaces": {intf_l1_r2
: {"drPriority": 10}}}}}
2375 result
= verify_pim_config(tgen
, input_dict_dr
)
2376 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2378 for data
in input_dict_all
:
2379 result
= verify_mroutes(
2382 data
["src_address"],
2387 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2389 for data
in input_dict_all
:
2390 result
= verify_upstream_iif(
2391 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
2393 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2395 step("Configure 'ip pim drpriority 20' on receiver interface on FRR3(FHR)")
2397 intf_f1_r2
= topo
["routers"]["f1"]["links"]["r2"]["interface"]
2400 "raw_config": ["interface {}".format(intf_f1_r2
), "ip pim drpriority 20"]
2403 result
= apply_raw_config(tgen
, raw_config
)
2404 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2407 "DR config is successful on FRR3 node , verify using "
2408 " 'show ip pim interface json'"
2411 input_dict_dr
= {"f1": {"pim": {"interfaces": {intf_f1_r2
: {"drPriority": 20}}}}}
2412 result
= verify_pim_config(tgen
, input_dict_dr
)
2413 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2415 for data
in input_dict_all
:
2416 result
= verify_mroutes(
2419 data
["src_address"],
2424 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2426 for data
in input_dict_all
:
2427 result
= verify_upstream_iif(
2428 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
2430 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2433 "PIM is enable on FRR1, FRR2 interface and neighbor is up, "
2434 " verify using 'show ip pim interface'"
2437 result
= verify_pim_interface(tgen
, topo
, "l1")
2438 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2440 result
= verify_pim_interface(tgen
, topo
, "f1")
2441 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2444 "Highet IP become PIM DR , verify using "
2445 "'show ip pim interface json' and 'show ip pim neighbor'"
2447 step("Highest priority become PIM DR")
2449 dr_address
= topo
["routers"]["l1"]["links"]["r2"]["ipv4"].split("/")[0]
2451 "l1": {"pim": {"interfaces": {intf_l1_r2
: {"drAddress": dr_address
}}}}
2453 result
= verify_pim_config(tgen
, input_dict_dr
)
2454 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2456 dr_address
= topo
["routers"]["f1"]["links"]["r2"]["ipv4"].split("/")[0]
2458 "f1": {"pim": {"interfaces": {intf_f1_r2
: {"drAddress": dr_address
}}}}
2460 result
= verify_pim_config(tgen
, input_dict_dr
)
2461 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2463 step("Remove 'no ip pim drpriority' on receiver interface on FRR1")
2467 "raw_config": ["interface {}".format(intf_l1_r2
), "no ip pim drpriority 10"]
2470 result
= apply_raw_config(tgen
, raw_config
)
2471 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2473 step("Remove 'no ip pim drpriority' on receiver interface on FRR3")
2477 "raw_config": ["interface {}".format(intf_f1_r2
), "no ip pim drpriority 20"]
2480 result
= apply_raw_config(tgen
, raw_config
)
2481 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2484 "After removing drpriority , config got removed from both the "
2485 "nodes and highest IP become PIM DR"
2488 input_dict_dr
= {"l1": {"pim": {"interfaces": {intf_l1_r2
: {"drPriority": 1}}}}}
2489 result
= verify_pim_config(tgen
, input_dict_dr
)
2490 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2492 input_dict_dr
= {"f1": {"pim": {"interfaces": {intf_f1_r2
: {"drPriority": 1}}}}}
2493 result
= verify_pim_config(tgen
, input_dict_dr
)
2494 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2496 dr_address
= topo
["routers"]["r2"]["links"]["l1"]["ipv4"].split("/")[0]
2498 "l1": {"pim": {"interfaces": {intf_l1_r2
: {"drAddress": dr_address
}}}}
2500 result
= verify_pim_config(tgen
, input_dict_dr
)
2501 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2503 dr_address
= topo
["routers"]["r2"]["links"]["f1"]["ipv4"].split("/")[0]
2505 "f1": {"pim": {"interfaces": {intf_f1_r2
: {"drAddress": dr_address
}}}}
2507 result
= verify_pim_config(tgen
, input_dict_dr
)
2508 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2510 for data
in input_dict_all
:
2511 result
= verify_mroutes(
2514 data
["src_address"],
2519 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2521 for data
in input_dict_all
:
2522 result
= verify_upstream_iif(
2523 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
2525 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2527 write_test_footer(tc_name
)
2530 def test_pim_hello_timer_p1(request
):
2532 TC_37: Verify PIM hello is sent on configured timer
2535 tgen
= get_topogen()
2536 tc_name
= request
.node
.name
2537 write_test_header(tc_name
)
2539 # Don"t run this test if we have any failure.
2540 if tgen
.routers_have_failure():
2541 pytest
.skip(tgen
.errors
)
2543 # Creating configuration from JSON
2544 app_helper
.stop_all_hosts()
2546 reset_config_on_routers(tgen
)
2547 clear_pim_interface_traffic(tgen
, topo
)
2548 check_router_status(tgen
)
2550 step("Configure 'ip pim' on receiver interface on FRR1")
2551 step("Enable PIM on all routers")
2552 step("Enable IGMP on FRR1 interface and send IGMP join " "(225.1.1.1-225.1.1.10)")
2554 input_join
= {"i1": topo
["routers"]["i1"]["links"]["l1"]["interface"]}
2556 for recvr
, recvr_intf
in input_join
.items():
2557 result
= app_helper
.run_join(recvr
, IGMP_JOIN_RANGE_1
, join_intf
=recvr_intf
)
2558 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2560 step("Configure RP for (226.1.1.1-5) and (232.1.1.1-5) in cisco-1(f1)")
2567 "rp_addr": topo
["routers"]["r2"]["links"]["lo"]["ipv4"].split(
2570 "group_addr_range": GROUP_RANGE
,
2577 result
= create_pim_config(tgen
, topo
, input_dict
)
2578 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2580 step("Configure PIM hello interval timer 100 on FRR1 node (FRR1-FRR2 link)")
2582 intf_l1_r2
= topo
["routers"]["l1"]["links"]["r2"]["interface"]
2584 "l1": {"raw_config": ["interface {}".format(intf_l1_r2
), "ip pim hello 100"]}
2586 result
= apply_raw_config(tgen
, raw_config
)
2587 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2590 "PIM hello interval is configured on interface verify using "
2591 "'show ip pim interface'"
2594 input_dict_hello
= {
2595 "l1": {"pim": {"interfaces": {intf_l1_r2
: {"helloPeriod": 100}}}}
2597 result
= verify_pim_config(tgen
, input_dict_hello
)
2598 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2600 step("Modify hello timer to 180 and then 50sec")
2602 intf_l1_r2
= topo
["routers"]["l1"]["links"]["r2"]["interface"]
2604 "l1": {"raw_config": ["interface {}".format(intf_l1_r2
), "ip pim hello 180"]}
2606 result
= apply_raw_config(tgen
, raw_config
)
2607 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2610 "PIM hello interval is configured on interface verify using "
2611 "'show ip pim interface'"
2614 input_dict_hello
= {
2615 "l1": {"pim": {"interfaces": {intf_l1_r2
: {"helloPeriod": 180}}}}
2617 result
= verify_pim_config(tgen
, input_dict_hello
)
2618 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2620 intf_l1_r2
= topo
["routers"]["l1"]["links"]["r2"]["interface"]
2622 "l1": {"raw_config": ["interface {}".format(intf_l1_r2
), "ip pim hello 50"]}
2624 result
= apply_raw_config(tgen
, raw_config
)
2625 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2628 "PIM hello interval is configured on interface verify using "
2629 "'show ip pim interface'"
2632 input_dict_hello
= {
2633 "l1": {"pim": {"interfaces": {intf_l1_r2
: {"helloPeriod": 50}}}}
2635 result
= verify_pim_config(tgen
, input_dict_hello
)
2636 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2638 step("Verify that no core is observed")
2639 if tgen
.routers_have_failure():
2640 assert False, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2642 write_test_footer(tc_name
)
2645 def test_mroute_after_removing_RP_sending_IGMP_prune_p2(request
):
2647 TC_39 Verify mroute after removing the RP and sending IGMP prune
2650 tgen
= get_topogen()
2651 tc_name
= request
.node
.name
2652 write_test_header(tc_name
)
2654 # Don"t run this test if we have any failure.
2655 if tgen
.routers_have_failure():
2656 pytest
.skip(tgen
.errors
)
2658 # Creating configuration from JSON
2659 app_helper
.stop_all_hosts()
2661 reset_config_on_routers(tgen
)
2662 clear_pim_interface_traffic(tgen
, topo
)
2663 check_router_status(tgen
)
2666 "Remove cisco connected link to simulate topo "
2667 "LHR(FRR1(f1))----RP(cisco(f1)---FHR(FRR3(l1))"
2670 intf_l1_c1
= topo
["routers"]["l1"]["links"]["c1"]["interface"]
2671 intf_f1_c2
= topo
["routers"]["f1"]["links"]["c2"]["interface"]
2672 shutdown_bringup_interface(tgen
, "l1", intf_l1_c1
, False)
2673 shutdown_bringup_interface(tgen
, "f1", intf_f1_c2
, False)
2675 step("Enable the PIM on all the interfaces of FRR1, FRR2, FRR3")
2677 "Enable IGMP of FRR1 interface and send IGMP joins "
2678 " from FRR1 node for group range (225.1.1.1-5)"
2681 intf_f1_i8
= topo
["routers"]["f1"]["links"]["i8"]["interface"]
2687 "igmp": {"version": "2", "query": {"query-interval": 15}}
2693 result
= create_igmp_config(tgen
, topo
, input_dict
)
2694 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2696 input_join
= {"i8": topo
["routers"]["i8"]["links"]["f1"]["interface"]}
2698 for recvr
, recvr_intf
in input_join
.items():
2699 result
= app_helper
.run_join(recvr
, IGMP_JOIN_RANGE_1
, join_intf
=recvr_intf
)
2700 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2702 step("Configure static RP for (225.1.1.1-5) as R2")
2709 "rp_addr": topo
["routers"]["r2"]["links"]["lo"]["ipv4"].split(
2712 "group_addr_range": GROUP_RANGE
,
2719 result
= create_pim_config(tgen
, topo
, input_dict
)
2720 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2723 "Send traffic from FHR to all the groups ( 225.1.1.1 to 225.1.1.5) and send"
2724 " multicast traffic"
2727 input_src
= {"i6": topo
["routers"]["i6"]["links"]["l1"]["interface"]}
2729 for src
, src_intf
in input_src
.items():
2730 result
= app_helper
.run_traffic(src
, IGMP_JOIN_RANGE_1
, bind_intf
=src_intf
)
2731 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2733 source_i2
= topo
["routers"]["i6"]["links"]["l1"]["ipv4"].split("/")[0]
2738 "src_address": source_i2
,
2739 "iif": topo
["routers"]["l1"]["links"]["i6"]["interface"],
2740 "oil": topo
["routers"]["l1"]["links"]["r2"]["interface"],
2745 "iif": topo
["routers"]["f1"]["links"]["r2"]["interface"],
2746 "oil": topo
["routers"]["f1"]["links"]["i8"]["interface"],
2750 "src_address": source_i2
,
2751 "iif": topo
["routers"]["f1"]["links"]["r2"]["interface"],
2752 "oil": topo
["routers"]["f1"]["links"]["i8"]["interface"],
2756 step("Verify mroutes and iff upstream")
2758 for data
in input_dict_all
:
2759 result
= verify_mroutes(
2762 data
["src_address"],
2767 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2769 for data
in input_dict_all
:
2770 result
= verify_upstream_iif(
2771 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
2773 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2775 step("Remove the RP config for both the range from all the nodes")
2782 "rp_addr": topo
["routers"]["r2"]["links"]["lo"]["ipv4"].split(
2785 "group_addr_range": GROUP_RANGE
,
2793 result
= create_pim_config(tgen
, topo
, input_dict
)
2794 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2796 input_dict_starg
= [
2800 "iif": topo
["routers"]["f1"]["links"]["r2"]["interface"],
2801 "oil": topo
["routers"]["f1"]["links"]["i8"]["interface"],
2808 "src_address": source_i2
,
2809 "iif": topo
["routers"]["l1"]["links"]["i6"]["interface"],
2810 "oil": topo
["routers"]["l1"]["links"]["r2"]["interface"],
2814 "src_address": source_i2
,
2815 "iif": topo
["routers"]["f1"]["links"]["r2"]["interface"],
2816 "oil": topo
["routers"]["f1"]["links"]["i8"]["interface"],
2820 for data
in input_dict_starg
:
2821 result
= verify_mroutes(
2824 data
["src_address"],
2830 assert result
is not True, (
2831 "Testcase {} : Failed \n "
2832 "Expected: [{}]: mroute (S, G) should not be present in mroute table \n "
2833 "Found: {}".format(tc_name
, data
["dut"], result
)
2836 for data
in input_dict_sg
:
2837 result
= verify_mroutes(
2840 data
["src_address"],
2845 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2847 step("Send prune from receiver-1 (using ctrl+c) on iperf interface")
2848 app_helper
.stop_all_hosts()
2850 intf_f1_i8
= topo
["routers"]["f1"]["links"]["i8"]["interface"]
2851 input_traffic
= {"f1": {"traffic_sent": [intf_f1_i8
]}}
2852 traffic_before
= verify_multicast_traffic(tgen
, input_traffic
, return_traffic
=True)
2853 assert isinstance(traffic_before
, dict), (
2854 "Testcase {} : Failed \n traffic_before is not dictionary \n "
2855 "Error: {}".format(tc_name
, result
)
2858 step("IGMP groups are remove from FRR1 node 'show ip igmp groups'")
2861 result
= verify_igmp_groups(
2862 tgen
, dut
, intf_f1_i8
, IGMP_JOIN_RANGE_1
, expected
=False
2864 assert result
is not True, (
2865 "Testcase {} : Failed \n "
2866 "Expected: [{}]: IGMP groups should not present \n "
2867 "Found: {}".format(tc_name
, dut
, result
)
2871 "After receiving the IGMP prune from FRR1 , verify traffic "
2872 "immediately stopped for this receiver 'show ip multicast'"
2875 intf_f1_i8
= topo
["routers"]["f1"]["links"]["i8"]["interface"]
2876 input_traffic
= {"f1": {"traffic_sent": [intf_f1_i8
]}}
2877 traffic_after
= verify_multicast_traffic(tgen
, input_traffic
, return_traffic
=True)
2878 assert isinstance(traffic_after
, dict), (
2879 "Testcase {} : Failed \n traffic_after is not dictionary \n "
2880 "Error: {}".format(tc_name
, result
)
2883 result
= verify_state_incremented(traffic_before
, traffic_after
)
2884 assert result
is not True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2885 logger
.info("Expected Behaviour: {}".format(result
))
2887 step("Configure static RP for (225.1.1.1-5) as R2 loopback interface")
2894 "rp_addr": topo
["routers"]["r2"]["links"]["lo"]["ipv4"].split(
2897 "group_addr_range": GROUP_RANGE
,
2904 result
= create_pim_config(tgen
, topo
, input_dict
)
2905 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2907 step("Send IGMP joins again from LHR,check IGMP joins and starg received")
2909 for recvr
, recvr_intf
in input_join
.items():
2910 result
= app_helper
.run_join(recvr
, IGMP_JOIN_RANGE_1
, join_intf
=recvr_intf
)
2911 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2913 for data
in input_dict_starg
:
2914 result
= verify_mroutes(
2917 data
["src_address"],
2922 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2924 step("Send traffic from FHR and verify mroute upstream")
2926 for src
, src_intf
in input_src
.items():
2927 result
= app_helper
.run_traffic(src
, IGMP_JOIN_RANGE_1
, bind_intf
=src_intf
)
2928 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2930 source_i2
= topo
["routers"]["i6"]["links"]["l1"]["ipv4"].split("/")[0]
2932 for data
in input_dict_sg
:
2933 result
= verify_mroutes(
2936 data
["src_address"],
2941 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
2943 write_test_footer(tc_name
)
2946 def test_prune_sent_to_LHR_and_FHR_when_PIMnbr_down_p2(request
):
2948 TC_38 Verify prune is sent to LHR and FHR when PIM nbr went down
2951 tgen
= get_topogen()
2952 tc_name
= request
.node
.name
2953 write_test_header(tc_name
)
2955 # Don"t run this test if we have any failure.
2956 if tgen
.routers_have_failure():
2957 pytest
.skip(tgen
.errors
)
2959 # Creating configuration from JSON
2960 app_helper
.stop_all_hosts()
2962 reset_config_on_routers(tgen
)
2963 clear_pim_interface_traffic(tgen
, topo
)
2964 check_router_status(tgen
)
2967 "Remove cisco connected link to simulate topo "
2968 "LHR(FRR1(f1))----RP(cisco(f1)---FHR(FRR3(l1))"
2971 intf_l1_c1
= topo
["routers"]["l1"]["links"]["c1"]["interface"]
2972 intf_f1_c2
= topo
["routers"]["f1"]["links"]["c2"]["interface"]
2973 shutdown_bringup_interface(tgen
, "l1", intf_l1_c1
, False)
2974 shutdown_bringup_interface(tgen
, "f1", intf_f1_c2
, False)
2976 step("Enable the PIM on all the interfaces of FRR1, FRR2, FRR3")
2978 "Enable IGMP of FRR1 interface and send IGMP joins "
2979 " from FRR1 node for group range (225.1.1.1-5)"
2982 intf_f1_i8
= topo
["routers"]["f1"]["links"]["i8"]["interface"]
2988 "igmp": {"version": "2", "query": {"query-interval": 15}}
2994 result
= create_igmp_config(tgen
, topo
, input_dict
)
2995 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
2997 input_join
= {"i8": topo
["routers"]["i8"]["links"]["f1"]["interface"]}
2999 for recvr
, recvr_intf
in input_join
.items():
3000 result
= app_helper
.run_join(recvr
, IGMP_JOIN_RANGE_1
, join_intf
=recvr_intf
)
3001 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
3003 step("Configure static RP for (225.1.1.1-5) as R2")
3010 "rp_addr": topo
["routers"]["r2"]["links"]["lo"]["ipv4"].split(
3013 "group_addr_range": GROUP_RANGE
,
3020 result
= create_pim_config(tgen
, topo
, input_dict
)
3021 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3024 "Send traffic from FHR to all the groups ( 225.1.1.1 to 225.1.1.5) and send"
3025 " multicast traffic"
3029 "i6": topo
["routers"]["i6"]["links"]["l1"]["interface"],
3030 "i2": topo
["routers"]["i2"]["links"]["f1"]["interface"],
3033 for src
, src_intf
in input_src
.items():
3034 result
= app_helper
.run_traffic(src
, IGMP_JOIN_RANGE_1
, bind_intf
=src_intf
)
3035 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3037 source_i2
= topo
["routers"]["i6"]["links"]["l1"]["ipv4"].split("/")[0]
3038 source_i1
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
3043 "src_address": source_i2
,
3044 "iif": topo
["routers"]["l1"]["links"]["i6"]["interface"],
3045 "oil": topo
["routers"]["l1"]["links"]["r2"]["interface"],
3050 "iif": topo
["routers"]["f1"]["links"]["r2"]["interface"],
3051 "oil": topo
["routers"]["f1"]["links"]["i8"]["interface"],
3055 "src_address": source_i1
,
3056 "iif": topo
["routers"]["f1"]["links"]["i2"]["interface"],
3057 "oil": topo
["routers"]["f1"]["links"]["i8"]["interface"],
3061 "src_address": source_i2
,
3062 "iif": topo
["routers"]["f1"]["links"]["r2"]["interface"],
3063 "oil": topo
["routers"]["f1"]["links"]["i8"]["interface"],
3067 step("Verify mroutes and iff upstream")
3069 for data
in input_dict_all
:
3070 result
= verify_mroutes(
3073 data
["src_address"],
3078 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3080 for data
in input_dict_all
:
3081 result
= verify_upstream_iif(
3082 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
3084 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3085 step("Verify mcast traffic received")
3086 intf_f1_i8
= topo
["routers"]["f1"]["links"]["i8"]["interface"]
3087 input_traffic
= {"f1": {"traffic_sent": [intf_f1_i8
]}}
3089 result
= verify_multicast_traffic(tgen
, input_traffic
)
3090 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3092 step("Shut the link from LHR to RP from RP node")
3094 intf_r2_f1
= topo
["routers"]["r2"]["links"]["f1"]["interface"]
3095 shutdown_bringup_interface(tgen
, "r2", intf_r2_f1
, False)
3097 step("Verify RP info after Shut the link from LHR to RP from RP node")
3099 rp_address
= "1.0.5.17"
3101 result
= verify_pim_rp_info(
3102 tgen
, topo
, dut
, GROUP_RANGE_1
, "Unknown", rp_address
, SOURCE
3104 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3106 input_dict_starg
= [
3110 "iif": topo
["routers"]["f1"]["links"]["r2"]["interface"],
3111 "oil": topo
["routers"]["f1"]["links"]["i8"]["interface"],
3115 input_dict_sg_i2
= [
3118 "src_address": source_i2
,
3119 "iif": topo
["routers"]["l1"]["links"]["i6"]["interface"],
3120 "oil": topo
["routers"]["l1"]["links"]["r2"]["interface"],
3124 "src_address": source_i2
,
3125 "iif": topo
["routers"]["f1"]["links"]["r2"]["interface"],
3126 "oil": topo
["routers"]["f1"]["links"]["i8"]["interface"],
3130 input_dict_sg_i1
= [
3133 "src_address": source_i1
,
3134 "iif": topo
["routers"]["f1"]["links"]["i2"]["interface"],
3135 "oil": topo
["routers"]["f1"]["links"]["i8"]["interface"],
3139 input_dict_sg_i2_l1
= [
3142 "src_address": source_i2
,
3143 "iif": topo
["routers"]["l1"]["links"]["i6"]["interface"],
3144 "oil": topo
["routers"]["l1"]["links"]["r2"]["interface"],
3148 step("Verify mroute after Shut the link from LHR to RP from RP node")
3150 for data
in input_dict_starg
:
3151 result
= verify_mroutes(
3154 data
["src_address"],
3160 assert result
is not True, (
3161 "Testcase {} : Failed \n "
3162 "Expected: [{}]: mroute (S, G) should not be present in mroute table \n "
3163 "Found: {}".format(tc_name
, data
["dut"], result
)
3166 for data
in input_dict_sg_i1
:
3167 result
= verify_mroutes(
3170 data
["src_address"],
3175 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3177 step("Verify upstream after Shut the link from LHR to RP from RP node")
3179 for data
in input_dict_starg
:
3180 result
= verify_upstream_iif(
3184 data
["src_address"],
3188 assert result
is not True, (
3189 "Testcase {} : Failed \n "
3190 "Expected: [{}]: Upstream IIF interface {} should not be present\n"
3191 "Found: {}".format(tc_name
, data
["dut"], data
["iif"], result
)
3194 for data
in input_dict_sg_i1
:
3195 result
= verify_upstream_iif(
3196 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
3198 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3200 step("No shut the link from LHR to RP from RP node")
3202 intf_r2_f1
= topo
["routers"]["r2"]["links"]["f1"]["interface"]
3203 shutdown_bringup_interface(tgen
, "r2", intf_r2_f1
, True)
3205 step("Verify RP info after No shut the link from LHR to RP from RP node")
3207 rp_address
= "1.0.5.17"
3209 result
= verify_pim_rp_info(
3210 tgen
, topo
, dut
, GROUP_RANGE_1
, "Unknown", rp_address
, SOURCE
, expected
=False
3212 assert result
is not True, (
3213 "Testcase {} : Failed \n "
3214 "Expected: [{}]: RP IIF should be updated as Unknown \n "
3215 "Found: {}".format(tc_name
, dut
, result
)
3218 step("Verify mroute after No shut the link from LHR to RP from RP node")
3220 for data
in input_dict_starg
:
3221 result
= verify_mroutes(
3224 data
["src_address"],
3229 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3231 for data
in input_dict_sg_i2
:
3232 result
= verify_mroutes(
3235 data
["src_address"],
3240 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3242 for data
in input_dict_sg_i1
:
3243 result
= verify_mroutes(
3246 data
["src_address"],
3251 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3253 step("Verify upstrem after No shut the link from LHR to RP from RP node")
3255 for data
in input_dict_starg
:
3256 result
= verify_upstream_iif(
3257 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
3259 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3261 for data
in input_dict_sg_i1
:
3262 result
= verify_upstream_iif(
3263 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
3265 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3267 for data
in input_dict_sg_i2
:
3268 result
= verify_upstream_iif(
3269 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
3271 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3273 step("Verify mcast traffic received after noshut LHR to RP from RP node")
3275 intf_f1_i8
= topo
["routers"]["f1"]["links"]["i8"]["interface"]
3276 input_traffic
= {"f1": {"traffic_sent": [intf_f1_i8
]}}
3277 result
= verify_multicast_traffic(tgen
, input_traffic
)
3278 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3280 step("Shut the link from FHR to RP from RP node")
3282 intf_r2_l1
= topo
["routers"]["r2"]["links"]["l1"]["interface"]
3283 shutdown_bringup_interface(tgen
, "r2", intf_r2_l1
, False)
3285 step("Verify RP info after Shut the link from FHR to RP from RP node")
3287 rp_address
= "1.0.5.17"
3289 result
= verify_pim_rp_info(
3290 tgen
, topo
, dut
, GROUP_RANGE_1
, "Unknown", rp_address
, SOURCE
3292 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3294 step("Verify mroute after Shut the link from FHR to RP from RP node")
3296 for data
in input_dict_starg
:
3297 result
= verify_mroutes(
3300 data
["src_address"],
3305 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3307 for data
in input_dict_sg_i1
:
3308 result
= verify_mroutes(
3311 data
["src_address"],
3316 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3318 step("Verify upstream after Shut the link from FHR to RP from RP node")
3320 for data
in input_dict_starg
:
3321 result
= verify_upstream_iif(
3322 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
3324 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3326 for data
in input_dict_sg_i1
:
3327 result
= verify_upstream_iif(
3328 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
3330 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3332 for data
in input_dict_sg_i2_l1
:
3333 result
= verify_upstream_iif(
3337 data
["src_address"],
3341 assert result
is not True, (
3342 "Testcase {} : Failed \n "
3343 "Expected: [{}]: Upstream IIF interface {} should not be present"
3344 " after shutting link from RP to FHR \n"
3345 "Found: {}".format(tc_name
, data
["dut"], data
["iif"], result
)
3348 step(" No shut the link from FHR to RP from RP node")
3350 intf_r2_l1
= topo
["routers"]["r2"]["links"]["l1"]["interface"]
3351 shutdown_bringup_interface(tgen
, "r2", intf_r2_l1
, True)
3353 step("Verify RP info after Noshut the link from FHR to RP from RP node")
3356 rp_address
= "1.0.5.17"
3358 result
= verify_pim_rp_info(
3359 tgen
, topo
, dut
, GROUP_RANGE_1
, "Unknown", rp_address
, SOURCE
, expected
=False
3361 assert result
is not True, (
3362 "Testcase {} : Failed \n "
3363 "Expected: [{}]: RP IIF should be updated as Unknown \n"
3364 "Found: {}".format(tc_name
, dut
, result
)
3367 step("Verify mroute after Noshut the link from FHR to RP from RP node")
3369 for data
in input_dict_starg
:
3370 result
= verify_mroutes(
3373 data
["src_address"],
3378 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3380 for data
in input_dict_sg_i2
:
3381 result
= verify_mroutes(
3384 data
["src_address"],
3389 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3391 for data
in input_dict_sg_i1
:
3392 result
= verify_mroutes(
3395 data
["src_address"],
3400 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3402 step("Verify mroute after Noshut the link from FHR to RP from RP node")
3404 for data
in input_dict_starg
:
3405 result
= verify_upstream_iif(
3406 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
3408 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3410 for data
in input_dict_sg_i1
:
3411 result
= verify_upstream_iif(
3412 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
3414 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3416 for data
in input_dict_sg_i2
:
3417 result
= verify_upstream_iif(
3418 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
3420 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3422 step("Verify mcast traffic received after noshut FHR to RP from RP node")
3423 intf_f1_i8
= topo
["routers"]["f1"]["links"]["i8"]["interface"]
3424 input_traffic
= {"f1": {"traffic_sent": [intf_f1_i8
]}}
3425 result
= verify_multicast_traffic(tgen
, input_traffic
)
3426 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3428 step("Shut the link from FHR to RP from FHR node")
3430 intf_l1_r2
= topo
["routers"]["l1"]["links"]["r2"]["interface"]
3431 shutdown_bringup_interface(tgen
, "l1", intf_l1_r2
, False)
3433 step("Verify PIM Nbrs after Shut the link from FHR to RP from FHR node")
3435 step("Verify RP info after Shut the link from FHR to RP from FHR node")
3437 rp_address
= "1.0.5.17"
3439 result
= verify_pim_rp_info(
3440 tgen
, topo
, dut
, GROUP_RANGE_1
, "Unknown", rp_address
, SOURCE
3442 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3444 step("Verify mroute after Shut the link from FHR to RP from FHR node")
3446 for data
in input_dict_starg
:
3447 result
= verify_mroutes(
3450 data
["src_address"],
3455 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3457 for data
in input_dict_sg_i1
:
3458 result
= verify_mroutes(
3461 data
["src_address"],
3466 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3468 step("Verify upstream after Shut the link from FHR to RP from FHR node")
3469 for data
in input_dict_starg
:
3470 result
= verify_upstream_iif(
3471 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
3473 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3475 for data
in input_dict_sg_i1
:
3476 result
= verify_upstream_iif(
3477 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
3479 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3481 for data
in input_dict_sg_i2_l1
:
3482 result
= verify_upstream_iif(
3486 data
["src_address"],
3490 assert result
is not True, (
3491 "Testcase {} : Failed \n "
3492 "Expected: [{}]: Upstream IIF interface {} should not be present"
3493 " after shutting link from FHR to RP \n"
3494 "Found: {}".format(tc_name
, data
["dut"], data
["iif"], result
)
3497 step(" No shut the link from FHR to RP from FHR node")
3499 intf_l1_r2
= topo
["routers"]["l1"]["links"]["r2"]["interface"]
3500 shutdown_bringup_interface(tgen
, "l1", intf_l1_r2
, True)
3502 step("Verify RP info after No Shut the link from FHR to RP from FHR node")
3504 rp_address
= "1.0.5.17"
3506 result
= verify_pim_rp_info(
3507 tgen
, topo
, dut
, GROUP_RANGE_1
, "Unknown", rp_address
, SOURCE
, expected
=False
3509 assert result
is not True, (
3510 "Testcase {} : Failed \n "
3511 "Expected: [{}]: RP IIF should be updated as Unknown \n"
3512 "Found: {}".format(tc_name
, dut
, result
)
3515 step("Verify mroute after No Shut the link from FHR to RP from FHR node")
3517 for data
in input_dict_starg
:
3518 result
= verify_mroutes(
3521 data
["src_address"],
3526 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3528 for data
in input_dict_sg_i2
:
3529 result
= verify_mroutes(
3532 data
["src_address"],
3537 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3539 for data
in input_dict_sg_i1
:
3540 result
= verify_mroutes(
3543 data
["src_address"],
3548 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3550 step("Verify upstream after No Shut the link from FHR to RP from FHR node")
3552 for data
in input_dict_starg
:
3553 result
= verify_upstream_iif(
3554 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
3556 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3558 for data
in input_dict_sg_i1
:
3559 result
= verify_upstream_iif(
3560 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
3562 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3564 for data
in input_dict_sg_i2
:
3565 result
= verify_upstream_iif(
3566 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
3568 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3570 step("Verify mcast traffic received after noshut FHR to RP from FHR node")
3571 intf_f1_i8
= topo
["routers"]["f1"]["links"]["i8"]["interface"]
3572 input_traffic
= {"f1": {"traffic_sent": [intf_f1_i8
]}}
3573 result
= verify_multicast_traffic(tgen
, input_traffic
)
3574 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3576 write_test_footer(tc_name
)
3579 def test_mroute_flags_p1(request
):
3581 TC_47 Verify mroute flag in LHR and FHR node
3584 tgen
= get_topogen()
3585 tc_name
= request
.node
.name
3586 write_test_header(tc_name
)
3588 # Don"t run this test if we have any failure.
3589 if tgen
.routers_have_failure():
3590 pytest
.skip(tgen
.errors
)
3592 # Creating configuration from JSON
3593 app_helper
.stop_all_hosts()
3595 reset_config_on_routers(tgen
)
3596 clear_pim_interface_traffic(tgen
, topo
)
3597 check_router_status(tgen
)
3600 "Remove cisco connected link to simulate topo "
3601 "LHR(FRR1(f1))----RP(cisco(f1)---FHR(FRR3(l1))"
3604 intf_l1_c1
= topo
["routers"]["l1"]["links"]["c1"]["interface"]
3605 intf_f1_c2
= topo
["routers"]["f1"]["links"]["c2"]["interface"]
3606 shutdown_bringup_interface(tgen
, "l1", intf_l1_c1
, False)
3607 shutdown_bringup_interface(tgen
, "f1", intf_f1_c2
, False)
3609 step("Enable the PIM on all the interfaces of FRR1, FRR2, FRR3")
3611 "Enable IGMP of FRR1 interface and send IGMP joins "
3612 " from FRR1 node for group range (225.1.1.1-5)"
3615 intf_f1_i8
= topo
["routers"]["f1"]["links"]["i8"]["interface"]
3621 "igmp": {"version": "2", "query": {"query-interval": 15}}
3627 result
= create_igmp_config(tgen
, topo
, input_dict
)
3628 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
3630 input_join
= {"i8": topo
["routers"]["i8"]["links"]["f1"]["interface"]}
3632 for recvr
, recvr_intf
in input_join
.items():
3633 result
= app_helper
.run_join(recvr
, IGMP_JOIN_RANGE_1
, join_intf
=recvr_intf
)
3634 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
3636 step("Configure static RP for (225.1.1.1-5) as R2")
3643 "rp_addr": topo
["routers"]["r2"]["links"]["lo"]["ipv4"].split(
3646 "group_addr_range": GROUP_RANGE
,
3653 result
= create_pim_config(tgen
, topo
, input_dict
)
3654 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3657 "Send traffic from FHR to all the groups ( 225.1.1.1 to 225.1.1.5) and send"
3658 " multicast traffic"
3662 "i6": topo
["routers"]["i6"]["links"]["l1"]["interface"],
3663 "i2": topo
["routers"]["i2"]["links"]["f1"]["interface"],
3666 for src
, src_intf
in input_src
.items():
3667 result
= app_helper
.run_traffic(src
, IGMP_JOIN_RANGE_1
, bind_intf
=src_intf
)
3668 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3670 source_i2
= topo
["routers"]["i6"]["links"]["l1"]["ipv4"].split("/")[0]
3671 source_i1
= topo
["routers"]["i2"]["links"]["f1"]["ipv4"].split("/")[0]
3676 "src_address": source_i2
,
3677 "iif": topo
["routers"]["l1"]["links"]["i6"]["interface"],
3678 "oil": topo
["routers"]["l1"]["links"]["r2"]["interface"],
3683 "iif": topo
["routers"]["f1"]["links"]["r2"]["interface"],
3684 "oil": topo
["routers"]["f1"]["links"]["i8"]["interface"],
3688 "src_address": source_i1
,
3689 "iif": topo
["routers"]["f1"]["links"]["i2"]["interface"],
3690 "oil": topo
["routers"]["f1"]["links"]["i8"]["interface"],
3694 "src_address": source_i2
,
3695 "iif": topo
["routers"]["f1"]["links"]["r2"]["interface"],
3696 "oil": topo
["routers"]["f1"]["links"]["i8"]["interface"],
3700 step("Verify mroutes and iff upstream")
3702 for data
in input_dict_all
:
3703 result
= verify_mroutes(
3706 data
["src_address"],
3711 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3713 result
= verify_upstream_iif(
3714 tgen
, data
["dut"], data
["iif"], data
["src_address"], IGMP_JOIN_RANGE_1
3716 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3719 step("verify flag for (*,G) on f1")
3722 result
= verify_multicast_flag_state(
3723 tgen
, dut
, src_address
, IGMP_JOIN_RANGE_1
, flag
3725 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3727 step("verify flag for (S,G) on f1 for Remote spurce ")
3728 src_address
= source_i2
3730 result
= verify_multicast_flag_state(
3731 tgen
, dut
, src_address
, IGMP_JOIN_RANGE_1
, flag
3733 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3735 write_test_footer(tc_name
)
3738 def test_verify_multicast_traffic_when_LHR_connected_to_RP_p1(request
):
3740 TC_11: Verify multicast traffic flowing fine, when LHR connected to RP
3742 FHR(FRR3(l1))---LHR(FRR1(r2)----RP(FRR2(f1))
3745 tgen
= get_topogen()
3746 tc_name
= request
.node
.name
3747 write_test_header(tc_name
)
3749 # Don"t run this test if we have any failure.
3750 if tgen
.routers_have_failure():
3751 pytest
.skip(tgen
.errors
)
3753 # Creating configuration from JSON
3754 app_helper
.stop_all_hosts()
3756 reset_config_on_routers(tgen
)
3757 clear_pim_interface_traffic(tgen
, topo
)
3758 check_router_status(tgen
)
3761 "Remove FRR3 to cisco connected link to simulate topo "
3762 "FHR(FRR3(l1))---LHR(FRR1(r2)----RP(FRR2(f1))"
3765 intf_l1_c1
= topo
["routers"]["l1"]["links"]["c1"]["interface"]
3766 intf_f1_c2
= topo
["routers"]["f1"]["links"]["c2"]["interface"]
3767 shutdown_bringup_interface(tgen
, "l1", intf_l1_c1
, False)
3768 shutdown_bringup_interface(tgen
, "f1", intf_f1_c2
, False)
3770 step("Disable IGMP config from l1")
3785 result
= create_igmp_config(tgen
, topo
, input_dict_2
)
3786 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
3788 step("Enable the PIM on all the interfaces of FRR1, R2 and FRR3" " routers")
3790 "Enable IGMP on FRR1(r2) interface and send IGMP join (226.1.1.1-5)"
3791 " and (232.1.1.1-5)"
3794 intf_r2_i3
= topo
["routers"]["r2"]["links"]["i3"]["interface"]
3800 "igmp": {"version": "2", "query": {"query-interval": 15}}
3806 result
= create_igmp_config(tgen
, topo
, input_dict
)
3807 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
3809 _GROUP_RANGE
= GROUP_RANGE_2
+ GROUP_RANGE_3
3810 _IGMP_JOIN_RANGE
= IGMP_JOIN_RANGE_2
+ IGMP_JOIN_RANGE_3
3812 input_join
= {"i3": topo
["routers"]["i3"]["links"]["r2"]["interface"]}
3814 for recvr
, recvr_intf
in input_join
.items():
3815 result
= app_helper
.run_join(recvr
, _IGMP_JOIN_RANGE
, join_intf
=recvr_intf
)
3816 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
3818 step("Configure RP for (226.1.1.1-5) and (232.1.1.1-5) in (f1)")
3825 "rp_addr": topo
["routers"]["f1"]["links"]["lo"]["ipv4"].split(
3828 "group_addr_range": _GROUP_RANGE
,
3835 result
= create_pim_config(tgen
, topo
, input_dict
)
3836 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3838 step("Send multicast traffic from FRR3 to 225.1.1.1-225.1.1.10" " receiver")
3840 input_src
= {"i1": topo
["routers"]["i1"]["links"]["l1"]["interface"]}
3842 for src
, src_intf
in input_src
.items():
3843 result
= app_helper
.run_traffic(src
, _IGMP_JOIN_RANGE
, bind_intf
=src_intf
)
3844 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3847 "'show ip mroute' showing correct RPF and OIF interface for (*,G)"
3848 " and (S,G) entries on all the nodes"
3851 source_i1
= topo
["routers"]["i1"]["links"]["l1"]["ipv4"].split("/")[0]
3855 "src_address": source_i1
,
3856 "iif": topo
["routers"]["l1"]["links"]["i1"]["interface"],
3857 "oil": topo
["routers"]["l1"]["links"]["r2"]["interface"],
3862 "iif": topo
["routers"]["r2"]["links"]["f1"]["interface"],
3863 "oil": topo
["routers"]["r2"]["links"]["i3"]["interface"],
3867 "src_address": source_i1
,
3868 "iif": topo
["routers"]["r2"]["links"]["l1"]["interface"],
3869 "oil": topo
["routers"]["r2"]["links"]["i3"]["interface"],
3873 for data
in input_dict_all
:
3874 result
= verify_mroutes(
3877 data
["src_address"],
3882 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3884 for data
in input_dict_all
:
3885 result
= verify_upstream_iif(
3886 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
3888 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3891 "Multicast traffic is flowing for all the groups verify"
3892 "using 'show ip multicast'"
3895 intf_l1_i1
= topo
["routers"]["l1"]["links"]["i1"]["interface"]
3896 intf_r2_l1
= topo
["routers"]["r2"]["links"]["l1"]["interface"]
3897 intf_r2_f1
= topo
["routers"]["r2"]["links"]["f1"]["interface"]
3898 intf_r2_i3
= topo
["routers"]["r2"]["links"]["i3"]["interface"]
3899 intf_f1_r2
= topo
["routers"]["f1"]["links"]["r2"]["interface"]
3901 "l1": {"traffic_received": [intf_l1_i1
]},
3902 "r2": {"traffic_received": [intf_r2_l1
], "traffic_sent": [intf_r2_i3
]},
3904 result
= verify_multicast_traffic(tgen
, input_traffic
)
3905 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3907 step("Shut and No shut the receiver port")
3909 intf_r2_i3
= topo
["routers"]["r2"]["links"]["i3"]["interface"]
3910 shutdown_bringup_interface(tgen
, "r2", intf_r2_i3
, False)
3913 "Verification: After Shut of receiver port, Verify (*,G) and "
3914 "(S,G) got removed from LHR node (FRR1) using 'show ip mroute'"
3921 "iif": topo
["routers"]["r2"]["links"]["f1"]["interface"],
3922 "oil": topo
["routers"]["r2"]["links"]["i3"]["interface"],
3926 "src_address": source_i1
,
3927 "iif": topo
["routers"]["r2"]["links"]["l1"]["interface"],
3928 "oil": topo
["routers"]["r2"]["links"]["i3"]["interface"],
3932 for data
in input_dict_r2
:
3933 result
= verify_mroutes(
3936 data
["src_address"],
3942 assert result
is not True, (
3943 "Testcase {} : Failed \n "
3944 "Expected: [{}]: mroute (S, G) should not be present in mroute table \n "
3945 "Found: {}".format(tc_name
, data
["dut"], result
)
3948 shutdown_bringup_interface(tgen
, "r2", intf_r2_i3
, True)
3951 "Verification: After No shut of receiver port , Verify (*,G)"
3952 " and (S,G) got populated on LHR node (FRR1) using "
3953 "'show ip mroute' 'show ip pim upstream'"
3956 for data
in input_dict_r2
:
3957 result
= verify_mroutes(
3960 data
["src_address"],
3965 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3967 for data
in input_dict_r2
:
3968 result
= verify_upstream_iif(
3969 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
3971 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3974 "Multicast traffic is resumed for all the groups verify "
3975 "using 'show ip multicast'"
3978 result
= verify_multicast_traffic(tgen
, input_traffic
)
3979 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
3981 step("Shut and No shut the source port")
3983 intf_l1_i1
= topo
["routers"]["l1"]["links"]["i1"]["interface"]
3984 shutdown_bringup_interface(tgen
, "l1", intf_l1_i1
, False)
3987 "Verification: After Shut of source port, Verify (*,G) and "
3988 "(S,G) got removed from LHR node (FRR1) using 'show ip mroute'"
3994 "src_address": source_i1
,
3995 "iif": topo
["routers"]["l1"]["links"]["i1"]["interface"],
3996 "oil": topo
["routers"]["l1"]["links"]["r2"]["interface"],
4000 for data
in input_dict_l1
:
4001 result
= verify_mroutes(
4004 data
["src_address"],
4010 assert result
is not True, (
4011 "Testcase {} : Failed \n "
4012 "Expected: [{}]: mroute (S, G) should not be present in mroute table \n "
4013 "Found: {}".format(tc_name
, data
["dut"], result
)
4016 shutdown_bringup_interface(tgen
, "l1", intf_l1_i1
, True)
4019 "Verification: After No shut of source port , Verify (*,G)"
4020 " and (S,G) got populated on LHR node (FRR1) using "
4021 "'show ip mroute' 'show ip pim upstream'"
4024 for data
in input_dict_l1
:
4025 result
= verify_mroutes(
4028 data
["src_address"],
4033 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4035 for data
in input_dict_l1
:
4036 result
= verify_upstream_iif(
4037 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
4039 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4042 "Multicast traffic is resumed for all the groups verify "
4043 "using 'show ip multicast'"
4046 result
= verify_multicast_traffic(tgen
, input_traffic
)
4047 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4049 step("Shut and No shut of LHR to cisco port from LHR side")
4051 intf_r2_f1
= topo
["routers"]["r2"]["links"]["f1"]["interface"]
4052 shutdown_bringup_interface(tgen
, "r2", intf_r2_f1
, False)
4055 "Verification: After Shut of source port, Verify (S,G) got "
4056 "removed from LHR and FHR using 'show ip mroute'"
4059 input_dict_r2_f1
= [
4063 "iif": topo
["routers"]["r2"]["links"]["f1"]["interface"],
4064 "oil": topo
["routers"]["r2"]["links"]["i3"]["interface"],
4070 "oil": topo
["routers"]["f1"]["links"]["r2"]["interface"],
4074 for data
in input_dict_r2_f1
:
4075 result
= verify_mroutes(
4078 data
["src_address"],
4084 assert result
is not True, (
4085 "Testcase {} : Failed \n "
4086 "Expected: [{}]: mroute (S, G) should not be present in mroute table \n "
4087 "Found: {}".format(tc_name
, data
["dut"], result
)
4090 shutdown_bringup_interface(tgen
, "r2", intf_r2_f1
, True)
4093 "Verification: After No shut of source port , Verify (*,G)"
4094 " and (S,G) got populated on LHR node (FRR1) using "
4095 "'show ip mroute' 'show ip pim upstream'"
4098 for data
in input_dict_all
:
4099 result
= verify_mroutes(
4102 data
["src_address"],
4107 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4109 for data
in input_dict_all
:
4110 result
= verify_upstream_iif(
4111 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
4113 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4116 "Multicast traffic is resumed for all the groups verify "
4117 "using 'show ip multicast'"
4120 input_traffic_r2
= {
4121 "r2": {"traffic_received": [intf_r2_l1
], "traffic_sent": [intf_r2_i3
]}
4123 result
= verify_multicast_traffic(tgen
, input_traffic_r2
)
4124 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4126 step("Shut and no shut of FHR to LHR port from FHR side")
4128 intf_l1_r2
= topo
["routers"]["l1"]["links"]["r2"]["interface"]
4129 shutdown_bringup_interface(tgen
, "l1", intf_l1_r2
, False)
4132 "Verification: After Shut of LHR to FHR port, Verify (S,G)"
4133 "got removed from LHR 'show ip mroute'"
4138 iif
= topo
["routers"]["r2"]["links"]["f1"]["interface"]
4139 oil
= topo
["routers"]["r2"]["links"]["i3"]["interface"]
4141 result
= verify_mroutes(tgen
, dut
, src_address
, _IGMP_JOIN_RANGE
, iif
, oil
)
4142 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4144 src_address
= source_i1
4145 iif
= topo
["routers"]["r2"]["links"]["l1"]["interface"]
4146 oil
= topo
["routers"]["r2"]["links"]["i3"]["interface"]
4148 result
= verify_mroutes(
4149 tgen
, dut
, src_address
, _IGMP_JOIN_RANGE
, iif
, oil
, expected
=False
4151 assert result
is not True, (
4152 "Testcase {} : Failed \n "
4153 "Expected: [{}]: mroute (S, G) should not be present in mroute table \n "
4154 "Found: {}".format(tc_name
, dut
, result
)
4157 shutdown_bringup_interface(tgen
, "l1", intf_l1_r2
, True)
4160 "Verification: After No shut of source port , Verify (*,G)"
4161 " and (S,G) got populated on LHR node (FRR1) using "
4162 "'show ip mroute' 'show ip pim upstream'"
4165 for data
in input_dict_all
:
4166 result
= verify_mroutes(
4169 data
["src_address"],
4174 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4176 for data
in input_dict_all
:
4177 result
= verify_upstream_iif(
4178 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
4180 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4183 "Multicast traffic is resumed for all the groups verify "
4184 "using 'show ip multicast'"
4187 result
= verify_multicast_traffic(tgen
, input_traffic_r2
)
4188 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4190 write_test_footer(tc_name
)
4193 def test_verify_multicast_traffic_when_FHR_connected_to_RP_p1(request
):
4195 TC_12: Verify multicast traffic is flowing fine when FHR is connected to RP
4197 LHR(FRR1)---FHR(FRR3)----RP(FRR2)
4200 tgen
= get_topogen()
4201 tc_name
= request
.node
.name
4202 write_test_header(tc_name
)
4204 # Don"t run this test if we have any failure.
4205 if tgen
.routers_have_failure():
4206 pytest
.skip(tgen
.errors
)
4208 # Creating configuration from JSON
4209 app_helper
.stop_all_hosts()
4211 reset_config_on_routers(tgen
)
4212 clear_pim_interface_traffic(tgen
, topo
)
4213 check_router_status(tgen
)
4216 "Remove FRR3 to FRR2 connected link to simulate topo "
4217 "FHR(FRR3)---LHR(FRR1)----RP(FFR2)"
4220 intf_l1_c1
= topo
["routers"]["l1"]["links"]["c1"]["interface"]
4221 intf_f1_c2
= topo
["routers"]["f1"]["links"]["c2"]["interface"]
4222 shutdown_bringup_interface(tgen
, "l1", intf_l1_c1
, False)
4223 shutdown_bringup_interface(tgen
, "f1", intf_f1_c2
, False)
4225 step("Enable the PIM on all the interfaces of FRR1, R2 and FRR3" " routers")
4226 step("Enable IGMP on FRR1(l1) interface and send IGMP join " " and (225.1.1.1-5)")
4228 _GROUP_RANGE
= GROUP_RANGE_2
+ GROUP_RANGE_3
4229 _IGMP_JOIN_RANGE
= IGMP_JOIN_RANGE_2
+ IGMP_JOIN_RANGE_3
4231 input_join
= {"i1": topo
["routers"]["i1"]["links"]["l1"]["interface"]}
4233 for recvr
, recvr_intf
in input_join
.items():
4234 result
= app_helper
.run_join(recvr
, _IGMP_JOIN_RANGE
, join_intf
=recvr_intf
)
4235 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
4237 step("Configure RP for (225.1.1.1-5) in (f1)")
4244 "rp_addr": topo
["routers"]["f1"]["links"]["lo"]["ipv4"].split(
4247 "group_addr_range": _GROUP_RANGE
,
4254 result
= create_pim_config(tgen
, topo
, input_dict
)
4255 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4257 step("Send multicast traffic from FRR3(r2) to 225.1.1.1-225.1.1.10" " receiver")
4259 input_src
= {"i3": topo
["routers"]["i3"]["links"]["r2"]["interface"]}
4261 for src
, src_intf
in input_src
.items():
4262 result
= app_helper
.run_traffic(src
, _IGMP_JOIN_RANGE
, bind_intf
=src_intf
)
4263 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4266 "'show ip mroute' showing correct RPF and OIF interface for (*,G)"
4267 " and (S,G) entries on all the nodes"
4270 source_i3
= topo
["routers"]["i3"]["links"]["r2"]["ipv4"].split("/")[0]
4275 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
4276 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
4280 "src_address": source_i3
,
4281 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
4282 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
4287 "iif": topo
["routers"]["r2"]["links"]["f1"]["interface"],
4288 "oil": topo
["routers"]["r2"]["links"]["l1"]["interface"],
4292 "src_address": source_i3
,
4293 "iif": topo
["routers"]["r2"]["links"]["i3"]["interface"],
4294 "oil": topo
["routers"]["r2"]["links"]["l1"]["interface"],
4298 for data
in input_dict_all
:
4299 result
= verify_mroutes(
4302 data
["src_address"],
4307 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4309 for data
in input_dict_all
:
4310 result
= verify_upstream_iif(
4311 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
4313 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4315 intf_l1_r2
= topo
["routers"]["l1"]["links"]["r2"]["interface"]
4316 intf_f1_r2
= topo
["routers"]["f1"]["links"]["r2"]["interface"]
4317 intf_l1_i1
= topo
["routers"]["l1"]["links"]["i1"]["interface"]
4319 "l1": {"traffic_received": [intf_l1_r2
], "traffic_sent": [intf_l1_i1
]}
4321 result
= verify_multicast_traffic(tgen
, input_traffic
)
4322 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4324 step("Shut the receiver(l1) port in 1 min interval")
4326 shutdown_bringup_interface(tgen
, "l1", intf_l1_i1
, False)
4329 "Verification: After Shut of receiver port, Verify (*,G) and "
4330 "(S,G) got removed from LHR node (FRR1) using 'show ip mroute'"
4336 "src_address": source_i3
,
4337 "iif": topo
["routers"]["l1"]["links"]["r2"]["interface"],
4338 "oil": topo
["routers"]["l1"]["links"]["i1"]["interface"],
4342 for data
in input_dict_l1
:
4343 result
= verify_mroutes(
4346 data
["src_address"],
4352 assert result
is not True, (
4353 "Testcase {} : Failed \n "
4354 "Expected: [{}]: mroute (S, G) should not be present in mroute table \n "
4355 "Found: {}".format(tc_name
, data
["dut"], result
)
4358 step("No shut the receiver(l1) port in 1 min interval")
4360 shutdown_bringup_interface(tgen
, "l1", intf_l1_i1
, True)
4363 "Verification: After No shut of receiver port , Verify (*,G)"
4364 " and (S,G) got populated on LHR node (FRR1) using "
4365 "'show ip mroute' 'show ip pim upstream'"
4368 for data
in input_dict_l1
:
4369 result
= verify_mroutes(
4372 data
["src_address"],
4377 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4379 for data
in input_dict_l1
:
4380 result
= verify_upstream_iif(
4381 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
4383 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4385 result
= verify_multicast_traffic(tgen
, input_traffic
)
4386 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4388 step("Shut the source(r2) port in 1 min interval")
4390 intf_r2_i3
= topo
["routers"]["r2"]["links"]["i3"]["interface"]
4391 shutdown_bringup_interface(tgen
, "r2", intf_r2_i3
, False)
4394 "Verification: After Shut of source port, Verify (S,G) got "
4395 "removed from FHR using 'show ip mroute'"
4401 "src_address": source_i3
,
4402 "iif": topo
["routers"]["r2"]["links"]["i3"]["interface"],
4403 "oil": topo
["routers"]["r2"]["links"]["l1"]["interface"],
4407 for data
in input_dict_r2
:
4408 result
= verify_mroutes(
4411 data
["src_address"],
4417 assert result
is not True, (
4418 "Testcase {} : Failed \n "
4419 "Expected: [{}]: mroute (S, G) should not be present in mroute table \n "
4420 "Found: {}".format(tc_name
, data
["dut"], result
)
4423 step("No shut the source(r2) port in 1 min interval")
4425 shutdown_bringup_interface(tgen
, "r2", intf_r2_i3
, True)
4428 "Verification: After No shut of source port , Verify (*,G)"
4429 " and (S,G) got populated on LHR and FHR using "
4430 "'show ip mroute' 'show ip pim upstream'"
4433 for data
in input_dict_r2
:
4434 result
= verify_mroutes(
4437 data
["src_address"],
4442 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4444 for data
in input_dict_r2
:
4445 result
= verify_upstream_iif(
4446 tgen
, data
["dut"], data
["iif"], data
["src_address"], _IGMP_JOIN_RANGE
4448 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4450 result
= verify_multicast_traffic(tgen
, input_traffic
)
4451 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4453 step("Shut FHR to RP port from FHR side")
4455 intf_r2_f1
= topo
["routers"]["r2"]["links"]["f1"]["interface"]
4456 shutdown_bringup_interface(tgen
, "r2", intf_r2_f1
, False)
4459 "Verification: After Shut of FHR to cisco port, Verify (*,G) "
4460 "got removed from FHR and cisco node using 'show ip mroute'"
4463 input_dict_all_star
= [
4467 "iif": topo
["routers"]["r2"]["links"]["f1"]["interface"],
4468 "oil": topo
["routers"]["r2"]["links"]["l1"]["interface"],
4474 "oil": topo
["routers"]["f1"]["links"]["r2"]["interface"],
4478 for data
in input_dict_all_star
:
4479 result
= verify_mroutes(
4482 data
["src_address"],
4488 assert result
is not True, (
4489 "Testcase {} : Failed \n "
4490 "Expected: [{}]: mroute (S, G) should not be present in mroute table \n "
4491 "Found: {}".format(tc_name
, data
["dut"], result
)
4494 write_test_footer(tc_name
)
4497 def test_PIM_passive_p1(request
):
4499 TC Verify PIM passive functionality"
4502 tgen
= get_topogen()
4503 tc_name
= request
.node
.name
4504 write_test_header(tc_name
)
4505 app_helper
.stop_all_hosts()
4506 # Creating configuration from JSON
4508 if tgen
.routers_have_failure():
4509 check_router_status(tgen
)
4510 reset_config_on_routers(tgen
)
4511 clear_pim_interface_traffic(tgen
, topo
)
4513 step("Enable the PIM on all the interfaces of FRR1, FRR2, FRR3")
4515 "Enable IGMP of FRR1 interface and send IGMP joins "
4516 " from FRR1 node for group range (225.1.1.1-5)"
4519 intf_c1_i4
= topo
["routers"]["c1"]["links"]["i4"]["interface"]
4522 "configure PIM passive on receiver interface to verify no impact on IGMP join"
4523 "and multicast traffic on pim passive interface"
4527 "c1": {"raw_config": ["interface {}".format(intf_c1_i4
), "ip pim passive"]}
4529 result
= apply_raw_config(tgen
, raw_config
)
4530 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4532 step("configure IGMPv2 and send IGMP joinon on PIM passive interface")
4534 "c1": {"igmp": {"interfaces": {intf_c1_i4
: {"igmp": {"version": "2"}}}}}
4536 result
= create_igmp_config(tgen
, topo
, input_dict
)
4537 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
4539 input_join
= {"i4": topo
["routers"]["i4"]["links"]["c1"]["interface"]}
4540 for recvr
, recvr_intf
in input_join
.items():
4541 result
= app_helper
.run_join(recvr
, IGMP_JOIN_RANGE_1
, join_intf
=recvr_intf
)
4542 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
4544 step("Configure static RP for (225.1.1.1-5) as R2")
4551 "rp_addr": topo
["routers"]["r2"]["links"]["lo"]["ipv4"].split(
4554 "group_addr_range": GROUP_RANGE_1
,
4561 result
= create_pim_config(tgen
, topo
, input_dict
)
4562 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4564 step("Send Mcast traffic from C2 to all the groups ( 225.1.1.1 to 225.1.1.5)")
4566 input_src
= {"i5": topo
["routers"]["i5"]["links"]["c2"]["interface"]}
4567 for src
, src_intf
in input_src
.items():
4568 result
= app_helper
.run_traffic(src
, IGMP_JOIN_RANGE_1
, bind_intf
=src_intf
)
4569 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4571 source_i5
= topo
["routers"]["i5"]["links"]["c2"]["ipv4"].split("/")[0]
4573 input_dict_starg
= [
4577 "iif": topo
["routers"]["c1"]["links"]["l1"]["interface"],
4578 "oil": topo
["routers"]["c1"]["links"]["i4"]["interface"],
4585 "src_address": source_i5
,
4586 "iif": topo
["routers"]["c1"]["links"]["c2"]["interface"],
4587 "oil": topo
["routers"]["c1"]["links"]["i4"]["interface"],
4591 step("(*,G) and (S,G) created on f1 and node verify using 'show ip mroute'")
4593 for data
in input_dict_sg
:
4594 result
= verify_mroutes(
4597 data
["src_address"],
4602 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4604 for data
in input_dict_sg
:
4605 result
= verify_mroutes(
4608 data
["src_address"],
4613 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4615 for data
in input_dict_starg
:
4616 result
= verify_mroutes(
4619 data
["src_address"],
4624 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4626 intf_c1_c2
= topo
["routers"]["c1"]["links"]["c2"]["interface"]
4627 intf_c2_c1
= topo
["routers"]["c2"]["links"]["c1"]["interface"]
4630 "configure PIM passive on upstream interface to verify"
4631 "hello tx/rx counts are not incremented"
4634 # Changing hello timer to 3sec for checking more number of packets
4639 "interface {}".format(intf_c1_c2
),
4644 "c2": {"raw_config": ["interface {}".format(intf_c2_c1
), "ip pim hello 3"]},
4646 result
= apply_raw_config(tgen
, raw_config
)
4647 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4649 step("verify PIM hello tx/rx stats on C1")
4652 intf_c1_c2
: ["helloTx", "helloRx"],
4656 logger
.info("waiting for 5 sec config to get apply and hello count update")
4659 c1_state_before
= verify_pim_interface_traffic(tgen
, state_dict
)
4661 c1_state_before
, dict
4662 ), "Testcase{} : Failed \n state_before is not dictionary \n " "Error: {}".format(
4667 "sleeping for 30 sec hello interval timer to verify count are not increamented"
4671 c1_state_after
= verify_pim_interface_traffic(tgen
, state_dict
)
4673 c1_state_after
, dict
4674 ), "Testcase{} : Failed \n state_before is not dictionary \n " "Error: {}".format(
4678 step("verify stats not increamented on c1")
4679 result
= verify_pim_stats_increament(c1_state_before
, c1_state_after
)
4682 ), "Testcase{} : Failed Error: {}" "stats incremented".format(tc_name
, result
)
4684 step("No impact observed on mroutes")
4685 for data
in input_dict_sg
:
4686 result
= verify_mroutes(
4689 data
["src_address"],
4694 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4696 for data
in input_dict_sg
:
4697 result
= verify_mroutes(
4700 data
["src_address"],
4705 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4707 for data
in input_dict_starg
:
4708 result
= verify_mroutes(
4711 data
["src_address"],
4716 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4718 step("remove PIM passive and verify hello tx/rx is increamented")
4722 "interface {}".format(intf_c1_c2
),
4723 "no ip pim passive",
4728 result
= apply_raw_config(tgen
, raw_config
)
4729 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
4731 logger
.info("waiting for 30 sec for pim hello to receive")
4734 c1_state_after
= verify_pim_interface_traffic(tgen
, state_dict
)
4736 c1_state_after
, dict
4737 ), "Testcase{} : Failed \n state_before is not dictionary \n " "Error: {}".format(
4741 step("verify stats increamented on c1 after removing pim passive")
4742 result
= verify_pim_stats_increament(c1_state_before
, c1_state_after
)
4743 assert result
is True, "Testcase{} : Failed Error: {}" "stats incremented".format(
4747 write_test_footer(tc_name
)
4750 if __name__
== "__main__":
4751 args
= ["-s"] + sys
.argv
[1:]
4752 sys
.exit(pytest
.main(args
))