Skip to content

Commit 7adb219

Browse files
author
Barry A. Trent
committed
tests: add topotest for igmp proxy
Signed-off-by: Barry A. Trent <[email protected]>
1 parent 4cfa4d4 commit 7adb219

File tree

6 files changed

+460
-1
lines changed

6 files changed

+460
-1
lines changed

tests/topotests/lib/pim.py

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4260,6 +4260,7 @@ def verify_local_igmp_groups(tgen, dut, interface, group_addresses):
42604260
logger.debug("Exiting lib API: {}".format(sys._getframe().f_code.co_name))
42614261
return True
42624262

4263+
42634264
@retry(retry_timeout=62)
42644265
def verify_static_groups(tgen, dut, interface, group_addresses):
42654266
"""
@@ -4293,7 +4294,9 @@ def verify_static_groups(tgen, dut, interface, group_addresses):
42934294
rnode = tgen.routers()[dut]
42944295

42954296
logger.info("[DUT: %s]: Verifying static groups received:", dut)
4296-
show_static_group_json = run_frr_cmd(rnode, "show ip igmp static-group json", isjson=True)
4297+
show_static_group_json = run_frr_cmd(
4298+
rnode, "show ip igmp static-group json", isjson=True
4299+
)
42974300

42984301
if type(group_addresses) is not list:
42994302
group_addresses = [group_addresses]
@@ -4330,6 +4333,71 @@ def verify_static_groups(tgen, dut, interface, group_addresses):
43304333
logger.debug("Exiting lib API: {}".format(sys._getframe().f_code.co_name))
43314334
return True
43324335

4336+
4337+
@retry(retry_timeout=62)
4338+
def verify_local_igmp_proxy_groups(
4339+
tgen, dut, group_addresses_present, group_addresses_not_present
4340+
):
4341+
"""
4342+
Verify igmp proxy groups are as expected by running
4343+
"show ip igmp static-group json" command
4344+
4345+
Parameters
4346+
----------
4347+
* `tgen`: topogen object
4348+
* `dut`: device under test
4349+
* `group_addresses_present`: IGMP group addresses which should
4350+
currently be proxied
4351+
* `group_addresses_not_present`: IGMP group addresses which should
4352+
not currently be proxied
4353+
4354+
Usage
4355+
-----
4356+
dut = "r1"
4357+
group_addresses_present = "225.1.1.1"
4358+
group_addresses_not_present = "225.2.2.2"
4359+
result = verify_igmp_proxy_groups(tgen, dut, group_p, group_np)
4360+
4361+
Returns
4362+
-------
4363+
errormsg(str) or True
4364+
"""
4365+
4366+
if dut not in tgen.routers():
4367+
errormsg = "[DUT %s]: Device not found!"
4368+
return errormsg
4369+
4370+
rnode = tgen.routers()[dut]
4371+
4372+
logger.info("[DUT: %s]: Verifying local IGMP proxy groups:", dut)
4373+
4374+
out = rnode.vtysh_cmd("show ip igmp proxy json", isjson=True)
4375+
groups = [g["group"] if "group" in g else None for g in out["r1-eth1"]["groups"]]
4376+
4377+
if type(group_addresses_present) is not list:
4378+
group_addresses_present = [group_addresses_present]
4379+
if type(group_addresses_not_present) is not list:
4380+
group_addresses_not_present = [group_addresses_not_present]
4381+
4382+
for test_addr in group_addresses_present:
4383+
if not test_addr in groups:
4384+
errormsg = (
4385+
"[DUT %s]: Verifying local IGMP proxy joins FAILED!! "
4386+
" Expected but not found: %s " % (dut, test_addr)
4387+
)
4388+
return errormsg
4389+
4390+
for test_addr in group_addresses_not_present:
4391+
if test_addr in groups:
4392+
errormsg = (
4393+
"[DUT %s]: Verifying local IGMP proxy join removed FAILED!! "
4394+
" Unexpected but found: %s " % (dut, test_addr)
4395+
)
4396+
return errormsg
4397+
4398+
return True
4399+
4400+
43334401
def verify_pim_interface_traffic(tgen, input_dict, return_stats=True, addr_type="ipv4"):
43344402
"""
43354403
Verify ip pim interface traffic by running
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
hostname r1
2+
!
3+
interface r1-eth0
4+
ip address 10.0.20.1/24
5+
ip igmp
6+
ip pim
7+
ip igmp join 225.1.1.1
8+
ip igmp join 225.2.2.2
9+
!
10+
interface r1-eth1
11+
ip address 10.0.30.1/24
12+
ip pim
13+
ip igmp
14+
ip igmp proxy
15+
!
16+
interface r1-eth2
17+
ip address 10.0.40.1/24
18+
ip igmp
19+
ip pim
20+
ip igmp join 225.3.3.3
21+
ip igmp join 225.4.4.4
22+
!
23+
interface lo
24+
ip address 10.254.0.1/32
25+
ip pim
26+
!
27+
router pim
28+
rp 10.254.0.3
29+
join-prune-interval 5
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
hostname r2
2+
!
3+
interface r2-eth0
4+
ip address 10.0.20.2/24
5+
ip igmp
6+
ip pim
7+
ip igmp proxy
8+
!
9+
interface r2-eth1
10+
ip address 10.0.80.1/24
11+
ip igmp
12+
ip pim passive
13+
!
14+
interface lo
15+
ip address 10.254.0.2/32
16+
!
17+
router pim
18+
rp 10.254.0.3
19+
join-prune-interval 5
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
hostname r3
2+
!
3+
interface r3-eth0
4+
ip address 10.0.40.4/24
5+
!
6+
interface lo
7+
ip address 10.254.0.4/32
8+
!
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
hostname rp
2+
!
3+
interface rp-eth0
4+
ip address 10.0.30.3/24
5+
ip pim
6+
!
7+
interface lo
8+
ip address 10.254.0.3/32
9+
ip pim
10+
!
11+
router pim
12+
join-prune-interval 5
13+
rp 10.254.0.3
14+
register-accept-list ACCEPT
15+
16+
ip prefix-list ACCEPT seq 5 permit 10.0.20.0/24 le 32

0 commit comments

Comments
 (0)