Merge branch 'fix/add_network_reconnectin_in_ot_ci_case' into 'master'

feat(openthread): flush ipv6 addr in openthread ci cases

Closes TZ-1260 and IDFCI-2537

See merge request espressif/esp-idf!34666
This commit is contained in:
Shu Chen 2024-11-20 10:14:11 +08:00
commit d7dc6e7f2a
2 changed files with 22 additions and 2 deletions

View File

@ -460,6 +460,26 @@ def get_domain() -> str:
return str(role)
def flush_ipv6_addr_by_interface() -> None:
interface_name = get_host_interface_name()
print(f'flush ipv6 addr : {interface_name}')
command_show_addr = f'ip -6 addr show dev {interface_name}'
command_show_route = f'ip -6 route show dev {interface_name}'
addr_before = subprocess.getoutput(command_show_addr)
route_before = subprocess.getoutput(command_show_route)
print(f'Before flush, IPv6 addresses: \n{addr_before}')
print(f'Before flush, IPv6 routes: \n{route_before}')
subprocess.run(['ip', 'link', 'set', interface_name, 'down'])
subprocess.run(['ip', '-6', 'addr', 'flush', 'dev', interface_name])
subprocess.run(['ip', '-6', 'route', 'flush', 'dev', interface_name])
subprocess.run(['ip', 'link', 'set', interface_name, 'up'])
time.sleep(5)
addr_after = subprocess.getoutput(command_show_addr)
route_after = subprocess.getoutput(command_show_route)
print(f'After flush, IPv6 addresses: \n{addr_after}')
print(f'After flush, IPv6 routes: \n{route_after}')
class tcp_parameter:
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''):

View File

@ -74,8 +74,8 @@ def fixture_Init_avahi() -> bool:
@pytest.fixture(name='Init_interface')
def fixture_Init_interface() -> bool:
print('Init interface')
ocf.init_interface_ipv6_address()
ocf.reset_host_interface()
ocf.flush_ipv6_addr_by_interface()
# The sleep time is set based on experience; reducing it might cause the host to be unready.
time.sleep(30)
ocf.set_interface_sysctl_options()
return True