2019-11-15 03:38:40 +01:00
|
|
|
from actions.action import Action
|
|
|
|
|
|
|
|
class DropAction(Action):
|
2020-05-17 16:15:16 +02:00
|
|
|
"""
|
|
|
|
Geneva action to drop the given packet.
|
|
|
|
"""
|
|
|
|
frequency = 1
|
|
|
|
|
2019-11-15 03:38:40 +01:00
|
|
|
def __init__(self, environment_id=None):
|
2020-05-17 16:15:16 +02:00
|
|
|
"""
|
|
|
|
Initializes this drop action.
|
|
|
|
|
|
|
|
Args:
|
|
|
|
environment_id (str, optional): Environment ID of the strategy we are a part of
|
|
|
|
"""
|
2019-11-15 03:38:40 +01:00
|
|
|
Action.__init__(self, "drop", "both")
|
|
|
|
self.terminal = True
|
|
|
|
self.branching = False
|
|
|
|
|
|
|
|
def run(self, packet, logger):
|
|
|
|
"""
|
|
|
|
The drop action returns None for both it's left and right children, and
|
|
|
|
does not pass the packet along for continued use.
|
|
|
|
"""
|
|
|
|
logger.debug(" - Dropping given packet.")
|
|
|
|
return None, None
|