diff options
Diffstat (limited to 'tests/topotests/multicast_features/test_multicast_features.py')
| -rw-r--r-- | tests/topotests/multicast_features/test_multicast_features.py | 37 |
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(): |
