From 71bd792d27716f65975db9d3f9e3acd3c2be3d89 Mon Sep 17 00:00:00 2001 From: Marcos Boyington <15697303+gmarcosb@users.noreply.github.com> Date: Tue, 27 Jan 2026 16:17:30 -0700 Subject: [PATCH 1/4] Fix chip-tool build breakage caused by openthread build failure --- third_party/ot-commissioner/BUILD.gn | 1 + 1 file changed, 1 insertion(+) diff --git a/third_party/ot-commissioner/BUILD.gn b/third_party/ot-commissioner/BUILD.gn index 47d0308790d8e1..0847a2f2c898ac 100644 --- a/third_party/ot-commissioner/BUILD.gn +++ b/third_party/ot-commissioner/BUILD.gn @@ -57,6 +57,7 @@ static_library("ot-commissioner") { "repo/third_party/COSE-C/repo/include", "repo/third_party/googletest/repo/googletest/include", "repo/third_party/json/repo/single_include", + "repo/third_party/libevent/repo/include", "repo/third_party/mbedtls/repo/include", "repo/third_party/mdns/repo/include", ] From 749ce72a069b4c4a00a9089369165a9f670cdf96 Mon Sep 17 00:00:00 2001 From: Marcos Boyington <15697303+gmarcosb@users.noreply.github.com> Date: Thu, 5 Feb 2026 12:32:16 -0700 Subject: [PATCH 2/4] Revert "Fix chip-tool build breakage caused by openthread build failure" This reverts commit d8ab9ded4324abb13a29aa318ce18b2216532c7e. --- third_party/ot-commissioner/BUILD.gn | 1 - 1 file changed, 1 deletion(-) diff --git a/third_party/ot-commissioner/BUILD.gn b/third_party/ot-commissioner/BUILD.gn index 0847a2f2c898ac..47d0308790d8e1 100644 --- a/third_party/ot-commissioner/BUILD.gn +++ b/third_party/ot-commissioner/BUILD.gn @@ -57,7 +57,6 @@ static_library("ot-commissioner") { "repo/third_party/COSE-C/repo/include", "repo/third_party/googletest/repo/googletest/include", "repo/third_party/json/repo/single_include", - "repo/third_party/libevent/repo/include", "repo/third_party/mbedtls/repo/include", "repo/third_party/mdns/repo/include", ] From 741eb1bb23c8477ae1665f61f4e1a3d1243365f1 Mon Sep 17 00:00:00 2001 From: Marcos Boyington <15697303+gmarcosb@users.noreply.github.com> Date: Tue, 27 Jan 2026 16:17:30 -0700 Subject: [PATCH 3/4] Fix chip-tool build breakage caused by openthread build failure --- third_party/ot-commissioner/BUILD.gn | 1 + 1 file changed, 1 insertion(+) diff --git a/third_party/ot-commissioner/BUILD.gn b/third_party/ot-commissioner/BUILD.gn index 47d0308790d8e1..0847a2f2c898ac 100644 --- a/third_party/ot-commissioner/BUILD.gn +++ b/third_party/ot-commissioner/BUILD.gn @@ -57,6 +57,7 @@ static_library("ot-commissioner") { "repo/third_party/COSE-C/repo/include", "repo/third_party/googletest/repo/googletest/include", "repo/third_party/json/repo/single_include", + "repo/third_party/libevent/repo/include", "repo/third_party/mbedtls/repo/include", "repo/third_party/mdns/repo/include", ] From 9e6ab8a79d4d3040d3411630c251046b4d303b2b Mon Sep 17 00:00:00 2001 From: Marcos Boyington <15697303+gmarcosb@users.noreply.github.com> Date: Wed, 4 Mar 2026 14:54:11 -0700 Subject: [PATCH 4/4] Continue work from #42841 to get OTNS to work such that chip-tool can provision directly through OTNS --- .github/workflows/build.yaml | 33 ++++++++++++ .gitmodules | 4 ++ .../all-clusters-app/linux/AppOptions.cpp | 33 ++++++++++++ examples/chip-tool/args.gni | 19 +++++++ .../chip-tool/commands/common/Command.cpp | 9 ++++ examples/platform/linux/AppMain.cpp | 22 +++++--- examples/platform/linux/BUILD.gn | 12 ++++- examples/platform/linux/Options.cpp | 15 +++--- examples/platform/linux/Options.h | 2 +- scripts/build/build/targets.py | 1 + scripts/build/builders/host.py | 16 +++++- .../build/testdata/all_targets_linux_x64.txt | 2 +- scripts/tests/chiptest/runner.py | 4 +- scripts/tests/chiptest/test_definition.py | 41 ++++++-------- scripts/tests/local.py | 9 ++++ scripts/tests/requirements.txt | 1 + scripts/tests/run_test_suite.py | 20 ++++--- .../ThreadMeshcopCommissionProxy.cpp | 4 ++ src/platform/BUILD.gn | 1 + src/platform/Linux/BUILD.gn | 11 ++-- src/platform/device.gni | 1 - .../matter/testing/linux/thread.py | 39 ++++++++++++-- .../matter/testing/tasks.py | 7 +++ src/system/BUILD.gn | 3 ++ src/system/SystemLayerImplSelect.cpp | 2 +- src/system/system.gni | 3 ++ .../openthread/platforms/otns/BUILD.gn | 54 +++++++++++++++++++ third_party/ot-commissioner/BUILD.gn | 12 +++-- 28 files changed, 314 insertions(+), 66 deletions(-) create mode 100644 third_party/openthread/platforms/otns/BUILD.gn diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index df54c7f10a6e6f..7cd3dde21f6d1c 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -333,6 +333,39 @@ jobs: # # objdirs are big; don't hold on to them too long. # retention-days: 5 + build_linux_otns: + name: Build on Linux (otns) + + runs-on: ubuntu-latest + if: github.actor != 'restyled-io[bot]' && inputs.run-codeql != true + + container: + image: ghcr.io/project-chip/chip-build:181 + + steps: + - name: Dump GitHub context + env: + GITHUB_CONTEXT: ${{ toJSON(github) }} + run: echo "$GITHUB_CONTEXT" + - name: Dump Concurrency context + env: + CONCURRENCY_CONTEXT: ${{ github.ref }}-${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.event.number) || (github.event_name == 'workflow_dispatch' && github.run_number) || github.sha }} + run: echo "$CONCURRENCY_CONTEXT" + - name: Checkout + uses: actions/checkout@v5 + - name: Checkout submodules & Bootstrap + uses: ./.github/actions/checkout-submodules-and-bootstrap + with: + platform: linux + + - name: Setup Build, Run Build and Run Tests + run: | + scripts/run_in_build_env.sh \ + "./scripts/build/build_examples.py \ + --target linux-x64-all-clusters-no-wifi-openthread-endpoint-otns-clang \ + build + " + build_linux_python_lib: name: Build on Linux (python_lib) diff --git a/.gitmodules b/.gitmodules index 4ffcf389e34504..23a60dee75a76b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -335,6 +335,10 @@ url = https://github.com/openthread/ot-commissioner.git platforms = linux recursive = true +[submodule "third_party/ot-ns/repo"] + path = third_party/ot-ns/repo + url = https://github.com/openthread/ot-ns.git + platforms = linux [submodule "third_party/uriparser/repo"] path = third_party/uriparser/repo url = https://github.com/uriparser/uriparser.git diff --git a/examples/all-clusters-app/linux/AppOptions.cpp b/examples/all-clusters-app/linux/AppOptions.cpp index 63102668f5cc61..d9aaec7fd9ec4b 100644 --- a/examples/all-clusters-app/linux/AppOptions.cpp +++ b/examples/all-clusters-app/linux/AppOptions.cpp @@ -24,6 +24,10 @@ #include #include +#if CHIP_ENABLE_OTNS +#include +#endif + #include using namespace chip::ArgParser; @@ -44,6 +48,34 @@ constexpr uint16_t kOptionCrashFilePath = 0xFF05; constexpr uint16_t kOptionUseMockClock = 0xFF06; namespace { +#if CHIP_ENABLE_OTNS +struct MockClock : public ClockBase +{ +public: + MockClock() : mRealClock(SystemClock()) { Clock::Internal::SetSystemClockForTesting(this); } + ~MockClock() { Clock::Internal::SetSystemClockForTesting(&mRealClock); } + + void SetUTCTime(Microseconds64 aOverride) { } + + Microseconds64 GetMonotonicMicroseconds64() override { return Microseconds64(otPlatTimeGet()); } + Milliseconds64 GetMonotonicMilliseconds64() override { return std::chrono::duration_cast(Microseconds64(otPlatTimeGet())); } + + CHIP_ERROR GetClock_RealTime(Microseconds64 & aCurTime) override + { + aCurTime = Microseconds64(otPlatTimeGet()); + return CHIP_NO_ERROR; + } + CHIP_ERROR GetClock_RealTimeMS(Milliseconds64 & aCurTime) override + { + aCurTime = std::chrono::duration_cast(Microseconds64(otPlatTimeGet())); + return CHIP_NO_ERROR; + } + CHIP_ERROR SetClock_RealTime(Microseconds64 aNewCurTime) override { return CHIP_ERROR_NOT_IMPLEMENTED; } + +private: + ClockBase & mRealClock; +}; +#else struct MockClock : public ClockBase { private: @@ -95,6 +127,7 @@ struct MockClock : public ClockBase ClockBase & mRealClock; Offset mOffset; }; +#endif } // namespace diff --git a/examples/chip-tool/args.gni b/examples/chip-tool/args.gni index 9c163f1cabd2b1..b22a29e4a315c1 100644 --- a/examples/chip-tool/args.gni +++ b/examples/chip-tool/args.gni @@ -31,4 +31,23 @@ matter_log_json_payload_decode_full = true # make chip-tool very strict by default chip_tlv_validate_char_string_on_read = true chip_tlv_validate_char_string_on_write = true + +_openthread_config_file = + rebase_path( + get_path_info("${chip_root}/third_party/openthread/openthread-config.h", + "abspath")) +openthread_config_file = "\"$_openthread_config_file\"" +openthread_config_ecdsa_enable = true +openthread_config_ip6_slaac_enable = true +openthread_config_full_logs = true +openthread_config_joiner_enable = true +openthread_config_log_output = "platform_defined" +openthread_config_srp_client_enable = true +openthread_config_tcp_enable = false +openthread_config_tmf_netdata_service_enable = true +openthread_enable_core_config_args = true +openthread_project_core_config_file = rebase_path( + get_path_info( + "${chip_root}/third_party/openthread/repo/examples/platforms/simulation/openthread-core-simulation-config.h", + "abspath")) chip_support_thread_meshcop = true diff --git a/examples/chip-tool/commands/common/Command.cpp b/examples/chip-tool/commands/common/Command.cpp index b3bcb1321a0694..85b6486f8f12b3 100644 --- a/examples/chip-tool/commands/common/Command.cpp +++ b/examples/chip-tool/commands/common/Command.cpp @@ -181,6 +181,7 @@ static bool ParseAddressWithInterface(const char * addressString, Command::Addre return false; } +#if CHIP_SYSTEM_CONFIG_USE_SOCKETS || CHIP_SYSTEM_CONFIG_USE_NETWORK_FRAMEWORK if (result->ai_family == AF_INET6) { struct sockaddr_in6 * addr = reinterpret_cast(result->ai_addr); @@ -201,6 +202,14 @@ static bool ParseAddressWithInterface(const char * addressString, Command::Addre } return true; +#else + if (!::chip::Inet::IPAddress::FromString(addressString, address->address)) + { + return false; + } + address->interfaceId = chip::Inet::InterfaceId::Null(); + return true; +#endif } // The callback should return whether the argument is valid, for the non-null diff --git a/examples/platform/linux/AppMain.cpp b/examples/platform/linux/AppMain.cpp index aa0135e80c9306..5a091c610d8e49 100644 --- a/examples/platform/linux/AppMain.cpp +++ b/examples/platform/linux/AppMain.cpp @@ -16,7 +16,9 @@ * limitations under the License. */ +#include #include +#include #include #include @@ -153,6 +155,7 @@ #include #include #include +extern "C" void otAppCliInit(otInstance * aInstance); #endif using namespace chip; @@ -257,7 +260,7 @@ void InitNetworkCommissioning() bool isThreadEnabled = false; #if CHIP_APP_MAIN_HAS_THREAD_DRIVER #if CHIP_SYSTEM_CONFIG_USE_OPENTHREAD_ENDPOINT - isThreadEnabled = LinuxDeviceOptions::GetInstance().mThreadNodeId > 0; + isThreadEnabled = LinuxDeviceOptions::GetInstance().mThreadArgs.size() > 0; #else isThreadEnabled = LinuxDeviceOptions::GetInstance().mThread; #endif @@ -739,15 +742,20 @@ int ChipLinuxAppInit(int argc, char * const argv[], OptionSet * customOptions, #if CHIP_ENABLE_OPENTHREAD #if CHIP_SYSTEM_CONFIG_USE_OPENTHREAD_ENDPOINT - if (LinuxDeviceOptions::GetInstance().mThreadNodeId) + if (LinuxDeviceOptions::GetInstance().mThreadArgs.size()) { - std::string nodeid = std::to_string(LinuxDeviceOptions::GetInstance().mThreadNodeId); - std::string logfile = "--log-file=thread.log"; - char * args[] = { argv[0], logfile.data(), nodeid.data() }; - - otSysInit(MATTER_ARRAY_SIZE(args), args); + std::vector args; + args.push_back(argv[0]); + for (auto & arg : LinuxDeviceOptions::GetInstance().mThreadArgs) + { + args.push_back(arg.data()); + } + otSysInit(static_cast(args.size()), args.data()); SuccessOrExit(err = DeviceLayer::ThreadStackMgrImpl().InitThreadStack()); SuccessOrExit(err = DeviceLayer::ThreadStackMgrImpl().StartThreadTask()); +#if CHIP_ENABLE_OTNS + otAppCliInit(otInstanceGetSingle()); +#endif ChipLogProgress(NotSpecified, "Thread initialized."); } #else diff --git a/examples/platform/linux/BUILD.gn b/examples/platform/linux/BUILD.gn index fefd1ad2e82e48..11dcf27b36fd8d 100644 --- a/examples/platform/linux/BUILD.gn +++ b/examples/platform/linux/BUILD.gn @@ -13,12 +13,14 @@ # limitations under the License. import("//build_overrides/chip.gni") +import("//build_overrides/openthread.gni") import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni") import("${chip_root}/src/app/common_flags.gni") import("${chip_root}/src/app/icd/icd.gni") import("${chip_root}/src/crypto/crypto.gni") import("${chip_root}/src/lib/core/core.gni") import("${chip_root}/src/lib/lib.gni") +import("${chip_root}/src/platform/device.gni") import("${chip_root}/src/system/system.gni") import("${chip_root}/src/tracing/tracing_args.gni") @@ -253,7 +255,15 @@ source_set("app-main") { ] if (chip_system_config_use_openthread_inet_endpoints) { - deps += [ "${chip_root}/third_party/openthread/platforms/simulation" ] + if (chip_enable_otns) { + deps += [ + "${chip_root}/third_party/openthread:openthread_cli", + "${chip_root}/third_party/openthread/platforms/otns", + "${openthread_root}/examples/apps/cli:cli_uart", + ] + } else { + deps += [ "${chip_root}/third_party/openthread/platforms/simulation" ] + } } public_configs = [ ":app-main-config" ] } diff --git a/examples/platform/linux/Options.cpp b/examples/platform/linux/Options.cpp index 82dbca7f5ef17c..ea9b9b20f73376 100644 --- a/examples/platform/linux/Options.cpp +++ b/examples/platform/linux/Options.cpp @@ -93,6 +93,7 @@ enum kDeviceOption_Command, kDeviceOption_PICS, kDeviceOption_KVS, + kDeviceOption_ThreadArgs, kDeviceOption_InterfaceId, kDeviceOption_AppPipe, kDeviceOption_AppPipeOut, @@ -177,7 +178,7 @@ OptionDef sDeviceOptionDefs[] = { #endif // CHIP_DEVICE_CONFIG_ENABLE_WIFI #if CHIP_ENABLE_OPENTHREAD #if CHIP_SYSTEM_CONFIG_USE_OPENTHREAD_ENDPOINT - { "thread-node-id", kArgumentRequired, kDeviceOption_ThreadNodeId }, + { "thread-args", kArgumentRequired, kDeviceOption_ThreadArgs }, #else { "thread", kNoArgument, kDeviceOption_Thread }, #endif @@ -292,8 +293,8 @@ const char * sDeviceOptionHelp = #if CHIP_ENABLE_OPENTHREAD #if CHIP_SYSTEM_CONFIG_USE_OPENTHREAD_ENDPOINT "\n" - " --thread-node-id \n" - " Enable Thread Simulation with the specified node id.\n" + " --thread-args \n" + " Enable Thread with the specified arguments.\n" #else " --thread\n" " Enable Thread management via ot-agent.\n" @@ -568,12 +569,8 @@ bool HandleOption(const char * aProgram, OptionSet * aOptions, int aIdentifier, #if CHIP_ENABLE_OPENTHREAD #if CHIP_SYSTEM_CONFIG_USE_OPENTHREAD_ENDPOINT - case kDeviceOption_ThreadNodeId: - if (!ParseInt(aValue, LinuxDeviceOptions::GetInstance().mThreadNodeId)) - { - PrintArgError("%s: invalid value specified for Thread node id: %s\n", aProgram, aValue); - retval = false; - } + case kDeviceOption_ThreadArgs: + LinuxDeviceOptions::GetInstance().mThreadArgs.push_back(aValue); break; #else case kDeviceOption_Thread: diff --git a/examples/platform/linux/Options.h b/examples/platform/linux/Options.h index 9c24b473af68c9..52f110df37ea72 100644 --- a/examples/platform/linux/Options.h +++ b/examples/platform/linux/Options.h @@ -59,7 +59,7 @@ struct LinuxDeviceOptions bool mWiFi = false; #if CHIP_ENABLE_OPENTHREAD #if CHIP_SYSTEM_CONFIG_USE_OPENTHREAD_ENDPOINT - uint16_t mThreadNodeId = 0; + std::vector mThreadArgs; #else bool mThread = false; #endif diff --git a/scripts/build/build/targets.py b/scripts/build/build/targets.py index 25005872cadd0d..f1e38628cbc04f 100755 --- a/scripts/build/build/targets.py +++ b/scripts/build/build/targets.py @@ -179,6 +179,7 @@ def BuildHostTarget(): target.AppendModifier("no-wifi", enable_wifi=False) target.AppendModifier("no-thread", enable_thread=False) target.AppendModifier("openthread-endpoint", openthread_endpoint=True) + target.AppendModifier("otns", enable_otns=True) target.AppendModifier('nfc-commission', chip_enable_nfc_based_commissioning=True) target.AppendModifier('no-shell', disable_shell=True) target.AppendModifier( diff --git a/scripts/build/builders/host.py b/scripts/build/builders/host.py index c7050140f7dad1..5600c41ab60c1c 100644 --- a/scripts/build/builders/host.py +++ b/scripts/build/builders/host.py @@ -412,8 +412,9 @@ def __init__(self, root, runner, app: HostApp, board=HostBoard.NATIVE, enable_webrtc=False, terms_and_conditions_required: Optional[bool] = None, chip_enable_nfc_based_commissioning=None, openthread_endpoint=False, - unified=False, + enable_otns=False, chip_enable_endpoint_unique_id: Optional[bool] = None, + unified=False ): """ Construct a host builder. @@ -589,6 +590,19 @@ def __init__(self, root, runner, app: HostApp, board=HostBoard.NATIVE, self.extra_gn_options.append('chip_system_config_use_openthread_inet_endpoints=true') + if enable_otns: + if not openthread_endpoint: + raise Exception("OpenThread EndPoint mode is required") + + # if enable_ble: + # raise Exception("OTNS mode does not support BLE") + + self.extra_gn_options.append('chip_logging_backend="syslog"') + self.extra_gn_options.append('chip_enable_otns=true') + self.extra_gn_options.append('import("//build_overrides/chip.gni")') + self.extra_gn_options.append( + 'openthread_project_core_config_file=rebase_path(get_path_info("${chip_root}/third_party/ot-ns/repo/ot-rfsim/src/openthread-core-rfsim-config.h", "abspath"))') + if self.board == HostBoard.ARM64: if not use_clang: raise Exception("Cross compile only supported using clang") diff --git a/scripts/build/testdata/all_targets_linux_x64.txt b/scripts/build/testdata/all_targets_linux_x64.txt index 112566da4e8db2..d5fd6014d85e4b 100644 --- a/scripts/build/testdata/all_targets_linux_x64.txt +++ b/scripts/build/testdata/all_targets_linux_x64.txt @@ -9,7 +9,7 @@ efr32-{brd2601b,brd2605a,brd2703a,brd2704b,brd2708a,brd2911a,brd4186a,brd4186c,b esp32-{c3devkit,devkitc,m5stack,p4functionev,qemu}-{all-clusters,all-clusters-minimal,all-devices,bridge,energy-gateway,evse,light,lock,ota-provider,ota-requestor,ota-requestor,shell,temperature-measurement,tests,water-heater}[-ipv6only][-rpc][-tracing] genio-lighting-app linux-fake-tests[-asan][-boringssl][-clang][-coverage][-dmalloc][-libfuzzer][-mbedtls][-ossfuzz][-pw-fuzztest][-tsan][-ubsan] -linux-{arm64,x64}-{address-resolve-tool,air-purifier,air-quality-sensor,all-clusters,all-clusters-minimal,all-devices,bridge,camera,camera-controller,chip-cert,chip-tool,closure,contact-sensor,dishwasher,energy-gateway,evse,fabric-admin,fabric-bridge,fabric-sync,java-matter-controller,jf-admin-app,jf-control-app,kotlin-matter-controller,light,light-data-model-no-unique-id,lit-icd,lock,microwave-oven,minmdns,network-manager,ota-provider,ota-requestor,python-bindings,refrigerator,rpc-console,rvc,shell,simulated-app1,simulated-app2,terms-and-conditions,tests,thermostat,tv-app,tv-casting-app,water-heater,water-leak-detector}[-asan][-boringssl][-chip-casting-simplified][-clang][-coverage][-disable-dnssd-tests][-dmalloc][-enable-dnssd-tests][-endpoint-unique-id][-evse-test-event][-googletest][-ipv6only][-libfuzzer][-libnl][-mbedtls][-minmdns-verbose][-nfc-commission][-nlfaultinject][-no-ble][-no-interactive][-no-shell][-no-thread][-no-wifi][-no-wifipaf][-nodeps][-openthread-endpoint][-ossfuzz][-platform-mdns][-pw-fuzztest][-rpc][-same-event-loop][-terms-and-conditions][-test][-tsan][-ubsan][-unified][-webrtc][-with-ui] +linux-{arm64,x64}-{address-resolve-tool,air-purifier,air-quality-sensor,all-clusters,all-clusters-minimal,all-devices,bridge,camera,camera-controller,chip-cert,chip-tool,closure,contact-sensor,dishwasher,energy-gateway,evse,fabric-admin,fabric-bridge,fabric-sync,java-matter-controller,jf-admin-app,jf-control-app,kotlin-matter-controller,light,light-data-model-no-unique-id,lit-icd,lock,microwave-oven,minmdns,network-manager,ota-provider,ota-requestor,python-bindings,refrigerator,rpc-console,rvc,shell,simulated-app1,simulated-app2,terms-and-conditions,tests,thermostat,tv-app,tv-casting-app,water-leak-detector}[-asan][-boringssl][-chip-casting-simplified][-clang][-coverage][-disable-dnssd-tests][-dmalloc][-enable-dnssd-tests][-evse-test-event][-googletest][-ipv6only][-libfuzzer][-libnl][-mbedtls][-minmdns-verbose][-nfc-commission][-nlfaultinject][-no-ble][-no-interactive][-no-shell][-no-thread][-no-wifi][-no-wifipaf][-nodeps][-openthread-endpoint][-ossfuzz][-otns][-platform-mdns][-pw-fuzztest][-rpc][-same-event-loop][-terms-and-conditions][-test][-tsan][-ubsan][-unified][-webrtc][-with-ui] linux-x64-efr32-test-runner[-clang] imx-{all-clusters-app,all-clusters-minimal-app,chip-tool,lighting-app,ota-provider-app,thermostat}[-ele][-release][-trusty] infineon-psoc6-{all-clusters,all-clusters-minimal,light,lock}[-ota][-trustm][-updateimage] diff --git a/scripts/tests/chiptest/runner.py b/scripts/tests/chiptest/runner.py index 5318e552152f49..df5df32dba5352 100644 --- a/scripts/tests/chiptest/runner.py +++ b/scripts/tests/chiptest/runner.py @@ -34,7 +34,7 @@ with python_path.PythonPath('../../../src/python_testing/matter_testing_infrastructure', relative_to=__file__): # Import all symbols used downstream not only those we use ourselves - from matter.testing.tasks import SubprocessInfo, SubprocessKind # noqa: F401 + from matter.testing.tasks import SubprocessInfo, SubprocessKind, ProcessConfigurator # noqa: F401 class LogPipe(threading.Thread): @@ -200,7 +200,7 @@ def RunSubprocess(self, subproc: SubprocessInfo, name: str, wait: bool = True, timeout_seconds: int | None = None, stdin: IO[Any] | None = None) -> tuple[subprocess.Popen[bytes], LogPipe, LogPipe]: cmd = subproc.to_cmd() - log.info('RunSubprocess starting application %s', " ".join(cmd)) + log.error('RunSubprocess starting application %s', " ".join(cmd)) outpipe = LogPipe( logging.DEBUG, capture_delegate=self.capture_delegate, diff --git a/scripts/tests/chiptest/test_definition.py b/scripts/tests/chiptest/test_definition.py index d93565ecdf4790..1110157fb291a3 100644 --- a/scripts/tests/chiptest/test_definition.py +++ b/scripts/tests/chiptest/test_definition.py @@ -30,7 +30,7 @@ from types import MappingProxyType from .accessories import AppsRegister -from .runner import LogPipe, Runner, SubprocessInfo, SubprocessKind +from .runner import LogPipe, Runner, SubprocessInfo, SubprocessKind, ProcessConfigurator log = logging.getLogger(__name__) @@ -40,7 +40,6 @@ TEST_SETUP_QR_CODE = 'MT:-24J042C00KA0648G00' TEST_THREAD_DATASET = '0e08000000000001000000030000104a0300001635060004001fffe0020884fa18779329ac770708fd269658e44aa21a030f4f70656e5468726561642d32386335010228c50c0402a0f7f8051000112233445566778899aabbccddeeff041000112233445566778899aabbccddeeff' - class App: def __init__(self, runner: Runner, subproc: SubprocessInfo): self.process: subprocess.Popen[bytes] | None = None @@ -117,10 +116,10 @@ def waitForApplicationUp(self): assert self.process is not None and self.outpipe is not None, "waitForApplicationUp can be called only after start()" what = ["APP STATUS: Starting event loop"] - if not any(arg.startswith("--thread-node-id=") for arg in self.subproc.args): + if not any(arg.startswith("--thread-args=") for arg in self.subproc.args): what += ["mDNS service published:"] - self.__waitFor(what) + self.__waitFor(what, timeoutInSeconds=300) def waitForMessage(self, message: str, timeoutInSeconds: float = 10): self.__waitFor([message], timeoutInSeconds=timeoutInSeconds) @@ -466,8 +465,7 @@ def Run(self, runner: Runner, apps_register: AppsRegister, subproc_info_repo: Su ble_controller_app: int | None = None, ble_controller_tool: int | None = None, op_network: str = 'WiFi', - thread_ba_host: str | None = None, - thread_ba_port: int | None = None, + thread_config: ProcessConfigurator | None = None ): """ Executes the given test case using the provided runner for execution. @@ -476,7 +474,7 @@ def Run(self, runner: Runner, apps_register: AppsRegister, subproc_info_repo: Su for target in self.targets: log.info('Executing %s::%s', self.name, target.name) self._RunImpl(target, runner, apps_register, subproc_info_repo, pics_file, timeout_seconds, dry_run, - test_runtime, ble_controller_app, ble_controller_tool, op_network, thread_ba_host, thread_ba_port) + test_runtime, ble_controller_app, ble_controller_tool, op_network, thread_config) def _RunImpl(self, target: TestTarget, runner: Runner, apps_register: AppsRegister, subproc_info_repo: SubprocessInfoRepo, pics_file: Path, timeout_seconds: int | None, dry_run: bool = False, @@ -484,8 +482,7 @@ def _RunImpl(self, target: TestTarget, runner: Runner, apps_register: AppsRegist ble_controller_app: int | None = None, ble_controller_tool: int | None = None, op_network: str = 'WiFi', - thread_ba_host: str | None = None, - thread_ba_port: int | None = None): + thread_config: ProcessConfigurator | None = None): runner.capture_delegate = ExecutionCapture() tool_storage_dir = None @@ -508,10 +505,8 @@ def _RunImpl(self, target: TestTarget, runner: Runner, apps_register: AppsRegist subproc = subproc.with_args(arg) if op_network == 'Thread': - # The node id must not conflict with ThreadBorderRouter.NODE_ID - subproc = subproc.with_args("--thread-node-id=2") - - if ble_controller_app is not None: + subproc = thread_config.apply_args(subproc) + elif ble_controller_app is not None: subproc = subproc.with_args("--ble-controller", str(ble_controller_app)) if op_network == 'WiFi': subproc = subproc.with_args("--wifi") @@ -567,18 +562,14 @@ def _RunImpl(self, target: TestTarget, runner: Runner, apps_register: AppsRegist pairing_cmd = subproc_info_repo['chip-tool-with-python'] if ble_controller_tool is not None: - if op_network == 'WiFi': - pairing_cmd = pairing_cmd.with_args( - "pairing", "code-wifi", TEST_NODE_ID, "MatterAP", "MatterAPPassword", TEST_SETUP_QR_CODE) - pairing_server_args = ["--ble-controller", str(ble_controller_tool)] - elif op_network == 'Thread': - pairing_cmd = pairing_cmd.with_args( - "pairing", "code-thread", TEST_NODE_ID, f"hex:{TEST_THREAD_DATASET}", TEST_SETUP_QR_CODE) - pairing_server_args = ["--ble-controller", str(ble_controller_tool)] - elif op_network == 'Thread' and thread_ba_host is not None and thread_ba_port is not None: + pairing_server_args = ["--ble-controller", str(ble_controller_tool)] + + if op_network == 'WiFi': pairing_cmd = pairing_cmd.with_args( - "pairing", "thread-meshcop", TEST_NODE_ID, f"hex:{TEST_THREAD_DATASET}", setupCode, - "--thread-ba-host", thread_ba_host, "--thread-ba-port", str(thread_ba_port)) + "pairing", "code-wifi", TEST_NODE_ID, "MatterAP", "MatterAPPassword", TEST_SETUP_QR_CODE) + elif op_network == 'Thread': + pairing_cmd = thread_config.apply_pairing_args(pairing_cmd.with_args( + "pairing", "code-thread", TEST_NODE_ID, f"hex:{TEST_THREAD_DATASET}", TEST_SETUP_QR_CODE)) else: pairing_cmd = pairing_cmd.with_args('pairing', 'code', TEST_NODE_ID, setupCode) @@ -599,6 +590,8 @@ def _RunImpl(self, target: TestTarget, runner: Runner, apps_register: AppsRegist pairing_cmd = pairing_cmd.with_args(*server_args) test_cmd = test_cmd.with_args(*server_args) + log.error("Pairing command: %s", shlex.join(pairing_cmd.to_cmd())) + log.error("Testcase command: %s", shlex.join(test_cmd.to_cmd())) if dry_run: log.info("Pairing command: %s", shlex.join(pairing_cmd.to_cmd())) log.info("Testcase command: %s", shlex.join(test_cmd.to_cmd())) diff --git a/scripts/tests/local.py b/scripts/tests/local.py index 36e44c145903e9..edb1ab021cb825 100755 --- a/scripts/tests/local.py +++ b/scripts/tests/local.py @@ -162,6 +162,15 @@ def _get_targets(coverage: Optional[bool]) -> list[ApplicationTarget]: binary="chip-all-clusters-app", ) ) + targets.append( + ApplicationTarget( + kind=SubprocessKind.APP, + env_key="ALL_CLUSTERS_THREAD_APP", + cli_key="all-clusters", + target=f"{target_prefix}-all-clusters-no-wifi-openthread-endpoint-{suffix}", + binary="chip-all-clusters-app", + ) + ) targets.append( ApplicationTarget( kind=SubprocessKind.APP, diff --git a/scripts/tests/requirements.txt b/scripts/tests/requirements.txt index 0289e0117f9b34..25423a6c2f5500 100644 --- a/scripts/tests/requirements.txt +++ b/scripts/tests/requirements.txt @@ -12,3 +12,4 @@ tabulate -e ${PW_PROJECT_ROOT}/scripts/py_matter_idl -e ${PW_PROJECT_ROOT}/scripts/py_matter_yamltests +-e ${PW_PROJECT_ROOT}/third_party/ot-ns/repo/pylibs \ No newline at end of file diff --git a/scripts/tests/run_test_suite.py b/scripts/tests/run_test_suite.py index 72788cc5a4d1b7..4e2de4e3d1c13d 100755 --- a/scripts/tests/run_test_suite.py +++ b/scripts/tests/run_test_suite.py @@ -18,6 +18,7 @@ import logging import os import random +import shlex import sys import time import warnings @@ -406,7 +407,7 @@ def terminate(self) -> None: ... help='Number of tests that are expected to fail in each iteration. Overall test will pass if the number of failures matches this. Nonzero values require --keep-going') @click.option( '--commissioning-method', - type=click.Choice(['on-network', 'ble-wifi', 'ble-thread', 'thread-meshcop'], case_sensitive=False), + type=click.Choice(['on-network', 'ble-wifi', 'ble-thread', 'otns-meshcop', 'thread-meshcop'], case_sensitive=False), default='on-network', help='Commissioning method to use. "on-network" is the default one available on all platforms, "ble-wifi" performs BLE-WiFi commissioning using Bluetooth and WiFi mock servers. "ble-thread" performs BLE-Thread commissioning using Bluetooth and Thread mock servers. "thread-meshcop" performs Thread commissioning using Thread mock server. This option is Linux-only.') @click.pass_context @@ -491,7 +492,7 @@ def handle_deprecated_pathopt(key, path, kind): # Derive boolean flags from commissioning_method parameter wifi_required = commissioning_method in ['ble-wifi'] - thread_required = commissioning_method in ['ble-thread', 'thread-meshcop'] + thread_required = commissioning_method in ['ble-thread', 'thread-meshcop', 'otns-meshcop'] if (wifi_required or thread_required) and sys.platform != "linux": raise click.BadOptionUsage("commissioning-method", @@ -532,13 +533,17 @@ def cleanup() -> None: elif commissioning_method == 'ble-thread': to_terminate.append(chiptest.linux.DBusTestSystemBus()) to_terminate.append(chiptest.linux.BluetoothMock()) - to_terminate.append(chiptest.linux.ThreadBorderRouter(TEST_THREAD_DATASET, ns)) + thread_config = chiptest.linux.ThreadBorderRouter(TEST_THREAD_DATASET, ns) + to_terminate.append(thread_config) ble_controller_app = 0 # Bind app to the first BLE controller ble_controller_tool = 1 # Bind tool to the second BLE controller elif commissioning_method == 'thread-meshcop': - to_terminate.append(tbr := chiptest.linux.ThreadBorderRouter(TEST_THREAD_DATASET, ns)) - thread_ba_host = tbr.get_border_agent_host() - thread_ba_port = tbr.get_border_agent_port() + thread_config = chiptest.linux.ThreadBorderRouter(TEST_THREAD_DATASET, ns, True) + to_terminate.append(thread_config) + elif commissioning_method == 'otns-meshcop': + subproc_info_repo.require('otns') + thread_config = chiptest.linux.ThreadOtns(shlex.join(subproc_info_repo['otns'].to_cmd())) + to_terminate.append(thread_config) to_terminate.append(executor := chiptest.linux.LinuxNamespacedExecutor(ns)) elif sys.platform == 'darwin': @@ -571,8 +576,7 @@ def cleanup() -> None: ble_controller_app=ble_controller_app, ble_controller_tool=ble_controller_tool, op_network='Thread' if thread_required else 'WiFi', - thread_ba_host=thread_ba_host, - thread_ba_port=thread_ba_port, + thread_config=thread_config ) if not dry_run: test_end = time.monotonic() diff --git a/src/controller/ThreadMeshcopCommissionProxy.cpp b/src/controller/ThreadMeshcopCommissionProxy.cpp index 202b8da6884f86..2f7622e38ed814 100644 --- a/src/controller/ThreadMeshcopCommissionProxy.cpp +++ b/src/controller/ThreadMeshcopCommissionProxy.cpp @@ -182,6 +182,7 @@ void ThreadMeshcopCommissionProxy::OnResource(mdns::Minimal::ResourceType sectio CHIP_ERROR ThreadMeshcopCommissionProxy::CreateProxySocket(chip::Dnssd::CommissionNodeData & commissionData) { +#if CHIP_SYSTEM_CONFIG_USE_SOCKETS || CHIP_SYSTEM_CONFIG_USE_NETWORK_FRAMEWORK mProxyFd = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP); VerifyOrReturnError(mProxyFd >= 0, CHIP_ERROR_POSIX(errno)); @@ -212,6 +213,9 @@ CHIP_ERROR ThreadMeshcopCommissionProxy::CreateProxySocket(chip::Dnssd::Commissi ChipLogProgress(Controller, "Proxy socket created on port %u", commissionData.port); return CHIP_NO_ERROR; +#else + return CHIP_ERROR_NOT_IMPLEMENTED; +#endif } void ThreadMeshcopCommissionProxy::OnRecord(const mdns::Minimal::BytesRange & name, const mdns::Minimal::BytesRange & value) diff --git a/src/platform/BUILD.gn b/src/platform/BUILD.gn index ac4c1160e070b7..9c9e182dbfdf72 100644 --- a/src/platform/BUILD.gn +++ b/src/platform/BUILD.gn @@ -154,6 +154,7 @@ if (chip_device_platform != "none" && chip_device_platform != "external") { "CHIP_DEVICE_CONFIG_ENABLE_DYNAMIC_MRP_CONFIG=${chip_device_config_enable_dynamic_mrp_config}", "CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF=${chip_device_config_enable_wifipaf}", "CHIP_DEVICE_CONFIG_ENABLE_THREAD_MESHCOP=${chip_device_config_enable_thread_meshcop}", + "CHIP_ENABLE_OTNS=${chip_enable_otns}", ] _enable_joint_fabric = chip_device_config_enable_joint_fabric diff --git a/src/platform/Linux/BUILD.gn b/src/platform/Linux/BUILD.gn index f37843412582f4..fd59fba99a92e7 100644 --- a/src/platform/Linux/BUILD.gn +++ b/src/platform/Linux/BUILD.gn @@ -220,10 +220,13 @@ static_library("Linux") { "ThreadStackManagerImpl_OpenThread.h", ] - deps += [ - "${chip_root}/src/app:app_config", - "${chip_root}/third_party/openthread/platforms/simulation", - ] + deps += [ "${chip_root}/src/app:app_config" ] + + if (chip_enable_otns) { + deps += [ "${chip_root}/third_party/openthread/platforms/otns" ] + } else { + deps += [ "${chip_root}/third_party/openthread/platforms/simulation" ] + } if (chip_mdns == "platform") { sources += [ diff --git a/src/platform/device.gni b/src/platform/device.gni index 9cdc2b8fc98f91..151b3f20a1c5df 100644 --- a/src/platform/device.gni +++ b/src/platform/device.gni @@ -52,7 +52,6 @@ declare_args() { # DEPRECATED: Use 'chip_enable_thread' instead. chip_enable_openthread = "DEPRECATED" - # Enable openthread support. chip_enable_thread = chip_device_platform == "linux" || chip_device_platform == "qpg" || chip_device_platform == "cc13x4_26x4" || diff --git a/src/python_testing/matter_testing_infrastructure/matter/testing/linux/thread.py b/src/python_testing/matter_testing_infrastructure/matter/testing/linux/thread.py index 6d7d858025370f..0b2e9752c905e7 100644 --- a/src/python_testing/matter_testing_infrastructure/matter/testing/linux/thread.py +++ b/src/python_testing/matter_testing_infrastructure/matter/testing/linux/thread.py @@ -20,25 +20,27 @@ import subprocess import threading from typing import Optional, Pattern +from otns.cli import OTNS -from matter.testing.tasks import SubprocessKind +from matter.testing.tasks import SubprocessKind, ProcessConfigurator from .namespace import IsolatedNetworkNamespace log = logging.getLogger(__name__) -class ThreadBorderRouter: +class ThreadBorderRouter(ProcessConfigurator): # The Thread radio simulation node id, choose other if there is a conflict. NODE_ID = 9 - def __init__(self, dataset: str, ns: IsolatedNetworkNamespace): + def __init__(self, dataset: str, ns: IsolatedNetworkNamespace, meshcop: bool = False): self._event = threading.Event() self._pattern: Optional[Pattern[str]] = None self._event.set() self._netns_app = ns.netns_for_subprocess_kind(SubprocessKind.APP) self._link_name_app = ns.app_link.name + self._meshcop = meshcop radio_url = f'spinel+hdlc+forkpty:///usr/bin/env?forkpty-arg=ot-rcp&forkpty-arg={self.NODE_ID}' cmd = self._netns_app.wrap_cmd(['otbr-agent', '-d7', '-v', f'-B{self._link_name_app}', radio_url]) @@ -107,3 +109,34 @@ def terminate(self): if self._otbr: self._otbr.terminate() self._otbr.wait() + + def apply_args(self, process: SubprocessInfo) -> SubprocessInfo: + return process.with_args("--thread-args=2") + + def apply_pairing_args(self, process: SubprocessInfo) -> SubprocessInfo: + if self._meshcop: + return process.with_args("pairing", "thread-meshcop", "--thread-ba-host", self.get_border_agent_host(), "--thread-ba-port", str(self.get_border_agent_port())) + else: + return process.with_args("pairing", "code-thread") + +class ThreadOtns(ProcessConfigurator): + + # The Thread radio simulation node id, choose other if there is a conflict. + NODE_ID = 9 + RANDOM_SEED = 20242025 + + def __init__(self, otns_path: str): + self._otns = OTNS(otns_args=['autogo=true', '-seed', str(ThreadOtns.RANDOM_SEED)], otns_path=otns_path) + + def terminate(self): + if self._otns: + self._otns.close() + + def apply_args(self, process: SubprocessInfo) -> SubprocessInfo: + socket = self._otns.get_otns_socket() + process = process.with_args("--thread-args=2") + process = process.with_args(f"--thread-args={socket}") + return process.with_args(f"--thread-args={ThreadOtns.RANDOM_SEED}") + + def apply_pairing_args(self, process: SubprocessInfo) -> SubprocessInfo: + return process.with_args("pairing", "thread-meshcop", "--thread-ba-host", self.get_border_agent_host(), "--thread-ba-port", str(self.get_border_agent_port())) diff --git a/src/python_testing/matter_testing_infrastructure/matter/testing/tasks.py b/src/python_testing/matter_testing_infrastructure/matter/testing/tasks.py index fc9196234b0e7c..8cc776adfa1f19 100644 --- a/src/python_testing/matter_testing_infrastructure/matter/testing/tasks.py +++ b/src/python_testing/matter_testing_infrastructure/matter/testing/tasks.py @@ -208,3 +208,10 @@ def wait(self, timeout: Optional[float] = None) -> Optional[int]: """Wait for the subprocess to finish.""" self.join(timeout) return self.returncode + +class ProcessConfigurator: + def apply_args(self, process: SubprocessInfo) -> SubprocessInfo: + return process + + def apply_pairing_args(self, process: SubprocessInfo) -> SubprocessInfo: + return process \ No newline at end of file diff --git a/src/system/BUILD.gn b/src/system/BUILD.gn index 60cadb9803f18a..9c62d1a1d80e5f 100644 --- a/src/system/BUILD.gn +++ b/src/system/BUILD.gn @@ -26,6 +26,9 @@ import("system.gni") assert(chip_enable_thread || !chip_system_config_use_openthread_inet_endpoints, "OpenThread Endpoint is only available when Thread is enabled") +assert(!chip_enable_otns || chip_system_config_use_openthread_inet_endpoints, + "OTNS requires chip_system_config_use_openthread_inet_endpoints to be true") + if (chip_system_config_use_lwip) { import("//build_overrides/lwip.gni") } diff --git a/src/system/SystemLayerImplSelect.cpp b/src/system/SystemLayerImplSelect.cpp index 7db76152bfd0b1..9b9948416408c9 100644 --- a/src/system/SystemLayerImplSelect.cpp +++ b/src/system/SystemLayerImplSelect.cpp @@ -588,7 +588,7 @@ void LayerImplSelect::PrepareEvents() FD_ZERO(&mSelected.mErrorSet); // NOLINTEND(clang-analyzer-security.insecureAPI.bzero) -#if !CHIP_SYSTEM_CONFIG_USE_LIBEV +#if !CHIP_SYSTEM_CONFIG_USE_LIBEV && !CHIP_ENABLE_OTNS /* Only OTNS should wake */ FD_SET(mWakeEvent.GetReadFD(), &mSelected.mReadSet); mMaxFd = mWakeEvent.GetReadFD(); #endif diff --git a/src/system/system.gni b/src/system/system.gni index bf3de9f44d766c..90acdd195da378 100644 --- a/src/system/system.gni +++ b/src/system/system.gni @@ -34,6 +34,9 @@ declare_args() { # Use OpenThread TCP/UDP stack directly chip_system_config_use_openthread_inet_endpoints = false + + # Enable openthread support. + chip_enable_otns = false } declare_args() { diff --git a/third_party/openthread/platforms/otns/BUILD.gn b/third_party/openthread/platforms/otns/BUILD.gn new file mode 100644 index 00000000000000..0916eb3d2c1951 --- /dev/null +++ b/third_party/openthread/platforms/otns/BUILD.gn @@ -0,0 +1,54 @@ +# Copyright (c) 2026 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build_overrides/chip.gni") +import("//build_overrides/openthread.gni") + +static_library("otns") { + include_dirs = [ "${chip_root}/third_party/ot-ns/repo/ot-rfsim/src" ] + + public = [ + "${openthread_root}/examples/platforms/openthread-select.h", + "${openthread_root}/examples/platforms/openthread-system.h", + ] + + sources = [ + "${chip_root}/third_party/ot-ns/repo/ot-rfsim/src/alarm.c", + "${chip_root}/third_party/ot-ns/repo/ot-rfsim/src/ble.c", + "${chip_root}/third_party/ot-ns/repo/ot-rfsim/src/crypto.c", + "${chip_root}/third_party/ot-ns/repo/ot-rfsim/src/diag.c", + "${chip_root}/third_party/ot-ns/repo/ot-rfsim/src/dso_transport.c", + "${chip_root}/third_party/ot-ns/repo/ot-rfsim/src/entropy.c", + "${chip_root}/third_party/ot-ns/repo/ot-rfsim/src/event-sim.c", + "${chip_root}/third_party/ot-ns/repo/ot-rfsim/src/flash.c", + "${chip_root}/third_party/ot-ns/repo/ot-rfsim/src/infra_if.c", + "${chip_root}/third_party/ot-ns/repo/ot-rfsim/src/logging.c", + "${chip_root}/third_party/ot-ns/repo/ot-rfsim/src/misc.c", + "${chip_root}/third_party/ot-ns/repo/ot-rfsim/src/platform-rfsim.c", + "${chip_root}/third_party/ot-ns/repo/ot-rfsim/src/platform-rfsim.cpp", + "${chip_root}/third_party/ot-ns/repo/ot-rfsim/src/radio.c", + "${chip_root}/third_party/ot-ns/repo/ot-rfsim/src/system.c", + "${chip_root}/third_party/ot-ns/repo/ot-rfsim/src/trel.c", + "${chip_root}/third_party/ot-ns/repo/ot-rfsim/src/uart.c", + "${openthread_root}/src/lib/platform/exit_code.c", + "${openthread_root}/src/lib/platform/exit_code.h", + ] + + deps = [ + "${openthread_root}/src/core:libopenthread_core_headers", + "..:libopenthread-platform-utils", + ] + + public_configs = [ "..:libopenthread-platform_config" ] +} \ No newline at end of file diff --git a/third_party/ot-commissioner/BUILD.gn b/third_party/ot-commissioner/BUILD.gn index 0847a2f2c898ac..7f82a957bef8e7 100644 --- a/third_party/ot-commissioner/BUILD.gn +++ b/third_party/ot-commissioner/BUILD.gn @@ -16,6 +16,7 @@ import("//build_overrides/build.gni") import("//build_overrides/chip.gni") import("${build_root}/config/compiler/compiler.gni") import("${chip_root}/third_party/mbedtls/mbedtls3.gni") +import("${chip_root}/src/system/system.gni") mbedtls3_target("ot_commissioner_mbedtls") { mbedtls_root = "repo/third_party/mbedtls/repo" @@ -38,7 +39,6 @@ config("public") { static_library("ot-commissioner") { configs += [ - ":ot_commissioner_mbedtls_warnings", ":warnings", ] public = [ "repo/include/commissioner/commissioner.hpp" ] @@ -58,7 +58,6 @@ static_library("ot-commissioner") { "repo/third_party/googletest/repo/googletest/include", "repo/third_party/json/repo/single_include", "repo/third_party/libevent/repo/include", - "repo/third_party/mbedtls/repo/include", "repo/third_party/mdns/repo/include", ] sources = [ @@ -86,7 +85,14 @@ static_library("ot-commissioner") { "repo/src/library/token_manager.cpp", "repo/src/library/udp_proxy.cpp", ] - deps = [ ":ot_commissioner_mbedtls" ] + if (chip_enable_otns) { + deps = [ "${chip_root}/third_party/openthread/platforms:libopenthread-platform", + "${chip_root}/third_party/openthread/repo/third_party/mbedtls", ] + } else { + configs += [ ":ot_commissioner_mbedtls_warnings" ] + include_dirs += [ "repo/third_party/mbedtls/repo/include" ] + deps = [ ":ot_commissioner_mbedtls" ] + } libs = [ "event_core", "event_pthreads",