LLDP

class trex.emu.emu_plugins.emu_plugin_lldp.LLDPPlugin(emu_client)[source]

Defines LLDP plugin

INIT_JSON_NS = {'lldp': {}}
Parameters

Empty.

INIT_JSON_CLIENT = {'lldp': {}}
Parameters
timer: uint32

time in seconds betwean packets

options: dict

Dictionary that contains options

Options
raw: array of byte

generic options array for lldp options [60,8,77,83,70,84,32,53,46,48]

remove_default: bool

remove the default headers

get_counters(c_key, cnt_filter=None, zero=True, verbose=True)[source]

Get the LLDP counters of a client.

Parameters
c_key: trex.emu.trex_emu_profile.EMUClientKey

EMUClientKey

cnt_filter: list

List of counters types as strings. i.e: [‘INFO’, ‘ERROR’, ‘WARNING’]. Default is None, means no filter. If verbosity is off, this filter can’t be used.

zero: bool

Get zero values, default is True.

verbose: bool

Show verbose version of each counter, default is True.

Returns

Dictionary of all wanted counters. When verbose is True, each plugin contains a list of counter dictionaries.

{'pluginName': [{'help': 'Explanation 1',
                'info': 'INFO',
                'name': 'counterOne',
                'unit': 'pkts',
                'value': 8,
                'zero': False},
                {'help': 'Explanation 2',
                'info': 'ERROR',
                'name': 'counterTwo',
                'unit': 'pkts',
                'value': 6,
                'zero': False}]}

When verbose is False, each plugins returns a dictionary of counterName, value pairs.

{'pluginName': {'counterOne': 8, 'counterTwo': 6}}

Raises

TRexError

tear_down_ns(ns_key)

This function will be called before removing this plugin from namespace.

parameters
ns_key: EMUNamespaceKey

see trex.emu.trex_emu_profile.EMUNamespaceKey

clear_counters(c_key)[source]

Clear the LLDP counters of a client.

Parameters
c_key: trex.emu.trex_emu_profile.EMUClientKey

EMUClientKey

Returns

Boolean indicating if clearing was successful.
  • True: Clearing was successful.

  • False: Clearing was not successful.

Raises

TRexError

lldp_show_counters_line(line)[source]

Show lldp counters (per client).

trex.emu.emu_plugins.emu_plugin_lldp.wraps(func)

Replaces functools.wraps in order to undo wrapping.

Can be used to preserve the decorated function’s signature in the documentation generated by Sphinx.