mirror of
https://github.com/espressif/openthread.git
synced 2026-08-02 09:07:47 +00:00
[border-agent] update "ConnectionMode" in state bitmap when stopped (#11462)
This commit updates how the "ConnectionMode" field is set in the Border Agent State Bitmap, which is advertised as the value of the `sb` TXT key. In particular, when the Border Agent service is stopped and therefore not accepting any connections, the value of this field is now set to `kConnectionModeDisabled` to indicate this. This commit also updates and enhances `test_border_agent` to validate the State Bitmap entry in the TXT data, covering cases where the device role changes or ePSKc support is enabled/disabled.
This commit is contained in:
@@ -209,7 +209,10 @@ class PublishMeshCopService(thread_cert.TestCase):
|
||||
sb_data = service_data['txt']['sb'].encode('raw_unicode_escape')
|
||||
state_bitmap = int.from_bytes(sb_data, byteorder='big')
|
||||
logging.info(bin(state_bitmap))
|
||||
self.assertEqual((state_bitmap & 7), 1) # connection mode = PskC
|
||||
if br.get_ba_state() == 'Active':
|
||||
self.assertEqual((state_bitmap & 7), 1) # connection mode = PskC
|
||||
else:
|
||||
self.assertEqual((state_bitmap & 7), 0) # connection mode = Disabled
|
||||
sb_thread_interface_status = state_bitmap >> 3 & 3
|
||||
sb_thread_role = state_bitmap >> 9 & 3
|
||||
device_role = br.get_state()
|
||||
|
||||
@@ -1913,6 +1913,11 @@ class NodeImpl:
|
||||
self.send_command(cmd)
|
||||
self._expect_done()
|
||||
|
||||
def get_ba_state(self):
|
||||
states = [r'Disabled', r'Inactive', r'Active']
|
||||
self.send_command('ba state')
|
||||
return self._expect_result(states)
|
||||
|
||||
def get_ephemeral_key_state(self):
|
||||
cmd = 'ba ephemeralkey'
|
||||
states = [r'Disabled', r'Stopped', r'Started', r'Connected', r'Accepted']
|
||||
|
||||
Reference in New Issue
Block a user