[toranj] add support for multi radio and TREL (#4440)

This commit updates `toranj` test framework to support running tests
in posix-app mode over a TREL radio link (a virtual Ethernet netif is
used for TREL). It also updates the build script to easily set up
different configurations, ncp/posix-app with any radio combination:
15.4 only, TREL only, or multi radio (15.4 + TREL).
This commit is contained in:
Abtin Keshavarzian
2020-12-10 11:46:07 -08:00
committed by Jonathan Hui
parent 07d734b1be
commit 451ae39be4
3 changed files with 151 additions and 14 deletions
+113 -11
View File
@@ -34,11 +34,17 @@ display_usage()
echo ""
echo "Usage: $(basename "$0") [options] <config>"
echo " <config> can be:"
echo " ncp : Build OpenThread NCP FTD mode with simulation platform"
echo " rcp : Build OpenThread RCP (NCP in radio mode) with simulation platform"
echo " posix : Build OpenThread POSIX App NCP"
echo " cmake : Configure and build OpenThread using cmake/ninja (RCP and NCP) only"
echo " cmake-posix: Configure and build OpenThread POSIX host using cmake/ninja"
echo " ncp : Build OpenThread NCP FTD mode with simulation platform"
echo " ncp-15.4 : Build OpenThread NCP FTD mode with simulation platform - 15.4 radio"
echo " ncp-trel : Build OpenThread NCP FTD mode with simulation platform - TREL radio "
echo " ncp-15.4+trel : Build OpenThread NCP FTD mode with simulation platform - multi radio (15.4+TREL)"
echo " rcp : Build OpenThread RCP (NCP in radio mode) with simulation platform"
echo " posix : Build OpenThread POSIX NCP"
echo " posix-15.4 : Build OpenThread POSIX NCP - 15.4 radio"
echo " posix-trel : Build OpenThread POSIX NCP - TREL radio "
echo " posix-15.4+trel : Build OpenThread POSIX NCP - multi radio (15.4+TREL)"
echo " cmake : Configure and build OpenThread using cmake/ninja (RCP and NCP) only"
echo " cmake-posix: : Configure and build OpenThread POSIX using cmake/ninja"
echo ""
echo "Options:"
echo " -c/--enable-coverage Enable code coverage"
@@ -100,9 +106,9 @@ else
fi
case ${build_config} in
ncp)
ncp | ncp-)
echo "==================================================================================================="
echo "Building OpenThread NCP FTD mode with POSIX platform"
echo "Building OpenThread NCP FTD mode with simulation platform (radios determined by config)"
echo "==================================================================================================="
./bootstrap || die "bootstrap failed"
cd "${top_builddir}" || die "cd failed"
@@ -114,9 +120,57 @@ case ${build_config} in
make -j 8 || die
;;
ncp-15.4)
echo "==================================================================================================="
echo "Building OpenThread NCP FTD mode with simulation platform - 15.4 radio"
echo "==================================================================================================="
cppflags_config='-DOPENTHREAD_PROJECT_CORE_CONFIG_FILE=\"../tests/toranj/openthread-core-toranj-config-simulation.h\"'
cppflags_config="${cppflags_config} -DOPENTHREAD_CONFIG_RADIO_LINK_IEEE_802_15_4_ENABLE=1"
cppflags_config="${cppflags_config} -DOPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE=0"
./bootstrap || die "bootstrap failed"
cd "${top_builddir}" || die "cd failed"
${top_srcdir}/configure \
CPPFLAGS="$cppflags_config" \
--with-examples=simulation \
"${configure_options[@]}" || die
make -j 8 || die
;;
ncp-trel)
echo "==================================================================================================="
echo "Building OpenThread NCP FTD mode with simulation platform - TREL radio"
echo "==================================================================================================="
cppflags_config='-DOPENTHREAD_PROJECT_CORE_CONFIG_FILE=\"../tests/toranj/openthread-core-toranj-config-simulation.h\"'
cppflags_config="${cppflags_config} -DOPENTHREAD_CONFIG_RADIO_LINK_IEEE_802_15_4_ENABLE=0"
cppflags_config="${cppflags_config} -DOPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE=1"
./bootstrap || die "bootstrap failed"
cd "${top_builddir}" || die "cd failed"
${top_srcdir}/configure \
CPPFLAGS="$cppflags_config" \
--with-examples=simulation \
"${configure_options[@]}" || die
make -j 8 || die
;;
ncp-15.4+trel | ncp-trel+15.4)
echo "==================================================================================================="
echo "Building OpenThread NCP FTD mode with simulation platform - multi radio (15.4 + TREL)"
echo "==================================================================================================="
cppflags_config='-DOPENTHREAD_PROJECT_CORE_CONFIG_FILE=\"../tests/toranj/openthread-core-toranj-config-simulation.h\"'
cppflags_config="${cppflags_config} -DOPENTHREAD_CONFIG_RADIO_LINK_IEEE_802_15_4_ENABLE=1"
cppflags_config="${cppflags_config} -DOPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE=1"
./bootstrap || die "bootstrap failed"
cd "${top_builddir}" || die "cd failed"
${top_srcdir}/configure \
CPPFLAGS="$cppflags_config" \
--with-examples=simulation \
"${configure_options[@]}" || die
make -j 8 || die
;;
rcp)
echo "===================================================================================================="
echo "Building OpenThread RCP (NCP in radio mode) with POSIX platform"
echo "Building OpenThread RCP (NCP in radio mode) with simulation platform"
echo "===================================================================================================="
./bootstrap || die "bootstrap failed"
cd "${top_builddir}" || die "cd failed"
@@ -132,13 +186,61 @@ case ${build_config} in
make -j 8 || die
;;
posix | posix-app | posixapp)
posix | posix-)
echo "===================================================================================================="
echo "Building OpenThread POSIX App NCP"
echo "Building OpenThread POSIX (radios determined by config)"
echo "===================================================================================================="
cppflags_config='-DOPENTHREAD_PROJECT_CORE_CONFIG_FILE=\"../tests/toranj/openthread-core-toranj-config-posix.h\"'
./bootstrap || die "bootstrap failed"
cd "${top_builddir}" || die "cd failed"
${top_srcdir}/configure \
CPPFLAGS="$cppflags_config" \
--with-platform=posix \
"${configure_options[@]}" || die
make -j 8 || die
;;
posix-15.4)
echo "===================================================================================================="
echo "Building OpenThread POSIX - 15.4 radio"
echo "===================================================================================================="
cppflags_config='-DOPENTHREAD_PROJECT_CORE_CONFIG_FILE=\"../tests/toranj/openthread-core-toranj-config-posix.h\"'
cppflags_config="${cppflags_config} -DOPENTHREAD_CONFIG_RADIO_LINK_IEEE_802_15_4_ENABLE=1"
cppflags_config="${cppflags_config} -DOPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE=0"
./bootstrap || die "bootstrap failed"
cd "${top_builddir}" || die "cd failed"
${top_srcdir}/configure \
CPPFLAGS="$cppflags_config" \
--with-platform=posix \
"${configure_options[@]}" || die
make -j 8 || die
;;
posix-trel)
echo "===================================================================================================="
echo "Building OpenThread POSIX - TREL radio"
echo "===================================================================================================="
cppflags_config='-DOPENTHREAD_PROJECT_CORE_CONFIG_FILE=\"../tests/toranj/openthread-core-toranj-config-posix.h\"'
cppflags_config="${cppflags_config} -DOPENTHREAD_CONFIG_RADIO_LINK_IEEE_802_15_4_ENABLE=0"
cppflags_config="${cppflags_config} -DOPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE=1"
./bootstrap || die "bootstrap failed"
cd "${top_builddir}" || die "cd failed"
${top_srcdir}/configure \
CPPFLAGS="$cppflags_config" \
--with-platform=posix \
"${configure_options[@]}" || die
make -j 8 || die
;;
posix-trel+15.4 | posix-15.4+trel)
echo "===================================================================================================="
echo "Building OpenThread POSIX - multi radio link (15.4 + TREL)"
echo "===================================================================================================="
cppflags_config='-DOPENTHREAD_PROJECT_CORE_CONFIG_FILE=\"../tests/toranj/openthread-core-toranj-config-posix.h\"'
cppflags_config="${cppflags_config} -DOPENTHREAD_CONFIG_RADIO_LINK_IEEE_802_15_4_ENABLE=1"
cppflags_config="${cppflags_config} -DOPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE=1"
./bootstrap || die "bootstrap failed"
cd "${top_builddir}" || die "cd failed"
${top_srcdir}/configure \
CPPFLAGS="$cppflags_config" \
--with-platform=posix \
@@ -159,7 +261,7 @@ case ${build_config} in
cmake-posix-host | cmake-posix | cmake-p)
echo "===================================================================================================="
echo "Building OpenThread POSIX host platform using cmake"
echo "Building OpenThread POSIX using cmake"
echo "===================================================================================================="
cd "${top_builddir}" || die "cd failed"
cmake -GNinja -DOT_PLATFORM=posix -DOT_COMPILE_WARNING_AS_ERROR=on -DOT_APP_CLI=off \
@@ -462,6 +462,14 @@
*/
#define OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE 1
/**
* @def OPENTHREAD_CONFIG_POSIX_APP_TREL_INTERFACE_NAME
*
* Defines the default interface name used for TREL UDP6 platform.
*
*/
#define OPENTHREAD_CONFIG_POSIX_APP_TREL_INTERFACE_NAME "trel"
#if OPENTHREAD_RADIO
/**
* @def OPENTHREAD_CONFIG_MAC_SOFTWARE_ACK_TIMEOUT_ENABLE
+30 -3
View File
@@ -46,9 +46,25 @@ cleanup()
sudo ip link delete "$interface" >/dev/null 2>&1
done < <(ifconfig 2>/dev/null | grep -o "wpan[0-9]*")
sudo ip address flush trel
sleep 0.3
}
prepare_trel_link()
{
# Prepares a netif "trel" as virtual eth to use for
# testing "TREL" radio link in POSIX platform.
echo "Preparing trel netif"
sudo ip link delete trel
sudo ip link add trel type veth peer name trel-peer || die
sudo ip link set trel multicast on || die
sudo ip link set trel up || die
sudo ip link set trel-peer multicast on || die
sudo ip link set trel-peer up || die
}
run()
{
counter=0
@@ -92,11 +108,15 @@ case $TORANJ_POSIX_RCP_MODEL in
esac
if [ "$use_posix_with_rcp" = "no" ]; then
./build.sh ${coverage_option} ncp || die "ncp build failed"
./build.sh ${coverage_option} ncp-"${TORANJ_RADIO}" || die "ncp build failed"
else
./build.sh ${coverage_option} rcp || die "rcp build failed"
./build.sh ${coverage_option} posix || die "posix build failed"
./build.sh ${coverage_option} posix-"${TORANJ_RADIO}" || die "posix build failed"
if [ "$TORANJ_RADIO" = "trel" ]; then
prepare_trel_link
fi
fi
cleanup
@@ -147,7 +167,14 @@ run test-043-meshcop-joiner-router.py
run test-100-mcu-power-state.py
run test-600-channel-manager-properties.py
run test-601-channel-manager-channel-change.py
run test-602-channel-manager-channel-select.py
# Skip the "channel-select" test on a TREL only radio link, since it
# requires energy scan which is not supported in this case.
if [ "$TORANJ_RADIO" != "trel" ]; then
run test-602-channel-manager-channel-select.py
fi
run test-603-channel-manager-announce-recovery.py
exit 0