(20250212) Started a new class (util) that handles MikroTik config. in async mode, and started implementing that in the PPPoE-1000 controller. I can now configure and roll back the first three steps. Long way to go :')

This commit is contained in:
2025-02-12 19:05:29 +05:30
parent 6e65de9dfc
commit 02dd675f83
8 changed files with 409 additions and 607 deletions
+2 -2
View File
@@ -172,7 +172,7 @@ class MikroTikPPPoE1000Auth(BaseModel):
frozen = True
)
vlanRange: List[int] = Field(
vlanIds: List[int] = Field(
description = "Don't know, and don't want to know.",
min_length = 1,
frozen = True
@@ -234,7 +234,7 @@ class MikroTikPPPoE1000Auth(BaseModel):
def validate_ip_range(cls, value):
return ip.to_hyphen_notation(value)
@field_validator("vlanRange", mode = "before")
@field_validator("vlanIds", mode = "before")
def validate_vlans(cls, value):
return parse_vlans(value)
+20 -1
View File
@@ -77,6 +77,12 @@ REGEX_SESSION_TOKEN = r"^[a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[89ab][a-f0-9]
class MikroTikConfigAttemptResponse(BaseModel):
actionChain: str | int = Field(
description = "To be able to link all the actions of one process",
frozen = False,
default = None
)
success: bool = Field(
description = "To indicate whether or not, the action was a success",
frozen = False,
@@ -107,7 +113,14 @@ class MikroTikConfigAttemptResponse(BaseModel):
# ┃ ┓┏┏╋┏┓┏┳┓ ┣ ┓┏┏┓┏┏
# ┗┛┗┻┛┗┗┛┛┗┗ ┻ ┗┻┛┗┗┛
pass
def __add__(self, other):
return MikroTikConfigAttemptResponse(
actionChain = other.actionChain or self.actionChain,
success = self.success and other.success,
message = self.message + " -> " + other.message,
exception = other.exception or self.exception
)
# ┓┏ ┓• ┓ •
# ┃┃┏┓┃┓┏┫┏┓╋┓┏┓┏┓
@@ -121,6 +134,12 @@ class MikroTikConfigAttemptResponse(BaseModel):
class MikroTikRollBackAttemptResponse(BaseModel):
actionChain: str | int = Field(
description = "To be able to link all the actions of one process",
frozen = False,
default = None
)
success: bool = Field(
description = "To indicate whether or not, the action was a success",
frozen = False,