summaryrefslogtreecommitdiff
path: root/tests/topotests
diff options
context:
space:
mode:
authorNathan Bahr <nbahr@atcorp.com>2025-02-21 17:59:04 +0000
committerMergify <37929162+mergify[bot]@users.noreply.github.com>2025-02-24 18:54:09 +0000
commit673410bd3089476d35d1562b38f7c83df3a495a4 (patch)
tree2c2d109ad58845a16b3cea5263072cf9c5e53a99 /tests/topotests
parent24dbcbb31ee5edd79c0ed309e728d6758b8b0e76 (diff)
pim: Fix autorp group joins
Group joining got broken when moving the autorp socket to open/close as needed. This fixes it so autorp group joining is properly handled as part of opening the socket. Signed-off-by: Nathan Bahr <nbahr@atcorp.com> (cherry picked from commit d840560b74e3a6117aa1e4b1203dcdd8fb254ef6)
Diffstat (limited to 'tests/topotests')
-rw-r--r--tests/topotests/pim_autorp/test_pim_autorp.py97
1 files changed, 97 insertions, 0 deletions
diff --git a/tests/topotests/pim_autorp/test_pim_autorp.py b/tests/topotests/pim_autorp/test_pim_autorp.py
index 61cf8ebbc5..5edf1db6af 100644
--- a/tests/topotests/pim_autorp/test_pim_autorp.py
+++ b/tests/topotests/pim_autorp/test_pim_autorp.py
@@ -158,6 +158,103 @@ def test_pim_autorp_init(request):
)
+def test_pim_autorp_disable_enable(request):
+ "Test PIM AutoRP disable and re-enable works properly"
+ tgen = get_topogen()
+ tc_name = request.node.name
+ write_test_header(tc_name)
+
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ step("Ensure AutoRP groups are joined on all routers")
+ for rtr in ["r1", "r2", "r3", "r4"]:
+ expected = {
+ f"{rtr}-eth0": {
+ "name": f"{rtr}-eth0",
+ "224.0.1.39": "*",
+ "224.0.1.40": "*",
+ },
+ f"{rtr}-eth1": {
+ "name": f"{rtr}-eth1",
+ "224.0.1.39": "*",
+ "224.0.1.40": "*",
+ },
+ }
+
+ test_func = partial(
+ topotest.router_json_cmp,
+ tgen.gears[rtr],
+ "show ip igmp sources json",
+ expected,
+ )
+ _, result = topotest.run_and_expect(test_func, None)
+ assert result is None, "{} does not have correct autorp groups joined".format(
+ rtr
+ )
+
+ step("Disable AutoRP on all routers")
+ for rtr in ["r1", "r2", "r3", "r4"]:
+ tgen.routers()[rtr].vtysh_cmd(
+ """
+ conf
+ router pim
+ no autorp discovery
+ """
+ )
+
+ step("Ensure AutoRP groups are no longer joined on all routers")
+ for rtr in ["r1", "r2", "r3", "r4"]:
+ expected = {f"{rtr}-eth0": None, f"{rtr}-eth1": None}
+
+ test_func = partial(
+ topotest.router_json_cmp,
+ tgen.gears[rtr],
+ "show ip igmp sources json",
+ expected,
+ )
+ _, result = topotest.run_and_expect(test_func, None)
+ assert result is None, "{} does not have correct autorp groups joined".format(
+ rtr
+ )
+
+ step("Re-enable AutoRP on all routers")
+ for rtr in ["r1", "r2", "r3", "r4"]:
+ tgen.routers()[rtr].vtysh_cmd(
+ """
+ conf
+ router pim
+ autorp discovery
+ """
+ )
+
+ step("Ensure AutoRP groups are re-joined on all routers")
+ for rtr in ["r1", "r2", "r3", "r4"]:
+ expected = {
+ f"{rtr}-eth0": {
+ "name": f"{rtr}-eth0",
+ "224.0.1.39": "*",
+ "224.0.1.40": "*",
+ },
+ f"{rtr}-eth1": {
+ "name": f"{rtr}-eth1",
+ "224.0.1.39": "*",
+ "224.0.1.40": "*",
+ },
+ }
+
+ test_func = partial(
+ topotest.router_json_cmp,
+ tgen.gears[rtr],
+ "show ip igmp sources json",
+ expected,
+ )
+ _, result = topotest.run_and_expect(test_func, None)
+ assert result is None, "{} does not have correct autorp groups joined".format(
+ rtr
+ )
+
+
def test_pim_autorp_no_mapping_agent_rp(request):
"Test PIM AutoRP candidate with no mapping agent"
tgen = get_topogen()