summaryrefslogtreecommitdiff
path: root/tests/topotests/multicast_features/test_multicast_features.py
diff options
context:
space:
mode:
authorJafar Al-Gharaibeh <jafar@atcorp.com>2025-02-19 13:39:12 -0600
committerGitHub <noreply@github.com>2025-02-19 13:39:12 -0600
commitce64c34f12e86a7c4671c5aab0c8aec8558c0a1b (patch)
treee0c7c806bc901833037968e53471ac913f939c65 /tests/topotests/multicast_features/test_multicast_features.py
parent66434fc2eea13c83b60f46212e85d33d03ec9c3d (diff)
parentc92061b8db3112917713d37085f0c8f5156ca34d (diff)
Merge pull request #17914 from opensourcerouting/pim-nb-filter
pimd: filter neighbors by address
Diffstat (limited to 'tests/topotests/multicast_features/test_multicast_features.py')
-rw-r--r--tests/topotests/multicast_features/test_multicast_features.py37
1 files changed, 28 insertions, 9 deletions
diff --git a/tests/topotests/multicast_features/test_multicast_features.py b/tests/topotests/multicast_features/test_multicast_features.py
index bce1c91e31..f336557520 100644
--- a/tests/topotests/multicast_features/test_multicast_features.py
+++ b/tests/topotests/multicast_features/test_multicast_features.py
@@ -149,10 +149,14 @@ def test_pim_convergence():
if tgen.routers_have_failure():
pytest.skip(tgen.errors)
- def expect_pim_peer(router, iptype, interface, peer):
+ def expect_pim_peer(router, iptype, interface, peer, missing=False):
"Wait until peer is present."
- logger.info(f"waiting peer {peer} in {router}")
- expected = {interface: {peer: {"upTime": "*"}}}
+ if missing:
+ logger.info(f"waiting peer {peer} in {router} to disappear")
+ expected = {interface: {peer: None}}
+ else:
+ logger.info(f"waiting peer {peer} in {router}")
+ expected = {interface: {peer: {"upTime": "*"}}}
test_func = partial(
topotest.router_json_cmp,
@@ -166,23 +170,38 @@ def test_pim_convergence():
expect_pim_peer("r1", "ip", "r1-eth0", "192.168.1.2")
expect_pim_peer("r2", "ip", "r2-eth0", "192.168.1.1")
- expect_pim_peer("r1", "ip", "r1-eth1", "192.168.2.2")
+
+ # This neighbor is denied by default
+ expect_pim_peer("r1", "ip", "r1-eth1", "192.168.2.2", missing=True)
+ # Lets configure the prefix list so the above neighbor gets accepted:
+ tgen.gears["r1"].vtysh_cmd("""
+ configure terminal
+ ip prefix-list pim-eth0-neighbors permit 192.168.2.0/24
+ """)
+ expect_pim_peer("r1", "ip", "r1-eth1", "192.168.2.2", missing=False)
#
# IPv6 part
#
out = tgen.gears["r1"].vtysh_cmd("show interface r1-eth0 json", True)
- r1_r2_link_address = out["r1-eth0"]["ipAddresses"][1]["address"].split("/")[0]
+ r1_r2_link_address = out["r1-eth0"]["ipAddresses"][1]["address"].split('/')[0]
out = tgen.gears["r1"].vtysh_cmd("show interface r1-eth1 json", True)
- r1_r3_link_address = out["r1-eth1"]["ipAddresses"][1]["address"].split("/")[0]
+ r1_r3_link_address = out["r1-eth1"]["ipAddresses"][1]["address"].split('/')[0]
out = tgen.gears["r2"].vtysh_cmd("show interface r2-eth0 json", True)
- r2_link_address = out["r2-eth0"]["ipAddresses"][1]["address"].split("/")[0]
+ r2_link_address = out["r2-eth0"]["ipAddresses"][1]["address"].split('/')[0]
out = tgen.gears["r3"].vtysh_cmd("show interface r3-eth0 json", True)
- r3_link_address = out["r3-eth0"]["ipAddresses"][1]["address"].split("/")[0]
+ r3_link_address = out["r3-eth0"]["ipAddresses"][1]["address"].split('/')[0]
expect_pim_peer("r1", "ipv6", "r1-eth0", r2_link_address)
expect_pim_peer("r2", "ipv6", "r2-eth0", r1_r2_link_address)
- expect_pim_peer("r1", "ipv6", "r1-eth1", r3_link_address)
+ expect_pim_peer("r1", "ipv6", "r1-eth1", r3_link_address, missing=True)
+
+ tgen.gears["r1"].vtysh_cmd(f"""
+ configure terminal
+ ipv6 prefix-list pimv6-eth0-neighbors permit {r3_link_address}/64
+ """)
+
+ expect_pim_peer("r1", "ipv6", "r1-eth1", r3_link_address, missing=False)
def test_igmp_group_limit():