Enhance Keenetic model and update templates for improved data handling

- Implemented the `interfaces` and `vlans` methods in the `Keenetic` model to process and decode interface and VLAN data.
- Added a `_decode_utf` method to handle UTF-8 encoded descriptions.
- Updated the Keenetic TTP template to define structured groups for system, interfaces, and VLANs.
- Refactored file paths in the `Mikrotik` model for consistency and clarity.
This commit is contained in:
IluaAir
2026-02-22 00:21:55 +03:00
parent a41cb1f7ec
commit 2394296f5b
5 changed files with 85 additions and 11 deletions

View File

@@ -1,7 +1,16 @@
<doc>
</doc>
<var>
</var>
<vars>
</vars>
<group>
</group>
<group name="system">
...
</group>
<group name="interfaces">
...
</group>
<group name="vlans">
...
</group>

View File

@@ -0,0 +1,29 @@
<doc>
</doc>
<vars>
default_system = {
"model": "",
"serial_number": ""
}
default_interfaces = {}
</vars>
<group name="system" default="default_system">
! release: {{ version }}
! model: {{ model | ORPHRASE }}
! hw_version: {{ serial_number }}
</group>
<group name="interfaces">
interface {{ name | _start_ | exclude("Vlan") }}
rename {{ rename }}
description {{ description | ORPHRASE }}
ip address {{ ip_address }} {{ netmask }}
{{ shutdown | re("up") | replace("up","False") | strip('"') }}
{{ shutdown | re("down") | replace("down","True") | strip('"') }}
</group>
<group name="vlans">
interface {{ ignore }}/Vlan{{ vlan_id }}
description {{ description | ORPHRASE | strip('"') }}
</group>