NETEM

The following class provides access to the netem (Network Emulator) queuing discipline:


class NetemQDisc(qdisc_handle: Handle, parent_handle: Optional[Handle], *, delay: Optional[Union[float, int, Tuple]] = None, limit: Optional[int] = None, drop: Optional[Union[int, Tuple]] = None, duplicate: Optional[Union[int, Tuple]] = None, corrupt: Optional[Union[int, Tuple]] = None, reorder: Optional[Union[int, Tuple]] = None, gap: Optional[int] = None)[source]

Bases: QDisc

This class provides access to the netem queueing discipline (see tc-netem(8)).

Parameters:
  • qdisc_handleHandle of this NetemQDisc

  • parent_handleHandle of the parent QDisc, or None if this is a root queuing discipline

  • delay – delay (in ms) added to each outgoing packet; delay can be specified as a float, as an int, or as a tuple of the form (delay, [jitter, [correlation]])

  • limit – packet limit

  • drop – drop percentage; drop can be specified as an int, or as a tuple of the form (percent, [correlation])

  • duplicate – duplicate percentage; duplicate can be specified as an int, or as a tuple of the form (percent, [correlation])

  • corrupt – corrupt percentage; corrupt can be specified as an int, or as a tuple of the form (percent, [correlation])

  • reorder – reorder percentage; reorder can be specified as an int, or as a tuple of the form (percent, [correlation])

  • gap – packet distance when reordering

get_description() str[source]

Returns a string describing this NetemQDisc instance and its attributes

get_delay() Optional[float][source]

Returns the delay added to outgoing packets (in ms)

get_delay_all() Optional[Tuple][source]

Returns the delay parameters as the tuple (delay, [jitter, [correlation]])

get_limit() Optional[int][source]

Returns the packet limit

get_loss() Optional[int][source]

Returns the packet loss rate (percentage)

get_loss_all() Optional[Tuple][source]

Returns the packet loss parameters as the tuple (percent, [correlation])

get_duplicate() Optional[int][source]

Returns the duplicate packet percentage

get_duplicate_all() Optional[Tuple][source]

Returns the packet duplication parameters as the tuple (percent, [correlation])

get_corrupt() Optional[int][source]

Returns the corrupted packet percentage

get_corrupt_all() Optional[int][source]

Returns the packet corruption parameters as the tuple (percent, [correlation])

dump(outfile: TextIO, level=0, qclass_map: Optional[Mapping[Handle, QClass]] = None)

Recursively dump this Qdisc to outfile.

The qclass_map, if present, is used to determine the destination QClass objects of traffic filters.

get_config() QDiscConfig

Returns the QDiscConfig where this QDisc/QClass has been instantiated, or None if not instantiated.

get_handle() Handle

Returns the QDisc/QClass handle

get_interface() Optional[str]

Returns the interface where this QDisc/QClass has been instantiated, or None if the QDisc/QClass is not instantiated.

get_parent_handle() Optional[Handle]

Returns the handle of the parent of this QDisc/QClass

get_reorder() Optional[int][source]

Returns the reordered packet percentage

get_stats() Optional[QStats]

Returns queuing stats.

is_default() bool

Returns True if this QDisc is the default qdisc used by the kernel.

static is_ingress() bool

Returns True if this QDisc is the ingress qdisc

is_root() bool

Returns True if this is a root QDisc

get_reorder_all() Optional[int][source]

Returns the packet reordering parameters as the tuple (percent, [correlation])

get_gap() Optional[int][source]

Returns the gap (in packets) when reordering

qdisc_creation_args() List[str][source]

Returns the arguments expected by tc(8) to create a netem qdisc