topotests: test MSDP shutdown command

New test step to check that MSDP shutdown command is working.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
This commit is contained in:
Rafael Zalamena 2024-11-25 11:32:46 -03:00
parent 379dc9ee2f
commit 2c79f3532e

View File

@ -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()