PoliceAction¶
The PoliceAction class supports policing.
- class PoliceAction(action_index: Optional[int] = None, *, rate: Optional[int] = None, burst: Optional[int] = None, mtu: Optional[int] = None, decision: ActionDecision, overhead: Optional[int] = None)[source]¶
This class supports the tc(8)
policeaction as documented in tc-police(8).- Parameters:
action_index – an integer that effectively names the action
rate – rate
burst – burst
mtu – MTU
decision – control action to take
overhead – overhead
- action_creation_args() List[str]¶
Returns a list of tc(8) arguments to instantiate this action
- get_action_index() Optional[int]¶
Returns the action index
- get_decision() Optional[ActionDecision]¶
Returns the decision (e.g.
ActionDecision.DROP) for this action
- get_install_duration() int¶
Returns the number of seconds since the action was installed (created)
- get_stats() Optional[ActionStats]¶
Returns action statistics
- get_use_duration() int¶
It is not clear how the use duration (in seconds) is defined. As a data point, the install duration and use duration of an action created as part of a filter creation always have the same value.
- parse_common_lines(line_iter: LineGroupIterator) None¶
Parse lines common to all actions. Stop when an empty line is encountered (the end of the action)
- set_action_index(action_index: int) None¶
Sets the action index
- set_durations(*, install_duration: int, use_duration: int) None¶
Set the install and use duration