OTNS requires Go 1.17+ to build:
- Install Go from https://golang.org/dl/
- Add
$(go env GOPATH)/bin
(normally$HOME/go/bin
) to$PATH
.
git clone https://github.com/openthread/ot-ns.git ./otns
cd otns
./script/install-deps
./script/install
OTNS uses POSIX simulation to simulate Thread nodes.
To build OpenThread for OTNS:
git clone https://github.com/openthread/openthread openthread
cd openthread
./script/bootstrap
./bootstrap
make -f examples/Makefile-simulation OTNS=1
After building OpenThread, run OTNS:
cd output/simulation/bin
otns
If started successfully, OTNS opens a web browser for network visualization and management.
Use a web browser to manage the simulated Thread network:
- Add, delete, and move various types of OpenThread nodes
- Disable and recover node radios
- Adjust simulation speed
See OTNS CLI Reference.
pyOTNS library provides utilities to create and manage simulations through OTNS CLI.
To review the pyOTNS
documentation:
- Start
pydoc3
document server:pydoc3 -p 8080
- Open a web browser and navigate to http://localhost:8080/otns.html.
For example test scripts, see pylibs/examples.