├── .clang-format ├── .clang-tidy ├── .codecov.yml ├── .dockerignore ├── .github ├── dependabot.yml └── workflows │ ├── build.yml │ ├── develop.yml │ ├── docker.yml │ ├── lint.yml │ ├── stress.yml │ └── test.yml ├── .gitignore ├── .gitmodules ├── .golangci.yml ├── .prettierrc ├── AUTHORS ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── GUIDE.md ├── LICENSE ├── README.md ├── cli ├── CmdRunner.go ├── README.md ├── ast.go ├── cli_test.go ├── help.go ├── runcli.go ├── types.go └── yaml_test.go ├── cmd ├── otns-replay │ ├── grpc_service.go │ └── otns_replay.go ├── otns │ └── otns.go └── real │ └── otns-silk-proxy │ └── otns-silk-proxy.go ├── dispatcher ├── FailureCtrl.go ├── FailureCtrl_test.go ├── Node.go ├── alarm_mgr.go ├── coaps.go ├── dispatcher.go ├── dispatcher_config.go ├── rloc16_map.go ├── rloc16_map_test.go ├── send_queue.go ├── send_queue_test.go ├── stats.go ├── types.go └── visualization_options.go ├── dissectpkt ├── dissectpkt.go └── wpan │ └── wpan.go ├── energy ├── core.go ├── node.go └── types.go ├── etc ├── cli-scripts │ └── ot-script-example.yaml ├── docker │ ├── environment │ │ └── Dockerfile │ └── playground │ │ └── Dockerfile ├── mesh-topologies │ ├── office_200.yaml │ ├── office_50.yaml │ └── test_mesh_topology.yaml └── ot-registrar │ └── credentials_registrar.p12 ├── event ├── event.go └── event_test.go ├── go.mod ├── logger ├── logger.go ├── nodelogger.go └── parse.go ├── ot-rfsim ├── CMakeLists.txt ├── README.md ├── etc │ └── ot-mbedtls-settings.patch ├── ot-versions │ └── README.md ├── script │ ├── build │ ├── build_all │ ├── build_br │ ├── build_br_ccm │ ├── build_ccm │ ├── build_latest │ ├── build_v11 │ ├── build_v12 │ └── build_v13 └── src │ ├── CMakeLists.txt │ ├── alarm.c │ ├── ble.c │ ├── crypto.c │ ├── diag.c │ ├── dso_transport.c │ ├── entropy.c │ ├── event-sim.c │ ├── event-sim.h │ ├── flash.c │ ├── infra_if.c │ ├── logging.c │ ├── misc.c │ ├── openthread-core-rfsim-config-check.h │ ├── openthread-core-rfsim-config.h │ ├── platform-rfsim.c │ ├── platform-rfsim.cpp │ ├── platform-rfsim.h │ ├── radio-parameters.h │ ├── radio.c │ ├── radio.h │ ├── system.c │ ├── trel.c │ └── uart.c ├── otns_main └── otns_main.go ├── otnstester ├── OtnsTest.go └── tests │ ├── consts.go │ ├── otns_basic_test.go │ ├── otns_many_children_test.go │ └── otns_one_router_test.go ├── pcap ├── PcapFile.go ├── PcapFile_test.go └── PcapTapFile.go ├── prng └── prng.go ├── progctx ├── progctx.go └── progctx_test.go ├── pylibs ├── case_studies │ ├── deprecated_prefix.py │ ├── fast_key_rotation.py │ ├── forced_key_rotation.py │ ├── fragment_reassembly.py │ ├── large_diagnostics.py │ ├── office_floor.py │ ├── office_floor_multi_runs.py │ ├── partial_dataset.py │ ├── srp_dataset_types.py │ ├── srp_lease_time.py │ ├── srp_remove_service.py │ ├── srp_reregistration.py │ ├── srp_reregistration_2.py │ ├── srp_reregistration_3.py │ └── traffic_patterns.py ├── examples │ ├── diagnostics.py │ ├── dns_client.py │ ├── farm.py │ ├── form_partition.py │ ├── hidden_nodes_test.py │ ├── interactive_cli.py │ ├── interactive_cli_threaded.py │ ├── many_hops_network.py │ ├── multiple_channels.py │ ├── ping.py │ ├── power_cycle.py │ ├── rekey.py │ ├── simple.py │ ├── srp.py │ └── tcp.py ├── node_clicker.py ├── otns │ ├── __init__.py │ ├── cli │ │ ├── OTNS.py │ │ ├── __init__.py │ │ └── errors.py │ ├── errors.py │ └── proto │ │ ├── __init__.py │ │ ├── visualize_grpc_pb2.py │ │ └── visualize_grpc_pb2_grpc.py ├── setup.py ├── stress_tests │ ├── BaseStressTest.py │ ├── README.md │ ├── StressTestResult.py │ ├── commissioning.py │ ├── errors.py │ ├── external_routes.py │ ├── large_network_forming.py │ ├── mleid_connectivity.py │ ├── multicast_performance.py │ ├── network_forming.py │ ├── network_latency.py │ ├── network_limits.py │ ├── otns_performance.py │ ├── run_stress_suite.py │ ├── service_connectivity.py │ └── very_large_network_forming.py └── unittests │ ├── OTNSTestCase.py │ ├── requirements.txt │ ├── test_basic.py │ ├── test_border_router.py │ ├── test_ccm_commissioning.py │ ├── test_commissioning.py │ ├── test_csl.py │ ├── test_exe_versions.py │ ├── test_ping.py │ ├── test_radiomodels.py │ ├── test_signals.py │ ├── test_sim_hosts.py │ └── test_topologies.py ├── radiomodel ├── ber_model.go ├── fading_model.go ├── model_params.go ├── pathloss_model.go ├── radiomodel.go ├── radiomodelIdeal.go ├── radiomodelMutualInterference.go ├── radionode.go └── utils.go ├── script ├── bootstrap ├── common.sh ├── compile-proto ├── docker-build ├── install ├── install-deps ├── install-nodes ├── make-pretty ├── pack-web ├── run-docker-pack-web ├── setup-dev ├── test └── utils.sh ├── simulation ├── kpi.go ├── kpi_data.go ├── kpi_test.go ├── node.go ├── node_config.go ├── node_config_test.go ├── nodescript_parser.go ├── sim_hosts.go ├── simulation.go ├── simulationController.go ├── simulation_config.go ├── simulation_io.go ├── types.go ├── utils.go └── utils_test.go ├── types ├── node_config.go ├── ot_types.go ├── rfsim_types.go └── types.go ├── visualize ├── SimulationController.go ├── grpc │ ├── grpcField.go │ ├── grpcNode.go │ ├── grpcServer.go │ ├── grpcServer_test.go │ ├── grpcStream.go │ ├── grpcVisualizer.go │ ├── pb │ │ ├── visualize_grpc.pb.go │ │ └── visualize_grpc.proto │ └── replay │ │ └── replay.go ├── multi │ └── multiVisualizer.go ├── nopVisualizer.go ├── statslog │ └── statslogVisualizer.go └── types.go └── web ├── site ├── bindata.go ├── bindata_test.go ├── js │ ├── energy │ │ ├── energyConsChart.js │ │ ├── nodeEnergyConsBarChart.js │ │ └── powerConsChart.js │ ├── energyViewer.js │ ├── stats │ │ ├── StatsVisualizer.js │ │ └── nodeNumbersChart.js │ ├── statsViewer.js │ ├── vis │ │ ├── ActionBar.js │ │ ├── Button.js │ │ ├── LVObject.js │ │ ├── LogWindow.js │ │ ├── Node.js │ │ ├── NodeWindow.js │ │ ├── PixiVisualizer.js │ │ ├── VObject.js │ │ ├── consts.js │ │ ├── format_text.js │ │ ├── message.js │ │ ├── resources.js │ │ └── wrapper.js │ └── visualize.js ├── package.json ├── site.go ├── site_test.go ├── static │ └── image │ │ ├── checked-checkbox-32.png │ │ ├── gua.png │ │ ├── pause-32.png │ │ ├── play-32.png │ │ ├── unchecked-checkbox-32.png │ │ └── white-shapes │ │ ├── circle-128.png │ │ ├── circle-16.png │ │ ├── circle-24.png │ │ ├── circle-256.png │ │ ├── circle-32.png │ │ ├── circle-48.png │ │ ├── circle-512.png │ │ ├── circle-64.png │ │ ├── circle-dashed-4-128.png │ │ ├── circle-dashed-4-16.png │ │ ├── circle-dashed-4-24.png │ │ ├── circle-dashed-4-256.png │ │ ├── circle-dashed-4-32.png │ │ ├── circle-dashed-4-48.png │ │ ├── circle-dashed-4-512.png │ │ ├── circle-dashed-4-64.png │ │ ├── circle-dashed-6-128.png │ │ ├── circle-dashed-6-16.png │ │ ├── circle-dashed-6-24.png │ │ ├── circle-dashed-6-256.png │ │ ├── circle-dashed-6-32.png │ │ ├── circle-dashed-6-48.png │ │ ├── circle-dashed-6-512.png │ │ ├── circle-dashed-6-64.png │ │ ├── circle-dashed-8-128.png │ │ ├── circle-dashed-8-16.png │ │ ├── circle-dashed-8-24.png │ │ ├── circle-dashed-8-256.png │ │ ├── circle-dashed-8-32.png │ │ ├── circle-dashed-8-48.png │ │ ├── circle-dashed-8-512.png │ │ ├── circle-dashed-8-64.png │ │ ├── circle-outline-128.png │ │ ├── circle-outline-16.png │ │ ├── circle-outline-24.png │ │ ├── circle-outline-256.png │ │ ├── circle-outline-32.png │ │ ├── circle-outline-48.png │ │ ├── circle-outline-512.png │ │ ├── circle-outline-64.png │ │ ├── hexagon-128.png │ │ ├── hexagon-16.png │ │ ├── hexagon-24.png │ │ ├── hexagon-256.png │ │ ├── hexagon-32.png │ │ ├── hexagon-48.png │ │ ├── hexagon-512.png │ │ ├── hexagon-64.png │ │ ├── hexagon-outline-128.png │ │ ├── hexagon-outline-16.png │ │ ├── hexagon-outline-24.png │ │ ├── hexagon-outline-256.png │ │ ├── hexagon-outline-32.png │ │ ├── hexagon-outline-48.png │ │ ├── hexagon-outline-512.png │ │ ├── hexagon-outline-64.png │ │ ├── octagon-128.png │ │ ├── octagon-16.png │ │ ├── octagon-24.png │ │ ├── octagon-256.png │ │ ├── octagon-32.png │ │ ├── octagon-48.png │ │ ├── octagon-512.png │ │ ├── octagon-64.png │ │ ├── octagon-outline-128.png │ │ ├── octagon-outline-16.png │ │ ├── octagon-outline-24.png │ │ ├── octagon-outline-256.png │ │ ├── octagon-outline-32.png │ │ ├── octagon-outline-48.png │ │ ├── octagon-outline-512.png │ │ ├── octagon-outline-64.png │ │ ├── square-128.png │ │ ├── square-16.png │ │ ├── square-24.png │ │ ├── square-256.png │ │ ├── square-32.png │ │ ├── square-48.png │ │ ├── square-512.png │ │ ├── square-64.png │ │ ├── square-dashed-128.png │ │ ├── square-dashed-16.png │ │ ├── square-dashed-24.png │ │ ├── square-dashed-256.png │ │ ├── square-dashed-32.png │ │ ├── square-dashed-48.png │ │ ├── square-dashed-512.png │ │ ├── square-dashed-64.png │ │ ├── square-dashed-rounded-128.png │ │ ├── square-dashed-rounded-16.png │ │ ├── square-dashed-rounded-24.png │ │ ├── square-dashed-rounded-256.png │ │ ├── square-dashed-rounded-32.png │ │ ├── square-dashed-rounded-48.png │ │ ├── square-dashed-rounded-512.png │ │ ├── square-dashed-rounded-64.png │ │ ├── square-ios-app-128.png │ │ ├── square-ios-app-16.png │ │ ├── square-ios-app-24.png │ │ ├── square-ios-app-256.png │ │ ├── square-ios-app-32.png │ │ ├── square-ios-app-48.png │ │ ├── square-ios-app-512.png │ │ ├── square-ios-app-64.png │ │ ├── square-outline-128.png │ │ ├── square-outline-16.png │ │ ├── square-outline-24.png │ │ ├── square-outline-256.png │ │ ├── square-outline-32.png │ │ ├── square-outline-48.png │ │ ├── square-outline-512.png │ │ ├── square-outline-64.png │ │ ├── square-rounded-128.png │ │ ├── square-rounded-16.png │ │ ├── square-rounded-24.png │ │ ├── square-rounded-256.png │ │ ├── square-rounded-32.png │ │ ├── square-rounded-48.png │ │ ├── square-rounded-512.png │ │ ├── square-rounded-64.png │ │ ├── triangle-128.png │ │ ├── triangle-16.png │ │ ├── triangle-24.png │ │ ├── triangle-256.png │ │ ├── triangle-32.png │ │ ├── triangle-48.png │ │ ├── triangle-512.png │ │ ├── triangle-64.png │ │ ├── triangle-outline-128.png │ │ ├── triangle-outline-16.png │ │ ├── triangle-outline-24.png │ │ ├── triangle-outline-256.png │ │ ├── triangle-outline-32.png │ │ ├── triangle-outline-48.png │ │ ├── triangle-outline-512.png │ │ └── triangle-outline-64.png ├── templates │ ├── energyViewer.html │ ├── statsViewer.html │ └── visualize.html └── webpack.config.js ├── web.go └── web_test.go /.clang-tidy: -------------------------------------------------------------------------------- 1 | --- 2 | Checks: > 3 | -*, 4 | bugprone-argument-comment, 5 | bugprone-too-small-loop-variable, 6 | google-explicit-constructor, 7 | google-readability-casting, 8 | misc-unused-using-decls, 9 | modernize-loop-convert, 10 | modernize-use-bool-literals, 11 | modernize-use-equals-default, 12 | modernize-use-equals-delete, 13 | modernize-use-nullptr, 14 | readability-avoid-const-params-in-decls, 15 | readability-else-after-return, 16 | readability-inconsistent-declaration-parameter-name, 17 | readability-make-member-function-const, 18 | readability-redundant-control-flow, 19 | readability-redundant-member-init, 20 | readability-simplify-boolean-expr, 21 | readability-static-accessed-through-instance 22 | WarningsAsErrors: '*' 23 | HeaderFilterRegex: '(examples|include|src).*(? " 41 | } 42 | 43 | func (c cliHandler) HandleCommand(cmd string, output io.Writer) error { 44 | if _, err := output.Write([]byte("Done\n")); err != nil { 45 | return err 46 | } 47 | 48 | if cmd == "exit" { 49 | os.Exit(0) 50 | } 51 | 52 | return nil 53 | } 54 | 55 | func main() { 56 | err := cli.Cli.Run(&cliHandler{}, &cli.CliOptions{ 57 | EchoInput: true, 58 | }) 59 | 60 | if err != nil { 61 | logger.Error(err) 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /dispatcher/dispatcher_config.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020-2024, The OTNS Authors. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 1. Redistributions of source code must retain the above copyright 7 | // notice, this list of conditions and the following disclaimer. 8 | // 2. Redistributions in binary form must reproduce the above copyright 9 | // notice, this list of conditions and the following disclaimer in the 10 | // documentation and/or other materials provided with the distribution. 11 | // 3. Neither the name of the copyright holder nor the 12 | // names of its contributors may be used to endorse or promote products 13 | // derived from this software without specific prior written permission. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | // POSSIBILITY OF SUCH DAMAGE. 26 | 27 | package dispatcher 28 | 29 | import ( 30 | "github.com/openthread/ot-ns/logger" 31 | "github.com/openthread/ot-ns/pcap" 32 | ) 33 | 34 | type Config struct { 35 | Speed float64 36 | Realtime bool 37 | DumpPackets bool 38 | PcapEnabled bool 39 | PcapFrameType pcap.FrameType 40 | DefaultWatchOn bool 41 | DefaultWatchLevel string 42 | SimulationId int 43 | OutputDir string 44 | PhyTxStats bool 45 | } 46 | 47 | func DefaultConfig() *Config { 48 | return &Config{ 49 | Speed: 1, 50 | Realtime: false, 51 | DumpPackets: false, 52 | PcapEnabled: true, 53 | PcapFrameType: pcap.FrameTypeWpan, 54 | DefaultWatchOn: false, 55 | DefaultWatchLevel: logger.OffLevelString, 56 | SimulationId: 0, 57 | OutputDir: "tmp", 58 | PhyTxStats: false, 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /dispatcher/rloc16_map.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020-2023, The OTNS Authors. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 1. Redistributions of source code must retain the above copyright 7 | // notice, this list of conditions and the following disclaimer. 8 | // 2. Redistributions in binary form must reproduce the above copyright 9 | // notice, this list of conditions and the following disclaimer in the 10 | // documentation and/or other materials provided with the distribution. 11 | // 3. Neither the name of the copyright holder nor the 12 | // names of its contributors may be used to endorse or promote products 13 | // derived from this software without specific prior written permission. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | // POSSIBILITY OF SUCH DAMAGE. 26 | 27 | package dispatcher 28 | 29 | import ( 30 | "github.com/openthread/ot-ns/logger" 31 | "github.com/openthread/ot-ns/types" 32 | ) 33 | 34 | type rloc16Map map[uint16][]*Node 35 | 36 | func (m rloc16Map) Remove(rloc16 uint16, node *Node) { 37 | logger.AssertTrue(rloc16 != types.InvalidRloc16) 38 | logger.AssertTrue(m.Contains(rloc16, node)) 39 | m[rloc16] = m.removeFromList(m[rloc16], node) 40 | logger.AssertFalse(m.Contains(rloc16, node)) 41 | } 42 | 43 | func (m rloc16Map) Add(rloc16 uint16, node *Node) { 44 | logger.AssertTrue(rloc16 != types.InvalidRloc16) 45 | logger.AssertFalse(m.Contains(rloc16, node)) 46 | m[rloc16] = append(m[rloc16], node) 47 | logger.AssertTrue(m.Contains(rloc16, node)) 48 | } 49 | 50 | func (m rloc16Map) Contains(rloc16 uint16, node *Node) bool { 51 | for _, n := range m[rloc16] { 52 | if n == node { 53 | return true 54 | } 55 | } 56 | return false 57 | } 58 | 59 | func (m rloc16Map) removeFromList(nodes []*Node, node *Node) []*Node { 60 | for i, n := range nodes { 61 | if n == node { 62 | return append(nodes[:i], nodes[i+1:]...) 63 | } 64 | } 65 | 66 | return nodes 67 | } 68 | -------------------------------------------------------------------------------- /dispatcher/types.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020-2024, The OTNS Authors. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 1. Redistributions of source code must retain the above copyright 7 | // notice, this list of conditions and the following disclaimer. 8 | // 2. Redistributions in binary form must reproduce the above copyright 9 | // notice, this list of conditions and the following disclaimer in the 10 | // documentation and/or other materials provided with the distribution. 11 | // 3. Neither the name of the copyright holder nor the 12 | // names of its contributors may be used to endorse or promote products 13 | // derived from this software without specific prior written permission. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | // POSSIBILITY OF SUCH DAMAGE. 26 | 27 | package dispatcher 28 | 29 | import ( 30 | "math" 31 | "time" 32 | 33 | . "github.com/openthread/ot-ns/types" 34 | ) 35 | 36 | const ( 37 | // DefaultDispatcherSpeed is used in a speed parameter, to indicate Dispatcher's current default speed. 38 | DefaultDispatcherSpeed float64 = -1.0 39 | Ever uint64 = math.MaxUint64 / 2 40 | MaxSimulateSpeed = 1000000 41 | DefaultReadTimeout = time.Second * 5 42 | ) 43 | 44 | type TimeWindowStats struct { 45 | WinStartUs uint64 46 | WinWidthUs uint64 47 | PhyStats map[NodeId]PhyStats 48 | 49 | statsWinStart map[NodeId]PhyStats // internal bookkeeping: stats at window start 50 | } 51 | 52 | func defaultTimeWindowStats() TimeWindowStats { 53 | return TimeWindowStats{ 54 | WinStartUs: 0, 55 | WinWidthUs: 1e6, 56 | PhyStats: make(map[NodeId]PhyStats), 57 | statsWinStart: make(map[NodeId]PhyStats), 58 | } 59 | } 60 | 61 | func min(t1 uint64, t2 uint64) uint64 { 62 | if t1 <= t2 { 63 | return t1 64 | } 65 | return t2 66 | } 67 | -------------------------------------------------------------------------------- /dispatcher/visualization_options.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020, The OTNS Authors. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 1. Redistributions of source code must retain the above copyright 7 | // notice, this list of conditions and the following disclaimer. 8 | // 2. Redistributions in binary form must reproduce the above copyright 9 | // notice, this list of conditions and the following disclaimer in the 10 | // documentation and/or other materials provided with the distribution. 11 | // 3. Neither the name of the copyright holder nor the 12 | // names of its contributors may be used to endorse or promote products 13 | // derived from this software without specific prior written permission. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | // POSSIBILITY OF SUCH DAMAGE. 26 | 27 | package dispatcher 28 | 29 | type VisualizationOptions struct { 30 | BroadcastMessage bool 31 | UnicastMessage bool 32 | AckMessage bool 33 | RouterTable bool 34 | ChildTable bool 35 | } 36 | 37 | func defaultVisualizationOptions() VisualizationOptions { 38 | return VisualizationOptions{ 39 | BroadcastMessage: true, 40 | UnicastMessage: true, 41 | AckMessage: false, 42 | RouterTable: true, 43 | ChildTable: true, 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /dissectpkt/dissectpkt.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020-2022, The OTNS Authors. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 1. Redistributions of source code must retain the above copyright 7 | // notice, this list of conditions and the following disclaimer. 8 | // 2. Redistributions in binary form must reproduce the above copyright 9 | // notice, this list of conditions and the following disclaimer in the 10 | // documentation and/or other materials provided with the distribution. 11 | // 3. Neither the name of the copyright holder nor the 12 | // names of its contributors may be used to endorse or promote products 13 | // derived from this software without specific prior written permission. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | // POSSIBILITY OF SUCH DAMAGE. 26 | 27 | package dissectpkt 28 | 29 | import ( 30 | "github.com/openthread/ot-ns/dissectpkt/wpan" 31 | ) 32 | 33 | type WpanFrameType int 34 | 35 | const ( 36 | MLE WpanFrameType = iota 37 | MAC = iota 38 | ) 39 | 40 | type PktInfo struct { 41 | MacFrame *wpan.MacFrame 42 | } 43 | 44 | func Dissect(data []byte) *PktInfo { 45 | macFrame := wpan.Dissect(data) 46 | 47 | pktinfo := &PktInfo{ 48 | MacFrame: macFrame, 49 | } 50 | 51 | return pktinfo 52 | } 53 | 54 | func IsAckFrame(pkt *PktInfo) bool { 55 | return pkt.MacFrame.FrameControl.FrameType() == wpan.FrameTypeAck 56 | } 57 | -------------------------------------------------------------------------------- /energy/types.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022-2024, The OTNS Authors. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 1. Redistributions of source code must retain the above copyright 7 | // notice, this list of conditions and the following disclaimer. 8 | // 2. Redistributions in binary form must reproduce the above copyright 9 | // notice, this list of conditions and the following disclaimer in the 10 | // documentation and/or other materials provided with the distribution. 11 | // 3. Neither the name of the copyright holder nor the 12 | // names of its contributors may be used to endorse or promote products 13 | // derived from this software without specific prior written permission. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | // POSSIBILITY OF SUCH DAMAGE. 26 | 27 | package energy 28 | 29 | import ( 30 | . "github.com/openthread/ot-ns/types" 31 | ) 32 | 33 | /* 34 | * Default consumption values by state of STM32WB55rg at 3.3V. 35 | * Consumption in kilowatts, time in microseconds, resulting energy in mJ. 36 | * 37 | * TODO make CLI configurable. 38 | */ 39 | const ( 40 | RadioDisabledConsumption float64 = 0.00000011 //kilowatts, to be confirmed 41 | RadioTxConsumption float64 = 0.00001716 //kilowatts @ i = 5.2 mA 42 | RadioRxConsumption float64 = 0.00001485 //kilowatts @ i = 4.5 mA 43 | RadioSleepConsumption float64 = 0.00001485 //kilowatts @ i = 4.5 mA 44 | ) 45 | 46 | const ( 47 | ComputePeriod uint64 = 30000000 // in microseconds 48 | ) 49 | 50 | type RadioStatus struct { 51 | State RadioStates 52 | SpentDisabled uint64 53 | SpentSleep uint64 54 | SpentTx uint64 55 | SpentRx uint64 56 | Timestamp uint64 57 | } 58 | 59 | type NetworkConsumption struct { 60 | Timestamp uint64 61 | EnergyConsDisabled float64 62 | EnergyConsSleep float64 63 | EnergyConsTx float64 64 | EnergyConsRx float64 65 | } 66 | -------------------------------------------------------------------------------- /etc/cli-scripts/ot-script-example.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Example OT node CLI script, which can be passed to otns using the -ot-script parameter. 3 | # It's in YAML format. Script comment lines start with '#'. 4 | # TODO: enable using script config in same file with YAML network config. 5 | # 6 | 7 | script: 8 | ftd: | 9 | # Active Dataset parameters. This only works for an FTD (e.g. type 'router' or 'fed'). 10 | # Therefore it's in the 'ftd' script section. 11 | dataset init new 12 | dataset networkname Test\ Network 13 | dataset panid 0x1234 14 | dataset channel 15 15 | dataset networkkey 998877665544332211ffeeddccbbaa00 16 | dataset meshlocalprefix fd00:abba:: 17 | dataset commit active 18 | 19 | # Some extra settings - differ from usual setup. 20 | routerselectionjitter 10 21 | 22 | mtd: | 23 | # MTD not able to use 'dataset init new'. Therefore, other way of providing active dataset. 24 | networkkey 998877665544332211ffeeddccbbaa00 25 | panid 0x1234 26 | channel 15 27 | 28 | br: | 29 | # BR-specific configuration goes here. There's some spaces at EOL to test script-parsing. 30 | ############# 31 | routerselectionjitter 1 32 | routerdowngradethreshold 33 33 | routerupgradethreshold 33 34 | netdata publish route fc00::/7 s med 35 | bbr enable 36 | srp server enable 37 | br init 1 1 38 | br enable 39 | 40 | all: | 41 | # Some extra settings - differ from usual setup. These are applied to all node types, 42 | # except for 'raw' added nodes. 43 | ccathreshold -50 44 | txpower 10 45 | 46 | # Autostart the node 47 | ifconfig up 48 | thread start 49 | -------------------------------------------------------------------------------- /etc/docker/environment/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022-2025, The OTNS Authors. 2 | # All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 1. Redistributions of source code must retain the above copyright 7 | # notice, this list of conditions and the following disclaimer. 8 | # 2. Redistributions in binary form must reproduce the above copyright 9 | # notice, this list of conditions and the following disclaimer in the 10 | # documentation and/or other materials provided with the distribution. 11 | # 3. Neither the name of the copyright holder nor the 12 | # names of its contributors may be used to endorse or promote products 13 | # derived from this software without specific prior written permission. 14 | # 15 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | # POSSIBILITY OF SUCH DAMAGE. 26 | 27 | # Builds the OTNS2 web development environment Docker (nodejs, npm, gRPC). 28 | # All build file results are kept. 29 | # The .dockerignore file from the repo root is used during build. 30 | # An older OS is used to avoid breaking the web build which heavily relies 31 | # on specific versions of tools/libraries. 32 | 33 | FROM golang:1.23 34 | 35 | RUN apt-get update && apt-get install -y python3 python3-pip sudo unzip nodejs npm git && rm -rf /var/lib/apt/lists/* 36 | COPY . /otns 37 | WORKDIR /otns 38 | RUN ./script/install-deps 39 | RUN ./script/setup-dev 40 | 41 | ENTRYPOINT [ "bash" ] 42 | -------------------------------------------------------------------------------- /etc/docker/playground/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2020-2025, The OTNS Authors. 2 | # All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 1. Redistributions of source code must retain the above copyright 7 | # notice, this list of conditions and the following disclaimer. 8 | # 2. Redistributions in binary form must reproduce the above copyright 9 | # notice, this list of conditions and the following disclaimer in the 10 | # documentation and/or other materials provided with the distribution. 11 | # 3. Neither the name of the copyright holder nor the 12 | # names of its contributors may be used to endorse or promote products 13 | # derived from this software without specific prior written permission. 14 | # 15 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | # POSSIBILITY OF SUCH DAMAGE. 26 | 27 | # Builds the OTNS2 playground Docker, for easily trying out OTNS2. 28 | # The .dockerignore file from the repo root is used during build. 29 | 30 | # Stage 0: build OTNS, OT nodes, and any dependencies 31 | FROM golang:1.23 32 | 33 | RUN apt-get update && apt-get install -y python3 python3-pip sudo unzip 34 | COPY . /otns 35 | WORKDIR /otns 36 | RUN ./script/bootstrap 37 | # /go/bin is the default location for "FROM golang:*" Dockers. 38 | RUN strip /go/bin/grpcwebproxy /go/bin/otns 39 | 40 | # Stage 1: build the final image 41 | FROM ubuntu:24.04 42 | 43 | RUN apt-get update && apt-get install -y xdg-utils 44 | # Copy over the produced binaries (including all built node types) from stage 0 45 | COPY --from=0 /go/bin/grpcwebproxy /go/bin/otns /otns/ot-rfsim/ot-versions/ot-* /usr/bin/ 46 | EXPOSE 8997 8998 8999 9000 47 | 48 | ENTRYPOINT [ "otns" ] 49 | -------------------------------------------------------------------------------- /etc/ot-registrar/credentials_registrar.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/etc/ot-registrar/credentials_registrar.p12 -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020-2024, The OTNS Authors. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 1. Redistributions of source code must retain the above copyright 7 | // notice, this list of conditions and the following disclaimer. 8 | // 2. Redistributions in binary form must reproduce the above copyright 9 | // notice, this list of conditions and the following disclaimer in the 10 | // documentation and/or other materials provided with the distribution. 11 | // 3. Neither the name of the copyright holder nor the 12 | // names of its contributors may be used to endorse or promote products 13 | // derived from this software without specific prior written permission. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | // POSSIBILITY OF SUCH DAMAGE. 26 | 27 | module github.com/openthread/ot-ns 28 | 29 | go 1.23.0 30 | 31 | require ( 32 | github.com/alecthomas/participle v0.7.1 33 | github.com/chzyer/readline v1.5.1 34 | github.com/mitchellh/go-wordwrap v1.0.1 35 | github.com/pkg/errors v0.9.1 36 | github.com/stretchr/testify v1.9.0 37 | go.uber.org/zap v1.24.0 38 | golang.org/x/net v0.38.0 39 | golang.org/x/term v0.30.0 40 | google.golang.org/grpc v1.56.3 41 | google.golang.org/protobuf v1.34.1 42 | gopkg.in/yaml.v3 v3.0.1 43 | ) 44 | 45 | require ( 46 | github.com/davecgh/go-spew v1.1.1 // indirect 47 | github.com/golang/protobuf v1.5.3 // indirect 48 | github.com/pmezard/go-difflib v1.0.0 // indirect 49 | go.uber.org/atomic v1.7.0 // indirect 50 | go.uber.org/multierr v1.6.0 // indirect 51 | golang.org/x/sys v0.31.0 // indirect 52 | golang.org/x/text v0.23.0 // indirect 53 | google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect 54 | ) 55 | -------------------------------------------------------------------------------- /ot-rfsim/etc/ot-mbedtls-settings.patch: -------------------------------------------------------------------------------- 1 | From 5b77e200f648c36787109eebf4bb97380cc06960 Mon Sep 17 00:00:00 2001 2 | From: Esko Dijk 3 | Date: Fri, 5 Jul 2024 10:51:51 +0200 4 | Subject: [PATCH] [OTNS] remove -Werror build flag in [mbedtls] to enable 5 | building legacy code on newer (Apple Clang) compilers. 6 | 7 | --- 8 | third_party/mbedtls/repo/CMakeLists.txt | 2 +- 9 | 1 file changed, 1 insertion(+), 1 deletion(-) 10 | 11 | diff --git a/third_party/mbedtls/repo/CMakeLists.txt b/third_party/mbedtls/repo/CMakeLists.txt 12 | index ac24bf41b..eef0a9260 100644 13 | --- a/third_party/mbedtls/repo/CMakeLists.txt 14 | +++ b/third_party/mbedtls/repo/CMakeLists.txt 15 | @@ -218,7 +218,7 @@ if(MBEDTLS_FATAL_WARNINGS) 16 | endif(CMAKE_COMPILER_IS_MSVC) 17 | 18 | if(CMAKE_COMPILER_IS_CLANG OR CMAKE_COMPILER_IS_GNU) 19 | - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror") 20 | + # set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror") 21 | if(UNSAFE_BUILD) 22 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error=cpp") 23 | set(CMAKE_C_FLAGS_ASAN "${CMAKE_C_FLAGS_ASAN} -Wno-error=cpp") 24 | -- 25 | 2.34.1 26 | -------------------------------------------------------------------------------- /ot-rfsim/ot-versions/README.md: -------------------------------------------------------------------------------- 1 | # ot-versions directory 2 | 3 | This contains the `ot-cli-ftd` and `ot-cli-mtd` binaries for a number of specific OpenThread builds of current or previously released codebases. Older versions can be used for testing legacy node behavior and backwards-compatibility. Newer versions typically have more features enabled. 4 | 5 | Versions are listed below. With each version tag, the directory is listed in which the code for that version is expected to be located. Of these directories, only the `openthread` directory is included as a submodule in this repo. The `openthread-v*` directories are created on-the-fly by the respective build scripts by getting a historic commit from the `openthread` submodule repo. 6 | 7 | - v11 - `openthread-v11` - A Thread v1.2 codebase compiled with v1.1 version flag. (v1.1 codebase is too old to compile with OT-RFSIM. For this reason, a 1.2 codebase is used.) 8 | 9 | - v12 - `openthread-v12` - A Thread v1.2 codebase compiled with v1.2 version flag. 10 | 11 | - v13 - `openthread-v13` - A Thread v1.3 codebase compiled with v1.3 version flag; tag [thread-reference-20230119](https://github.com/openthread/openthread/tree/thread-reference-20230119). 12 | 13 | - latest - `openthread` - A recent OpenThread `main` branch commit that's the default `openthread` submodule. The version is selected with v1.4 version flag, currently. If in the future the Thread version increases, this build will track that. 14 | 15 | - br - `openthread` - Same code as 'latest', but builds a Thread Border Router (BR). 16 | 17 | - ccm - `openthread-ccm` - (In development) A codebase supporting Thread Commercial Commissioning Mode (CCM). 18 | 19 | - br-ccm - `openthread-ccm` - (In development) A Thread CCM Border Router. 20 | 21 | Build scripts: the build scripts to build all of the versions are `../script/build_`. Each of these specific build scripts invokes the general `build` script. The `../script/build_all` builds all commonly used versions. 22 | -------------------------------------------------------------------------------- /ot-rfsim/script/build_all: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2023-2024, The OpenThread Authors. 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are met: 8 | # 1. Redistributions of source code must retain the above copyright 9 | # notice, this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. Neither the name of the copyright holder nor the 14 | # names of its contributors may be used to endorse or promote products 15 | # derived from this software without specific prior written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 21 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | # POSSIBILITY OF SUCH DAMAGE. 28 | # 29 | 30 | printf "\n./script/build_all -- builds all OT node versions (that weren't built yet or require an update)\n\n" 31 | 32 | set -euo pipefail 33 | 34 | build_error() 35 | { 36 | printf '\n****************\n Failed build script: %s - stopping.\n****************\n\n' "$@" 37 | exit 1 38 | } 39 | 40 | main() 41 | { 42 | local options=() 43 | options+=("$@") 44 | 45 | for VER in v11 v12 v13 latest br; do 46 | SCRIPTNAME="./script/build_$VER" 47 | 48 | printf 'Node %s: building with script %s\n' "${VER}" "${SCRIPTNAME}" 49 | if ${SCRIPTNAME} "${options[@]}"; then 50 | printf 'Node %s: completed build with script %s\n' "${VER}" "${SCRIPTNAME}" 51 | else 52 | build_error "${SCRIPTNAME}" 53 | fi 54 | done 55 | 56 | printf '\nSuccessfully completed building all OT node versions.\n' 57 | } 58 | 59 | main "$@" 60 | -------------------------------------------------------------------------------- /ot-rfsim/script/build_br: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2023-2024, The OpenThread Authors. 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are met: 8 | # 1. Redistributions of source code must retain the above copyright 9 | # notice, this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. Neither the name of the copyright holder nor the 14 | # names of its contributors may be used to endorse or promote products 15 | # derived from this software without specific prior written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 21 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | # POSSIBILITY OF SUCH DAMAGE. 28 | # 29 | 30 | set -euxo pipefail 31 | 32 | # OpenThread Border Router (OTBR) specific options. These are superimposed on the standard 33 | # options in './build'. 34 | OTBR_OPTIONS=( 35 | "-DOT_THREAD_VERSION=1.4" 36 | "-DOT_VENDOR_MODEL=RFSIM-BR-v1.4.0" 37 | "-DOT_BACKBONE_ROUTER=ON" 38 | "-DOT_BACKBONE_ROUTER_MULTICAST_ROUTING=ON" 39 | "-DOT_BORDER_ROUTER=ON" 40 | "-DOT_BORDER_ROUTING=ON" 41 | "-DOT_BORDER_ROUTING_DHCP6_PD=ON" 42 | "-DOT_BORDER_ROUTING_COUNTERS=ON" 43 | "-DOT_NAT64_BORDER_ROUTING=ON" 44 | "-DOT_BORDER_AGENT=ON" 45 | "-DOT_MLR=ON" 46 | "-DOT_UDP_FORWARD=ON" 47 | "-DOT_COAP_BLOCK=ON" 48 | "-DOT_DNSSD_SERVER=ON" 49 | "-DOT_NETDATA_PUBLISHER=ON" 50 | "-DOT_SRP_SERVER=ON" 51 | "-DOT_TREL=OFF" 52 | "-DOT_TCP=ON" 53 | "-DOT_POWER_SUPPLY=EXTERNAL" 54 | "-DOT_DEVICE_PROP_LEADER_WEIGHT=ON" 55 | "-DOT_MLE_MAX_CHILDREN=32" 56 | "-DOT_HISTORY_TRACKER=ON" 57 | ) 58 | readonly OTBR_OPTIONS 59 | 60 | main() 61 | { 62 | local options=() 63 | options+=("${OTBR_OPTIONS[@]}" "$@") 64 | 65 | OTNS_NODE_TYPE="br" OT_CMAKE_NINJA_TARGET="ot-cli-ftd" ./script/build "${options[@]}" 66 | 67 | cp ./build/br/bin/ot-cli-ftd ./ot-versions/ot-cli-ftd_br 68 | } 69 | 70 | main "$@" 71 | -------------------------------------------------------------------------------- /ot-rfsim/script/build_br_ccm: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2024, The OpenThread Authors. 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are met: 8 | # 1. Redistributions of source code must retain the above copyright 9 | # notice, this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. Neither the name of the copyright holder nor the 14 | # names of its contributors may be used to endorse or promote products 15 | # derived from this software without specific prior written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 21 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | # POSSIBILITY OF SUCH DAMAGE. 28 | # 29 | 30 | set -euxo pipefail 31 | 32 | # OpenThread CCM Border Router (OTBR) specific options. These are superimposed on the standard 33 | # options in './build'. 34 | OTBR_OPTIONS=( 35 | "-DOT_THREAD_VERSION=1.4" 36 | "-DOT_VENDOR_MODEL=RFSIM-CCM-BR-v1.4.0" 37 | "-DOT_BACKBONE_ROUTER=ON" 38 | "-DOT_BACKBONE_ROUTER_MULTICAST_ROUTING=ON" 39 | "-DOT_BORDER_ROUTER=ON" 40 | "-DOT_BORDER_ROUTING=ON" 41 | "-DOT_BORDER_ROUTING_DHCP6_PD=ON" 42 | "-DOT_BORDER_ROUTING_COUNTERS=ON" 43 | "-DOT_NAT64_BORDER_ROUTING=ON" 44 | "-DOT_BORDER_AGENT=ON" 45 | "-DOT_MLR=ON" 46 | "-DOT_UDP_FORWARD=ON" 47 | "-DOT_COAP_BLOCK=ON" 48 | "-DOT_DNSSD_SERVER=ON" 49 | "-DOT_NETDATA_PUBLISHER=ON" 50 | "-DOT_SRP_SERVER=ON" 51 | "-DOT_TREL=OFF" 52 | "-DOT_POWER_SUPPLY=EXTERNAL" 53 | "-DOT_DEVICE_PROP_LEADER_WEIGHT=ON" 54 | "-DOT_MLE_MAX_CHILDREN=32" 55 | "-DOT_HISTORY_TRACKER=ON" 56 | "-DOT_CCM=ON" 57 | ) 58 | readonly OTBR_OPTIONS 59 | 60 | main() 61 | { 62 | local options=() 63 | options+=("${OTBR_OPTIONS[@]}" "$@") 64 | 65 | OT_DIR="../openthread-ccm" OTNS_NODE_TYPE="br-ccm" OT_CMAKE_NINJA_TARGET="ot-cli-ftd" ./script/build "${options[@]}" 66 | 67 | cp ./build/br-ccm/bin/ot-cli-ftd ./ot-versions/ot-cli-ftd_br_ccm 68 | } 69 | 70 | main "$@" 71 | -------------------------------------------------------------------------------- /ot-rfsim/script/build_ccm: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2024, The OpenThread Authors. 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are met: 8 | # 1. Redistributions of source code must retain the above copyright 9 | # notice, this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. Neither the name of the copyright holder nor the 14 | # names of its contributors may be used to endorse or promote products 15 | # derived from this software without specific prior written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 21 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | # POSSIBILITY OF SUCH DAMAGE. 28 | # 29 | 30 | set -euxo pipefail 31 | 32 | OT_OPTIONS=( 33 | "-DOT_THREAD_VERSION=1.4" 34 | "-DOT_VENDOR_MODEL=RFSIM-CCM-v1.4.0" 35 | "-DOT_BACKBONE_ROUTER=OFF" 36 | "-DOT_BACKBONE_ROUTER_MULTICAST_ROUTING=OFF" 37 | "-DOT_BORDER_ROUTER=ON" 38 | "-DOT_BORDER_ROUTING=OFF" 39 | "-DOT_BORDER_ROUTING_DHCP6_PD=OFF" 40 | "-DOT_BORDER_ROUTING_COUNTERS=OFF" 41 | "-DOT_NAT64_BORDER_ROUTING=OFF" 42 | "-DOT_MLR=ON" 43 | "-DOT_COAP_BLOCK=OFF" 44 | "-DOT_DNSSD_SERVER=OFF" 45 | "-DOT_NETDATA_PUBLISHER=ON" 46 | "-DOT_SRP_SERVER=OFF" 47 | "-DOT_TREL=OFF" 48 | "-DOT_POWER_SUPPLY=EXTERNAL" 49 | "-DOT_DEVICE_PROP_LEADER_WEIGHT=ON" 50 | "-DOT_HISTORY_TRACKER=OFF" 51 | "-DOT_BLE_TCAT=ON" 52 | "-DOT_CCM=ON" 53 | ) 54 | readonly OT_OPTIONS 55 | 56 | main() 57 | { 58 | local options=() 59 | options+=("${OT_OPTIONS[@]}" "$@") 60 | 61 | OT_DIR="../openthread-ccm" OTNS_NODE_TYPE="ccm" OT_CMAKE_NINJA_TARGET="ot-cli-ftd ot-cli-mtd" ./script/build "${options[@]}" 62 | 63 | cp ./build/ccm/bin/ot-cli-ftd ./ot-versions/ot-cli-ftd_ccm 64 | cp ./build/ccm/bin/ot-cli-mtd ./ot-versions/ot-cli-mtd_ccm 65 | } 66 | 67 | main "$@" 68 | -------------------------------------------------------------------------------- /ot-rfsim/script/build_latest: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2023-2024, The OpenThread Authors. 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are met: 8 | # 1. Redistributions of source code must retain the above copyright 9 | # notice, this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. Neither the name of the copyright holder nor the 14 | # names of its contributors may be used to endorse or promote products 15 | # derived from this software without specific prior written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 21 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | # POSSIBILITY OF SUCH DAMAGE. 28 | # 29 | 30 | set -euxo pipefail 31 | 32 | OT_OPTIONS=( 33 | "-DOT_THREAD_VERSION=1.4" 34 | "-DOT_VENDOR_MODEL=RFSIM-Node-v1.4.0" 35 | "-DOT_BACKBONE_ROUTER=OFF" 36 | "-DOT_BACKBONE_ROUTER_MULTICAST_ROUTING=OFF" 37 | "-DOT_BORDER_ROUTER=ON" 38 | "-DOT_BORDER_ROUTING=OFF" 39 | "-DOT_BORDER_ROUTING_DHCP6_PD=OFF" 40 | "-DOT_BORDER_ROUTING_COUNTERS=OFF" 41 | "-DOT_NAT64_BORDER_ROUTING=OFF" 42 | "-DOT_MLR=ON" 43 | "-DOT_COAP_BLOCK=OFF" 44 | "-DOT_DNSSD_SERVER=OFF" 45 | "-DOT_NETDATA_PUBLISHER=ON" 46 | "-DOT_SRP_SERVER=OFF" 47 | "-DOT_TREL=OFF" 48 | "-DOT_TCP=ON" 49 | "-DOT_POWER_SUPPLY=EXTERNAL" 50 | "-DOT_DEVICE_PROP_LEADER_WEIGHT=ON" 51 | "-DOT_HISTORY_TRACKER=OFF" 52 | "-DOT_BLE_TCAT=ON" 53 | ) 54 | readonly OT_OPTIONS 55 | 56 | main() 57 | { 58 | local options=() 59 | options+=("${OT_OPTIONS[@]}" "$@") 60 | 61 | OTNS_NODE_TYPE="latest" OT_CMAKE_NINJA_TARGET="ot-cli-ftd ot-cli-mtd" ./script/build "${options[@]}" 62 | 63 | cp ./build/latest/bin/ot-cli-ftd ./ot-versions/ 64 | cp ./build/latest/bin/ot-cli-mtd ./ot-versions/ 65 | } 66 | 67 | main "$@" 68 | -------------------------------------------------------------------------------- /ot-rfsim/script/build_v11: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2023-2025, The OpenThread Authors. 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are met: 8 | # 1. Redistributions of source code must retain the above copyright 9 | # notice, this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. Neither the name of the copyright holder nor the 14 | # names of its contributors may be used to endorse or promote products 15 | # derived from this software without specific prior written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 21 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | # POSSIBILITY OF SUCH DAMAGE. 28 | # 29 | 30 | set -euxo pipefail 31 | 32 | # shellcheck source=/dev/null 33 | . "$(dirname "$0")"/../../script/utils.sh 34 | 35 | OT_OPTIONS=( 36 | "-DOT_THREAD_VERSION=1.1" 37 | "-DOT_VENDOR_MODEL=RFSIM-Node-v1.1" 38 | "-DOT_PACKAGE_VERSION=1.1-0a5152b4fa" 39 | "-DOT_COMPILE_WARNING_AS_ERROR=OFF" 40 | ) 41 | readonly OT_OPTIONS 42 | 43 | main() 44 | { 45 | local options=() 46 | options+=("${OT_OPTIONS[@]}" "$@") 47 | 48 | if [[ ! -f ./openthread-v11/README.md ]]; then 49 | get_openthread_commit "0a5152b4fa9f9cbff57da89d9aa33d409e915241" "./openthread-v11" "../openthread" 50 | fi 51 | 52 | OT_DIR="./openthread-v11" OTNS_NODE_TYPE="v11" OT_CMAKE_NINJA_TARGET="ot-cli-ftd ot-cli-mtd" ./script/build "${options[@]}" 53 | 54 | cp ./build/v11/bin/ot-cli-ftd ./ot-versions/ot-cli-ftd_v11 55 | cp ./build/v11/bin/ot-cli-mtd ./ot-versions/ot-cli-mtd_v11 56 | } 57 | 58 | main "$@" 59 | -------------------------------------------------------------------------------- /ot-rfsim/script/build_v12: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2023-2025, The OpenThread Authors. 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are met: 8 | # 1. Redistributions of source code must retain the above copyright 9 | # notice, this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. Neither the name of the copyright holder nor the 14 | # names of its contributors may be used to endorse or promote products 15 | # derived from this software without specific prior written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 21 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | # POSSIBILITY OF SUCH DAMAGE. 28 | # 29 | 30 | set -euxo pipefail 31 | 32 | # shellcheck source=/dev/null 33 | . "$(dirname "$0")"/../../script/utils.sh 34 | 35 | OT_OPTIONS=( 36 | "-DOT_MLR=ON" 37 | "-DOT_THREAD_VERSION=1.2" 38 | "-DOT_VENDOR_MODEL=RFSIM-Node-v1.2" 39 | "-DOT_PACKAGE_VERSION=1.2-f759d163dc" 40 | "-DOT_COMPILE_WARNING_AS_ERROR=OFF" 41 | ) 42 | readonly OT_OPTIONS 43 | 44 | main() 45 | { 46 | local options=() 47 | options+=("${OT_OPTIONS[@]}" "$@") 48 | 49 | if [[ ! -f ./openthread-v12/README.md ]]; then 50 | get_openthread_commit "f759d163dc4e719bc2dbdf0bc713ea33d51b1819" "./openthread-v12" "../openthread" 51 | fi 52 | 53 | OT_DIR="./openthread-v12" OTNS_NODE_TYPE="v12" OT_CMAKE_NINJA_TARGET="ot-cli-ftd ot-cli-mtd" ./script/build "${options[@]}" 54 | 55 | cp ./build/v12/bin/ot-cli-ftd ./ot-versions/ot-cli-ftd_v12 56 | cp ./build/v12/bin/ot-cli-mtd ./ot-versions/ot-cli-mtd_v12 57 | } 58 | 59 | main "$@" 60 | -------------------------------------------------------------------------------- /ot-rfsim/script/build_v13: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2023-2025, The OpenThread Authors. 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are met: 8 | # 1. Redistributions of source code must retain the above copyright 9 | # notice, this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. Neither the name of the copyright holder nor the 14 | # names of its contributors may be used to endorse or promote products 15 | # derived from this software without specific prior written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 21 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | # POSSIBILITY OF SUCH DAMAGE. 28 | # 29 | 30 | set -euxo pipefail 31 | 32 | # shellcheck source=/dev/null 33 | . "$(dirname "$0")"/../../script/utils.sh 34 | 35 | OT_OPTIONS=( 36 | "-DOT_THREAD_VERSION=1.3" 37 | "-DOT_VENDOR_MODEL=RFSIM-Node-v1.3" 38 | "-DOT_PACKAGE_VERSION=1.3-c6179c24ed" 39 | "-DOT_BACKBONE_ROUTER=OFF" 40 | "-DOT_BORDER_ROUTER=OFF" 41 | "-DOT_BORDER_ROUTING=OFF" 42 | "-DOT_MLR=ON" 43 | "-DOT_COAP_BLOCK=OFF" 44 | "-DOT_DNSSD_SERVER=OFF" 45 | "-DOT_NETDATA_PUBLISHER=ON" 46 | "-DOT_SRP_SERVER=OFF" 47 | "-DOT_TREL=OFF" 48 | "-DOT_TCP=ON" 49 | "-DOT_POWER_SUPPLY=EXTERNAL" 50 | "-DOT_DEVICE_PROP_LEADER_WEIGHT=OFF" 51 | "-DOT_HISTORY_TRACKER=OFF" 52 | "-DOT_COMPILE_WARNING_AS_ERROR=OFF" 53 | ) 54 | readonly OT_OPTIONS 55 | 56 | main() 57 | { 58 | local options=() 59 | options+=("${OT_OPTIONS[@]}" "$@") 60 | 61 | if [[ ! -f ./openthread-v13/README.md ]]; then 62 | get_openthread_commit "c6179c24ed75a11c14dc4b1fffcde58be0bda785" "./openthread-v13" "../openthread" 63 | fi 64 | 65 | OT_DIR="./openthread-v13" OTNS_NODE_TYPE="v13" OT_CMAKE_NINJA_TARGET="ot-cli-ftd ot-cli-mtd" ./script/build "${options[@]}" 66 | 67 | cp ./build/v13/bin/ot-cli-ftd ./ot-versions/ot-cli-ftd_v13 68 | cp ./build/v13/bin/ot-cli-mtd ./ot-versions/ot-cli-mtd_v13 69 | } 70 | 71 | main "$@" 72 | -------------------------------------------------------------------------------- /ot-rfsim/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2022-2024, The OpenThread Authors. 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 1. Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # 2. Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # 3. Neither the name of the copyright holder nor the 13 | # names of its contributors may be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | add_library(openthread-rfsim-config INTERFACE) 30 | 31 | add_library(openthread-rfsim 32 | alarm.c 33 | ble.c 34 | crypto.c 35 | diag.c 36 | dso_transport.c 37 | entropy.c 38 | event-sim.c 39 | flash.c 40 | infra_if.c 41 | logging.c 42 | misc.c 43 | platform-rfsim.c 44 | platform-rfsim.cpp 45 | radio.c 46 | system.c 47 | trel.c 48 | uart.c 49 | $ 50 | ) 51 | 52 | find_library(LIBRT rt) 53 | if(LIBRT) 54 | target_link_libraries(openthread-rfsim PRIVATE ${LIBRT}) 55 | endif() 56 | 57 | target_link_libraries(openthread-rfsim PRIVATE 58 | openthread-platform 59 | openthread-rfsim-config 60 | ot-config 61 | ) 62 | 63 | target_compile_options(openthread-rfsim PRIVATE 64 | ${OT_CFLAGS} 65 | ) 66 | 67 | target_include_directories(openthread-rfsim PRIVATE 68 | ${OT_PUBLIC_INCLUDES} 69 | ${OT_DIR}/examples/platforms 70 | ${PROJECT_SOURCE_DIR}/src 71 | ) 72 | -------------------------------------------------------------------------------- /ot-rfsim/src/diag.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, The OpenThread Authors. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 3. Neither the name of the copyright holder nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | #include "platform-rfsim.h" 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #include 37 | #include 38 | #include 39 | 40 | #if OPENTHREAD_CONFIG_DIAG_ENABLE 41 | 42 | /** 43 | * Diagnostics mode variables. 44 | * 45 | */ 46 | static bool sDiagMode = false; 47 | 48 | void otPlatDiagModeSet(bool aMode) { sDiagMode = aMode; } 49 | 50 | bool otPlatDiagModeGet() { return sDiagMode; } 51 | 52 | void otPlatDiagChannelSet(uint8_t aChannel) { OT_UNUSED_VARIABLE(aChannel); } 53 | 54 | void otPlatDiagTxPowerSet(int8_t aTxPower) { OT_UNUSED_VARIABLE(aTxPower); } 55 | 56 | void otPlatDiagRadioReceived(otInstance *aInstance, otRadioFrame *aFrame, otError aError) 57 | { 58 | OT_UNUSED_VARIABLE(aInstance); 59 | OT_UNUSED_VARIABLE(aFrame); 60 | OT_UNUSED_VARIABLE(aError); 61 | } 62 | 63 | void otPlatDiagAlarmCallback(otInstance *aInstance) { OT_UNUSED_VARIABLE(aInstance); } 64 | 65 | #endif // OPENTHREAD_CONFIG_DIAG_ENABLE 66 | -------------------------------------------------------------------------------- /ot-rfsim/src/dso_transport.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, The OpenThread Authors. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 3. Neither the name of the copyright holder nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | #include "platform-rfsim.h" 30 | 31 | #if OPENTHREAD_CONFIG_DNS_DSO_ENABLE 32 | 33 | #include 34 | 35 | void otPlatDsoEnableListening(otInstance *aInstance, bool aEnable) 36 | { 37 | OT_UNUSED_VARIABLE(aInstance); 38 | OT_UNUSED_VARIABLE(aEnable); 39 | } 40 | 41 | void otPlatDsoConnect(otPlatDsoConnection *aConnection, const otSockAddr *aPeerSockAddr) 42 | { 43 | OT_UNUSED_VARIABLE(aConnection); 44 | OT_UNUSED_VARIABLE(aPeerSockAddr); 45 | } 46 | 47 | void otPlatDsoSend(otPlatDsoConnection *aConnection, otMessage *aMessage) 48 | { 49 | OT_UNUSED_VARIABLE(aConnection); 50 | OT_UNUSED_VARIABLE(aMessage); 51 | } 52 | 53 | void otPlatDsoDisconnect(otPlatDsoConnection *aConnection, otPlatDsoDisconnectMode aMode) 54 | { 55 | OT_UNUSED_VARIABLE(aConnection); 56 | OT_UNUSED_VARIABLE(aMode); 57 | } 58 | 59 | #endif // #if OPENTHREAD_CONFIG_DNS_DSO_ENABLE 60 | -------------------------------------------------------------------------------- /ot-rfsim/src/infra_if.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021-2024, The OpenThread Authors. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 3. Neither the name of the copyright holder nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | #include "platform-rfsim.h" 30 | 31 | #include 32 | 33 | #if OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE 34 | bool otPlatInfraIfHasAddress(uint32_t aInfraIfIndex, const otIp6Address *aAddress) 35 | { 36 | OT_UNUSED_VARIABLE(aInfraIfIndex); 37 | OT_UNUSED_VARIABLE(aAddress); 38 | 39 | return false; 40 | } 41 | 42 | otError otPlatInfraIfSendIcmp6Nd(uint32_t aInfraIfIndex, 43 | const otIp6Address *aDestAddress, 44 | const uint8_t *aBuffer, 45 | uint16_t aBufferLength) 46 | { 47 | OT_UNUSED_VARIABLE(aInfraIfIndex); 48 | OT_UNUSED_VARIABLE(aDestAddress); 49 | OT_UNUSED_VARIABLE(aBuffer); 50 | OT_UNUSED_VARIABLE(aBufferLength); 51 | 52 | return OT_ERROR_NONE; 53 | } 54 | 55 | otError otPlatInfraIfDiscoverNat64Prefix(uint32_t aInfraIfIndex) 56 | { 57 | OT_UNUSED_VARIABLE(aInfraIfIndex); 58 | 59 | return OT_ERROR_NONE; 60 | } 61 | #endif 62 | -------------------------------------------------------------------------------- /ot-rfsim/src/openthread-core-rfsim-config-check.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022, The OpenThread Authors. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 3. Neither the name of the copyright holder nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | #ifndef OPENTHREAD_CORE_RFSIM_CONFIG_CHECK_H_ 30 | #define OPENTHREAD_CORE_RFSIM_CONFIG_CHECK_H_ 31 | 32 | #if OPENTHREAD_CONFIG_OTNS_ENABLE == 0 33 | #error "OPENTHREAD_CONFIG_OTNS_ENABLE MUST be '1' for the RFSIM platform" 34 | #endif 35 | 36 | #if OPENTHREAD_CONFIG_THREAD_VERSION <= 2 && OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE 37 | #error "OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE MUST be '0' for Thread Version 1.1 build" 38 | #endif 39 | 40 | #endif /* OPENTHREAD_CORE_RFSIM_CONFIG_CHECK_H_ */ 41 | -------------------------------------------------------------------------------- /ot-rfsim/src/platform-rfsim.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2024, The OpenThread Authors. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 3. Neither the name of the copyright holder nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | /** 30 | * @file 31 | * @brief 32 | * This file includes the C++ portions of the OT-RFSIM platform. 33 | */ 34 | 35 | #if OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE 36 | 37 | #include "net/ip6.hpp" 38 | #include "net/ip6_address.hpp" 39 | 40 | extern "C" otError platformParseIp6(otMessage *aMessage, otMessageInfo *aIp6Info); 41 | extern "C" void validateOtMsg(otMessage *aMessage); 42 | 43 | #include "platform-rfsim.h" 44 | #include "utils/uart.h" 45 | 46 | using namespace ot; 47 | 48 | otError platformParseIp6(otMessage *aMessage, otMessageInfo *aIp6Info) 49 | { 50 | Ip6::Headers headers; 51 | otError error; 52 | Message msg = AsCoreType(aMessage); 53 | 54 | SuccessOrExit(error = headers.ParseFrom(msg)); 55 | aIp6Info->mSockAddr = headers.GetSourceAddress(); 56 | aIp6Info->mPeerAddr = headers.GetDestinationAddress(); 57 | aIp6Info->mSockPort = headers.GetSourcePort(); 58 | aIp6Info->mPeerPort = headers.GetDestinationPort(); 59 | 60 | exit: 61 | return error; 62 | } 63 | 64 | #endif // OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE 65 | -------------------------------------------------------------------------------- /ot-rfsim/src/radio-parameters.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023, The OpenThread Authors. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 3. Neither the name of the copyright holder nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | #ifndef OT_RFSIM_RADIO_PARAMETERS_H 30 | #define OT_RFSIM_RADIO_PARAMETERS_H 31 | 32 | // Custom parameters for the simulated RFSIM radio, which may vary over radio vendors while still 33 | // being standards compliant. See radio.h for further parameters. The constants with DEFAULT in 34 | // the name are default values on startup that can be modified in the CLI. 35 | enum 36 | { 37 | RFSIM_RX_SENSITIVITY_DEFAULT_DBM = -100, // dBm 38 | RFSIM_CCA_ED_THRESHOLD_DEFAULT_DBM = -75, // dBm, MUST be -85 < Th <= -75 dBm per IEEE 802.15.4-2015 39 | RFSIM_TX_POWER_DEFAULT_DBM = 0, // dBm 40 | RFSIM_CSL_ACCURACY_DEFAULT_PPM = 20, // ppm (both in + or - direction) 41 | RFSIM_CSL_UNCERTAINTY_DEFAULT_10US = 10, // units of 10 us (ceiling of true uncertainty) 42 | RFSIM_TURNAROUND_TIME_US = 40, // radio turnaround time (us) between Rx and Tx 43 | RFSIM_STARTUP_TIME_US = 140, // Disabled -> Enabled time (us) 44 | RFSIM_RAMPUP_TIME_US = 40, // Sleeping -> Ready time (us) 45 | }; 46 | 47 | #endif // OT_RFSIM_RADIO_PARAMETERS_H 48 | -------------------------------------------------------------------------------- /ot-rfsim/src/uart.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, The OpenThread Authors. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 3. Neither the name of the copyright holder nor the 13 | * names of its contributors may be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | /** 30 | * @file 31 | * @brief 32 | * This file includes platform-specific UART code. 33 | */ 34 | 35 | #include "platform-rfsim.h" 36 | 37 | #include "event-sim.h" 38 | #include "utils/uart.h" 39 | 40 | otError otPlatUartEnable(void) { return OT_ERROR_NONE; } 41 | 42 | otError otPlatUartDisable(void) { return OT_ERROR_NONE; } 43 | 44 | otError otPlatUartSend(const uint8_t *aBuf, uint16_t aBufLength) 45 | { 46 | otSimSendUartWriteEvent(aBuf, aBufLength); 47 | otPlatUartSendDone(); 48 | 49 | return OT_ERROR_NONE; 50 | } 51 | 52 | otError otPlatUartFlush(void) { return OT_ERROR_NONE; } 53 | 54 | void platformUartRestore(void) {} 55 | -------------------------------------------------------------------------------- /otnstester/tests/consts.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020-2024, The OTNS Authors. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 1. Redistributions of source code must retain the above copyright 7 | // notice, this list of conditions and the following disclaimer. 8 | // 2. Redistributions in binary form must reproduce the above copyright 9 | // notice, this list of conditions and the following disclaimer in the 10 | // documentation and/or other materials provided with the distribution. 11 | // 3. Neither the name of the copyright holder nor the 12 | // names of its contributors may be used to endorse or promote products 13 | // derived from this software without specific prior written permission. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | // POSSIBILITY OF SUCH DAMAGE. 26 | 27 | package main 28 | 29 | import ( 30 | "github.com/openthread/ot-ns/simulation" 31 | ) 32 | 33 | const ( 34 | RoleLeader = "leader" 35 | RoleRouter = "router" 36 | RoleChild = "child" 37 | ) 38 | 39 | var ( 40 | DefaultRadioRange = simulation.DefaultNodeConfig().RadioRange 41 | ) 42 | -------------------------------------------------------------------------------- /otnstester/tests/otns_many_children_test.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023-2024, The OTNS Authors. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 1. Redistributions of source code must retain the above copyright 7 | // notice, this list of conditions and the following disclaimer. 8 | // 2. Redistributions in binary form must reproduce the above copyright 9 | // notice, this list of conditions and the following disclaimer in the 10 | // documentation and/or other materials provided with the distribution. 11 | // 3. Neither the name of the copyright holder nor the 12 | // names of its contributors may be used to endorse or promote products 13 | // derived from this software without specific prior written permission. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | // POSSIBILITY OF SUCH DAMAGE. 26 | 27 | package main 28 | 29 | import ( 30 | "math" 31 | "math/rand" 32 | "testing" 33 | "time" 34 | 35 | "github.com/openthread/ot-ns/otnstester" 36 | ) 37 | 38 | func TestAddManySEDs(t *testing.T) { 39 | ot := otnstester.Instance(t) 40 | testAddManySEDs(ot) 41 | ot.Reset() 42 | } 43 | 44 | func testAddManySEDs(test *otnstester.OtnsTest) { 45 | test.Start("testAddManySEDs") 46 | test.Command("radiomodel MutualInterference") 47 | 48 | x := 500 49 | y := 500 50 | nodeid := test.AddNode("router", x, y) 51 | test.ExpectEqual(1, nodeid) 52 | test.Go(time.Second * 10) 53 | test.ExpectEqual(RoleLeader, test.GetNodeState(nodeid)) 54 | 55 | N := 10 // number of SED Children - 10 is the limit for a minimally Thread compliant Router. 56 | var r float64 57 | for n := 1; n <= N; n++ { 58 | fra := float64(n) / float64(N) 59 | r = rand.Float64()*60.0 + 60.0 60 | test.AddNodeRr("sed", int(float64(x)+r*math.Sin(2.0*math.Pi*fra)), 61 | int(float64(y)+r*math.Cos(2.0*math.Pi*fra)), 200) 62 | test.Go(time.Millisecond * 2200) 63 | } 64 | test.Go(time.Second * 60) 65 | 66 | for n := 2; n <= N+1; n++ { 67 | test.ExpectEqual(RoleChild, test.GetNodeState(n)) 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /otnstester/tests/otns_one_router_test.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023-2024, The OTNS Authors. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 1. Redistributions of source code must retain the above copyright 7 | // notice, this list of conditions and the following disclaimer. 8 | // 2. Redistributions in binary form must reproduce the above copyright 9 | // notice, this list of conditions and the following disclaimer in the 10 | // documentation and/or other materials provided with the distribution. 11 | // 3. Neither the name of the copyright holder nor the 12 | // names of its contributors may be used to endorse or promote products 13 | // derived from this software without specific prior written permission. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | // POSSIBILITY OF SUCH DAMAGE. 26 | 27 | package main 28 | 29 | import ( 30 | "testing" 31 | "time" 32 | 33 | "github.com/openthread/ot-ns/otnstester" 34 | ) 35 | 36 | func TestAddOneRouter(t *testing.T) { 37 | ot := otnstester.Instance(t) 38 | testAddOneRouter(ot) 39 | ot.Reset() 40 | } 41 | 42 | func testAddOneRouter(test *otnstester.OtnsTest) { 43 | test.Start("testAddOneRouter") 44 | 45 | nodeid := test.AddNode("router", 100, 100) 46 | test.ExpectEqual(1, nodeid) 47 | test.Go(time.Second * 10) 48 | test.ExpectEqual(RoleLeader, test.GetNodeState(nodeid)) 49 | test.ExpectVisualizeAddNode(nodeid, 100, 100, DefaultRadioRange) 50 | } 51 | -------------------------------------------------------------------------------- /pylibs/case_studies/forced_key_rotation.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # Copyright (c) 2024, The OTNS Authors. 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 1. Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # 2. Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # 3. Neither the name of the copyright holder nor the 13 | # names of its contributors may be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | 28 | # Case study on forced key rotation by a reference device (Leader), where the 29 | # new tKSC should be followed by the Router DUT. 30 | 31 | from otns.cli import OTNS 32 | from otns.cli.errors import OTNSExitedError 33 | 34 | 35 | def main(): 36 | ns = OTNS() 37 | ns.speed = 100 38 | ns.web() 39 | 40 | # Leader 41 | ns.add("router") 42 | ns.node_cmd(1, "keysequence counter 127") 43 | ns.go(10) 44 | 45 | # add Router 46 | ns.add("router") 47 | ns.go(10) 48 | 49 | # ping - both src and dst use Key Index 0x79 in Aux Security Header. 50 | ns.ping(1, 2) 51 | ns.go(10) 52 | 53 | # force tKSC update +1 54 | ns.node_cmd(1, "keysequence counter 128") 55 | 56 | # ping again - both src and dst must use Key Index 0x01 in Aux Security Header. 57 | ns.ping(1, 2) 58 | ns.go(10) 59 | 60 | # run some time to catch MLE messages from node 2 - should reflect same Key Index. 61 | ns.go(150) 62 | ns.web_display() 63 | 64 | 65 | if __name__ == '__main__': 66 | try: 67 | main() 68 | except OTNSExitedError as ex: 69 | if ex.exit_code != 0: 70 | raise 71 | -------------------------------------------------------------------------------- /pylibs/case_studies/traffic_patterns.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # Copyright (c) 2024, The OTNS Authors. 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 1. Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # 2. Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # 3. Neither the name of the copyright holder nor the 13 | # names of its contributors may be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | 28 | # Case study on traffic patterns simulation - unicast, multicast. 29 | 30 | from otns.cli import OTNS 31 | from otns.cli.errors import OTNSExitedError 32 | 33 | 34 | def build_topology(ns): 35 | # 34 pixels =~ 2 map grid units =~ 5 feet =~ 1.524 m 36 | ns.set_radioparam('MeterPerUnit', 1.524 / 34) 37 | ns.load("etc/mesh-topologies/office_50.yaml") 38 | 39 | 40 | def main(): 41 | ns = OTNS() 42 | ns.radiomodel = 'MutualInterference' 43 | ns.web('stats') 44 | ns.web('main') 45 | 46 | build_topology(ns) 47 | ns.go(30) 48 | ns.set_title('starting data traffic test') 49 | ns.speed = 1 50 | 51 | # send unicast and multicast traffic over mesh 52 | ns.kpi_start() 53 | ns.cmd("send coap con 1 50 ds 64") # unicast from BR to node 54 | ns.go(0.002) 55 | ns.cmd("send coap 48 31-50") # sensor triggers lights of lower group 56 | ns.go(5) 57 | ns.kpi_save('tmp/cs_traffic_patterns.json') 58 | ns.kpi_save() 59 | 60 | ns.set_title('data traffic test done') 61 | ns.interactive_cli() 62 | ns.web_display() 63 | 64 | 65 | if __name__ == '__main__': 66 | try: 67 | main() 68 | except OTNSExitedError as ex: 69 | if ex.exit_code != 0: 70 | raise 71 | -------------------------------------------------------------------------------- /pylibs/examples/form_partition.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # Copyright (c) 2020-2023, The OTNS Authors. 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 1. Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # 2. Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # 3. Neither the name of the copyright holder nor the 13 | # names of its contributors may be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | 28 | import time 29 | 30 | from otns.cli import OTNS 31 | 32 | from otns.cli.errors import OTNSExitedError 33 | 34 | XGAP = 150 35 | YGAP = 100 36 | 37 | 38 | def main(): 39 | ns = OTNS(otns_args=["-log", "debug", '-logfile', 'none']) 40 | ns.set_title("Form Partition Example") 41 | ns.web() 42 | ns.speed = float('inf') 43 | 44 | while True: 45 | # wait until next time 46 | for n in (2, 3, 4, 5, 6, 7, 8): 47 | test_nxn(ns, n) 48 | time.sleep(1) 49 | 50 | 51 | def test_nxn(ns, n): 52 | nodes = ns.nodes() 53 | for id in nodes: 54 | ns.delete(id) 55 | 56 | for r in range(n): 57 | for c in range(n): 58 | ns.add("router", 100 + XGAP * c, 100 + YGAP * r) 59 | 60 | secs = 0 61 | while True: 62 | ns.go(1) 63 | secs += 1 64 | 65 | partitions = ns.partitions() 66 | if len(partitions) == 1 and 0 not in partitions: 67 | # all nodes converged into one partition 68 | break 69 | 70 | 71 | if __name__ == '__main__': 72 | try: 73 | main() 74 | except OTNSExitedError as ex: 75 | if ex.exit_code != 0: 76 | raise 77 | -------------------------------------------------------------------------------- /pylibs/examples/interactive_cli.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # Copyright (c) 2023, The OTNS Authors. 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 1. Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # 2. Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # 3. Neither the name of the copyright holder nor the 13 | # names of its contributors may be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | 28 | from otns.cli import OTNS 29 | from otns.cli.errors import OTNSExitedError 30 | 31 | 32 | def main(): 33 | ns = OTNS() 34 | ns.web() 35 | 36 | ns.radiomodel = 'MIDisc' 37 | ns.speed = 20 38 | ns.set_title("Interactive simulation with OTNS CLI example - setting up") 39 | 40 | # add some nodes and let them form network 41 | ns.add("router") 42 | ns.go(10) 43 | ns.add("router") 44 | ns.go(10) 45 | ns.add("router") 46 | ns.go(10) 47 | ns.add("router") 48 | ns.go(10) 49 | ns.add("router") 50 | ns.go(10) 51 | 52 | # here we call the CLI for the user to type commands. Now the simulation can be manipulated as wanted, 53 | # using the CLI or GUI commands. Typing 'exit' will exit this call. 54 | ns.set_title( 55 | "Interactive simulation with OTNS CLI example - switch to cmdline and e.g. type 'ping 1 5', then look at animation" 56 | ) 57 | ns.speed = 0.008 58 | ns.autogo = True 59 | ns.interactive_cli() 60 | 61 | # after the user exits, more scripted things could be done. But usually the script would also exit. 62 | ns.speed = 10 63 | ns.add("fed") 64 | ns.go(15) 65 | 66 | 67 | if __name__ == '__main__': 68 | try: 69 | main() 70 | except OTNSExitedError as ex: 71 | if ex.exit_code != 0: 72 | raise 73 | -------------------------------------------------------------------------------- /pylibs/examples/interactive_cli_threaded.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # Copyright (c) 2023, The OTNS Authors. 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 1. Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # 2. Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # 3. Neither the name of the copyright holder nor the 13 | # names of its contributors may be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | 28 | import time 29 | 30 | from otns.cli import OTNS 31 | from otns.cli.errors import OTNSExitedError 32 | 33 | 34 | def main(): 35 | ns = OTNS() 36 | ns.web() 37 | 38 | ns.radiomodel = 'MIDisc' 39 | ns.speed = 10.0 40 | ns.set_title("Interactive simulation OTNS CLI Threaded example - switch to cmdline and type some commands.") 41 | 42 | # add some nodes and let them form network 43 | ns.add("router") 44 | ns.go(10) 45 | ns.add("router") 46 | ns.go(10) 47 | ns.add("router") 48 | ns.go(10) 49 | ns.add("router") 50 | ns.go(10) 51 | ns.add("router") 52 | ns.go(10) 53 | 54 | # here we call the threaded CLI for the user to type commands. Now the simulation can be manipulated as wanted, 55 | # using the CLI or GUI commands. 56 | ns.speed = 1.0 57 | ns.autogo = True 58 | if ns.interactive_cli_threaded(): 59 | # if returns True, the threaded CLI was started. 60 | # in parallel, this script can now act on the simulation. 61 | for n in range(1, 20): 62 | print('\nSending Python scripted ping 1 -> 5') 63 | ns.ping(1, 5) 64 | time.sleep(5) 65 | 66 | 67 | if __name__ == '__main__': 68 | try: 69 | main() 70 | except OTNSExitedError as ex: 71 | if ex.exit_code != 0: 72 | raise 73 | -------------------------------------------------------------------------------- /pylibs/examples/simple.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # Copyright (c) 2020-2023, The OTNS Authors. 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 1. Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # 2. Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # 3. Neither the name of the copyright holder nor the 13 | # names of its contributors may be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | 28 | from otns.cli import OTNS 29 | from otns.cli.errors import OTNSExitedError 30 | 31 | 32 | def main(): 33 | ns = OTNS(otns_args=["-log", "debug", "-logfile", "none"]) 34 | ns.set_title("Simple Example") 35 | ns.web() 36 | 37 | ns.add("router", x=300, y=300) 38 | ns.add("router", x=200, y=300) 39 | ns.add("fed", x=300, y=200) 40 | ns.add("med", x=400, y=300) 41 | ns.add("sed", x=300, y=400) 42 | 43 | ns.go() 44 | 45 | 46 | if __name__ == '__main__': 47 | try: 48 | main() 49 | except OTNSExitedError as ex: 50 | if ex.exit_code != 0: 51 | raise 52 | -------------------------------------------------------------------------------- /pylibs/otns/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # Copyright (c) 2020, The OTNS Authors. 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 1. Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # 2. Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # 3. Neither the name of the copyright holder nor the 13 | # names of its contributors may be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | -------------------------------------------------------------------------------- /pylibs/otns/cli/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # Copyright (c) 2020, The OTNS Authors. 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 1. Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # 2. Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # 3. Neither the name of the copyright holder nor the 13 | # names of its contributors may be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | 28 | from .OTNS import OTNS 29 | 30 | __all__ = ['OTNS'] 31 | -------------------------------------------------------------------------------- /pylibs/otns/errors.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # Copyright (c) 2020, The OTNS Authors. 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 1. Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # 2. Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # 3. Neither the name of the copyright holder nor the 13 | # names of its contributors may be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | """ 29 | This file contains definitions of OTNS errors 30 | """ 31 | 32 | 33 | class OTNSError(Exception): 34 | """ 35 | Base class for all OTNS errors. 36 | """ 37 | -------------------------------------------------------------------------------- /pylibs/otns/proto/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # Copyright (c) 2020, The OTNS Authors. 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 1. Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # 2. Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # 3. Neither the name of the copyright holder nor the 13 | # names of its contributors may be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | -------------------------------------------------------------------------------- /pylibs/setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # Copyright (c) 2020-2025, The OTNS Authors. 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 1. Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # 2. Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # 3. Neither the name of the copyright holder nor the 13 | # names of its contributors may be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | 28 | import setuptools 29 | 30 | setuptools.setup( 31 | name="pyOTNS", 32 | version="2.1.1", 33 | author="The OTNS Authors", 34 | description="Run OTNS2 OpenThread mesh network simulations from Python code", 35 | url="https://github.com/openthread/ot-ns", 36 | packages=setuptools.find_packages(), 37 | classifiers=[ 38 | "Programming Language :: Python :: 3", 39 | "License :: OSI Approved :: BSD 3-Clause License", 40 | "Operating System :: OS Independent", 41 | ], 42 | python_requires='>=3.9', 43 | install_requires=['PyYAML'], 44 | ) 45 | -------------------------------------------------------------------------------- /pylibs/stress_tests/errors.py: -------------------------------------------------------------------------------- 1 | # !/usr/bin/env python3 2 | # 3 | # Copyright (c) 2020, The OTNS Authors. 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are met: 8 | # 1. Redistributions of source code must retain the above copyright 9 | # notice, this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # 3. Neither the name of the copyright holder nor the 14 | # names of its contributors may be used to endorse or promote products 15 | # derived from this software without specific prior written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 21 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | # POSSIBILITY OF SUCH DAMAGE. 28 | 29 | 30 | class UnexpectedError(Exception): 31 | pass 32 | 33 | 34 | class UnexpectedNodeState(UnexpectedError): 35 | 36 | def __init__(self, nid: int, expected_state: str, actual_state: str): 37 | super(UnexpectedNodeState, 38 | self).__init__(f'Node {nid} state mismatch: expected {expected_state}, but is {actual_state}') 39 | 40 | 41 | class UnexpectedNodeAddr(UnexpectedError): 42 | pass 43 | -------------------------------------------------------------------------------- /pylibs/unittests/requirements.txt: -------------------------------------------------------------------------------- 1 | wheel>=0.42.0 2 | aiocoap==0.4.7 -------------------------------------------------------------------------------- /pylibs/unittests/test_border_router.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # Copyright (c) 2023, The OTNS Authors. 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 1. Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # 2. Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # 3. Neither the name of the copyright holder nor the 13 | # names of its contributors may be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | 29 | import unittest 30 | 31 | from OTNSTestCase import OTNSTestCase 32 | 33 | 34 | class BorderRouterTests(OTNSTestCase): 35 | 36 | def testAddDeleteBorderRouter(self): 37 | ns = self.ns 38 | nid = ns.add('br') 39 | self.assertNodeState(nid, 'detached') 40 | ns.go(10) 41 | self.assertNodeState(nid, 'leader') 42 | ns.delete(1) 43 | ns.go(10) 44 | self.assertTrue(len(ns.nodes()) == 0) 45 | 46 | def testBorderRouterDistributesOmrPrefix(self): 47 | ns = self.ns 48 | ns.radiomodel = 'MIDisc' # force line topology 49 | 50 | ns.add('br', x=100, y=100) 51 | ns.go(10) 52 | 53 | ns.add('router', x=250, y=100) 54 | ns.go(10) 55 | 56 | ns.add('fed', x=400, y=100) 57 | ns.go(80) 58 | 59 | ns.ping(3, 1, addrtype='slaac', count=4) 60 | ns.go(50) 61 | ns.ping(1, 3, addrtype='slaac', count=4) 62 | ns.go(50) 63 | 64 | pings = ns.pings() 65 | self.assertTrue(len(pings) == 8) 66 | 67 | 68 | if __name__ == '__main__': 69 | unittest.main() 70 | -------------------------------------------------------------------------------- /radiomodel/utils.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022-2023, The OTNS Authors. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 1. Redistributions of source code must retain the above copyright 7 | // notice, this list of conditions and the following disclaimer. 8 | // 2. Redistributions in binary form must reproduce the above copyright 9 | // notice, this list of conditions and the following disclaimer in the 10 | // documentation and/or other materials provided with the distribution. 11 | // 3. Neither the name of the copyright holder nor the 12 | // names of its contributors may be used to endorse or promote products 13 | // derived from this software without specific prior written permission. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | // POSSIBILITY OF SUCH DAMAGE. 26 | 27 | package radiomodel 28 | 29 | import ( 30 | "math" 31 | 32 | . "github.com/openthread/ot-ns/types" 33 | ) 34 | 35 | // paround is a custom parameter rounding function (2 digits) 36 | func paround(param float64) float64 { 37 | return math.Round(param*100.0) / 100.0 38 | } 39 | 40 | // addSignalPowersDbm calculates signal power in dBm of two added, uncorrelated, signals with powers p1 and p2 (dBm). 41 | func addSignalPowersDbm(p1 DbValue, p2 DbValue) DbValue { 42 | if p1 > p2+15.0 { // avoid costly calculation where possible 43 | return p1 44 | } 45 | if p2 > p1+15.0 { 46 | return p2 47 | } 48 | return 10.0 * math.Log10(math.Pow(10, p1/10.0)+math.Pow(10, p2/10.0)) 49 | } 50 | 51 | // clipRssi clips the RSSI value (in dBm, as DbValue) to int8 range for return to OT nodes. 52 | func clipRssi(rssi DbValue) int8 { 53 | if rssi > RssiMax { 54 | rssi = RssiMax 55 | } else if rssi < RssiMin { 56 | rssi = RssiMinusInfinity 57 | } 58 | return int8(math.Round(rssi)) 59 | } 60 | -------------------------------------------------------------------------------- /script/compile-proto: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2020-2025, The OTNS Authors. 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 1. Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # 2. Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # 3. Neither the name of the copyright holder nor the 13 | # names of its contributors may be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | 28 | # Compiles all Protocol Buffers files and gRPC interfaces 29 | 30 | # shellcheck source=script/common.sh 31 | . "$(dirname "$0")"/common.sh 32 | 33 | compile_proto() 34 | { 35 | cd "$OTNSDIR"/visualize/grpc/pb || return 1 36 | protoc -I=. visualize_grpc.proto --go_opt=paths=source_relative --go_out=plugins=grpc:. 37 | mkdir -p ../../../web/site/js/proto/ 38 | protoc -I=. visualize_grpc.proto \ 39 | --js_out=import_style=commonjs:../../../web/site/js/proto/ \ 40 | --grpc-web_out=import_style=commonjs,mode=grpcwebtext:../../../web/site/js/proto/ 41 | python3 -m grpc_tools.protoc -I. \ 42 | --python_out=../../../pylibs/otns/proto \ 43 | --grpc_python_out=../../../pylibs/otns/proto \ 44 | ./visualize_grpc.proto 45 | cd - || return 1 46 | } 47 | 48 | replace_python_proto_import_path() 49 | { 50 | local search='import visualize_grpc_pb2 as visualize__grpc__pb2' 51 | local replace='from . import visualize_grpc_pb2 as visualize__grpc__pb2' 52 | 53 | if [[ $Darwin == 1 ]]; then 54 | sed -i "" "s/${search}/${replace}/g" pylibs/otns/proto/visualize_grpc_pb2_grpc.py 55 | else 56 | sed -i "s/${search}/${replace}/g" pylibs/otns/proto/visualize_grpc_pb2_grpc.py 57 | fi 58 | } 59 | 60 | compile_proto 61 | replace_python_proto_import_path 62 | -------------------------------------------------------------------------------- /script/install: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2020-2025, The OTNS Authors. 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 1. Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # 2. Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # 3. Neither the name of the copyright holder nor the 13 | # names of its contributors may be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | 28 | # Installs OTNS (without any OT node executables) and pyOTNS. 29 | 30 | # shellcheck source=script/common.sh 31 | . "$(dirname "$0")"/common.sh 32 | 33 | install_otns() 34 | { 35 | go mod tidy 36 | repeat 3 go_install ./cmd/... 37 | echo "otns installed: $(command -v otns)" 38 | } 39 | 40 | install_pyotns() 41 | { 42 | activate_python_venv 43 | cd pylibs 44 | python3 -m pip install . 45 | # python3 setup.py install --user --prefix= 2>/dev/null # alternative - fails on macos-14 46 | cd - 47 | } 48 | 49 | main() 50 | { 51 | install_pyotns 52 | install_otns 53 | } 54 | 55 | main 56 | -------------------------------------------------------------------------------- /script/install-nodes: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2024-2025, The OTNS Authors. 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 1. Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # 2. Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # 3. Neither the name of the copyright holder nor the 13 | # names of its contributors may be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | 28 | # Installs the full set of OT node executables used by OTNS. This includes 29 | # different Thread protocol version nodes and special node types (BR). 30 | 31 | # shellcheck source=script/common.sh 32 | . "$(dirname "$0")"/common.sh 33 | 34 | main() 35 | { 36 | build_openthread_versions 37 | } 38 | 39 | main 40 | -------------------------------------------------------------------------------- /script/pack-web: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2020-2025, The OTNS Authors. 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 1. Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # 2. Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # 3. Neither the name of the copyright holder nor the 13 | # names of its contributors may be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | 28 | # Packs web related files into go binary data using [go-bindata](https://github.com/jteeuwen/go-bindata) 29 | 30 | # shellcheck source=script/common.sh 31 | . "$(dirname "$0")"/common.sh 32 | 33 | main() 34 | { 35 | readonly sitedir="$OTNSDIR"/web/site 36 | ( 37 | cd "$sitedir" 38 | npm install 39 | npm version 40 | npx webpack ./js/visualize.js -o ./static/js/visualize.js 41 | npx webpack ./js/energyViewer.js -o ./static/js/energyViewer.js 42 | npx webpack ./js/statsViewer.js -o ./static/js/statsViewer.js 43 | 44 | go-bindata -pkg web_site -o _bindata.go templates/... static/... 45 | head -26 bindata.go >_merge_bindata.go 46 | cat _bindata.go >>_merge_bindata.go 47 | mv _merge_bindata.go bindata.go 48 | rm -f _bindata.go 49 | ) 50 | } 51 | 52 | ./script/compile-proto 53 | main 54 | -------------------------------------------------------------------------------- /script/run-docker-pack-web: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2020-2025, The OTNS Authors. 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without 6 | # modification, are permitted provided that the following conditions are met: 7 | # 1. Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # 2. Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # 3. Neither the name of the copyright holder nor the 13 | # names of its contributors may be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | # POSSIBILITY OF SUCH DAMAGE. 27 | 28 | # Runs the pack-web script via a Docker with the right tools environment. 29 | # Only used during OTNS-web development. The Docker image is created via 30 | # /.github/workflows/docker.yml . It can also be created using script 31 | # `./script/docker-build environment`. 32 | 33 | set -euxo pipefail 34 | 35 | docker run -t -v"$PWD":/otns openthread/otns2:environment -c "./script/pack-web" 36 | -------------------------------------------------------------------------------- /simulation/kpi_test.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024, The OTNS Authors. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 1. Redistributions of source code must retain the above copyright 7 | // notice, this list of conditions and the following disclaimer. 8 | // 2. Redistributions in binary form must reproduce the above copyright 9 | // notice, this list of conditions and the following disclaimer in the 10 | // documentation and/or other materials provided with the distribution. 11 | // 3. Neither the name of the copyright holder nor the 12 | // names of its contributors may be used to endorse or promote products 13 | // derived from this software without specific prior written permission. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | // POSSIBILITY OF SUCH DAMAGE. 26 | 27 | package simulation 28 | 29 | import ( 30 | "testing" 31 | 32 | "github.com/stretchr/testify/assert" 33 | ) 34 | 35 | func TestNodeCounters(t *testing.T) { 36 | n1 := make(NodeCounters) 37 | n1["test1.key"] = 42 38 | n1["test3.key"] = 987 39 | 40 | n2 := make(NodeCounters) 41 | n2["test1.key"] = 42 42 | n2["test2.key"] = 121 43 | 44 | n2.Add(n1) 45 | 46 | assert.Equal(t, uint64(42), n1["test1.key"]) 47 | _, n1HasTest2Key := n1["test2.key"] 48 | assert.False(t, n1HasTest2Key) 49 | assert.Equal(t, uint64(987), n1["test3.key"]) 50 | 51 | assert.Equal(t, uint64(84), n2["test1.key"]) 52 | assert.Equal(t, uint64(121), n2["test2.key"]) 53 | assert.Equal(t, uint64(987), n2["test3.key"]) 54 | } 55 | -------------------------------------------------------------------------------- /simulation/node_config_test.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023, The OTNS Authors. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 1. Redistributions of source code must retain the above copyright 7 | // notice, this list of conditions and the following disclaimer. 8 | // 2. Redistributions in binary form must reproduce the above copyright 9 | // notice, this list of conditions and the following disclaimer in the 10 | // documentation and/or other materials provided with the distribution. 11 | // 3. Neither the name of the copyright holder nor the 12 | // names of its contributors may be used to endorse or promote products 13 | // derived from this software without specific prior written permission. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | // POSSIBILITY OF SUCH DAMAGE. 26 | 27 | package simulation 28 | 29 | import ( 30 | "testing" 31 | 32 | "github.com/stretchr/testify/assert" 33 | ) 34 | 35 | func TestDetermineExecutableBasedOnConfig(t *testing.T) { 36 | cfg := ExecutableConfig{ 37 | Ftd: "my-ftd-fail", 38 | Mtd: "ot-cli-mtd", 39 | Br: "br-script", 40 | SearchPaths: []string{".", "./otrfsim/path/not/found", "../ot-rfsim/ot-versions"}, 41 | } 42 | 43 | // if file could not be located, same name is returned. 44 | nodeCfg := DefaultNodeConfig() 45 | exe := cfg.FindExecutableBasedOnConfig(&nodeCfg) 46 | assert.Equal(t, "my-ftd-fail", exe) 47 | 48 | // test assumes that ot-rfsim has been built. 49 | nodeCfg.IsMtd = true 50 | nodeCfg.IsRouter = false 51 | exe = cfg.FindExecutableBasedOnConfig(&nodeCfg) 52 | assert.Equal(t, "../ot-rfsim/ot-versions/ot-cli-mtd", exe) 53 | 54 | // test assumes that ot-rfsim has been built. 55 | cfg.Mtd = "ot-cli-mtd" 56 | exe = cfg.FindExecutableBasedOnConfig(&nodeCfg) 57 | assert.Equal(t, "../ot-rfsim/ot-versions/ot-cli-mtd", exe) 58 | 59 | // Also non-executable files could be supplied. The error comes only later when adding the node type. 60 | cfg.Ftd = "../simulation/node_config.go" 61 | nodeCfg.IsMtd = false 62 | nodeCfg.IsRouter = true 63 | exe = cfg.FindExecutableBasedOnConfig(&nodeCfg) 64 | assert.Equal(t, "../simulation/node_config.go", exe) 65 | } 66 | -------------------------------------------------------------------------------- /simulation/nodescript_parser.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022-2024, The OTNS Authors. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 1. Redistributions of source code must retain the above copyright 7 | // notice, this list of conditions and the following disclaimer. 8 | // 2. Redistributions in binary form must reproduce the above copyright 9 | // notice, this list of conditions and the following disclaimer in the 10 | // documentation and/or other materials provided with the distribution. 11 | // 3. Neither the name of the copyright holder nor the 12 | // names of its contributors may be used to endorse or promote products 13 | // derived from this software without specific prior written permission. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | // POSSIBILITY OF SUCH DAMAGE. 26 | 27 | package simulation 28 | 29 | import ( 30 | "fmt" 31 | "os" 32 | 33 | "gopkg.in/yaml.v3" 34 | ) 35 | 36 | func ReadNodeScript(fn string) (*YamlScriptConfig, error) { 37 | b, err := os.ReadFile(fn) 38 | if err != nil { 39 | err = fmt.Errorf("could not load script config file '%s': %v", fn, err) 40 | return nil, err 41 | } 42 | cfgFile := YamlConfigFile{} 43 | err = yaml.Unmarshal(b, &cfgFile) 44 | if err != nil { 45 | err = fmt.Errorf("error in YAML file: %v", err) 46 | return nil, err 47 | } 48 | return &cfgFile.ScriptConfig, nil 49 | } 50 | -------------------------------------------------------------------------------- /simulation/simulationController.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020, The OTNS Authors. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 1. Redistributions of source code must retain the above copyright 7 | // notice, this list of conditions and the following disclaimer. 8 | // 2. Redistributions in binary form must reproduce the above copyright 9 | // notice, this list of conditions and the following disclaimer in the 10 | // documentation and/or other materials provided with the distribution. 11 | // 3. Neither the name of the copyright holder nor the 12 | // names of its contributors may be used to endorse or promote products 13 | // derived from this software without specific prior written permission. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | // POSSIBILITY OF SUCH DAMAGE. 26 | 27 | package simulation 28 | 29 | import ( 30 | "strings" 31 | 32 | "github.com/openthread/ot-ns/visualize" 33 | "github.com/pkg/errors" 34 | ) 35 | 36 | type simulationController struct { 37 | sim *Simulation 38 | } 39 | 40 | func (sc *simulationController) Command(cmd string) ([]string, error) { 41 | var outputBuilder strings.Builder 42 | 43 | sim := sc.sim 44 | err := sim.cmdRunner.RunCommand(cmd, &outputBuilder) 45 | if err != nil { 46 | return nil, err 47 | } 48 | output := strings.Split(outputBuilder.String(), "\n") 49 | if output[len(output)-1] == "" { 50 | output = output[:len(output)-1] 51 | } 52 | return output, nil 53 | } 54 | 55 | type readonlySimulationController struct { 56 | sim *Simulation 57 | } 58 | 59 | var readonlySimulationError = errors.Errorf("simulation is readonly") 60 | 61 | func (rc *readonlySimulationController) Command(cmd string) (output []string, err error) { 62 | return nil, readonlySimulationError 63 | } 64 | 65 | func NewSimulationController(sim *Simulation) visualize.SimulationController { 66 | if !sim.cfg.ReadOnly { 67 | return &simulationController{sim} 68 | } else { 69 | return &readonlySimulationController{sim} 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /simulation/utils_test.go: -------------------------------------------------------------------------------- 1 | package simulation 2 | 3 | import ( 4 | "net/netip" 5 | "testing" 6 | 7 | "encoding/binary" 8 | "encoding/hex" 9 | 10 | "github.com/stretchr/testify/assert" 11 | ) 12 | 13 | func TestCreateIp6UdpDatagram(t *testing.T) { 14 | src := netip.MustParseAddr("fc00::1234") 15 | dst := netip.MustParseAddr("fe80::abcd") 16 | udpPayload := []byte{1, 2, 3, 4, 5} 17 | 18 | ip6 := createIp6UdpDatagram(5683, 5683, src, dst, 64, udpPayload) 19 | assert.Equal(t, 53, len(ip6)) 20 | } 21 | 22 | func TestUdpChecksum(t *testing.T) { 23 | // see example on https://stackoverflow.com/questions/30858973/udp-checksum-calculation-for-ipv6-packet 24 | src := netip.MustParseAddr("2100::1:abcd:0:0:1") 25 | dst := netip.MustParseAddr("fd00::160") 26 | udpPayload := []byte{0x12, 0x34, 0x56, 0x78} 27 | 28 | ip6 := createIp6UdpDatagram(9874, 9874, src, dst, 64, udpPayload) 29 | assert.Equal(t, 52, len(ip6)) 30 | 31 | ip6HexStr := hex.EncodeToString(ip6) 32 | assert.Equal(t, "60000000000c11402100000000000001abcd000000000001fd00000000000000000000000000016026922692000c7ed512345678", ip6HexStr) 33 | udpChecksum := binary.BigEndian.Uint16(ip6[46:48]) 34 | assert.Equal(t, uint16(0x7ed5), udpChecksum) 35 | } 36 | -------------------------------------------------------------------------------- /visualize/SimulationController.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020, The OTNS Authors. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 1. Redistributions of source code must retain the above copyright 7 | // notice, this list of conditions and the following disclaimer. 8 | // 2. Redistributions in binary form must reproduce the above copyright 9 | // notice, this list of conditions and the following disclaimer in the 10 | // documentation and/or other materials provided with the distribution. 11 | // 3. Neither the name of the copyright holder nor the 12 | // names of its contributors may be used to endorse or promote products 13 | // derived from this software without specific prior written permission. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | // POSSIBILITY OF SUCH DAMAGE. 26 | 27 | package visualize 28 | 29 | // SimulationController interfaces back to the entity controlling the simulation. 30 | type SimulationController interface { 31 | // Command is called when the Visualizer wants to execute a CLI command. 32 | Command(cmd string) ([]string, error) 33 | } 34 | -------------------------------------------------------------------------------- /visualize/grpc/grpcNode.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022-2024, The OTNS Authors. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 1. Redistributions of source code must retain the above copyright 7 | // notice, this list of conditions and the following disclaimer. 8 | // 2. Redistributions in binary form must reproduce the above copyright 9 | // notice, this list of conditions and the following disclaimer in the 10 | // documentation and/or other materials provided with the distribution. 11 | // 3. Neither the name of the copyright holder nor the 12 | // names of its contributors may be used to endorse or promote products 13 | // derived from this software without specific prior written permission. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | // POSSIBILITY OF SUCH DAMAGE. 26 | 27 | package visualize_grpc 28 | 29 | import ( 30 | . "github.com/openthread/ot-ns/types" 31 | ) 32 | 33 | type grpcNode struct { 34 | nodeid NodeId 35 | extaddr uint64 36 | x, y, z int 37 | radioRange int 38 | nodeType string 39 | mode NodeMode 40 | rloc16 uint16 41 | role OtDeviceRole 42 | partitionId uint32 43 | failed bool 44 | parent uint64 45 | routerTable map[uint64]struct{} 46 | childTable map[uint64]struct{} 47 | threadVersion uint16 48 | version string 49 | commit string 50 | } 51 | 52 | func newGprcNode(id NodeId, cfg *NodeConfig) *grpcNode { 53 | gn := &grpcNode{ 54 | nodeid: id, 55 | extaddr: InvalidExtAddr, 56 | x: cfg.X, 57 | y: cfg.Y, 58 | z: cfg.Z, 59 | radioRange: cfg.RadioRange, 60 | nodeType: cfg.Type, 61 | mode: DefaultNodeMode(), 62 | rloc16: InvalidRloc16, 63 | role: OtDeviceRoleDisabled, 64 | partitionId: 0, 65 | failed: false, 66 | parent: 0, 67 | routerTable: map[uint64]struct{}{}, 68 | childTable: map[uint64]struct{}{}, 69 | threadVersion: InvalidThreadVersion, 70 | version: cfg.Version, 71 | commit: "", 72 | } 73 | return gn 74 | } 75 | -------------------------------------------------------------------------------- /visualize/grpc/grpcServer_test.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020-2024, The OTNS Authors. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 1. Redistributions of source code must retain the above copyright 7 | // notice, this list of conditions and the following disclaimer. 8 | // 2. Redistributions in binary form must reproduce the above copyright 9 | // notice, this list of conditions and the following disclaimer in the 10 | // documentation and/or other materials provided with the distribution. 11 | // 3. Neither the name of the copyright holder nor the 12 | // names of its contributors may be used to endorse or promote products 13 | // derived from this software without specific prior written permission. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | // POSSIBILITY OF SUCH DAMAGE. 26 | 27 | package visualize_grpc 28 | 29 | import ( 30 | "testing" 31 | "time" 32 | 33 | "github.com/stretchr/testify/assert" 34 | 35 | "github.com/openthread/ot-ns/logger" 36 | ) 37 | 38 | func TestStartStopServer(t *testing.T) { 39 | vis := &grpcVisualizer{ 40 | simctrl: nil, 41 | f: newGrpcField(), 42 | } 43 | srv := newGrpcServer(vis, "localhost:8997", nil) 44 | 45 | var err error 46 | done := make(chan bool) 47 | go func() { 48 | err = srv.Run() 49 | done <- true 50 | }() 51 | time.Sleep(time.Second * 1) 52 | srv.stop() 53 | 54 | <-done 55 | assert.Nil(t, err, "expected nil Run() error but got %v", err) 56 | } 57 | 58 | func TestStopBeforeStart(t *testing.T) { 59 | vis := &grpcVisualizer{ 60 | simctrl: nil, 61 | f: newGrpcField(), 62 | } 63 | srv := newGrpcServer(vis, "localhost:8997", nil) 64 | 65 | var err error 66 | done := make(chan bool) 67 | go func() { 68 | time.Sleep(time.Second * 1) 69 | err = srv.Run() 70 | done <- true 71 | }() 72 | srv.stop() 73 | 74 | <-done 75 | assert.NotNil(t, err, "expected Run() error but got nil") 76 | logger.Infof("Run() err returned: %v", err) 77 | } 78 | -------------------------------------------------------------------------------- /web/site/bindata_test.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020, The OTNS Authors. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 1. Redistributions of source code must retain the above copyright 7 | // notice, this list of conditions and the following disclaimer. 8 | // 2. Redistributions in binary form must reproduce the above copyright 9 | // notice, this list of conditions and the following disclaimer in the 10 | // documentation and/or other materials provided with the distribution. 11 | // 3. Neither the name of the copyright holder nor the 12 | // names of its contributors may be used to endorse or promote products 13 | // derived from this software without specific prior written permission. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | // POSSIBILITY OF SUCH DAMAGE. 26 | 27 | package web_site 28 | 29 | import ( 30 | "testing" 31 | 32 | "github.com/stretchr/testify/assert" 33 | ) 34 | 35 | func TestAsset(t *testing.T) { 36 | _, err := Asset("static/js") 37 | assert.NotNil(t, err) 38 | 39 | data, err := Asset("static/js/visualize.js") 40 | assert.Nil(t, err) 41 | assert.Truef(t, len(data) > 0, "data is nil") 42 | } 43 | 44 | func TestAssetNames(t *testing.T) { 45 | names := AssetNames() 46 | assert.NotEmpty(t, names) 47 | for _, name := range names { 48 | data, err := Asset(name) 49 | assert.Nil(t, err) 50 | assert.NotEmpty(t, data) 51 | } 52 | } 53 | 54 | func TestAssetDir(t *testing.T) { 55 | for _, dir := range []string{"", "templates", "static"} { 56 | names, err := AssetDir(dir) 57 | assert.Nil(t, err) 58 | assert.NotEmpty(t, names) 59 | } 60 | 61 | names, err := AssetDir("__NotExist") 62 | assert.NotNil(t, err) 63 | assert.Empty(t, names) 64 | } 65 | -------------------------------------------------------------------------------- /web/site/js/vis/consts.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020-2023, The OTNS Authors. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 1. Redistributions of source code must retain the above copyright 7 | // notice, this list of conditions and the following disclaimer. 8 | // 2. Redistributions in binary form must reproduce the above copyright 9 | // notice, this list of conditions and the following disclaimer in the 10 | // documentation and/or other materials provided with the distribution. 11 | // 3. Neither the name of the copyright holder nor the 12 | // names of its contributors may be used to endorse or promote products 13 | // derived from this software without specific prior written permission. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | // POSSIBILITY OF SUCH DAMAGE. 26 | 27 | // nodes and numbering 28 | export const NODE_ID_INVALID = 0xffff; 29 | export const EXT_ADDR_INVALID = 0xFFFFFFFFFFFFFFFF; 30 | 31 | // simulation speed controls 32 | export const PAUSE_SPEED = 0; 33 | export const MAX_SPEED = 1000000; 34 | export const TUNE_SPEED_SETTINGS = [0.000001, 0.000005, 0.00001, 0.00005, 0.0001, 0.0005, 0.001, 0.005, 0.01, 35 | 0.05, 0.1, 0.25, 0.5, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, MAX_SPEED]; 36 | 37 | // radio frame and power info 38 | export const FRAME_CONTROL_MASK_FRAME_TYPE = 0x7; 39 | export const FRAME_TYPE_ACK = 2; 40 | export const POWER_DBM_INVALID = 127; 41 | 42 | // colors and fonts 43 | export const COLOR_ACK_MESSAGE = 0xaee571; 44 | export const BUTTON_LABEL_FONT_FAMILY = 'verdana, helvetica, sans-serif'; 45 | export const NODE_LABEL_FONT_FAMILY = 'helvetica, arial, monospace, sans-serif'; 46 | export const NODE_LABEL_FONT_SIZE = 13; 47 | export const STATUS_MSG_FONT_FAMILY = 'consolas, monaco, monospace'; 48 | export const STATUS_MSG_FONT_SIZE = 13; 49 | 50 | export const LOG_WINDOW_FONT_FAMILY = 'verdana, helvetica, sans-serif'; 51 | export const LOG_WINDOW_FONT_SIZE = 11.5; 52 | export const LOG_WINDOW_FONT_COLOR = "Blue"; 53 | -------------------------------------------------------------------------------- /web/site/js/vis/resources.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020, The OTNS Authors. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 1. Redistributions of source code must retain the above copyright 7 | // notice, this list of conditions and the following disclaimer. 8 | // 2. Redistributions in binary form must reproduce the above copyright 9 | // notice, this list of conditions and the following disclaimer in the 10 | // documentation and/or other materials provided with the distribution. 11 | // 3. Neither the name of the copyright holder nor the 12 | // names of its contributors may be used to endorse or promote products 13 | // derived from this software without specific prior written permission. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | // POSSIBILITY OF SUCH DAMAGE. 26 | 27 | let resources = null; 28 | 29 | export function Resources() { 30 | return resources; 31 | } 32 | 33 | export function SetResources(res) { 34 | resources = res; 35 | } -------------------------------------------------------------------------------- /web/site/js/vis/wrapper.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020, The OTNS Authors. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 1. Redistributions of source code must retain the above copyright 7 | // notice, this list of conditions and the following disclaimer. 8 | // 2. Redistributions in binary form must reproduce the above copyright 9 | // notice, this list of conditions and the following disclaimer in the 10 | // documentation and/or other materials provided with the distribution. 11 | // 3. Neither the name of the copyright holder nor the 12 | // names of its contributors may be used to endorse or promote products 13 | // derived from this software without specific prior written permission. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | // POSSIBILITY OF SUCH DAMAGE. 26 | 27 | import * as PIXI from "pixi.js-legacy"; 28 | import VObject from "./VObject"; 29 | 30 | export class Text extends VObject { 31 | constructor(text, style) { 32 | super(); 33 | this._root = new PIXI.Text(text, style) 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /web/site/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "otns-web", 3 | "version": "2.0.0", 4 | "description": "otns-web site", 5 | "devDependencies": { 6 | "@grpc/proto-loader": "^0.3.0", 7 | "google-protobuf": "^3.6.1", 8 | "grpc": "^1.15.0", 9 | "grpc-web": "^1.0.0", 10 | "webpack": "^4.16.5", 11 | "webpack-cli": "^3.1.0" 12 | }, 13 | "dependencies": { 14 | "chart.js": "3.9.1", 15 | "pixi-scrollbox": "2.1.5", 16 | "pixi-viewport": "4.13.2", 17 | "pixi.js": "5.3.3", 18 | "pixi.js-legacy": "5.3.3" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /web/site/static/image/checked-checkbox-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/checked-checkbox-32.png -------------------------------------------------------------------------------- /web/site/static/image/gua.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/gua.png -------------------------------------------------------------------------------- /web/site/static/image/pause-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/pause-32.png -------------------------------------------------------------------------------- /web/site/static/image/play-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/play-32.png -------------------------------------------------------------------------------- /web/site/static/image/unchecked-checkbox-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/unchecked-checkbox-32.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/circle-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/circle-128.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/circle-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/circle-16.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/circle-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/circle-24.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/circle-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/circle-256.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/circle-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/circle-32.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/circle-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/circle-48.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/circle-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/circle-512.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/circle-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/circle-64.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/circle-dashed-4-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/circle-dashed-4-128.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/circle-dashed-4-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/circle-dashed-4-16.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/circle-dashed-4-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/circle-dashed-4-24.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/circle-dashed-4-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/circle-dashed-4-256.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/circle-dashed-4-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/circle-dashed-4-32.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/circle-dashed-4-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/circle-dashed-4-48.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/circle-dashed-4-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/circle-dashed-4-512.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/circle-dashed-4-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/circle-dashed-4-64.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/circle-dashed-6-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/circle-dashed-6-128.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/circle-dashed-6-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/circle-dashed-6-16.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/circle-dashed-6-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/circle-dashed-6-24.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/circle-dashed-6-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/circle-dashed-6-256.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/circle-dashed-6-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/circle-dashed-6-32.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/circle-dashed-6-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/circle-dashed-6-48.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/circle-dashed-6-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/circle-dashed-6-512.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/circle-dashed-6-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/circle-dashed-6-64.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/circle-dashed-8-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/circle-dashed-8-128.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/circle-dashed-8-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/circle-dashed-8-16.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/circle-dashed-8-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/circle-dashed-8-24.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/circle-dashed-8-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/circle-dashed-8-256.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/circle-dashed-8-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/circle-dashed-8-32.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/circle-dashed-8-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/circle-dashed-8-48.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/circle-dashed-8-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/circle-dashed-8-512.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/circle-dashed-8-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/circle-dashed-8-64.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/circle-outline-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/circle-outline-128.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/circle-outline-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/circle-outline-16.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/circle-outline-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/circle-outline-24.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/circle-outline-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/circle-outline-256.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/circle-outline-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/circle-outline-32.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/circle-outline-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/circle-outline-48.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/circle-outline-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/circle-outline-512.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/circle-outline-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/circle-outline-64.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/hexagon-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/hexagon-128.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/hexagon-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/hexagon-16.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/hexagon-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/hexagon-24.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/hexagon-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/hexagon-256.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/hexagon-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/hexagon-32.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/hexagon-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/hexagon-48.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/hexagon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/hexagon-512.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/hexagon-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/hexagon-64.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/hexagon-outline-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/hexagon-outline-128.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/hexagon-outline-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/hexagon-outline-16.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/hexagon-outline-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/hexagon-outline-24.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/hexagon-outline-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/hexagon-outline-256.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/hexagon-outline-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/hexagon-outline-32.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/hexagon-outline-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/hexagon-outline-48.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/hexagon-outline-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/hexagon-outline-512.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/hexagon-outline-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/hexagon-outline-64.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/octagon-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/octagon-128.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/octagon-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/octagon-16.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/octagon-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/octagon-24.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/octagon-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/octagon-256.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/octagon-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/octagon-32.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/octagon-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/octagon-48.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/octagon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/octagon-512.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/octagon-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/octagon-64.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/octagon-outline-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/octagon-outline-128.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/octagon-outline-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/octagon-outline-16.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/octagon-outline-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/octagon-outline-24.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/octagon-outline-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/octagon-outline-256.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/octagon-outline-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/octagon-outline-32.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/octagon-outline-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/octagon-outline-48.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/octagon-outline-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/octagon-outline-512.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/octagon-outline-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/octagon-outline-64.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-128.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-16.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-24.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-256.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-32.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-48.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-512.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-64.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-dashed-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-dashed-128.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-dashed-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-dashed-16.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-dashed-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-dashed-24.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-dashed-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-dashed-256.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-dashed-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-dashed-32.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-dashed-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-dashed-48.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-dashed-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-dashed-512.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-dashed-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-dashed-64.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-dashed-rounded-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-dashed-rounded-128.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-dashed-rounded-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-dashed-rounded-16.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-dashed-rounded-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-dashed-rounded-24.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-dashed-rounded-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-dashed-rounded-256.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-dashed-rounded-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-dashed-rounded-32.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-dashed-rounded-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-dashed-rounded-48.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-dashed-rounded-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-dashed-rounded-512.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-dashed-rounded-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-dashed-rounded-64.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-ios-app-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-ios-app-128.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-ios-app-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-ios-app-16.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-ios-app-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-ios-app-24.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-ios-app-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-ios-app-256.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-ios-app-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-ios-app-32.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-ios-app-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-ios-app-48.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-ios-app-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-ios-app-512.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-ios-app-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-ios-app-64.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-outline-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-outline-128.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-outline-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-outline-16.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-outline-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-outline-24.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-outline-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-outline-256.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-outline-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-outline-32.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-outline-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-outline-48.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-outline-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-outline-512.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-outline-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-outline-64.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-rounded-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-rounded-128.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-rounded-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-rounded-16.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-rounded-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-rounded-24.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-rounded-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-rounded-256.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-rounded-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-rounded-32.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-rounded-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-rounded-48.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-rounded-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-rounded-512.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/square-rounded-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/square-rounded-64.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/triangle-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/triangle-128.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/triangle-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/triangle-16.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/triangle-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/triangle-24.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/triangle-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/triangle-256.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/triangle-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/triangle-32.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/triangle-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/triangle-48.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/triangle-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/triangle-512.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/triangle-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/triangle-64.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/triangle-outline-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/triangle-outline-128.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/triangle-outline-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/triangle-outline-16.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/triangle-outline-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/triangle-outline-24.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/triangle-outline-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/triangle-outline-256.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/triangle-outline-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/triangle-outline-32.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/triangle-outline-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/triangle-outline-48.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/triangle-outline-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/triangle-outline-512.png -------------------------------------------------------------------------------- /web/site/static/image/white-shapes/triangle-outline-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openthread/ot-ns/0af4f1debb4abdf7a4bfa1b9dbe3fd9e04afda76/web/site/static/image/white-shapes/triangle-outline-64.png -------------------------------------------------------------------------------- /web/site/templates/energyViewer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | OTNS2 - Energy viewer 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 |
13 | 14 | 15 | 16 | 17 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /web/site/templates/statsViewer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | OTNS2 - Stats viewer 6 | 7 | 8 |
9 | 10 |
11 | 12 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /web/site/templates/visualize.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | OTNS2 - OpenThread Network Simulator 2 6 | 7 | 15 | 16 | 17 | 18 | 19 |
20 | 22 |
23 | 24 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /web/site/webpack.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | mode: 'production', 3 | 4 | performance: { 5 | maxAssetSize: 1048576, 6 | maxEntrypointSize: 1048576, 7 | }, 8 | 9 | resolve: { 10 | extensions: ['*', '.mjs', '.js', '.json'] 11 | }, 12 | 13 | module: { 14 | rules: [ 15 | { 16 | test: /\.mjs$/, 17 | include: /node_modules/, 18 | type: 'javascript/auto' 19 | } 20 | ] 21 | } 22 | }; -------------------------------------------------------------------------------- /web/web_test.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020-2023, The OTNS Authors. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are met: 6 | // 1. Redistributions of source code must retain the above copyright 7 | // notice, this list of conditions and the following disclaimer. 8 | // 2. Redistributions in binary form must reproduce the above copyright 9 | // notice, this list of conditions and the following disclaimer in the 10 | // documentation and/or other materials provided with the distribution. 11 | // 3. Neither the name of the copyright holder nor the 12 | // names of its contributors may be used to endorse or promote products 13 | // derived from this software without specific prior written permission. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | // POSSIBILITY OF SUCH DAMAGE. 26 | 27 | package web 28 | 29 | import ( 30 | "context" 31 | "runtime" 32 | "testing" 33 | 34 | "github.com/openthread/ot-ns/progctx" 35 | ) 36 | 37 | func TestOpenWeb(t *testing.T) { 38 | ctx := progctx.New(context.Background()) 39 | err := OpenWeb(ctx, MainTab) 40 | if err != nil { 41 | t.Error(err) 42 | } 43 | err = OpenWeb(ctx, StatsTab) 44 | if err != nil { 45 | t.Error(err) 46 | } 47 | err = OpenWeb(ctx, EnergyTab) 48 | if err != nil { 49 | t.Error(err) 50 | } 51 | 52 | for ctx.WaitCount() == 0 { 53 | runtime.Gosched() 54 | } 55 | 56 | ctx.Cancel(context.Background()) 57 | ctx.Wait() 58 | } 59 | --------------------------------------------------------------------------------