diff --git a/tools/harness-thci/OpenThread_BR.py b/tools/harness-thci/OpenThread_BR.py index 160d57616..34fba1a2e 100644 --- a/tools/harness-thci/OpenThread_BR.py +++ b/tools/harness-thci/OpenThread_BR.py @@ -60,6 +60,8 @@ logging.getLogger('paramiko').setLevel(logging.WARNING) class SSHHandle(object): + # Unit: second + KEEPALIVE_INTERVAL = 30 def __init__(self, ip, port, username, password): self.ip = ip @@ -85,6 +87,9 @@ class SSHHandle(object): else: raise + # Avoid SSH disconnection after idle for a long time + self.__handle.get_transport().set_keepalive(self.KEEPALIVE_INTERVAL) + def close(self): if self.__handle is not None: self.__handle.close()