mirror of
https://github.com/espressif/openthread.git
synced 2026-08-07 03:07:47 +00:00
[simulation] support simulating radio over IPv6 (#10194)
This commit adds support to simulate Thread radio over IPv6. With this commit, a simulation will be simulated over either IPv6 or IPv4. If it's simulated on IPv6, it communicates with other simulation nodes in IPv6 group `ff02::116`. And if it's simulated on IPv4, it communicates with other simulation nodes in IPv4 group `224.0.0.116`. Note that simulating virtual time is not included in this commit.
This commit is contained in:
@@ -84,6 +84,13 @@ proc spawn_node {id {type ""} {radio_url ""}} {
|
||||
set gcov_prefix "ot-run/$argv0/ot-gcda.$id"
|
||||
}
|
||||
|
||||
if {[info exists ::env(OT_SIMULATION_LOCAL_HOST)]} {
|
||||
set ot_simulation_local_host $::env(OT_SIMULATION_LOCAL_HOST)
|
||||
set radio_url "$radio_url&forkpty-arg=-L$ot_simulation_local_host"
|
||||
} else {
|
||||
set ot_simulation_local_host "127.0.0.1"
|
||||
}
|
||||
|
||||
switch -regexp ${type} {
|
||||
{rcp|rcp-cli} {
|
||||
# Sleep 0.2 seconds to ensure that the ot-rcp in the previous test has exited to
|
||||
@@ -97,7 +104,8 @@ proc spawn_node {id {type ""} {radio_url ""}} {
|
||||
expect_line "Done"
|
||||
}
|
||||
cli {
|
||||
spawn /usr/bin/env GCOV_PREFIX=$gcov_prefix $::env(OT_SIMULATION_APPS)/cli/ot-cli-ftd $id
|
||||
spawn /usr/bin/env GCOV_PREFIX=$gcov_prefix $::env(OT_SIMULATION_APPS)/cli/ot-cli-ftd \
|
||||
-L$ot_simulation_local_host $id
|
||||
send "factoryreset\n"
|
||||
wait_for "state" "disabled"
|
||||
expect_line "Done"
|
||||
@@ -105,7 +113,8 @@ proc spawn_node {id {type ""} {radio_url ""}} {
|
||||
expect_line "Done"
|
||||
}
|
||||
mtd {
|
||||
spawn /usr/bin/env GCOV_PREFIX=$gcov_prefix $::env(OT_SIMULATION_APPS)/cli/ot-cli-mtd $id
|
||||
spawn /usr/bin/env GCOV_PREFIX=$gcov_prefix $::env(OT_SIMULATION_APPS)/cli/ot-cli-mtd \
|
||||
-L$ot_simulation_local_host $id
|
||||
send "factoryreset\n"
|
||||
wait_for "state" "disabled"
|
||||
expect_line "Done"
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
#!/usr/bin/expect -f
|
||||
#
|
||||
# Copyright (c) 2024, The OpenThread Authors.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. Neither the name of the copyright holder nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
source "tests/scripts/expect/_common.exp"
|
||||
|
||||
spawn_node 1 rcp "spinel+hdlc+uart://$::env(OT_SIMULATION_APPS)/ncp/ot-rcp?forkpty-arg=-Llo&forkpty-arg=1"
|
||||
send "factoryreset\n"
|
||||
wait_for "state" "disabled"
|
||||
setup_default_network
|
||||
attach
|
||||
|
||||
spawn_node 2 rcp "spinel+hdlc+uart://$::env(OT_SIMULATION_APPS)/ncp/ot-rcp?forkpty-arg=--local-host=127.0.0.1&forkpty-arg=2"
|
||||
send "factoryreset\n"
|
||||
wait_for "state" "disabled"
|
||||
setup_default_network
|
||||
attach child
|
||||
|
||||
dispose_all
|
||||
Reference in New Issue
Block a user