4 # Copyright (c) 2022 by VMware, Inc. ("VMware")
5 # Used Copyright (c) 2018 by Network Device Education Foundation,
6 # Inc. ("NetDEF") in this file.
8 # Permission to use, copy, modify, and/or distribute this software
9 # for any purpose with or without fee is hereby granted, provided
10 # that the above copyright notice and this permission notice appear
13 # THE SOFTWARE IS PROVIDED "AS IS" AND VMWARE DISCLAIMS ALL WARRANTIES
14 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL VMWARE BE LIABLE FOR
16 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
17 # DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
18 # WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
19 # ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
24 Following tests are covered to test Multicast basic functionality:
31 r0-----r1-------------r3-----r5
37 - Create topology (setup module)
40 1. Configure multiple groups (10 grps) with same RP address
41 2. Verify IIF and OIL in updated in mroute when upstream interface
43 3. Verify RP info and (*,G) mroute after deleting the RP and shut /
44 no shut the RPF interface.
53 # Save the Current Working Directory to find configuration files.
54 CWD
= os
.path
.dirname(os
.path
.realpath(__file__
))
55 sys
.path
.append(os
.path
.join(CWD
, "../"))
56 sys
.path
.append(os
.path
.join(CWD
, "../lib/"))
58 # Required to instantiate the topology builder class.
60 # pylint: disable=C0413
61 # Import topogen and topotest helpers
62 from lib
.topogen
import Topogen
, get_topogen
64 from lib
.common_config
import (
68 reset_config_on_routers
,
70 shutdown_bringup_interface
,
76 socat_send_pim6_traffic
,
82 verify_join_state_and_timer
,
85 verify_pim_interface_traffic
,
88 clear_pim6_interface_traffic
,
90 verify_pim6_neighbors
,
91 get_pim6_interface_traffic
,
92 clear_pim6_interfaces
,
95 from lib
.topolog
import logger
96 from lib
.topojson
import build_topo_from_json
, build_config_from_json
99 GROUP_RANGE_1
= "ff08::/64"
100 GROUP_ADDRESS_1
= "ff08::1"
101 GROUP_RANGE_3
= "ffaa::/64"
102 GROUP_ADDRESS_3
= "ffaa::1"
103 GROUP_RANGE_LIST_1
= [
110 GROUP_RANGE_LIST_2
= [
117 GROUP_ADDRESS_LIST_1
= ["ffaa::1", "ffaa::2", "ffaa::3", "ffaa::4", "ffaa::5"]
118 GROUP_ADDRESS_LIST_2
= ["ffaa::6", "ffaa::7", "ffaa::8", "ffaa::9", "ffaa::10"]
121 ASSERT_MSG
= "Testcase {} : Failed Error: {}"
123 pytestmark
= [pytest
.mark
.pim6d
]
126 def build_topo(tgen
):
129 # Building topology from json file
130 build_topo_from_json(tgen
, TOPO
)
133 def setup_module(mod
):
135 Sets up the pytest environment
140 testsuite_run_time
= time
.asctime(time
.localtime(time
.time()))
141 logger
.info("Testsuite start time: %s", testsuite_run_time
)
142 logger
.info("=" * 40)
149 r0-----r1-------------r3-----r5
155 logger
.info("Master Topology: \n %s", topology
)
157 logger
.info("Running setup_module to create topology")
159 # This function initiates the topology build with Topogen...
160 json_file
= "{}/multicast_pim6_static_rp.json".format(CWD
)
161 tgen
= Topogen(json_file
, mod
.__name
__)
163 TOPO
= tgen
.json_topo
165 # ... and here it calls Mininet initialization functions.
167 # Starting topology, create tmp files which are loaded to routers
168 # to start daemons and then start routers
171 # Don"t run this test if we have any failure.
172 if tgen
.routers_have_failure():
173 pytest
.skip(tgen
.errors
)
175 # Creating configuration from JSON
176 build_config_from_json(tgen
, TOPO
)
178 # Verify PIM6 neighbors
179 result
= verify_pim6_neighbors(tgen
, TOPO
)
180 assert result
is True, "setup_module :Failed \n Error:" " {}".format(result
)
182 logger
.info("Running setup_module() done")
185 def teardown_module():
186 """Teardown the pytest environment"""
188 logger
.info("Running teardown_module to delete topology")
191 # Stop toplogy and Remove tmp files
194 logger
.info("Testsuite end time: %s", time
.asctime(time
.localtime(time
.time())))
195 logger
.info("=" * 40)
198 #####################################################
202 #####################################################
205 def verify_state_incremented(state_before
, state_after
):
207 API to compare interface traffic state incrementing
211 * `state_before` : State dictionary for any particular instance
212 * `state_after` : State dictionary for any particular instance
215 for router
, state_data
in state_before
.items():
216 for state
, value
in state_data
.items():
217 if state_before
[router
][state
] >= state_after
[router
][state
]:
219 "[DUT: %s]: state %s value has not"
220 " incremented, Initial value: %s, "
221 "Current value: %s [FAILED!!]"
225 state_before
[router
][state
],
226 state_after
[router
][state
],
232 "[DUT: %s]: State %s value is "
233 "incremented, Initial value: %s, Current value: %s"
237 state_before
[router
][state
],
238 state_after
[router
][state
],
244 #####################################################
248 #####################################################
251 def test_pim6_multiple_groups_same_RP_address_p2(request
):
253 Configure multiple groups (10 grps) with same RP address
259 r0-----r1-------------r3-----r5
267 tc_name
= request
.node
.name
268 write_test_header(tc_name
)
270 # Don"t run this test if we have any failure.
271 if tgen
.routers_have_failure():
272 pytest
.skip(tgen
.errors
)
274 step("Creating configuration from JSON")
276 clear_pim6_mroute(tgen
)
277 clear_pim6_interface_traffic(tgen
, TOPO
)
278 reset_config_on_routers(tgen
)
280 step("Enable MLD on r1 interface")
281 step("Enable the PIM6 on all the interfaces of r1, r2, r3 and r4 routers")
282 step("r2: Configure r2 as RP")
288 "rp_addr": TOPO
["routers"]["r2"]["links"]["lo"]["ipv6"].split(
291 "group_addr_range": GROUP_RANGE_3
,
298 result
= create_pim_config(tgen
, TOPO
, input_dict
)
299 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
301 step("r2: verify rp-info")
304 rp_address
= TOPO
["routers"]["r2"]["links"]["lo"]["ipv6"].split("/")[0]
305 result
= verify_pim_rp_info(tgen
, TOPO
, dut
, GROUP_RANGE_3
, oif
, rp_address
, SOURCE
)
306 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
308 group_address_list
= GROUP_ADDRESS_LIST_1
+ GROUP_ADDRESS_LIST_2
309 step("r0: Send MLD join for 10 groups")
310 intf
= TOPO
["routers"]["r0"]["links"]["r1"]["interface"]
311 intf_ip
= TOPO
["routers"]["r0"]["links"]["r1"]["ipv6"].split("/")[0]
312 result
= socat_send_mld_join(
313 tgen
, "r0", "UDP6-RECV", group_address_list
, intf
, intf_ip
315 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
317 step("r1: Verify MLD groups")
319 intf_r1_r0
= TOPO
["routers"]["r1"]["links"]["r0"]["interface"]
320 result
= verify_mld_groups(tgen
, dut
, intf_r1_r0
, group_address_list
)
321 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
323 step("r5: Send multicast traffic for group {}".format(group_address_list
))
324 intf
= TOPO
["routers"]["r5"]["links"]["r3"]["interface"]
325 SOURCE_ADDRESS
= TOPO
["routers"]["r5"]["links"]["r3"]["ipv6"].split("/")[0]
326 result
= socat_send_pim6_traffic(tgen
, "r5", "UDP6-SEND", group_address_list
, intf
)
327 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
329 step("r1: Verify (*, G) upstream IIF interface")
331 iif
= TOPO
["routers"]["r1"]["links"]["r2"]["interface"]
332 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, group_address_list
)
333 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
335 step("r1: Verify (*, G) upstream join state and join timer")
336 result
= verify_join_state_and_timer(
337 tgen
, dut
, iif
, STAR
, group_address_list
, addr_type
="ipv6"
339 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
341 step("r1: Verify (*, G) ip mroutes")
342 oif
= TOPO
["routers"]["r1"]["links"]["r0"]["interface"]
343 result
= verify_mroutes(tgen
, dut
, STAR
, group_address_list
, iif
, oif
)
344 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
346 step("r1: Verify (S, G) ip mroutes")
347 iif
= TOPO
["routers"]["r1"]["links"]["r3"]["interface"]
348 result
= verify_mroutes(tgen
, dut
, SOURCE_ADDRESS
, group_address_list
, iif
, oif
)
349 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
351 step("r1: Verify (S, G) upstream IIF interface")
352 result
= verify_upstream_iif(tgen
, dut
, iif
, SOURCE_ADDRESS
, group_address_list
)
353 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
355 step("r1: Verify (S, G) upstream join state and join timer")
356 result
= verify_join_state_and_timer(
357 tgen
, dut
, iif
, SOURCE_ADDRESS
, group_address_list
, addr_type
="ipv6"
359 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
361 step("r2: Verify (*, G) upstream IIF interface")
364 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, group_address_list
)
365 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
367 step("r2: Verify (*, G) upstream join state and join timer")
368 result
= verify_join_state_and_timer(
369 tgen
, dut
, iif
, STAR
, group_address_list
, addr_type
="ipv6"
371 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
373 step("r2: Verify (*, G) ip mroutes")
374 oif
= TOPO
["routers"]["r2"]["links"]["r1"]["interface"]
375 result
= verify_mroutes(tgen
, dut
, STAR
, group_address_list
, iif
, oif
)
376 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
378 step("r3: Verify (S, G) upstream IIF interface")
380 iif
= TOPO
["routers"]["r3"]["links"]["r5"]["interface"]
381 result
= verify_upstream_iif(tgen
, dut
, iif
, SOURCE_ADDRESS
, group_address_list
)
382 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
384 step("r3: Verify (S, G) upstream join state and join timer")
385 result
= verify_join_state_and_timer(
394 assert result
is not True, (
395 "Testcase {} : Failed \n "
396 "r3: (S,G) upstream state is joined and join timer is running\n Error: {}".format(
401 step("r3: Verify (S, G) ip mroutes")
402 oif
= TOPO
["routers"]["r3"]["links"]["r1"]["interface"]
403 result
= verify_mroutes(tgen
, dut
, SOURCE_ADDRESS
, group_address_list
, iif
, oif
)
404 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
406 step("r2: Verify (S, G) upstream IIF interface")
408 iif
= TOPO
["routers"]["r2"]["links"]["r3"]["interface"]
409 result
= verify_upstream_iif(
410 tgen
, dut
, iif
, SOURCE_ADDRESS
, group_address_list
, joinState
="NotJoined"
412 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
414 step("r2: Verify (S, G) upstream join state and join timer")
415 result
= verify_join_state_and_timer(
424 assert result
is not True, (
425 "Testcase {} : Failed \n "
426 "r2: (S,G) upstream state is joined and join timer is running\n Error: {}".format(
431 step("r2: Verify (S, G) ip mroutes")
433 result
= verify_mroutes(tgen
, dut
, SOURCE_ADDRESS
, group_address_list
, iif
, oif
)
434 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
436 step("r1: Delete RP configuration")
442 "rp_addr": TOPO
["routers"]["r2"]["links"]["lo"]["ipv6"].split(
445 "group_addr_range": GROUP_RANGE_3
,
453 result
= create_pim_config(tgen
, TOPO
, input_dict
)
454 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
456 step("r1: Shut the interface r1-r2-eth1 from R1 to R2")
458 intf
= TOPO
["routers"]["r1"]["links"]["r2"]["interface"]
459 shutdown_bringup_interface(tgen
, dut
, intf
, False)
461 step("r1: No Shut the interface r1-r2-eth1 from R1 to R2")
462 shutdown_bringup_interface(tgen
, dut
, intf
, True)
464 step("r1: Configure RP")
470 "rp_addr": TOPO
["routers"]["r2"]["links"]["lo"]["ipv6"].split(
473 "group_addr_range": GROUP_RANGE_3
,
480 result
= create_pim_config(tgen
, TOPO
, input_dict
)
481 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
483 step("r1: Shut the interface r1-r0-eth0 from R1 to R2")
484 intf
= TOPO
["routers"]["r1"]["links"]["r0"]["interface"]
485 shutdown_bringup_interface(tgen
, dut
, intf
, False)
487 step("r1: No Shut the interface r1-r0-eth0 from R1 to R2")
488 shutdown_bringup_interface(tgen
, dut
, intf
, True)
490 step("r1: Verify (*, G) upstream IIF interface")
492 iif
= TOPO
["routers"]["r1"]["links"]["r2"]["interface"]
493 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, group_address_list
)
494 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
496 step("r1: Verify (*, G) upstream join state and join timer")
497 result
= verify_join_state_and_timer(
498 tgen
, dut
, iif
, STAR
, group_address_list
, addr_type
="ipv6"
500 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
502 step("r1: Verify (*, G) ip mroutes")
503 oif
= TOPO
["routers"]["r1"]["links"]["r0"]["interface"]
504 result
= verify_mroutes(tgen
, dut
, STAR
, group_address_list
, iif
, oif
)
505 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
507 step("r1: Verify (S, G) upstream IIF interface")
508 iif
= TOPO
["routers"]["r1"]["links"]["r3"]["interface"]
509 result
= verify_upstream_iif(tgen
, dut
, iif
, SOURCE_ADDRESS
, group_address_list
)
510 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
512 step("r1: Verify (S, G) upstream join state and join timer")
513 result
= verify_join_state_and_timer(
514 tgen
, dut
, iif
, SOURCE_ADDRESS
, group_address_list
, addr_type
="ipv6"
516 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
518 step("r1: Verify (S, G) ip mroutes")
519 result
= verify_mroutes(tgen
, dut
, SOURCE_ADDRESS
, group_address_list
, iif
, oif
)
520 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
522 step("r2: Verify (*, G) upstream IIF interface")
525 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, group_address_list
)
526 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
528 step("r2: Verify (*, G) upstream join state and join timer")
529 result
= verify_join_state_and_timer(
530 tgen
, dut
, iif
, STAR
, group_address_list
, addr_type
="ipv6"
532 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
534 step("r2: Verify (*, G) ip mroutes")
535 oif
= TOPO
["routers"]["r2"]["links"]["r1"]["interface"]
536 result
= verify_mroutes(tgen
, dut
, STAR
, group_address_list
, iif
, oif
)
537 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
539 step("r3: Verify (S, G) upstream IIF interface")
541 iif
= TOPO
["routers"]["r3"]["links"]["r5"]["interface"]
542 result
= verify_upstream_iif(tgen
, dut
, iif
, SOURCE_ADDRESS
, group_address_list
)
543 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
545 step("r3: Verify (S, G) upstream join state and join timer")
546 result
= verify_join_state_and_timer(
555 assert result
is not True, (
556 "Testcase {} : Failed \n "
557 "r3: (S,G) upstream state is joined and join timer is running\n Error: {}".format(
562 step("r3: Verify (S, G) ip mroutes")
563 oif
= TOPO
["routers"]["r3"]["links"]["r1"]["interface"]
564 result
= verify_mroutes(tgen
, dut
, SOURCE_ADDRESS
, group_address_list
, iif
, oif
)
565 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
567 write_test_footer(tc_name
)
570 def test_pim6_multiple_groups_different_RP_address_p2(request
):
572 Verify IIF and OIL in updated in mroute when upstream interface
579 r0-----r1-------------r3-----r5
589 tc_name
= request
.node
.name
590 write_test_header(tc_name
)
592 # Don"t run this test if we have any failure.
593 if tgen
.routers_have_failure():
594 pytest
.skip(tgen
.errors
)
596 step("Creating configuration from JSON")
598 clear_pim6_mroute(tgen
)
599 clear_pim6_interface_traffic(tgen
, TOPO
)
600 reset_config_on_routers(tgen
)
602 step("Enable MLD on r1 interface")
603 step("Enable the PIM6 on all the interfaces of r1, r2, r3 and r4 routers")
604 step("r2: Configure r2 as RP")
605 step("r4: Configure r4 as RP")
611 "rp_addr": TOPO
["routers"]["r2"]["links"]["lo"]["ipv6"].split(
614 "group_addr_range": GROUP_RANGE_LIST_1
,
623 "rp_addr": TOPO
["routers"]["r4"]["links"]["lo"]["ipv6"].split(
626 "group_addr_range": GROUP_RANGE_LIST_2
,
633 result
= create_pim_config(tgen
, TOPO
, input_dict
)
634 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
636 step("r2: Verify RP info")
639 rp_address
= TOPO
["routers"]["r2"]["links"]["lo"]["ipv6"].split("/")[0]
640 result
= verify_pim_rp_info(
641 tgen
, TOPO
, dut
, GROUP_RANGE_LIST_1
, oif
, rp_address
, SOURCE
643 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
645 step("r4: Verify RP info")
647 rp_address
= TOPO
["routers"]["r4"]["links"]["lo"]["ipv6"].split("/")[0]
648 result
= verify_pim_rp_info(
649 tgen
, TOPO
, dut
, GROUP_RANGE_LIST_2
, oif
, rp_address
, SOURCE
651 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
653 group_address_list
= GROUP_ADDRESS_LIST_1
+ GROUP_ADDRESS_LIST_2
654 step("r0: Send MLD join for 10 groups")
655 intf
= TOPO
["routers"]["r0"]["links"]["r1"]["interface"]
656 intf_ip
= TOPO
["routers"]["r0"]["links"]["r1"]["ipv6"].split("/")[0]
657 result
= socat_send_mld_join(
658 tgen
, "r0", "UDP6-RECV", group_address_list
, intf
, intf_ip
660 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
662 step("r1: Verify MLD groups")
664 intf_r1_r0
= TOPO
["routers"]["r1"]["links"]["r0"]["interface"]
665 result
= verify_mld_groups(tgen
, dut
, intf_r1_r0
, group_address_list
)
666 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
668 step("r5: Send multicast traffic for group {}".format(group_address_list
))
669 intf
= TOPO
["routers"]["r5"]["links"]["r3"]["interface"]
670 SOURCE_ADDRESS
= TOPO
["routers"]["r5"]["links"]["r3"]["ipv6"].split("/")[0]
671 result
= socat_send_pim6_traffic(tgen
, "r5", "UDP6-SEND", group_address_list
, intf
)
672 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
674 step("r1: Verify (*, G) upstream IIF interface")
676 iif
= TOPO
["routers"]["r1"]["links"]["r2"]["interface"]
677 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, group_address_list
)
678 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
680 step("r1: Verify (*, G) upstream join state and join timer")
681 result
= verify_join_state_and_timer(
682 tgen
, dut
, iif
, STAR
, group_address_list
, addr_type
="ipv6"
684 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
686 step("r1: Verify (*, G) ip mroutes")
687 oif
= TOPO
["routers"]["r1"]["links"]["r0"]["interface"]
688 result
= verify_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS_LIST_1
, iif
, oif
)
689 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
691 step("r1: Verify (S, G) upstream IIF interface")
692 iif
= TOPO
["routers"]["r1"]["links"]["r3"]["interface"]
693 result
= verify_upstream_iif(tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_1
)
694 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
696 step("r1: Verify (S, G) upstream join state and join timer")
697 result
= verify_join_state_and_timer(
698 tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_1
, addr_type
="ipv6"
700 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
702 step("r1: Verify (S, G) ip mroutes")
703 result
= verify_mroutes(tgen
, dut
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_1
, iif
, oif
)
704 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
706 step("r2: Verify (*, G) upstream IIF interface")
709 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS_LIST_1
)
710 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
712 step("r2: Verify (*, G) upstream join state and join timer")
713 result
= verify_join_state_and_timer(
714 tgen
, dut
, iif
, STAR
, GROUP_ADDRESS_LIST_1
, addr_type
="ipv6"
716 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
718 step("r2: Verify (*, G) ip mroutes")
719 oif
= TOPO
["routers"]["r2"]["links"]["r1"]["interface"]
720 result
= verify_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS_LIST_1
, iif
, oif
)
721 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
723 step("r2: Verify (S, G) upstream IIF interface")
724 iif
= TOPO
["routers"]["r2"]["links"]["r3"]["interface"]
725 result
= verify_upstream_iif(
726 tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_1
, joinState
="NotJoined"
728 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
730 step("r2: Verify (S, G) upstream join state and join timer")
731 result
= verify_join_state_and_timer(
736 GROUP_ADDRESS_LIST_1
,
740 assert result
is not True, (
741 "Testcase {} : Failed \n "
742 "r2: (S,G) upstream state is joined and join timer is running\n Error: {}".format(
747 step("r2: Verify (S, G) ip mroutes")
749 result
= verify_mroutes(tgen
, dut
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_1
, iif
, oif
)
750 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
752 step("r3: Verify (S, G) upstream IIF interface")
754 iif
= TOPO
["routers"]["r3"]["links"]["r5"]["interface"]
755 result
= verify_upstream_iif(tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_1
)
756 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
758 step("r3: Verify (S, G) upstream join state and join timer")
759 result
= verify_join_state_and_timer(
764 GROUP_ADDRESS_LIST_1
,
768 assert result
is not True, (
769 "Testcase {} : Failed \n "
770 "r3: (S,G) upstream state is joined and join timer is running\n Error: {}".format(
775 step("r3: Verify (S, G) ip mroutes")
776 oif
= TOPO
["routers"]["r3"]["links"]["r1"]["interface"]
777 result
= verify_mroutes(tgen
, dut
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_1
, iif
, oif
)
778 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
780 step("r1: Verify (*, G) upstream IIF interface")
782 iif
= TOPO
["routers"]["r1"]["links"]["r4"]["interface"]
783 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS_LIST_2
)
784 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
786 step("r1: Verify (*, G) upstream join state and join timer")
787 result
= verify_join_state_and_timer(
788 tgen
, dut
, iif
, STAR
, GROUP_ADDRESS_LIST_2
, addr_type
="ipv6"
790 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
792 step("r1: Verify (*, G) ip mroutes")
793 oif
= TOPO
["routers"]["r1"]["links"]["r0"]["interface"]
794 result
= verify_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS_LIST_2
, iif
, oif
)
795 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
797 step("r1: Verify (S, G) upstream IIF interface")
798 iif
= TOPO
["routers"]["r1"]["links"]["r3"]["interface"]
799 result
= verify_upstream_iif(tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_2
)
800 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
802 step("r1: Verify (S, G) upstream join state and join timer")
803 result
= verify_join_state_and_timer(
804 tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_2
, addr_type
="ipv6"
806 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
808 step("r1: Verify (S, G) ip mroutes")
809 result
= verify_mroutes(tgen
, dut
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_2
, iif
, oif
)
810 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
812 step("r4: Verify (*, G) upstream IIF interface")
815 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS_LIST_2
)
816 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
818 step("r4: Verify (*, G) upstream join state and join timer")
819 result
= verify_join_state_and_timer(
820 tgen
, dut
, iif
, STAR
, GROUP_ADDRESS_LIST_2
, addr_type
="ipv6"
822 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
824 step("r4: Verify (*, G) ip mroutes")
825 oif
= TOPO
["routers"]["r4"]["links"]["r1"]["interface"]
826 result
= verify_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS_LIST_2
, iif
, oif
)
827 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
829 step("r4: Verify (S, G) upstream IIF interface")
830 iif
= TOPO
["routers"]["r4"]["links"]["r3"]["interface"]
831 result
= verify_upstream_iif(
832 tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_2
, joinState
="NotJoined"
834 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
836 step("r4: Verify (S, G) upstream join state and join timer")
837 result
= verify_join_state_and_timer(
842 GROUP_ADDRESS_LIST_2
,
846 assert result
is not True, (
847 "Testcase {} : Failed \n "
848 "r4: (S,G) upstream state is joined and join timer is running\n Error: {}".format(
853 step("r4: Verify (S, G) ip mroutes")
855 result
= verify_mroutes(tgen
, dut
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_2
, iif
, oif
)
856 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
858 step("r3: Verify (S, G) upstream IIF interface")
860 iif
= TOPO
["routers"]["r3"]["links"]["r5"]["interface"]
861 result
= verify_upstream_iif(tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_2
)
862 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
864 step("r3: Verify (S, G) upstream join state and join timer")
865 result
= verify_join_state_and_timer(
870 GROUP_ADDRESS_LIST_2
,
874 assert result
is not True, "Testcase {} :Failed \n Error: {}".format(
878 step("r3: Verify (S, G) ip mroutes")
879 oif
= TOPO
["routers"]["r3"]["links"]["r1"]["interface"]
880 result
= verify_mroutes(tgen
, dut
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_2
, iif
, oif
)
881 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
883 step("Delete RP configuration")
889 "rp_addr": TOPO
["routers"]["r2"]["links"]["lo"]["ipv6"].split(
892 "group_addr_range": GROUP_RANGE_LIST_1
,
902 "rp_addr": TOPO
["routers"]["r4"]["links"]["lo"]["ipv6"].split(
905 "group_addr_range": GROUP_RANGE_LIST_2
,
913 result
= create_pim_config(tgen
, TOPO
, input_dict
)
914 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
916 step("r1, r2, r3, r4: Re-configure RP")
922 "rp_addr": TOPO
["routers"]["r2"]["links"]["lo"]["ipv6"].split(
925 "group_addr_range": GROUP_RANGE_LIST_1
,
934 "rp_addr": TOPO
["routers"]["r4"]["links"]["lo"]["ipv6"].split(
937 "group_addr_range": GROUP_RANGE_LIST_2
,
944 result
= create_pim_config(tgen
, TOPO
, input_dict
)
945 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
947 step("r1: Shut/No Shut the interfacesfrom R1 to R2, R4 and R0")
949 intf1
= TOPO
["routers"]["r1"]["links"]["r2"]["interface"]
950 intf2
= TOPO
["routers"]["r1"]["links"]["r4"]["interface"]
951 intf3
= TOPO
["routers"]["r1"]["links"]["r0"]["interface"]
952 for intf
in [intf1
, intf2
, intf3
]:
953 shutdown_bringup_interface(tgen
, dut
, intf
, False)
954 shutdown_bringup_interface(tgen
, dut
, intf
, True)
956 step("r1: Verify (*, G) upstream IIF interface")
958 iif
= TOPO
["routers"]["r1"]["links"]["r2"]["interface"]
959 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS_LIST_1
)
960 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
962 step("r1: Verify (*, G) upstream join state and join timer")
963 result
= verify_join_state_and_timer(
964 tgen
, dut
, iif
, STAR
, GROUP_ADDRESS_LIST_1
, addr_type
="ipv6"
966 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
968 step("r1: Verify (*, G) ip mroutes")
969 oif
= TOPO
["routers"]["r1"]["links"]["r0"]["interface"]
970 result
= verify_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS_LIST_1
, iif
, oif
)
971 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
973 step("r1: Verify (S, G) upstream IIF interface")
974 iif
= TOPO
["routers"]["r1"]["links"]["r3"]["interface"]
975 result
= verify_upstream_iif(tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_1
)
976 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
978 step("r1: Verify (S, G) upstream join state and join timer")
979 result
= verify_join_state_and_timer(
980 tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_1
, addr_type
="ipv6"
982 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
984 step("r1: Verify (S, G) ip mroutes")
985 result
= verify_mroutes(tgen
, dut
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_1
, iif
, oif
)
986 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
988 step("r2: Verify (*, G) upstream IIF interface")
991 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS_LIST_1
)
992 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
994 step("r2: Verify (*, G) upstream join state and join timer")
995 result
= verify_join_state_and_timer(
996 tgen
, dut
, iif
, STAR
, GROUP_ADDRESS_LIST_1
, addr_type
="ipv6"
998 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
1000 step("r2: Verify (*, G) ip mroutes")
1001 oif
= TOPO
["routers"]["r2"]["links"]["r1"]["interface"]
1002 result
= verify_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS_LIST_1
, iif
, oif
)
1003 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
1005 step("r2: Verify (S, G) upstream IIF interface")
1006 iif
= TOPO
["routers"]["r2"]["links"]["r3"]["interface"]
1007 result
= verify_upstream_iif(
1008 tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_1
, joinState
="NotJoined"
1010 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
1012 step("r2: Verify (S, G) upstream join state and join timer")
1013 result
= verify_join_state_and_timer(
1018 GROUP_ADDRESS_LIST_1
,
1022 assert result
is not True, (
1023 "Testcase {} : Failed \n "
1024 "r2: (S,G) upstream state is joined and join timer is running\n Error: {}".format(
1029 step("r2: Verify (S, G) ip mroutes")
1031 result
= verify_mroutes(tgen
, dut
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_1
, iif
, oif
)
1032 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
1034 step("r3: Verify (S, G) upstream IIF interface")
1036 iif
= TOPO
["routers"]["r3"]["links"]["r5"]["interface"]
1037 result
= verify_upstream_iif(tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_1
)
1038 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
1040 step("r3: Verify (S, G) upstream join state and join timer")
1041 result
= verify_join_state_and_timer(
1046 GROUP_ADDRESS_LIST_1
,
1050 assert result
is not True, (
1051 "Testcase {} : Failed \n "
1052 "r3: (S,G) upstream state is joined and join timer is running\n Error: {}".format(
1057 step("r3: Verify (S, G) ip mroutes")
1058 oif
= TOPO
["routers"]["r3"]["links"]["r1"]["interface"]
1059 result
= verify_mroutes(tgen
, dut
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_1
, iif
, oif
)
1060 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
1062 step("r1: Verify (*, G) upstream IIF interface")
1064 iif
= TOPO
["routers"]["r1"]["links"]["r4"]["interface"]
1065 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS_LIST_2
)
1066 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
1068 step("r1: Verify (*, G) upstream join state and join timer")
1069 result
= verify_join_state_and_timer(
1070 tgen
, dut
, iif
, STAR
, GROUP_ADDRESS_LIST_2
, addr_type
="ipv6"
1072 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
1074 step("r1: Verify (*, G) ip mroutes")
1075 oif
= TOPO
["routers"]["r1"]["links"]["r0"]["interface"]
1076 result
= verify_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS_LIST_2
, iif
, oif
)
1077 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
1079 step("r1: Verify (S, G) upstream IIF interface")
1080 iif
= TOPO
["routers"]["r1"]["links"]["r3"]["interface"]
1081 result
= verify_upstream_iif(tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_2
)
1082 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
1084 step("r1: Verify (S, G) upstream join state and join timer")
1085 result
= verify_join_state_and_timer(
1086 tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_2
, addr_type
="ipv6"
1088 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
1090 step("r1: Verify (S, G) ip mroutes")
1091 result
= verify_mroutes(tgen
, dut
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_2
, iif
, oif
)
1092 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
1094 step("r4: Verify (*, G) upstream IIF interface")
1097 result
= verify_upstream_iif(tgen
, dut
, iif
, STAR
, GROUP_ADDRESS_LIST_2
)
1098 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
1100 step("r4: Verify (*, G) upstream join state and join timer")
1101 result
= verify_join_state_and_timer(
1102 tgen
, dut
, iif
, STAR
, GROUP_ADDRESS_LIST_2
, addr_type
="ipv6"
1104 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
1106 step("r4: Verify (*, G) ip mroutes")
1107 oif
= TOPO
["routers"]["r4"]["links"]["r1"]["interface"]
1108 result
= verify_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS_LIST_2
, iif
, oif
)
1109 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
1111 step("r4: Verify (S, G) upstream IIF interface")
1112 iif
= TOPO
["routers"]["r4"]["links"]["r3"]["interface"]
1113 result
= verify_upstream_iif(
1114 tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_2
, joinState
="NotJoined"
1116 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
1118 step("r4: Verify (S, G) upstream join state and join timer")
1119 result
= verify_join_state_and_timer(
1124 GROUP_ADDRESS_LIST_2
,
1128 assert result
is not True, (
1129 "Testcase {} : Failed \n "
1130 "r4: (S,G) upstream state is joined and join timer is running\n Error: {}".format(
1135 step("r4: Verify (S, G) ip mroutes")
1137 result
= verify_mroutes(tgen
, dut
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_2
, iif
, oif
)
1138 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
1140 step("r3: Verify (S, G) upstream IIF interface")
1142 iif
= TOPO
["routers"]["r3"]["links"]["r5"]["interface"]
1143 result
= verify_upstream_iif(tgen
, dut
, iif
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_2
)
1144 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
1146 step("r3: Verify (S, G) upstream join state and join timer")
1147 result
= verify_join_state_and_timer(
1152 GROUP_ADDRESS_LIST_2
,
1156 assert result
is not True, (
1157 "Testcase {} : Failed \n "
1158 "r3: (S,G) upstream state is joined and join timer is running\n Error: {}".format(
1163 step("r3: Verify (S, G) ip mroutes")
1164 oif
= TOPO
["routers"]["r3"]["links"]["r1"]["interface"]
1165 result
= verify_mroutes(tgen
, dut
, SOURCE_ADDRESS
, GROUP_ADDRESS_LIST_2
, iif
, oif
)
1166 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
1168 write_test_footer(tc_name
)
1171 def test_pim6_delete_RP_shut_noshut_upstream_interface_p1(request
):
1173 Verify RP info and (*,G) mroute after deleting the RP and shut /
1174 no shut the RPF interface.
1180 r0-----r1-------------r3
1183 tgen
= get_topogen()
1184 tc_name
= request
.node
.name
1185 write_test_header(tc_name
)
1187 # Don"t run this test if we have any failure.
1188 if tgen
.routers_have_failure():
1189 pytest
.skip(tgen
.errors
)
1191 step("Creating configuration from JSON")
1193 clear_pim6_mroute(tgen
)
1194 clear_pim6_interface_traffic(tgen
, TOPO
)
1195 reset_config_on_routers(tgen
)
1197 step("Enable MLD on r1 interface")
1198 step("Enable the PIM6 on all the interfaces of r1, r2, r3 and r4 routers")
1199 step("r2: Configure r2 as RP")
1205 "rp_addr": TOPO
["routers"]["r2"]["links"]["lo"]["ipv6"].split(
1208 "group_addr_range": GROUP_RANGE_1
,
1215 result
= create_pim_config(tgen
, TOPO
, input_dict
)
1216 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1218 step("r2: verify rp-info")
1221 rp_address
= TOPO
["routers"]["r2"]["links"]["lo"]["ipv6"].split("/")[0]
1222 result
= verify_pim_rp_info(
1223 tgen
, TOPO
, dut
, GROUP_ADDRESS_1
, oif
, rp_address
, SOURCE
1225 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
1227 step("r0: Send MLD join")
1228 intf
= TOPO
["routers"]["r0"]["links"]["r1"]["interface"]
1229 intf_ip
= TOPO
["routers"]["r0"]["links"]["r1"]["ipv6"].split("/")[0]
1230 result
= socat_send_mld_join(
1231 tgen
, "r0", "UDP6-RECV", GROUP_ADDRESS_1
, intf
, intf_ip
1233 assert result
is True, "Testcase {}: Failed Error: {}".format(tc_name
, result
)
1235 step("r1: Verify MLD groups")
1237 intf_r1_r0
= TOPO
["routers"]["r1"]["links"]["r0"]["interface"]
1238 result
= verify_mld_groups(tgen
, dut
, intf_r1_r0
, GROUP_ADDRESS_1
)
1239 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
1241 step("r1: Verify (*, G) ip mroutes created")
1242 iif
= TOPO
["routers"]["r1"]["links"]["r2"]["interface"]
1243 oif
= TOPO
["routers"]["r1"]["links"]["r0"]["interface"]
1244 result
= verify_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS_1
, iif
, oif
)
1245 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
1247 step("r2: Verify (*, G) ip mroutes created")
1250 oif
= TOPO
["routers"]["r2"]["links"]["r1"]["interface"]
1251 result
= verify_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS_1
, iif
, oif
)
1252 assert result
is True, ASSERT_MSG
.format(tc_name
, result
)
1254 step("r1: Delete RP configuration")
1260 "rp_addr": TOPO
["routers"]["r2"]["links"]["lo"]["ipv6"].split(
1263 "group_addr_range": GROUP_RANGE_1
,
1271 result
= create_pim_config(tgen
, TOPO
, input_dict
)
1272 assert result
is True, "Testcase {} : Failed Error: {}".format(tc_name
, result
)
1274 step("r1: Shut/No Shut the interface r1-r2-eth1/r1-r0-eth0 from R1 to R2")
1276 intf1
= TOPO
["routers"]["r1"]["links"]["r2"]["interface"]
1277 intf2
= TOPO
["routers"]["r1"]["links"]["r0"]["interface"]
1278 for intf
in [intf1
, intf2
]:
1279 shutdown_bringup_interface(tgen
, dut
, intf
, False)
1280 shutdown_bringup_interface(tgen
, dut
, intf
, True)
1282 step("r2: Shut the RP interface lo")
1285 shutdown_bringup_interface(tgen
, dut
, intf
, False)
1287 step("r1: Shut the interface r1-r2-eth1/r1-r3-eth2 towards RP")
1288 intf3
= TOPO
["routers"]["r1"]["links"]["r3"]["interface"]
1289 for intf
in [intf1
, intf3
]:
1290 shutdown_bringup_interface(tgen
, dut
, intf
, False)
1292 step("r1: Verify (*, G) ip mroutes cleared")
1294 iif
= TOPO
["routers"]["r1"]["links"]["r2"]["interface"]
1295 oif
= TOPO
["routers"]["r1"]["links"]["r0"]["interface"]
1296 result
= verify_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS_1
, iif
, oif
, expected
=False)
1297 assert result
is not True, (
1298 "Testcase {} : Failed \n "
1299 "r1: (*,G) mroutes are not cleared after shut of R1 to R0 link\n Error: {}".format(
1304 step("r2: Verify (*, G) ip mroutes cleared")
1307 oif
= TOPO
["routers"]["r2"]["links"]["r1"]["interface"]
1308 result
= verify_mroutes(tgen
, dut
, STAR
, GROUP_ADDRESS_1
, iif
, oif
, expected
=False)
1309 assert result
is not True, (
1310 "Testcase {} : Failed \n "
1311 "r2: (*,G) mroutes are not cleared after shut of R1 to R0 link\n Error: {}".format(
1316 write_test_footer(tc_name
)
1319 if __name__
== "__main__":
1320 args
= ["-s"] + sys
.argv
[1:]
1321 sys
.exit(pytest
.main(args
))