[all] support for OT Posix nodes with RCP using realtime UART#190
Open
EskoDijk wants to merge 3 commits into
Open
[all] support for OT Posix nodes with RCP using realtime UART#190EskoDijk wants to merge 3 commits into
EskoDijk wants to merge 3 commits into
Conversation
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>
b0bc1da to
e952195
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.