[dts] [PATCH] framework: test case nic code name strip from pci type

Xu, HuilongX huilongx.xu at intel.com
Tue Mar 10 01:41:49 CET 2015


Acked-by: huilong xu <huilongx.xu at intel.com>
- Tested OS: FC21
- Kernel: 3.17.1-302.fc21.x86_64
- GCC: gcc version 4.9.1 20140930 (Red Hat 4.9.1-11) (GCC)
- CPU: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz
- NIC: Intel Corporation Ethernet Controller X710 for 10GbE SFP+
- Default x86_64-native-linuxapp-gcc configuration

-----Original Message-----
From: dts [mailto:dts-bounces at dpdk.org] On Behalf Of Yong Liu
Sent: Monday, March 09, 2015 5:23 PM
To: dts at dpdk.org
Subject: [dts] [PATCH] framework: test case nic code name strip from pci type

Case should not take configuration param as real nic name. NIC code name now
convert from dut pci type.

Signed-off-by: Marvin Liu <yong.liu at intel.com>

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



More information about the dts mailing list