EthNmController
- class mtf.network_port.nm_controller.EthNmController
Ethernet Network Management controller
- __init__(channel_name: str)
- get_nm_signal(signal_name: str, update_nm_signal_data=None)
Get network management signal value
- Args:
signal_name (UdpNmSignals): NM signal name update_nm_signal_data(Function): Update NM signal data
- Returns:
Union[int, List[int]]: requested signal value.
- static __new__(cls, *args, **kwargs)
Initialize a new instance of the ControllerBase.
The instance will be automatically added to the list of controllers.
- callback_(data_frame: BusEvent)
used as a callback function when an event or frame is received on the communication bus Args:
data_frame (BusEvent): The data frame
- clean_up()
Clean up all controller instances.
- Return:
bool
- classmethod controllers_cleanup()
Clean up all controller instances.
Calls the clean_up() method for each instance.
- get_message_queue() list[dict[str, Any]]
Get messages queue :return: :rtype:
- get_queue() list[dict[str, Any]]
Reset the internal state of an instance of the EthBusListener class
- get_timestamp_queue() list[int]
Retrieve the private attribute _timestamp_queue Return:
list[int]
- register_callback(callback_fnc: Callable[[IEthernetProtocol], None])
- Parameters:
callback_fnc – callback function with parameter of type
MessageEthernet
Setting a callback# ... from andisdk import MessageEthernet # ... def eth_listener_callback(msg: MessageEthernet): # do things # ... creating listener # register our callback listener.register_callback(eth_listener_callback)
Warning
The callback function should be lightweight without logs. Otherwise, it will reduce the performance dramatically. The object that is passed to callback functions is mutable. So the user must be careful. In case of silent mode, the callback functions will be invoked only when getting the queue.
- reset() None
Reset the state of the bus listener by clearing its history and emptying the event queue
- start(channel=None, keep_cache=False, silent_mode: bool = False)
Start a listener on a specific channel Args:
channel (str) keep_cache (bool) silent_mode (bool): Specify whether the listening should be done in silent mode or not
- Return:
bool
- start_listening(keep_cache=False, silent_mode: bool = False) bool
Starts listening on a bus and can be configured to operate in silent mode or to reset cached data before beginning to listen
- Args:
keep_cache (bool) silent_mode (bool): Specify whether the listening should be done in silent mode or not
- Return:
bool
- stop()
Stop a listener on a specific channel
- Return:
bool
- stop_listening() bool
Stop listening for events on a communication bus Return:
bool
- unregister_callback(callback_fnc: Callable[[IEthernetProtocol], None])
- Parameters:
callback_fnc – callback function with parameter of type
MessageEthernet
Remove a callback# ... from andisdk import MessageEthernet # ... def eth_listener_callback(msg: MessageEthernet): # do things # ... creating listener # ... do work # unregister our callback listener.unregister_callback(eth_listener_callback)
- adapt_queue_elements() Queue[BaseEvent]
ensure the object.timestamp, object.payload