kopia lustrzana https://github.com/espressif/esp-idf
feat(ci): add ci cases for openthread border router
rodzic
a5caa1c724
commit
54f13eaacc
|
@ -1077,6 +1077,18 @@ pytest_examples_openthread_br:
|
|||
- esp32c6
|
||||
- openthread_br
|
||||
|
||||
pytest_examples_openthread_bbr:
|
||||
extends:
|
||||
- .pytest_examples_dir_template
|
||||
- .rules:test:example_test-i154
|
||||
needs:
|
||||
- build_pytest_examples_esp32s3
|
||||
- build_pytest_examples_esp32c6
|
||||
- build_pytest_examples_esp32h2
|
||||
tags:
|
||||
- esp32c6
|
||||
- openthread_bbr
|
||||
|
||||
pytest_examples_openthread_sleep:
|
||||
extends:
|
||||
- .pytest_examples_dir_template
|
||||
|
|
|
@ -361,6 +361,25 @@ def create_host_udp_server(myudp:udp_parameter) -> None:
|
|||
sock.close()
|
||||
|
||||
|
||||
def host_udp_send_message(udp_target:udp_parameter) -> None:
|
||||
interface_name = get_host_interface_name()
|
||||
try:
|
||||
if udp_target.udp_type == 'INET6':
|
||||
AF_INET = socket.AF_INET6
|
||||
else:
|
||||
AF_INET = socket.AF_INET
|
||||
sock = socket.socket(AF_INET, socket.SOCK_DGRAM)
|
||||
sock.bind(('::', 12350))
|
||||
sock.setsockopt(socket.SOL_SOCKET, socket.SO_BINDTODEVICE, interface_name.encode())
|
||||
sock.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_MULTICAST_HOPS, 32)
|
||||
print('Host is sending message')
|
||||
sock.sendto(udp_target.udp_bytes, (udp_target.addr, udp_target.port))
|
||||
except socket.error:
|
||||
print('Host cannot send message')
|
||||
finally:
|
||||
sock.close()
|
||||
|
||||
|
||||
def wait(dut:IdfDut, wait_time:float) -> None:
|
||||
dut.expect(pexpect.TIMEOUT, timeout=wait_time)
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -94,6 +94,7 @@ ENV_MARKERS = {
|
|||
# multi-dut markers
|
||||
'ieee802154': 'ieee802154 related tests should run on ieee802154 runners.',
|
||||
'openthread_br': 'tests should be used for openthread border router.',
|
||||
'openthread_bbr': 'tests should be used for openthread border router linked to Internet.',
|
||||
'openthread_sleep': 'tests should be used for openthread sleepy device.',
|
||||
'zigbee_multi_dut': 'zigbee runner which have multiple duts.',
|
||||
'wifi_two_dut': 'tests should be run on runners which has two wifi duts connected.',
|
||||
|
|
Ładowanie…
Reference in New Issue