- Revised the project description in `pyproject.toml` to better reflect the functionality of the `oxipy` client. - Improved the README.md by adding detailed explanations of the project structure, installation instructions, and usage examples. - Updated documentation files to enhance clarity and organization, including sections on extending models and writing TTP templates. - Adjusted various TTP templates to ensure consistency and accuracy in the parsing of device configurations.
19 lines
481 B
Python
19 lines
481 B
Python
from oxi.interfaces import register_parser
|
|
from oxi.interfaces.base import BaseDevice
|
|
|
|
|
|
@register_parser(["vrp", "huawei"])
|
|
class Huawei(BaseDevice):
|
|
template = "huawei.ttp"
|
|
|
|
def vlans(self) -> list[dict]:
|
|
vlan_ids = self.raw.get("vlans", {}).get("vlan_ids", [])
|
|
return [{"vlan_id": vlan} for vlan in vlan_ids]
|
|
|
|
|
|
if __name__ == "__main__":
|
|
with open("./test4.txt") as file:
|
|
data = file.read()
|
|
huawei = Huawei(data)
|
|
print(huawei.parse())
|