[tests] add support for enable/disable OT mdns (#11660)

This commit is contained in:
Jonathan Hui
2025-07-01 11:48:55 -07:00
committed by GitHub
parent ef0e7bb858
commit 68d603ef42
2 changed files with 15 additions and 1 deletions
@@ -137,9 +137,9 @@ class TestDnssdServerOnMultiBr(thread_cert.TestCase):
self.simulator.go(5)
# start BR2 late to ensure it doesn't have mDNS cache
br2.start_mdns_service()
br2.start_otbr_service()
br2.start()
br2.start_mdns_service()
self.simulator.go(config.BORDER_ROUTER_STARTUP_DELAY)
br2.dns_upstream_query_state = False
+14
View File
@@ -177,9 +177,23 @@ class OtbrDocker:
self.bash('service otbr-agent stop')
def stop_mdns_service(self):
self.send_command('mdns disable')
# The OT build may not include mdns, so ignore `InvalidCommand` errors.
try:
self._expect_result(r'Done')
except Exception as ex:
if 'InvalidCommand' not in str(ex):
raise
self.bash('service avahi-daemon stop; service mdns stop; !(cat /proc/net/udp | grep -i :14E9)')
def start_mdns_service(self):
self.send_command('mdns enable')
# The OT build may not include mdns, so ignore `InvalidCommand` errors.
try:
self._expect_result(r'Done')
except Exception as ex:
if 'InvalidCommand' not in str(ex):
raise
self.bash('service avahi-daemon start; service mdns start; cat /proc/net/udp | grep -i :14E9')
def start_ot_ctl(self):