mirror of
https://github.com/espressif/openthread.git
synced 2026-07-27 06:17:47 +00:00
[srp-client] adding auto-start feature (#6140)
This commit adds auto-start SRP client feature. Config option `OPENTHREAD_CONFIG_SRP_CLIENT_AUTO_START_API_ENABLE` adds support for this feature in SRP client allowing auto-start mode to be enabled or disabled. When enabled, the SRP client will monitor the Thread Network Data for SRP Server Service entries and automatically start and stop the client when an SRP server is detected. If multiple SRP servers are found, a random one will be selected. If the selected SRP server is no longer detected (not longer present in the Thread Network Data), the SRP client will be stopped and then it may switch to another SRP server (if available). This commit also adds support for the new feature in CLI and adds a new test `test_srp_auto_start_mode.py` covering the behavior of this feature.
This commit is contained in:
@@ -928,6 +928,34 @@ class NodeImpl:
|
||||
self.send_command(f'srp client stop')
|
||||
self._expect_done()
|
||||
|
||||
def srp_client_get_state(self):
|
||||
cmd = 'srp client state'
|
||||
self.send_command(cmd)
|
||||
return self._expect_command_output(cmd)[0]
|
||||
|
||||
def srp_client_get_auto_start_mode(self):
|
||||
cmd = 'srp client autostart'
|
||||
self.send_command(cmd)
|
||||
return self._expect_command_output(cmd)[0]
|
||||
|
||||
def srp_client_enable_auto_start_mode(self):
|
||||
self.send_command(f'srp client autostart enable')
|
||||
self._expect_done()
|
||||
|
||||
def srp_client_disable_auto_start_mode(self):
|
||||
self.send_command(f'srp client autostart able')
|
||||
self._expect_done()
|
||||
|
||||
def srp_client_get_server_address(self):
|
||||
cmd = 'srp client server address'
|
||||
self.send_command(cmd)
|
||||
return self._expect_command_output(cmd)[0]
|
||||
|
||||
def srp_client_get_server_port(self):
|
||||
cmd = 'srp client server port'
|
||||
self.send_command(cmd)
|
||||
return int(self._expect_command_output(cmd)[0])
|
||||
|
||||
def srp_client_get_host_state(self):
|
||||
cmd = 'srp client host state'
|
||||
self.send_command(cmd)
|
||||
|
||||
Reference in New Issue
Block a user