# SPDX-FileCopyrightText: <text>Copyright 2026 Arm Limited
# and/or its affiliates <open-source-office@arm.com></text>
#
# SPDX-License-Identifier: MIT
"""
Runtime option dataclasses used by the FPGA networking and controller
layers for log paths, remote command execution, and UART login handling.
"""
from __future__ import annotations
from dataclasses import dataclass
from typing import Optional, Sequence
@dataclass(frozen=True)
[docs]
class LogPathOptions:
"""
Log destination overrides.
:param log_dir: Optional base directory for logs (default: <cwd>/logs).
:param log_prefix: Optional prefix for generating timestamped log folders.
"""
[docs]
log_dir: Optional[str] = None
[docs]
log_prefix: Optional[str] = None
@dataclass(frozen=True)
[docs]
class RemoteRunSpec:
"""
Structured specification for executing a remote command.
:param env_setup_cmds: Sequence of shell commands used to prepare the
environment before running the main remote command.
:param remote_cmd: The primary command to execute on the remote host.
:param remote_workdir: Optional remote working directory. If provided,
the execution flow will change into this directory before running
``remote_cmd``.
"""
[docs]
env_setup_cmds: Sequence[str]
[docs]
remote_workdir: Optional[str] = None
@dataclass(frozen=True)
[docs]
class ShellPromptWaitOptions:
"""
Configuration options for waiting on a shell prompt in a UART log.
:param timeout_s: Maximum time to wait for detection of login prompt.
:param poll_s: Polling interval in seconds between login prompt checks.
:param tail_lines: Number of lines from the end of the UART log inspected
when searching for the login marker.
"""
@dataclass(frozen=True)
[docs]
class LoginWaitOptions:
"""
Configuration options for waiting on a UART login prompt and shell prompt.
:param timeout_s: Maximum time to wait for detection of login prompt.
:param poll_s: Polling interval in seconds between login prompt checks.
:param tail_lines: Number of lines from the end of the UART log inspected
when searching for the login marker.
:param shell_prompt_timeout_s: Maximum time to wait for the shell prompt
after sending the login username.
"""
[docs]
shell_prompt_timeout_s: int = 120