#2912 - removal of the rom_config method as this shouldn't be needed for the actions refactor

This commit is contained in:
Charlie Crane
2024-12-09 09:59:47 +00:00
parent a8fbb002e4
commit 386717fa41
2 changed files with 18 additions and 5 deletions

View File

@@ -32,8 +32,3 @@ class AbstractAction(BaseModel):
def form_request(cls, config: ConfigSchema) -> RequestFormat:
"""Return the action formatted as a request which can be ingested by the PrimAITE simulation."""
pass
@classmethod
def from_config(cls, config: Dict) -> "AbstractAction":
"""Create an action component from a config dictionary."""
return cls(config=cls.ConfigSchema(**config))

View File

@@ -79,6 +79,24 @@ class ACLRemoveRuleAbstractAction(AbstractAction, identifier="acl_remove_rule_ab
protocol_name: str
position: int
@field_validator(
src_ip,
mode="before",
)
@classmethod
def valid_ip(cls, v: str) -> str:
"""Check that a valid IP has been provided for src and dst."""
return is_valid_protocol(v)
@field_validator(
protocol_name,
mode="before",
)
@classmethod
def is_valid_protocol(cls, v: str) -> bool:
"""Check that we are using a valid protocol."""
return protocol_validator(v)
class RouterACLAddRuleAction(ACLAddRuleAbstractAction, identifier="router_acl_add_rule"):
"""Action which adds a rule to a router's ACL."""