mirror of
https://github.com/espressif/openthread.git
synced 2026-09-06 01:00:09 +00:00
[srp-client] add lease changing test (#7280)
This commit is contained in:
@@ -38,6 +38,7 @@ import subprocess
|
||||
import sys
|
||||
import time
|
||||
import traceback
|
||||
import typing
|
||||
import unittest
|
||||
from ipaddress import IPv6Address, IPv6Network
|
||||
from typing import Union, Dict, Optional, List, Any
|
||||
@@ -654,7 +655,7 @@ class NodeImpl:
|
||||
if isinstance(pattern, str):
|
||||
pattern = re.compile(pattern)
|
||||
|
||||
if isinstance(pattern, re.Pattern):
|
||||
if isinstance(pattern, typing.Pattern):
|
||||
return pattern.match(line)
|
||||
else:
|
||||
return any(NodeImpl._match_pattern(line, p) for p in pattern)
|
||||
@@ -1130,6 +1131,16 @@ class NodeImpl:
|
||||
service_lines = self._expect_command_output()
|
||||
return [self._parse_srp_client_service(line) for line in service_lines]
|
||||
|
||||
def srp_client_set_lease_interval(self, leaseinterval: int):
|
||||
cmd = f'srp client leaseinterval {leaseinterval}'
|
||||
self.send_command(cmd)
|
||||
self._expect_done()
|
||||
|
||||
def srp_client_get_lease_interval(self) -> int:
|
||||
cmd = 'srp client leaseinterval'
|
||||
self.send_command(cmd)
|
||||
return int(self._expect_result('\d+'))
|
||||
|
||||
def _encode_txt_entry(self, entry):
|
||||
"""Encodes the TXT entry to the DNS-SD TXT record format as a HEX string.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user