From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 81C0D58E4 for ; Mon, 9 Mar 2015 10:22:58 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 09 Mar 2015 02:21:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,366,1422950400"; d="scan'208";a="695832382" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga002.jf.intel.com with ESMTP; 09 Mar 2015 02:22:56 -0700 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id t299MrwI025911; Mon, 9 Mar 2015 17:22:53 +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 t299MpwE013130; Mon, 9 Mar 2015 17:22:53 +0800 Received: (from yliu84x@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id t299Mot7013126; Mon, 9 Mar 2015 17:22:50 +0800 From: Yong Liu To: dts@dpdk.org Date: Mon, 9 Mar 2015 17:22:49 +0800 Message-Id: <1425892969-13094-1-git-send-email-yong.liu@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dts] [PATCH] framework: test case nic code name strip from pci type 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: Mon, 09 Mar 2015 09:22:59 -0000 Case should not take configuration param as real nic name. NIC code name now convert from dut pci type. Signed-off-by: Marvin Liu diff --git a/framework/dts.py b/framework/dts.py index 1c7a43e..ae12dc9 100644 --- a/framework/dts.py +++ b/framework/dts.py @@ -358,7 +358,7 @@ def dts_run_suite(crbInst, test_suites, target, nic): test_module = __import__('TestSuite_' + test_suite) for test_classname, test_class in get_subclasses(test_module, TestCase): - test_suite = test_class(dut, tester, target, nic) + test_suite = test_class(dut, tester, target) dts_log_testsuite(test_suite, log_handler, test_classname) log_handler.info("\nTEST SUITE : " + test_classname) diff --git a/framework/settings.py b/framework/settings.py index 41c9c2c..70e6999 100644 --- a/framework/settings.py +++ b/framework/settings.py @@ -136,3 +136,12 @@ TIMEOUT = 15 Global macro for dts. """ IXIA = "ixia" + +def nic_name_from_type(self, type): + """ + strip nic code name by nic type + """ + for name, nic_type in NICS.items(): + if nic_type == type: + return name + return 'Unknown' diff --git a/framework/test_case.py b/framework/test_case.py index b1595fb..3d2e2dc 100644 --- a/framework/test_case.py +++ b/framework/test_case.py @@ -35,16 +35,20 @@ A base class for creating DTF test cases. import dts from exception import VerifyFailure -from settings import DRIVERS, NICS +from settings import DRIVERS, NICS, nic_name_from_type class TestCase(object): - def __init__(self, dut, tester, target, nic): + def __init__(self, dut, tester, target): self.dut = dut self.tester = tester self.target = target - self.nic = nic + self.nics = [] + for portid in range(len(self.dut.ports_info)): + nic_type = self.dut.ports_info[portid]['type'] + self.nics.append(nic_name_from_type(nic_type)) + self.nic = self.nics[0] def set_up_all(self): pass -- 1.9.3