deevirt_schema/api/network.py

27 lines
848 B
Python

from ipaddress import IPv4Address, IPv6Address
from typing import List, Optional
from pydantic_xml import element, attr
from pydantic import UUID4, BaseModel, ConfigDict, Field
from pydantic_extra_types.mac_address import MacAddress
from deevirt_common.lib.virt import vm as vmVirt
class lsp(BaseModel):
model_config = ConfigDict(from_attributes=True)
id:UUID4 = Field()
mac_addr:str = Field()
ipv4_addr:Optional[IPv4Address] = Field(default=None)
ipv6_addr:Optional[IPv6Address] = Field(default=None)
class ls(BaseModel):
model_config = ConfigDict(from_attributes=True)
id:UUID4 = Field()
name:str = Field()
network_switch_port:Optional[List[lsp]] = Field(default=[])
class lspCreate(BaseModel):
switch_id:UUID4 = Field(default=None)
id:Optional[UUID4]
mac_addr:Optional[str] = Field()