4 # Copyright (c) 2019 by VMware, Inc. ("VMware")
5 # Used Copyright (c) 2018 by Network Device Education Foundation,
6 # Inc. ("NetDEF") in this file.
8 # Permission to use, copy, modify, and/or distribute this software
9 # for any purpose with or without fee is hereby granted, provided
10 # that the above copyright notice and this permission notice appear
13 # THE SOFTWARE IS PROVIDED "AS IS" AND VMWARE DISCLAIMS ALL WARRANTIES
14 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL VMWARE BE LIABLE FOR
16 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
17 # DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
18 # WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
19 # ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
24 Following tests are covered to test Multicast basic functionality:
31 r0-----r1-------------r3-----r5
37 - Create topology (setup module)
40 TC_1 : Verify upstream interfaces(IIF) and join state are updated properly
41 after adding and deleting the static RP
42 TC_2 : Verify IIF and OIL in "show ip pim state" updated properly after
43 adding and deleting the static RP
44 TC_3: (*, G) Mroute entry are cleared when static RP gets deleted
45 TC_4: Verify (*,G) prune is send towards the RP after deleting the static RP
46 TC_5: Verify OIF entry for RP is cleared when RP becomes unreachable
47 TC_6: Verify IIF and OIL in "show ip pim state" updated properly when RP
49 TC_7 : Verify upstream interfaces(IIF) and join state are updated properly
50 after adding and deleting the static RP
51 TC_8: Verify (*,G) prune is send towards the RP when RP becomes unreachable
52 TC_9 : Verify RP configured after IGMP join received, PIM join towards RP is
54 TC_10 : Verify RP becomes reachable after IGMP join received, PIM join
55 towards RP is sent immediately
56 TC_11 : Verify PIM join send towards the higher preferred RP
57 TC_12 : Verify PIM prune send towards the lower preferred RP
58 TC_13 : Verify RPF interface is updated in mroute (kernel) when higher
59 preferred overlapping RP configured
60 TC_14 : Verify IIF and OIL in "show ip pim state" updated properly when higher
61 preferred overlapping RP configured
62 TC_15 : Verify upstream interfaces(IIF) and join state are updated when higher
63 preferred overlapping RP is configured
64 TC_16 : Verify join is send to lower preferred RP, when higher preferred RP
66 TC_17 : Verify prune is send to higher preferred RP when higher preferred RP
68 TC_18 : Verify RPF interface updated in mroute when higher preferred RP gets
70 TC_19 : Verify IIF and OIL in "show ip pim state" updated when higher
71 preferred overlapping RP is deleted
72 TC_20 : Verify PIM upstream IIF updated when higher preferred overlapping RP
74 TC_21_1 : Verify OIF and RFP for (*,G) and (S,G) when static RP configure in
76 TC_21_2 : Verify OIF and RFP for (*,G) and (S,G) when static RP configure in
78 TC_22_1 : Verify OIF and RPF for (*,G) and (S,G) when static RP configure in
80 TC_22_2 : Verify OIF and RPF for (*,G) and (S,G) when static RP configure in
82 TC_23 : Verify (*,G) and (S,G) populated correctly when RPT and SPT path are
84 TC_24 : Verify (*,G) and (S,G) populated correctly when SPT and RPT share the
86 TC_25 : Verify (*,G) and (S,G) populated correctly after clearing the PIM ,
87 IGMP and mroutes joins
88 TC_26 : Restart the PIMd process and verify PIM joins , and mroutes entries
89 TC_27 : Configure multiple groups (10 grps) with same RP address
90 TC_28 : Configure multiple groups (10 grps) with different RP address
91 TC_29 : Verify IIF and OIL in updated in mroute when upstream interface
93 TC_30 : Verify IIF and OIL change to other path after shut the primary path
94 TC_31 : Verify RP info and (*,G) mroute after deleting the RP and shut / no
95 shut the RPF interface.
96 TC_32 : Verify RP info and (*,G) mroute after deleting the RP and shut / no
97 shut the RPF interface
103 from time
import sleep
107 # Save the Current Working Directory to find configuration files.
108 CWD
= os
.path
.dirname(os
.path
.realpath(__file__
))
109 sys
.path
.append(os
.path
.join(CWD
, "../"))
110 sys
.path
.append(os
.path
.join(CWD
, "../lib/"))
112 # Required to instantiate the topology builder class.
114 # pylint: disable=C0413
115 # Import topogen and topotest helpers
117 from lib
.topogen
import Topogen
, get_topogen
118 from lib
.topolog
import logger
119 from lib
.topojson
import build_topo_from_json
, build_config_from_json
121 from lib
.common_config
import (
125 reset_config_on_routers
,
127 shutdown_bringup_interface
,
129 start_router_daemons
,
130 create_static_routes
,
133 from lib
.pim
import (
137 verify_join_state_and_timer
,
139 verify_pim_neighbors
,
140 get_pim_interface_traffic
,
143 clear_ip_pim_interface_traffic
,
144 clear_ip_igmp_interfaces
,
145 clear_ip_pim_interfaces
,
147 clear_ip_mroute_verify
,
151 pytestmark
= [pytest
.mark
.pimd
, pytest
.mark
.staticd
]
155 GROUP_RANGE_ALL
= "224.0.0.0/4"
156 GROUP_RANGE
= "225.1.1.1/32"
157 GROUP_RANGE_LIST_1
= [
164 GROUP_RANGE_LIST_2
= [
171 GROUP_ADDRESS
= "225.1.1.1"
172 GROUP_ADDRESS_LIST_1
= ["225.1.1.1", "225.1.1.2", "225.1.1.3", "225.1.1.4", "225.1.1.5"]
173 GROUP_ADDRESS_LIST_2
= [
181 SOURCE_ADDRESS
= "10.0.6.2"
185 def build_topo(tgen
):
188 # Building topology from json file
189 build_topo_from_json(tgen
, TOPO
)
192 def setup_module(mod
):
194 Sets up the pytest environment
199 testsuite_run_time
= time
.asctime(time
.localtime(time
.time()))
200 logger
.info("Testsuite start time: %s", testsuite_run_time
)
201 logger
.info("=" * 40)
208 r0-----r1-------------r3-----r5
214 logger
.info("Master Topology: \n %s", topology
)
216 logger
.info("Running setup_module to create topology")
218 # This function initiates the topology build with Topogen...
219 json_file
= "{}/multicast_pim_static_rp.json".format(CWD
)
220 tgen
= Topogen(json_file
, mod
.__name
__)
222 TOPO
= tgen
.json_topo
224 # ... and here it calls Mininet initialization functions.
226 # get list of daemons needs to be started for this suite.
227 daemons
= topo_daemons(tgen
, TOPO
)
229 # Starting topology, create tmp files which are loaded to routers
230 # to start daemons and then start routers
231 start_topology(tgen
, daemons
)
233 # Don"t run this test if we have any failure.
234 if tgen
.routers_have_failure():
235 pytest
.skip(tgen
.errors
)
237 # Creating configuration from JSON
238 build_config_from_json(tgen
, TOPO
)
240 # Verify PIM neighbors
241 result
= verify_pim_neighbors(tgen
, TOPO
)
242 assert result
is True, "setup_module :Failed \n Error:" " {}".format(result
)
244 # XXX Replace this using "with McastTesterHelper()... " in each test if possible.
246 app_helper
= McastTesterHelper(tgen
)
248 logger
.info("Running setup_module() done")
251 def teardown_module():
252 """Teardown the pytest environment"""
254 logger
.info("Running teardown_module to delete topology")
260 # Stop toplogy and Remove tmp files
263 logger
.info("Testsuite end time: %s", time
.asctime(time
.localtime(time
.time())))
264 logger
.info("=" * 40)
267 #####################################################
271 #####################################################
274 def verify_mroute_repopulated(uptime_before
, uptime_after
):
276 API to compare uptime for mroutes
280 * `uptime_before` : Uptime dictionary for any particular instance
281 * `uptime_after` : Uptime dictionary for any particular instance
284 for group
in uptime_before
.keys():
285 for source
in uptime_before
[group
].keys():
286 if set(uptime_before
[group
]) != set(uptime_after
[group
]):
288 "mroute (%s, %s) has not come"
289 " up after mroute clear [FAILED!!]" % (source
, group
)
293 d_1
= datetime
.datetime
.strptime(uptime_before
[group
][source
], "%H:%M:%S")
294 d_2
= datetime
.datetime
.strptime(uptime_after
[group
][source
], "%H:%M:%S")
296 errormsg
= "mroute (%s, %s) is not " "repopulated [FAILED!!]" % (
302 logger
.info("mroute (%s, %s) is " "repopulated [PASSED!!]", source
, group
)
307 def verify_state_incremented(state_before
, state_after
):
309 API to compare interface traffic state incrementing
313 * `state_before` : State dictionary for any particular instance
314 * `state_after` : State dictionary for any particular instance
317 for router
, state_data
in state_before
.items():
318 for state
, _
in state_data
.items():
319 if state_before
[router
][state
] >= state_after
[router
][state
]:
321 "[DUT: %s]: state %s value has not"
322 " incremented, Initial value: %s, "
323 "Current value: %s [FAILED!!]"
327 state_before
[router
][state
],
328 state_after
[router
][state
],
334 "[DUT: %s]: State %s value is "
335 "incremented, Initial value: %s, Current value: %s"
339 state_before
[router
][state
],
340 state_after
[router
][state
],
346 def test_add_delete_static_RP_p0(request
):
348 TC_1_P0 : Verify upstream interfaces(IIF) and join state are updated
349 properly after adding and deleting the static RP
350 TC_2_P0 : Verify IIF and OIL in "show ip pim state" updated properly
351 after adding and deleting the static RP
352 TC_3_P0: (*, G) Mroute entry are cleared when static RP gets deleted
353 TC_4_P0: Verify (*,G) prune is send towards the RP after deleting the
362 tc_name
= request
.node
.name
363 write_test_header(tc_name
)
365 # Don"t run this test if we have any failure.
366 if tgen
.routers_have_failure():
367 pytest
.skip(tgen
.errors
)
369 step("pre-configuration to send IGMP join and multicast traffic")
371 step("Enable IGMP on r1 interface and send IGMP " "join (225.1.1.1) to r1")
372 step("Configure r2 loopback interface as RP")
373 step("Enable PIM between r1 and r3")
375 step("r1: Verify show ip igmp group without any IGMP join")
377 interface
= "r1-r0-eth0"
378 result
= verify_igmp_groups(tgen
, dut
, interface
, GROUP_ADDRESS
, expected
=False)
379 assert result
is not True, (
380 "Testcase {} : Failed \n "
381 "r1: igmp group present without any IGMP join \n Error: {}".format(
386 step("r1: Verify show ip pim interface traffic without any IGMP join")
387 state_dict
= {"r1": {"r1-r2-eth1": ["pruneTx"]}}
389 state_before
= get_pim_interface_traffic(tgen
, state_dict
)
392 ), "Testcase {} : Failed \n state_before is not dictionary\n Error: {}".format(
396 step("r0 : Send IGMP join")
397 result
= app_helper
.run_join("r0", GROUP_ADDRESS
, "r1")
398 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
400 step("r1: Verify IGMP groups")
402 result
= verify_igmp_groups(tgen
, dut
, oif
, GROUP_ADDRESS
)
403 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
405 step("r1: Verify RP info")
408 rp_address
= "1.0.2.17"
409 result
= verify_pim_rp_info(
410 tgen
, TOPO
, dut
, GROUP_RANGE_ALL
, iif
, rp_address
, SOURCE
412 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
414 step("r1: Verify upstream IIF interface")
415 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
)
416 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
418 step("r1: Verify upstream join state and join timer")
419 result
= verify_join_state_and_timer(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
)
420 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
421 step("r1: Verify ip mroutes")
422 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
)
423 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
425 step("r1: Verify ip pim join")
426 result
= verify_join_state_and_timer(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
)
427 step("r1: Delete RP configuration")
429 # Delete RP configuration
435 "rp_addr": "1.0.2.17",
436 "group_addr_range": GROUP_RANGE_ALL
,
444 result
= create_pim_config(tgen
, TOPO
, input_dict
)
445 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
447 step("r1: Verify RP info")
448 result
= verify_pim_rp_info(
449 tgen
, TOPO
, dut
, GROUP_RANGE_ALL
, iif
, rp_address
, SOURCE
, expected
=False
453 ), "Testcase {} : Failed \n " "r1: RP info present \n Error: {}".format(
457 step("r1: Verify upstream IIF interface")
458 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
, expected
=False)
459 assert result
is not True, (
460 "Testcase {} : Failed \n "
461 "r1: upstream IIF interface present \n Error: {}".format(tc_name
, result
)
464 step("r1: Verify upstream join state and join timer")
465 result
= verify_join_state_and_timer(
466 tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
, expected
=False
468 assert result
is not True, (
469 "Testcase {} : Failed \n "
470 "r1: upstream join state is up and join timer is running \n Error: {}".format(
476 step("r1: Verify PIM state")
477 result
= verify_pim_state(tgen
, dut
, iif
, oif
, GROUP_ADDRESS
, expected
=False)
478 assert result
is not True, "Testcase {} :Failed \n Error: {}".format(
482 step("r1: Verify ip mroutes")
483 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
, expected
=False)
486 ), "Testcase {} : Failed \n " "r1: mroutes are still present \n Error: {}".format(
490 step("r1: Verify show ip pim interface traffic without any IGMP join")
491 state_after
= get_pim_interface_traffic(tgen
, state_dict
)
494 ), "Testcase {} : Failed \n state_before is not dictionary \n Error: {}".format(
498 result
= verify_state_incremented(state_before
, state_after
)
499 assert result
is True, "Testcase{} : Failed Error: {}".format(tc_name
, result
)
501 # Uncomment next line for debugging
504 write_test_footer(tc_name
)
507 def test_SPT_RPT_path_same_p1(request
):
509 TC_24_P1 : Verify (*,G) and (S,G) populated correctly when SPT and RPT
524 tc_name
= request
.node
.name
525 write_test_header(tc_name
)
527 # Don"t run this test if we have any failure.
528 if tgen
.routers_have_failure():
529 pytest
.skip(tgen
.errors
)
531 step("Creating configuration from JSON")
532 reset_config_on_routers(tgen
)
533 app_helper
.stop_all_hosts()
534 clear_ip_mroute(tgen
)
535 clear_ip_pim_interface_traffic(tgen
, TOPO
)
539 shutdown_bringup_interface(tgen
, dut
, intf
, False)
541 shutdown_bringup_interface(tgen
, dut
, intf
, False)
545 shutdown_bringup_interface(tgen
, dut
, intf
, False)
547 shutdown_bringup_interface(tgen
, dut
, intf
, False)
549 step("Enable IGMP on r1 interface and send IGMP join (225.1.1.1) to R1")
550 step("Configure RP on r2 (loopback interface) for the group range" " 224.0.0.0/4")
551 step("Enable the PIM on all the interfaces of r1, r2, r3 and r4 routers")
552 step("Send multicast traffic from R3")
554 step("r2: Verify RP info")
556 rp_address
= "1.0.2.17"
558 result
= verify_pim_rp_info(
559 tgen
, TOPO
, dut
, GROUP_RANGE_ALL
, iif
, rp_address
, SOURCE
561 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
563 step("r0: Send IGMP join")
564 result
= app_helper
.run_join("r0", GROUP_ADDRESS
, "r1")
565 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
567 step("r1: Verify IGMP groups")
570 result
= verify_igmp_groups(tgen
, dut
, oif
, GROUP_ADDRESS
)
571 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
573 step("r5: Send multicast traffic for group 225.1.1.1")
574 result
= app_helper
.run_traffic("r5", GROUP_ADDRESS
, "r3")
575 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
577 step("r1: Verify (*, G) upstream IIF interface")
580 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
)
581 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
583 step("r1: Verify (*, G) upstream join state and join timer")
584 result
= verify_join_state_and_timer(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
)
585 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
587 step("r1: Verify (*, G) ip mroutes")
588 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
)
589 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
591 step("r1: Verify (S, G) upstream IIF interface")
593 result
= verify_upstream_iif(tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS
)
594 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
596 step("r1: Verify (S, G) upstream join state and join timer")
597 result
= verify_join_state_and_timer(tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS
)
598 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
600 step("r1: Verify (S, G) ip mroutes")
601 result
= verify_ip_mroutes(tgen
, dut
, SOURCE_ADDRESS
, GROUP_ADDRESS
, iif
, oif
)
602 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
604 step("r2: Verify (*, G) upstream IIF interface")
607 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
)
608 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
610 step("r2: Verify (*, G) upstream join state and join timer")
611 result
= verify_join_state_and_timer(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
)
612 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
614 step("r2: Verify (*, G) ip mroutes")
616 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
)
617 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
619 step("r2: Verify (S, G) upstream IIF interface")
621 result
= verify_upstream_iif(tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS
)
622 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
624 step("r2: Verify (S, G) upstream join state and join timer")
625 result
= verify_join_state_and_timer(tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS
)
626 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
628 step("r2: Verify (S, G) ip mroutes")
629 result
= verify_ip_mroutes(tgen
, dut
, SOURCE_ADDRESS
, GROUP_ADDRESS
, iif
, oif
)
630 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
632 step("r3: Verify (S, G) upstream IIF interface")
635 result
= verify_upstream_iif(tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS
)
636 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
638 step("r3: Verify (S, G) upstream join state and join timer")
639 result
= verify_join_state_and_timer(
640 tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS
, expected
=False
642 assert result
is not True, (
643 "Testcase {} : Failed \n "
644 "r3: (S, G) upstream join state is up and join timer is running\n Error: {}".format(
649 step("r3: Verify (S, G) ip mroutes")
651 result
= verify_ip_mroutes(tgen
, dut
, SOURCE_ADDRESS
, GROUP_ADDRESS
, iif
, oif
)
652 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
654 # Uncomment next line for debugging
657 write_test_footer(tc_name
)
660 def test_not_reachable_static_RP_p0(request
):
662 TC_5_P0: Verify OIF entry for RP is cleared when RP becomes unreachable
663 TC_6_P0: Verify IIF and OIL in "show ip pim state" updated properly when
664 RP becomes unreachable
665 TC_7_P0 : Verify upstream interfaces(IIF) and join state are updated
666 properly after adding and deleting the static RP
667 TC_8_P0: Verify (*,G) prune is send towards the RP when RP becomes
676 tc_name
= request
.node
.name
677 write_test_header(tc_name
)
679 # Don"t run this test if we have any failure.
680 if tgen
.routers_have_failure():
681 pytest
.skip(tgen
.errors
)
683 step("Creating configuration from JSON")
684 reset_config_on_routers(tgen
)
685 app_helper
.stop_all_hosts()
686 clear_ip_mroute(tgen
)
687 clear_ip_pim_interface_traffic(tgen
, TOPO
)
691 shutdown_bringup_interface(tgen
, dut
, intf
, False)
695 shutdown_bringup_interface(tgen
, dut
, intf
, False)
698 "r1: (*,G) prune is not sent towards the RP interface, verify using"
699 "show ip pim interface traffic"
701 state_dict
= {"r1": {"r1-r2-eth1": ["pruneTx"]}}
702 state_before
= get_pim_interface_traffic(tgen
, state_dict
)
705 ), "Testcase{} : Failed \n state_before is not dictionary \n " "Error: {}".format(
706 tc_name
, state_before
709 step("Enable IGMP on r1 interface and send IGMP " "join (225.1.1.1) to r1")
710 step("Configure r2 loopback interface as RP")
711 step("Enable PIM between r1 and r2")
713 step("r0 : Send IGMP join")
714 result
= app_helper
.run_join("r0", GROUP_ADDRESS
, "r1")
715 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
717 step("r1 : Verify rp info")
720 rp_address
= "1.0.2.17"
721 result
= verify_pim_rp_info(
722 tgen
, TOPO
, dut
, GROUP_RANGE_ALL
, iif
, rp_address
, SOURCE
724 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
726 step("r1: Verify IGMP groups")
728 result
= verify_igmp_groups(tgen
, dut
, oif
, GROUP_ADDRESS
)
729 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
731 step("r1: Verify PIM state")
732 result
= verify_pim_state(tgen
, dut
, iif
, oif
, GROUP_ADDRESS
)
733 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
735 step("r1: Verify upstream IIF interface")
736 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
)
737 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
739 step("r1: Verify upstream join state and join timer")
740 result
= verify_join_state_and_timer(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
)
741 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
743 step("r1 :Verify ip mroutes")
744 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
)
745 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
747 step("r1: Make RP un-reachable")
752 {"network": "1.0.2.17/32", "next_hop": "10.0.1.2", "delete": True}
757 result
= create_static_routes(tgen
, input_dict
)
758 assert result
is True, "Testcase {} : Failed \n Error: {}".format(tc_name
, result
)
760 step("r1: Check RP detail using show ip pim rp-info OIF should be unknown")
761 result
= verify_pim_rp_info(
762 tgen
, TOPO
, dut
, GROUP_RANGE_ALL
, "Unknown", rp_address
, SOURCE
764 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
767 "r1 : OIL should be same and IIF should be cleared on R1 verify"
768 "using show ip pim state"
770 result
= verify_pim_state(tgen
, dut
, iif
, oif
, GROUP_ADDRESS
, expected
=False)
771 assert result
is not True, (
772 "Testcase {} : Failed \n "
773 "OIL is not same and IIF is not cleared on R1 \n Error: {}".format(
778 step("r1: upstream IIF should be unknown , verify using show ip pim" "upstream")
779 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
, expected
=False)
780 assert result
is not True, (
781 "Testcase {} : Failed \n "
782 "r1: upstream IIF is not unknown \n Error: {}".format(tc_name
, result
)
786 "r1: join state should not be joined and join timer should stop,"
787 "verify using show ip pim upstream"
789 result
= verify_join_state_and_timer(
790 tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
, expected
=False
792 assert result
is not True, (
793 "Testcase {} : Failed \n "
794 "r1: join state is joined and timer is not stopped \n Error: {}".format(
800 "r1: (*,G) prune is sent towards the RP interface, verify using"
801 "show ip pim interface traffic"
803 state_after
= get_pim_interface_traffic(tgen
, state_dict
)
806 ), "Testcase{} : Failed \n state_before is not dictionary \n " "Error: {}".format(
810 result
= verify_state_incremented(state_before
, state_after
)
811 assert result
is True, "Testcase{} : Failed Error: {}".format(tc_name
, result
)
813 step("r1: (*, G) cleared from mroute table using show ip mroute")
814 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
, expected
=False)
815 assert result
is not True, (
816 "Testcase {} : Failed \n "
817 "r1: (*, G) are not cleared from mroute table \n Error: {}".format(
821 logger
.info("Expected behavior: %s", result
)
823 # Uncomment next line for debugging
826 write_test_footer(tc_name
)
829 def test_add_RP_after_join_received_p1(request
):
831 TC_9_P1 : Verify RP configured after IGMP join received, PIM join towards
832 RP is sent immediately
840 tc_name
= request
.node
.name
841 write_test_header(tc_name
)
843 # Don"t run this test if we have any failure.
844 if tgen
.routers_have_failure():
845 pytest
.skip(tgen
.errors
)
847 step("Creating configuration from JSON")
848 reset_config_on_routers(tgen
)
849 app_helper
.stop_all_hosts()
850 clear_ip_mroute(tgen
)
851 clear_ip_pim_interface_traffic(tgen
, TOPO
)
853 step("Enable IGMP on R1 interface")
854 step("Configure r2 loopback interface as RP")
855 step("Enable PIM between r1 and r2")
856 step("Delete RP configuration from r1")
858 step("r1: Delete RP configuration")
864 "rp_addr": "1.0.2.17",
865 "group_addr_range": GROUP_RANGE_ALL
,
873 result
= create_pim_config(tgen
, TOPO
, input_dict
)
874 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
876 step("r1: Verify rp-info")
878 rp_address
= "1.0.2.17"
880 result
= verify_pim_rp_info(
881 tgen
, TOPO
, dut
, GROUP_RANGE_ALL
, iif
, rp_address
, SOURCE
, expected
=False
885 ), "Testcase {} : Failed \n " "r1: rp-info is present \n Error: {}".format(
889 step("joinTx value before join sent")
890 state_dict
= {"r1": {"r1-r2-eth1": ["joinTx"]}}
891 state_before
= get_pim_interface_traffic(tgen
, state_dict
)
894 ), "Testcase{} : Failed \n state_before is not dictionary \n " "Error: {}".format(
898 step("r0 : Send IGMP join (225.1.1.1) to r1, when rp is not configured" "in r1")
899 result
= app_helper
.run_join("r0", GROUP_ADDRESS
, "r1")
900 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
902 step("r1: IGMP group is received on R1 verify using show ip igmp groups")
904 result
= verify_igmp_groups(tgen
, dut
, oif
, GROUP_ADDRESS
)
905 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
907 step("r1: Verify upstream IIF interface")
908 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
, expected
=False)
909 assert result
is not True, (
910 "Testcase {} : Failed \n "
911 "r1: upstream IFF interface is present \n Error: {}".format(tc_name
, result
)
914 step("r1: Verify upstream join state and join timer")
916 result
= verify_join_state_and_timer(
917 tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
, expected
=False
919 assert result
is not True, (
920 "Testcase {} : Failed \n "
921 "r1: upstream join state is joined and timer is running \n Error: {}".format(
926 step("r1: Verify PIM state")
927 result
= verify_pim_state(tgen
, dut
, iif
, oif
, GROUP_ADDRESS
, expected
=False)
930 ), "Testcase {} : Failed \n " "r1: PIM state is up\n Error: {}".format(
934 step("r1: Verify ip mroutes")
935 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
, expected
=False)
938 ), "Testcase {} : Failed \n " "r1: mroutes are still present\n Error: {}".format(
942 step("r1: Configure static RP")
948 "rp_addr": "1.0.2.17",
949 "group_addr_range": GROUP_RANGE_ALL
,
956 result
= create_pim_config(tgen
, TOPO
, input_dict
)
957 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
959 step("r1: Verify rp-info")
960 result
= verify_pim_rp_info(
961 tgen
, TOPO
, dut
, GROUP_RANGE_ALL
, iif
, rp_address
, SOURCE
963 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
965 step("r1: Verify upstream IIF interface")
966 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
)
967 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
969 step("r1 : Verify upstream join state and join timer")
970 result
= verify_join_state_and_timer(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
)
971 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
973 step("r1: Verify PIM state")
974 result
= verify_pim_state(tgen
, dut
, iif
, oif
, GROUP_ADDRESS
)
975 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
977 step("r1 : Verify ip mroutes")
978 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
)
979 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
980 logger
.info("Expected behavior: %s", result
)
982 state_after
= get_pim_interface_traffic(tgen
, state_dict
)
985 ), "Testcase{} : Failed \n state_before is not dictionary \n " "Error: {}".format(
989 result
= verify_state_incremented(state_before
, state_after
)
990 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
992 # Uncomment next line for debugging
995 write_test_footer(tc_name
)
998 def test_reachable_static_RP_after_join_p0(request
):
1000 TC_10_P0 : Verify RP becomes reachable after IGMP join received, PIM join
1001 towards RP is sent immediately
1007 tgen
= get_topogen()
1008 tc_name
= request
.node
.name
1009 write_test_header(tc_name
)
1011 # Don"t run this test if we have any failure.
1012 if tgen
.routers_have_failure():
1013 pytest
.skip(tgen
.errors
)
1015 step("Creating configuration from JSON")
1016 reset_config_on_routers(tgen
)
1017 app_helper
.stop_all_hosts()
1018 clear_ip_mroute(tgen
)
1019 clear_ip_pim_interface_traffic(tgen
, TOPO
)
1021 step("Enable IGMP on r1 interface and send IGMP " "join (225.1.1.1) to r1")
1022 step("Configure r2 loopback interface as RP")
1023 step("Enable PIM between r1 and r2")
1025 step("r1 : Verify pim interface traffic")
1026 state_dict
= {"r1": {"r1-r2-eth1": ["joinTx"]}}
1027 state_before
= get_pim_interface_traffic(tgen
, state_dict
)
1030 ), "Testcase{} : Failed \n state_before is not dictionary \n " "Error: {}".format(
1031 tc_name
, state_before
1034 step("r1: Make RP un-reachable")
1037 shutdown_bringup_interface(tgen
, dut
, intf
, False)
1039 shutdown_bringup_interface(tgen
, dut
, intf
, False)
1041 shutdown_bringup_interface(tgen
, dut
, intf
, False)
1043 step("r1: Verify rp-info")
1044 rp_address
= "1.0.2.17"
1045 result
= verify_pim_rp_info(
1046 tgen
, TOPO
, dut
, GROUP_ADDRESS
, "Unknown", rp_address
, SOURCE
1048 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1050 step("r1 : Send IGMP join for 225.1.1.1")
1051 result
= app_helper
.run_join("r0", GROUP_ADDRESS
, "r1")
1052 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1054 step("r1 : Verify IGMP groups")
1056 result
= verify_igmp_groups(tgen
, dut
, oif
, GROUP_ADDRESS
)
1057 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1059 step("r1 : Verify upstream IIF interface")
1061 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
, expected
=False)
1062 assert result
is not True, (
1063 "Testcase {} : Failed \n "
1064 "r1: upstream IIF interface is present\n Error: {}".format(tc_name
, result
)
1067 step("r1 : Verify upstream join state and join timer")
1068 result
= verify_join_state_and_timer(
1069 tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
, expected
=False
1071 assert result
is not True, (
1072 "Testcase {} : Failed \n "
1073 "r1: upstream join state is joined and timer is running\n Error: {}".format(
1078 step("r1 : Verify PIM state")
1079 result
= verify_pim_state(tgen
, dut
, iif
, oif
, GROUP_ADDRESS
, expected
=False)
1082 ), "Testcase {} : Failed \n " "r1: PIM state is up\n Error: {}".format(
1086 step("r1 : Verify ip mroutes")
1087 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
, expected
=False)
1090 ), "Testcase {} : Failed \n " "r1: mroutes are still present\n Error: {}".format(
1094 step("r1: Make RP reachable")
1096 shutdown_bringup_interface(tgen
, dut
, intf
, True)
1098 shutdown_bringup_interface(tgen
, dut
, intf
, True)
1100 shutdown_bringup_interface(tgen
, dut
, intf
, True)
1102 step("r1 : Verify rp-info")
1103 result
= verify_pim_rp_info(
1104 tgen
, TOPO
, dut
, GROUP_RANGE_ALL
, iif
, rp_address
, SOURCE
1106 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1108 step("r1: Verify upstream IIF interface")
1109 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
)
1110 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1112 step("r1 : Verify upstream join state and join timer")
1113 result
= verify_join_state_and_timer(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
)
1114 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1116 step("r1 : Verify PIM state")
1117 result
= verify_pim_state(tgen
, dut
, iif
, oif
, GROUP_ADDRESS
)
1118 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1120 step("r1 : Verify ip mroutes")
1121 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
)
1122 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1123 logger
.info("Expected behavior: %s", result
)
1125 step("r1 : Verify pim interface traffic")
1126 state_after
= get_pim_interface_traffic(tgen
, state_dict
)
1129 ), "Testcase{} : Failed \n state_before is not dictionary \n " "Error: {}".format(
1133 result
= verify_state_incremented(state_before
, state_after
)
1134 assert result
is True, "Testcase{} : Failed Error: {}".format(tc_name
, result
)
1136 # Uncomment next line for debugging
1137 # tgen.mininet_cli()
1139 write_test_footer(tc_name
)
1142 def test_send_join_on_higher_preffered_rp_p1(request
):
1144 TC_11_P1 : Verify PIM join send towards the higher preferred RP
1145 TC_12_P1 : Verify PIM prune send towards the lower preferred RP
1146 TC_13_P1 : Verify RPF interface is updated in mroute (kernel) when higher
1147 preferred overlapping RP configured
1148 TC_14_P1 : Verify IIF and OIL in "show ip pim state" updated properly when
1149 higher preferred overlapping RP configured
1150 TC_15_P1 : Verify upstream interfaces(IIF) and join state are updated when
1151 higher preferred overlapping RP is configured
1152 TC_16_P1 : Verify join is send to lower preferred RP, when higher
1153 preferred RP gets deleted
1154 TC_17_P1 : Verify prune is send to higher preferred RP when higher
1155 preferred RP gets deleted
1156 TC_18_P1 : Verify RPF interface updated in mroute when higher preferred RP
1158 TC_19_P1 : Verify IIF and OIL in "show ip pim state" updated when higher
1159 preferred overlapping RP is deleted
1160 TC_20_P1 : Verify PIM upstream IIF updated when higher preferred
1161 overlapping RP deleted
1172 tgen
= get_topogen()
1173 tc_name
= request
.node
.name
1174 write_test_header(tc_name
)
1176 # Don"t run this test if we have any failure.
1177 if tgen
.routers_have_failure():
1178 pytest
.skip(tgen
.errors
)
1180 step("Creating configuration from JSON")
1181 reset_config_on_routers(tgen
)
1182 app_helper
.stop_all_hosts()
1183 clear_ip_mroute(tgen
)
1184 clear_ip_pim_interface_traffic(tgen
, TOPO
)
1186 step("Enable IGMP on r1 interface")
1187 step("Configure RP on r2 (loopback interface) for the group range " "224.0.0.0/4")
1188 step("Configure RP on r4 (loopback interface) for the group range " "225.1.1.1/32")
1190 step("r3 : Make all interface not reachable")
1193 shutdown_bringup_interface(tgen
, dut
, intf
, False)
1195 shutdown_bringup_interface(tgen
, dut
, intf
, False)
1197 shutdown_bringup_interface(tgen
, dut
, intf
, False)
1201 shutdown_bringup_interface(tgen
, dut
, intf
, False)
1205 shutdown_bringup_interface(tgen
, dut
, intf
, False)
1209 shutdown_bringup_interface(tgen
, dut
, intf
, False)
1211 step("r1 : Verify joinTx count before sending join")
1212 state_dict
= {"r1": {"r1-r4-eth3": ["joinTx"], "r1-r2-eth1": ["pruneTx"]}}
1214 state_before
= get_pim_interface_traffic(tgen
, state_dict
)
1217 ), "Testcase{} : Failed \n state_before is not dictionary \n " "Error: {}".format(
1218 tc_name
, state_before
1221 step("r0 : Send IGMP join for 225.1.1.1")
1222 result
= app_helper
.run_join("r0", GROUP_ADDRESS
, "r1")
1223 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1225 step("r1 : Verify IGMP groups")
1228 result
= verify_igmp_groups(tgen
, dut
, oif
, GROUP_ADDRESS
)
1229 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1231 step("Configure static RP for group 225.1.1.1/32")
1237 "rp_addr": "1.0.4.17",
1238 "group_addr_range": ["225.1.1.1/32"],
1245 result
= create_pim_config(tgen
, TOPO
, input_dict
)
1246 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1248 step("r1 : Verify RP info for group 224.0.0.0/4")
1249 rp_address_1
= "1.0.2.17"
1251 result
= verify_pim_rp_info(
1252 tgen
, TOPO
, dut
, GROUP_RANGE_ALL
, iif
, rp_address_1
, SOURCE
1254 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1256 step("r1 : Verify RP info for group 225.1.1.1")
1257 rp_address_2
= "1.0.4.17"
1259 result
= verify_pim_rp_info(tgen
, TOPO
, dut
, GROUP_RANGE
, iif
, rp_address_2
, SOURCE
)
1260 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1262 step("r1 : Verify join is sent to higher preferred RP")
1263 step("r1 : Verify prune is sent to lower preferred RP")
1264 state_after
= get_pim_interface_traffic(tgen
, state_dict
)
1267 ), "Testcase{} : Failed \n state_before is not dictionary \n " "Error: {}".format(
1271 result
= verify_state_incremented(state_before
, state_after
)
1272 assert result
is True, "Testcase{} : Failed Error: {}".format(tc_name
, result
)
1274 step("r1 : Verify ip mroutes")
1276 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
)
1277 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1279 step("r1 : Verify PIM state")
1280 result
= verify_pim_state(tgen
, dut
, iif
, oif
, GROUP_ADDRESS
)
1281 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1283 step("r1 : Verify upstream IIF interface")
1284 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
)
1285 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1287 step("r1 : Verify upstream join state and join timer")
1288 result
= verify_join_state_and_timer(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
)
1289 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1291 clear_ip_pim_interface_traffic(tgen
, TOPO
)
1293 step("r1 : Verify joinTx, pruneTx count before RP gets deleted")
1294 state_dict
= {"r1": {"r1-r2-eth1": ["joinTx"], "r1-r4-eth3": ["pruneTx"]}}
1296 state_before
= get_pim_interface_traffic(tgen
, state_dict
)
1299 ), "Testcase{} : Failed \n state_before is not dictionary \n " "Error: {}".format(
1303 step("r1 : Delete RP configuration for 225.1.1.1")
1309 "rp_addr": "1.0.4.17",
1310 "group_addr_range": ["225.1.1.1/32"],
1318 result
= create_pim_config(tgen
, TOPO
, input_dict
)
1319 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1321 step("r1 : Verify rp-info for group 224.0.0.0/4")
1323 result
= verify_pim_rp_info(
1324 tgen
, TOPO
, dut
, GROUP_RANGE_ALL
, iif
, rp_address_1
, SOURCE
1326 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1328 step("r1 : Verify rp-info for group 225.1.1.1")
1330 result
= verify_pim_rp_info(
1331 tgen
, TOPO
, dut
, GROUP_RANGE
, oif
, rp_address_2
, SOURCE
, expected
=False
1333 assert result
is not True, (
1334 "Testcase {} : Failed \n "
1335 "r1: rp-info is present for group 225.1.1.1 \n Error: {}".format(
1341 "r1 : Verify RPF interface updated in mroute when higher preferred"
1345 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
)
1346 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1347 logger
.info("Expected behavior: %s", result
)
1350 "r1 : Verify IIF and OIL in show ip pim state updated when higher"
1351 "preferred overlapping RP is deleted"
1353 result
= verify_pim_state(tgen
, dut
, iif
, oif
, GROUP_ADDRESS
)
1354 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1357 "r1 : Verify upstream IIF updated when higher preferred overlapping"
1360 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
)
1361 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1364 "r1 : Verify upstream join state and join timer updated when higher"
1365 "preferred overlapping RP deleted"
1367 result
= verify_join_state_and_timer(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
)
1368 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1371 "r1 : Verify join is sent to lower preferred RP, when higher"
1372 "preferred RP gets deleted"
1375 "r1 : Verify prune is sent to higher preferred RP when higher"
1376 " preferred RP gets deleted"
1378 state_after
= get_pim_interface_traffic(tgen
, state_dict
)
1381 ), "Testcase{} : Failed \n state_before is not dictionary \n " "Error: {}".format(
1385 result
= verify_state_incremented(state_before
, state_after
)
1386 assert result
is True, "Testcase{} : Failed Error: {}".format(tc_name
, result
)
1388 # Uncomment next line for debugging
1389 # tgen.mininet_cli()
1391 write_test_footer(tc_name
)
1394 def test_RP_configured_as_LHR_1_p1(request
):
1396 TC_21_1_P1: Verify OIF and RPF for (*,G) and (S,G) when static RP configure
1403 r0-----r1-------------r3-----r5
1409 tgen
= get_topogen()
1410 tc_name
= request
.node
.name
1411 write_test_header(tc_name
)
1413 # Don"t run this test if we have any failure.
1414 if tgen
.routers_have_failure():
1415 pytest
.skip(tgen
.errors
)
1417 step("Creating configuration from JSON")
1418 reset_config_on_routers(tgen
)
1419 app_helper
.stop_all_hosts()
1420 clear_ip_mroute(tgen
)
1421 clear_ip_pim_interface_traffic(tgen
, TOPO
)
1423 step("Enable IGMP on r1 interface")
1424 step("Configure RP on r1 (loopback interface) for the group range" " 224.0.0.0/4")
1425 step("Enable the PIM on all the interfaces of r1, r2, r3 and r4 routers")
1426 step("Send the IGMP join from r0")
1427 step("Send multicast traffic from r5")
1429 step("r1 , r2, r3, r4: Delete existing RP configuration" "configure r1(LHR) as RP")
1435 "rp_addr": "1.0.2.17",
1436 "group_addr_range": GROUP_RANGE_ALL
,
1446 "rp_addr": "1.0.2.17",
1447 "group_addr_range": GROUP_RANGE_ALL
,
1457 "rp_addr": "1.0.2.17",
1458 "group_addr_range": GROUP_RANGE_ALL
,
1468 "rp_addr": "1.0.2.17",
1469 "group_addr_range": GROUP_RANGE_ALL
,
1477 result
= create_pim_config(tgen
, TOPO
, input_dict
)
1478 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1480 step("r1: Configure r1(LHR) as RP")
1486 "rp_addr": "1.0.1.17",
1487 "group_addr_range": GROUP_RANGE_ALL
,
1496 "rp_addr": "1.0.1.17",
1497 "group_addr_range": GROUP_RANGE_ALL
,
1506 "rp_addr": "1.0.1.17",
1507 "group_addr_range": GROUP_RANGE_ALL
,
1516 "rp_addr": "1.0.1.17",
1517 "group_addr_range": GROUP_RANGE_ALL
,
1524 result
= create_pim_config(tgen
, TOPO
, input_dict
)
1525 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1527 shutdown_bringup_interface(tgen
, "r1", "lo", False)
1529 shutdown_bringup_interface(tgen
, "r1", "lo", True)
1532 step("r1: Verify RP info")
1534 rp_address
= "1.0.1.17"
1536 result
= verify_pim_rp_info(
1537 tgen
, TOPO
, dut
, GROUP_RANGE_ALL
, iif
, rp_address
, SOURCE
1539 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1541 step("r0: Send IGMP join")
1542 result
= app_helper
.run_join("r0", GROUP_ADDRESS
, "r1")
1543 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1545 step("r1: Verify IGMP groups")
1547 result
= verify_igmp_groups(tgen
, dut
, oif
, GROUP_ADDRESS
)
1548 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1550 step("r5: Send multicast traffic for group 225.1.1.1")
1551 result
= app_helper
.run_traffic("r5", GROUP_ADDRESS
, "r3")
1552 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1554 step("r1: Verify (*, G) upstream IIF interface")
1555 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
)
1556 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1558 step("r1: Verify (*, G) upstream join state and join timer")
1559 result
= verify_join_state_and_timer(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
)
1560 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1562 step("r1: Verify (*, G) ip mroutes")
1563 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
)
1564 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1566 step("r1: Verify (S, G) upstream IIF interface")
1568 result
= verify_upstream_iif(tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS
)
1569 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1571 step("r1: Verify (S, G) upstream join state and join timer")
1572 result
= verify_join_state_and_timer(tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS
)
1573 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1575 step("r1: Verify (S, G) ip mroutes")
1576 result
= verify_ip_mroutes(tgen
, dut
, SOURCE_ADDRESS
, GROUP_ADDRESS
, iif
, oif
)
1577 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1579 step("r3: Verify (S, G) upstream IIF interface")
1582 result
= verify_upstream_iif(tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS
)
1583 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1585 step("r3: Verify (S, G) upstream join state and join timer")
1586 result
= verify_join_state_and_timer(
1587 tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS
, expected
=False
1589 assert result
is not True, (
1590 "Testcase {} : Failed \n "
1591 "r3: (S, G) upstream join state is joined and join"
1592 " timer is running \n Error: {}".format(tc_name
, result
)
1595 step("r3: Verify (S, G) ip mroutes")
1597 result
= verify_ip_mroutes(tgen
, dut
, SOURCE_ADDRESS
, GROUP_ADDRESS
, iif
, oif
)
1598 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1600 # Uncomment next line for debugging
1601 # tgen.mininet_cli()
1603 write_test_footer(tc_name
)
1606 def test_RP_configured_as_LHR_2_p1(request
):
1608 TC_21_2_P1: Verify OIF and RPF for (*,G) and (S,G) when static RP configure
1615 r0-----r1-------------r3-----r5
1621 tgen
= get_topogen()
1622 tc_name
= request
.node
.name
1623 write_test_header(tc_name
)
1625 # Don"t run this test if we have any failure.
1626 if tgen
.routers_have_failure():
1627 pytest
.skip(tgen
.errors
)
1629 step("Creating configuration from JSON")
1630 reset_config_on_routers(tgen
)
1631 app_helper
.stop_all_hosts()
1632 clear_ip_mroute(tgen
)
1633 clear_ip_pim_interface_traffic(tgen
, TOPO
)
1635 step("Enable IGMP on r1 interface")
1636 step("Configure RP on r1 (loopback interface) for the group range" " 224.0.0.0/4")
1637 step("Enable the PIM on all the interfaces of r1, r2, r3 and r4 routers")
1638 step("Send multicast traffic from r5")
1639 step("Send the IGMP join from r0")
1641 step("r1, r2, r3, r4: Delete existing RP configuration," "configure r1(LHR) as RP")
1647 "rp_addr": "1.0.2.17",
1648 "group_addr_range": GROUP_RANGE_ALL
,
1658 "rp_addr": "1.0.2.17",
1659 "group_addr_range": GROUP_RANGE_ALL
,
1669 "rp_addr": "1.0.2.17",
1670 "group_addr_range": GROUP_RANGE_ALL
,
1680 "rp_addr": "1.0.2.17",
1681 "group_addr_range": GROUP_RANGE_ALL
,
1689 result
= create_pim_config(tgen
, TOPO
, input_dict
)
1690 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1692 step("r1, r2, r3, r4: Configure r1(LHR) as RP")
1698 "rp_addr": "1.0.1.17",
1699 "group_addr_range": GROUP_RANGE_ALL
,
1708 "rp_addr": "1.0.1.17",
1709 "group_addr_range": GROUP_RANGE_ALL
,
1718 "rp_addr": "1.0.1.17",
1719 "group_addr_range": GROUP_RANGE_ALL
,
1728 "rp_addr": "1.0.1.17",
1729 "group_addr_range": GROUP_RANGE_ALL
,
1736 result
= create_pim_config(tgen
, TOPO
, input_dict
)
1737 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1739 step("r1: Verify RP info")
1741 rp_address
= "1.0.1.17"
1743 result
= verify_pim_rp_info(tgen
, TOPO
, dut
, GROUP_ADDRESS
, iif
, rp_address
, SOURCE
)
1744 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1746 step("r5: Send multicast traffic for group 225.1.1.1")
1747 result
= app_helper
.run_traffic("r5", GROUP_ADDRESS
, "r3")
1748 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1750 step("r0: Send IGMP join")
1751 result
= app_helper
.run_join("r0", GROUP_ADDRESS
, "r1")
1752 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1754 step("r1: Verify IGMP groups")
1756 result
= verify_igmp_groups(tgen
, dut
, oif
, GROUP_ADDRESS
)
1757 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1759 step("r1: Verify (*, G) upstream IIF interface")
1760 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
)
1761 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1763 step("r1: Verify (*, G) upstream join state and join timer")
1764 result
= verify_join_state_and_timer(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
)
1765 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1767 step("r1: Verify (*, G) ip mroutes")
1768 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
)
1769 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1771 step("r1: Verify (S, G) upstream IIF interface")
1773 result
= verify_upstream_iif(tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS
)
1774 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1776 step("r1: Verify (S, G) upstream join state and join timer")
1777 result
= verify_join_state_and_timer(tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS
)
1778 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1780 step("r1: Verify (S, G) ip mroutes")
1781 result
= verify_ip_mroutes(tgen
, dut
, SOURCE_ADDRESS
, GROUP_ADDRESS
, iif
, oif
)
1782 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1784 step("r3: Verify (S, G) upstream IIF interface")
1787 result
= verify_upstream_iif(tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS
)
1788 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1790 step("r3: Verify (S, G) upstream join state and join timer")
1791 result
= verify_join_state_and_timer(
1792 tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS
, expected
=False
1794 assert result
is not True, (
1795 "Testcase {} : Failed \n "
1796 "r3: (S,G) upstream state is joined and join timer is running\n Error: {}".format(
1801 step("r3: Verify (S, G) ip mroutes")
1803 result
= verify_ip_mroutes(tgen
, dut
, SOURCE_ADDRESS
, GROUP_ADDRESS
, iif
, oif
)
1804 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1806 # Uncomment next line for debugging
1807 # tgen.mininet_cli()
1809 write_test_footer(tc_name
)
1812 def test_RP_configured_as_FHR_1_p1(request
):
1814 TC_22_1_P1: Verify OIF and RFP for (*,G) and (S,G) when static RP configure
1821 r0-----r1-------------r3-----r5
1827 tgen
= get_topogen()
1828 tc_name
= request
.node
.name
1829 write_test_header(tc_name
)
1831 # Don"t run this test if we have any failure.
1832 if tgen
.routers_have_failure():
1833 pytest
.skip(tgen
.errors
)
1835 step("Creating configuration from JSON")
1836 reset_config_on_routers(tgen
)
1837 app_helper
.stop_all_hosts()
1838 clear_ip_mroute(tgen
)
1839 clear_ip_pim_interface_traffic(tgen
, TOPO
)
1841 step("Enable IGMP on r1 interface")
1842 step("Configure RP on r2 (loopback interface) for the group range" " 225.1.1.0/24")
1843 step("Enable the PIM on all the interfaces of r1, r2, r3 and r4 routers")
1844 step("Send the IGMP join from r0")
1845 step("Send multicast traffic from r5")
1847 step("r1, r2, r3, r4: Delete existing RP configuration" "configure r3(FHR) as RP")
1853 "rp_addr": "1.0.2.17",
1854 "group_addr_range": GROUP_RANGE_ALL
,
1864 "rp_addr": "1.0.2.17",
1865 "group_addr_range": GROUP_RANGE_ALL
,
1875 "rp_addr": "1.0.2.17",
1876 "group_addr_range": GROUP_RANGE_ALL
,
1886 "rp_addr": "1.0.2.17",
1887 "group_addr_range": GROUP_RANGE_ALL
,
1894 result
= create_pim_config(tgen
, TOPO
, input_dict
)
1895 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1897 step("r1, r2, r3, r4: Configure r3(FHR) as RP")
1903 "rp_addr": "1.0.3.17",
1904 "group_addr_range": GROUP_RANGE_ALL
,
1913 "rp_addr": "1.0.3.17",
1914 "group_addr_range": GROUP_RANGE_ALL
,
1923 "rp_addr": "1.0.3.17",
1924 "group_addr_range": GROUP_RANGE_ALL
,
1933 "rp_addr": "1.0.3.17",
1934 "group_addr_range": GROUP_RANGE_ALL
,
1941 result
= create_pim_config(tgen
, TOPO
, input_dict
)
1942 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1944 step("r1: Verify RP info")
1946 rp_address
= "1.0.3.17"
1948 result
= verify_pim_rp_info(
1949 tgen
, TOPO
, dut
, GROUP_RANGE_ALL
, iif
, rp_address
, SOURCE
1951 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1953 step("r0: Send IGMP join")
1954 result
= app_helper
.run_join("r0", GROUP_ADDRESS
, "r1")
1955 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1957 step("r0: Verify IGMP groups")
1959 result
= verify_igmp_groups(tgen
, dut
, oif
, GROUP_ADDRESS
)
1960 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1962 step("r5: Send multicast traffic for group 225.1.1.1")
1963 result
= app_helper
.run_traffic("r5", GROUP_ADDRESS
, "r3")
1964 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1966 step("r1: Verify (*, G) upstream IIF interface")
1967 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
)
1968 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1970 step("r1: Verify (*, G) upstream join state and join timer")
1971 result
= verify_join_state_and_timer(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
)
1972 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1974 step("r1: Verify (*, G) ip mroutes")
1975 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
)
1976 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1978 step("r1: Verify (S, G) upstream IIF interface")
1979 result
= verify_upstream_iif(tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS
)
1980 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1982 step("r1: Verify (S, G) upstream join state and join timer")
1983 result
= verify_join_state_and_timer(tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS
)
1984 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1986 step("r1: Verify (S, G) ip mroutes")
1987 result
= verify_ip_mroutes(tgen
, dut
, SOURCE_ADDRESS
, GROUP_ADDRESS
, iif
, oif
)
1988 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1990 step("r3: Verify (S, G) upstream IIF interface")
1993 result
= verify_upstream_iif(tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS
)
1994 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
1996 step("r3: Verify (S, G) upstream join state and join timer")
1997 result
= verify_join_state_and_timer(
1998 tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS
, expected
=False
2000 assert result
is not True, (
2001 "Testcase {} : Failed \n "
2002 "r3: (S,G) upstream state is joined and join timer is running\n Error: {}".format(
2007 step("r3: Verify (S, G) ip mroutes")
2009 result
= verify_ip_mroutes(tgen
, dut
, SOURCE_ADDRESS
, GROUP_ADDRESS
, iif
, oif
)
2010 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2012 # Uncomment next line for debugging
2013 # tgen.mininet_cli()
2015 write_test_footer(tc_name
)
2018 def test_RP_configured_as_FHR_2_p2(request
):
2020 TC_22_2_P2: Verify OIF and RFP for (*,G) and (S,G) when static RP configure
2027 r0-----r1-------------r3-----r5
2032 tgen
= get_topogen()
2033 tc_name
= request
.node
.name
2034 write_test_header(tc_name
)
2036 # Don"t run this test if we have any failure.
2037 if tgen
.routers_have_failure():
2038 pytest
.skip(tgen
.errors
)
2040 step("Creating configuration from JSON")
2041 reset_config_on_routers(tgen
)
2042 app_helper
.stop_all_hosts()
2043 clear_ip_mroute(tgen
)
2044 clear_ip_pim_interface_traffic(tgen
, TOPO
)
2046 step("Enable IGMP on r1 interface")
2047 step("Configure RP on r2 (loopback interface) for the group range" " 225.1.1.0/24")
2048 step("Enable the PIM on all the interfaces of r1, r2, r3 and r4 routers")
2049 step("Send multicast traffic from r5")
2050 step("Send the IGMP join from r0")
2052 step("r1, r2, r3, r4: Delete existing RP configuration" "configure r3(FHR) as RP")
2058 "rp_addr": "1.0.2.17",
2059 "group_addr_range": GROUP_RANGE_ALL
,
2069 "rp_addr": "1.0.2.17",
2070 "group_addr_range": GROUP_RANGE_ALL
,
2080 "rp_addr": "1.0.2.17",
2081 "group_addr_range": GROUP_RANGE_ALL
,
2091 "rp_addr": "1.0.2.17",
2092 "group_addr_range": GROUP_RANGE_ALL
,
2100 result
= create_pim_config(tgen
, TOPO
, input_dict
)
2101 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2103 step("r1, r2, r3, r4: Configure r3(FHR) as RP")
2109 "rp_addr": "1.0.3.17",
2110 "group_addr_range": GROUP_RANGE_ALL
,
2119 "rp_addr": "1.0.3.17",
2120 "group_addr_range": GROUP_RANGE_ALL
,
2129 "rp_addr": "1.0.3.17",
2130 "group_addr_range": GROUP_RANGE_ALL
,
2139 "rp_addr": "1.0.3.17",
2140 "group_addr_range": GROUP_RANGE_ALL
,
2147 result
= create_pim_config(tgen
, TOPO
, input_dict
)
2148 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2150 step("r1: Verify RP info")
2152 rp_address
= "1.0.3.17"
2154 result
= verify_pim_rp_info(
2155 tgen
, TOPO
, dut
, GROUP_RANGE_ALL
, iif
, rp_address
, SOURCE
2157 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2159 step("r5: Send multicast traffic for group 225.1.1.1")
2160 result
= app_helper
.run_traffic("r5", GROUP_ADDRESS
, "r3")
2161 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2163 step("r0: Send IGMP join")
2164 result
= app_helper
.run_join("r0", GROUP_ADDRESS
, "r1")
2165 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2167 step("r0: Verify IGMP groups")
2169 result
= verify_igmp_groups(tgen
, dut
, oif
, GROUP_ADDRESS
)
2170 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2172 step("r1: Verify (*, G) upstream IIF interface")
2173 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
)
2174 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2176 step("r1: Verify (*, G) upstream join state and join timer")
2177 result
= verify_join_state_and_timer(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
)
2178 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2180 step("r1: Verify (*, G) ip mroutes")
2181 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
)
2182 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2184 step("r1: Verify (S, G) upstream IIF interface")
2186 result
= verify_upstream_iif(tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS
)
2187 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2189 step("r1: Verify (S, G) upstream join state and join timer")
2190 result
= verify_join_state_and_timer(tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS
)
2191 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2193 step("r1: Verify (S, G) ip mroutes")
2194 result
= verify_ip_mroutes(tgen
, dut
, SOURCE_ADDRESS
, GROUP_ADDRESS
, iif
, oif
)
2195 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2197 step("r3: Verify (S, G) upstream IIF interface")
2200 result
= verify_upstream_iif(tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS
)
2201 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2203 step("r3: Verify (S, G) upstream join state and join timer")
2204 result
= verify_join_state_and_timer(
2205 tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS
, expected
=False
2207 assert result
is not True, (
2208 "Testcase {} : Failed \n "
2209 "r3: (S,G) upstream state is joined and join timer is running\n Error: {}".format(
2214 step("r3: Verify (S, G) ip mroutes")
2216 result
= verify_ip_mroutes(tgen
, dut
, SOURCE_ADDRESS
, GROUP_ADDRESS
, iif
, oif
)
2217 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2219 # Uncomment next line for debugging
2220 # tgen.mininet_cli()
2222 write_test_footer(tc_name
)
2225 def test_SPT_RPT_path_different_p1(request
):
2227 TC_23_P1: Verify (*,G) and (S,G) populated correctly when RPT and SPT path
2234 r0-----r1-------------r3-----r5
2241 tgen
= get_topogen()
2242 tc_name
= request
.node
.name
2243 write_test_header(tc_name
)
2245 # Don"t run this test if we have any failure.
2246 if tgen
.routers_have_failure():
2247 pytest
.skip(tgen
.errors
)
2249 step("Creating configuration from JSON")
2250 reset_config_on_routers(tgen
)
2251 app_helper
.stop_all_hosts()
2252 clear_ip_mroute(tgen
)
2253 clear_ip_pim_interface_traffic(tgen
, TOPO
)
2255 step("Enable IGMP on r1 interface and send IGMP join (225.1.1.1) to r1")
2256 step("Configure RP on r2 (loopback interface) for the group range" " 224.0.0.0/4")
2257 step("Enable the PIM on all the interfaces of r1, r2, r3 and r4 routers")
2258 step("Send multicast traffic from r3")
2260 step("r2: Verify RP info")
2262 rp_address
= "1.0.2.17"
2264 result
= verify_pim_rp_info(tgen
, TOPO
, dut
, GROUP_ADDRESS
, iif
, rp_address
, SOURCE
)
2265 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2267 step("r0: Send IGMP join")
2268 result
= app_helper
.run_join("r0", GROUP_ADDRESS
, "r1")
2269 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2271 step("r1: Verify IGMP groups")
2274 result
= verify_igmp_groups(tgen
, dut
, oif
, GROUP_ADDRESS
)
2275 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2277 step("r5: Send multicast traffic for group 225.1.1.1")
2278 result
= app_helper
.run_traffic("r5", GROUP_ADDRESS
, "r3")
2279 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2281 step("r1: Verify (*, G) upstream IIF interface")
2283 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
)
2284 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2286 step("r1: Verify (*, G) upstream join state and join timer")
2287 result
= verify_join_state_and_timer(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
)
2288 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2290 step("r1: Verify (*, G) ip mroutes")
2291 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
)
2292 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2294 step("r1: Verify (S, G) upstream IIF interface")
2296 result
= verify_upstream_iif(tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS
)
2297 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2299 step("r1: Verify (S, G) upstream join state and join timer")
2300 result
= verify_join_state_and_timer(tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS
)
2301 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2303 step("r1: Verify (S, G) ip mroutes")
2304 result
= verify_ip_mroutes(tgen
, dut
, SOURCE_ADDRESS
, GROUP_ADDRESS
, iif
, oif
)
2305 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2307 step("r2: Verify (*, G) upstream IIF interface")
2310 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
)
2311 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2313 step("r2: Verify (*, G) upstream join state and join timer")
2314 result
= verify_join_state_and_timer(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
)
2315 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2317 step("r2: Verify (*, G) ip mroutes")
2319 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
)
2320 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2322 step("r3: Verify (S, G) upstream IIF interface")
2325 result
= verify_upstream_iif(tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS
)
2326 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2328 step("r3: Verify (S, G) upstream join state and join timer")
2329 result
= verify_join_state_and_timer(
2330 tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS
, expected
=False
2332 assert result
is not True, (
2333 "Testcase {} : Failed \n "
2334 "r3: (S,G) upstream state is joined and join timer is running\n Error: {}".format(
2339 step("r3: Verify (S, G) ip mroutes")
2341 result
= verify_ip_mroutes(tgen
, dut
, SOURCE_ADDRESS
, GROUP_ADDRESS
, iif
, oif
)
2342 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2344 step("r2: Verify (S, G) upstream IIF interface")
2347 result
= verify_upstream_iif(
2348 tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS
, joinState
="NotJoined"
2350 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2352 step("r2: Verify (S, G) upstream join state and join timer")
2353 result
= verify_join_state_and_timer(
2354 tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS
, expected
=False
2356 assert result
is not True, (
2357 "Testcase {} : Failed \n "
2358 "r2: (S,G) upstream state is joined and join timer is running\n Error: {}".format(
2363 step("r2: Verify (S, G) ip mroutes")
2365 result
= verify_ip_mroutes(tgen
, dut
, SOURCE_ADDRESS
, GROUP_ADDRESS
, iif
, oif
)
2366 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2368 # Uncomment next line for debugging
2369 # tgen.mininet_cli()
2371 write_test_footer(tc_name
)
2374 def test_clear_pim_configuration_p1(request
):
2376 TC_25_P1: Verify (*,G) and (S,G) populated correctly after clearing the
2377 PIM,IGMP and mroutes joins
2383 r0-----r1-------------r3-----r5
2392 tgen
= get_topogen()
2393 tc_name
= request
.node
.name
2394 write_test_header(tc_name
)
2396 # Don"t run this test if we have any failure.
2397 if tgen
.routers_have_failure():
2398 pytest
.skip(tgen
.errors
)
2400 step("Creating configuration from JSON")
2401 reset_config_on_routers(tgen
)
2402 app_helper
.stop_all_hosts()
2403 clear_ip_mroute(tgen
)
2404 clear_ip_pim_interface_traffic(tgen
, TOPO
)
2406 step("Enable IGMP on r1 interface")
2407 step("Configure RP on r2 (loopback interface) for the group range" " 224.0.0.0/4")
2408 step("Enable the PIM on all the interfaces of r1, r2, r3 and r4 routers")
2409 step("Send the IGMP join from r0")
2410 step("Send multicast traffic from r5")
2412 step("r2: Verify RP info")
2414 rp_address
= "1.0.2.17"
2416 result
= verify_pim_rp_info(
2417 tgen
, TOPO
, dut
, GROUP_RANGE_ALL
, oif
, rp_address
, SOURCE
2419 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2421 step("r0: Send IGMP join")
2422 result
= app_helper
.run_join("r0", GROUP_ADDRESS
, "r1")
2423 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2425 step("r1: Verify IGMP groups")
2428 result
= verify_igmp_groups(tgen
, dut
, iif
, GROUP_ADDRESS
)
2429 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2431 step("r5: Send multicast traffic for group 225.1.1.1")
2432 result
= app_helper
.run_traffic("r5", GROUP_ADDRESS
, "r3")
2433 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2435 step("r1: Verify (*, G) upstream IIF interface")
2438 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
)
2439 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2441 step("r1: Verify (*, G) upstream join state and join timer")
2442 result
= verify_join_state_and_timer(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
)
2443 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2445 step("r1: Verify (*, G) ip mroutes")
2447 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
)
2448 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2450 step("r1: Verify IGMP groups timer restarted")
2451 result
= clear_ip_igmp_interfaces(tgen
, dut
)
2452 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2454 step("r1: Verify PIM neighbor timer restarted")
2455 result
= clear_ip_pim_interfaces(tgen
, dut
)
2456 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2458 step("r1: Verify PIM mroute timer restarted")
2459 result
= clear_ip_mroute_verify(tgen
, dut
)
2460 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2462 # Uncomment next line for debugging
2463 # tgen.mininet_cli()
2465 write_test_footer(tc_name
)
2468 def test_restart_pimd_process_p2(request
):
2470 TC_26_P2: Restart the PIMd process and verify PIM upstream and mroutes
2476 r0-----r1-------------r3-----r5
2485 tgen
= get_topogen()
2486 tc_name
= request
.node
.name
2487 write_test_header(tc_name
)
2489 # Don"t run this test if we have any failure.
2490 if tgen
.routers_have_failure():
2491 pytest
.skip(tgen
.errors
)
2493 step("Creating configuration from JSON")
2494 reset_config_on_routers(tgen
)
2495 app_helper
.stop_all_hosts()
2496 clear_ip_mroute(tgen
)
2497 clear_ip_pim_interface_traffic(tgen
, TOPO
)
2499 step("Enable IGMP on r1 interface and send IGMP join (225.1.1.1) to R1")
2500 step("Configure RP on r3 (loopback interface) for the group range" " 224.0.0.0/4")
2501 step("Enable the PIM on all the interfaces of r1, r2, r3 and r4 routers")
2502 step("Send multicast traffic from R3")
2503 step("Restart the PIMd process")
2505 step("r2: Verify RP info")
2507 rp_address
= "1.0.2.17"
2509 result
= verify_pim_rp_info(
2510 tgen
, TOPO
, dut
, GROUP_RANGE_ALL
, oif
, rp_address
, SOURCE
2512 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2514 step("r0: Send IGMP join")
2515 result
= app_helper
.run_join("r0", GROUP_ADDRESS
, "r1")
2516 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2518 step("r1: Verify IGMP groups")
2521 result
= verify_igmp_groups(tgen
, dut
, oif
, GROUP_ADDRESS
)
2522 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2524 step("r5: Send multicast traffic for group 225.1.1.1")
2525 result
= app_helper
.run_traffic("r5", GROUP_ADDRESS
, "r3")
2526 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2528 step("r1: Verify (*, G) upstream IIF interface")
2530 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
)
2531 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2533 step("r1: Verify (*, G) upstream join state and join timer")
2534 result
= verify_join_state_and_timer(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
)
2535 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2537 step("r1: Verify (*, G) ip mroutes")
2538 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
)
2539 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2541 step("r1: Verify (S, G) upstream IIF interface")
2543 result
= verify_upstream_iif(tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS
)
2544 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2546 step("r1: Verify (S, G) upstream join state and join timer")
2547 result
= verify_join_state_and_timer(tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS
)
2548 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2550 step("r1: Verify (S, G) ip mroutes")
2551 result
= verify_ip_mroutes(tgen
, dut
, SOURCE_ADDRESS
, GROUP_ADDRESS
, iif
, oif
)
2552 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2554 step("r2: Verify (*, G) upstream IIF interface")
2557 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
)
2558 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2560 step("r2: Verify (*, G) upstream join state and join timer")
2561 result
= verify_join_state_and_timer(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS
)
2562 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2564 step("r2: Verify (*, G) ip mroutes")
2566 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
)
2567 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2569 step("r3: Verify (S, G) upstream IIF interface")
2572 result
= verify_upstream_iif(tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS
)
2573 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2575 step("r3: Verify (S, G) upstream join state and join timer")
2576 result
= verify_join_state_and_timer(
2577 tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS
, expected
=False
2579 assert result
is not True, (
2580 "Testcase {} : Failed \n "
2581 "r3: (S,G) upstream state is joined and join timer is running\n Error: {}".format(
2586 step("r3: Verify (S, G) ip mroutes")
2588 result
= verify_ip_mroutes(tgen
, dut
, SOURCE_ADDRESS
, GROUP_ADDRESS
, iif
, oif
)
2589 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2594 logger
.info("waiting for 10 sec to make sure old mroute time is higher")
2596 # Why do we then wait 60 seconds below before checking the routes?
2597 uptime_before
= verify_ip_mroutes(
2598 tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oil
, return_uptime
=True, mwait
=60
2600 assert isinstance(uptime_before
, dict), "Testcase{} : Failed Error: {}".format(
2604 step("r1: Kill pimd process")
2605 kill_router_daemons(tgen
, "r1", ["pimd"])
2607 step("r1 : Start pimd process")
2608 start_router_daemons(tgen
, "r1", ["pimd"])
2610 logger
.info("Waiting for 5sec to get PIMd restarted and mroute" " re-learned..")
2613 # Why do we then wait 10 seconds below before checking the routes?
2614 uptime_after
= verify_ip_mroutes(
2615 tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oil
, return_uptime
=True, mwait
=10
2617 assert isinstance(uptime_after
, dict), "Testcase{} : Failed Error: {}".format(
2621 result
= verify_mroute_repopulated(uptime_before
, uptime_after
)
2622 assert result
is True, "Testcase{} : Failed Error: {}".format(tc_name
, result
)
2624 write_test_footer(tc_name
)
2627 def test_multiple_groups_same_RP_address_p2(request
):
2629 TC_27_P2: Configure multiple groups (10 grps) with same RP address
2635 r0-----r1-------------r3-----r5
2642 tgen
= get_topogen()
2643 tc_name
= request
.node
.name
2644 write_test_header(tc_name
)
2646 # Don"t run this test if we have any failure.
2647 if tgen
.routers_have_failure():
2648 pytest
.skip(tgen
.errors
)
2650 step("Creating configuration from JSON")
2651 reset_config_on_routers(tgen
)
2652 app_helper
.stop_all_hosts()
2653 clear_ip_mroute(tgen
)
2654 clear_ip_pim_interface_traffic(tgen
, TOPO
)
2656 step("Enable IGMP on r1 interface and send IGMP join (225.1.1.1) to r1")
2657 step("Configure RP on r2 (loopback interface) for the group range" "225.1.1.0/24")
2658 step("Enable the PIM on all the interfaces of r1-r2-r3")
2659 step("Send multicast traffic from r5 to all the groups")
2660 step("r1 : Remove the groups to RP mapping one by one")
2661 step("r1: Shut the upstream interfaces")
2662 step("r1: No shut the upstream interfaces")
2663 step("r1: Configure the RP again")
2664 step("r1: Shut the receiver interfaces")
2665 step("r1: No Shut the receiver interfaces")
2666 step("r2: Verify RP info")
2668 step("r2: verify rp-info")
2670 rp_address
= "1.0.2.17"
2672 result
= verify_pim_rp_info(
2673 tgen
, TOPO
, dut
, GROUP_RANGE_ALL
, oif
, rp_address
, SOURCE
2675 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2677 group_address_list
= GROUP_ADDRESS_LIST_1
+ GROUP_ADDRESS_LIST_2
2678 step("r0: Send IGMP join for 10 groups")
2679 result
= app_helper
.run_join("r0", group_address_list
, "r1")
2680 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2682 step("r1: Verify IGMP groups")
2685 result
= verify_igmp_groups(tgen
, dut
, oif
, group_address_list
)
2686 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2688 step("r5: Send multicast traffic for group 225.1.1.1")
2689 result
= app_helper
.run_traffic("r5", group_address_list
, "r3")
2690 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2692 step("r1: Verify (*, G) upstream IIF interface")
2695 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, group_address_list
)
2696 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2698 step("r1: Verify (*, G) upstream join state and join timer")
2699 result
= verify_join_state_and_timer(tgen
, dut
, iif
, STAR
, group_address_list
)
2700 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2702 step("r1: Verify (*, G) ip mroutes")
2704 result
= verify_ip_mroutes(tgen
, dut
, STAR
, group_address_list
, iif
, oif
)
2705 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2707 step("r1: Verify (S, G) upstream IIF interface")
2709 result
= verify_upstream_iif(tgen
, dut
, iif
, SOURCE_ADDRESS
, group_address_list
)
2710 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2712 step("r1: Verify (S, G) upstream join state and join timer")
2713 result
= verify_join_state_and_timer(
2714 tgen
, dut
, iif
, SOURCE_ADDRESS
, group_address_list
2716 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2718 step("r1: Verify (S, G) ip mroutes")
2719 result
= verify_ip_mroutes(tgen
, dut
, SOURCE_ADDRESS
, group_address_list
, iif
, oif
)
2720 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2722 step("r2: Verify (*, G) upstream IIF interface")
2725 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, group_address_list
)
2726 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2728 step("r2: Verify (*, G) upstream join state and join timer")
2729 result
= verify_join_state_and_timer(tgen
, dut
, iif
, STAR
, group_address_list
)
2730 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2732 step("r2: Verify (*, G) ip mroutes")
2734 result
= verify_ip_mroutes(tgen
, dut
, STAR
, group_address_list
, iif
, oif
)
2735 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2737 step("r3: Verify (S, G) upstream IIF interface")
2740 result
= verify_upstream_iif(tgen
, dut
, iif
, SOURCE_ADDRESS
, group_address_list
)
2741 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2743 step("r3: Verify (S, G) upstream join state and join timer")
2744 result
= verify_join_state_and_timer(
2745 tgen
, dut
, iif
, SOURCE_ADDRESS
, group_address_list
, expected
=False
2747 assert result
is not True, (
2748 "Testcase {} : Failed \n "
2749 "r3: (S,G) upstream state is joined and join timer is running\n Error: {}".format(
2754 step("r3: Verify (S, G) ip mroutes")
2756 result
= verify_ip_mroutes(tgen
, dut
, SOURCE_ADDRESS
, group_address_list
, iif
, oif
)
2757 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2759 step("r2: Verify (S, G) upstream IIF interface")
2762 result
= verify_upstream_iif(
2763 tgen
, dut
, iif
, SOURCE_ADDRESS
, group_address_list
, joinState
="NotJoined"
2765 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2767 step("r2: Verify (S, G) upstream join state and join timer")
2768 result
= verify_join_state_and_timer(
2769 tgen
, dut
, iif
, SOURCE_ADDRESS
, group_address_list
, expected
=False
2771 assert result
is not True, (
2772 "Testcase {} : Failed \n "
2773 "r2: (S,G) upstream state is joined and join timer is running\n Error: {}".format(
2778 step("r2: Verify (S, G) ip mroutes")
2780 result
= verify_ip_mroutes(tgen
, dut
, SOURCE_ADDRESS
, group_address_list
, iif
, oif
)
2781 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2783 step("r1: Delete RP configuration")
2789 "rp_addr": "1.0.2.17",
2790 "group_addr_range": GROUP_RANGE_ALL
,
2798 result
= create_pim_config(tgen
, TOPO
, input_dict
)
2799 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2801 step("r1: Shut the interface r1-r2-eth1 from R1 to R2")
2804 shutdown_bringup_interface(tgen
, dut
, intf
, False)
2806 step("r1: No Shut the interface r1-r2-eth1 from R1 to R2")
2808 shutdown_bringup_interface(tgen
, dut
, intf
, True)
2810 step("r1: Configure RP")
2816 "rp_addr": "1.0.2.17",
2817 "group_addr_range": GROUP_RANGE_ALL
,
2824 result
= create_pim_config(tgen
, TOPO
, input_dict
)
2825 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2827 step("r1: Shut the interface r1-r0-eth0 from R1 to R2")
2829 shutdown_bringup_interface(tgen
, dut
, intf
, False)
2831 step("r1: No Shut the interface r1-r0-eth0 from R1 to R2")
2833 shutdown_bringup_interface(tgen
, dut
, intf
, True)
2835 step("r1: Verify (*, G) upstream IIF interface")
2838 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, group_address_list
)
2839 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2841 step("r1: Verify (*, G) upstream join state and join timer")
2842 result
= verify_join_state_and_timer(tgen
, dut
, iif
, STAR
, group_address_list
)
2843 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2845 step("r1: Verify (*, G) ip mroutes")
2847 result
= verify_ip_mroutes(tgen
, dut
, STAR
, group_address_list
, iif
, oif
)
2848 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2850 step("r1: Verify (S, G) upstream IIF interface")
2852 result
= verify_upstream_iif(tgen
, dut
, iif
, SOURCE_ADDRESS
, group_address_list
)
2853 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2855 step("r1: Verify (S, G) upstream join state and join timer")
2856 result
= verify_join_state_and_timer(
2857 tgen
, dut
, iif
, SOURCE_ADDRESS
, group_address_list
2859 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2861 step("r1: Verify (S, G) ip mroutes")
2862 result
= verify_ip_mroutes(tgen
, dut
, SOURCE_ADDRESS
, group_address_list
, iif
, oif
)
2863 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2865 step("r2: Verify (*, G) upstream IIF interface")
2868 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, group_address_list
)
2869 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2871 step("r2: Verify (*, G) upstream join state and join timer")
2872 result
= verify_join_state_and_timer(tgen
, dut
, iif
, STAR
, group_address_list
)
2873 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2875 step("r2: Verify (*, G) ip mroutes")
2877 result
= verify_ip_mroutes(tgen
, dut
, STAR
, group_address_list
, iif
, oif
)
2878 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2880 step("r2: Verify (S, G) upstream IIF interface")
2883 result
= verify_upstream_iif(
2884 tgen
, dut
, iif
, SOURCE_ADDRESS
, group_address_list
, joinState
="NotJoined"
2886 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2888 step("r2: Verify (S, G) upstream join state and join timer")
2889 result
= verify_join_state_and_timer(
2890 tgen
, dut
, iif
, SOURCE_ADDRESS
, group_address_list
, expected
=False
2892 assert result
is not True, (
2893 "Testcase {} : Failed \n "
2894 "r2: (S,G) upstream state is joined and join timer is running\n Error: {}".format(
2899 step("r2: Verify (S, G) ip mroutes")
2901 result
= verify_ip_mroutes(tgen
, dut
, SOURCE_ADDRESS
, group_address_list
, iif
, oif
)
2902 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2904 step("r3: Verify (S, G) upstream IIF interface")
2907 result
= verify_upstream_iif(tgen
, dut
, iif
, SOURCE_ADDRESS
, group_address_list
)
2908 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2910 step("r3: Verify (S, G) upstream join state and join timer")
2911 result
= verify_join_state_and_timer(
2912 tgen
, dut
, iif
, SOURCE_ADDRESS
, group_address_list
, expected
=False
2914 assert result
is not True, (
2915 "Testcase {} : Failed \n "
2916 "r3: (S,G) upstream state is joined and join timer is running\n Error: {}".format(
2921 step("r3: Verify (S, G) ip mroutes")
2923 result
= verify_ip_mroutes(tgen
, dut
, SOURCE_ADDRESS
, group_address_list
, iif
, oif
)
2924 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2926 write_test_footer(tc_name
)
2929 def test_multiple_groups_different_RP_address_p2(request
):
2931 TC_28_P2: Verify IIF and OIL in updated in mroute when upstream interface
2938 r0-----r1-------------r3-----r5
2947 tgen
= get_topogen()
2948 tc_name
= request
.node
.name
2949 write_test_header(tc_name
)
2951 # Don"t run this test if we have any failure.
2952 if tgen
.routers_have_failure():
2953 pytest
.skip(tgen
.errors
)
2955 step("Creating configuration from JSON")
2956 reset_config_on_routers(tgen
)
2957 app_helper
.stop_all_hosts()
2958 clear_ip_mroute(tgen
)
2959 clear_ip_pim_interface_traffic(tgen
, TOPO
)
2961 step("Delete existing RP configuration")
2967 "rp_addr": "1.0.2.17",
2968 "group_addr_range": GROUP_RANGE_ALL
,
2975 result
= create_pim_config(tgen
, TOPO
, input_dict
)
2976 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
2983 "rp_addr": "1.0.2.17",
2984 "group_addr_range": GROUP_RANGE_LIST_1
,
2993 "rp_addr": "1.0.4.17",
2994 "group_addr_range": GROUP_RANGE_LIST_2
,
3000 result
= create_pim_config(tgen
, TOPO
, input_dict
)
3001 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3003 step("r2: Verify RP info")
3005 rp_address
= "1.0.2.17"
3007 result
= verify_pim_rp_info(
3008 tgen
, TOPO
, dut
, GROUP_RANGE_LIST_1
, oif
, rp_address
, SOURCE
3010 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3012 step("r4: Verify RP info")
3014 rp_address
= "1.0.4.17"
3015 result
= verify_pim_rp_info(
3016 tgen
, TOPO
, dut
, GROUP_RANGE_LIST_2
, oif
, rp_address
, SOURCE
3018 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3020 group_address_list
= GROUP_ADDRESS_LIST_1
+ GROUP_ADDRESS_LIST_2
3021 step("r0: Send IGMP join")
3022 result
= app_helper
.run_join("r0", group_address_list
, "r1")
3023 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3025 step("r1: Verify IGMP groups")
3028 result
= verify_igmp_groups(tgen
, dut
, oif
, group_address_list
)
3029 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3031 step("r5: Send multicast traffic for group 225.1.1.1")
3032 result
= app_helper
.run_traffic("r5", group_address_list
, "r3")
3033 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3035 step("r1: Verify (*, G) upstream IIF interface")
3038 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS_LIST_1
)
3039 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3041 step("r1: Verify (*, G) upstream join state and join timer")
3042 result
= verify_join_state_and_timer(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS_LIST_1
)
3043 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3045 step("r1: Verify (*, G) ip mroutes")
3046 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS_LIST_1
, iif
, oif
)
3047 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3049 step("r1: Verify (S, G) upstream IIF interface")
3051 result
= verify_upstream_iif(tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_1
)
3052 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3054 step("r1: Verify (S, G) upstream join state and join timer")
3055 result
= verify_join_state_and_timer(
3056 tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_1
3058 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3060 step("r1: Verify (S, G) ip mroutes")
3061 result
= verify_ip_mroutes(
3062 tgen
, dut
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_1
, iif
, oif
3064 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3066 step("r2: Verify (*, G) upstream IIF interface")
3069 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS_LIST_1
)
3070 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3072 step("r2: Verify (*, G) upstream join state and join timer")
3073 result
= verify_join_state_and_timer(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS_LIST_1
)
3074 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3076 step("r2: Verify (*, G) ip mroutes")
3078 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS_LIST_1
, iif
, oif
)
3079 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3081 step("r2: Verify (S, G) upstream IIF interface")
3083 result
= verify_upstream_iif(
3084 tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_1
, joinState
="NotJoined"
3086 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3088 step("r2: Verify (S, G) upstream join state and join timer")
3089 result
= verify_join_state_and_timer(
3090 tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_1
, expected
=False
3092 assert result
is not True, (
3093 "Testcase {} : Failed \n "
3094 "r2: (S,G) upstream state is joined and join timer is running\n Error: {}".format(
3099 step("r2: Verify (S, G) ip mroutes")
3101 result
= verify_ip_mroutes(
3102 tgen
, dut
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_1
, iif
, oif
3104 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3106 step("r3: Verify (S, G) upstream IIF interface")
3109 result
= verify_upstream_iif(tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_1
)
3110 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3112 step("r3: Verify (S, G) upstream join state and join timer")
3113 result
= verify_join_state_and_timer(
3114 tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_1
, expected
=False
3116 assert result
is not True, (
3117 "Testcase {} : Failed \n "
3118 "r3: (S,G) upstream state is joined and join timer is running\n Error: {}".format(
3123 step("r3: Verify (S, G) ip mroutes")
3125 result
= verify_ip_mroutes(
3126 tgen
, dut
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_1
, iif
, oif
3128 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3130 step("r1: Verify (*, G) upstream IIF interface")
3133 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS_LIST_2
)
3134 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3136 step("r1: Verify (*, G) upstream join state and join timer")
3137 result
= verify_join_state_and_timer(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS_LIST_2
)
3138 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3140 step("r1: Verify (*, G) ip mroutes")
3142 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS_LIST_2
, iif
, oif
)
3143 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3145 step("r1: Verify (S, G) upstream IIF interface")
3147 result
= verify_upstream_iif(tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_2
)
3148 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3150 step("r1: Verify (S, G) upstream join state and join timer")
3151 result
= verify_join_state_and_timer(
3152 tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_2
3154 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3156 step("r1: Verify (S, G) ip mroutes")
3157 result
= verify_ip_mroutes(
3158 tgen
, dut
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_2
, iif
, oif
3160 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3162 step("r4: Verify (*, G) upstream IIF interface")
3165 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS_LIST_2
)
3166 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3168 step("r4: Verify (*, G) upstream join state and join timer")
3169 result
= verify_join_state_and_timer(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS_LIST_2
)
3170 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3172 step("r4: Verify (*, G) ip mroutes")
3174 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS_LIST_2
, iif
, oif
)
3175 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3177 step("r4: Verify (S, G) upstream IIF interface")
3179 result
= verify_upstream_iif(
3180 tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_2
, joinState
="NotJoined"
3182 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3184 step("r4: Verify (S, G) upstream join state and join timer")
3185 result
= verify_join_state_and_timer(
3186 tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_2
, expected
=False
3188 assert result
is not True, (
3189 "Testcase {} : Failed \n "
3190 "r4: (S,G) upstream state is joined and join timer is running\n Error: {}".format(
3195 step("r4: Verify (S, G) ip mroutes")
3197 result
= verify_ip_mroutes(
3198 tgen
, dut
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_2
, iif
, oif
3200 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3202 step("r3: Verify (S, G) upstream IIF interface")
3205 result
= verify_upstream_iif(tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_2
)
3206 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3208 step("r3: Verify (S, G) upstream join state and join timer")
3209 result
= verify_join_state_and_timer(
3210 tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_2
, expected
=False
3212 assert result
is not True, "Testcase {} :Failed \n Error: {}".format(
3216 step("r3: Verify (S, G) ip mroutes")
3218 result
= verify_ip_mroutes(
3219 tgen
, dut
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_2
, iif
, oif
3221 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3223 step("Delete RP configuration")
3229 "rp_addr": "1.0.2.17",
3230 "group_addr_range": GROUP_RANGE_LIST_1
,
3240 "rp_addr": "1.0.4.17",
3241 "group_addr_range": GROUP_RANGE_LIST_2
,
3248 result
= create_pim_config(tgen
, TOPO
, input_dict
)
3249 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3251 step("r1, r2, r3, r4: Re-configure RP")
3257 "rp_addr": "1.0.2.17",
3258 "group_addr_range": GROUP_RANGE_LIST_1
,
3267 "rp_addr": "1.0.4.17",
3268 "group_addr_range": GROUP_RANGE_LIST_2
,
3274 result
= create_pim_config(tgen
, TOPO
, input_dict
)
3275 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3277 step("r1: Shut the interface r1-r2-eth1 from R1 to R2")
3280 shutdown_bringup_interface(tgen
, dut
, intf
, False)
3282 step("r1: No shut the interface r1-r2-eth1 from R1 to R2")
3285 shutdown_bringup_interface(tgen
, dut
, intf
, True)
3287 step("r1: Shut the interface r1-r2-eth1 from R1 to R4")
3290 shutdown_bringup_interface(tgen
, dut
, intf
, False)
3292 step("r1: No shut the interface r1-r2-eth1 from R1 to r4")
3295 shutdown_bringup_interface(tgen
, dut
, intf
, True)
3297 step("r1: Shut the interface r1-r0-eth0 from R1 to R0")
3300 shutdown_bringup_interface(tgen
, dut
, intf
, False)
3302 step("r1: No Shut the interface r1-r0-eth0 from R1 to R0")
3305 shutdown_bringup_interface(tgen
, dut
, intf
, True)
3307 step("r1: Verify (*, G) upstream IIF interface")
3310 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS_LIST_1
)
3311 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3313 step("r1: Verify (*, G) upstream join state and join timer")
3314 result
= verify_join_state_and_timer(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS_LIST_1
)
3315 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3317 step("r1: Verify (*, G) ip mroutes")
3319 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS_LIST_1
, iif
, oif
)
3320 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3322 step("r1: Verify (S, G) upstream IIF interface")
3324 result
= verify_upstream_iif(tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_1
)
3325 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3327 step("r1: Verify (S, G) upstream join state and join timer")
3328 result
= verify_join_state_and_timer(
3329 tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_1
3331 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3333 step("r1: Verify (S, G) ip mroutes")
3334 result
= verify_ip_mroutes(
3335 tgen
, dut
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_1
, iif
, oif
3337 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3339 step("r2: Verify (*, G) upstream IIF interface")
3342 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS_LIST_1
)
3343 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3345 step("r2: Verify (*, G) upstream join state and join timer")
3346 result
= verify_join_state_and_timer(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS_LIST_1
)
3347 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3349 step("r2: Verify (*, G) ip mroutes")
3351 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS_LIST_1
, iif
, oif
)
3352 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3354 step("r2: Verify (S, G) upstream IIF interface")
3356 result
= verify_upstream_iif(
3357 tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_1
, joinState
="NotJoined"
3359 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3361 step("r2: Verify (S, G) upstream join state and join timer")
3362 result
= verify_join_state_and_timer(
3363 tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_1
, expected
=False
3365 assert result
is not True, (
3366 "Testcase {} : Failed \n "
3367 "r2: (S,G) upstream state is joined and join timer is running\n Error: {}".format(
3372 step("r2: Verify (S, G) ip mroutes")
3374 result
= verify_ip_mroutes(
3375 tgen
, dut
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_1
, iif
, oif
3377 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3379 step("r3: Verify (S, G) upstream IIF interface")
3382 result
= verify_upstream_iif(tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_1
)
3383 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3385 step("r3: Verify (S, G) upstream join state and join timer")
3386 result
= verify_join_state_and_timer(
3387 tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_1
, expected
=False
3389 assert result
is not True, (
3390 "Testcase {} : Failed \n "
3391 "r3: (S,G) upstream state is joined and join timer is running\n Error: {}".format(
3396 step("r3: Verify (S, G) ip mroutes")
3398 result
= verify_ip_mroutes(
3399 tgen
, dut
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_1
, iif
, oif
3401 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3403 step("r1: Verify (*, G) upstream IIF interface")
3406 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS_LIST_2
)
3407 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3409 step("r1: Verify (*, G) upstream join state and join timer")
3410 result
= verify_join_state_and_timer(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS_LIST_2
)
3411 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3413 step("r1: Verify (*, G) ip mroutes")
3415 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS_LIST_2
, iif
, oif
)
3416 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3418 step("r1: Verify (S, G) upstream IIF interface")
3420 result
= verify_upstream_iif(tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_2
)
3421 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3423 step("r1: Verify (S, G) upstream join state and join timer")
3424 result
= verify_join_state_and_timer(
3425 tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_2
3427 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3429 step("r1: Verify (S, G) ip mroutes")
3430 result
= verify_ip_mroutes(
3431 tgen
, dut
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_2
, iif
, oif
3433 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3435 step("r4: Verify (*, G) upstream IIF interface")
3438 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS_LIST_2
)
3439 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3441 step("r4: Verify (*, G) upstream join state and join timer")
3442 result
= verify_join_state_and_timer(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS_LIST_2
)
3443 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3445 step("r4: Verify (*, G) ip mroutes")
3447 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS_LIST_2
, iif
, oif
)
3448 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3450 step("r4: Verify (S, G) upstream IIF interface")
3452 result
= verify_upstream_iif(
3453 tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_2
, joinState
="NotJoined"
3455 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3457 step("r4: Verify (S, G) upstream join state and join timer")
3458 result
= verify_join_state_and_timer(
3459 tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_2
, expected
=False
3461 assert result
is not True, (
3462 "Testcase {} : Failed \n "
3463 "r4: (S,G) upstream state is joined and join timer is running\n Error: {}".format(
3468 step("r4: Verify (S, G) ip mroutes")
3470 result
= verify_ip_mroutes(
3471 tgen
, dut
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_2
, iif
, oif
3473 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3475 step("r3: Verify (S, G) upstream IIF interface")
3478 result
= verify_upstream_iif(tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_2
)
3479 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3481 step("r3: Verify (S, G) upstream join state and join timer")
3482 result
= verify_join_state_and_timer(
3483 tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_2
, expected
=False
3485 assert result
is not True, (
3486 "Testcase {} : Failed \n "
3487 "r3: (S,G) upstream state is joined and join timer is running\n Error: {}".format(
3492 step("r3: Verify (S, G) ip mroutes")
3494 result
= verify_ip_mroutes(
3495 tgen
, dut
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_2
, iif
, oif
3497 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3499 write_test_footer(tc_name
)
3502 def test_shutdown_primary_path_p1(request
):
3504 TC_30_P1: Verify IIF and OIL change to other path after shut the primary
3511 r0-----r1-------------r3
3514 tgen
= get_topogen()
3515 tc_name
= request
.node
.name
3516 write_test_header(tc_name
)
3518 # Don"t run this test if we have any failure.
3519 if tgen
.routers_have_failure():
3520 pytest
.skip(tgen
.errors
)
3522 step("Creating configuration from JSON")
3523 reset_config_on_routers(tgen
)
3524 app_helper
.stop_all_hosts()
3525 clear_ip_mroute(tgen
)
3526 clear_ip_pim_interface_traffic(tgen
, TOPO
)
3529 step("Enable IGMP on r1 interface")
3530 step("Configure RP on r2 (loopback interface) for the group range" " 224.0.0.0/4")
3531 step("r1: Shut the link from r1 to r2")
3532 step("r3: Shut the link from r1 to r3")
3533 step("r1: No shut the link from r1 to r2")
3534 step("r3: No shut the link from r1 to r3")
3536 step("r1: Verify RP info")
3538 rp_address
= "1.0.2.17"
3540 result
= verify_pim_rp_info(
3541 tgen
, TOPO
, dut
, GROUP_RANGE_ALL
, iif
, rp_address
, SOURCE
3543 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3545 step("r0: Send IGMP join")
3546 result
= app_helper
.run_join("r0", GROUP_ADDRESS
, "r1")
3547 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3549 step("r1: Verify IGMP groups")
3551 result
= verify_igmp_groups(tgen
, dut
, oif
, GROUP_ADDRESS
)
3552 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3554 step("r1: Verify (*, G) ip mroutes")
3555 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
)
3556 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3558 step("r2: Verify (*, G) ip mroutes")
3562 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
)
3563 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3565 step("r1: Shut the interface r1-r2-eth1 from R1 to R2")
3568 shutdown_bringup_interface(tgen
, dut
, intf
, False)
3571 "Verify after shut the R1 to R2 link , verify join is reaching to RP"
3575 logger
.info("Waiting for 110 sec only if test run with crucible")
3577 step("r1: Verify (*, G) ip mroutes")
3581 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
)
3582 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3584 step("r2: Verify (*, G) ip mroutes")
3588 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
)
3589 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3591 step("r3: Verify (*, G) ip mroutes")
3595 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
)
3596 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3598 step("r3: Shut the link from R1 to R3 from R3 node")
3601 shutdown_bringup_interface(tgen
, dut
, intf
, False)
3604 "Verify after shut of R1 to R3 link , verify (*,G) entries got"
3605 " cleared from all the node R1, R2, R3"
3608 step("r1: Verify (*, G) ip mroutes")
3612 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
, expected
=False)
3613 assert result
is not True, (
3614 "Testcase {} : Failed \n "
3615 "r1: (*,G) mroutes are not cleared after shut of R1 to R3 link\n Error: {}".format(
3620 step("r2: Verify (*, G) ip mroutes")
3624 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
, expected
=False)
3625 assert result
is not True, (
3626 "Testcase {} : Failed \n "
3627 "r2: (*,G) mroutes are not cleared after shut of R1 to R3 link\n Error: {}".format(
3632 step("r3: Verify (*, G) ip mroutes")
3636 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
, expected
=False)
3637 assert result
is not True, (
3638 "Testcase {} : Failed \n "
3639 "r3: (*,G) mroutes are not cleared after shut of R1 to R3 link\n Error: {}".format(
3644 step("r3: No shutdown the link from R1 to R3 from R3 node")
3647 shutdown_bringup_interface(tgen
, dut
, intf
, True)
3649 step("r1: Verify (*, G) ip mroutes")
3653 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
)
3654 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3656 step("r2: Verify (*, G) ip mroutes")
3660 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
)
3661 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3663 step("r3: Verify (*, G) ip mroutes")
3667 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
)
3668 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3670 step("r1: No shutdown the link from R1 to R2 from R1 node")
3673 shutdown_bringup_interface(tgen
, dut
, intf
, True)
3675 step("r1: Verify (*, G) ip mroutes")
3679 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
)
3680 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3682 step("r2: Verify (*, G) ip mroutes")
3686 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
)
3687 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3689 write_test_footer(tc_name
)
3692 def test_delete_RP_shut_noshut_upstream_interface_p1(request
):
3694 TC_31_P1: Verify RP info and (*,G) mroute after deleting the RP and shut /
3695 no shut the RPF interface.
3700 r0-----r1-------------r3
3703 tgen
= get_topogen()
3704 tc_name
= request
.node
.name
3705 write_test_header(tc_name
)
3707 # Don"t run this test if we have any failure.
3708 if tgen
.routers_have_failure():
3709 pytest
.skip(tgen
.errors
)
3711 step("Creating configuration from JSON")
3712 reset_config_on_routers(tgen
)
3713 app_helper
.stop_all_hosts()
3714 clear_ip_mroute(tgen
)
3715 clear_ip_pim_interface_traffic(tgen
, TOPO
)
3717 step("Enable IGMP on r1 interface")
3718 step("Configure RP on r2 (loopback interface) for the group range" " 224.0.0.0/4")
3719 step("r1: Delete the RP config")
3720 step("r1: Shut and no shut the upstream interface (R1-R2) connected link")
3721 step("r1: Shut and no shut the OIL interface")
3723 step("r1: Verify RP info")
3725 rp_address
= "1.0.2.17"
3727 result
= verify_pim_rp_info(
3728 tgen
, TOPO
, dut
, GROUP_RANGE_ALL
, iif
, rp_address
, SOURCE
3730 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3732 step("r0: Send IGMP join")
3733 result
= app_helper
.run_join("r0", GROUP_ADDRESS
, "r1")
3734 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3736 step("r1: Verify IGMP groups")
3739 result
= verify_igmp_groups(tgen
, dut
, oif
, GROUP_ADDRESS
)
3740 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3742 step("r1: Verify (*, G) ip mroutes created")
3743 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
)
3744 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3746 step("r2: Verify (*, G) ip mroutes created")
3750 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
)
3751 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3753 step("r1: Delete RP configuration")
3755 # Delete RP configuration
3761 "rp_addr": "1.0.2.17",
3762 "group_addr_range": GROUP_RANGE_ALL
,
3770 result
= create_pim_config(tgen
, TOPO
, input_dict
)
3771 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3773 step("r1: Shut the interface r1-r2-eth1 from R1 to R2")
3776 shutdown_bringup_interface(tgen
, dut
, intf
, False)
3778 step("r1: No shutdown the interface r1-r2-eth1 from R1 to R2")
3781 shutdown_bringup_interface(tgen
, dut
, intf
, True)
3783 step("r1: Shutdown the OIL interface r1-r0-eth0 from R1 to R0 ")
3786 shutdown_bringup_interface(tgen
, dut
, intf
, False)
3788 step("r1: No shutdown the OIL interface r1-r0-eth0 from R1 to R0")
3791 shutdown_bringup_interface(tgen
, dut
, intf
, True)
3793 step("r1: Verify (*, G) ip mroutes cleared")
3797 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
, expected
=False)
3798 assert result
is not True, (
3799 "Testcase {} : Failed \n "
3800 "r1: (*,G) mroutes are not cleared after shut of R1 to R0 link\n Error: {}".format(
3805 step("r2: Verify (*, G) ip mroutes cleared")
3809 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
, expected
=False)
3810 assert result
is not True, (
3811 "Testcase {} : Failed \n "
3812 "r2: (*,G) mroutes are not cleared after shut of R1 to R0 link\n Error: {}".format(
3817 write_test_footer(tc_name
)
3820 def test_delete_RP_shut_noshut_RP_interface_p1(request
):
3822 TC_32_P1: Verify RP info and (*,G) mroute after deleting the RP and shut/
3823 no shut the RPF interface
3829 r0-----r1-------------r3
3832 tgen
= get_topogen()
3833 tc_name
= request
.node
.name
3834 write_test_header(tc_name
)
3836 # Don"t run this test if we have any failure.
3837 if tgen
.routers_have_failure():
3838 pytest
.skip(tgen
.errors
)
3840 step("Creating configuration from JSON")
3841 reset_config_on_routers(tgen
)
3842 app_helper
.stop_all_hosts()
3843 clear_ip_mroute(tgen
)
3844 clear_ip_pim_interface_traffic(tgen
, TOPO
)
3846 step("Enable IGMP on r1 interface")
3847 step("Configure RP on r2 (lo) for the group range" " 224.0.0.0/4")
3848 step("r2: Delete the RP configuration")
3849 step("r2: Shut the RP interface (lo)")
3850 step("r1: Shut the interface(r1-r2-eth1, r1-r3-eth2) towards rp")
3852 step("r1: Verify RP info")
3854 rp_address
= "1.0.2.17"
3856 result
= verify_pim_rp_info(
3857 tgen
, TOPO
, dut
, GROUP_RANGE_ALL
, iif
, rp_address
, SOURCE
3859 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3861 step("r0: Send IGMP join")
3862 result
= app_helper
.run_join("r0", GROUP_ADDRESS
, "r1")
3863 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3865 step("r1: Verify IGMP groups")
3867 result
= verify_igmp_groups(tgen
, dut
, oif
, GROUP_ADDRESS
)
3868 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3870 step("r1: Verify (*, G) ip mroutes created")
3871 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
)
3872 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3874 step("r2: Verify (*, G) ip mroutes created")
3878 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
)
3879 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3881 step("r2: Delete RP configuration")
3883 # Delete RP configuration
3889 "rp_addr": "1.0.2.17",
3890 "group_addr_range": GROUP_RANGE_ALL
,
3898 result
= create_pim_config(tgen
, TOPO
, input_dict
)
3899 assert result
is True, "Testcase {} :Failed \n Error: {}".format(tc_name
, result
)
3901 step("r2: Shut the RP interface lo")
3904 shutdown_bringup_interface(tgen
, dut
, intf
, False)
3906 step("r1: Shut the interface r1-r2-eth1 towards RP")
3909 shutdown_bringup_interface(tgen
, dut
, intf
, False)
3911 step("r1: Shut the interface r1-r3-eth2 towards RP")
3914 shutdown_bringup_interface(tgen
, dut
, intf
, False)
3916 step("r1: Verify (*, G) ip mroutes cleared")
3920 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
, expected
=False)
3921 assert result
is not True, (
3922 "Testcase {} : Failed \n "
3923 "r1: (*,G) mroutes are not cleared after shut of R1 to R2 and R3 link\n Error: {}".format(
3928 step("r2: Verify (*, G) ip mroutes cleared")
3932 result
= verify_ip_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS
, iif
, oif
, expected
=False)
3933 assert result
is not True, (
3934 "Testcase {} : Failed \n "
3935 "r2: (*,G) mroutes are not cleared after shut of R1 to R2 and R3 link\n Error: {}".format(
3940 write_test_footer(tc_name
)
3943 if __name__
== "__main__":
3944 ARGS
= ["-s"] + sys
.argv
[1:]
3945 sys
.exit(pytest
.main(ARGS
))