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:
@@ -1,7 +1,16 @@
|
||||
<doc>
|
||||
</doc>
|
||||
<var>
|
||||
</var>
|
||||
<vars>
|
||||
</vars>
|
||||
|
||||
<group>
|
||||
</group>
|
||||
<group name="system">
|
||||
...
|
||||
</group>
|
||||
|
||||
<group name="interfaces">
|
||||
...
|
||||
</group>
|
||||
|
||||
<group name="vlans">
|
||||
...
|
||||
</group>
|
||||
|
||||
29
oxi/interfaces/models/templates/keenetic.ttp
Normal file
29
oxi/interfaces/models/templates/keenetic.ttp
Normal 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>
|
||||
Reference in New Issue
Block a user