- Added a `shutdown` boolean attribute to the `Interfaces` class to manage interface states. - Updated the `eltex.ttp` template to include the `shutdown` command based on the new attribute. - Modified expected configuration JSON files for various devices to reflect the new `shutdown` attribute, ensuring accurate testing and validation of interface configurations.
45 lines
743 B
Python
45 lines
743 B
Python
from ipaddress import IPv4Address
|
|
|
|
from pydantic import BaseModel, ConfigDict, Field
|
|
|
|
|
|
class Base(BaseModel):
|
|
model_config = ConfigDict(populate_by_name=True)
|
|
|
|
|
|
class System(BaseModel):
|
|
"""
|
|
Required
|
|
"""
|
|
|
|
model: str
|
|
serial_number: str
|
|
version: str
|
|
|
|
|
|
class Interfaces(Base):
|
|
"""
|
|
Required
|
|
"""
|
|
|
|
name: str = Field(alias="interface")
|
|
ip_address: IPv4Address | None = None
|
|
mask: int | None = None
|
|
description: str | None = None
|
|
shutdown: bool = False
|
|
|
|
|
|
class Vlans(Base):
|
|
"""
|
|
Optional
|
|
"""
|
|
|
|
vlan_id: int
|
|
name: str | None = Field(default=None, alias="description")
|
|
|
|
|
|
class Device(BaseModel):
|
|
system: System
|
|
interfaces: list[Interfaces]
|
|
vlans: list[Vlans] = []
|