host.remote_host

Abstract base for network-reached hosts.

RemoteHost is the common ancestor of every host class that talks to a target across a network — UnixHost (SSH/Telnet to a bash shell), EmbeddedHost (telnet to an RTOS shell), and any future siblings such as a Windows-host class. It is deliberately distinct from LocalHost, which runs commands on the local machine and shares no network plumbing.

History: this name used to belong to the concrete SSH/Telnet bash host. That class is now UnixHost; RemoteHost is the abstract parent. The split makes the OS family of a host explicit (lab data carries an os_type field) and gives embedded targets a place to live alongside Unix ones without lying about their shape.

RemoteHost is intentionally not a dataclass. The concrete subclasses are @dataclass(slots=True) and the field-ordering rules of dataclass inheritance (no non-default field after a default one) make a shared dataclass base awkward. Instead this base owns the behavior shared by every remote host — host naming and the SshHopTransport machinery — and declares, as bare annotations, the instance attributes those shared methods rely on. Each concrete subclass supplies the real @dataclass fields.

otto.host.remote_host.OsType

Profile selector recorded on a host (the os_type field).

Built-ins: unix (UnixHost), embedded (generic EmbeddedHost), zephyr (ZephyrHost). Custom profiles add more names. The base family (unix vs embedded) is derived from the host class, not from this string.

class otto.host.remote_host.RemoteHost

Bases: BaseHost

Abstract base class for any host reached over a network.

Concrete subclasses (UnixHost, EmbeddedHost) supply the transport-specific session/transfer machinery as @dataclass fields. Do not instantiate this class directly.

The bare annotations below are the instance-attribute contract every concrete subclass must satisfy. They carry no values, so they create no slots and do not participate in the subclasses’ @dataclass field collection — they exist purely so the shared methods here (and callers holding a RemoteHost-typed reference) type-check.

ip : --is-rst--str

IP address of the host.

element : --is-rst--str

Network element to which this host belongs.

id : --is-rst--str

Unique identifier for this host.

name : --is-rst--str

Human-readable name; auto-generated from element/board if not given.

creds : --is-rst--dict[str, str]

Users and their respective passwords for this host.

resources : --is-rst--set[str]

Names of resources required to use this host.

log : --is-rst--bool

Whether this host logs its output to stdout and log files.

user : --is-rst--Optional[str]

User with which to log in, or None to use the first entry in creds.

element_id : --is-rst--Optional[int]

Network element identifier, or None when no disambiguation is needed.

board : --is-rst--Optional[str]

Board type name, or None.

slot : --is-rst--Optional[int]

Physical slot number of the board, or None.

hop : --is-rst--Optional[str]

Host ID of the intermediate hop used to reach this host, or None.

os_type : --is-rst--OsType

Profile selector recorded on this host (see OsType). The base family (unix vs embedded) is derived from the host class, not this string.

os_name : --is-rst--Optional[str]

Kernel/OS name (e.g. Linux, Zephyr).

os_version : --is-rst--Optional[str]

OS/kernel version string, or None if unspecified.

default_dest_dir : --is-rst--Path

Per-host default directory that put() / get() resolve a relative or empty dest_dir against. Lets a fan-out helper like do_for_all_hosts() pass one generic destination (Path()) and have each host land the files where its filesystem actually lives — e.g. /RAM: on a Zephyr FAT target, /lfs on a Zephyr LittleFS target. Defaults to Path() on Unix, which preserves the existing “relative path lands in the SSH user’s home” behavior.

snmp : --is-rst--Optional[SnmpOptions]

Optional per-host SNMP polling config (lab snmp block), or None. When set, otto’s monitor collects this host over SNMP instead of by running shell commands. Declared on both concrete subclasses; see SnmpOptions.

max_filename_len : --is-rst--int

Upper bound on the basename length (including extension) accepted by the target’s filesystem. Defaults to 255 on every concrete subclass — the Linux NAME_MAX, also the cap for ext4 / XFS / Btrfs / NTFS and the typical LittleFS ceiling. Override per-host when the firmware enforces a tighter limit (e.g. 32 for a Zephyr build that sets CONFIG_FS_FATFS_MAX_LFN=32, or 12 for a stock FAT 8.3 build without LFN support). put / get reject over-limit names up front with a clear message instead of letting the device produce an opaque error like -ENOENT or File name too long.

interfaces : --is-rst--dict[str, str]

Named secondary interface addresses, keyed by interface name (e.g. {"mgmt": "10.0.0.5", "data": "192.168.1.5"}). The primary address stays ip; this map is additive and optional (empty by default). Resolve a name (or pass a literal through) with address_for().

address_for(name_or_literal)

Resolve an interface name to its address, or pass a literal through.

If name_or_literal is a key in interfaces, return that interface’s address; otherwise return the value unchanged (it is taken to be a literal address such as ip or an explicit IP). This lets a host’s snmp.address name a secondary interface without otto having to distinguish names from literals.

Return type:

str