mirror of
https://github.com/kernelkit/infix.git
synced 2026-08-03 06:13:02 +02:00
infamy:netns: Add traceroute support
This commit is contained in:
committed by
Joachim Wiberg
parent
70c640fe48
commit
6db8c2bc75
@@ -89,6 +89,17 @@ class IsolatedMacVlan:
|
||||
""", check=True)
|
||||
|
||||
|
||||
def traceroute(self, addr):
|
||||
res=self.runsh(f"""
|
||||
set -ex
|
||||
traceroute -n {addr}
|
||||
""", check=True)
|
||||
result=[]
|
||||
for line in res.stdout.splitlines()[2:]:
|
||||
l=line.split()
|
||||
result.append(l)
|
||||
return result
|
||||
|
||||
def ping(self, daddr, count=1, timeout=5, interval=2, check=False):
|
||||
return self.runsh(f"""set -ex; ping -c {count} -w {timeout} -i {interval} {daddr}""", check=check)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user