WattsonNetworkSwitch#

class wattson.cosimulation.simulators.network.components.wattson_network_switch.WattsonNetworkSwitch(*, id: str, system_name: str | None = None, display_name: str | None = None, network_emulator: ForwardRef('NetworkEmulator') | None = None, emulation_instance: Any | None = None, segment: str = 'main', config: dict = <factory>, _is_started: bool = False, logger: logging.Logger | None = None, interfaces: List[ForwardRef('WattsonNetworkInterface')] = <factory>, priority: float = 4, _services: Dict[int, wattson.services.wattson_service.WattsonService]=<factory>, _processes: List[subprocess.Popen] = <factory>, _min_interface_id: int = 0, _is_outside_namespace: bool = False, _child_nodes: List[ForwardRef('WattsonNetworkNode')] = <factory>, _parent: ForwardRef('WattsonNetworkNode') | None = None)#

Bases: WattsonNetworkNode, NetworkSwitch

Methods

__init__

clear_mirrors

Clear all existing mirror ports at this node

disable_mirror

Disable mirroring output to the given interface

disable_rstp

Disable participation in rapid spanning tree protocol

enable_mirror

Enable network mirroring at this node and use the given interface as mirror port

enable_rstp

Enable participation in rapid spanning tree protocol

get_emulation_entity_config

get_prefix

get_switch_management_ip_address_str

get_switch_management_prefix_length

is_manageable

is_ovs

on_add_to_emulator

on_interface_start

reset_flows

should_be_manageable

start

start_emulation_instance

start_pcap

Start a packet capture on this node for the given interface.

stop

stop_emulation_instance

to_remote_representation

Creates a dictionary for synchronization with a RemoteNetworkEntity.

Attributes

class_id

interfaces

config

id

__init__(*, id: str, system_name: str | None = None, display_name: str | None = None, network_emulator: NetworkEmulator | None = None, emulation_instance: Any | None = None, segment: str = 'main', config: dict = <factory>, _is_started: bool = False, logger: Logger | None = None, interfaces: List[WattsonNetworkInterface] = <factory>, priority: float = 4, _services: Dict[int, ~wattson.services.wattson_service.WattsonService]=<factory>, _processes: List[Popen] = <factory>, _min_interface_id: int = 0, _is_outside_namespace: bool = False, _child_nodes: List[WattsonNetworkNode] = <factory>, _parent: WattsonNetworkNode | None = None) None#
clear_mirrors()#

Clear all existing mirror ports at this node

Returns:

Whether the action has been successfully performed

Return type:

bool

disable_mirror(interface: WattsonNetworkInterface) bool#

Disable mirroring output to the given interface

Parameters:

interface ('NetworkInterface') – The interface used as mirror port

Returns:

Whether the action has been successfully performed

Return type:

bool

disable_rstp()#

Disable participation in rapid spanning tree protocol

enable_mirror(interface: WattsonNetworkInterface) bool#

Enable network mirroring at this node and use the given interface as mirror port

Parameters:

interface ('NetworkInterface') – The interface to use as mirror port

Returns:

Whether the action has been successfully performed

Return type:

bool

enable_rstp()#

Enable participation in rapid spanning tree protocol

start_pcap(interface: WattsonNetworkInterface | None = None) List[WattsonService]#

Start a packet capture on this node for the given interface. If the interface is None, all packets for all interfaces are captured.

Parameters:

interface (Optional['NetworkInterface'], optional) – (Optional) interface to start the PCAP for (Default value = None)

Returns:

A list of services that represent the packet capturing processes.

Return type:

List[‘WattsonServiceInterface’]

to_remote_representation(force_state_synchronization: bool = True) RemoteNetworkEntityRepresentation#

Creates a dictionary for synchronization with a RemoteNetworkEntity.

Parameters:

force_state_synchronization (bool, optional) – Whether to force a synchronization of the internal state with the actual state (Default value = True)

Returns:

A dictionary representation of this WattsonNetworkEntity for synchronization with a RemoteNetworkEntity.

Return type:

RemoteNetworkEntityRepresentation