ICMP¶
- class trex.emu.emu_plugins.emu_plugin_icmp.ICMPPlugin(emu_client)[source]¶
Defines ICMP plugin
- INIT_JSON_NS = {'icmp': {}}¶
- Parameters
Empty.
- INIT_JSON_CLIENT = {'icmp': {}}¶
- Parameters
Empty.
- get_counters(ns_key, cnt_filter=None, zero=True, verbose=True)[source]¶
Get the ICMP counters of a namespace.
- Parameters
- ns_key:
trex.emu.trex_emu_profile.EMUNamespaceKey EMUNamespaceKey
- 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.
- ns_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
- clear_counters(ns_key)[source]¶
Clear the ICMP counters of a namespace.
- Parameters
- ns_key:
trex.emu.trex_emu_profile.EMUNamespaceKey EMUNamespaceKey
- ns_key:
- Returns
- Boolean indicating if clearing was successful.
True: Clearing was successful.
False: Clearing was not successful.
- Raises
TRexError
- start_ping(c_key, amount=None, pace=None, dst=None, timeout=None, payload_size=None)[source]¶
Start pinging, sending Echo Requests.
- Parameters
- c_key: EMUClientKey
- amount: int
Amount of Echo Requests to send.
- pace: float
Pace in which to send the packets in pps (packets per second).
- dst: list of bytes
Destination IPv4. For example: [1, 1, 1, 3]
- timeout: int
Time to collect the results in seconds, starting when the last Echo Request is sent.
- payload_size: int
Size of the ICMP payload, in bytes.
- Returns
(RPC Response, TRexError), one of the entries is None.
- tear_down_ns(ns_key)¶
This function will be called before removing this plugin from namespace.
- parameters
- ns_key: EMUNamespaceKey
- get_ping_stats(c_key, zero=True)[source]¶
Get the stats of an active ping.
- Parameters
- c_key: EMUClientKey
- zero: boolean
Get values that equal zero aswell.
- Returns
(RPC Response, TRexError), one of the entries is None.
- trex.emu.emu_plugins.emu_plugin_icmp.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.