Merge branch 'feature/add_test_case_for_select_block_5_1' into 'release/v5.1'

Backport some openthread features(Backport v5.1).

See merge request espressif/esp-idf!29927
This commit is contained in:
Shu Chen
2024-05-11 10:24:27 +08:00
18 changed files with 240 additions and 23 deletions

View File

@@ -4,8 +4,7 @@ cmake_minimum_required(VERSION 3.16)
# (Not part of the boilerplate)
# This example uses an extra component for common functions such as Wi-Fi and Ethernet connection.
set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common
$ENV{IDF_PATH}/examples/common_components/iperf)
set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_examples_common)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(esp_ot_br)

View File

@@ -1,7 +1,7 @@
## IDF Component Manager Manifest File
dependencies:
espressif/esp_ot_cli_extension:
version: "~1.0.0"
version: "~1.1.0"
espressif/mdns: "^1.0.3"
## Required IDF version
idf:

View File

@@ -2,7 +2,5 @@
# in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.16)
set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/iperf)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(esp_ot_cli)

View File

@@ -1,7 +1,7 @@
## IDF Component Manager Manifest File
dependencies:
espressif/esp_ot_cli_extension:
version: "~1.0.0"
version: "~1.1.0"
idf:
version: ">=4.1.0"
ot_led:

View File

@@ -1,8 +1,10 @@
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Unlicense OR CC0-1.0
# !/usr/bin/env python3
import copy
import os.path
import re
import secrets
import subprocess
import threading
import time
@@ -16,7 +18,7 @@ from pytest_embedded_idf.dut import IdfDut
# This file contains the test scripts for Thread:
# Case 1: Thread network formation and attaching
# A Thread Border Router forms a Thread network, Thread devices attache to it, then test ping connection between them.
# A Thread Border Router forms a Thread network, Thread devices attach to it, then test ping connection between them.
# Case 2: Bidirectional IPv6 connectivity
# Test IPv6 ping connection between Thread device and Linux Host (via Thread Border Router).
@@ -27,10 +29,10 @@ from pytest_embedded_idf.dut import IdfDut
# Case 4: Multicast forwarding from Thread to Wi-Fi network
# Linux Host joins the multicast group, test group communication from Thread to Wi-Fi network.
# Case 5: discover Serice published by Thread device
# Case 5: discover Service published by Thread device
# Thread device publishes the service, Linux Host discovers the service on Wi-Fi network.
# Case 6: discover Serice published by W-Fi device
# Case 6: discover Service published by W-Fi device
# Linux Host device publishes the service on Wi-Fi network, Thread device discovers the service.
# Case 7: ICMP communication via NAT64
@@ -627,3 +629,64 @@ def test_basic_startup(dut: Tuple[IdfDut, IdfDut]) -> None:
finally:
ocf.execute_command(br, 'factoryreset')
time.sleep(3)
# Case 12: Curl a website via DNS and NAT64
# @pytest.mark.openthread_bbr is not supported on release 5.1, skip this check
# Case 13: Meshcop discovery of Border Router
@pytest.mark.supported_targets
@pytest.mark.esp32c6
@pytest.mark.openthread_br
@pytest.mark.flaky(reruns=1, reruns_delay=1)
@pytest.mark.parametrize(
'config, count, app_path, target', [
('rcp|br', 2,
f'{os.path.join(os.path.dirname(__file__), "ot_rcp")}'
f'|{os.path.join(os.path.dirname(__file__), "ot_br")}',
'esp32c6|esp32s3'),
],
indirect=True,
)
def test_br_meshcop(Init_interface:bool, Init_avahi:bool, dut: Tuple[IdfDut, IdfDut]) -> None:
br = dut[1]
assert Init_interface
assert Init_avahi
dut[0].serial.stop_redirect_thread()
result = None
output_bytes = b''
try:
ocf.init_thread(br)
br_wifi_para = copy.copy(default_br_wifi_para)
ipv4_address = ocf.joinWiFiNetwork(br, br_wifi_para)[0]
br_thread_para = copy.copy(default_br_ot_para)
networkname = 'OTCI-' + str(secrets.token_hex(1))
br_thread_para.setnetworkname(networkname)
ocf.joinThreadNetwork(br, br_thread_para)
ocf.wait(br, 10)
assert ocf.is_joined_wifi_network(br)
command = 'timeout 3 avahi-browse -r _meshcop._udp'
try:
result = subprocess.run(command, capture_output=True, check=True, shell=True)
if result:
output_bytes = result.stdout
except subprocess.CalledProcessError as e:
output_bytes = e.stdout
finally:
print('out_bytes: ', output_bytes)
output_str = str(output_bytes)
print('out_str: ', output_str)
assert 'hostname = [esp-ot-br.local]' in str(output_str)
assert ('address = [' + ipv4_address + ']') in str(output_str)
assert 'dn=DefaultDomain' in str(output_str)
assert 'tv=1.4.0' in str(output_str)
assert ('nn=' + networkname) in str(output_str)
assert 'mn=BorderRouter' in str(output_str)
assert 'vn=OpenThread' in str(output_str)
assert 'rv=1' in str(output_str)
finally:
ocf.execute_command(br, 'factoryreset')
time.sleep(3)