feat(openthread): allow enabling trel before getting interface

This commit is contained in:
Xu Si Yu
2024-09-11 22:00:59 +08:00
committed by BOT
parent 88077e0b16
commit b59b0e0926
14 changed files with 120 additions and 102 deletions

View File

@@ -44,6 +44,24 @@ from pytest_embedded_idf.dut import IdfDut
# Case 9: TCP communication via NAT64
# Thread device (IPV6) send tcp message to the host device (IPV4) via NAT64.
# Case 10: Sleepy device test
# Start a Thread sleepy device, wait it join the Thread network and check related flags.
# Case 11: Basic startup Test of BR
# Test the basic startup and network formation of a Thread device.
# Case 12: Curl a website via DNS and NAT64
# A border router joins a Wi-Fi network and forms a Thread network, a Thread devices attached to it and curl a website.
# Case 13: Meshcop discovery of Border Router
# A border router joins a Wi-Fi network, forms a Thread network and publish a meshcop service. Linux Host device discover the mescop service.
# Case 14: Curl a website over HTTPS via DNS and NAT64
# A border router joins a Wi-Fi network and forms a Thread network, a Thread devices attached to it and curl a https website.
# Case 15: Thread network formation and attaching with TREL
# A TREL device forms a Thread network, other TREL devices attach to it, then test ping connection between them.
@pytest.fixture(scope='module', name='Init_avahi')
def fixture_Init_avahi() -> bool:
@@ -690,3 +708,57 @@ def test_br_meshcop(Init_interface:bool, Init_avahi:bool, dut: Tuple[IdfDut, Idf
finally:
ocf.execute_command(br, 'factoryreset')
time.sleep(3)
# Case 14: Curl a website over HTTPS via DNS and NAT64
# Skip this check on release 5.1
# Case 15: Thread network formation and attaching with TREL
@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', [
('trel|trel', 2,
f'{os.path.join(os.path.dirname(__file__), "ot_trel")}'
f'|{os.path.join(os.path.dirname(__file__), "ot_trel")}',
'esp32c6|esp32s3'),
],
indirect=True,
)
def test_trel_connect(dut: Tuple[IdfDut, IdfDut]) -> None:
trel_s3 = dut[1]
trel_c6 = dut[0]
trel_list = [trel_c6]
router_extaddr_list = ['7766554433221101']
trel_s3.expect('IPv4 address:', timeout=10)
trel_c6.expect('IPv4 address:', timeout=10)
ocf.init_thread(trel_s3)
for trel in trel_list:
ocf.init_thread(trel)
trel_leader_para = copy.copy(default_br_ot_para)
trel_leader_para.bbr = False
ocf.joinThreadNetwork(trel_s3, trel_leader_para)
trel_para = copy.copy(default_cli_ot_para)
trel_para.dataset = ocf.getDataset(trel_s3)
try:
order = 0
for trel in trel_list:
trel_para.exaddr = router_extaddr_list[order]
order = order + 1
ocf.joinThreadNetwork(trel, trel_para)
for trel in trel_list:
trel_mleid_addr = ocf.get_mleid_addr(trel)
trel_s3_mleid_addr = ocf.get_mleid_addr(trel_s3)
rx_nums = ocf.ot_ping(trel, trel_s3_mleid_addr, 5)[1]
assert rx_nums == 5
rx_nums = ocf.ot_ping(trel_s3, trel_mleid_addr, 5)[1]
assert rx_nums == 5
finally:
ocf.execute_command(trel_s3, 'factoryreset')
for trel in trel_list:
ocf.execute_command(trel, 'factoryreset')
time.sleep(3)