Files
oxipy/oxi/interfaces/models/h3c.py
IluaAir 41c4cc48e9 Update project description and enhance documentation for clarity
- 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.
2026-05-25 16:01:38 +03:00

24 lines
634 B
Python

from oxi.interfaces import BaseDevice, register_parser
@register_parser("h3c")
class H3C(BaseDevice):
template = "h3c.ttp"
def vlans(self) -> list[dict]:
vlan_list = self.raw.get("vlans", [])
vlans: list[dict] = []
for item in vlan_list:
vlan_ids = item.get("vlans_id")
if not vlan_ids:
vlans.append(item)
continue
vlans.extend({"vlan_id": vlan_id} for vlan_id in vlan_ids)
return vlans
if __name__ == "__main__":
with open("./test5.txt") as file:
data = file.read()
h3c = H3C(data)
print(h3c.parse())