models.host¶
Pydantic boundary specs for the host record (a hosts.json entry).
HostSpec and its family subclasses validate a host dict and build the
unchanged runtime UnixHost / EmbeddedHost via to_host(). The specs
nest the per-protocol *OptionsSpec``s from ``otto.models.options and reuse
their to_runtime() builders; embedded registry-name fields
(filesystem / command_frame / loader) resolve through the existing
host registries at build time.
-
class otto.models.host.ToolchainSpec(*, sysroot: Path =
PosixPath('/'), lcov: Path =PosixPath('usr/bin/lcov'), gcov: Path =PosixPath('usr/bin/gcov'))¶ Bases:
OttoModel
-
class otto.models.host.HostSpec(*, ip: str, element: str, creds: dict[str, str] =
{}, name: str | None =None, os_type: str ='unix', os_name: str | None =None, os_version: str | None =None, user: str | None =None, element_id: int | None =None, board: str | None =None, slot: int | None =None, hop: str | None =None, is_virtual: bool =False, default_dest_dir: Path =PosixPath('.'), max_filename_len: int =255, resources: set[str] ={}, interfaces: dict[str, str] ={}, log: bool =True, log_stdout: bool =True, telnet_options: TelnetOptionsSpec =TelnetOptionsSpec(port=23, write_chunk_size=0, write_chunk_delay=0.0, cols=400, rows=24, encoding=False, connect_timeout=None, echo_negotiation_timeout=3.0, login_prompt=b':', login=True, single_client_console=False, auto_window_resize=False, extra={}), snmp: SnmpOptionsSpec | None =None, toolchain: ToolchainSpec =ToolchainSpec(sysroot=PosixPath('/'), lcov=PosixPath('usr/bin/lcov'), gcov=PosixPath('usr/bin/gcov')), command_frame: str | None =None, power_control: dict[str, Any] | str | None =None, labs: list[str] =[])¶ Bases:
OttoModel- telnet_options : TelnetOptionsSpec¶
- snmp : SnmpOptionsSpec | None¶
- toolchain : ToolchainSpec¶
-
to_host(cls: Any | None =
None, *, preferences: dict[str, list[str]] | None =None) RemoteHost¶ Build the runtime host this spec describes.
Overridden by the concrete family specs (
UnixHostSpec,EmbeddedHostSpec), each of which knows the runtime class to construct. The abstract base carries the contract so the storage factory can callspec.to_host(cls)against aHostSpecreference.
-
class otto.models.host.UnixHostSpec(*, ip: str, element: str, creds: dict[str, str], name: str | None =
None, os_type: str ='unix', os_name: str | None =None, os_version: str | None =None, user: str | None =None, element_id: int | None =None, board: str | None =None, slot: int | None =None, hop: str | None =None, is_virtual: bool =False, default_dest_dir: Path =PosixPath('.'), max_filename_len: int =255, resources: set[str] ={}, interfaces: dict[str, str] ={}, log: bool =True, log_stdout: bool =True, telnet_options: TelnetOptionsSpec =TelnetOptionsSpec(port=23, write_chunk_size=0, write_chunk_delay=0.0, cols=400, rows=24, encoding=False, connect_timeout=None, echo_negotiation_timeout=3.0, login_prompt=b':', login=True, single_client_console=False, auto_window_resize=False, extra={}), snmp: SnmpOptionsSpec | None =None, toolchain: ToolchainSpec =ToolchainSpec(sysroot=PosixPath('/'), lcov=PosixPath('usr/bin/lcov'), gcov=PosixPath('usr/bin/gcov')), command_frame: str | None =None, power_control: dict[str, Any] | str | None =None, labs: list[str] =[], hw_version: str | None =None, sw_version: str | None =None, valid_terms: list[str] =['ssh', 'telnet'], valid_transfers: list[str] =['scp', 'sftp', 'ftp', 'nc'], term: str | None =None, transfer: str | None =None, docker_capable: bool =False, ssh_options: SshOptionsSpec =SshOptionsSpec(port=22, known_hosts=None, connect_timeout=None, keepalive_interval=None, keepalive_count_max=None, client_keys=None, client_host_keys=None, agent_forwarding=False, preferred_auth=None, encryption_algs=None, server_host_key_algs=None, compression_algs=None, local_forwards=[], remote_forwards=[], socks_forwards=[], extra={}), sftp_options: SftpOptionsSpec =SftpOptionsSpec(env=None, send_env=None, extra={}), scp_options: ScpOptionsSpec =ScpOptionsSpec(preserve=False, recurse=True, block_size=16384, extra={}), ftp_options: FtpOptionsSpec =FtpOptionsSpec(port=21, encoding='utf-8', socket_timeout=None, connection_timeout=None, path_timeout=None, read_speed_limit=None, write_speed_limit=None, ssl=None, passive_commands=('epsv', 'pasv'), extra={}), nc_options: NcOptionsSpec =NcOptionsSpec(exec_name='nc', port=9000, port_strategy='auto', port_cmd=None, listener_check='auto', listener_cmd=None, listener_timeout=30.0))¶ Bases:
HostSpec- ssh_options : SshOptionsSpec¶
- sftp_options : SftpOptionsSpec¶
- scp_options : ScpOptionsSpec¶
- ftp_options : FtpOptionsSpec¶
- nc_options : NcOptionsSpec¶
- to_host(cls: type[~otto.host.unix_host.UnixHost] = <class 'otto.host.unix_host.UnixHost'>, *, preferences: dict[str, list[str]] | None = None) UnixHost¶
Build the runtime host this spec describes.
Overridden by the concrete family specs (
UnixHostSpec,EmbeddedHostSpec), each of which knows the runtime class to construct. The abstract base carries the contract so the storage factory can callspec.to_host(cls)against aHostSpecreference.
-
class otto.models.host.EmbeddedHostSpec(*, ip: str, element: str, creds: dict[str, str] =
{}, name: str | None =None, os_type: str ='embedded', os_name: str | None =None, os_version: str | None =None, user: str | None =None, element_id: int | None =None, board: str | None =None, slot: int | None =None, hop: str | None =None, is_virtual: bool =False, default_dest_dir: Path =PosixPath('.'), max_filename_len: int =255, resources: set[str] ={}, interfaces: dict[str, str] ={}, log: bool =True, log_stdout: bool =True, telnet_options: TelnetOptionsSpec =TelnetOptionsSpec(port=23, write_chunk_size=0, write_chunk_delay=0.0, cols=400, rows=24, encoding=False, connect_timeout=None, echo_negotiation_timeout=3.0, login_prompt=b':', login=True, single_client_console=False, auto_window_resize=False, extra={}), snmp: SnmpOptionsSpec | None =None, toolchain: ToolchainSpec =ToolchainSpec(sysroot=PosixPath('/'), lcov=PosixPath('usr/bin/lcov'), gcov=PosixPath('usr/bin/gcov')), command_frame: str | None =None, power_control: dict[str, Any] | str | None =None, labs: list[str] =[], valid_terms: list[str] =['telnet'], valid_transfers: list[str] =['console'], term: str | None =None, transfer: str | None =None, filesystem: str | None =None, loader: str | None =None)¶ Bases:
HostSpec- to_host(cls: type[~otto.host.embedded_host.EmbeddedHost] = <class 'otto.host.embedded_host.EmbeddedHost'>, *, preferences: dict[str, list[str]] | None = None) EmbeddedHost¶
Build the runtime host this spec describes.
Overridden by the concrete family specs (
UnixHostSpec,EmbeddedHostSpec), each of which knows the runtime class to construct. The abstract base carries the contract so the storage factory can callspec.to_host(cls)against aHostSpecreference.