CDP¶
- class trex.emu.emu_plugins.emu_plugin_cdp.CDPPlugin(emu_client)[source]¶
Defines CDP plugin
- INIT_JSON_NS = {'cdp': {}}¶
- Parameters
Empty.
- INIT_JSON_CLIENT = {'cdp': {}}¶
- Parameters
- timer: uint32
time in seconds betwean packets
- veruint32
1 or 2
- csuint16
replace the checksum to generate bad checksum. in case of zero calculate the right one.
- options: dict
the options to add to cdp
- Options
- raw: array of byte
generic options array for cdp [60,8,77,83,70,84,32,53,46,48]
- get_counters(c_key, cnt_filter=None, zero=True, verbose=True)[source]¶
Get the CDP 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.
- c_key:
- 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
- clear_counters(c_key)[source]¶
Clear the CDP counters of a client.
- Parameters
- c_key:
trex.emu.trex_emu_profile.EMUClientKey EMUClientKey
- c_key:
- Returns
- Boolean indicating if clearing was successful.
True: Clearing was successful.
False: Clearing was not successful.
- Raises
TRexError
- trex.emu.emu_plugins.emu_plugin_cdp.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.