[dts] [PATCH v2 09/16] framework/ssh_connection: support multiple VMs module
Marvin Liu
yong.liu at intel.com
Wed Jan 10 01:11:07 CET 2018
1. Support DUT index argument.
2. Remove logger handler when close the connection.
Signed-off-by: Marvin Liu <yong.liu at intel.com>
diff --git a/framework/ssh_connection.py b/framework/ssh_connection.py
index 675279b..915d081 100644
--- a/framework/ssh_connection.py
+++ b/framework/ssh_connection.py
@@ -44,8 +44,8 @@ class SSHConnection(object):
Implement send_expect/copy function upper SSHPexpet module.
"""
- def __init__(self, host, session_name, username, password=''):
- self.session = SSHPexpect(host, username, password)
+ def __init__(self, host, session_name, username, password='', dut_id=0):
+ self.session = SSHPexpect(host, username, password, dut_id)
self.name = session_name
connection = {}
connection[self.name] = self.session
@@ -63,7 +63,7 @@ class SSHConnection(object):
def send_command(self, cmds, timeout=1):
self.logger.info(cmds)
- out = self.session.send_command(cmds)
+ out = self.session.send_command(cmds, timeout)
self.logger.debug(out)
return out
@@ -73,6 +73,9 @@ class SSHConnection(object):
return out
def close(self, force=False):
+ if getattr(self, "logger", None):
+ self.logger.logger_exit()
+
self.session.close(force)
connection = {}
connection[self.name] = self.session
--
1.9.3
More information about the dts
mailing list