Skip to content

[all] support for OT Posix nodes with RCP using realtime UART#190

Open
EskoDijk wants to merge 3 commits into
pr-ext-sim-nodesfrom
pr-real-uart-rcp-2
Open

[all] support for OT Posix nodes with RCP using realtime UART#190
EskoDijk wants to merge 3 commits into
pr-ext-sim-nodesfrom
pr-real-uart-rcp-2

Conversation

@EskoDijk

@EskoDijk EskoDijk commented Mar 4, 2026

Copy link
Copy Markdown
Owner

Note: this PR is based on PR 755 (pr-ext-sim-nodes) and must be merged after it.

This adds support for running a standard OT Posix node in a realtime simulation, where the Posix process performs realtime SPINEL/HDLC UART communication with an RCP. Support for RCPs is the basis to for upcoming features like including real OTBRs in a simulation, either running on the local host or running in a Docker.

The dispatcher/simulation core is updated to allow handling of both 'realtime UART' (stdout) based CLI and logging interactions and 'virtual-time UART' interactions by nodes in the same simulation. The real-time simulation mode has a separate code path in the Dispatcher that keeps the speed fixed at 1.0x and is coupled to the simulation host's OS system clock.

A method waitForSimulation() is introduced to avoid the need for custom simulation event processing loops at different places in the code. Also, the queueing and filtering of UART/log output of OT nodes is simplified to make the code better readable and the data flow easier to understand and debug.

The CLI (over PTY/UART/...) echo behavior differs for Linux Posix nodes that are controlled via stdin/stdout: there is no 'echo' behavior. Depending on OS, there could be. To handle all possible combinations of platform/node-type, there is a function 'setupCli' added that autodetects whether echo is used for a node, or not, and whether the CLI connection is functional.
To achieve this feature, some stale/unnecessary code related to the 'assurePrompt()' function was removed, also making the node CLI code more maintainable.

In the OT-RFSIM platform there's a fix in the otPlatRadioSleep() implementation to better comply to the API requirement for returning OT_ERROR_BUSY.

EskoDijk and others added 3 commits February 27, 2026 09:48
This PR enables a user to start a node process externally (interactive or scripted) to let it
join a running simulation. This feature makes interactive testing of new node builds easier,
as well as attaching a debugger or profiler to the node process, and allows providing the
node with a long/custom set of commandline arguments, as well as observing the node's stdout
and stderr outputs (and/or stdin input) directly in the terminal.

Dispatcher is updated to report newly detected node numbers to the parent simulation which
can then decide to add node objects for it. Also the checking/sanitizing of received events
is improved, so that a simulation can continue to run even if the node process sent incorrect
data or tries to claim an existing node ID.

Simulation is updated with a new node type EXT (external) which has special handling compared
to other node types. A specific startup script can be configured for EXT nodes, in YAML. By
default, the startup script uses the MTD's setup method and makes no assumptions about whether
the new node is MTD/FTD or Router/End Device.

Python library is updated to allow multiple OTNS instances with different sim-ids to run at
the same time. A method `get_otns_socket()` is added to retrieve the Unix socket file that
an external node needs for attaching to the simulation.
This adds support for running a standard OT Posix node in a realtime simulation, where
the Posix process performs realtime SPINEL/HDLC UART communication with an RCP.
Support for RCPs is the basis to for upcoming features like including real OTBRs in a
simulation, either running on the local host or running in a Docker.

The dispatcher/simulation core is updated to allow handling of both 'realtime UART'
(stdout) based CLI and logging interactions and 'virtual-time UART' interactions by
nodes in the same simulation. The real-time simulation mode has a separate code path
in the Dispatcher that keeps the speed fixed at 1.0x and is coupled to the simulation
host's OS system clock.

A method `waitForSimulation()` is introduced to avoid the need for custom simulation
event processing loops at different places in the code. Also, the queueing and
filtering of UART/log output of OT nodes is simplified to make the code better
readable and the data flow easier to understand and debug.

The CLI (over PTY/UART/...) echo behavior differs for Linux Posix nodes that are
controlled via stdin/stdout: there is no 'echo' behavior. Depending on OS, there could
be. To handle all possible combinations of platform/node-type, there is a function
'setupCli' added that autodetects whether echo is used for a node, or not, and whether
the CLI connection is functional.
To achieve this feature, some stale/unnecessary code related to the 'assurePrompt()'
function was removed, also making the node CLI code more maintainable.

In the OT-RFSIM platform there's a fix in the otPlatRadioSleep() implementation to
better comply to the API requirement for returning OT_ERROR_BUSY.

Co-authored-by: François Michel <francoismichel.dev@gmail.com>
@EskoDijk EskoDijk force-pushed the pr-ext-sim-nodes branch 2 times, most recently from b0bc1da to e952195 Compare March 8, 2026 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant