Skip to content

Commit 6bedf6c

Browse files
committed
Merge branch 'fix/add_network_reconnectin_in_ot_ci_case_v5.3' into 'release/v5.3'
feat(openthread): flush ipv6 addr in openthread ci cases(Backport v5.3) See merge request espressif/esp-idf!34674
2 parents d3be713 + e56baae commit 6bedf6c

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

examples/openthread/ot_ci_function.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,26 @@ def get_domain() -> str:
460460
return str(role)
461461

462462

463+
def flush_ipv6_addr_by_interface() -> None:
464+
interface_name = get_host_interface_name()
465+
print(f'flush ipv6 addr : {interface_name}')
466+
command_show_addr = f'ip -6 addr show dev {interface_name}'
467+
command_show_route = f'ip -6 route show dev {interface_name}'
468+
addr_before = subprocess.getoutput(command_show_addr)
469+
route_before = subprocess.getoutput(command_show_route)
470+
print(f'Before flush, IPv6 addresses: \n{addr_before}')
471+
print(f'Before flush, IPv6 routes: \n{route_before}')
472+
subprocess.run(['ip', 'link', 'set', interface_name, 'down'])
473+
subprocess.run(['ip', '-6', 'addr', 'flush', 'dev', interface_name])
474+
subprocess.run(['ip', '-6', 'route', 'flush', 'dev', interface_name])
475+
subprocess.run(['ip', 'link', 'set', interface_name, 'up'])
476+
time.sleep(5)
477+
addr_after = subprocess.getoutput(command_show_addr)
478+
route_after = subprocess.getoutput(command_show_route)
479+
print(f'After flush, IPv6 addresses: \n{addr_after}')
480+
print(f'After flush, IPv6 routes: \n{route_after}')
481+
482+
463483
class tcp_parameter:
464484

465485
def __init__(self, tcp_type:str='', addr:str='::', port:int=12345, listen_flag:bool=False, recv_flag:bool=False, timeout:float=15.0, tcp_bytes:bytes=b''):

examples/openthread/pytest_otbr.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ def fixture_Init_avahi() -> bool:
7474
@pytest.fixture(name='Init_interface')
7575
def fixture_Init_interface() -> bool:
7676
print('Init interface')
77-
ocf.init_interface_ipv6_address()
78-
ocf.reset_host_interface()
77+
ocf.flush_ipv6_addr_by_interface()
78+
# The sleep time is set based on experience; reducing it might cause the host to be unready.
7979
time.sleep(30)
8080
ocf.set_interface_sysctl_options()
8181
return True

0 commit comments

Comments
 (0)