RemoteNetworkEmulator#

class wattson.cosimulation.simulators.network.remote_network_emulator.RemoteNetworkEmulator(wattson_client: WattsonClient)#

Bases: object

Methods

__init__

add_on_topology_changed_callback

connect_interfaces

connect_nodes

Connects two nodes with a new link connecting two new interfaces.

create_docker

create_host

create_interface

Creates a network interface at a given node and returns its remote representation.

create_node

Creates a new NetworkNode in the running network emulation.

create_router

create_switch

find_node_by_id

Searches for a node with the given (non-prefixed) ID and returns the node.

find_node_by_name

Searches for a node with the given display name.

find_nodes_by_ip_address

Searches for all nodes with the given IP address and returns the nodes.

find_nodes_by_role

get_entities

get_host

get_hosts

get_instance

get_interface

get_interface_by_id

get_interfaces

get_link

get_links

get_node

get_nodes

get_router

get_routers

get_switch

get_switches

get_unused_ip

has_interface

query

remove_interface

remove_link

remove_node

remove_on_topology_changed_callback

synchronize

__init__(wattson_client: WattsonClient)#
connect_nodes(node_a: str | RemoteNetworkNode, node_b: str | RemoteNetworkNode, interface_a_options: dict | None = None, interface_b_options: dict | None = None, link_options: dict | None = None, update_default_routes: bool = False) Tuple[RemoteNetworkInterface, RemoteNetworkLink, RemoteNetworkInterface]#

Connects two nodes with a new link connecting two new interfaces.

Parameters:
  • node_a (Union[str, RemoteNetworkNode]) – entity_id or RemoteNetworkNode instance of the first node.

  • node_b (Union[str, RemoteNetworkNode]) – entity_id or RemoteNetworkNode instance of the second node.

  • interface_a_options (Optional[dict], optional) – Options for the newly created interface of node a. (Default value = None)

  • interface_b_options (Optional[dict], optional) – Options for the newly created interface of node b. (Default value = None)

  • link_options (Optional[dict], optional) – Options for the newly created lincd Doc k. (Default value = None)

  • update_default_routes (bool, optional) – Whether to update the default routes of the freshly connected nodes.

Returns:

The newly created RemoteNetworkInterface at node a, the

newly created RemoteNetworkLink and the newly created RemoteNetworkInterface at node b.

Return type:

Tuple[RemoteNetworkInterface,RemoteNetworkLink,RemoteNetworkInterface]

create_interface(node: str | RemoteNetworkNode, interface_id: str, arguments: dict | None = None, config: dict | None = None) RemoteNetworkInterface | None#

Creates a network interface at a given node and returns its remote representation.

Parameters:
  • node (Union[str, RemoteNetworkNode]) – The node to create the network interface for.

  • interface_id (str) – The entity_id of the interface to create

  • arguments (Optional[dict], optional) – Arguments to pass to the constructor (Default value = None)

  • config (Optional[dict], optional) – Config options to pass to the constructor (Default value = None)

Returns:

The RemoteNetworkInterface instance

Return type:

Optional[RemoteNetworkInterface]

create_node(entity_id: str, node_class: ~typing.Type[~wattson.cosimulation.simulators.network.components.interface.network_node.NetworkNode] = <class 'wattson.cosimulation.simulators.network.components.remote.remote_network_node.RemoteNetworkNode'>, arguments: dict | None = None, config: dict | None = None) RemoteNetworkNode#

Creates a new NetworkNode in the running network emulation.

Parameters:
  • entity_id (str) – The entity_id of the new node

  • node_class (Type[NetworkNode], optional) – The node type class, i.e., NetworkNode or a respective subclass (Default value = RemoteNetworkNode)

  • arguments (Optional[dict], optional) – Arguments to pass to the node constructor (Default value = None)

  • config (Optional[dict], optional) – The config to pass to the node constructor (Default value = None)

Returns:

A remote representation of the newly created node.

Return type:

RemoteNetworkNode

find_node_by_id(node_id: str) RemoteNetworkNode#

Searches for a node with the given (non-prefixed) ID and returns the node.

Parameters:

node_id (str) – The id of the node to search for

Returns:

The node with the given Id

Return type:

RemoteNetworkNode

Raises:

NetworkNodeNotFoundException – if no node with the given ID is found

find_node_by_name(node_name: str) RemoteNetworkNode#

Searches for a node with the given display name.

Parameters:

node_name (str) – The name to search for

Returns:

The (first) the node with the given display name

Return type:

RemoteNetworkNode

Raises:

NetworkNodeNotFoundException – if no node with the given name is found

find_nodes_by_ip_address(ip_address: str | IPv4Address) List[RemoteNetworkNode]#

Searches for all nodes with the given IP address and returns the nodes.

Parameters:

ip_address (Union[str, ipaddress.IPv4Address]) – The IP address to search for

Returns:

A list of nodes with the given IP address

Return type:

List[RemoteNetworkNode]