Fix action config schemas and formrequest method for dos bot action
This commit is contained in:
@@ -17,20 +17,20 @@ class NetworkPortAbstractAction(AbstractAction, identifier="network_port_abstrac
|
||||
"""Base configuration schema for NetworkPort actions."""
|
||||
|
||||
target_nodename: str
|
||||
port_id: int
|
||||
port_num: int
|
||||
verb: ClassVar[str]
|
||||
|
||||
@classmethod
|
||||
def form_request(cls, config: ConfigSchema) -> RequestFormat:
|
||||
"""Return the action formatted as a request which can be ingested by the PrimAITE simulation."""
|
||||
if config.target_nodename is None or config.port_id is None:
|
||||
if config.target_nodename is None or config.port_num is None:
|
||||
return ["do_nothing"]
|
||||
return [
|
||||
"network",
|
||||
"node",
|
||||
config.target_nodename,
|
||||
"network_interface",
|
||||
config.port_id,
|
||||
config.port_num,
|
||||
config.verb,
|
||||
]
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ class ConfigureDoSBotAction(AbstractAction, identifier="configure_dos_bot"):
|
||||
max_sessions: Optional[int] = None
|
||||
|
||||
@classmethod
|
||||
def form_request(config: ConfigSchema) -> RequestFormat:
|
||||
def form_request(cls, config: ConfigSchema) -> RequestFormat:
|
||||
"""Return the action formatted as a request that can be ingested by the simulation."""
|
||||
data = dict(
|
||||
target_ip_address=config.target_ip_address,
|
||||
|
||||
Reference in New Issue
Block a user