feat(ci): add ci cases for openthread border router

This commit is contained in:
Xu Si Yu
2023-09-06 10:54:19 +08:00
parent a5caa1c724
commit 54f13eaacc
4 changed files with 80 additions and 0 deletions

View File

@@ -219,6 +219,16 @@ def test_multicast_forwarding_A(Init_interface:bool, dut: Tuple[IdfDut, IdfDut,
print('ping result:\n', str(out_str))
role = re.findall(r' (\d+)%', str(out_str))[0]
assert role != '100'
ocf.execute_command(cli, 'udp open')
cli.expect('Done', timeout=5)
ocf.execute_command(cli, 'udp bind :: 12350')
cli.expect('Done', timeout=5)
ocf.clean_buffer(cli)
target_udp = ocf.udp_parameter('INET6', 'ff04::125', 12350, '', False, 15.0, b'hello')
ocf.host_udp_send_message(target_udp)
cli.expect('hello', timeout=5)
ocf.execute_command(cli, 'udp close')
cli.expect('Done', timeout=5)
finally:
ocf.execute_command(br, 'factoryreset')
ocf.execute_command(cli, 'factoryreset')
@@ -623,3 +633,41 @@ 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.supported_targets
@pytest.mark.esp32h2
@pytest.mark.esp32c6
@pytest.mark.openthread_bbr
@pytest.mark.flaky(reruns=1, reruns_delay=1)
@pytest.mark.parametrize(
'config, count, app_path, target', [
('rcp|cli_h2|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'),
],
indirect=True,
)
def test_NAT64_DNS(Init_interface:bool, dut: Tuple[IdfDut, IdfDut, IdfDut]) -> None:
br = dut[2]
cli = dut[1]
assert Init_interface
dut[0].serial.stop_redirect_thread()
formBasicWiFiThreadNetwork(br, cli)
try:
ocf.execute_command(br, 'bbr')
br.expect('server16', timeout=5)
ocf.execute_command(cli, 'dns64server 8.8.8.8')
cli.expect('Done', timeout=5)
command = 'curl http://www.espressif.com'
message = ocf.get_ouput_string(cli, command, 10)
assert '<html>' in str(message)
assert '301 Moved Permanently' in str(message)
finally:
ocf.execute_command(br, 'factoryreset')
ocf.execute_command(cli, 'factoryreset')
time.sleep(3)