From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 10D321B168 for ; Wed, 10 Jan 2018 08:18:14 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Jan 2018 23:18:14 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,339,1511856000"; d="scan'208";a="19775219" Received: from dpdk-test38.sh.intel.com ([10.67.119.87]) by fmsmga004.fm.intel.com with ESMTP; 09 Jan 2018 23:18:14 -0800 From: Marvin Liu To: dts@dpdk.org Cc: Marvin Liu Date: Tue, 9 Jan 2018 19:11:07 -0500 Message-Id: <1515543074-81373-10-git-send-email-yong.liu@intel.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1515543074-81373-1-git-send-email-yong.liu@intel.com> References: <1515379769-11553-1-git-send-email-yong.liu@intel.com> <1515543074-81373-1-git-send-email-yong.liu@intel.com> Subject: [dts] [PATCH v2 09/16] framework/ssh_connection: support multiple VMs module X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2018 07:18:15 -0000 1. Support DUT index argument. 2. Remove logger handler when close the connection. Signed-off-by: Marvin Liu 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