test suite reviews and discussions
 help / color / mirror / Atom feed
From: Yong Liu <yong.liu@intel.com>
To: dts@dpdk.org
Subject: [dts] [PATCH V2 4/5] framework: optimize wirespeed calculation and kill_all function
Date: Fri, 13 Feb 2015 10:14:53 +0800	[thread overview]
Message-ID: <1423793694-14183-5-git-send-email-yong.liu@intel.com> (raw)
In-Reply-To: <1423793694-14183-1-git-send-email-yong.liu@intel.com>

When calculate wirespeed of one dut port, we need known both driver and nic 
name. All nic use ixgbe driver, wirespeed is 10G. NIC avoton2c5 wirespeed is 
 2.5G. NIC fortville_eagle wirespeed is 10G. Other Fortville NICs wirespeed 
is 40G.

Signed-off-by: Marvinliu <yong.liu@intel.com>
---
 framework/crb.py       |  1 -
 framework/test_case.py | 26 ++++++++++++++++++++------
 2 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/framework/crb.py b/framework/crb.py
index fa03757..fb3639c 100644
--- a/framework/crb.py
+++ b/framework/crb.py
@@ -284,7 +284,6 @@ class Crb(object):
                 | awk '/config/ {print $2}'` ; do kill -9 $i; done"
         self.alt_session.session.send_expect(cmd, "# ", 10)
         time.sleep(.7)
-        self.check_os_type()
 
     def close(self):
         """
diff --git a/framework/test_case.py b/framework/test_case.py
index c5dd10f..fbde06c 100644
--- a/framework/test_case.py
+++ b/framework/test_case.py
@@ -33,9 +33,9 @@
 A base class for creating DTF test cases.
 """
 
+import dts
 from exception import VerifyFailure
-from settings import DRIVERS
-
+from settings import DRIVERS, NICS
 
 class TestCase(object):
 
@@ -67,18 +67,32 @@ class TestCase(object):
 
         raise ValueError(nic_name)
 
+    def get_nic_name(self, pci_id):
+        for nic_name, pci in NICS.items():
+            if pci_id == pci:
+                return nic_name
+
+        raise ValueError(nic_name)
+
     def wirespeed(self, nic, frame_size, num_ports):
         """
         Calculate bit rate. It is depended for NICs
         """
         bitrate = 1000.0  # 1Gb ('.0' forces to operate as float)
-        if self.get_nic_driver(self.nic) == "ixgbe":
+        if self.nic == "any" or self.nic == "cfg":
+            driver = dts.get_nic_driver(self.dut.ports_info[0]['type'])
+            nic = self.get_nic_name(self.dut.ports_info[0]['type'])
+        else:
+            driver = self.get_nic_driver(self.nic)
+            nic = self.nic
+
+        if driver == "ixgbe":
             bitrate *= 10  # 10 Gb NICs
-        elif self.nic == "avoton2c5":
+        elif nic == "avoton2c5":
             bitrate *= 2.5  # 2.5 Gb NICs
-        elif self.nic in ["fortville_spirit", "fortville_spirit_single"]:
+        elif nic in ["fortville_spirit", "fortville_spirit_single"]:
             bitrate *= 40
-        elif self.nic == 'fortville_eagle':
+        elif nic == 'fortville_eagle':
            bitrate *= 10
 
         return bitrate * num_ports / 8 / (frame_size + 20)
-- 
1.9.3

  parent reply	other threads:[~2015-02-13  2:15 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-12  8:09 [dts] [PATCH 0/5] Support IXIA performance validation on one platform Yong Liu
2015-02-12  8:09 ` [dts] [PATCH 1/5] framework: remove useless nic list, replaced by port configuration file Yong Liu
2015-02-12  8:09 ` [dts] [PATCH 2/5] framework: support configure IXIA port as tester peer port Yong Liu
2015-02-12  8:09 ` [dts] [PATCH 3/5] framework: seperate killl scapy and kill DPDK application in kill_all function Yong Liu
2015-02-12  8:09 ` [dts] [PATCH 4/5] framework: optimize wirespeed calculation and " Yong Liu
2015-02-12  8:09 ` [dts] [PATCH 5/5] pmd: remove useless nic check function Yong Liu
2015-02-12  9:08 ` [dts] [PATCH 0/5] Support IXIA performance validation on one platform Qiu, Michael
2015-02-13  0:44   ` Liu, Yong
2015-02-13  2:14 ` [dts] [PATCH V2 " Yong Liu
2015-02-13  2:14   ` [dts] [PATCH V2 1/5] framework: remove useless nic list, replaced by port configuration file Yong Liu
2015-02-13  2:14   ` [dts] [PATCH V2 2/5] framework: support configure IXIA port as tester peer port Yong Liu
2015-02-13  2:14   ` [dts] [PATCH V2 3/5] framework: seperate killl scapy and kill DPDK application in kill_all function Yong Liu
2015-02-13  2:14   ` Yong Liu [this message]
2015-02-13  2:14   ` [dts] [PATCH V2 5/5] pmd: remove useless nic check function Yong Liu
2015-02-15  7:05   ` [dts] [PATCH V2 0/5] Support IXIA performance validation on one platform Qiu, Michael
2015-02-16  3:07 ` [dts] [PATCH V3 " Yong Liu
2015-02-16  3:07   ` [dts] [PATCH V3 1/5] framework: remove useless nic list, replaced by port configuration file Yong Liu
2015-02-16  3:07   ` [dts] [PATCH V3 2/5] framework: support configure IXIA port as tester peer port Yong Liu
2015-02-16  3:07   ` [dts] [PATCH V3 3/5] framework: seperate kill scapy and DPDK application in kill_all function Yong Liu
2015-02-16  3:07   ` [dts] [PATCH V3 4/5] framework: optimize wirespeed calculation and " Yong Liu
2015-02-16  3:07   ` [dts] [PATCH V3 5/5] pmd: remove useless nic check function Yong Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1423793694-14183-5-git-send-email-yong.liu@intel.com \
    --to=yong.liu@intel.com \
    --cc=dts@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).