[tests] check whether the unreachable address is included in the DNS-SD response (#9075)

This commit enhances the DNS-SD server test that it verifies if the
unreachable address is included in the DNS-SD response.
This commit is contained in:
whd
2023-05-24 15:28:01 -07:00
committed by GitHub
parent b82cfddd68
commit c6ea8afc85
2 changed files with 85 additions and 5 deletions
+24
View File
@@ -3644,6 +3644,30 @@ class LinuxHost():
(self.ETH_DEV, self.ETH_DEV))
self.bash(f'ip -6 neigh list dev {self.ETH_DEV}')
def publish_mdns_service(self, instance_name, service_type, port, host_name, txt):
"""Publish an mDNS service on the Ethernet.
:param instance_name: the service instance name.
:param service_type: the service type in format of '<service_type>.<protocol>'.
:param port: the port the service is at.
:param host_name: the host name this service points to. The domain
should not be included.
:param txt: a dictionary containing the key-value pairs of the TXT record.
"""
txt_string = ' '.join([f'{key}={value}' for key, value in txt.items()])
self.bash(f'avahi-publish -s {instance_name} {service_type} {port} -H {host_name}.local {txt_string} &')
def publish_mdns_host(self, hostname, addresses):
"""Publish an mDNS host on the Ethernet
:param host_name: the host name this service points to. The domain
should not be included.
:param addresses: a list of strings representing the addresses to
be registered with the host.
"""
for address in addresses:
self.bash(f'avahi-publish -a {hostname}.local {address} &')
def browse_mdns_services(self, name, timeout=2):
""" Browse mDNS services on the ethernet.