- Enhanced the `BaseDevice` class with methods for loading templates and parsing configuration data using TTP. - Updated the `Device` model to use lists for `interfaces` and `vlans`, allowing for multiple entries. - Introduced new TTP template files for structured data parsing.
26 lines
462 B
Python
26 lines
462 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 | None = Field(default=None, alias="description")
|
|
|
|
|
|
class Device(BaseModel):
|
|
system: System
|
|
interfaces: list[Interfaces] = []
|
|
vlans: list[Vlans] = []
|