import asyncio
-from BIRD.Basic import Basic
+from BIRD.Basic import Basic, Code
class StatusException(Exception):
def __init__(self, msg):
await self.bird.cli.open()
data = await self.bird.cli.socket.command("show status")
- if data[0]["code"] != 1000:
+ if data[0]["code"] != Code.Version:
raise StatusException(f"BIRD version not on the first line, got {data[0]['code']}")
self.data["version"] = data[0]["data"]
- if data[-1]["code"] != 13:
+ if data[-1]["code"] != Code.Status:
raise StatusException(f"BIRD status not on the last line, got {data[-1]['code']}")
self.data["status"] = data[-1]["data"]
await self.bird.cli.open()
hello = self.bird.cli.hello
- if hello["code"] != 1:
+ if hello["code"] != Code.Welcome:
raise VersionException(f"code is {hello['code']}, should be 1")
s = hello["data"].split(" ")