From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 357225580 for ; Thu, 4 Aug 2016 15:18:46 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 04 Aug 2016 06:18:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,470,1464678000"; d="scan'208";a="1019597338" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by fmsmga001.fm.intel.com with ESMTP; 04 Aug 2016 06:18:44 -0700 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id u74DIhPo030461; Thu, 4 Aug 2016 21:18:43 +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 u74DIeKB014748; Thu, 4 Aug 2016 21:18:42 +0800 Received: (from yliu84x@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id u74DIexb014744; Thu, 4 Aug 2016 21:18:40 +0800 From: Marvin Liu To: dts@dpdk.org Cc: Marvin Liu Date: Thu, 4 Aug 2016 21:18:32 +0800 Message-Id: <1470316714-14698-3-git-send-email-yong.liu@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1470316714-14698-1-git-send-email-yong.liu@intel.com> References: <1470316714-14698-1-git-send-email-yong.liu@intel.com> Subject: [dts] [PATCH 2/4] framework: fix cache option not work 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: Thu, 04 Aug 2016 13:18:46 -0000 When cache option enabled, port information retrieved from cache file. Netdevice object should be initialized based on port infor. Signed-off-by: Marvin Liu diff --git a/framework/dut.py b/framework/dut.py index 88c4679..f76b4f4 100644 --- a/framework/dut.py +++ b/framework/dut.py @@ -213,6 +213,10 @@ class Dut(Crb): """ Restore all ports's interfaces. """ + # no need to restore for all info has been recorded + if self.read_cache: + return + restore_interfaces = getattr(self, 'restore_interfaces_%s' % self.get_os_type()) return restore_interfaces() @@ -546,7 +550,7 @@ class Dut(Crb): """ Rescan ports information """ - if self.read_cache and self.load_serializer_ports(): + if self.read_cache: return if self.ports_info: @@ -565,12 +569,13 @@ class Dut(Crb): for port_info in self.ports_info: port = port_info['port'] - intf = port_info['intf'] + intf = port.get_interface_name() + port_info['intf'] = intf out = self.send_expect("ip link show %s" % intf, "# ") if "DOWN" in out: self.send_expect("ip link set %s up" % intf, "# ") time.sleep(5) - macaddr = port_info['mac'] + port_info['mac'] = port.get_mac_addr() out = self.send_expect("ip -family inet6 address show dev %s | awk '/inet6/ { print $2 }'" % intf, "# ") ipv6 = out.split('/')[0] @@ -644,14 +649,17 @@ class Dut(Crb): return for port_info in self.ports_info: - port = GetNicObj(self, port_info['pci'], port_info['type']) - intf = port.get_interface_name() - - self.logger.info("DUT cached: [%s %s] %s" % (port_info['pci'], - port_info['type'], intf)) + addr_array = port_info['pci'].split(':') + domain_id = addr_array[0] + bus_id = addr_array[1] + devfun_id = addr_array[2] + port = GetNicObj(self, domain_id, bus_id, devfun_id) port_info['port'] = port + self.logger.info("DUT cached: [%s %s] %s" % (port_info['pci'], + port_info['type'], port_info['intf'])) + def scan_ports_uncached(self): """ Scan ports and collect port's pci id, mac adress, ipv6 address. diff --git a/framework/tester.py b/framework/tester.py index cadc3ad..962aaf8 100644 --- a/framework/tester.py +++ b/framework/tester.py @@ -293,7 +293,12 @@ class Tester(Crb): if port_info['type'] == 'ixia': continue - port = GetNicObj(self, port_info['pci'], port_info['type']) + addr_array = port_info['pci'].split(':') + domain_id = addr_array[0] + bus_id = addr_array[1] + devfun_id = addr_array[2] + + port = GetNicObj(self, domain_id, bus_id, devfun_id) intf = port.get_interface_name() self.logger.info("Tester cached: [000:%s %s] %s" % ( -- 1.9.3