(20250218) mkj
This commit is contained in:
@@ -298,7 +298,7 @@ class MikroTikHotspot1000Auth(BaseModel):
|
||||
frozen = True
|
||||
)
|
||||
|
||||
vlanRange: str = Field(
|
||||
vlanIds: List[int] = Field(
|
||||
description = "Don't know, and don't want to know.",
|
||||
min_length = 1,
|
||||
frozen = True
|
||||
@@ -330,6 +330,27 @@ class MikroTikHotspot1000Auth(BaseModel):
|
||||
class Config:
|
||||
extra = "forbid"
|
||||
|
||||
# ┏┓ •
|
||||
# ┃┃┏┓┏┓┏┓┏┓┏┓╋┓┏┓┏
|
||||
# ┣┛┛ ┗┛┣┛┗ ┛ ┗┗┗ ┛
|
||||
# ┛
|
||||
|
||||
@property
|
||||
def firstPrivateIp(self) -> str:
|
||||
return self.privateIpPool.split("-")[0]
|
||||
|
||||
@property
|
||||
def lastPrivateIp(self) -> str:
|
||||
return self.privateIpPool.split("-")[1]
|
||||
|
||||
@property
|
||||
def firstPublicIp(self) -> str:
|
||||
return self.publicIpPool.split("-")[0]
|
||||
|
||||
@property
|
||||
def lastPublicIp(self) -> str:
|
||||
return self.publicIpPool.split("-")[1]
|
||||
|
||||
# ┓┏ ┓• ┓ •
|
||||
# ┃┃┏┓┃┓┏┫┏┓╋┓┏┓┏┓
|
||||
# ┗┛┗┻┗┗┗┻┗┻┗┗┗┛┛┗
|
||||
@@ -339,6 +360,14 @@ class MikroTikHotspot1000Auth(BaseModel):
|
||||
if isinstance(value, (str, float)): value = int(value)
|
||||
return value
|
||||
|
||||
@field_validator("privateIpPool", "publicIpPool", mode = "before")
|
||||
def validate_ip_range(cls, value):
|
||||
return ip.to_hyphen_notation(value)
|
||||
|
||||
@field_validator("vlanIds", mode = "before")
|
||||
def validate_vlans(cls, value):
|
||||
return parse_vlans(value)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user