[cli] support -I {src-addr} for ping command (#6470)

This commit is contained in:
whd
2021-04-22 12:43:26 -07:00
committed by GitHub
parent f344098266
commit 7a2465f751
8 changed files with 268 additions and 3 deletions
+5 -2
View File
@@ -1766,8 +1766,11 @@ class NodeImpl:
return self._expect_results(
r'\|\s(\S+)\s+\|\s(\S+)\s+\|\s([0-9a-fA-F]{4})\s\|\s([0-9a-fA-F]{16})\s\|\s(\d+)')
def ping(self, ipaddr, num_responses=1, size=8, timeout=5, count=1, interval=1, hoplimit=64):
cmd = f'ping {ipaddr} {size} {count} {interval} {hoplimit} {timeout}'
def ping(self, ipaddr, num_responses=1, size=8, timeout=5, count=1, interval=1, hoplimit=64, interface=None):
args = f'{ipaddr} {size} {count} {interval} {hoplimit} {timeout}'
if interface is not None:
args = f'-I {interface} {args}'
cmd = f'ping {args}'
self.send_command(cmd)