]> git.proxmox.com Git - mirror_frr.git/blame - tests/topotests/multicast_pim_static_rp_topo1/test_multicast_pim_static_rp1.py
tests: [topojson]Update assert/error messages
[mirror_frr.git] / tests / topotests / multicast_pim_static_rp_topo1 / test_multicast_pim_static_rp1.py
CommitLineData
676fa219
DS
1#!/usr/bin/env python
2
3#
4# Copyright (c) 2019 by VMware, Inc. ("VMware")
5# Used Copyright (c) 2018 by Network Device Education Foundation,
6# Inc. ("NetDEF") in this file.
7#
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
11# in all copies.
12#
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
20# OF THIS SOFTWARE.
21#
22
23"""
24Following tests are covered to test Multicast basic functionality:
25
26Topology:
27
28 _______r2_____
29 | |
30 iperf | | iperf
31 r0-----r1-------------r3-----r5
32 | |
33 |_____________|
34 r4
35
36Test steps
37- Create topology (setup module)
38- Bring up topology
39
40TC_1 : Verify upstream interfaces(IIF) and join state are updated properly
41 after adding and deleting the static RP
42TC_2 : Verify IIF and OIL in "show ip pim state" updated properly after
43 adding and deleting the static RP
44TC_3: (*, G) Mroute entry are cleared when static RP gets deleted
45TC_4: Verify (*,G) prune is send towards the RP after deleting the static RP
46TC_5: Verify OIF entry for RP is cleared when RP becomes unreachable
47TC_6: Verify IIF and OIL in "show ip pim state" updated properly when RP
48 becomes unreachable
49TC_7 : Verify upstream interfaces(IIF) and join state are updated properly
50 after adding and deleting the static RP
51TC_8: Verify (*,G) prune is send towards the RP when RP becomes unreachable
52TC_9 : Verify RP configured after IGMP join received, PIM join towards RP is
53 sent immediately
54TC_10 : Verify RP becomes reachable after IGMP join received, PIM join
55 towards RP is sent immediately
56TC_11 : Verify PIM join send towards the higher preferred RP
57TC_12 : Verify PIM prune send towards the lower preferred RP
58TC_13 : Verify RPF interface is updated in mroute (kernel) when higher
59 preferred overlapping RP configured
60TC_14 : Verify IIF and OIL in "show ip pim state" updated properly when higher
61 preferred overlapping RP configured
62TC_15 : Verify upstream interfaces(IIF) and join state are updated when higher
63 preferred overlapping RP is configured
64TC_16 : Verify join is send to lower preferred RP, when higher preferred RP
65 gets deleted
66TC_17 : Verify prune is send to higher preferred RP when higher preferred RP
67 gets deleted
68TC_18 : Verify RPF interface updated in mroute when higher preferred RP gets
69 deleted
70TC_19 : Verify IIF and OIL in "show ip pim state" updated when higher
71 preferred overlapping RP is deleted
72TC_20 : Verify PIM upstream IIF updated when higher preferred overlapping RP
73 deleted
74TC_21_1 : Verify OIF and RFP for (*,G) and (S,G) when static RP configure in
75 LHR router
76TC_21_2 : Verify OIF and RFP for (*,G) and (S,G) when static RP configure in
77 LHR router
78TC_22_1 : Verify OIF and RPF for (*,G) and (S,G) when static RP configure in
79 FHR router
80TC_22_2 : Verify OIF and RPF for (*,G) and (S,G) when static RP configure in
81 FHR router
82TC_23 : Verify (*,G) and (S,G) populated correctly when RPT and SPT path are
83 different
84TC_24 : Verify (*,G) and (S,G) populated correctly when SPT and RPT share the
85 same path
86TC_25 : Verify (*,G) and (S,G) populated correctly after clearing the PIM ,
87 IGMP and mroutes joins
88TC_26 : Restart the PIMd process and verify PIM joins , and mroutes entries
89TC_27 : Configure multiple groups (10 grps) with same RP address
90TC_28 : Configure multiple groups (10 grps) with different RP address
91TC_29 : Verify IIF and OIL in updated in mroute when upstream interface
92 configure as RP
93TC_30 : Verify IIF and OIL change to other path after shut the primary path
94TC_31 : Verify RP info and (*,G) mroute after deleting the RP and shut / no
95 shut the RPF interface.
96TC_32 : Verify RP info and (*,G) mroute after deleting the RP and shut / no
97 shut the RPF interface
98"""
99
100import os
101import sys
102import time
103from time import sleep
104import datetime
105import pytest
106
107# Save the Current Working Directory to find configuration files.
108CWD = os.path.dirname(os.path.realpath(__file__))
109sys.path.append(os.path.join(CWD, "../"))
110sys.path.append(os.path.join(CWD, "../lib/"))
111
112# Required to instantiate the topology builder class.
113
114# pylint: disable=C0413
115# Import topogen and topotest helpers
116
117from lib.topogen import Topogen, get_topogen
118from lib.topolog import logger
119from lib.topojson import build_topo_from_json, build_config_from_json
120
121from lib.common_config import (
122 start_topology,
123 write_test_header,
124 write_test_footer,
125 reset_config_on_routers,
126 step,
127 shutdown_bringup_interface,
128 kill_router_daemons,
129 start_router_daemons,
130 create_static_routes,
676fa219
DS
131)
132from lib.pim import (
133 create_pim_config,
134 verify_igmp_groups,
135 verify_upstream_iif,
136 verify_join_state_and_timer,
137 verify_mroutes,
138 verify_pim_neighbors,
139 get_pim_interface_traffic,
140 verify_pim_rp_info,
141 verify_pim_state,
142 clear_pim_interface_traffic,
143 clear_igmp_interfaces,
144 clear_pim_interfaces,
145 clear_mroute,
146 clear_mroute_verify,
147 McastTesterHelper,
148)
149
150pytestmark = [pytest.mark.pimd, pytest.mark.staticd]
151
152
153# Global variables
154GROUP_RANGE_ALL = "224.0.0.0/4"
155GROUP_RANGE = "225.1.1.1/32"
156GROUP_RANGE_LIST_1 = [
157 "225.1.1.1/32",
158 "225.1.1.2/32",
159 "225.1.1.3/32",
160 "225.1.1.4/32",
161 "225.1.1.5/32",
162]
163GROUP_RANGE_LIST_2 = [
164 "225.1.1.6/32",
165 "225.1.1.7/32",
166 "225.1.1.8/32",
167 "225.1.1.9/32",
168 "225.1.1.10/32",
169]
170GROUP_ADDRESS = "225.1.1.1"
171GROUP_ADDRESS_LIST_1 = ["225.1.1.1", "225.1.1.2", "225.1.1.3", "225.1.1.4", "225.1.1.5"]
172GROUP_ADDRESS_LIST_2 = [
173 "225.1.1.6",
174 "225.1.1.7",
175 "225.1.1.8",
176 "225.1.1.9",
177 "225.1.1.10",
178]
179STAR = "*"
180SOURCE_ADDRESS = "10.0.6.2"
181SOURCE = "Static"
182
183
184def build_topo(tgen):
185 """Build function"""
186
187 # Building topology from json file
188 build_topo_from_json(tgen, TOPO)
189
190
191def setup_module(mod):
192 """
193 Sets up the pytest environment
194
195 * `mod`: module name
196 """
197
198 testsuite_run_time = time.asctime(time.localtime(time.time()))
199 logger.info("Testsuite start time: %s", testsuite_run_time)
200 logger.info("=" * 40)
201
202 topology = """
203
204 _______r2_____
205 | |
206 iperf | | iperf
207 r0-----r1-------------r3-----r5
208 | |
209 |_____________|
210 r4
211
212 """
213 logger.info("Master Topology: \n %s", topology)
214
215 logger.info("Running setup_module to create topology")
216
217 # This function initiates the topology build with Topogen...
218 json_file = "{}/multicast_pim_static_rp.json".format(CWD)
219 tgen = Topogen(json_file, mod.__name__)
220 global TOPO
221 TOPO = tgen.json_topo
222
223 # ... and here it calls Mininet initialization functions.
224
676fa219
DS
225 # Starting topology, create tmp files which are loaded to routers
226 # to start daemons and then start routers
991a971f 227 start_topology(tgen)
676fa219
DS
228
229 # Don"t run this test if we have any failure.
230 if tgen.routers_have_failure():
231 pytest.skip(tgen.errors)
232
233 # Creating configuration from JSON
234 build_config_from_json(tgen, TOPO)
235
236 # Verify PIM neighbors
237 result = verify_pim_neighbors(tgen, TOPO)
238 assert result is True, "setup_module :Failed \n Error:" " {}".format(result)
239
240 # XXX Replace this using "with McastTesterHelper()... " in each test if possible.
241 global app_helper
242 app_helper = McastTesterHelper(tgen)
243
244 logger.info("Running setup_module() done")
245
246
247def teardown_module():
248 """Teardown the pytest environment"""
249
250 logger.info("Running teardown_module to delete topology")
251
252 tgen = get_topogen()
253
254 app_helper.cleanup()
255
256 # Stop toplogy and Remove tmp files
257 tgen.stop_topology()
258
259 logger.info("Testsuite end time: %s", time.asctime(time.localtime(time.time())))
260 logger.info("=" * 40)
261
262
263#####################################################
264#
265# Testcases
266#
267#####################################################
268
269
270def verify_mroute_repopulated(uptime_before, uptime_after):
271 """
272 API to compare uptime for mroutes
273
274 Parameters
275 ----------
276 * `uptime_before` : Uptime dictionary for any particular instance
277 * `uptime_after` : Uptime dictionary for any particular instance
278 """
279
280 for group in uptime_before.keys():
281 for source in uptime_before[group].keys():
282 if set(uptime_before[group]) != set(uptime_after[group]):
283 errormsg = (
284 "mroute (%s, %s) has not come"
285 " up after mroute clear [FAILED!!]" % (source, group)
286 )
287 return errormsg
288
289 d_1 = datetime.datetime.strptime(uptime_before[group][source], "%H:%M:%S")
290 d_2 = datetime.datetime.strptime(uptime_after[group][source], "%H:%M:%S")
291 if d_2 >= d_1:
292 errormsg = "mroute (%s, %s) is not " "repopulated [FAILED!!]" % (
293 source,
294 group,
295 )
296 return errormsg
297
298 logger.info("mroute (%s, %s) is " "repopulated [PASSED!!]", source, group)
299
300 return True
301
302
303def verify_state_incremented(state_before, state_after):
304 """
305 API to compare interface traffic state incrementing
306
307 Parameters
308 ----------
309 * `state_before` : State dictionary for any particular instance
310 * `state_after` : State dictionary for any particular instance
311 """
312
313 for router, state_data in state_before.items():
314 for state, _ in state_data.items():
315 if state_before[router][state] >= state_after[router][state]:
316 errormsg = (
317 "[DUT: %s]: state %s value has not"
318 " incremented, Initial value: %s, "
319 "Current value: %s [FAILED!!]"
320 % (
321 router,
322 state,
323 state_before[router][state],
324 state_after[router][state],
325 )
326 )
327 return errormsg
328
329 logger.info(
330 "[DUT: %s]: State %s value is "
331 "incremented, Initial value: %s, Current value: %s"
332 " [PASSED!!]",
333 router,
334 state,
335 state_before[router][state],
336 state_after[router][state],
337 )
338
339 return True
340
341
342def test_RP_configured_as_LHR_1_p1(request):
343 """
344 TC_21_1_P1: Verify OIF and RPF for (*,G) and (S,G) when static RP configure
345 in LHR router
346
347 Topology used:
348 ________r2_____
349 | |
350 iperf | | iperf
351 r0-----r1-------------r3-----r5
352
353 r1 : LHR/RP
354 r3 : FHR
355 """
356
357 tgen = get_topogen()
358 tc_name = request.node.name
359 write_test_header(tc_name)
360
361 # Don"t run this test if we have any failure.
362 if tgen.routers_have_failure():
363 pytest.skip(tgen.errors)
364
365 step("Creating configuration from JSON")
366 reset_config_on_routers(tgen)
367 app_helper.stop_all_hosts()
368 clear_mroute(tgen)
369 clear_pim_interface_traffic(tgen, TOPO)
370
371 step("Enable IGMP on r1 interface")
372 step("Configure RP on r1 (loopback interface) for the group range" " 224.0.0.0/4")
373 step("Enable the PIM on all the interfaces of r1, r2, r3 and r4 routers")
374 step("Send the IGMP join from r0")
375 step("Send multicast traffic from r5")
376
377 step("r1 , r2, r3, r4: Delete existing RP configuration" "configure r1(LHR) as RP")
378 input_dict = {
379 "r1": {
380 "pim": {
381 "rp": [
382 {
383 "rp_addr": "1.0.2.17",
384 "group_addr_range": GROUP_RANGE_ALL,
385 "delete": True,
386 }
387 ]
388 }
389 },
390 "r2": {
391 "pim": {
392 "rp": [
393 {
394 "rp_addr": "1.0.2.17",
395 "group_addr_range": GROUP_RANGE_ALL,
396 "delete": True,
397 }
398 ]
399 }
400 },
401 "r3": {
402 "pim": {
403 "rp": [
404 {
405 "rp_addr": "1.0.2.17",
406 "group_addr_range": GROUP_RANGE_ALL,
407 "delete": True,
408 }
409 ]
410 }
411 },
412 "r4": {
413 "pim": {
414 "rp": [
415 {
416 "rp_addr": "1.0.2.17",
417 "group_addr_range": GROUP_RANGE_ALL,
418 "delete": True,
419 }
420 ]
421 }
422 },
423 }
424
425 result = create_pim_config(tgen, TOPO, input_dict)
426 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
427
428 step("r1: Configure r1(LHR) as RP")
429 input_dict = {
430 "r1": {
431 "pim": {
432 "rp": [
433 {
434 "rp_addr": "1.0.1.17",
435 "group_addr_range": GROUP_RANGE_ALL,
436 }
437 ]
438 }
439 },
440 "r2": {
441 "pim": {
442 "rp": [
443 {
444 "rp_addr": "1.0.1.17",
445 "group_addr_range": GROUP_RANGE_ALL,
446 }
447 ]
448 }
449 },
450 "r3": {
451 "pim": {
452 "rp": [
453 {
454 "rp_addr": "1.0.1.17",
455 "group_addr_range": GROUP_RANGE_ALL,
456 }
457 ]
458 }
459 },
460 "r4": {
461 "pim": {
462 "rp": [
463 {
464 "rp_addr": "1.0.1.17",
465 "group_addr_range": GROUP_RANGE_ALL,
466 }
467 ]
468 }
469 },
470 }
471
472 result = create_pim_config(tgen, TOPO, input_dict)
473 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
474
475 shutdown_bringup_interface(tgen, "r1", "lo", False)
476 sleep(5)
477 shutdown_bringup_interface(tgen, "r1", "lo", True)
478 sleep(5)
479
480 step("r1: Verify RP info")
481 dut = "r1"
482 rp_address = "1.0.1.17"
483 iif = "lo"
484 result = verify_pim_rp_info(
485 tgen, TOPO, dut, GROUP_RANGE_ALL, iif, rp_address, SOURCE
486 )
487 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
488
489 step("r0: Send IGMP join")
490 result = app_helper.run_join("r0", GROUP_ADDRESS, "r1")
491 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
492
493 step("r1: Verify IGMP groups")
494 oif = "r1-r0-eth0"
495 result = verify_igmp_groups(tgen, dut, oif, GROUP_ADDRESS)
496 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
497
498 step("r5: Send multicast traffic for group 225.1.1.1")
499 result = app_helper.run_traffic("r5", GROUP_ADDRESS, "r3")
500 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
501
502 step("r1: Verify (*, G) upstream IIF interface")
503 result = verify_upstream_iif(tgen, dut, iif, STAR, GROUP_ADDRESS)
504 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
505
506 step("r1: Verify (*, G) upstream join state and join timer")
507 result = verify_join_state_and_timer(tgen, dut, iif, STAR, GROUP_ADDRESS)
508 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
509
510 step("r1: Verify (*, G) ip mroutes")
511 result = verify_mroutes(tgen, dut, STAR, GROUP_ADDRESS, iif, oif)
512 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
513
514 step("r1: Verify (S, G) upstream IIF interface")
515 iif = "r1-r3-eth2"
516 result = verify_upstream_iif(tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS)
517 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
518
519 step("r1: Verify (S, G) upstream join state and join timer")
520 result = verify_join_state_and_timer(tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS)
521 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
522
523 step("r1: Verify (S, G) ip mroutes")
524 result = verify_mroutes(tgen, dut, SOURCE_ADDRESS, GROUP_ADDRESS, iif, oif)
525 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
526
527 step("r3: Verify (S, G) upstream IIF interface")
528 dut = "r3"
529 iif = "r3-r5-eth3"
530 result = verify_upstream_iif(tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS)
531 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
532
533 step("r3: Verify (S, G) upstream join state and join timer")
534 result = verify_join_state_and_timer(
535 tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS, expected=False
536 )
537 assert result is not True, (
538 "Testcase {} : Failed \n "
db726bb8
KK
539 "Expected: [{}]: Upstream Join State should not be Joined and "
540 "join timer should not run\n "
541 "Found: {}".format(tc_name, dut, result)
676fa219
DS
542 )
543
544 step("r3: Verify (S, G) ip mroutes")
545 oif = "r3-r1-eth0"
546 result = verify_mroutes(tgen, dut, SOURCE_ADDRESS, GROUP_ADDRESS, iif, oif)
547 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
548
549 # Uncomment next line for debugging
550 # tgen.mininet_cli()
551
552 write_test_footer(tc_name)
553
554
555def test_RP_configured_as_LHR_2_p1(request):
556 """
557 TC_21_2_P1: Verify OIF and RPF for (*,G) and (S,G) when static RP configure
558 in LHR router
559
560 Topology used:
561 ________r2_____
562 | |
563 iperf | | iperf
564 r0-----r1-------------r3-----r5
565
566 r1 : LHR/RP
567 r3 : FHR
568
569 """
570 tgen = get_topogen()
571 tc_name = request.node.name
572 write_test_header(tc_name)
573
574 # Don"t run this test if we have any failure.
575 if tgen.routers_have_failure():
576 pytest.skip(tgen.errors)
577
578 step("Creating configuration from JSON")
579 reset_config_on_routers(tgen)
580 app_helper.stop_all_hosts()
581 clear_mroute(tgen)
582 clear_pim_interface_traffic(tgen, TOPO)
583
584 step("Enable IGMP on r1 interface")
585 step("Configure RP on r1 (loopback interface) for the group range" " 224.0.0.0/4")
586 step("Enable the PIM on all the interfaces of r1, r2, r3 and r4 routers")
587 step("Send multicast traffic from r5")
588 step("Send the IGMP join from r0")
589
590 step("r1, r2, r3, r4: Delete existing RP configuration," "configure r1(LHR) as RP")
591 input_dict = {
592 "r1": {
593 "pim": {
594 "rp": [
595 {
596 "rp_addr": "1.0.2.17",
597 "group_addr_range": GROUP_RANGE_ALL,
598 "delete": True,
599 }
600 ]
601 }
602 },
603 "r2": {
604 "pim": {
605 "rp": [
606 {
607 "rp_addr": "1.0.2.17",
608 "group_addr_range": GROUP_RANGE_ALL,
609 "delete": True,
610 }
611 ]
612 }
613 },
614 "r3": {
615 "pim": {
616 "rp": [
617 {
618 "rp_addr": "1.0.2.17",
619 "group_addr_range": GROUP_RANGE_ALL,
620 "delete": True,
621 }
622 ]
623 }
624 },
625 "r4": {
626 "pim": {
627 "rp": [
628 {
629 "rp_addr": "1.0.2.17",
630 "group_addr_range": GROUP_RANGE_ALL,
631 "delete": True,
632 }
633 ]
634 }
635 },
636 }
637
638 result = create_pim_config(tgen, TOPO, input_dict)
639 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
640
641 step("r1, r2, r3, r4: Configure r1(LHR) as RP")
642 input_dict = {
643 "r1": {
644 "pim": {
645 "rp": [
646 {
647 "rp_addr": "1.0.1.17",
648 "group_addr_range": GROUP_RANGE_ALL,
649 }
650 ]
651 }
652 },
653 "r2": {
654 "pim": {
655 "rp": [
656 {
657 "rp_addr": "1.0.1.17",
658 "group_addr_range": GROUP_RANGE_ALL,
659 }
660 ]
661 }
662 },
663 "r3": {
664 "pim": {
665 "rp": [
666 {
667 "rp_addr": "1.0.1.17",
668 "group_addr_range": GROUP_RANGE_ALL,
669 }
670 ]
671 }
672 },
673 "r4": {
674 "pim": {
675 "rp": [
676 {
677 "rp_addr": "1.0.1.17",
678 "group_addr_range": GROUP_RANGE_ALL,
679 }
680 ]
681 }
682 },
683 }
684
685 result = create_pim_config(tgen, TOPO, input_dict)
686 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
687
688 step("r1: Verify RP info")
689 dut = "r1"
690 rp_address = "1.0.1.17"
691 iif = "lo"
692 result = verify_pim_rp_info(tgen, TOPO, dut, GROUP_ADDRESS, iif, rp_address, SOURCE)
693 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
694
695 step("r5: Send multicast traffic for group 225.1.1.1")
696 result = app_helper.run_traffic("r5", GROUP_ADDRESS, "r3")
697 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
698
699 step("r0: Send IGMP join")
700 result = app_helper.run_join("r0", GROUP_ADDRESS, "r1")
701 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
702
703 step("r1: Verify IGMP groups")
704 oif = "r1-r0-eth0"
705 result = verify_igmp_groups(tgen, dut, oif, GROUP_ADDRESS)
706 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
707
708 step("r1: Verify (*, G) upstream IIF interface")
709 result = verify_upstream_iif(tgen, dut, iif, STAR, GROUP_ADDRESS)
710 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
711
712 step("r1: Verify (*, G) upstream join state and join timer")
713 result = verify_join_state_and_timer(tgen, dut, iif, STAR, GROUP_ADDRESS)
714 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
715
716 step("r1: Verify (*, G) ip mroutes")
717 result = verify_mroutes(tgen, dut, STAR, GROUP_ADDRESS, iif, oif)
718 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
719
720 step("r1: Verify (S, G) upstream IIF interface")
721 iif = "r1-r3-eth2"
722 result = verify_upstream_iif(tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS)
723 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
724
725 step("r1: Verify (S, G) upstream join state and join timer")
726 result = verify_join_state_and_timer(tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS)
727 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
728
729 step("r1: Verify (S, G) ip mroutes")
730 result = verify_mroutes(tgen, dut, SOURCE_ADDRESS, GROUP_ADDRESS, iif, oif)
731 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
732
733 step("r3: Verify (S, G) upstream IIF interface")
734 dut = "r3"
735 iif = "r3-r5-eth3"
736 result = verify_upstream_iif(tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS)
737 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
738
739 step("r3: Verify (S, G) upstream join state and join timer")
740 result = verify_join_state_and_timer(
741 tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS, expected=False
742 )
743 assert result is not True, (
744 "Testcase {} : Failed \n "
db726bb8
KK
745 "Expected: [{}]: Upstream Join State should not be Joined and "
746 "join timer should not run\n "
747 "Found: {}".format(tc_name, dut, result)
676fa219
DS
748 )
749
750 step("r3: Verify (S, G) ip mroutes")
751 oif = "r3-r1-eth0"
752 result = verify_mroutes(tgen, dut, SOURCE_ADDRESS, GROUP_ADDRESS, iif, oif)
753 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
754
755 # Uncomment next line for debugging
756 # tgen.mininet_cli()
757
758 write_test_footer(tc_name)
759
760
761def test_RP_configured_as_FHR_1_p1(request):
762 """
763 TC_22_1_P1: Verify OIF and RFP for (*,G) and (S,G) when static RP configure
764 in FHR router
765
766 Topology used:
767 ________r2_____
768 | |
769 iperf | | iperf
770 r0-----r1-------------r3-----r5
771
772 r1 : LHR
773 r3 : FHR/RP
774 """
775
776 tgen = get_topogen()
777 tc_name = request.node.name
778 write_test_header(tc_name)
779
780 # Don"t run this test if we have any failure.
781 if tgen.routers_have_failure():
782 pytest.skip(tgen.errors)
783
784 step("Creating configuration from JSON")
785 reset_config_on_routers(tgen)
786 app_helper.stop_all_hosts()
787 clear_mroute(tgen)
788 clear_pim_interface_traffic(tgen, TOPO)
789
790 step("Enable IGMP on r1 interface")
791 step("Configure RP on r2 (loopback interface) for the group range" " 225.1.1.0/24")
792 step("Enable the PIM on all the interfaces of r1, r2, r3 and r4 routers")
793 step("Send the IGMP join from r0")
794 step("Send multicast traffic from r5")
795
796 step("r1, r2, r3, r4: Delete existing RP configuration" "configure r3(FHR) as RP")
797 input_dict = {
798 "r1": {
799 "pim": {
800 "rp": [
801 {
802 "rp_addr": "1.0.2.17",
803 "group_addr_range": GROUP_RANGE_ALL,
804 "delete": True,
805 }
806 ]
807 }
808 },
809 "r2": {
810 "pim": {
811 "rp": [
812 {
813 "rp_addr": "1.0.2.17",
814 "group_addr_range": GROUP_RANGE_ALL,
815 "delete": True,
816 }
817 ]
818 }
819 },
820 "r3": {
821 "pim": {
822 "rp": [
823 {
824 "rp_addr": "1.0.2.17",
825 "group_addr_range": GROUP_RANGE_ALL,
826 "delete": True,
827 }
828 ]
829 }
830 },
831 "r4": {
832 "pim": {
833 "rp": [
834 {
835 "rp_addr": "1.0.2.17",
836 "group_addr_range": GROUP_RANGE_ALL,
837 "delete": True,
838 }
839 ]
840 }
841 },
842 }
843 result = create_pim_config(tgen, TOPO, input_dict)
844 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
845
846 step("r1, r2, r3, r4: Configure r3(FHR) as RP")
847 input_dict = {
848 "r1": {
849 "pim": {
850 "rp": [
851 {
852 "rp_addr": "1.0.3.17",
853 "group_addr_range": GROUP_RANGE_ALL,
854 }
855 ]
856 }
857 },
858 "r2": {
859 "pim": {
860 "rp": [
861 {
862 "rp_addr": "1.0.3.17",
863 "group_addr_range": GROUP_RANGE_ALL,
864 }
865 ]
866 }
867 },
868 "r3": {
869 "pim": {
870 "rp": [
871 {
872 "rp_addr": "1.0.3.17",
873 "group_addr_range": GROUP_RANGE_ALL,
874 }
875 ]
876 }
877 },
878 "r4": {
879 "pim": {
880 "rp": [
881 {
882 "rp_addr": "1.0.3.17",
883 "group_addr_range": GROUP_RANGE_ALL,
884 }
885 ]
886 }
887 },
888 }
889
890 result = create_pim_config(tgen, TOPO, input_dict)
891 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
892
893 step("r1: Verify RP info")
894 dut = "r1"
895 rp_address = "1.0.3.17"
896 iif = "r1-r3-eth2"
897 result = verify_pim_rp_info(
898 tgen, TOPO, dut, GROUP_RANGE_ALL, iif, rp_address, SOURCE
899 )
900 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
901
902 step("r0: Send IGMP join")
903 result = app_helper.run_join("r0", GROUP_ADDRESS, "r1")
904 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
905
906 step("r0: Verify IGMP groups")
907 oif = "r1-r0-eth0"
908 result = verify_igmp_groups(tgen, dut, oif, GROUP_ADDRESS)
909 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
910
911 step("r5: Send multicast traffic for group 225.1.1.1")
912 result = app_helper.run_traffic("r5", GROUP_ADDRESS, "r3")
913 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
914
915 step("r1: Verify (*, G) upstream IIF interface")
916 result = verify_upstream_iif(tgen, dut, iif, STAR, GROUP_ADDRESS)
917 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
918
919 step("r1: Verify (*, G) upstream join state and join timer")
920 result = verify_join_state_and_timer(tgen, dut, iif, STAR, GROUP_ADDRESS)
921 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
922
923 step("r1: Verify (*, G) ip mroutes")
924 result = verify_mroutes(tgen, dut, STAR, GROUP_ADDRESS, iif, oif)
925 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
926
927 step("r1: Verify (S, G) upstream IIF interface")
928 result = verify_upstream_iif(tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS)
929 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
930
931 step("r1: Verify (S, G) upstream join state and join timer")
932 result = verify_join_state_and_timer(tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS)
933 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
934
935 step("r1: Verify (S, G) ip mroutes")
936 result = verify_mroutes(tgen, dut, SOURCE_ADDRESS, GROUP_ADDRESS, iif, oif)
937 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
938
939 step("r3: Verify (S, G) upstream IIF interface")
940 dut = "r3"
941 iif = "r3-r5-eth3"
942 result = verify_upstream_iif(tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS)
943 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
944
945 step("r3: Verify (S, G) upstream join state and join timer")
946 result = verify_join_state_and_timer(
947 tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS, expected=False
948 )
949 assert result is not True, (
950 "Testcase {} : Failed \n "
db726bb8
KK
951 "Expected: [{}]: Upstream Join State should not be Joined and "
952 "join timer should not run\n "
953 "Found: {}".format(tc_name, dut, result)
676fa219
DS
954 )
955
956 step("r3: Verify (S, G) ip mroutes")
957 oif = "r3-r1-eth0"
958 result = verify_mroutes(tgen, dut, SOURCE_ADDRESS, GROUP_ADDRESS, iif, oif)
959 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
960
961 # Uncomment next line for debugging
962 # tgen.mininet_cli()
963
964 write_test_footer(tc_name)
965
966
967def test_RP_configured_as_FHR_2_p2(request):
968 """
969 TC_22_2_P2: Verify OIF and RFP for (*,G) and (S,G) when static RP configure
970 in FHR router
971
972 Topology used:
973 ________r2_____
974 | |
975 iperf | | iperf
976 r0-----r1-------------r3-----r5
977
978 r1 : LHR
979 r3 : FHR/RP
980 """
981 tgen = get_topogen()
982 tc_name = request.node.name
983 write_test_header(tc_name)
984
985 # Don"t run this test if we have any failure.
986 if tgen.routers_have_failure():
987 pytest.skip(tgen.errors)
988
989 step("Creating configuration from JSON")
990 reset_config_on_routers(tgen)
991 app_helper.stop_all_hosts()
992 clear_mroute(tgen)
993 clear_pim_interface_traffic(tgen, TOPO)
994
995 step("Enable IGMP on r1 interface")
996 step("Configure RP on r2 (loopback interface) for the group range" " 225.1.1.0/24")
997 step("Enable the PIM on all the interfaces of r1, r2, r3 and r4 routers")
998 step("Send multicast traffic from r5")
999 step("Send the IGMP join from r0")
1000
1001 step("r1, r2, r3, r4: Delete existing RP configuration" "configure r3(FHR) as RP")
1002 input_dict = {
1003 "r1": {
1004 "pim": {
1005 "rp": [
1006 {
1007 "rp_addr": "1.0.2.17",
1008 "group_addr_range": GROUP_RANGE_ALL,
1009 "delete": True,
1010 }
1011 ]
1012 }
1013 },
1014 "r2": {
1015 "pim": {
1016 "rp": [
1017 {
1018 "rp_addr": "1.0.2.17",
1019 "group_addr_range": GROUP_RANGE_ALL,
1020 "delete": True,
1021 }
1022 ]
1023 }
1024 },
1025 "r3": {
1026 "pim": {
1027 "rp": [
1028 {
1029 "rp_addr": "1.0.2.17",
1030 "group_addr_range": GROUP_RANGE_ALL,
1031 "delete": True,
1032 }
1033 ]
1034 }
1035 },
1036 "r4": {
1037 "pim": {
1038 "rp": [
1039 {
1040 "rp_addr": "1.0.2.17",
1041 "group_addr_range": GROUP_RANGE_ALL,
1042 "delete": True,
1043 }
1044 ]
1045 }
1046 },
1047 }
1048
1049 result = create_pim_config(tgen, TOPO, input_dict)
1050 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1051
1052 step("r1, r2, r3, r4: Configure r3(FHR) as RP")
1053 input_dict = {
1054 "r1": {
1055 "pim": {
1056 "rp": [
1057 {
1058 "rp_addr": "1.0.3.17",
1059 "group_addr_range": GROUP_RANGE_ALL,
1060 }
1061 ]
1062 }
1063 },
1064 "r2": {
1065 "pim": {
1066 "rp": [
1067 {
1068 "rp_addr": "1.0.3.17",
1069 "group_addr_range": GROUP_RANGE_ALL,
1070 }
1071 ]
1072 }
1073 },
1074 "r3": {
1075 "pim": {
1076 "rp": [
1077 {
1078 "rp_addr": "1.0.3.17",
1079 "group_addr_range": GROUP_RANGE_ALL,
1080 }
1081 ]
1082 }
1083 },
1084 "r4": {
1085 "pim": {
1086 "rp": [
1087 {
1088 "rp_addr": "1.0.3.17",
1089 "group_addr_range": GROUP_RANGE_ALL,
1090 }
1091 ]
1092 }
1093 },
1094 }
1095
1096 result = create_pim_config(tgen, TOPO, input_dict)
1097 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1098
1099 step("r1: Verify RP info")
1100 dut = "r1"
1101 rp_address = "1.0.3.17"
1102 iif = "r1-r3-eth2"
1103 result = verify_pim_rp_info(
1104 tgen, TOPO, dut, GROUP_RANGE_ALL, iif, rp_address, SOURCE
1105 )
1106 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1107
1108 step("r5: Send multicast traffic for group 225.1.1.1")
1109 result = app_helper.run_traffic("r5", GROUP_ADDRESS, "r3")
1110 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1111
1112 step("r0: Send IGMP join")
1113 result = app_helper.run_join("r0", GROUP_ADDRESS, "r1")
1114 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1115
1116 step("r0: Verify IGMP groups")
1117 oif = "r1-r0-eth0"
1118 result = verify_igmp_groups(tgen, dut, oif, GROUP_ADDRESS)
1119 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1120
1121 step("r1: Verify (*, G) upstream IIF interface")
1122 result = verify_upstream_iif(tgen, dut, iif, STAR, GROUP_ADDRESS)
1123 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1124
1125 step("r1: Verify (*, G) upstream join state and join timer")
1126 result = verify_join_state_and_timer(tgen, dut, iif, STAR, GROUP_ADDRESS)
1127 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1128
1129 step("r1: Verify (*, G) ip mroutes")
1130 result = verify_mroutes(tgen, dut, STAR, GROUP_ADDRESS, iif, oif)
1131 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1132
1133 step("r1: Verify (S, G) upstream IIF interface")
1134 iif = "r1-r3-eth2"
1135 result = verify_upstream_iif(tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS)
1136 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1137
1138 step("r1: Verify (S, G) upstream join state and join timer")
1139 result = verify_join_state_and_timer(tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS)
1140 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1141
1142 step("r1: Verify (S, G) ip mroutes")
1143 result = verify_mroutes(tgen, dut, SOURCE_ADDRESS, GROUP_ADDRESS, iif, oif)
1144 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1145
1146 step("r3: Verify (S, G) upstream IIF interface")
1147 dut = "r3"
1148 iif = "r3-r5-eth3"
1149 result = verify_upstream_iif(tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS)
1150 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1151
1152 step("r3: Verify (S, G) upstream join state and join timer")
1153 result = verify_join_state_and_timer(
1154 tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS, expected=False
1155 )
1156 assert result is not True, (
1157 "Testcase {} : Failed \n "
db726bb8
KK
1158 "Expected: [{}]: Upstream Join State should not be Joined and "
1159 "join timer should not run\n "
1160 "Found: {}".format(tc_name, dut, result)
676fa219
DS
1161 )
1162
1163 step("r3: Verify (S, G) ip mroutes")
1164 oif = "r3-r1-eth0"
1165 result = verify_mroutes(tgen, dut, SOURCE_ADDRESS, GROUP_ADDRESS, iif, oif)
1166 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1167
1168 # Uncomment next line for debugging
1169 # tgen.mininet_cli()
1170
1171 write_test_footer(tc_name)
1172
1173
1174def test_SPT_RPT_path_different_p1(request):
1175 """
1176 TC_23_P1: Verify (*,G) and (S,G) populated correctly when RPT and SPT path
1177 are different
1178
1179 Topology used:
1180 ________r2_____
1181 | |
1182 iperf | | iperf
1183 r0-----r1-------------r3-----r5
1184
1185 r1: LHR
1186 r2: RP
1187 r3: FHR
1188 """
1189
1190 tgen = get_topogen()
1191 tc_name = request.node.name
1192 write_test_header(tc_name)
1193
1194 # Don"t run this test if we have any failure.
1195 if tgen.routers_have_failure():
1196 pytest.skip(tgen.errors)
1197
1198 step("Creating configuration from JSON")
1199 reset_config_on_routers(tgen)
1200 app_helper.stop_all_hosts()
1201 clear_mroute(tgen)
1202 clear_pim_interface_traffic(tgen, TOPO)
1203
1204 step("Enable IGMP on r1 interface and send IGMP join (225.1.1.1) to r1")
1205 step("Configure RP on r2 (loopback interface) for the group range" " 224.0.0.0/4")
1206 step("Enable the PIM on all the interfaces of r1, r2, r3 and r4 routers")
1207 step("Send multicast traffic from r3")
1208
1209 step("r2: Verify RP info")
1210 dut = "r2"
1211 rp_address = "1.0.2.17"
1212 iif = "lo"
1213 result = verify_pim_rp_info(tgen, TOPO, dut, GROUP_ADDRESS, iif, rp_address, SOURCE)
1214 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1215
1216 step("r0: Send IGMP join")
1217 result = app_helper.run_join("r0", GROUP_ADDRESS, "r1")
1218 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1219
1220 step("r1: Verify IGMP groups")
1221 dut = "r1"
1222 oif = "r1-r0-eth0"
1223 result = verify_igmp_groups(tgen, dut, oif, GROUP_ADDRESS)
1224 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1225
1226 step("r5: Send multicast traffic for group 225.1.1.1")
1227 result = app_helper.run_traffic("r5", GROUP_ADDRESS, "r3")
1228 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1229
1230 step("r1: Verify (*, G) upstream IIF interface")
1231 iif = "r1-r2-eth1"
1232 result = verify_upstream_iif(tgen, dut, iif, STAR, GROUP_ADDRESS)
1233 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1234
1235 step("r1: Verify (*, G) upstream join state and join timer")
1236 result = verify_join_state_and_timer(tgen, dut, iif, STAR, GROUP_ADDRESS)
1237 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1238
1239 step("r1: Verify (*, G) ip mroutes")
1240 result = verify_mroutes(tgen, dut, STAR, GROUP_ADDRESS, iif, oif)
1241 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1242
1243 step("r1: Verify (S, G) upstream IIF interface")
1244 iif = "r1-r3-eth2"
1245 result = verify_upstream_iif(tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS)
1246 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1247
1248 step("r1: Verify (S, G) upstream join state and join timer")
1249 result = verify_join_state_and_timer(tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS)
1250 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1251
1252 step("r1: Verify (S, G) ip mroutes")
1253 result = verify_mroutes(tgen, dut, SOURCE_ADDRESS, GROUP_ADDRESS, iif, oif)
1254 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1255
1256 step("r2: Verify (*, G) upstream IIF interface")
1257 dut = "r2"
1258 iif = "lo"
1259 result = verify_upstream_iif(tgen, dut, iif, STAR, GROUP_ADDRESS)
1260 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1261
1262 step("r2: Verify (*, G) upstream join state and join timer")
1263 result = verify_join_state_and_timer(tgen, dut, iif, STAR, GROUP_ADDRESS)
1264 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1265
1266 step("r2: Verify (*, G) ip mroutes")
1267 oif = "r2-r1-eth0"
1268 result = verify_mroutes(tgen, dut, STAR, GROUP_ADDRESS, iif, oif)
1269 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1270
1271 step("r3: Verify (S, G) upstream IIF interface")
1272 dut = "r3"
1273 iif = "r3-r5-eth3"
1274 result = verify_upstream_iif(tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS)
1275 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1276
1277 step("r3: Verify (S, G) upstream join state and join timer")
1278 result = verify_join_state_and_timer(
1279 tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS, expected=False
1280 )
1281 assert result is not True, (
1282 "Testcase {} : Failed \n "
db726bb8
KK
1283 "Expected: [{}]: Upstream Join State should not be Joined and "
1284 "join timer should not run\n "
1285 "Found: {}".format(tc_name, dut, result)
676fa219
DS
1286 )
1287
1288 step("r3: Verify (S, G) ip mroutes")
1289 oif = "r3-r1-eth0"
1290 result = verify_mroutes(tgen, dut, SOURCE_ADDRESS, GROUP_ADDRESS, iif, oif)
1291 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1292
1293 step("r2: Verify (S, G) upstream IIF interface")
1294 dut = "r2"
1295 iif = "r2-r3-eth1"
1296 result = verify_upstream_iif(
1297 tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS, joinState="NotJoined"
1298 )
1299 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1300
1301 step("r2: Verify (S, G) upstream join state and join timer")
1302 result = verify_join_state_and_timer(
1303 tgen, dut, iif, SOURCE_ADDRESS, GROUP_ADDRESS, expected=False
1304 )
1305 assert result is not True, (
1306 "Testcase {} : Failed \n "
db726bb8
KK
1307 "Expected: [{}]: Upstream Join State should not be Joined and "
1308 "join timer should not run\n "
1309 "Found: {}".format(tc_name, dut, result)
676fa219
DS
1310 )
1311
1312 step("r2: Verify (S, G) ip mroutes")
1313 oif = "none"
1314 result = verify_mroutes(tgen, dut, SOURCE_ADDRESS, GROUP_ADDRESS, iif, oif)
1315 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1316
1317 # Uncomment next line for debugging
1318 # tgen.mininet_cli()
1319
1320 write_test_footer(tc_name)
1321
1322
1323def test_clear_pim_configuration_p1(request):
1324 """
1325 TC_25_P1: Verify (*,G) and (S,G) populated correctly after clearing the
1326 PIM,IGMP and mroutes joins
1327
1328 Topology used:
1329 ________r2_____
1330 | |
1331 iperf | | iperf
1332 r0-----r1-------------r3-----r5
1333 | |
1334 |_____________|
1335 r4
1336 r1 : LHR
1337 r2 : RP
1338 r3 : FHR
1339 """
1340
1341 tgen = get_topogen()
1342 tc_name = request.node.name
1343 write_test_header(tc_name)
1344
1345 # Don"t run this test if we have any failure.
1346 if tgen.routers_have_failure():
1347 pytest.skip(tgen.errors)
1348
1349 step("Creating configuration from JSON")
1350 reset_config_on_routers(tgen)
1351 app_helper.stop_all_hosts()
1352 clear_mroute(tgen)
1353 clear_pim_interface_traffic(tgen, TOPO)
1354
1355 step("Enable IGMP on r1 interface")
1356 step("Configure RP on r2 (loopback interface) for the group range" " 224.0.0.0/4")
1357 step("Enable the PIM on all the interfaces of r1, r2, r3 and r4 routers")
1358 step("Send the IGMP join from r0")
1359 step("Send multicast traffic from r5")
1360
1361 step("r2: Verify RP info")
1362 dut = "r2"
1363 rp_address = "1.0.2.17"
1364 oif = "lo"
1365 result = verify_pim_rp_info(
1366 tgen, TOPO, dut, GROUP_RANGE_ALL, oif, rp_address, SOURCE
1367 )
1368 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1369
1370 step("r0: Send IGMP join")
1371 result = app_helper.run_join("r0", GROUP_ADDRESS, "r1")
1372 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1373
1374 step("r1: Verify IGMP groups")
1375 dut = "r1"
1376 iif = "r1-r0-eth0"
1377 result = verify_igmp_groups(tgen, dut, iif, GROUP_ADDRESS)
1378 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1379
1380 step("r5: Send multicast traffic for group 225.1.1.1")
1381 result = app_helper.run_traffic("r5", GROUP_ADDRESS, "r3")
1382 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1383
1384 step("r1: Verify (*, G) upstream IIF interface")
1385 dut = "r1"
1386 iif = "r1-r2-eth1"
1387 result = verify_upstream_iif(tgen, dut, iif, STAR, GROUP_ADDRESS)
1388 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1389
1390 step("r1: Verify (*, G) upstream join state and join timer")
1391 result = verify_join_state_and_timer(tgen, dut, iif, STAR, GROUP_ADDRESS)
1392 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1393
1394 step("r1: Verify (*, G) ip mroutes")
1395 oif = "r1-r0-eth0"
1396 result = verify_mroutes(tgen, dut, STAR, GROUP_ADDRESS, iif, oif)
1397 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1398
1399 step("r1: Verify IGMP groups timer restarted")
1400 result = clear_igmp_interfaces(tgen, dut)
1401 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1402
1403 step("r1: Verify PIM neighbor timer restarted")
1404 result = clear_pim_interfaces(tgen, dut)
1405 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1406
1407 step("r1: Verify PIM mroute timer restarted")
1408 result = clear_mroute_verify(tgen, dut)
1409 assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
1410
1411 # Uncomment next line for debugging
1412 # tgen.mininet_cli()
1413
1414 write_test_footer(tc_name)
1415
1416
676fa219
DS
1417if __name__ == "__main__":
1418 ARGS = ["-s"] + sys.argv[1:]
1419 sys.exit(pytest.main(ARGS))