diff options
| author | Russ White <russ@riw.us> | 2024-02-20 10:14:20 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-20 10:14:20 -0500 |
| commit | ab40199f00cc2c3b779e97d41f799f2b5696fc7c (patch) | |
| tree | 33ae2024e4ebf84fb7d23c785268d80c3fd822f9 /tests/topotests/lib/checkping.py | |
| parent | b02d946db1e2241fc18bdf0a062672324609f2db (diff) | |
| parent | 1262ee66ad43e76f98133f1c53842fd9021a4dd5 (diff) | |
Merge pull request #15351 from louis-6wind/fix-leak-vrf-interface
bgpd: update route leak after vrf interface changes
Diffstat (limited to 'tests/topotests/lib/checkping.py')
| -rw-r--r-- | tests/topotests/lib/checkping.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/topotests/lib/checkping.py b/tests/topotests/lib/checkping.py index aaa6164dd4..5500807fab 100644 --- a/tests/topotests/lib/checkping.py +++ b/tests/topotests/lib/checkping.py @@ -8,7 +8,7 @@ from lib.topolog import logger from lib import topotest -def check_ping(name, dest_addr, expect_connected, count, wait): +def check_ping(name, dest_addr, expect_connected, count, wait, source_addr=None): """ Assert that ping to dest_addr is expected * 'name': the router to set the ping from @@ -18,9 +18,13 @@ def check_ping(name, dest_addr, expect_connected, count, wait): * 'wait': how long ping should wait to receive all replies """ - def _check(name, dest_addr, match): + def _check(name, dest_addr, source_addr, match): tgen = get_topogen() - output = tgen.gears[name].run("ping {} -c 1 -w 1".format(dest_addr)) + cmd = "ping {}".format(dest_addr) + if source_addr: + cmd += " -I {}".format(source_addr) + cmd += " -c 1 -w 1" + output = tgen.gears[name].run(cmd) logger.info(output) if match not in output: return "ping fail" @@ -28,6 +32,6 @@ def check_ping(name, dest_addr, expect_connected, count, wait): match = ", {} packet loss".format("0%" if expect_connected else "100%") logger.info("[+] check {} {} {}".format(name, dest_addr, match)) tgen = get_topogen() - func = functools.partial(_check, name, dest_addr, match) + func = functools.partial(_check, name, dest_addr, source_addr, match) success, result = topotest.run_and_expect(func, None, count=count, wait=wait) assert result is None, "Failed" |
