WattsonNetworkSwitch#

class wattson.cosimulation.simulators.network.components.wattson_network_switch.WattsonNetworkSwitch(*, id: str, system_name: Optional[str] = None, display_name: Optional[str] = None, network_emulator: Optional[ForwardRef('NetworkEmulator')] = None, emulation_instance: Optional[Any] = None, segment: str = 'main', config: dict = <factory>, _is_started: bool = False, logger: Optional[logging.Logger] = 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)#

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

is_ovs

on_interface_start

reset_flows

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: ~typing.Any | None = None, segment: str = 'main', config: dict = <factory>, _is_started: bool = False, logger: ~logging.Logger | None = None, interfaces: ~typing.List[WattsonNetworkInterface] = <factory>, priority: float = 4, _services: ~typing.Dict[int, ~wattson.services.wattson_service.WattsonService] = <factory>, _processes: ~typing.List[~subprocess.Popen] = <factory>, _min_interface_id: int = 0, _is_outside_namespace: bool = False) 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