(20250218) mkj

This commit is contained in:
2025-02-18 15:17:45 +05:30
parent b7823f4c48
commit 5074b3f040
5 changed files with 551 additions and 1400 deletions
+30 -1
View File
@@ -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)
# ---------------------------------------------------------------------------------------------------------------------