test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH V1] add test suite l2fwd_jobstats
@ 2017-02-20  9:08 xu,gang
  2017-02-20  9:08 ` [dts] [PATCH V1] add test plan l2fwd_jobstats xu,gang
  0 siblings, 1 reply; 2+ messages in thread
From: xu,gang @ 2017-02-20  9:08 UTC (permalink / raw)
  To: dts; +Cc: xu,gang

Signed-off-by: xu,gang <gangx.xu@intel.com>
---
 tests/TestSuite_l2fwd_jobstats.py | 201 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 201 insertions(+)
 create mode 100644 tests/TestSuite_l2fwd_jobstats.py

diff --git a/tests/TestSuite_l2fwd_jobstats.py b/tests/TestSuite_l2fwd_jobstats.py
new file mode 100644
index 0000000..858b710
--- /dev/null
+++ b/tests/TestSuite_l2fwd_jobstats.py
@@ -0,0 +1,201 @@
+# BSD LICENSE
+#
+# Copyright(c) 2010-2017 Intel Corporation. All rights reserved.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+#   * Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+#   * Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in
+#     the documentation and/or other materials provided with the
+#     distribution.
+#   * Neither the name of Intel Corporation nor the names of its
+#     contributors may be used to endorse or promote products derived
+#     from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+"""
+DPDK Test suite.
+Test l2fwd-jobstats
+"""
+
+import string
+import time
+import re
+import utils
+from test_case import TestCase
+from qemu_kvm import QEMUKvm
+from packet import Packet, sniff_packets, load_sniff_packets
+
+
+class TestL2fwdJobstats(TestCase):
+
+    def set_up_all(self):
+        """
+        Run at the start of each test suite.
+        """
+
+        self.dut_ports = self.dut.get_ports(self.nic)
+        self.verify(len(self.dut_ports) >= 2, "Insufficient ports")
+        cores = self.dut.get_core_list("1S/4C/1T")
+        self.coremask = utils.create_mask(cores)
+        self.portmask = utils.create_mask(self.dut_ports)
+        self.path = "./examples/l2fwd-jobstats/build/l2fwd-jobstats"
+
+        self.tester_tx_port = self.tester.get_local_port(self.dut_ports[0])
+        self.tester_tx_pci = self.tester.ports_info[self.tester_tx_port]['pci']
+        port = self.tester.ports_info[self.tester_tx_port]['port']
+        self.tester_port_driver = port.get_nic_driver()
+        self.intf = port.get_interface_name()
+
+        # build sample app
+        out = self.dut.build_dpdk_apps("./examples/l2fwd-jobstats")
+        self.verify("Error" not in out, "compilation error 1")
+        self.verify("No such file" not in out, "compilation error 2")
+
+    def set_up(self):
+        """
+        Run before each test case.
+        """
+        pass
+
+    def generate_pcap_pkt(self, dst, load, pktname='flow.pcap'):
+        """
+        generate pcap pkt
+        """
+        context = '[Ether(dst="%s")/IP()/Raw(load=%s)]' % (dst, load)
+        self.session_secondary.send_expect('scapy', '>>> ', 10)
+        self.session_secondary.send_expect(
+            'wrpcap("%s", %s)' % (pktname, context), '>>> ', 10)
+        self.session_secondary.send_expect('quit()', '#', 10)
+
+    def pktgen_prerequisites(self):
+        """
+        igb_uio.ko should be put in 
+        have enough hugetpages
+        bind port 
+        before you using pktgen
+        """
+        self.tester.send_expect("modprobe uio", "#", 70)
+        out = self.tester.send_expect("lsmod | grep igb_uio", "#")
+        if "igb_uio" not in out:
+            self.tester.send_expect("rmmod -f igb_uio", "#", 70)
+            self.tester.send_expect(
+                "insmod ~/dpdk/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko", "#", 70)
+            out = self.tester.send_expect("lsmod | grep igb_uio", "#")
+            self.verify("igb_uio" in out,
+                        "No file igb_uio.ko, please add it in ~")
+        total_huge_pages = self.tester.get_total_huge_pages()
+        if total_huge_pages == 0:
+            self.tester.mount_huge_pages()
+        self.tester.send_expect(
+            "./dpdk_nic_bind.py --bind=igb_uio %s" % self.tester_tx_pci, "#")
+
+    def start_pktgen(self, pktname='flow.pcap'):
+        """
+        start pktgen with pcap file
+        """
+        self.session_secondary.send_expect(
+            "tar xvf ./dep/tgen.tgz -C ~", '#', 20)
+        self.session_secondary.send_expect(
+            "./pktgen -c 0xf -n 2 --proc-type auto -- -P -T -m '1.0' -s 0:%s" % pktname, "", 100)
+
+    def set_parameter(self, rate, count):
+        """
+        start pgtgen with send package's rate and count
+        """
+        self.session_secondary.send_expect("set 0 rate %s" % rate, "", 20)
+        self.session_secondary.send_expect("set 0 count %d" % count, "", 20)
+        self.session_secondary.send_expect("start all", "", 20)
+
+    def test_stability_rate(self):
+        """
+        Verify l2fwd_jobstats rx package stability on different rate
+        """
+        cmd = self.path + " -c %s -n %d -- -q 8 -p %s -l" % (
+            self.coremask, self.dut.get_memory_channels(), self.portmask)
+        self.dut.send_expect(cmd, "Port statistics", 60)
+        out = self.dut.get_session_output(timeout=1)
+        total_sent = re.search("Total packets sent:\s*(\d*)", out)
+        total_received = re.search("Total packets received:\s*(\d*)", out)
+        total_dropped = re.search("Total packets dropped:\s*(\d*)", out)
+        pack_sent = total_sent.group(1)
+        pack_received = total_received.group(1)
+        pack_dropped = total_dropped.group(1)
+        self.verify(int(pack_sent) == int(pack_received) == int(
+            pack_dropped) == 0, "Error: get wrong package")
+
+        self.pktgen_prerequisites()
+        self.session_secondary = self.tester.create_session(
+            name='pktgen_session')
+        dst = self.dut.ports_info[self.dut_ports[0]]['mac']
+        load = "'X'*46"
+        self.generate_pcap_pkt(dst, load)
+        self.start_pktgen()
+        total = []
+        rates = [10, 20, 30, 40, 50, 60, 70, 80, 90]
+        for rate in rates:
+            self.set_parameter(rate, 1000000000)
+            put = self.dut.get_session_output(timeout=60)
+            pkt_rare = re.findall(r"management\s.*\s(\d*.\d*)%", put)
+            pkt_received = re.findall("Total packets received:\s*(\d*)", put)
+            total.append(float(max(pkt_rare)))
+
+        self.verify(sorted(total) == total, "Error: %s rate abnormal" % total)
+
+    def test_stability_rx(self):
+        """
+        Verify l2fwd_jobstats rx package stability
+        """
+        cmd = self.path + " -c %s -n %d -- -q 8 -p %s -l" % (
+            self.coremask, self.dut.get_memory_channels(), self.portmask)
+        self.dut.send_expect(cmd, "Port statistics", 60)
+        self.scapy_send_packet(100)
+        out = self.dut.get_session_output(timeout=60)
+        total_received = re.findall("Total packets received:\s*(\d*)", out)
+
+        self.verify(int(max(total_received)) == 100,
+                    "Error: get only %s not 1000000" % int(max(total_received)))
+
+    def scapy_send_packet(self, num=1):
+        """
+        Send a packet to port
+        """
+        self.dmac = self.dut.get_mac_address(self.dut_ports[0])
+        txport = self.tester.get_local_port(self.dut_ports[0])
+        self.txItf = self.tester.get_interface(txport)
+        pkt = Packet(pkt_type='UDP')
+        pkt.config_layer('ether', {'dst': self.dmac, })
+        pkt.send_pkt(tx_port=self.txItf, count=num)
+
+    def tear_down(self):
+        """
+        Run after each test case.
+        """
+        self.tester.send_expect("./dpdk_nic_bind.py --bind=%s %s" %
+                                (self.tester_port_driver, self.tester_tx_pci), "#")
+        self.tester.send_expect("ifconfig %s up" % self.intf, "#")
+        self.dut.kill_all()
+        time.sleep(2)
+
+    def tear_down_all(self):
+        """
+        Run after each test suite.
+        """
+        pass
-- 
1.9.3

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

* [dts] [PATCH V1] add test plan l2fwd_jobstats
  2017-02-20  9:08 [dts] [PATCH V1] add test suite l2fwd_jobstats xu,gang
@ 2017-02-20  9:08 ` xu,gang
  0 siblings, 0 replies; 2+ messages in thread
From: xu,gang @ 2017-02-20  9:08 UTC (permalink / raw)
  To: dts; +Cc: xu,gang

Signed-off-by: xu,gang <gangx.xu@intel.com>
---
 test_plans/l2fwd_jobstats_test_plan.rst | 139 ++++++++++++++++++++++++++++++++
 1 file changed, 139 insertions(+)
 create mode 100644 test_plans/l2fwd_jobstats_test_plan.rst

diff --git a/test_plans/l2fwd_jobstats_test_plan.rst b/test_plans/l2fwd_jobstats_test_plan.rst
new file mode 100644
index 0000000..3d04169
--- /dev/null
+++ b/test_plans/l2fwd_jobstats_test_plan.rst
@@ -0,0 +1,139 @@
+.. Copyright (c) < 2017 >, Intel Corporation
+    All rights reserved.
+
+    Redistribution and use in source and binary forms, with or without
+    modification, are permitted provided that the following conditions
+    are met:
+
+    - Redistributions of source code must retain the above copyright
+        notice, this list of conditions and the following disclaimer.
+
+    - Redistributions in binary form must reproduce the above copyright
+        notice, this list of conditions and the following disclaimer in
+        the documentation and / or other materials provided with the
+        distribution.
+
+    - Neither the name of Intel Corporation nor the names of its
+        contributors may be used to endorse or promote products derived
+        from this software without specific prior written permission.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+    "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+    FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+    COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+    INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+    (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+     SERVICES
+     LOSS OF USE, DATA, OR PROFITS
+     OR BUSINESS INTERRUPTION)
+    HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+    STRICT LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE)
+    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+    OF THE POSSIBILITY OF SUCH DAMAGE.
+
+== == == == == == == == == == == == == == == == ==
+l2fwd - jobstats test plan
+== == == == == == == == == == == == == == == == ==
+
+This test plan will cover the basic l2fwd - jobstats case
+and will be worked as a regression test plan.
+
+Test Case1:
+    check different send rate the sample received rate
+== == == == == == == == == == == == == == == == == == == == == == == == 
+1. Bind two NIC port to igb_uio, then launch the l2fwd - jobstats sample
+
+    app / l2fwd - jobstats - c 0x03 - n4 - - -q 2 - p 03 - l
+    testpmd >
+
+2. Check the output, the Idle(Job) should occupy most of the CPU time
+and all statistic is zero. Like following:
+
+Port statistics == == == == == == == == == == == == == == == == == == ==
+Statistics for port 0 - -----------------------------
+Packets sent:
+    0
+Packets received:
+    0
+Packets dropped:
+    0
+Statistics for port 1 - -----------------------------
+Packets sent:
+    0
+Packets received:
+    0
+Packets dropped:
+    0
+Aggregate statistics == == == == == == == == == == == == == == == == == ==
+Total packets sent:
+    0
+Total packets received:
+    0
+Total packets dropped:
+    0
+== == == == == == == == == == == == == == == == == == == == == == == == == 
+----------------
+LCore   0:
+    statistics(time in ns, collected in 275, 887, 870)
+Stat type                   total % total        avg        min        max
+Stats duration:
+    10, 275, 967, 160
+Loop count:
+    304, 669
+Exec time               8, 127, 075    0.1 % 26         23 15, 956, 536
+Management time       316, 445, 834    3.1 % 1, 039         14 16, 002, 986
+Exec + management     324, 572, 909    3.2 % 1, 065         37 31, 959, 522
+Idle(job)          9, 951, 394, 251   96.8 % 47, 560         37 15, 956, 536
+
+Job 0:
+    port 0 fwd
+Exec count:
+    101, 146
+Exec period:
+    100, 035
+Exec time               2, 456, 268    0.0 % 24         23        843
+
+Job 1:
+    port 1 fwd
+Exec count:
+    101, 146
+Exec period:
+    100, 035
+Exec time               2, 469, 969    0.0 % 24         23      2, 086
+
+Job 2:
+    flush
+Exec count:
+    102, 723
+Exec period:
+    100, 036
+Exec time               3, 200, 838    0.0 % 31         30        471
+== == == == == == == == == == == == == == == == == == == == == == == == == ==
+
+3.Send packets to NIC port with different rate, check the core status reported
+by l2fwd - jobstats sample is correct Increase the packet send rate from 0 % 
+linerateto 100 % linerate. Check the "Exec + management" percentage can increase
+with the packet rate accordingly
+
+Stat type                   total % total        avg        min        max
+Stats duration:
+    10, 275, 967, 160
+Loop count:
+    304, 669
+Exec time               8, 127, 075    0.1 % 26         23 15, 956, 536
+Management time       316, 445, 834    3.1 % 1, 039         14 16, 002, 986
+Exec + management     324, 572, 909    3.2 % 1, 065         37 31, 959, 522
+Idle(job)          9, 951, 394, 251   96.8 % 47, 560         37 15, 956, 536
+
+
+Test Case2:
+    Check the packet statistic is correct
+== == == == == == == == == == == == == == == == == == == == == == == == == == ==
+1. Bind two NIC port to igb_uio, then launch the l2fwd - jobstats sample
+
+    app / l2fwd - jobstats - c 0x03 - n4 - - -q 2 - p 03 - l
+
+2. Send 10, 000, 000 packet to port 1 and 10, 000, 000 packets to port 2, check the
+NIC packets number reported by sample is the same with waht we set at the packet
+generator side.
-- 
1.9.3

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

end of thread, other threads:[~2017-02-20  9:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-20  9:08 [dts] [PATCH V1] add test suite l2fwd_jobstats xu,gang
2017-02-20  9:08 ` [dts] [PATCH V1] add test plan l2fwd_jobstats xu,gang

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).