mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-22 09:41:54 +00:00
Flock tests: more abstraction on route dumping
This commit is contained in:
parent
369962bdbc
commit
1adb4e7a90
@ -4,18 +4,6 @@ import asyncio
|
||||
from python.BIRD.Test import Test, BIRDInstance
|
||||
|
||||
class ThisTest(Test):
|
||||
async def route_dump(self, timeout=None):
|
||||
if timeout is not None:
|
||||
await asyncio.sleep(timeout)
|
||||
|
||||
print(*[
|
||||
f["out"].decode()
|
||||
for f in await asyncio.gather(*[
|
||||
where.show_route()
|
||||
for where in (self.src, self.dest)
|
||||
])
|
||||
])
|
||||
|
||||
async def run(self):
|
||||
# Prepare machines and links
|
||||
self.src, self.dest = await self.machines(
|
||||
|
@ -190,6 +190,26 @@ class Test:
|
||||
await asyncio.gather(*[ v.cleanup() for v in self.machine_index.values() ])
|
||||
await self.hcom("stop", True)
|
||||
|
||||
async def route_dump(self, timeout=None, machines=None):
|
||||
if timeout is not None:
|
||||
await asyncio.sleep(timeout)
|
||||
|
||||
if machines is None:
|
||||
machines = self.machine_index.values()
|
||||
else:
|
||||
machines = [
|
||||
m if isinstance(m, CLI) else self.machine_index[m]
|
||||
for m in machines
|
||||
]
|
||||
|
||||
print(*[
|
||||
f["out"].decode()
|
||||
for f in await asyncio.gather(*[
|
||||
where.show_route()
|
||||
for where in machines
|
||||
])
|
||||
])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
name = sys.argv[1]
|
||||
|
Loading…
Reference in New Issue
Block a user