diff --git a/components/openthread/src/esp_openthread.cpp b/components/openthread/src/esp_openthread.cpp index 61f3ceae2d..3ca5d46527 100644 --- a/components/openthread/src/esp_openthread.cpp +++ b/components/openthread/src/esp_openthread.cpp @@ -182,6 +182,7 @@ esp_err_t esp_openthread_mainloop_exit(void) esp_err_t esp_openthread_launch_mainloop(void) { + ESP_LOGI(OT_PLAT_LOG_TAG, "OpenThread enter mainloop"); esp_openthread_mainloop_context_t mainloop; otInstance *instance = esp_openthread_get_instance(); esp_err_t error = ESP_OK; diff --git a/examples/openthread/ot_ci_function.py b/examples/openthread/ot_ci_function.py index 2773b85c31..cde15f9153 100644 --- a/examples/openthread/ot_ci_function.py +++ b/examples/openthread/ot_ci_function.py @@ -185,7 +185,7 @@ def getDataset(dut: IdfDut) -> str: def init_thread(dut: IdfDut) -> None: - dut.expect('OpenThread attached to netif', timeout=10) + dut.expect('OpenThread enter mainloop', timeout=10) wait(dut, 3) reset_thread(dut) @@ -198,16 +198,16 @@ def stop_thread(dut: IdfDut) -> None: def reset_thread(dut: IdfDut) -> None: execute_command(dut, 'factoryreset') - dut.expect('OpenThread attached to netif', timeout=20) + dut.expect('OpenThread enter mainloop', timeout=20) wait(dut, 3) clean_buffer(dut) def hardreset_dut(dut: IdfDut) -> None: dut.serial.hard_reset() - dut.expect('OpenThread attached to netif', timeout=20) + dut.expect('OpenThread enter mainloop', timeout=20) execute_command(dut, 'factoryreset') - dut.expect('OpenThread attached to netif', timeout=20) + dut.expect('OpenThread enter mainloop', timeout=20) # get the mleid address of the thread @@ -461,7 +461,8 @@ def check_ipmaddr(dut: IdfDut) -> bool: def thread_is_joined_group(dut: IdfDut) -> bool: - command = 'mcast join ' + thread_ipv6_group + should_use_mcast = dut.app.sdkconfig.get('OPENTHREAD_PLATFORM_NETIF') is True + command = ('mcast join ' if should_use_mcast else 'ipmaddr add ') + thread_ipv6_group execute_command(dut, command) dut.expect('Done', timeout=5) order = 0 diff --git a/examples/openthread/ot_cli/main/esp_ot_cli.c b/examples/openthread/ot_cli/main/esp_ot_cli.c index 44a7d1abe8..0d49da7ef5 100644 --- a/examples/openthread/ot_cli/main/esp_ot_cli.c +++ b/examples/openthread/ot_cli/main/esp_ot_cli.c @@ -53,7 +53,9 @@ void app_main(void) ESP_ERROR_CHECK(nvs_flash_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); +#if CONFIG_OPENTHREAD_PLATFORM_NETIF ESP_ERROR_CHECK(esp_netif_init()); +#endif ESP_ERROR_CHECK(esp_vfs_eventfd_register(&eventfd_config)); #if CONFIG_OPENTHREAD_CLI @@ -62,7 +64,9 @@ void app_main(void) #endif static esp_openthread_config_t config = { +#if CONFIG_OPENTHREAD_PLATFORM_NETIF .netif_config = ESP_NETIF_DEFAULT_OPENTHREAD(), +#endif .platform_config = { .radio_config = ESP_OPENTHREAD_DEFAULT_RADIO_CONFIG(), .host_config = ESP_OPENTHREAD_DEFAULT_HOST_CONFIG(), diff --git a/examples/openthread/ot_cli/sdkconfig.ci.cli_disable_platform_netif b/examples/openthread/ot_cli/sdkconfig.ci.cli_disable_platform_netif new file mode 100644 index 0000000000..6d7624ee6c --- /dev/null +++ b/examples/openthread/ot_cli/sdkconfig.ci.cli_disable_platform_netif @@ -0,0 +1,2 @@ +CONFIG_OPENTHREAD_PLATFORM_NETIF=n +CONFIG_OPENTHREAD_CLI_ESP_EXTENSION=n diff --git a/examples/openthread/ot_common_components/ot_examples_common/Kconfig.projbuild b/examples/openthread/ot_common_components/ot_examples_common/Kconfig.projbuild index 0bca5c2987..6123273f4a 100644 --- a/examples/openthread/ot_common_components/ot_examples_common/Kconfig.projbuild +++ b/examples/openthread/ot_common_components/ot_examples_common/Kconfig.projbuild @@ -12,7 +12,12 @@ menu "Config for OpenThread Examples" menu "External Console Commands" config OPENTHREAD_IPERF_CMD_ENABLE bool "Enable iperf command" - depends on OPENTHREAD_FTD || OPENTHREAD_MTD + # TODO: Make this option depend on LWIP_ENABLE in the future. + # Currently, LWIP_ENABLE cannot be set to `n` because the OpenThread component makes MbedTLS a hard + # dependency. + # This is a known limitation of the ESP-IDF (<6) build system (component requirements are expanded + # before configuration is loaded). + depends on OPENTHREAD_PLATFORM_NETIF default y help If enabled, iperf will be registered and available as a console command. diff --git a/examples/openthread/pytest_otbr.py b/examples/openthread/pytest_otbr.py index 38b4c7b5c2..4668b3593a 100644 --- a/examples/openthread/pytest_otbr.py +++ b/examples/openthread/pytest_otbr.py @@ -121,6 +121,16 @@ PORT_MAPPING = {'ESPPORT1': 'esp32h2', 'ESPPORT2': 'esp32s3', 'ESPPORT3': 'esp32 f'{ESPPORT3}|{ESPPORT1}|{ESPPORT2}', id='c6-h2-s3', ), + pytest.param( + 'rcp_uart|cli_disable_platform_netif|br', + 3, + f'{os.path.join(os.path.dirname(__file__), "ot_rcp")}' + f'|{os.path.join(os.path.dirname(__file__), "ot_cli")}' + f'|{os.path.join(os.path.dirname(__file__), "ot_br")}', + 'esp32c6|esp32h2|esp32s3', + f'{ESPPORT3}|{ESPPORT1}|{ESPPORT2}', + id='c6-h2_disable_platform_netif-s3', + ), pytest.param( 'rcp_spi|cli|br_spi', 3, @@ -204,6 +214,16 @@ def formBasicWiFiThreadNetwork(br: IdfDut, cli: IdfDut) -> None: f'{ESPPORT3}|{ESPPORT1}|{ESPPORT2}', id='c6-h2-s3', ), + pytest.param( + 'rcp_uart|cli_disable_platform_netif|br', + 3, + f'{os.path.join(os.path.dirname(__file__), "ot_rcp")}' + f'|{os.path.join(os.path.dirname(__file__), "ot_cli")}' + f'|{os.path.join(os.path.dirname(__file__), "ot_br")}', + 'esp32c6|esp32h2|esp32s3', + f'{ESPPORT3}|{ESPPORT1}|{ESPPORT2}', + id='c6-h2_disable_platform_netif-s3', + ), ], indirect=True, ) @@ -264,6 +284,16 @@ def test_Bidirectional_IPv6_connectivity(Init_interface: bool, dut: tuple[IdfDut f'{ESPPORT3}|{ESPPORT1}|{ESPPORT2}', id='c6-h2-s3', ), + pytest.param( + 'rcp_uart|cli_disable_platform_netif|br', + 3, + f'{os.path.join(os.path.dirname(__file__), "ot_rcp")}' + f'|{os.path.join(os.path.dirname(__file__), "ot_cli")}' + f'|{os.path.join(os.path.dirname(__file__), "ot_br")}', + 'esp32c6|esp32h2|esp32s3', + f'{ESPPORT3}|{ESPPORT1}|{ESPPORT2}', + id='c6-h2_disable_platform_netif-s3', + ), ], indirect=True, ) @@ -317,6 +347,16 @@ def test_multicast_forwarding_A(Init_interface: bool, dut: tuple[IdfDut, IdfDut, f'{ESPPORT3}|{ESPPORT1}|{ESPPORT2}', id='c6-h2-s3', ), + pytest.param( + 'rcp_uart|cli_disable_platform_netif|br', + 3, + f'{os.path.join(os.path.dirname(__file__), "ot_rcp")}' + f'|{os.path.join(os.path.dirname(__file__), "ot_cli")}' + f'|{os.path.join(os.path.dirname(__file__), "ot_br")}', + 'esp32c6|esp32h2|esp32s3', + f'{ESPPORT3}|{ESPPORT1}|{ESPPORT2}', + id='c6-h2_disable_platform_netif-s3', + ), ], indirect=True, ) @@ -371,6 +411,16 @@ def test_multicast_forwarding_B(Init_interface: bool, dut: tuple[IdfDut, IdfDut, f'{ESPPORT3}|{ESPPORT1}|{ESPPORT2}', id='c6-h2-s3', ), + pytest.param( + 'rcp_uart|cli_disable_platform_netif|br', + 3, + f'{os.path.join(os.path.dirname(__file__), "ot_rcp")}' + f'|{os.path.join(os.path.dirname(__file__), "ot_cli")}' + f'|{os.path.join(os.path.dirname(__file__), "ot_br")}', + 'esp32c6|esp32h2|esp32s3', + f'{ESPPORT3}|{ESPPORT1}|{ESPPORT2}', + id='c6-h2_disable_platform_netif-s3', + ), ], indirect=True, ) @@ -432,6 +482,16 @@ def test_service_discovery_of_Thread_device( f'{ESPPORT3}|{ESPPORT1}|{ESPPORT2}', id='c6-h2-s3', ), + pytest.param( + 'rcp_uart|cli_disable_platform_netif|br', + 3, + f'{os.path.join(os.path.dirname(__file__), "ot_rcp")}' + f'|{os.path.join(os.path.dirname(__file__), "ot_cli")}' + f'|{os.path.join(os.path.dirname(__file__), "ot_br")}', + 'esp32c6|esp32h2|esp32s3', + f'{ESPPORT3}|{ESPPORT1}|{ESPPORT2}', + id='c6-h2_disable_platform_netif-s3', + ), ], indirect=True, ) @@ -717,7 +777,7 @@ def test_ot_sleepy_device(dut: tuple[IdfDut, IdfDut]) -> None: finally: logging.info('Cleaning up...') ocf.execute_command(leader, 'factoryreset') - leader.expect('OpenThread attached to netif', timeout=20) + leader.expect('OpenThread enter mainloop', timeout=20) ocf.hardreset_dut(sleepy_device) time.sleep(3)