WattsonNetworkDockerHost#
- class wattson.cosimulation.simulators.network.components.wattson_network_docker_host.WattsonNetworkDockerHost(*, 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:
WattsonNetworkHost,NetworkDockerHostMethods
Add a volume for mounting to the container (before it is started).
container_existscreate_containerExecutes a file-system related command (e.g., mounting).
- returns:
The boot command to start the container with.
get_class_idget_containerget_container_pidget_full_imageReturn the working directory of this node relative to this node.
Return the working directory of this node relative to the host machine running Wattson.
get_imageget_image_nameget_image_tagget_namespaceget_prefixget_python_executableget_volumeReturns a list of volumes to mount, represented by a dict with "host_path" and "docker_path" keys
is_container_runningis_image_installedis_valid_imageAttempts to open a terminal / konsole for the network host.
popenpull_imageremove_containerremove_volumeset_class_idstartstart_containerstopstop_containerCreates a dictionary for synchronization with a RemoteNetworkEntity.
Attributes
container_nameinterfacesconfigid- __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#
- add_volume(name: str, host_path: str, docker_path: str, permission: str = 'rw')#
Add a volume for mounting to the container (before it is started).
- Parameters:
name (str) – The name for the volume mount (i.e., an ID)
host_path (str) – The path on the host system
docker_path (str) – The mount path within the docker container
permission (str, optional) – The permissions for this folder (r, w, rw) (Default value = “rw”)
- exec_fs_cmd(cmd: List[str], **kwargs) int#
Executes a file-system related command (e.g., mounting). This does not necessarily belong to the network namespace in mixed-namespace environments
- Parameters:
cmd (List[str]) – The command to execute
**kwargs –
- Returns:
The command’s return code
- Return type:
int
- get_boot_command() str#
- Returns:
The boot command to start the container with.
- Return type:
str
- get_guest_folder() Path#
Return the working directory of this node relative to this node. This is just the host folder / artifact folder, except for nodes that use a different file system (e.g., Docker or VMs)
- Returns:
The working directory of this node relative to the node / guest.
- Return type:
Path
- get_host_folder() Path#
Return the working directory of this node relative to the host machine running Wattson.
- Parameters:
ensure_exists (bool, optional) – (Default value = True)
- Returns:
The working directory of this node relative to the host machine
- Return type:
Path
- get_volumes(with_default_mount: bool = True) List[Dict[str, str]]#
Returns a list of volumes to mount, represented by a dict with “host_path” and “docker_path” keys
- Parameters:
with_default_mount (bool, optional) – (Default value = True)
- open_terminal() bool#
Attempts to open a terminal / konsole for the network host.
- 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: