- Made the `description` field in the `Interfaces` model optional to enhance flexibility. - Renamed `id` to `vlan_id` in the `Vlans` model for clarity. - Refactored the `Mikrotik` class methods to streamline raw data access and removed unnecessary print statements. - Updated the Mikrotik TTP template to reflect changes in variable names and improve overall structure for interface and VLAN configurations.
27 lines
523 B
Python
27 lines
523 B
Python
from ipaddress import IPv4Address
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class Interfaces(BaseModel):
|
|
name: str
|
|
ip_address: IPv4Address | None = None
|
|
mask: int | None = None
|
|
description: str | None = None
|
|
|
|
|
|
class System(BaseModel):
|
|
model: str
|
|
serial_number: str
|
|
version: str
|
|
|
|
|
|
class Vlans(BaseModel):
|
|
vlan_id: int
|
|
name: str | None = Field(default=None, alias="description")
|
|
|
|
|
|
class Device(BaseModel):
|
|
system: System
|
|
interfaces: list[Interfaces] = []
|
|
vlans: list[Vlans] = []
|