Skip to content

Add OTBR node type for real-time mode (draft PR)#780

Draft
EskoDijk wants to merge 4 commits into
openthread:mainfrom
EskoDijk:pr-br
Draft

Add OTBR node type for real-time mode (draft PR)#780
EskoDijk wants to merge 4 commits into
openthread:mainfrom
EskoDijk:pr-br

Conversation

@EskoDijk
Copy link
Copy Markdown
Contributor

@EskoDijk EskoDijk commented Apr 6, 2026

This includes the existing 'RCP' PR commit. On top of this, the final commit adds the OTBR.

The OTBR allows interfacing to a real Ethernet/Wi-Fi network. An 'OTBR' button is added in the GUI when in real-time mode. Note: this is still draft code; and only 1 OTBR can be added at a time. No tests added yet.

@EskoDijk EskoDijk marked this pull request as draft April 6, 2026 18:46
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for real-time simulation mode and new node types, specifically OpenThread Border Routers (OTBR) and Radio Co-Processors (RCP). Key changes include the implementation of a real-time UART driver in the ot-rfsim platform, updates to the dispatcher to handle real-time clock synchronization, and new build scripts and CLI commands to manage these advanced node configurations. Feedback focuses on improving the robustness of the new UART implementation, specifically by handling EINTR signals during I/O operations and preventing potential deadlocks in the UART data processing loop when internal buffers are full.

Comment thread simulation/node.go Outdated
Comment thread ot-rfsim/src/uart.c Outdated
Comment thread ot-rfsim/src/uart.c
…ead#769)

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 process.
Support for RCPs is the basis 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 now has a different time
keeping mechanism that is synced to the host's clock and processes continuously, not
based on discrete time periods or different speeds - like virtual-time simulation is.
Deletion of nodes is updated in real-time mode: it is ongoing in the background in a
separate goroutine, to ensure the simulation doesn't halt upon node deletion and that
all final log messages of the exiting node are captured also.

A method waitForSimulation() is introduced to be more clear when command processing
needs to wait for simulation events to be processed first. It simplifies the code
in expectEvent() and expectLine() functions also.

Also, the queueing and filtering of UART/log output of OT nodes is simplified to make
the code better readable and the UART 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 echo. To handle all possible combinations of platform/node-type, there is a new function
'setupCli' added that autodetects whether echo is used for a node, or not, and whether
the CLI connection is functional.

The RFSIM radio C code is updated to avoid going to sleep when there are still OTNS
events in the queue, received via the Unix socket. This ensures faster overall
processing with less events being sent, relevant for nodes to keep up in real-time
mode.

Finally, previous build errors for the rcp target (Issue openthread#758) are now resolved.

Close openthread#758

Co-authored-by: François Michel <francoismichel.dev@gmail.com>
EskoDijk added 2 commits May 12, 2026 23:04
The OTBR allows interfacing to a real Ethernet/Wi-Fi network. An 'OTBR' button is added in the GUI
when in real-time mode. Only 1 OTBR can be added at a time.

Binaries otbr-agent and ot-ctl are used, running as root user via 'sudo -n'. Automatic instructions
for 'sudoers' will appear if the user attempts to start an OTBR without these processes having root
permission. A build script is added to easily build these binaries and install them.

The OTBR can be started with the 'restore' flag to let it restore previous (NVM) network settings
in /var/lib/thread.

GUIDE.md is updated with instructions to build an OTBR and run OTNS correctly.
… 2) log style output of otbr.sh; 3) param if to set bb interface per OTBR; 4) fast fail handling when OTBR process exits - without 5 sec wait.
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