From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 213B558C3 for ; Fri, 27 Nov 2015 09:39:21 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP; 27 Nov 2015 00:39:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,351,1444719600"; d="scan'208";a="607911895" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by FMSMGA003.fm.intel.com with ESMTP; 27 Nov 2015 00:39:20 -0800 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id tAR8dIEs015774; Fri, 27 Nov 2015 16:39:18 +0800 Received: from shecgisg003.sh.intel.com (localhost [127.0.0.1]) by shecgisg003.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id tAR8dGor019272; Fri, 27 Nov 2015 16:39:18 +0800 Received: (from yliu84x@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id tAR8dGf7019268; Fri, 27 Nov 2015 16:39:16 +0800 From: Yong Liu To: dts@dpdk.org Date: Fri, 27 Nov 2015 16:39:15 +0800 Message-Id: <1448613555-19236-1-git-send-email-yong.liu@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dts] [PATCH] framework: init pexcept sessions from crb instance 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: Fri, 27 Nov 2015 08:39:22 -0000 From: Marvin Liu Dut and tester will inherit pexpect sessions from crb instance. Session is basic componment of crb instance, should be initialized in crb module. Signed-off-by: Marvin Liu diff --git a/framework/crb.py b/framework/crb.py index fcbd7d9..9ce68e9 100644 --- a/framework/crb.py +++ b/framework/crb.py @@ -34,6 +34,8 @@ import dts import re import os from settings import TIMEOUT, IXIA +from ssh_connection import SSHConnection +from logger import getLogger """ CRB (customer reference board) basic functions and handlers @@ -48,13 +50,23 @@ class Crb(object): CPU/PCI/NIC on the board and setup running environment for DPDK. """ - def __init__(self, crb, serializer): + def __init__(self, crb, serializer, name): self.crb = crb self.read_cache = False self.skip_setup = False self.serializer = serializer self.ports_info = None + self.logger = getLogger(name) + self.session = SSHConnection(self.get_ip_address(), name, + self.get_password()) + self.session.init_log(self.logger) + self.alt_session = SSHConnection( + self.get_ip_address(), + self.NAME + '_alt', + self.get_password()) + self.alt_session.init_log(self.logger) + def send_expect(self, cmds, expected, timeout=TIMEOUT, alt_session=False, verify=False): """ diff --git a/framework/dut.py b/framework/dut.py index 90a86f5..c75f325 100644 --- a/framework/dut.py +++ b/framework/dut.py @@ -39,7 +39,6 @@ from settings import NICS, LOG_NAME_SEP from ssh_connection import SSHConnection from crb import Crb from net_device import NetDevice -from logger import getLogger from virt_resource import VirtResource from utils import RED @@ -62,19 +61,10 @@ class Dut(Crb): PCI_DEV_CACHE_KEY = 'dut_pci_dev_info' def __init__(self, crb, serializer): - super(Dut, self).__init__(crb, serializer) self.NAME = 'dut' + super(Dut, self).__init__(crb, serializer, self.NAME) self.host_init_flag = False - self.logger = getLogger(self.NAME) - self.session = SSHConnection(self.get_ip_address(), self.NAME, - self.get_password()) - self.session.init_log(self.logger) - self.alt_session = SSHConnection( - self.get_ip_address(), - self.NAME + '_alt', - self.get_password()) - self.alt_session.init_log(self.logger) self.number_of_cores = 0 self.tester = None self.cores = [] diff --git a/framework/tester.py b/framework/tester.py index 1f4f7ae..aeae1f8 100644 --- a/framework/tester.py +++ b/framework/tester.py @@ -58,17 +58,8 @@ class Tester(Crb): PCI_DEV_CACHE_KEY = 'tester_pci_dev_info' def __init__(self, crb, serializer): - super(Tester, self).__init__(crb, serializer) self.NAME = 'tester' - - self.logger = getLogger(self.NAME) - self.session = SSHConnection(self.get_ip_address(), - self.NAME, self.get_password()) - self.session.init_log(self.logger) - self.alt_session = SSHConnection(self.get_ip_address(), - self.NAME + '_alt', - self.get_password()) - self.alt_session.init_log(self.logger) + super(Tester, self).__init__(crb, serializer, self.NAME) self.bgProcIsRunning = False self.dut = None -- 1.9.3