From 2c79f3532e7121c938da69e4af16eee94ff01866 Mon Sep 17 00:00:00 2001 From: Rafael Zalamena Date: Mon, 25 Nov 2024 11:32:46 -0300 Subject: [PATCH] topotests: test MSDP shutdown command New test step to check that MSDP shutdown command is working. Signed-off-by: Rafael Zalamena --- tests/topotests/msdp_topo1/test_msdp_topo1.py | 51 +++++++++++++++++-- 1 file changed, 47 insertions(+), 4 deletions(-) diff --git a/tests/topotests/msdp_topo1/test_msdp_topo1.py b/tests/topotests/msdp_topo1/test_msdp_topo1.py index 1c97f7cb1e..8c25eeca06 100755 --- a/tests/topotests/msdp_topo1/test_msdp_topo1.py +++ b/tests/topotests/msdp_topo1/test_msdp_topo1.py @@ -521,15 +521,58 @@ def test_msdp_log_events(): r1_log = tgen.gears["r1"].net.getLog("log", "pimd") # Look up for informational messages that should have been enabled. - match = re.search( - "MSDP peer 192.168.1.2 state changed to established", r1_log) + match = re.search("MSDP peer 192.168.1.2 state changed to established", r1_log) assert match is not None - match = re.search( - r"MSDP SA \(192.168.10.100\,229.1.2.3\) created", r1_log) + match = re.search(r"MSDP SA \(192.168.10.100\,229.1.2.3\) created", r1_log) assert match is not None +def test_msdp_shutdown(): + "Shutdown MSDP sessions between r1, r2, r3, then check the state." + + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + tgen.gears["r1"].vtysh_cmd( + """ + configure terminal + router pim + msdp shutdown + """ + ) + + r1_expect = { + "192.168.0.2": { + "state": "inactive", + }, + "192.168.1.2": { + "state": "inactive", + }, + } + r2_expect = { + "192.168.0.1": { + "state": "listen", + } + } + r3_expect = { + "192.168.1.1": { + "state": "listen", + } + } + for router in [("r1", r1_expect), ("r2", r2_expect), ("r3", r3_expect)]: + test_func = partial( + topotest.router_json_cmp, + tgen.gears[router[0]], + "show ip msdp peer json", + router[1], + ) + logger.info("Waiting for {} msdp peer data".format(router[0])) + _, val = topotest.run_and_expect(test_func, None, count=30, wait=1) + assert val is None, "multicast route convergence failure" + + def test_memory_leak(): "Run the memory leak test and report results." tgen = get_topogen() -- 2.39.5