[trel] small updates and adding trel test (#7205)

- Adds platform API `trelDnssdInitialize` to initialize TREL
  DNS-SD module.
- Adds `test_trel_connectivity.py` test.
- Fixed `Border Router` TREL test to really use TREL.
This commit is contained in:
Simon Lin
2022-01-28 12:07:42 -08:00
committed by Jonathan Hui
parent 69ad96675f
commit 40b5fd3749
7 changed files with 223 additions and 11 deletions
+17
View File
@@ -125,6 +125,8 @@ class OtbrDocker:
config.OTBR_DOCKER_IMAGE,
'-B',
config.BACKBONE_IFNAME,
'--trel-url',
f'trel://{config.BACKBONE_IFNAME}',
],
stdin=subprocess.DEVNULL,
stdout=sys.stdout,
@@ -1145,6 +1147,21 @@ class NodeImpl:
self.send_command(cmd)
return int(self._expect_result('\d+'))
#
# TREL utilities
#
def get_trel_state(self) -> Union[None, bool]:
states = [r'Disabled', r'Enabled']
self.send_command('trel')
try:
return self._expect_result(states) == 'Enabled'
except Exception as ex:
if 'InvalidCommand' in str(ex):
return None
raise
def _encode_txt_entry(self, entry):
"""Encodes the TXT entry to the DNS-SD TXT record format as a HEX string.