[dts] [PATCH] tests/vhost_pmd_xstats: Detect the categories of packet size from xstats
michael.luo at intel.com
michael.luo at intel.com
Wed Mar 6 08:19:12 CET 2019
From: Luo Gaoliang <michael.luo at intel.com>
Detecting the categories of packet size from xstats to test the
case test_based_size instead of using the hardcoded sizes. Because different
NICs may categorize the big packets differently. For example, a 1024Byte packet,
Niantic counts it into rx_size_1024_to_max_packets, but Fortville puts it into
tx_size_1024_to_1522_packets.
Signed-off-by: Luo Gaoliang <michael.luo at intel.com>
---
tests/TestSuite_vhost_pmd_xstats.py | 23 ++++++++---------------
1 file changed, 8 insertions(+), 15 deletions(-)
diff --git a/tests/TestSuite_vhost_pmd_xstats.py b/tests/TestSuite_vhost_pmd_xstats.py
index e33b342..db59f48 100755
--- a/tests/TestSuite_vhost_pmd_xstats.py
+++ b/tests/TestSuite_vhost_pmd_xstats.py
@@ -158,21 +158,14 @@ class TestVhostPmdXstats(TestCase):
Verify receiving and transmitting packets correctly in the Vhost PMD xstats
"""
self.prepare_start()
- sizes = [64, 65, 128, 256, 513, 1025]
- scope = ''
- for pktsize in sizes:
- if pktsize == 64:
- scope = 'size_64'
- elif 65 <= pktsize <= 127:
- scope = 'size_65_to_127'
- elif 128 <= pktsize <= 255:
- scope = 'size_128_to_255'
- elif 256 <= pktsize <= 511:
- scope = 'size_256_to_511'
- elif 512 <= pktsize <= 1023:
- scope = 'size_512_to_1023'
- elif 1024 <= pktsize:
- scope = 'size_1024_to_max'
+ out = self.dut.send_expect(
+ "show port xstats %s" % self.dut_ports[0], "testpmd>", 60)
+ p = re.compile(r'rx_size_[0-9]+_[to_\w+]*packets')
+ categories = p.findall(out)
+ self.verify(len(categories) > 0, 'Unable to find the categories of RX packet size!')
+ for cat in categories:
+ scope = re.search(r'(?<=rx_)\w+(?=_packets)', cat).group(0)
+ pktsize = int(re.search(r'(?<=rx_size_)\d+', cat).group(0))
self.scapy_send_packet(pktsize, self.dmac, 10000)
self.send_verify(scope, 10000)
--
2.7.4
More information about the dts
mailing list