2024-07-10 10:44:53 +00:00
|
|
|
#!/usr/bin/python3
|
|
|
|
|
|
|
|
import asyncio
|
|
|
|
import os
|
|
|
|
import pathlib
|
|
|
|
import sys
|
|
|
|
|
2024-07-11 20:31:06 +00:00
|
|
|
selfpath = pathlib.Path(__file__)
|
|
|
|
name = selfpath.parent.stem
|
2024-07-10 10:44:53 +00:00
|
|
|
|
2024-07-11 20:31:06 +00:00
|
|
|
sys.path.insert(0, str(selfpath.parent.parent / "lib"))
|
2024-07-10 13:41:20 +00:00
|
|
|
|
2024-07-11 21:06:14 +00:00
|
|
|
from BIRD.Test import Test, BIRDInstance
|
2024-07-10 13:41:20 +00:00
|
|
|
|
|
|
|
os.chdir(pathlib.Path(__file__).parent)
|
|
|
|
|
2024-07-11 20:31:06 +00:00
|
|
|
class ThisTest(Test):
|
|
|
|
async def start(self):
|
2024-07-11 21:06:14 +00:00
|
|
|
self.src, self.dest = await self.machines(
|
|
|
|
"src", "dest",
|
|
|
|
t=BIRDInstance,
|
|
|
|
)
|
2024-07-12 16:45:53 +00:00
|
|
|
self.links = {
|
|
|
|
"L": await self.link("L", "src", "dest")
|
|
|
|
}
|
2024-07-11 20:31:06 +00:00
|
|
|
|
2024-07-12 17:56:04 +00:00
|
|
|
await super().start()
|
|
|
|
|
2024-07-10 10:44:53 +00:00
|
|
|
async def main():
|
2024-07-11 20:31:06 +00:00
|
|
|
t = ThisTest(name)
|
2024-07-12 17:56:04 +00:00
|
|
|
|
2024-07-11 20:31:06 +00:00
|
|
|
await t.start()
|
2024-07-10 10:44:53 +00:00
|
|
|
|
2024-07-11 20:31:06 +00:00
|
|
|
h = t.hypervisor
|
2024-07-10 10:44:53 +00:00
|
|
|
|
2024-07-12 16:45:53 +00:00
|
|
|
print(t.links, t.src, t.dest)
|
2024-07-10 10:44:53 +00:00
|
|
|
|
2024-07-10 13:41:20 +00:00
|
|
|
await asyncio.sleep(5)
|
2024-07-10 10:44:53 +00:00
|
|
|
|
|
|
|
print(await asyncio.gather(*[
|
2024-07-11 13:29:28 +00:00
|
|
|
where.show_route()
|
2024-07-11 21:06:14 +00:00
|
|
|
for where in (t.src, t.dest)
|
2024-07-10 10:44:53 +00:00
|
|
|
]))
|
|
|
|
|
|
|
|
await asyncio.sleep(1)
|
2024-07-10 13:41:20 +00:00
|
|
|
|
|
|
|
for p in ("p170", "p180", "p190", "p200"):
|
2024-07-11 21:06:14 +00:00
|
|
|
await t.src.enable(p)
|
2024-07-10 13:41:20 +00:00
|
|
|
await asyncio.sleep(1)
|
|
|
|
|
|
|
|
shr = await asyncio.gather(*[
|
2024-07-11 13:29:28 +00:00
|
|
|
where.show_route()
|
2024-07-11 21:06:14 +00:00
|
|
|
for where in (t.src, t.dest)
|
2024-07-10 13:41:20 +00:00
|
|
|
])
|
|
|
|
|
|
|
|
print(shr[0]["out"].decode(), shr[1]["out"].decode())
|
|
|
|
|
|
|
|
await asyncio.sleep(1)
|
|
|
|
|
|
|
|
print(await asyncio.gather(*[
|
2024-07-11 13:29:28 +00:00
|
|
|
where.show_route()
|
2024-07-11 21:06:14 +00:00
|
|
|
for where in (t.src, t.dest)
|
2024-07-10 13:41:20 +00:00
|
|
|
]))
|
|
|
|
|
2024-07-12 17:03:17 +00:00
|
|
|
await t.cleanup()
|
2024-07-10 10:44:53 +00:00
|
|
|
await h.control_socket.send_cmd("stop", True)
|
|
|
|
|
|
|
|
assert(__name__ == "__main__")
|
|
|
|
asyncio.run(main())
|