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 4EC6D5952 for ; Thu, 6 Aug 2015 14:35:35 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP; 06 Aug 2015 05:35:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,622,1432623600"; d="scan'208";a="779021290" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga002.jf.intel.com with ESMTP; 06 Aug 2015 05:35:34 -0700 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id t76CZW9F010610; Thu, 6 Aug 2015 20:35:32 +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 t76CZUqi003757; Thu, 6 Aug 2015 20:35:32 +0800 Received: (from yliu84x@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id t76CZUoU003753; Thu, 6 Aug 2015 20:35:30 +0800 From: Yong Liu To: dts@dpdk.org Date: Thu, 6 Aug 2015 20:35:21 +0800 Message-Id: <1438864522-3699-4-git-send-email-yong.liu@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1438864522-3699-1-git-send-email-yong.liu@intel.com> References: <1438864522-3699-1-git-send-email-yong.liu@intel.com> Subject: [dts] [PATCH 3/4] Move function accepted_nic to dts 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: Thu, 06 Aug 2015 12:35:35 -0000 From: Marvin Liu This function will use varaiable in dts. Moved to dts module will make settings module independent from it. Signed-off-by: Marvin Liu diff --git a/framework/dut.py b/framework/dut.py index a5c9db3..1199fc6 100644 --- a/framework/dut.py +++ b/framework/dut.py @@ -322,7 +322,7 @@ class Dut(Crb): current_nic = 0 for (pci_bus, pci_id) in self.pci_devices_info: - if settings.accepted_nic(pci_id): + if dts.accepted_nic(pci_id): if self.is_ssh_session_port(pci_bus): continue @@ -345,7 +345,7 @@ class Dut(Crb): current_nic = 0 for (pci_bus, pci_id) in self.pci_devices_info: - if settings.accepted_nic(pci_id): + if dts.accepted_nic(pci_id): if self.is_ssh_session_port(pci_bus): continue @@ -671,7 +671,7 @@ class Dut(Crb): for (pci_bus, pci_id) in self.pci_devices_info: - if not settings.accepted_nic(pci_id): + if not dts.accepted_nic(pci_id): self.logger.info("DUT: [%s %s] %s" % (pci_bus, pci_id, skipped)) continue diff --git a/framework/project_dpdk.py b/framework/project_dpdk.py index 7b6e1ae..e0009d3 100644 --- a/framework/project_dpdk.py +++ b/framework/project_dpdk.py @@ -39,7 +39,7 @@ from crb import Crb from dut import Dut from tester import Tester from logger import getLogger -from settings import IXIA, accepted_nic +from settings import IXIA class DPDKdut(Dut): @@ -112,7 +112,7 @@ class DPDKdut(Dut): binding_list = '' for (pci_bus, pci_id) in self.pci_devices_info: - if accepted_nic(pci_id): + if dts.accepted_nic(pci_id): binding_list += '%s,' % (pci_bus) self.send_expect("kldunload if_ixgbe.ko", "#") diff --git a/framework/settings.py b/framework/settings.py index 631bd32..b371fd7 100644 --- a/framework/settings.py +++ b/framework/settings.py @@ -179,23 +179,6 @@ def get_nic_driver(pci_id): return driver -def accepted_nic(pci_id): - """ - Return True if the pci_id is a known NIC card in the settings file and if - it is selected in the execution file, otherwise it returns False. - """ - if pci_id not in NICS.values(): - return False - - if dts.nic is 'any': - return True - - else: - if pci_id == NICS[dts.nic]: - return True - - return False - def get_netdev(crb, pci): for port in crb.ports_info: if pci == port['pci']: -- 1.9.3