geneva.actions.action¶
Geneva superclass object for defining a packet-level action.
-
class
action.
Action
(action_name, direction)¶ Bases:
object
Defines the superclass for a Geneva Action.
-
__init__
(action_name, direction)¶ Initializes this action object.
Parameters: - action_name (str) – Name of this action (“duplicate”)
- direction (str) – Direction of this action (“out”, “both”, “in”)
-
applies
(direction)¶ Returns whether this action applies to the given direction, as branching actions are not supported on inbound trees.
Parameters: direction (str) – Direction to check if this action applies (“out”, “in”, “both”) Returns: whether or not this action can be used to a given direction Return type: bool
-
static
get_actions
(direction, disabled=None, allow_terminal=True)¶ Dynamically imports all of the Action classes in this directory.
Will only return terminal actions if terminal is set to True.
Parameters: - direction (str) – Limit imported actions to just those that can run to this direction (“out”, “in”, “both”)
- disabled (list, optional) – list of actions that are disabled
- allow_terminal (bool) – whether or not terminal actions (“drop”) should be imported
Returns: Dictionary of imported actions
Return type: dict
-
mutate
(environment_id=None)¶ Mutates packet.
-
static
parse_action
(str_action, direction, logger)¶ Parses a string action into the action object.
Parameters: - str_action (str) – String representation of an action to parse
- direction (str) – Limit actions searched through to just those that can run to this direction (“out”, “in”, “both”)
- logger (
logging.Logger
) – a logger to log with
Returns: A parsed action object
Return type:
-
frequency
= 0¶
-
ident
= 0¶
-