Tunnel Controller Module

class mtf.network_port.tunnel_controller.TunnelController

A controller class for managing network tunneling operations.

__init__(channel_name: str)
set_vlan(tap_name: str = '', inner_vlan: c_ulong = 0, outer_vlan: c_ulong = 0, inner_vlan_ethertype: c_ushort = 33024, outer_vlan_ethertype: c_ushort = 37120, inner_priority_tag: c_ubyte = 0, outer_priority_tag: c_ubyte = 0, inner_cfi: c_bool = False, outer_cfi: c_bool = False) None

Configures VLAN settings for a specified network interface (tap).

Args:

tap_name (str): The name of the tap interface to configure. Default is an empty string. inner_vlan (c_uint32): The inner VLAN ID to be set. Default is 0. outer_vlan (c_uint32): The outer VLAN ID to be set. Default is 0. inner_vlan_ethertype (c_uint16): The ethertype for the inner VLAN. Default is 0x8100. outer_vlan_ethertype (c_uint16): The ethertype for the outer VLAN. Default is 0x9100. inner_priority_tag (c_ubyte): The priority tag for the inner VLAN. Default is 0. outer_priority_tag (c_ubyte): The priority tag for the outer VLAN. Default is 0. inner_cfi (c_bool): The CFI (Canonical Format Indicator) for the inner VLAN. Default is False. outer_cfi (c_bool): The CFI for the outer VLAN. Default is False.

set_physical_callback(callback_function=None) None

Sets a callback function to handle physical layer events.

Args:
callback_function (function, optional): A function to handle physical layer events.

If no function is provided, the callback is not set.

set_virtual_callback(tap_name: str = '', callback_function=None) None

Sets a callback function to handle virtual layer events for a specified tap.

Args:
tap_name (str, optional): The name of the virtual tap for which the callback

will be set. If no name is provided, the callback is set for all taps.

callback_function (function, optional): A function to handle virtual layer events.

If no function is provided, the callback is not set.

start() None

Starts the tunnel controller.

stop() None

Stop the tunnel controller.