0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-10-18 09:58:43 +00:00

Flock tests: more abstraction on route dumping

This commit is contained in:
Maria Matejka 2024-07-13 18:47:22 +02:00
parent 369962bdbc
commit 1adb4e7a90
2 changed files with 20 additions and 12 deletions

View File

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

View File

@ -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]