- Added `.idea` to `.gitignore` to exclude IDE configuration files. - Introduced `pydantic` version `2.12.5` as a dependency in `pyproject.toml` and `uv.lock`. - Added `annotated-types` as a new dependency in `uv.lock`. - Refactored `BaseDevice` class to include abstract methods for device properties and loading templates. - Created `Interfaces`, `System`, `Vlans`, and `Device` models in a new `contract.py` file for structured data handling. - Updated `Mikrotik` class to implement the new `BaseDevice` structure and added a template loading method.
26 lines
419 B
Python
26 lines
419 B
Python
from ipaddress import IPv4Address
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class Interfaces(BaseModel):
|
|
ip_address: IPv4Address
|
|
mask: int
|
|
description: str
|
|
|
|
|
|
class System(BaseModel):
|
|
model: str
|
|
serial_number: str
|
|
version: str
|
|
|
|
|
|
class Vlans(BaseModel):
|
|
id: int
|
|
name: str = Field(alias="description")
|
|
|
|
|
|
class Device(BaseModel):
|
|
system: System
|
|
interfaces: Interfaces
|
|
vlans: Vlans
|