[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:
Yakun Xu
2024-05-13 09:27:54 -07:00
committed by GitHub
parent 7cc636ccce
commit 39ce8117a5
7 changed files with 376 additions and 120 deletions
+11 -2
View File
@@ -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"