RemoteNetworkNode#
- class wattson.cosimulation.simulators.network.components.remote.remote_network_node.RemoteNetworkNode(entity_id: str, wattson_client: WattsonClient, auto_sync: bool = True)#
Bases:
RemoteNetworkEntity
,NetworkNode
Methods
Adds an Interface and links it to this node.
add_role
Adds a service to this node.
Clear all existing mirror ports at this node
delete_role
Disable mirroring output to the given interface
Enable network mirroring at this node and use the given interface as mirror port
exec
Returns the contents of a file on the file system of this node.
Writes the given content string to the file on the file system of this node specified by path.
get_config
get_interface
get_interfaces
get_roles
get_service
get_service_by_name
get_services
has_role
Returns True iff the node's configuration already has a service section :return:
Attempts to open a terminal / konsole for this node (on the simulation server)
Spawn a new process on the remote network node.
Start the WattsonNetworkEntity
Start a packet capture on this node for the given interface.
Start all services associated with this WattsonNetworkEntity
Stop the WattsonNetworkEntity
Stops a packet capture on this node for the given interface.
Stop all services associated with this WattsonNetworkEntity
transform_path
update_config
- __init__(entity_id: str, wattson_client: WattsonClient, auto_sync: bool = True)#
- add_interface(interface: RemoteNetworkInterface)#
Adds an Interface and links it to this node.
- Parameters:
interface ('NetworkInterface') – The interface instance
- add_service(service: WattsonRemoteService)#
Adds a service to this node. This does not start the service.
- Parameters:
service (WattsonServiceInterface) – The service to add to this node.
- clear_mirrors() bool #
Clear all existing mirror ports at this node
- Returns:
Whether the action has been successfully performed
- Return type:
bool
- disable_mirror(interface: RemoteNetworkInterface) 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
- enable_mirror(interface: RemoteNetworkInterface) 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
- file_get_contents(path: Path) str | None #
Returns the contents of a file on the file system of this node.
- Parameters:
path (Path) – The path of the file to read.
- Returns:
The contents of the file or None if the file does not exist or is not readable.
- Return type:
Optional[str]
- file_put_contents(path: Path, contents: str) Tuple[bool, Path | None] #
Writes the given content string to the file on the file system of this node specified by path. Returns whether the operation succeeded.
- Parameters:
path (Path) – The path of the file to write to.
contents (str) – The contents of the file to write.
- Returns:
Whether the operation succeeded and the potentially transformed path of the target file.
- Return type:
Tuple[bool,Optional[Path]]
- has_services() bool #
Returns True iff the node’s configuration already has a service section :return:
- open_terminal() bool #
Attempts to open a terminal / konsole for this node (on the simulation server)
- Returns:
Whether a terminal could be opened.
- Return type:
bool
- popen(cmd: list[str] | str, **kwargs) RemotePopen #
Spawn a new process on the remote network node. The result is a RemotePopen object that represents the spawned process and mimics the behavior of a default subprocess.Popen object.
- Parameters:
cmd (Union[list[str], str]) – The command to execute
**kwargs –
- Returns:
A RemotePopen object representing the spawned process.
- Return type:
- start()#
Start the WattsonNetworkEntity
- start_pcap(interface: RemoteNetworkInterface | None = None) List[WattsonRemoteService] #
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’]
- start_services()#
Start all services associated with this WattsonNetworkEntity
- stop()#
Stop the WattsonNetworkEntity
- stop_pcap(interface: RemoteNetworkInterface | None = None)#
Stops a packet capture on this node for the given interface. If the interface is None, packet captures for all interfaces are stopped.
- Parameters:
interface (Optional['NetworkInterface'], optional) – (Optional) interface to stop the PCAP (Default value = None)
- stop_services()#
Stop all services associated with this WattsonNetworkEntity