From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 4B01E8E68 for ; Tue, 19 Jan 2016 02:38:25 +0100 (CET) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP; 18 Jan 2016 17:38:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,315,1449561600"; d="scan'208";a="884235747" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by fmsmga001.fm.intel.com with ESMTP; 18 Jan 2016 17:38:20 -0800 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id u0J1cIVq012541; Tue, 19 Jan 2016 09:38: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 u0J1cGbh001668; Tue, 19 Jan 2016 09:38:18 +0800 Received: (from yliu84x@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id u0J1cFrC001664; Tue, 19 Jan 2016 09:38:15 +0800 From: Yong Liu To: dts@dpdk.org Date: Tue, 19 Jan 2016 09:38:06 +0800 Message-Id: <1453167491-1632-1-git-send-email-yong.liu@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dts] [PATCH v2 1/6] framework tester: NIC object get from net_device 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: Tue, 19 Jan 2016 01:38:25 -0000 All nic object should get from net device module. If object has been initalized, there's no need to re-instantiated it. Signed-off-by: Marvin Liu diff --git a/framework/tester.py b/framework/tester.py index c8cebd6..d3dab04 100644 --- a/framework/tester.py +++ b/framework/tester.py @@ -37,7 +37,7 @@ import re from time import sleep from settings import NICS from crb import Crb -from net_device import NetDevice +from net_device import GetNicObj from etgen import IxiaPacketGenerator, SoftwarePacketGenerator from settings import IXIA import random @@ -201,7 +201,7 @@ class Tester(Crb): try: for (pci_bus, pci_id) in self.pci_devices_info: addr_array = pci_bus.split(':') - port = NetDevice(self, addr_array[0], addr_array[1]) + port = GetNicObj(self, addr_array[0], addr_array[1]) itf = port.get_interface_name() self.enable_ipv6(itf) self.send_expect("ifconfig %s up" % itf, "# ") @@ -266,7 +266,7 @@ class Tester(Crb): if port_info['type'] == 'ixia': continue - port = NetDevice(self, port_info['pci'], port_info['type']) + port = GetNicObj(self, port_info['pci'], port_info['type']) intf = port.get_interface_name() self.logger.info("Tester cached: [000:%s %s] %s" % ( @@ -290,7 +290,7 @@ class Tester(Crb): bus_id = addr_array[0] devfun_id = addr_array[1] - port = NetDevice(self, bus_id, devfun_id) + port = GetNicObj(self, bus_id, devfun_id) intf = port.get_interface_name() if "No such file" in intf: @@ -496,7 +496,7 @@ class Tester(Crb): pkt = pkt_c(pkt_type=pkt_type, pkt_len=random.randint(64, 1514), ran_payload=True) - # config packet if has parameters + if params and len(portList) == len(params): for param in params: layer, config = param -- 1.9.3