This repo contains 'ot-rfsim', an example OpenThread platform driver for simulated OT nodes. A simulated OT node can be started from an RF simulator, such as OT-NS2. It connects to the simulator using the Unix Domain Socket as provided in the commandline parameters.
The easiest way to use this code is just to install OT-NS2, following the OT-NS2 Guide.
After cloning the repo, you must initialize the git submodule.
$ git submodule update --init
The submodule is openthread
with (a recent) openthread main
branch code.
Below shows first an example default build for use of the binaries in OT-NS simulation.
This includes debug logging, for extra debug info that can then be optionally displayed in OT-NS using the
watch
command. The debug logging is also stored in a file, per node.
$ ./script/build
Below shows an example build for OT-NS with build option OT_FULL_LOGS set to 'OFF', to disable the debug logging. This helps to speed up the simulation because far less socket communication events are then generated.
$ ./script/build -DOT_FULL_LOGS=OFF
Below shows an example build for OT-NS with build option OT_CSL_RECEIVER set to 'OFF', to disable the CSL receiver. This is normally enabled for the FTD build, so that it can emulate an MTD SED with CSL. But there may be a specific reason to disable it for an FTD build. (E.g. because a separate MTD build is done with CSL enabled, already.)
$ ./script/build -DOT_CSL_RECEIVER=OFF
After a successful build, the executable files are found in the directory:
./build/bin
There are some scripts (./script/build_*
) for building specific versions of OpenThread nodes for use in OT-NS.
There are specific commands in OT-NS to add e.g. v1.1, or v1.2 nodes, all mixed in one simulation.
These build scripts produce executables that are copied into the ot-versions
directory.
The executables in bin
can be briefly tested on the command line as follows:
$ cd build/bin
$ ./ot-cli-ftd
Usage: ot-cli-ftd <nodeNumber> <OTNS-socket-file>
$
This will print a usage message and exit the node.
The ot-cli-ftd
is by default used in the OT-NS simulator for all node types except BR. But also ot-cli-mtd
can be
configured for use for MED, SED and SSED.
One way to use the ot-cli-ftd
is to cd
to the path where the file is and start OT-NS:
$ cd build/bin
$ otns
> add router x 50 y 50
1
Done
Another way is to run OT-NS from the same directory from where it was installed. In this case, it will use
the binaries that are built into ./ot-rfsim/ot-versions
which is in the ot-rfsim
submodule. These binaries can be
built using the various ./script/build_*
scripts that are part of this repo.
We would love for you to contribute to OpenThread and help make it even better than it is today! See our Contributing Guidelines for more information.
Contributors are required to abide by our Code of Conduct and Coding Conventions and Style Guide.
OpenThread is released under the BSD 3-Clause license.
See the LICENSE
file for more information.
Please only use the OpenThread name and marks when accurately referencing this software distribution. Do not use the marks in a way that suggests you are endorsed by or otherwise affiliated with Nest, Google, or The Thread Group.
OpenThread support is available on GitHub:
- Bugs and feature requests pertaining to the ot-rfsim platform — submit to the ot-rfsim Issue Tracker
- OpenThread bugs and feature requests — submit to the OpenThread Issue Tracker
- Community Discussion - ask questions, share ideas, and engage with other community members