PoliceAction

The PoliceAction 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) police action 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

get_rate() Optional[int][source]

Returns the rate

get_burst() Optional[int][source]

Returns the burst

get_mtu() Optional[int][source]

Returns the mtu

get_overhead() Optional[int][source]

Returns the overhead

get_decision() ActionDecision[source]

Returns the decision (e.g. ActionDecision.DROP) for this action

action_creation_args() List[str][source]

Returns a list of tc(8) arguments to create this filter

get_action_index() Optional[int]

Returns the action index

get_kind() str

Returns the action type


class ActionDecision(value)[source]

List of decisions for tc(8) actions (see tc-actions(8)); there are also referred-to as control actions.

RECLASSIFY = 'reclassify'

Reclassify packet

PIPE = 'pipe'

Pass packet to next action

DROP = 'drop'

Drop packet

CONTINUE = 'continue'

Pass packet to next filter

PASS = 'pass'

End packet classification (packet returned to queuing discipline/class)

classmethod create_from_string(decision_str: str) ActionDecision[source]

Convert from a string to an ActionDecision member.

Parameters:

decision_str – the string representation of ActionDecision member.

Return type:

a ActionDecision member

Raises a ValueError if no match is found.