test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH] framework: test case nic code name strip from pci type
@ 2015-03-09  9:22 Yong Liu
  2015-03-10  0:41 ` Xu, HuilongX
  0 siblings, 1 reply; 3+ messages in thread
From: Yong Liu @ 2015-03-09  9:22 UTC (permalink / raw)
  To: dts

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@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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dts] [PATCH] framework: test case nic code name strip from pci type
  2015-03-09  9:22 [dts] [PATCH] framework: test case nic code name strip from pci type Yong Liu
@ 2015-03-10  0:41 ` Xu, HuilongX
  2015-03-10  1:47   ` Liu, Yong
  0 siblings, 1 reply; 3+ messages in thread
From: Xu, HuilongX @ 2015-03-10  0:41 UTC (permalink / raw)
  To: Liu, Yong, dts


Acked-by: huilong xu <huilongx.xu@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@dpdk.org] On Behalf Of Yong Liu
Sent: Monday, March 09, 2015 5:23 PM
To: dts@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@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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dts] [PATCH] framework: test case nic code name strip from pci type
  2015-03-10  0:41 ` Xu, HuilongX
@ 2015-03-10  1:47   ` Liu, Yong
  0 siblings, 0 replies; 3+ messages in thread
From: Liu, Yong @ 2015-03-10  1:47 UTC (permalink / raw)
  To: Xu, HuilongX, dts

Applied in next branch, thx.
> Acked-by: huilong xu <huilongx.xu@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@dpdk.org] On Behalf Of Yong Liu
> Sent: Monday, March 09, 2015 5:23 PM
> To: dts@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@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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-03-10  1:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-09  9:22 [dts] [PATCH] framework: test case nic code name strip from pci type Yong Liu
2015-03-10  0:41 ` Xu, HuilongX
2015-03-10  1:47   ` Liu, Yong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).