Files
oxipy/oxi/interfaces/models/templates/quasar.ttp
IluaAir 1d0f5ed685 Refactor Quasar model by removing system method and updating TTP template
- Removed the `system` method from the `Quasar` model to streamline system information handling.
- Updated the TTP template to enhance the formatting of system details, including version and product information, for improved clarity and organization.
2026-03-18 00:01:22 +03:00

66 lines
3.1 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<doc>
Базовый шаблон для нового устройства. Скопируйте этот файл, переименуйте
в &lt;vendor&gt;.ttp и заполните группы под формат конфигурации вашего устройства.
Обязательные группы: system, interfaces.
Опциональная группа: vlans — добавляйте только если устройство поддерживает VLAN.
--- Группа system ---
Должна возвращать одиночный словарь с полями:
model (str) — модель устройства
serial_number (str) — серийный номер
version (str) — версия прошивки
--- Группа interfaces ---
Должна возвращать список словарей. Каждый элемент:
interface (str) — имя интерфейса (alias поля name)
ip_address (str|None) — IPv4-адрес
mask (int|None) — длина префикса (напр. 24)
description (str|None) — описание интерфейса
Если устройство возвращает маску в виде 255.255.255.0, конвертируйте
её в prefix length в методе interfaces() класса устройства.
--- Группа vlans ---
Должна возвращать список словарей. Каждый элемент:
id (int) — номер VLAN (alias поля vlan_id)
description (str|None) — название VLAN (alias поля name)
--- Полезные модификаторы TTP ---
{{ field | ORPHRASE }} — одно слово или фраза до конца строки
{{ field | _start_ }} — начало новой записи группы
{{ field | strip('"') }} — убрать кавычки
{{ field | replace("yes","True") }} — замена подстроки
{{ field | exclude("pattern") }} — пропустить строку при совпадении
{{ ignore }} — захватить и выбросить значение
{{ ignore('.*') }} — выбросить всё до конца строки
Подробнее: docs/templates.md
</doc>
<vars>
default_system = {
"model": "",
"serial_number": "",
"version": ""
}
</vars>
<group name="system" default="default_system">
# Component Version {{ _start_ }}
# Assembly {{ version }}
# Product Name {{ model | ORPHRASE }}
# Product Serial Number {{ serial_number }}
# Subsystem Version {{ _start_ }}
# Engine {{ version }}
# Product Name {{ model | ORPHRASE }}
# Product Serial Number {{ serial_number }}
</group>
<group name="interfaces">
{{ ignore("\\s*") }}config {{ interface }} ipv4 address {{ ip_address }}/{{ mask }} gateway {{ gateway }} {{ ignore }}
</group>
<group name="bulkinterfaces.{{ interface }}">
{{ ignore("\\s*") }}config interface {{ interface | _start_ }} description {{ description | ORPHRASE | strip('"')}}
</group>