From 136bdb6e2a61b1545a47ac85d0ccdaf7a6f69a6e Mon Sep 17 00:00:00 2001 From: Jonathan Hui Date: Mon, 1 Jun 2026 15:16:19 -0700 Subject: [PATCH] [dua] remove OPENTHREAD_CONFIG_DUA_ENABLE build feature (#13165) This commit completely removes the local Domain Unicast Address (DUA) registration feature flag (OPENTHREAD_CONFIG_DUA_ENABLE) and all of its associated implementation, public APIs, CLI commands, Spinel property handlers, and certification tests. Thread 1.2 FTD Border Router/Router DUA proxying features for MTD children (OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE) are preserved and updated to only compile/instantiate components when proxy DUA features are active. Detailed Changes: - Remove default definition of OPENTHREAD_CONFIG_DUA_ENABLE from misc.h. - Remove OT_DUA and openthread_config_dua_enable from CMake/GN configs. - Remove otThreadSetFixedDuaInterfaceIdentifier and otThreadGetFixedDuaInterfaceIdentifier from include/openthread/thread.h and implementation src/core/api/thread_api.cpp. - Remove CLI DUA interpreter from src/cli/cli.cpp. - Remove SPINEL_CAP_DUA capability and SPINEL_PROP_THREAD_DUA_ID Spinel property handlers and dispatchers from NCP. - Strip local DUA management features (conflict checking, SLAAC DUA interface identifiers, and dad info settings) from DuaManager, MLE, Address Resolver, and settings. - Clean up Notifier, TimeTicker, and TMF dispatcher guards. - Clean up -DOT_DUA=ON compilation flags across build/test scripts. - Delete obsolete DUA certification tests: - v1_2_test_domain_unicast_address - v1_2_test_domain_unicast_address_registration - v1_2_test_dua_handle_address_error --- etc/cmake/options.cmake | 1 - etc/gn/openthread.gni | 3 - .../config/ot-core-config-check-size-br.h | 1 - .../config/ot-core-config-check-size-ftd.h | 1 - .../config/ot-core-config-check-size-mtd.h | 1 - include/openthread/instance.h | 2 +- include/openthread/thread.h | 32 -- script/check-arm-build | 1 - script/check-simulation-build-cmake | 10 +- script/make-pretty | 1 - script/test | 3 - src/cli/cli.cpp | 67 ---- src/core/BUILD.gn | 4 - src/core/api/thread_api.cpp | 31 -- src/core/backbone_router/bbr_leader.cpp | 4 +- src/core/common/notifier.cpp | 2 +- src/core/common/settings.cpp | 15 +- src/core/common/settings.hpp | 40 -- src/core/common/time_ticker.cpp | 2 +- src/core/config/misc.h | 9 - src/core/instance/instance.cpp | 2 +- src/core/instance/instance.hpp | 4 +- src/core/thread/address_resolver.cpp | 12 +- src/core/thread/dua_manager.cpp | 339 +--------------- src/core/thread/dua_manager.hpp | 98 +---- src/core/thread/mle.cpp | 19 - src/core/thread/tmf.cpp | 2 +- src/ncp/ncp_base.cpp | 4 - src/ncp/ncp_base_dispatcher.cpp | 6 - src/ncp/ncp_base_ftd.cpp | 47 --- .../v1_2_test_domain_unicast_address.py | 320 --------------- ...est_domain_unicast_address_registration.py | 370 ------------------ .../v1_2_test_dua_handle_address_error.py | 148 ------- tools/harness-simulation/posix/config.yml | 4 - tools/otci/otci/otci.py | 17 - tools/otci/tests/test_otci.py | 4 - 36 files changed, 25 insertions(+), 1601 deletions(-) delete mode 100755 tests/scripts/thread-cert/v1_2_test_domain_unicast_address.py delete mode 100755 tests/scripts/thread-cert/v1_2_test_domain_unicast_address_registration.py delete mode 100755 tests/scripts/thread-cert/v1_2_test_dua_handle_address_error.py diff --git a/etc/cmake/options.cmake b/etc/cmake/options.cmake index a1efeb6a4..343ce8a6f 100644 --- a/etc/cmake/options.cmake +++ b/etc/cmake/options.cmake @@ -210,7 +210,6 @@ ot_option(OT_DNS_DSO OPENTHREAD_CONFIG_DNS_DSO_ENABLE "DNS Stateful Operations ( ot_option(OT_DNS_UPSTREAM_QUERY OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_ENABLE "Allow sending DNS queries to upstream") ot_option(OT_DNSSD_DISCOVERY_PROXY OPENTHREAD_CONFIG_DNSSD_DISCOVERY_PROXY_ENABLE "DNS-SD discovery proxy") ot_option(OT_DNSSD_SERVER OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE "DNS-SD server") -ot_option(OT_DUA OPENTHREAD_CONFIG_DUA_ENABLE "Domain Unicast Address (DUA)") ot_option(OT_DYNAMIC_STORE_FRAME_AHEAD_COUNTER OPENTHREAD_CONFIG_DYNAMIC_STORE_FRAME_AHEAD_COUNTER_ENABLE "dynamic store frame ahead counter") ot_option(OT_ECDSA OPENTHREAD_CONFIG_ECDSA_ENABLE "ECDSA") ot_option(OT_EXTERNAL_HEAP OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE "external heap") diff --git a/etc/gn/openthread.gni b/etc/gn/openthread.gni index 72a090ec6..5c348dc45 100644 --- a/etc/gn/openthread.gni +++ b/etc/gn/openthread.gni @@ -138,9 +138,6 @@ if (openthread_enable_core_config_args) { # Enable ECDSA support openthread_config_ecdsa_enable = false - # Enable Domain Unicast Address feature for Thread 1.2 - openthread_config_dua_enable = false - # Enable Multicast Listener Registration feature for Thread 1.2 openthread_config_mlr_enable = false diff --git a/examples/config/ot-core-config-check-size-br.h b/examples/config/ot-core-config-check-size-br.h index 81536face..14e92b464 100644 --- a/examples/config/ot-core-config-check-size-br.h +++ b/examples/config/ot-core-config-check-size-br.h @@ -60,7 +60,6 @@ #define OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE 1 #define OPENTHREAD_CONFIG_DNS_DSO_ENABLE 1 #define OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_ENABLE 1 -#define OPENTHREAD_CONFIG_DUA_ENABLE 1 #define OPENTHREAD_CONFIG_ECDSA_ENABLE 1 #define OPENTHREAD_CONFIG_HISTORY_TRACKER_ENABLE 1 #define OPENTHREAD_CONFIG_IP6_BR_COUNTERS_ENABLE 1 diff --git a/examples/config/ot-core-config-check-size-ftd.h b/examples/config/ot-core-config-check-size-ftd.h index 2b4bd4a5d..efca41a80 100644 --- a/examples/config/ot-core-config-check-size-ftd.h +++ b/examples/config/ot-core-config-check-size-ftd.h @@ -59,7 +59,6 @@ #define OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE 1 #define OPENTHREAD_CONFIG_DNS_DSO_ENABLE 0 #define OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_ENABLE 0 -#define OPENTHREAD_CONFIG_DUA_ENABLE 1 #define OPENTHREAD_CONFIG_ECDSA_ENABLE 1 #define OPENTHREAD_CONFIG_HISTORY_TRACKER_ENABLE 0 #define OPENTHREAD_CONFIG_IP6_BR_COUNTERS_ENABLE 0 diff --git a/examples/config/ot-core-config-check-size-mtd.h b/examples/config/ot-core-config-check-size-mtd.h index c33998925..f626bd6ef 100644 --- a/examples/config/ot-core-config-check-size-mtd.h +++ b/examples/config/ot-core-config-check-size-mtd.h @@ -59,7 +59,6 @@ #define OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE 1 #define OPENTHREAD_CONFIG_DNS_DSO_ENABLE 0 #define OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_ENABLE 0 -#define OPENTHREAD_CONFIG_DUA_ENABLE 1 #define OPENTHREAD_CONFIG_ECDSA_ENABLE 1 #define OPENTHREAD_CONFIG_HISTORY_TRACKER_ENABLE 0 #define OPENTHREAD_CONFIG_IP6_BR_COUNTERS_ENABLE 0 diff --git a/include/openthread/instance.h b/include/openthread/instance.h index 5c8baaedc..a13ba8374 100644 --- a/include/openthread/instance.h +++ b/include/openthread/instance.h @@ -52,7 +52,7 @@ extern "C" { * * @note This number versions both OpenThread platform and user APIs. */ -#define OPENTHREAD_API_VERSION (601) +#define OPENTHREAD_API_VERSION (602) /** * @addtogroup api-instance diff --git a/include/openthread/thread.h b/include/openthread/thread.h index d7ec09b18..de5b1373a 100644 --- a/include/openthread/thread.h +++ b/include/openthread/thread.h @@ -628,38 +628,6 @@ const char *otThreadGetDomainName(otInstance *aInstance); */ otError otThreadSetDomainName(otInstance *aInstance, const char *aDomainName); -/** - * Sets or clears the Interface Identifier manually specified for the Thread Domain Unicast Address. - * - * Available when `OPENTHREAD_CONFIG_DUA_ENABLE` is enabled. - * - * @note Only available since Thread 1.2. - * - * @param[in] aInstance A pointer to an OpenThread instance. - * @param[in] aIid A pointer to the Interface Identifier to set or NULL to clear. - * - * @retval OT_ERROR_NONE Successfully set/cleared the Interface Identifier. - * @retval OT_ERROR_INVALID_ARGS The specified Interface Identifier is reserved. - * - * @sa otThreadGetFixedDuaInterfaceIdentifier - */ -otError otThreadSetFixedDuaInterfaceIdentifier(otInstance *aInstance, const otIp6InterfaceIdentifier *aIid); - -/** - * Gets the Interface Identifier manually specified for the Thread Domain Unicast Address. - * - * Available when `OPENTHREAD_CONFIG_DUA_ENABLE` is enabled. - * - * @note Only available since Thread 1.2. - * - * @param[in] aInstance A pointer to an OpenThread instance. - * - * @returns A pointer to the Interface Identifier which was set manually, or NULL if none was set. - * - * @sa otThreadSetFixedDuaInterfaceIdentifier - */ -const otIp6InterfaceIdentifier *otThreadGetFixedDuaInterfaceIdentifier(otInstance *aInstance); - /** * Gets the thrKeySequenceCounter. * diff --git a/script/check-arm-build b/script/check-arm-build index 4806d5afc..a9de9c9fb 100755 --- a/script/check-arm-build +++ b/script/check-arm-build @@ -54,7 +54,6 @@ build_nrf52840() "-DOT_DIAGNOSTIC=ON" "-DOT_DNSSD_SERVER=ON" "-DOT_DNS_CLIENT=ON" - "-DOT_DUA=ON" "-DOT_ECDSA=ON" "-DOT_FULL_LOGS=ON" "-DOT_JAM_DETECTION=ON" diff --git a/script/check-simulation-build-cmake b/script/check-simulation-build-cmake index c650f037d..c437519f2 100755 --- a/script/check-simulation-build-cmake +++ b/script/check-simulation-build-cmake @@ -158,23 +158,23 @@ build_all_features() # Build Thread 1.4 with full features reset_source CFLAGS="${cppflags[*]} ${CFLAGS}" CXXFLAGS="${cppflags[*]} ${CXXFLAGS}" \ - "$(dirname "$0")"/cmake-build simulation "${options[@]}" -DOT_DUA=ON + "$(dirname "$0")"/cmake-build simulation "${options[@]}" # Build Thread 1.4 with external heap and msg pool using heap reset_source CFLAGS="${cppflags[*]} ${CFLAGS} -DOPENTHREAD_CONFIG_MESSAGE_USE_HEAP_ENABLE=1" \ CXXFLAGS="${cppflags[*]} ${CXXFLAGS} -DOPENTHREAD_CONFIG_MESSAGE_USE_HEAP_ENABLE=1" \ - "$(dirname "$0")"/cmake-build simulation "${options[@]}" -DOT_DUA=ON + "$(dirname "$0")"/cmake-build simulation "${options[@]}" # Build Thread 1.4 with full features and no log reset_source CFLAGS="${cppflags[*]} ${CFLAGS}" CXXFLAGS="${cppflags[*]} ${CXXFLAGS}" \ - "$(dirname "$0")"/cmake-build simulation "${options[@]}" -DOT_DUA=ON -DOT_LOG_OUTPUT=NONE + "$(dirname "$0")"/cmake-build simulation "${options[@]}" -DOT_LOG_OUTPUT=NONE # Build Thread 1.4 with full features and full logs reset_source CFLAGS="${cppflags[*]} ${CFLAGS}" CXXFLAGS="${cppflags[*]} ${CXXFLAGS}" \ - "$(dirname "$0")"/cmake-build simulation "${options[@]}" -DOT_DUA=ON -DOT_FULL_LOGS=ON + "$(dirname "$0")"/cmake-build simulation "${options[@]}" -DOT_FULL_LOGS=ON # Build with Vendor Extension reset_source @@ -188,7 +188,7 @@ build_all_features() # Build Thread 1.4 with full features and OT_ASSERT=OFF reset_source - "$(dirname "$0")"/cmake-build simulation "${options[@]}" -DOT_DUA=ON -DOT_ASSERT=OFF + "$(dirname "$0")"/cmake-build simulation "${options[@]}" -DOT_ASSERT=OFF # Build with RAM settings reset_source diff --git a/script/make-pretty b/script/make-pretty index c4a61d2f9..cf20bb47b 100755 --- a/script/make-pretty +++ b/script/make-pretty @@ -112,7 +112,6 @@ OT_CLANG_TIDY_BUILD_OPTS=( '-DOT_DNS_UPSTREAM_QUERY=ON' "-DOT_DNSSD_DISCOVERY_PROXY=ON" '-DOT_DNSSD_SERVER=ON' - '-DOT_DUA=ON' '-DOT_MLR=ON' '-DOT_ECDSA=ON' '-DOT_HISTORY_TRACKER=ON' diff --git a/script/test b/script/test index 8adf3023e..1805f43a5 100755 --- a/script/test +++ b/script/test @@ -125,7 +125,6 @@ build_simulation() fi if [[ ${version} != "1.1" ]]; then - options+=("-DOT_DUA=ON") options+=("-DOT_MLR=ON") fi @@ -184,7 +183,6 @@ build_posix() ) if [[ ${version} != "1.1" ]]; then - options+=("-DOT_DUA=ON") options+=("-DOT_MLR=ON") options+=("-DOT_LINK_METRICS_INITIATOR=ON") options+=("-DOT_LINK_METRICS_SUBJECT=ON") @@ -346,7 +344,6 @@ do_build_otbr_docker() "-DOT_ANYCAST_LOCATOR=ON" "-DOT_COVERAGE=ON" "-DOT_DNS_CLIENT=ON" - "-DOT_DUA=ON" "-DOT_MLR=ON" "-DOT_NETDATA_PUBLISHER=ON" "-DOT_SLAAC=ON" diff --git a/src/cli/cli.cpp b/src/cli/cli.cpp index 3d8e4d5a2..f6c0dc9e4 100644 --- a/src/cli/cli.cpp +++ b/src/cli/cli.cpp @@ -1102,70 +1102,6 @@ template <> otError Interpreter::Process(Arg aArgs[]) return ProcessGetSet(aArgs, otThreadGetDomainName, otThreadSetDomainName); } -#if OPENTHREAD_CONFIG_DUA_ENABLE -template <> otError Interpreter::Process(Arg aArgs[]) -{ - otError error = OT_ERROR_NONE; - - /** - * @cli dua iid - * @code - * dua iid - * 0004000300020001 - * Done - * @endcode - * @par api_copy - * #otThreadGetFixedDuaInterfaceIdentifier - */ - if (aArgs[0] == "iid") - { - if (aArgs[1].IsEmpty()) - { - const otIp6InterfaceIdentifier *iid = otThreadGetFixedDuaInterfaceIdentifier(GetInstancePtr()); - - if (iid != nullptr) - { - OutputBytesLine(iid->mFields.m8); - } - } - /** - * @cli dua iid (set,clear) - * @code - * dua iid 0004000300020001 - * Done - * @endcode - * @code - * dua iid clear - * Done - * @endcode - * @cparam dua iid @ca{iid|clear} - * `dua iid clear` passes a `nullptr` to #otThreadSetFixedDuaInterfaceIdentifier. - * Otherwise, you can pass the `iid`. - * @par api_copy - * #otThreadSetFixedDuaInterfaceIdentifier - */ - else if (aArgs[1] == "clear") - { - error = otThreadSetFixedDuaInterfaceIdentifier(GetInstancePtr(), nullptr); - } - else - { - otIp6InterfaceIdentifier iid; - - SuccessOrExit(error = aArgs[1].ParseAsHexString(iid.mFields.m8)); - error = otThreadSetFixedDuaInterfaceIdentifier(GetInstancePtr(), &iid); - } - } - else - { - error = OT_ERROR_INVALID_COMMAND; - } - -exit: - return error; -} -#endif // OPENTHREAD_CONFIG_DUA_ENABLE - #endif // (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2) /** @@ -8671,9 +8607,6 @@ otError Interpreter::ProcessCommand(Arg aArgs[]) #if (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2) CmdEntry("domainname"), #endif -#if OPENTHREAD_CONFIG_DUA_ENABLE - CmdEntry("dua"), -#endif #if OPENTHREAD_FTD CmdEntry("eidcache"), #endif diff --git a/src/core/BUILD.gn b/src/core/BUILD.gn index 79c96c21e..27f54c2a2 100644 --- a/src/core/BUILD.gn +++ b/src/core/BUILD.gn @@ -103,10 +103,6 @@ if (openthread_enable_core_config_args) { macro = "OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE" value = openthread_config_dns_client_enable }, - { - macro = "OPENTHREAD_CONFIG_DUA_ENABLE" - value = openthread_config_dua_enable - }, { macro = "OPENTHREAD_CONFIG_ECDSA_ENABLE" value = openthread_config_ecdsa_enable diff --git a/src/core/api/thread_api.cpp b/src/core/api/thread_api.cpp index 04656bcc5..ac1c9a40f 100644 --- a/src/core/api/thread_api.cpp +++ b/src/core/api/thread_api.cpp @@ -238,37 +238,6 @@ exit: return error; } -#if OPENTHREAD_CONFIG_DUA_ENABLE -otError otThreadSetFixedDuaInterfaceIdentifier(otInstance *aInstance, const otIp6InterfaceIdentifier *aIid) -{ - Error error = kErrorNone; - - if (aIid) - { - error = AsCoreType(aInstance).Get().SetFixedDuaInterfaceIdentifier(AsCoreType(aIid)); - } - else - { - AsCoreType(aInstance).Get().ClearFixedDuaInterfaceIdentifier(); - } - - return error; -} - -const otIp6InterfaceIdentifier *otThreadGetFixedDuaInterfaceIdentifier(otInstance *aInstance) -{ - Instance &instance = AsCoreType(aInstance); - const otIp6InterfaceIdentifier *iid = nullptr; - - if (instance.Get().IsFixedDuaInterfaceIdentifierSet()) - { - iid = &instance.Get().GetFixedDuaInterfaceIdentifier(); - } - - return iid; -} -#endif // OPENTHREAD_CONFIG_DUA_ENABLE - #endif // (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2) uint32_t otThreadGetKeySequenceCounter(otInstance *aInstance) diff --git a/src/core/backbone_router/bbr_leader.cpp b/src/core/backbone_router/bbr_leader.cpp index fb79b2e2d..18fd694cc 100644 --- a/src/core/backbone_router/bbr_leader.cpp +++ b/src/core/backbone_router/bbr_leader.cpp @@ -208,7 +208,7 @@ void Leader::UpdateBackboneRouterPrimary(void) Get().HandleBackboneRouterPrimaryUpdate(event); #endif -#if OPENTHREAD_CONFIG_DUA_ENABLE || (OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE) +#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE Get().HandleBackboneRouterPrimaryUpdate(event); #endif @@ -253,7 +253,7 @@ void Leader::UpdateDomainPrefixConfig(void) Get().HandleDomainPrefixUpdate(event); #endif -#if OPENTHREAD_CONFIG_DUA_ENABLE || (OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE) +#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE Get().HandleDomainPrefixUpdate(event); #endif diff --git a/src/core/common/notifier.cpp b/src/core/common/notifier.cpp index eb7315bf7..52f79f2d5 100644 --- a/src/core/common/notifier.cpp +++ b/src/core/common/notifier.cpp @@ -143,7 +143,7 @@ void Notifier::EmitEvents(void) #if OPENTHREAD_CONFIG_MLR_ENABLE || (OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_MLR_ENABLE) Get().HandleNotifierEvents(events); #endif -#if OPENTHREAD_CONFIG_DUA_ENABLE || (OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE) +#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE Get().HandleNotifierEvents(events); #endif #if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE diff --git a/src/core/common/settings.cpp b/src/core/common/settings.cpp index 45764fcf5..e072037e1 100644 --- a/src/core/common/settings.cpp +++ b/src/core/common/settings.cpp @@ -71,13 +71,6 @@ void SettingsBase::ChildInfo::Log(Action aAction) const } #endif -#if OPENTHREAD_CONFIG_DUA_ENABLE -void SettingsBase::DadInfo::Log(Action aAction) const -{ - LogInfo("%s DadInfo {DadCounter:%2d}", ActionToString(aAction), GetDadCounter()); -} -#endif - #if OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE void SettingsBase::LogPrefix(Action aAction, Key aKey, const Ip6::Prefix &aPrefix) { @@ -151,7 +144,7 @@ const char *SettingsBase::KeyToString(Key aKey) _(kKeyChildInfo, "ChildInfo") \ _(6, "") \ _(kKeySlaacIidSecretKey, "SlaacIidSecretKey") \ - _(kKeyDadInfo, "DadInfo") \ + _(8, "") \ _(9, "") \ _(10, "") \ _(kKeySrpEcdsaKey, "SrpEcdsaKey") \ @@ -487,12 +480,6 @@ void Settings::Log(Action aAction, Error aError, Key aKey, const void *aValue) break; #endif -#if OPENTHREAD_CONFIG_DUA_ENABLE - case kKeyDadInfo: - reinterpret_cast(aValue)->Log(aAction); - break; -#endif - #if OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE case kKeyBrUlaPrefix: LogPrefix(aAction, aKey, *reinterpret_cast(aValue)); diff --git a/src/core/common/settings.hpp b/src/core/common/settings.hpp index 448683a41..7ce35cb17 100644 --- a/src/core/common/settings.hpp +++ b/src/core/common/settings.hpp @@ -112,7 +112,6 @@ public: kKeyParentInfo = OT_SETTINGS_KEY_PARENT_INFO, kKeyChildInfo = OT_SETTINGS_KEY_CHILD_INFO, kKeySlaacIidSecretKey = OT_SETTINGS_KEY_SLAAC_IID_SECRET_KEY, - kKeyDadInfo = OT_SETTINGS_KEY_DAD_INFO, kKeySrpEcdsaKey = OT_SETTINGS_KEY_SRP_ECDSA_KEY, kKeySrpClientInfo = OT_SETTINGS_KEY_SRP_CLIENT_INFO, kKeySrpServerInfo = OT_SETTINGS_KEY_SRP_SERVER_INFO, @@ -486,45 +485,6 @@ public: }; #endif -#if OPENTHREAD_CONFIG_DUA_ENABLE - /** - * Represents the duplicate address detection information for settings storage. - */ - OT_TOOL_PACKED_BEGIN - class DadInfo : private Clearable - { - friend class Settings; - friend class Clearable; - - public: - static constexpr Key kKey = kKeyDadInfo; ///< The associated key. - - /** - * Initializes the `DadInfo` object. - */ - void Init(void) { Clear(); } - - /** - * Returns the Dad Counter. - * - * @returns The Dad Counter value. - */ - uint8_t GetDadCounter(void) const { return mDadCounter; } - - /** - * Sets the Dad Counter. - * - * @param[in] aDadCounter The Dad Counter value. - */ - void SetDadCounter(uint8_t aDadCounter) { mDadCounter = aDadCounter; } - - private: - void Log(Action aAction) const; - - uint8_t mDadCounter; ///< Dad Counter used to resolve address conflict in Thread 1.2 DUA feature. - } OT_TOOL_PACKED_END; -#endif // OPENTHREAD_CONFIG_DUA_ENABLE - #if OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE /** * Defines constants and types for BR ULA prefix settings. diff --git a/src/core/common/time_ticker.cpp b/src/core/common/time_ticker.cpp index 0723a931b..a214e90b8 100644 --- a/src/core/common/time_ticker.cpp +++ b/src/core/common/time_ticker.cpp @@ -104,7 +104,7 @@ void TimeTicker::HandleTimer(void) } #endif -#if OPENTHREAD_CONFIG_DUA_ENABLE || (OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE) +#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE if (mReceivers & Mask(kDuaManager)) { Get().HandleTimeTick(); diff --git a/src/core/config/misc.h b/src/core/config/misc.h index f83e63cb4..d7d90814b 100644 --- a/src/core/config/misc.h +++ b/src/core/config/misc.h @@ -524,15 +524,6 @@ #define OPENTHREAD_CONFIG_OTNS_ENABLE 0 #endif -/** - * @def OPENTHREAD_CONFIG_DUA_ENABLE - * - * Define as 1 to support Thread 1.2 Domain Unicast Address feature. - */ -#ifndef OPENTHREAD_CONFIG_DUA_ENABLE -#define OPENTHREAD_CONFIG_DUA_ENABLE 0 -#endif - /** * @def OPENTHREAD_CONFIG_MLR_ENABLE * diff --git a/src/core/instance/instance.cpp b/src/core/instance/instance.cpp index cbb79fca5..0e271ea55 100644 --- a/src/core/instance/instance.cpp +++ b/src/core/instance/instance.cpp @@ -216,7 +216,7 @@ Instance::Instance(void) , mMlrManager(*this) #endif -#if OPENTHREAD_CONFIG_DUA_ENABLE || (OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE) +#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE , mDuaManager(*this) #endif #if OPENTHREAD_CONFIG_SRP_SERVER_ENABLE diff --git a/src/core/instance/instance.hpp b/src/core/instance/instance.hpp index 6143760a4..2846f4181 100644 --- a/src/core/instance/instance.hpp +++ b/src/core/instance/instance.hpp @@ -769,7 +769,7 @@ private: Mlr::Manager mMlrManager; #endif -#if OPENTHREAD_CONFIG_DUA_ENABLE || (OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE) +#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE DuaManager mDuaManager; #endif @@ -1252,7 +1252,7 @@ template <> inline BackboneRouter::BackboneTmfAgent &Instance::Get(void) template <> inline Mlr::Manager &Instance::Get(void) { return mMlrManager; } #endif -#if OPENTHREAD_CONFIG_DUA_ENABLE || (OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE) +#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE template <> inline DuaManager &Instance::Get(void) { return mDuaManager; } #endif diff --git a/src/core/thread/address_resolver.cpp b/src/core/thread/address_resolver.cpp index a816d4388..8cc391115 100644 --- a/src/core/thread/address_resolver.cpp +++ b/src/core/thread/address_resolver.cpp @@ -754,17 +754,7 @@ template <> void AddressResolver::HandleTmf(Coap::Msg &aMsg) if (address.GetAddress() == target && Get().GetMeshLocalEid().GetIid() != meshLocalIid) { // Target EID matches address and Mesh Local EID differs -#if OPENTHREAD_CONFIG_DUA_ENABLE - if (Get().IsDomainUnicast(address.GetAddress())) - { - Get().NotifyDuplicateDomainUnicastAddress(); - } - else -#endif - { - Get().RemoveUnicastAddress(address); - } - + Get().RemoveUnicastAddress(address); ExitNow(); } } diff --git a/src/core/thread/dua_manager.cpp b/src/core/thread/dua_manager.cpp index 8c28f8526..e67bc7ece 100644 --- a/src/core/thread/dua_manager.cpp +++ b/src/core/thread/dua_manager.cpp @@ -33,7 +33,7 @@ #include "dua_manager.hpp" -#if OPENTHREAD_CONFIG_DUA_ENABLE || (OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE) +#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE #include "instance/instance.hpp" @@ -45,22 +45,12 @@ DuaManager::DuaManager(Instance &aInstance) : InstanceLocator(aInstance) , mRegistrationTask(aInstance) , mIsDuaPending(false) -#if OPENTHREAD_CONFIG_DUA_ENABLE - , mDuaState(kNotExist) - , mDadCounter(0) - , mLastRegistrationTime(0) -#endif #if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE , mChildIndexDuaRegistering(Mle::kMaxChildren) #endif { mDelay.mValue = 0; -#if OPENTHREAD_CONFIG_DUA_ENABLE - mDomainUnicastAddress.InitAsThreadOriginGlobalScope(); - mFixedDuaInterfaceIdentifier.Clear(); -#endif - #if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE mChildDuaMask.Clear(); mChildDuaRegisteredMask.Clear(); @@ -76,183 +66,14 @@ void DuaManager::HandleDomainPrefixUpdate(BackboneRouter::DomainPrefixEvent aEve IgnoreError(Get().AbortTransaction(HandleDuaResponse, this)); } -#if OPENTHREAD_CONFIG_DUA_ENABLE - RemoveDomainUnicastAddress(); -#endif - -#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE if (!mChildDuaMask.IsEmpty()) { mChildDuaMask.Clear(); mChildDuaRegisteredMask.Clear(); } -#endif - } - -#if OPENTHREAD_CONFIG_DUA_ENABLE - switch (aEvent) - { - case BackboneRouter::kDomainPrefixRefreshed: - case BackboneRouter::kDomainPrefixAdded: - { - const Ip6::Prefix *prefix = Get().GetDomainPrefix(); - OT_ASSERT(prefix != nullptr); - mDomainUnicastAddress.mPrefixLength = prefix->GetLength(); - mDomainUnicastAddress.GetAddress().Clear(); - mDomainUnicastAddress.GetAddress().SetPrefix(*prefix); - } - break; - - case BackboneRouter::kDomainPrefixRemoved: - ExitNow(); - } - - // Apply cached DUA Interface Identifier manually specified. - if (IsFixedDuaInterfaceIdentifierSet()) - { - mDomainUnicastAddress.GetAddress().SetIid(mFixedDuaInterfaceIdentifier); - } - else - { - SuccessOrExit(GenerateDomainUnicastAddressIid()); - } - - AddDomainUnicastAddress(); - -exit: - return; -#endif -} - -#if OPENTHREAD_CONFIG_DUA_ENABLE -Error DuaManager::GenerateDomainUnicastAddressIid(void) -{ - Error error; - uint8_t dadCounter = mDadCounter; - - if ((error = Get().GenerateIid(mDomainUnicastAddress, dadCounter)) == kErrorNone) - { - if (dadCounter != mDadCounter) - { - mDadCounter = dadCounter; - Store(); - } - - LogInfo("Generated DUA: %s", mDomainUnicastAddress.GetAddress().ToString().AsCString()); - } - else - { - LogWarnOnError(error, "generate DUA"); - } - - return error; -} - -Error DuaManager::SetFixedDuaInterfaceIdentifier(const Ip6::InterfaceIdentifier &aIid) -{ - Error error = kErrorNone; - - VerifyOrExit(!aIid.IsReserved(), error = kErrorInvalidArgs); - VerifyOrExit(mFixedDuaInterfaceIdentifier.IsUnspecified() || mFixedDuaInterfaceIdentifier != aIid); - - mFixedDuaInterfaceIdentifier = aIid; - LogInfo("Set DUA IID: %s", mFixedDuaInterfaceIdentifier.ToString().AsCString()); - - if (Get().HasUnicastAddress(GetDomainUnicastAddress())) - { - RemoveDomainUnicastAddress(); - mDomainUnicastAddress.GetAddress().SetIid(mFixedDuaInterfaceIdentifier); - AddDomainUnicastAddress(); - } - -exit: - return error; -} - -void DuaManager::ClearFixedDuaInterfaceIdentifier(void) -{ - // Nothing to clear. - VerifyOrExit(IsFixedDuaInterfaceIdentifierSet()); - - if (GetDomainUnicastAddress().GetIid() == mFixedDuaInterfaceIdentifier && - Get().HasUnicastAddress(GetDomainUnicastAddress())) - { - RemoveDomainUnicastAddress(); - - if (GenerateDomainUnicastAddressIid() == kErrorNone) - { - AddDomainUnicastAddress(); - } - } - - LogInfo("Cleared DUA IID: %s", mFixedDuaInterfaceIdentifier.ToString().AsCString()); - mFixedDuaInterfaceIdentifier.Clear(); - -exit: - return; -} - -void DuaManager::Restore(void) -{ - Settings::DadInfo dadInfo; - - SuccessOrExit(Get().Read(dadInfo)); - mDadCounter = dadInfo.GetDadCounter(); - -exit: - return; -} - -void DuaManager::Store(void) -{ - Settings::DadInfo dadInfo; - - dadInfo.SetDadCounter(mDadCounter); - Get().Save(dadInfo); -} - -void DuaManager::AddDomainUnicastAddress(void) -{ - mDuaState = kToRegister; - mLastRegistrationTime = TimerMilli::GetNow(); - Get().AddUnicastAddress(mDomainUnicastAddress); -} - -void DuaManager::RemoveDomainUnicastAddress(void) -{ - if (mDuaState == kRegistering && mIsDuaPending) - { - IgnoreError(Get().AbortTransaction(HandleDuaResponse, this)); - } - - mDuaState = kNotExist; - mDomainUnicastAddress.mPreferred = false; - Get().RemoveUnicastAddress(mDomainUnicastAddress); -} - -void DuaManager::UpdateRegistrationDelay(uint8_t aDelay) -{ - if (mDelay.mFields.mRegistrationDelay == 0 || mDelay.mFields.mRegistrationDelay > aDelay) - { - mDelay.mFields.mRegistrationDelay = aDelay; - - LogDebg("update regdelay %d", mDelay.mFields.mRegistrationDelay); - UpdateTimeTickerRegistration(); } } -void DuaManager::NotifyDuplicateDomainUnicastAddress(void) -{ - RemoveDomainUnicastAddress(); - mDadCounter++; - - if (GenerateDomainUnicastAddressIid() == kErrorNone) - { - AddDomainUnicastAddress(); - } -} -#endif // OPENTHREAD_CONFIG_DUA_ENABLE - void DuaManager::UpdateReregistrationDelay(void) { uint16_t delay; @@ -285,20 +106,6 @@ void DuaManager::UpdateCheckDelay(uint8_t aDelay) void DuaManager::HandleNotifierEvents(Events aEvents) { -#if OPENTHREAD_CONFIG_DUA_ENABLE - if (aEvents.Contains(kEventThreadNetdataChanged) && Get().HasUnicastAddress(GetDomainUnicastAddress())) - { - Lowpan::Context context; - - Get().FindContextForAddress(GetDomainUnicastAddress(), context); - - if (!context.IsValid()) - { - RemoveDomainUnicastAddress(); - } - } -#endif - VerifyOrExit(Get().IsAttached(), mDelay.mValue = 0); if (aEvents.Contains(kEventThreadRoleChanged)) @@ -307,27 +114,8 @@ void DuaManager::HandleNotifierEvents(Events aEvents) { UpdateReregistrationDelay(); } -#if OPENTHREAD_CONFIG_DUA_ENABLE && OPENTHREAD_FTD - else if (Get().IsRouter()) - { - // Wait for link establishment with neighboring routers. - UpdateRegistrationDelay(kNewRouterRegistrationDelay); - } - else if (Get().WillBecomeRouterSoon()) - { - // Will check again in case the device decides to stay REED when jitter timeout expires. - UpdateRegistrationDelay(Get().GetRouterRoleTransitionTimeout() + kNewRouterRegistrationDelay + 1); - } -#endif } -#if OPENTHREAD_CONFIG_DUA_ENABLE - if (aEvents.ContainsAny(kEventIp6AddressAdded)) - { - UpdateRegistrationDelay(kNewDuaRegistrationDelay); - } -#endif - exit: return; } @@ -336,12 +124,7 @@ void DuaManager::HandleBackboneRouterPrimaryUpdate(BackboneRouter::PrimaryEvent { if (aEvent == BackboneRouter::kPrimaryAdded || aEvent == BackboneRouter::kPrimaryUpdatedReregister) { -#if OPENTHREAD_CONFIG_DUA_ENABLE - if (Get().IsFullThreadDevice() || Get().GetParent().IsThreadVersion1p1()) -#endif - { - UpdateReregistrationDelay(); - } + UpdateReregistrationDelay(); } } @@ -349,23 +132,7 @@ void DuaManager::HandleTimeTick(void) { bool attempt = false; -#if OPENTHREAD_CONFIG_DUA_ENABLE - LogDebg("regdelay %d, reregdelay %d, checkdelay %d", mDelay.mFields.mRegistrationDelay, - mDelay.mFields.mReregistrationDelay, mDelay.mFields.mCheckDelay); - - if ((mDuaState != kNotExist) && - (TimerMilli::GetNow() > (mLastRegistrationTime + TimeMilli::SecToMsec(kDuaDadPeriod)))) - { - mDomainUnicastAddress.mPreferred = true; - } - - if ((mDelay.mFields.mRegistrationDelay > 0) && (--mDelay.mFields.mRegistrationDelay == 0)) - { - attempt = true; - } -#else LogDebg("reregdelay %d, checkdelay %d", mDelay.mFields.mReregistrationDelay, mDelay.mFields.mCheckDelay); -#endif if ((mDelay.mFields.mCheckDelay > 0) && (--mDelay.mFields.mCheckDelay == 0)) { @@ -374,13 +141,6 @@ void DuaManager::HandleTimeTick(void) if ((mDelay.mFields.mReregistrationDelay > 0) && (--mDelay.mFields.mReregistrationDelay == 0)) { -#if OPENTHREAD_CONFIG_DUA_ENABLE - if (mDuaState != kNotExist) - { - mDuaState = kToRegister; - } -#endif - #if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE mChildDuaRegisteredMask.Clear(); #endif @@ -420,48 +180,13 @@ void DuaManager::PerformNextRegistration(void) // Only allow one outgoing DUA.req VerifyOrExit(!mIsDuaPending); - // Only send DUA.req when necessary -#if OPENTHREAD_CONFIG_DUA_ENABLE -#if OPENTHREAD_FTD - if (!Get().IsRouterOrLeader() && Get().WillBecomeRouterSoon()) - { - UpdateRegistrationDelay(Get().GetRouterRoleTransitionTimeout() + kNewRouterRegistrationDelay + 1); - ExitNow(); - } -#endif - VerifyOrExit(Get().IsFullThreadDevice() || Get().GetParent().IsThreadVersion1p1()); -#endif // OPENTHREAD_CONFIG_DUA_ENABLE - - { - bool needReg = false; - -#if OPENTHREAD_CONFIG_DUA_ENABLE - needReg = (mDuaState == kToRegister && mDelay.mFields.mRegistrationDelay == 0); -#endif - -#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE - needReg = needReg || (!mChildDuaMask.IsEmpty() && mChildDuaMask != mChildDuaRegisteredMask); -#endif - VerifyOrExit(needReg); - } + VerifyOrExit(!mChildDuaMask.IsEmpty() && mChildDuaMask != mChildDuaRegisteredMask); // Prepare DUA.req message = Get().AllocateAndInitPriorityConfirmablePostMessage(kUriDuaRegistrationRequest); VerifyOrExit(message != nullptr, error = kErrorNoBufs); -#if OPENTHREAD_CONFIG_DUA_ENABLE - if (mDuaState == kToRegister && mDelay.mFields.mRegistrationDelay == 0) { - dua = GetDomainUnicastAddress(); - SuccessOrExit(error = Tlv::Append(*message, dua)); - SuccessOrExit(error = Tlv::Append(*message, Get().GetMeshLocalEid().GetIid())); - mDuaState = kRegistering; - mLastRegistrationTime = TimerMilli::GetNow(); - } - else -#endif // OPENTHREAD_CONFIG_DUA_ENABLE - { -#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE uint32_t lastTransactionTime; Child *child = nullptr; @@ -486,21 +211,9 @@ void DuaManager::PerformNextRegistration(void) lastTransactionTime = Time::MsecToSec(TimerMilli::GetNow() - child->GetLastHeard()); SuccessOrExit(error = Tlv::Append(*message, lastTransactionTime)); -#endif // OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE } - if (!Get().IsFullThreadDevice() && Get().GetParent().IsThreadVersion1p1()) - { - uint8_t pbbrServiceId; - - SuccessOrExit(error = Get().GetServiceId(pbbrServiceId)); - Get().GetServiceAloc(pbbrServiceId, destAddr); - } - else - { - destAddr.InitAsRoutingLocator(Get().GetMeshLocalPrefix(), - Get().GetServer16()); - } + destAddr.InitAsRoutingLocator(Get().GetMeshLocalPrefix(), Get().GetServer16()); SuccessOrExit(error = Get().SendMessageTo(*message, destAddr, HandleDuaResponse, this)); @@ -508,14 +221,6 @@ void DuaManager::PerformNextRegistration(void) mRegisteringDua = dua; mDelay.mValue = 0; - // Generally Thread 1.2 Router would send DUA.req on behalf for DUA registered by its MTD child. - // When Thread 1.2 MTD attaches to Thread 1.1 parent, 1.2 MTD should send DUA.req to PBBR itself. - // In this case, Thread 1.2 sleepy end device relies on fast data poll to fetch the response timely. - if (!Get().IsRxOnWhenIdle()) - { - Get().SendFastPolls(); - } - LogInfo("Sent %s for DUA %s", UriToString(), dua.ToString().AsCString()); exit: @@ -594,39 +299,6 @@ Error DuaManager::ProcessDuaResponse(Coap::Message &aMessage) VerifyOrExit(Get().IsDomainUnicast(target), error = kErrorDrop); -#if OPENTHREAD_CONFIG_DUA_ENABLE - if (Get().HasUnicastAddress(target)) - { - switch (static_cast(status)) - { - case kDuaSuccess: - mLastRegistrationTime = TimerMilli::GetNow(); - mDuaState = kRegistered; - break; - case kDuaReRegister: - if (Get().HasUnicastAddress(GetDomainUnicastAddress())) - { - RemoveDomainUnicastAddress(); - AddDomainUnicastAddress(); - } - break; - case kDuaInvalid: - // Domain Prefix might be invalid. - RemoveDomainUnicastAddress(); - break; - case kDuaDuplicate: - NotifyDuplicateDomainUnicastAddress(); - break; - case kDuaNoResources: - case kDuaNotPrimary: - case kDuaGeneralFailure: - UpdateReregistrationDelay(); - break; - } - } - else -#endif -#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE { Child *child = nullptr; uint16_t childIndex; @@ -676,7 +348,6 @@ Error DuaManager::ProcessDuaResponse(Coap::Message &aMessage) SendAddressNotification(target, static_cast(status), *child); } } -#endif // OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE exit: UpdateTimeTickerRegistration(); @@ -745,4 +416,4 @@ void DuaManager::HandleChildDuaAddressEvent(const Child &aChild, ChildDuaAddress } // namespace ot -#endif // OPENTHREAD_CONFIG_DUA_ENABLE || (OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE) +#endif // OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE diff --git a/src/core/thread/dua_manager.hpp b/src/core/thread/dua_manager.hpp index 35468a4e9..b720912c6 100644 --- a/src/core/thread/dua_manager.hpp +++ b/src/core/thread/dua_manager.hpp @@ -36,15 +36,7 @@ #include "openthread-core-config.h" -#if OPENTHREAD_CONFIG_DUA_ENABLE || (OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE) - -#if OPENTHREAD_CONFIG_DUA_ENABLE && (OPENTHREAD_CONFIG_THREAD_VERSION < OT_THREAD_VERSION_1_2) -#error "Thread 1.2 or higher version is required for OPENTHREAD_CONFIG_DUA_ENABLE" -#endif - -#if OPENTHREAD_CONFIG_DUA_ENABLE && !OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE -#error "OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE is required for OPENTHREAD_CONFIG_DUA_ENABLE" -#endif +#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE #include "backbone_router/bbr_leader.hpp" #include "coap/coap_message.hpp" @@ -120,57 +112,6 @@ public: */ void HandleBackboneRouterPrimaryUpdate(BackboneRouter::PrimaryEvent aEvent); -#if OPENTHREAD_CONFIG_DUA_ENABLE - - /** - * Returns a reference to the Domain Unicast Address. - * - * @returns A reference to the Domain Unicast Address. - */ - const Ip6::Address &GetDomainUnicastAddress(void) const { return mDomainUnicastAddress.GetAddress(); } - - /** - * Sets the Interface Identifier manually specified for the Thread Domain Unicast Address. - * - * @param[in] aIid A reference to the Interface Identifier to set. - * - * @retval kErrorNone Successfully set the Interface Identifier. - * @retval kErrorInvalidArgs The specified Interface Identifier is reserved. - */ - Error SetFixedDuaInterfaceIdentifier(const Ip6::InterfaceIdentifier &aIid); - - /** - * Clears the Interface Identifier manually specified for the Thread Domain Unicast Address. - */ - void ClearFixedDuaInterfaceIdentifier(void); - - /** - * Indicates whether or not there is Interface Identifier manually specified for the Thread - * Domain Unicast Address. - * - * @retval true If there is Interface Identifier manually specified. - * @retval false If there is no Interface Identifier manually specified. - */ - bool IsFixedDuaInterfaceIdentifierSet(void) { return !mFixedDuaInterfaceIdentifier.IsUnspecified(); } - - /** - * Gets the Interface Identifier for the Thread Domain Unicast Address if manually specified. - * - * @returns A reference to the Interface Identifier. - */ - const Ip6::InterfaceIdentifier &GetFixedDuaInterfaceIdentifier(void) const { return mFixedDuaInterfaceIdentifier; } - - /* - * Restores duplicate address detection information from non-volatile memory. - */ - void Restore(void); - - /** - * Notifies duplicated Domain Unicast Address. - */ - void NotifyDuplicateDomainUnicastAddress(void); -#endif - #if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE /** * Events related to a Child DUA address. @@ -193,20 +134,8 @@ public: #endif private: - static constexpr uint32_t kDuaDadPeriod = 100; // DAD wait time to become "Preferred" (in sec). - static constexpr uint8_t kNoBufDelay = 5; // In sec. - static constexpr uint8_t KResponseTimeoutDelay = 30; // In sec. - static constexpr uint8_t kNewRouterRegistrationDelay = 3; // Delay (in sec) to establish link for a new router. - static constexpr uint8_t kNewDuaRegistrationDelay = 1; // Delay (in sec) for newly added DUA. - -#if OPENTHREAD_CONFIG_DUA_ENABLE - Error GenerateDomainUnicastAddressIid(void); - void Store(void); - - void AddDomainUnicastAddress(void); - void RemoveDomainUnicastAddress(void); - void UpdateRegistrationDelay(uint8_t aDelay); -#endif + static constexpr uint8_t kNoBufDelay = 5; // In sec. + static constexpr uint8_t KResponseTimeoutDelay = 30; // In sec. #if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE void SendAddressNotification(Ip6::Address &aAddress, DuaStatus aStatus, const Child &aChild); @@ -234,31 +163,12 @@ private: Ip6::Address mRegisteringDua; bool mIsDuaPending : 1; -#if OPENTHREAD_CONFIG_DUA_ENABLE - enum DuaState : uint8_t - { - kNotExist, ///< DUA is not available. - kToRegister, ///< DUA is to be registered. - kRegistering, ///< DUA is being registered. - kRegistered, ///< DUA is registered. - }; - - DuaState mDuaState; - uint8_t mDadCounter; - TimeMilli mLastRegistrationTime; // The time (in milliseconds) when sent last DUA.req or received DUA.rsp. - Ip6::InterfaceIdentifier mFixedDuaInterfaceIdentifier; - Ip6::Netif::UnicastAddress mDomainUnicastAddress; -#endif - union { struct { uint16_t mReregistrationDelay; // Delay (in seconds) for DUA re-registration. uint8_t mCheckDelay; // Delay (in seconds) for checking whether or not registration is required. -#if OPENTHREAD_CONFIG_DUA_ENABLE - uint8_t mRegistrationDelay; // Delay (in seconds) for DUA registration. -#endif } mFields; uint32_t mValue; // Non-zero indicates timer should start. } mDelay; @@ -277,5 +187,5 @@ DeclareTmfHandler(DuaManager, kUriDuaRegistrationNotify); } // namespace ot -#endif // OPENTHREAD_CONFIG_DUA_ENABLE || (OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE) +#endif // OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE #endif // OT_CORE_THREAD_DUA_MANAGER_HPP_ diff --git a/src/core/thread/mle.cpp b/src/core/thread/mle.cpp index 19223f9e1..83d354576 100644 --- a/src/core/thread/mle.cpp +++ b/src/core/thread/mle.cpp @@ -356,10 +356,6 @@ void Mle::Restore(void) IgnoreError(Get().Restore()); IgnoreError(Get().Restore()); -#if OPENTHREAD_CONFIG_DUA_ENABLE - Get().Restore(); -#endif - SuccessOrExit(Get().Read(networkInfo)); Get().SetCurrentKeySequence(networkInfo.GetKeySequence(), @@ -3670,14 +3666,6 @@ Error Mle::TxMessage::AppendAddressRegistrationTlv(AddressRegistrationMode aMode // Continue to append the other addresses if not `kAppendMeshLocalOnly` mode VerifyOrExit(aMode != kAppendMeshLocalOnly); -#if OPENTHREAD_CONFIG_DUA_ENABLE - if (Get().HasUnicastAddress(Get().GetDomainUnicastAddress())) - { - // Prioritize DUA, compressed entry - SuccessOrExit(error = AppendAddressRegistrationEntry(Get().GetDomainUnicastAddress())); - } -#endif - for (const Ip6::Netif::UnicastAddress &addr : Get().GetUnicastAddresses()) { if (!Get().ShouldRegisterUnicastAddrWithParent(addr)) @@ -3690,13 +3678,6 @@ Error Mle::TxMessage::AppendAddressRegistrationTlv(AddressRegistrationMode aMode continue; } -#if OPENTHREAD_CONFIG_DUA_ENABLE - if (addr.GetAddress() == Get().GetDomainUnicastAddress()) - { - continue; - } -#endif - SuccessOrExit(error = AppendAddressRegistrationEntry(addr.GetAddress())); } diff --git a/src/core/thread/tmf.cpp b/src/core/thread/tmf.cpp index 83d051078..b092fd094 100644 --- a/src/core/thread/tmf.cpp +++ b/src/core/thread/tmf.cpp @@ -123,7 +123,7 @@ bool Agent::HandleResource(const char *aUriPath, Msg &aMsg) Case(kUriRelayRx, Agent); #endif -#if OPENTHREAD_CONFIG_DUA_ENABLE || (OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE) +#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_DUA_ENABLE Case(kUriDuaRegistrationNotify, DuaManager); #endif diff --git a/src/ncp/ncp_base.cpp b/src/ncp/ncp_base.cpp index 6726380d0..23d80f2b4 100644 --- a/src/ncp/ncp_base.cpp +++ b/src/ncp/ncp_base.cpp @@ -2151,10 +2151,6 @@ template <> otError NcpBase::HandlePropertyGet(void) SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_CAP_THREAD_LINK_METRICS)); #endif -#if OPENTHREAD_CONFIG_DUA_ENABLE - SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_CAP_DUA)); -#endif - #if OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_CAP_REFERENCE_DEVICE)); #endif diff --git a/src/ncp/ncp_base_dispatcher.cpp b/src/ncp/ncp_base_dispatcher.cpp index 9a8fd7ee6..bda4d2aec 100644 --- a/src/ncp/ncp_base_dispatcher.cpp +++ b/src/ncp/ncp_base_dispatcher.cpp @@ -335,9 +335,6 @@ NcpBase::PropertyHandler NcpBase::FindGetPropertyHandler(spinel_prop_key_t aKey) #if (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2) OT_NCP_GET_HANDLER_ENTRY(SPINEL_PROP_THREAD_DOMAIN_NAME), #endif -#if OPENTHREAD_CONFIG_DUA_ENABLE - OT_NCP_GET_HANDLER_ENTRY(SPINEL_PROP_THREAD_DUA_ID), -#endif #endif // OPENTHREAD_FTD #if (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2) OT_NCP_GET_HANDLER_ENTRY(SPINEL_PROP_THREAD_BACKBONE_ROUTER_PRIMARY), @@ -651,9 +648,6 @@ NcpBase::PropertyHandler NcpBase::FindSetPropertyHandler(spinel_prop_key_t aKey) #if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_MLR_ENABLE && OPENTHREAD_CONFIG_COMMISSIONER_ENABLE OT_NCP_SET_HANDLER_ENTRY(SPINEL_PROP_THREAD_MLR_REQUEST), #endif -#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_DUA_ENABLE - OT_NCP_SET_HANDLER_ENTRY(SPINEL_PROP_THREAD_DUA_ID), -#endif #if OPENTHREAD_FTD #if OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE OT_NCP_SET_HANDLER_ENTRY(SPINEL_PROP_THREAD_BACKBONE_ROUTER_LOCAL_STATE), diff --git a/src/ncp/ncp_base_ftd.cpp b/src/ncp/ncp_base_ftd.cpp index cb1ed88ec..3cc9cbc10 100644 --- a/src/ncp/ncp_base_ftd.cpp +++ b/src/ncp/ncp_base_ftd.cpp @@ -385,53 +385,6 @@ exit: } #endif -#if OPENTHREAD_CONFIG_DUA_ENABLE -template <> otError NcpBase::HandlePropertyGet(void) -{ - const otIp6InterfaceIdentifier *iid = otThreadGetFixedDuaInterfaceIdentifier(mInstance); - otError error = OT_ERROR_NONE; - - if (iid == nullptr) - { - // send empty response - } - else - { - for (uint8_t i : iid->mFields.m8) - { - SuccessOrExit(error = mEncoder.WriteUint8(i)); - } - } - -exit: - return error; -} - -template <> otError NcpBase::HandlePropertySet(void) -{ - otError error = OT_ERROR_NONE; - - if (mDecoder.GetRemainingLength() == 0) - { - SuccessOrExit(error = otThreadSetFixedDuaInterfaceIdentifier(mInstance, nullptr)); - } - else - { - otIp6InterfaceIdentifier iid; - - for (uint8_t &i : iid.mFields.m8) - { - SuccessOrExit(error = mDecoder.ReadUint8(i)); - } - - SuccessOrExit(error = otThreadSetFixedDuaInterfaceIdentifier(mInstance, &iid)); - } - -exit: - return error; -} -#endif // OPENTHREAD_CONFIG_DUA_ENABLE - #if OPENTHREAD_CONFIG_BORDER_AGENT_EPHEMERAL_KEY_ENABLE template <> otError NcpBase::HandlePropertySet(void) diff --git a/tests/scripts/thread-cert/v1_2_test_domain_unicast_address.py b/tests/scripts/thread-cert/v1_2_test_domain_unicast_address.py deleted file mode 100755 index 81c9054fb..000000000 --- a/tests/scripts/thread-cert/v1_2_test_domain_unicast_address.py +++ /dev/null @@ -1,320 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (c) 2020, 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. -# - -import unittest - -import command -import config -import ipaddress -import mle -import thread_cert - -BBR_1 = 1 # Collapsed with Leader Role -ROUTER_1_1 = 2 -ROUTER_1_2 = 3 -MED_1_2 = 4 -SED_1_2 = 5 - -WAIT_ATTACH = 5 -WAIT_REDUNDANCE = 3 -ROUTER_SELECTION_JITTER = 1 -BBR_REGISTRATION_JITTER = 5 -SED_POLL_PERIOD = 2000 # 2s -MED_TIMEOUT = 20 # 20s - -DUA_IID_MANUAL1 = '4444333322221111' -DUA_IID_MANUAL2 = '5555444433332222' - -TEST_PREFIX1 = '2001:0:0:1::/64' -TEST_PREFIX2 = '2001:0:0:2::/64' -TEST_PREFIX3 = '2001:0:0:3::/64' -""" - Topology - - - SED_1_2 - | - | - ROUTER_1_1 MED_1_2 - | | - | | - BBR_1 (LEADER) --- ROUTER_1_2 - - - 1) Bring up BBR_1, BBR_1 becomes Leader and Primary Backbone Router, with Domain - Prefix without `P_slaac`. - - 2) Bring up ROUTER_1_1, no DUA was added due to that `P_slaac` flag is not set. - - 3) Bring up ROUTER_1_2, verify that it has DUA generated. - - 4) Bring up MED_1_2 with DUA_IID_MANUAL1 set in advance, verify - a) DUA_IID_MANUAL1 is registered in Address Registration TLV via Child Update Request. - b) Remove DUA_IID_MANUAL1, a new DUA generated via SLAAC would be registered in Address - Registration TLV via Child Update Request. - c) Set DUA_IID_MANUAL2 which should override the generated one and be registered in Address - Registration TLV via Child Update Request. - d) Remove DUA_IID_MANUAL2, a new DUA generated via SLAAC, the same as in above b) would - be registered in Address Registration TLV via Child Update Request. - - 5) Change BBR_1 from config.DOMAIN_PREFIX to config.DOMAIN_PRFIX_ALTER. Verify that MED_1_2 - generate a new Interface Identifier different from the one generated in 4d) due to the - Domain Prefix change. - - 6) Recover config.Domain_Prefix on BBR_1. Verify that MED_1_2 generates and registers the same - DUA as in step 4b). - - 7) Configure ROUTER_1_1 as Border Router with 3 SLAAC prefixes, verify MED_1_2 would register - its DUA in Address Registration TLV. - - 8) Bring up SED_1_2, verify it generates one DUA, and registers it to its parent, though the parent - is a Thread 1.1 device. - -""" - - -class TestDomainUnicastAddress(thread_cert.TestCase): - TOPOLOGY = { - BBR_1: { - 'version': '1.2', - 'allowlist': [ROUTER_1_1, ROUTER_1_2], - 'is_bbr': True - }, - ROUTER_1_1: { - 'version': '1.1', - 'allowlist': [BBR_1, SED_1_2] - }, - ROUTER_1_2: { - 'version': '1.2', - 'allowlist': [BBR_1, MED_1_2] - }, - MED_1_2: { - 'mode': 'rn', - 'version': '1.2', - 'allowlist': [ROUTER_1_2], - }, - SED_1_2: { - 'mode': 'n', - 'version': '1.2', - 'allowlist': [ROUTER_1_1], - }, - } - """All nodes are created with default configurations""" - - def __get_iid(self, address): - ''' Get the interface identifier of an IPv6 address. - - Args: - address (string): An IPv6 address; - ''' - return ''.join(ipaddress.ip_address(address).exploded.split(':')[4:]) - - def __check_dua_registration(self, node, iid, dp_cid): - ''' Check whether or not the specified Domain Unicast Address is registered in Address - Registration TLV. - - Args: - node (int) : The device id - iid (string): The Interface Identifier - dp_cid (int): The context id of the domain prefix. - ''' - - messages = self.simulator.get_messages_sent_by(node) - msg = messages.next_mle_message(mle.CommandType.CHILD_UPDATE_REQUEST) - command.check_compressed_address_registration_tlv(msg, dp_cid, iid, cid_present_once=True) - - def test(self): - # starting context id - context_id = 1 - - # 1) Bring up BBR_1, BBR_1 becomes Leader and Primary Backbone Router, with Domain - # Prefix without `P_slaac`. - self.nodes[BBR_1].set_router_selection_jitter(ROUTER_SELECTION_JITTER) - self.nodes[BBR_1].set_bbr_registration_jitter(BBR_REGISTRATION_JITTER) - self.nodes[BBR_1].set_backbone_router(seqno=1) - self.nodes[BBR_1].start() - WAIT_TIME = WAIT_ATTACH + ROUTER_SELECTION_JITTER - self.simulator.go(WAIT_TIME * 2) - self.assertEqual(self.nodes[BBR_1].get_state(), 'leader') - self.nodes[BBR_1].enable_backbone_router() - WAIT_TIME = BBR_REGISTRATION_JITTER + WAIT_REDUNDANCE - self.simulator.go(WAIT_TIME) - self.assertEqual(self.nodes[BBR_1].get_backbone_router_state(), 'Primary') - - self.nodes[BBR_1].set_domain_prefix(config.DOMAIN_PREFIX, 'prosD') - WAIT_TIME = WAIT_REDUNDANCE - self.simulator.go(WAIT_TIME) - - self.simulator.set_lowpan_context(context_id, config.DOMAIN_PREFIX) - domain_prefix_cid = context_id - - # 2) Bring up ROUTER_1_1, no DUA was added due to that `P_slaac` flag is not set. - self.nodes[ROUTER_1_1].set_router_selection_jitter(ROUTER_SELECTION_JITTER) - WAIT_TIME = WAIT_ATTACH + ROUTER_SELECTION_JITTER - self.nodes[ROUTER_1_1].start() - self.simulator.go(WAIT_TIME) - self.assertEqual(self.nodes[ROUTER_1_1].get_state(), 'router') - dua = self.nodes[ROUTER_1_1].get_addr(config.DOMAIN_PREFIX) - assert not dua, 'Error: Unexpected DUA ({})'.format(dua) - - # 3) Bring up ROUTER_1_2, verify that it has DUA generated. - self.nodes[ROUTER_1_2].set_router_selection_jitter(ROUTER_SELECTION_JITTER) - self.nodes[ROUTER_1_2].start() - WAIT_TIME = WAIT_ATTACH + ROUTER_SELECTION_JITTER - self.simulator.go(WAIT_TIME) - self.assertEqual(self.nodes[ROUTER_1_2].get_state(), 'router') - dua = self.nodes[ROUTER_1_2].get_addr(config.DOMAIN_PREFIX) - assert dua, 'Error: Expected DUA not found' - self.assertTrue(self.nodes[BBR_1].ping(dua)) - - # 4) Bring up MED_1_2 with DUA_IID_MANUAL1 set in advance - self.nodes[MED_1_2].set_dua_iid(DUA_IID_MANUAL1) - self.nodes[MED_1_2].set_timeout(MED_TIMEOUT) - self.nodes[MED_1_2].start() - WAIT_TIME = WAIT_ATTACH - self.simulator.go(WAIT_TIME) - self.assertEqual(self.nodes[MED_1_2].get_state(), 'child') - - # 4a) DUA_IID_MANUAL1 is registered in Address Registration TLV via Child Update Request. - self.__check_dua_registration(MED_1_2, DUA_IID_MANUAL1, domain_prefix_cid) - - # 4b) Remove DUA_IID_MANUAL1, a new DUA generated via SLAAC would be registered in Address - # Registration TLV via Child Update Request. - - # Flush relative message queues. - messages = self.simulator.get_messages_sent_by(MED_1_2) - - self.nodes[MED_1_2].clear_dua_iid() - WAIT_TIME = MED_TIMEOUT + WAIT_REDUNDANCE - self.simulator.go(WAIT_TIME) - - med_1_2_dua = self.nodes[MED_1_2].get_addr(config.DOMAIN_PREFIX) - assert med_1_2_dua, 'Error: Expected DUA not found' - - med_1_2_dua_iid = self.__get_iid(med_1_2_dua) - self.__check_dua_registration(MED_1_2, med_1_2_dua_iid, domain_prefix_cid) - - # 4c) Set DUA_IID_MANUAL2 which should override the generated one and be registered in Address - # Registration TLV via Child Update Request. - - # Flush relative message queues. - messages = self.simulator.get_messages_sent_by(MED_1_2) - self.nodes[MED_1_2].set_dua_iid(DUA_IID_MANUAL2) - WAIT_TIME = WAIT_REDUNDANCE - self.simulator.go(WAIT_TIME) - - dua = self.nodes[MED_1_2].get_addr(config.DOMAIN_PREFIX) - - self.__check_dua_registration(MED_1_2, DUA_IID_MANUAL2, domain_prefix_cid) - - # 4d) Remove DUA_IID_MANUAL2, a new DUA generated via SLAAC, the same as in above b) would - # be registered in Address Registration TLV via Child Update Request. - - # Flush relative message queues. - messages = self.simulator.get_messages_sent_by(MED_1_2) - self.nodes[MED_1_2].clear_dua_iid() - WAIT_TIME = WAIT_REDUNDANCE - self.simulator.go(WAIT_TIME) - dua = self.nodes[MED_1_2].get_addr(config.DOMAIN_PREFIX) - self.assertEqual(ipaddress.ip_address(dua), ipaddress.ip_address(med_1_2_dua)) - self.assertEqual(ipaddress.ip_address(med_1_2_dua), ipaddress.ip_address(dua)) - - self.__check_dua_registration(MED_1_2, med_1_2_dua_iid, domain_prefix_cid) - - # 5) Change BBR_1 from config.DOMAIN_PREFIX to config.DOMAIN_PRFIX_ALTER. Verify that MED_1_2 - # generates a new Interface Identifier different from the one generated in 4d) due to the - # Domain Prefix change. - context_id += 1 - self.simulator.set_lowpan_context(context_id, config.DOMAIN_PREFIX_ALTER) - self.nodes[BBR_1].set_domain_prefix(config.DOMAIN_PREFIX_ALTER) - WAIT_TIME = WAIT_REDUNDANCE - self.simulator.go(WAIT_TIME) - - med_1_2_dua2 = self.nodes[MED_1_2].get_addr(config.DOMAIN_PREFIX_ALTER) - med_1_2_dua2_iid = self.__get_iid(med_1_2_dua2) - self.__check_dua_registration(MED_1_2, med_1_2_dua2_iid, context_id) - - #6) Recover config.Domain_Prefix on BBR_1. Verify that MED_1_2 generates and registers the same - # DUA as in step 4b). - self.nodes[BBR_1].set_domain_prefix(config.DOMAIN_PREFIX) - WAIT_TIME = WAIT_REDUNDANCE - self.simulator.go(WAIT_TIME) - dua = self.nodes[MED_1_2].get_addr(config.DOMAIN_PREFIX) - assert dua, 'Error: Expected DUA not found' - self.assertEqual(ipaddress.ip_address(med_1_2_dua), ipaddress.ip_address(dua)) - - self.__check_dua_registration(MED_1_2, med_1_2_dua_iid, domain_prefix_cid) - - #7) Configure ROUTER_1_1 as Border Router with 3 SLAAC prefixes, verify MED_1_2 would register - # its DUA in Address Registration TLV. - - # Flush relative message queues. - messages = self.simulator.get_messages_sent_by(MED_1_2) - - context_id += 1 - self.simulator.set_lowpan_context(context_id, TEST_PREFIX1) - self.nodes[ROUTER_1_1].add_prefix(TEST_PREFIX1) - - context_id += 1 - self.simulator.set_lowpan_context(context_id, TEST_PREFIX2) - self.nodes[ROUTER_1_1].add_prefix(TEST_PREFIX2) - context_id += 1 - self.simulator.set_lowpan_context(context_id, TEST_PREFIX3) - self.nodes[ROUTER_1_1].add_prefix(TEST_PREFIX3) - self.nodes[ROUTER_1_1].register_netdata() - - WAIT_TIME = WAIT_REDUNDANCE - self.simulator.go(WAIT_TIME) - - WAIT_TIME = MED_TIMEOUT - self.simulator.go(WAIT_TIME) - dua = self.nodes[MED_1_2].get_addr(config.DOMAIN_PREFIX) - assert dua, 'Error: Expected DUA not found' - self.assertEqual(ipaddress.ip_address(med_1_2_dua), ipaddress.ip_address(dua)) - - self.__check_dua_registration(MED_1_2, med_1_2_dua_iid, domain_prefix_cid) - - #8) Bring up SED_1_2, verify that it generates one DUA, and registers it to its parent, though the parent - # is a Thread 1.1 device. - self.nodes[SED_1_2].set_pollperiod(SED_POLL_PERIOD) - self.nodes[SED_1_2].start() - WAIT_TIME = WAIT_ATTACH - self.simulator.go(WAIT_TIME) - - dua = self.nodes[SED_1_2].get_addr(config.DOMAIN_PREFIX) - assert dua, 'Error: Expected DUA not found' - - dua_iid = self.__get_iid(dua) - self.__check_dua_registration(SED_1_2, dua_iid, domain_prefix_cid) - - self.assertTrue(self.nodes[BBR_1].ping(dua)) - - -if __name__ == '__main__': - unittest.main() diff --git a/tests/scripts/thread-cert/v1_2_test_domain_unicast_address_registration.py b/tests/scripts/thread-cert/v1_2_test_domain_unicast_address_registration.py deleted file mode 100755 index 76772abe9..000000000 --- a/tests/scripts/thread-cert/v1_2_test_domain_unicast_address_registration.py +++ /dev/null @@ -1,370 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (c) 2020, 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. -# - -import unittest - -import command -import config -import ipaddress -import mle -import network_layer -import thread_cert - -BBR_1 = 1 # Collapsed with Leader Role -ROUTER_1_1 = 2 -ROUTER_1_2 = 3 - -FED_1_2_1 = 4 -MED_1_2_1 = 5 -SED_1_2_1 = 6 - -FED_1_2_2 = 7 -MED_1_2_2 = 8 -SED_1_2_2 = 9 - -WAIT_ATTACH = 5 -WAIT_REDUNDANCE = 3 -ROUTER_SELECTION_JITTER = 1 -BBR_REGISTRATION_JITTER = 5 -SED_POLL_PERIOD = 2000 # 2s -MED_TIMEOUT = 20 # 20s -PARENT_AGGREGATE_DELAY = 5 # 5s - -DUA_IID_MANUAL1 = '4444333322221111' - -ST_DUA_SUCCESS = 0 -ST_DUA_REREGISTER = 1 -ST_DUA_INVALID = 2 -ST_DUA_DUPLICATE = 3 -ST_DUA_NO_RESOURCES = 4 -ST_DUA_BBR_NOT_PRIMARY = 5 -ST_DUA_GENERAL_FAILURE = 6 - -BBR_REREGISTRATION_DELAY = 10 -""" - Topology - - - MED_1_2_1 SED_1_2_1 - \ | - \ | -FED_1_2_1 --- ROUTER_1_1 FED_1_2_2 MED_1_2_2 - | | / - | | / - BBR_1 (LEADER) --- ROUTER_1_2 --- SED_1_2_2 - - - 1) Bring up BBR_1, BBR_1 becomes Leader and Primary Backbone Router, with Domain - Prefix without `P_slaac`. - - 2) Test behaviors of ROUTER_1_2 under various response status: - a) Bring up ROUTER_1_2 with DUA_IID_MANUAL1, one DUA.req should happen to register DUA. - b) Remove DUA_IID_MANUAL1, one DUA.req should happen for the new generated DUA via SLAAC. - c) Configure BBR_1 to respond with the fatal error ST_DUA_INVALID, update BBR_1 with - BBR_REREGISTRATION_DELAY, ROUTER_1_2 should re-register its DUA within BBR_REREGISTRATION_DELAY. - - ROUTER_1_2 should remove its dua - - update network data, ROUTER_1_2 would regenerate and register the same dua - d) Configure BBR_1 to respond with the fatal error ST_DUA_DUPLICATE, update seqno to trigger reregistration. - After received DUA.rsp with ST_DUA_DUPLICATE, ROUTER_1_2 should - - increase dad counter - - regenerate a new DUA - - send DUA.req - e) (repeated) Configure BBR_1 to respond with per remaining error status: - - increase BBR seqno to trigger reregistration - - ROUTER_1_2 should re-register within BBR_REREGISTRATION_DELAY. For the not fatal errors, ROUTER_1_2 - should re-register within another BBR_REREGISTRATION_DELAY (with least delay if ST_DUA_REREGISTER) - 3) Bring up FED_1_2_1, MED_1_2_1, SED_1_2_1, they should send DUA.req by themselves as the parent - is of Thread 1.1 version. - 4) Bring up FED_1_2_2, it sends DUA.req itself as it it FTD. - 5) MED_1_2_2, SED_1_2_2, MTDs should should register their DUA to their parent - by Child Update Request, and the parent would send DUA.req for them on behalf. - 6) Increase seqno on BBR_1, within BBR_REREGISTRATION_DELAY, there should be one DUA.req from - per [FED_1_2_1, MED_1_2_1, SED_1_2_1, FED_1_2_2], and 3 DUA.req from ROUTER_1_2 among which - 2 DUA.req are for its MTD children. - -""" - - -class TestDomainUnicastAddressRegistration(thread_cert.TestCase): - TOPOLOGY = { - BBR_1: { - 'version': '1.2', - 'allowlist': [ROUTER_1_1, ROUTER_1_2], - 'is_bbr': True - }, - ROUTER_1_1: { - 'version': '1.1', - 'allowlist': [BBR_1, FED_1_2_1, MED_1_2_1, SED_1_2_1] - }, - ROUTER_1_2: { - 'version': '1.2', - 'allowlist': [BBR_1, FED_1_2_2, MED_1_2_2, SED_1_2_2] - }, - FED_1_2_1: { - 'version': '1.2', - 'allowlist': [ROUTER_1_1], - }, - MED_1_2_1: { - 'mode': 'rn', - 'version': '1.2', - 'allowlist': [ROUTER_1_1], - }, - SED_1_2_1: { - 'mode': 'n', - 'version': '1.2', - 'allowlist': [ROUTER_1_1], - }, - FED_1_2_2: { - 'version': '1.2', - 'allowlist': [ROUTER_1_2], - }, - MED_1_2_2: { - 'mode': 'rn', - 'version': '1.2', - 'allowlist': [ROUTER_1_2], - }, - SED_1_2_2: { - 'mode': 'n', - 'version': '1.2', - 'allowlist': [ROUTER_1_2], - }, - } - """All nodes are created with default configurations""" - - def __get_iid(self, address): - ''' Get the interface identifier of an IPv6 address. - - Args: - address (string): An IPv6 address; - ''' - return ''.join(ipaddress.ip_address(address).exploded.split(':')[4:]) - - def __check_dua_registration_tmf(self, node, occurrences=1, ml_eid=None): - - messages = self.simulator.get_messages_sent_by(node) - for i in range(occurrences): - msg = messages.next_coap_message('0.02', '/n/dr', False) - assert msg, 'Expected {}, but {}th not found\n node: {}(extaddr: {})'.format( - occurrences, i + 1, node, self.nodes[node].get_addr64()) - if ml_eid: - ml_eid_tlv = msg.get_coap_message_tlv(network_layer.MlEid) - self.assertEqual(ml_eid, ml_eid_tlv.ml_eid.hex()) - - def test(self): - # starting context id - context_id = 1 - seq_num = 1 - - # 1) Bring up BBR_1, BBR_1 becomes Leader and Primary Backbone Router, with Domain - # Prefix without `P_slaac`. - self.nodes[BBR_1].set_router_selection_jitter(ROUTER_SELECTION_JITTER) - self.nodes[BBR_1].set_bbr_registration_jitter(BBR_REGISTRATION_JITTER) - self.nodes[BBR_1].set_backbone_router(seqno=seq_num, reg_delay=BBR_REREGISTRATION_DELAY) - self.nodes[BBR_1].start() - WAIT_TIME = WAIT_ATTACH + ROUTER_SELECTION_JITTER - self.simulator.go(WAIT_TIME * 2) - self.assertEqual(self.nodes[BBR_1].get_state(), 'leader') - self.nodes[BBR_1].enable_backbone_router() - WAIT_TIME = BBR_REGISTRATION_JITTER + WAIT_REDUNDANCE - self.simulator.go(WAIT_TIME) - self.assertEqual(self.nodes[BBR_1].get_backbone_router_state(), 'Primary') - - self.nodes[BBR_1].set_domain_prefix(config.DOMAIN_PREFIX, 'prosD') - WAIT_TIME = WAIT_REDUNDANCE - self.simulator.go(WAIT_TIME) - - self.simulator.set_lowpan_context(context_id, config.DOMAIN_PREFIX) - domain_prefix_cid = context_id - - # 2) Test behaviors of ROUTER_1_2 under various response status: - # a) Bring up ROUTER_1_2 with DUA_IID_MANUAL1, one DUA.req should happen to register DUA. - - # Flush relative message queues. - self.flush_nodes([ROUTER_1_2]) - - self.nodes[ROUTER_1_2].set_dua_iid(DUA_IID_MANUAL1) - self.nodes[ROUTER_1_2].set_router_selection_jitter(ROUTER_SELECTION_JITTER) - self.nodes[ROUTER_1_2].start() - WAIT_TIME = WAIT_ATTACH - self.simulator.go(WAIT_TIME) - self.assertEqual(self.nodes[ROUTER_1_2].get_state(), 'router') - - mliid = self.__get_iid(self.nodes[ROUTER_1_2].get_mleid()) - - WAIT_TIME = WAIT_ATTACH + WAIT_REDUNDANCE - self.simulator.go(WAIT_TIME) - self.__check_dua_registration_tmf(ROUTER_1_2, 1, self.nodes[ROUTER_1_2].get_mleid_iid()) - - # b) Remove DUA_IID_MANUAL1, one DUA.req should happen for the new generated DUA via SLAAC. - - # Flush relative message queues. - self.flush_nodes([ROUTER_1_2]) - self.nodes[ROUTER_1_2].clear_dua_iid() - WAIT_TIME = WAIT_ATTACH + WAIT_REDUNDANCE - self.simulator.go(WAIT_TIME) - self.__check_dua_registration_tmf(ROUTER_1_2, 1, self.nodes[ROUTER_1_2].get_mleid_iid()) - - #c) Configure BBR_1 to respond with the fatal error ST_DUA_INVALID, update BBR_1 with - # BBR_REREGISTRATION_DELAY, ROUTER_1_2 should re-register its DUA within BBR_REREGISTRATION_DELAY. - # - ROUTER_1_2 should remove its dua - # - update network data, ROUTER_1_2 would regenerate and register the same dua - - # Flush relative message queues. - self.flush_nodes([ROUTER_1_2]) - seq_num = seq_num + 1 - self.nodes[BBR_1].set_next_dua_response(ST_DUA_INVALID, mliid) - self.nodes[BBR_1].set_backbone_router(seqno=seq_num) - WAIT_TIME = BBR_REREGISTRATION_DELAY + WAIT_REDUNDANCE - self.simulator.go(WAIT_TIME) - - self.__check_dua_registration_tmf(ROUTER_1_2, 1, self.nodes[ROUTER_1_2].get_mleid_iid()) - dua = self.nodes[ROUTER_1_2].get_addr(config.DOMAIN_PREFIX) - assert not dua, 'Error: Unexpected DUA ({}) found'.format(dua) - - # Retry after new network data is available - seq_num = seq_num + 1 - dua = self.nodes[ROUTER_1_2].get_addr(config.DOMAIN_PREFIX) - self.nodes[BBR_1].set_backbone_router(seqno=seq_num) - WAIT_TIME = BBR_REREGISTRATION_DELAY + WAIT_REDUNDANCE - self.simulator.go(WAIT_TIME) - - self.__check_dua_registration_tmf(ROUTER_1_2, 1, self.nodes[ROUTER_1_2].get_mleid_iid()) - dua = self.nodes[ROUTER_1_2].get_addr(config.DOMAIN_PREFIX) - assert dua, 'Error: Expected DUA ({}) not found'.format(dua) - - #d) Configure BBR_1 to respond with the fatal error ST_DUA_DUPLICATE, update seqno to trigger reregistration. - # After received DUA.rsp with ST_DUA_DUPLICATE, ROUTER_1_2 should - # - increase dad counter - # - regenerate a new DUA - # - send DUA.req - - # Flush relative message queues. - self.flush_nodes([ROUTER_1_2]) - seq_num = seq_num + 1 - self.nodes[BBR_1].set_next_dua_response(ST_DUA_DUPLICATE, mliid) - self.nodes[BBR_1].set_backbone_router(seqno=seq_num) - WAIT_TIME = BBR_REREGISTRATION_DELAY * 2 + WAIT_REDUNDANCE - self.simulator.go(WAIT_TIME) - - self.__check_dua_registration_tmf(ROUTER_1_2, 2, self.nodes[ROUTER_1_2].get_mleid_iid()) - - dua2 = self.nodes[ROUTER_1_2].get_addr(config.DOMAIN_PREFIX) - assert dua2, 'Error: Expected DUA ({}) not found'.format(dua2) - self.assertNotEqual(dua2, dua) - - # e) (repeated) Configure BBR_1 to respond with per remaining error status: - # - increase BBR seqno to trigger reregistration - # - ROUTER_1_2 should re-register within BBR_REREGISTRATION_DELAY. For the not fatal errors, ROUTER_1_2 - # should re-register within another BBR_REREGISTRATION_DELAY (with least delay if ST_DUA_REREGISTER) - for status in ['5.00', ST_DUA_REREGISTER, ST_DUA_NO_RESOURCES, ST_DUA_BBR_NOT_PRIMARY, ST_DUA_GENERAL_FAILURE]: - print(f'Testing Status {status}...') - # Flush relative message queues. - self.flush_nodes([ROUTER_1_2]) - seq_num = seq_num + 1 - self.nodes[BBR_1].set_next_dua_response(status, mliid) - self.nodes[BBR_1].set_backbone_router(seqno=seq_num) - WAIT_TIME = BBR_REREGISTRATION_DELAY + WAIT_REDUNDANCE - if status != ST_DUA_REREGISTER: - WAIT_TIME += BBR_REREGISTRATION_DELAY - - self.simulator.go(WAIT_TIME) - - self.__check_dua_registration_tmf(ROUTER_1_2, 2, self.nodes[ROUTER_1_2].get_mleid_iid()) - - # Bring up Router_1_1 - self.nodes[ROUTER_1_1].set_router_selection_jitter(ROUTER_SELECTION_JITTER) - self.nodes[ROUTER_1_1].start() - WAIT_TIME = WAIT_ATTACH - self.simulator.go(WAIT_TIME) - self.assertEqual(self.nodes[ROUTER_1_1].get_state(), 'router') - - dua = self.nodes[ROUTER_1_1].get_addr(config.DOMAIN_PREFIX) - assert not dua, 'Error: Unexpected DUA ({}) found'.format(dua) - - # Configure children - for node in [FED_1_2_1, FED_1_2_2]: - self.nodes[node].set_routereligible(False) - - for node in [SED_1_2_1, SED_1_2_2]: - self.nodes[node].set_pollperiod(SED_POLL_PERIOD) - - for node in [MED_1_2_1, MED_1_2_2]: - self.nodes[node].set_timeout(MED_TIMEOUT) - - # 3) Bring up FED_1_2_1, MED_1_2_1, SED_1_2_1, they should send DUA.req by themselves as the parent - # is of Thread 1.1 version. - # 4) Bring up FED_1_2_2, it sends DUA.req itself as it it FTD. - for node in [FED_1_2_1, MED_1_2_1, SED_1_2_1, FED_1_2_2]: - print("Starting child {} (extaddr: {})...".format(node, self.nodes[node].get_addr64())) - # Flush all message queues. - self.flush_all() - self.nodes[node].start() - WAIT_TIME = WAIT_ATTACH - self.simulator.go(WAIT_TIME) - self.assertEqual(self.nodes[node].get_state(), 'child') - WAIT_TIME = PARENT_AGGREGATE_DELAY + WAIT_REDUNDANCE - self.simulator.go(WAIT_TIME) - self.__check_dua_registration_tmf(node, 1, self.nodes[node].get_mleid_iid()) - - # 5) MED_1_2_2, SED_1_2_2, MTDs should should register their DUA to their parent - # by Child Update Request, and the parent would send DUA.req for them on behalf. - for node in [MED_1_2_2, SED_1_2_2]: - print("Starting child {} (extaddr: {})...".format(node, self.nodes[node].get_addr64())) - # Flush all message queues. - self.flush_all() - self.nodes[node].start() - WAIT_TIME = WAIT_ATTACH - self.simulator.go(WAIT_TIME) - self.assertEqual(self.nodes[node].get_state(), 'child') - - WAIT_TIME = PARENT_AGGREGATE_DELAY + WAIT_REDUNDANCE - print("waiting {}".format(WAIT_TIME)) - self.simulator.go(WAIT_TIME) - self.__check_dua_registration_tmf(ROUTER_1_2, 1, self.nodes[node].get_mleid_iid()) - - # 6) Increase seqno on BBR_1, within BBR_REREGISTRATION_DELAY, there should be one DUA.req from - # per [FED_1_2_1, MED_1_2_1, SED_1_2_1, FED_1_2_2], and 3 DUA.req from ROUTER_1_2 among which - # 2 DUA.req are for its MTD children. - - # Flush all message queues. - self.flush_all() - seq_num = seq_num + 1 - self.nodes[BBR_1].set_backbone_router(seqno=seq_num) - WAIT_TIME = BBR_REREGISTRATION_DELAY + WAIT_REDUNDANCE - self.simulator.go(WAIT_TIME) - WAIT_TIME = BBR_REREGISTRATION_DELAY + WAIT_REDUNDANCE - self.simulator.go(WAIT_TIME) - for node in [FED_1_2_1, MED_1_2_1, SED_1_2_1, FED_1_2_2]: - self.__check_dua_registration_tmf(node, 1, self.nodes[node].get_mleid_iid()) - - self.__check_dua_registration_tmf(ROUTER_1_2, 3) - - -if __name__ == '__main__': - unittest.main() diff --git a/tests/scripts/thread-cert/v1_2_test_dua_handle_address_error.py b/tests/scripts/thread-cert/v1_2_test_dua_handle_address_error.py deleted file mode 100755 index ea36c69da..000000000 --- a/tests/scripts/thread-cert/v1_2_test_dua_handle_address_error.py +++ /dev/null @@ -1,148 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (c) 2020, 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. -# -# This script tests how node would handle duplicated Domain Unicast Address. -# - -import unittest - -import config -import thread_cert - -BBR_1 = 1 # Collapsed with Leader Role -ROUTER = 2 -FED = 3 -MED = 4 - -WAIT_ATTACH = 5 -WAIT_REDUNDANCE = 3 -BBR_REGISTRATION_JITTER = 5 -SED_POLL_PERIOD = 2000 # 2s -MED_TIMEOUT = 20 # 20s -""" - Topology - - BBR_1 (Leader) - | - ROUTER_1---FED - | - MED -""" - -WAIT_REDUNDANCE = 3 -REG_DELAY = 5 - - -class TestDomainUnicastAddress(thread_cert.TestCase): - TOPOLOGY = { - BBR_1: { - 'version': '1.2', - 'allowlist': [ROUTER], - 'is_bbr': True - }, - ROUTER: { - 'version': '1.2', - 'allowlist': [BBR_1, FED, MED], - }, - FED: { - 'version': '1.2', - 'allowlist': [ROUTER], - 'router_eligible': False, - 'mode': 'rdn', - }, - MED: { - 'version': '1.2', - 'is_mtd': True, - 'allowlist': [ROUTER], - 'mode': 'rn', - }, - } - - def test(self): - self.simulator.set_lowpan_context(1, config.DOMAIN_PREFIX) - - # 1) Bring up BBR_1, BBR_1 becomes Leader and Primary Backbone Router, with Domain - # Prefix without `P_slaac`. - self.nodes[BBR_1].set_bbr_registration_jitter(BBR_REGISTRATION_JITTER) - self.nodes[BBR_1].set_backbone_router(seqno=1, reg_delay=REG_DELAY) - self.nodes[BBR_1].start() - - self.simulator.go(WAIT_ATTACH * 2 + config.DEFAULT_ROUTER_SELECTION_JITTER) - self.assertEqual(self.nodes[BBR_1].get_state(), 'leader') - self.nodes[BBR_1].enable_backbone_router() - self.simulator.go(BBR_REGISTRATION_JITTER + WAIT_REDUNDANCE) - self.assertEqual(self.nodes[BBR_1].get_backbone_router_state(), 'Primary') - - self.nodes[BBR_1].set_domain_prefix(config.DOMAIN_PREFIX, 'prosD') - self.simulator.go(WAIT_REDUNDANCE) - - # 2) Bring up ROUTER_1 - self.nodes[ROUTER].start() - self.simulator.go(WAIT_ATTACH + REG_DELAY + WAIT_REDUNDANCE) - self.assertEqual(self.nodes[ROUTER].get_state(), 'router') - - # Bring up FED - self.nodes[FED].start() - self.simulator.go(WAIT_ATTACH + REG_DELAY + WAIT_REDUNDANCE) - self.assertEqual(self.nodes[FED].get_state(), 'child') - - # Bring up MED - self.nodes[MED].start() - self.simulator.go(WAIT_ATTACH + config.PARENT_AGGREGATIOIN_DELAY + REG_DELAY + WAIT_REDUNDANCE) - self.assertEqual(self.nodes[MED].get_state(), 'child') - - self._verify_dua_handle_address_error(ROUTER) - self._verify_dua_handle_address_error(FED) - self._verify_dua_handle_address_error(MED, is_med=True) - - def _verify_dua_handle_address_error(self, nodeid, is_med=False): - dua = self.nodes[nodeid].get_addr(config.DOMAIN_PREFIX) - self.assertIsNotNone(dua) - - # Ping the DUA to verify reachability, and also fill the EID cache on BBR_1 - self.assertTrue(self.nodes[BBR_1].ping(dua)) - - self.simulator.go(WAIT_REDUNDANCE) - - # Send fake /a/an from ROUTER to BBR_1 for the node's DUA - pbbr_rloc = self.nodes[BBR_1].get_ip6_address(config.ADDRESS_TYPE.RLOC) - self.nodes[ROUTER].send_address_notification(pbbr_rloc, dua, f'000000000000{nodeid:04x}') - - self.simulator.go(config.PARENT_AGGREGATIOIN_DELAY * is_med + REG_DELAY + WAIT_REDUNDANCE + 50) - - # Make sure device handles /a/ae correctly by generating new DUA - new_dua = self.nodes[nodeid].get_addr(config.DOMAIN_PREFIX) - self.assertNotEqual(dua, new_dua) - self.assertTrue(self.nodes[BBR_1].ping(new_dua)) - self.assertFalse(self.nodes[BBR_1].ping(dua)) - - self.simulator.go(3) - - -if __name__ == '__main__': - unittest.main() diff --git a/tools/harness-simulation/posix/config.yml b/tools/harness-simulation/posix/config.yml index 11b29bca5..84548bd9b 100644 --- a/tools/harness-simulation/posix/config.yml +++ b/tools/harness-simulation/posix/config.yml @@ -20,7 +20,6 @@ ot_build: - "-DOPENTHREAD_CONFIG_IP6_MAX_EXT_MCAST_ADDRS=8" options: - "-DOT_REFERENCE_DEVICE=ON" - - "-DOT_DUA=ON" - "-DOT_MLR=ON" - "-DOT_COMMISSIONER=ON" - "-DOT_JOINER=ON" @@ -35,7 +34,6 @@ ot_build: - "-DOPENTHREAD_CONFIG_IP6_MAX_EXT_MCAST_ADDRS=8" options: - "-DOT_REFERENCE_DEVICE=ON" - - "-DOT_DUA=ON" - "-DOT_MLR=ON" - "-DOT_COMMISSIONER=ON" - "-DOT_JOINER=ON" @@ -57,7 +55,6 @@ ot_build: - OT_COMMISSIONER=1 options: - "-DOTBR_DUA_ROUTING=ON" - - "-DOT_DUA=ON" - "-DOT_MLR=ON" rcp_subpath: build/ot12/simulation rcp_options: @@ -76,7 +73,6 @@ ot_build: - EXTERNAL_COMMISSIONER=1 options: - "-DOTBR_DUA_ROUTING=ON" - - "-DOT_DUA=ON" - "-DOT_MLR=ON" rcp_subpath: build/ot13/simulation rcp_options: diff --git a/tools/otci/otci/otci.py b/tools/otci/otci/otci.py index 538636373..1c76cec94 100644 --- a/tools/otci/otci/otci.py +++ b/tools/otci/otci/otci.py @@ -2594,23 +2594,6 @@ class OTCI(object): """Set the Thread Domain Name for Thread 1.2 device.""" self.execute_command(f'domainname {self.__escape_escapable(name)}') - def get_dua_iid(self) -> str: - """Get the DUA IID for Thread 1.2 device.""" - raw_iid = self.execute_command('dua iid') - if raw_iid: - return self.__parse_iid(raw_iid) - else: - return '' - - def set_dua_iid(self, iid: str): - """Set the DUA IID for Thread 1.2 device.""" - self.__validate_iid(iid) - self.execute_command(f'dua iid {iid}') - - def clear_dua_iid(self): - """Clear the DUA IID for Thread 1.2 device.""" - self.execute_command('dua iid clear') - # TODO: mlr reg ... [timeout] # diff --git a/tools/otci/tests/test_otci.py b/tools/otci/tests/test_otci.py index 5bdbb9dde..74504e14f 100644 --- a/tools/otci/tests/test_otci.py +++ b/tools/otci/tests/test_otci.py @@ -135,10 +135,6 @@ class TestOTCI(unittest.TestCase): self.assertEqual('fd00:dba::/64', leader.get_mesh_local_prefix()) leader.set_mesh_local_prefix(TEST_MESH_LOCAL_PREFIX + '/64') leader.set_ml_iid('b1a5ed57a71571c5') - leader.set_dua_iid('ad4a011dad4a011d') - self.assertEqual('ad4a011dad4a011d', leader.get_dua_iid()) - leader.clear_dua_iid() - self.assertEqual('', leader.get_dua_iid()) self.assertFalse(leader.get_ifconfig_state()) # ifconfig up