Add Huawei model and TTP template
- Introduced a new `Huawei` model - Created a corresponding TTP template for Huawei devices. - Updated the base template to correct HTML entity encoding for vendor placeholders.
This commit is contained in:
18
oxi/interfaces/models/huawei.py
Normal file
18
oxi/interfaces/models/huawei.py
Normal file
@@ -0,0 +1,18 @@
|
||||
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):
|
||||
vlan_ids = self.raw["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())
|
||||
Reference in New Issue
Block a user