Nm Transmitter Module

class mtf.network_port.nm_transmitter.NmTransmiter

Network Management Transmitter

__init__(bus_name: str)
create_ethernet_packet(payload: list[int], src_ip: str, dest_ip: str, dest_mac: str, src_port: str, dest_port: str, vlan_code: numpy.byte = None)

Create the ethernet NM packet.

Args:

payload (list[int]): payload to be sent src_ip (str): source adapter ip address dest_ip (str): destination ip address dest_mac (str): destination mac address src_port (str): source port dest_port (str): destination port vlan_code (byte, optional): VlAN tag. Defaults to None.

Returns:

list of bytes: an ethernet packet

create_user_payload(payload: list[int], srcip: str, destip: str, srcport: str, destport: str, vlan_code: numpy.byte = None, src_mac: str = None)

_summary_

Args:

payload (list[int]): _description_ srcip (str): _description_ destip (str): _description_ srcport (str): _description_ destport (str): _description_ vlan_code (byte, optional): _description_. Defaults to None. src_mac (str, optional): _description_. Defaults to None.

Returns:

_type_: _description_

start_cyclic_nm(cycle: int, payload: list[int], srcip: str, destip: str, srcport: str, destport: str, vlan_code: numpy.byte = None, src_mac: str = None)

start to send of tester present every cycle time.

Parameters:
  • cycle (int) – cycle

  • payload (list of int) – payload

  • srcip (str) – source_ip

  • destip (str) – destination ip address

  • srcport (int) – source port

  • destport (int) – destination port

  • vlan_code (int) – vlan tag code (0x44 for NM)

  • src_mac (str) – source mac address

Returns:

No return value.

Return type:

update_cyclic_nm_data(payload: list[int], srcip: str, destip: str, srcport: str, destport: str, vlan_code: numpy.byte = None, src_mac: str = None)

Updates the cyclically sent packet’s data

stop_cyclic_nm() None

Stop sending the cyclic NM packets.

Returns:

nothing to be returned

Return type:

send_hard_nm_signal(payload: list[int], srcip: str, destip: str, srcport: str, destport: str, vlan_code: numpy.byte = None, src_mac: str = None) bool

Send an ethernet packet.

Args:

payload (list[int]): packet’s payload srcip (str): source adapter ip address destip (str): destination ip address srcport (str): source port destport (str): destination port vlan_code (byte, optional): VLAN tag. Defaults to None. src_mac (str, optional): source mac address

Returns:

bool: True if the packet was sent.Else False

clean_up() bool

cleanup nm transmitter

static __new__(cls, *args, **kwargs)

Creates a new instance.

Args:

*args: The variable arguments list. **wargs: The keyword arguments list.

Returns:

ControllersBase: The newly created instance.

Note:

Note

The instance will be automatically added to the list of controllers to be cleaned up later. It guarantees that all the controller instances are followed up and cleaned up when the associate method ‘controllers_cleanup(cls)’ is called.

Important

Do not override this method in subclasses to maintain this functionality.

classmethod controllers_cleanup()

Cleans up all controller instances.

It calls clean_up() for each controller in the list. If a cleanup fails, an error is raised, but the method continues processing the remaining controllers.

Returns:
bool: True indicating that all controllers were cleaned up successfully.

Otherwise, False is returned when an error occurs during the cleanup process.