NmTransmiter

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: int8 | None = 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: int8 | None = None, src_mac: str | None = 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: int8 | None = None, src_mac: str | None = 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: int8 | None = None, src_mac: str | None = 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: int8 | None = None, src_mac: str | None = 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)

Initialize a new instance of the ControllerBase.

The instance will be automatically added to the list of controllers.

classmethod controllers_cleanup()

Clean up all controller instances.

Calls the clean_up() method for each instance.