test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH V1] tests/pvp_multi_paths: update code to support trex
@ 2019-08-12 23:44 lihong
  2019-08-14  2:42 ` Wang, Yinan
  2019-08-28  5:56 ` Tu, Lijuan
  0 siblings, 2 replies; 3+ messages in thread
From: lihong @ 2019-08-12 23:44 UTC (permalink / raw)
  To: dts; +Cc: lihong

Signed-off-by: lihong <lihongx.ma@intel.com>
---
 tests/TestSuite_pvp_multi_paths_performance.py     | 37 ++++++++++++++--------
 ...vp_multi_paths_vhost_single_core_performance.py | 31 +++++++++++-------
 ...p_multi_paths_virtio_single_core_performance.py | 36 +++++++++++++--------
 3 files changed, 65 insertions(+), 39 deletions(-)

diff --git a/tests/TestSuite_pvp_multi_paths_performance.py b/tests/TestSuite_pvp_multi_paths_performance.py
index 071b2c6..b633b98 100644
--- a/tests/TestSuite_pvp_multi_paths_performance.py
+++ b/tests/TestSuite_pvp_multi_paths_performance.py
@@ -1,6 +1,6 @@
 # BSD LICENSE
 #
-# Copyright(c) 2010-2019 Intel Corporation. All rights reserved.
+# Copyright(c) <2019> Intel Corporation. All rights reserved.
 # All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -36,7 +36,8 @@ Test PVP performance using virtio_user on 8 tx/rx path.
 
 import utils
 from test_case import TestCase
-from settings import HEADER_SIZE
+from packet import Packet, save_packets
+from pktgen import PacketGeneratorHelper
 
 
 class TestPVPMultiPathPerformance(TestCase):
@@ -48,8 +49,6 @@ class TestPVPMultiPathPerformance(TestCase):
         self.frame_sizes = [64, 128, 256, 512, 1024, 1518]
         self.core_config = "1S/4C/1T"
         self.number_of_ports = 1
-        self.headers_size = HEADER_SIZE['eth'] + HEADER_SIZE['ip'] + \
-            HEADER_SIZE['udp']
         self.dut_ports = self.dut.get_ports()
         self.verify(len(self.dut_ports) >= 1, "Insufficient ports for testing")
         self.ports_socket = self.dut.get_numa_id(self.dut_ports[0])
@@ -59,11 +58,18 @@ class TestPVPMultiPathPerformance(TestCase):
         self.core_list_host = self.core_list[2:4]
         self.core_mask_user = utils.create_mask(self.core_list_user)
         self.core_mask_host = utils.create_mask(self.core_list_host)
-        if self.dut.cores[len(self.dut.cores) - 1]['socket'] == '0':
+        if len(set([int(core['socket']) for core in self.dut.cores])) == 1:
             self.socket_mem = '1024'
         else:
             self.socket_mem = '1024,1024'
 
+        self.out_path = '/tmp'
+        out = self.tester.send_expect('ls -d %s' % self.out_path, '# ')
+        if 'No such file or directory' in out:
+            self.tester.send_expect('mkdir -p %s' % self.out_path, '# ')
+        # create an instance to set stream field setting
+        self.pktgen_helper = PacketGeneratorHelper()
+
     def set_up(self):
         """
         Run before each test case.
@@ -81,7 +87,6 @@ class TestPVPMultiPathPerformance(TestCase):
         """
         Send packet with packet generator and verify
         """
-        payload_size = frame_size - self.headers_size
         tgen_input = []
         for port in xrange(self.number_of_ports):
             rx_port = self.tester.get_local_port(
@@ -90,14 +95,17 @@ class TestPVPMultiPathPerformance(TestCase):
                 self.dut_ports[(port) % self.number_of_ports])
             destination_mac = self.dut.get_mac_address(
                 self.dut_ports[(port) % self.number_of_ports])
-            self.tester.scapy_append(
-                'wrpcap("l2fwd_%d.pcap", [Ether(dst="%s")/IP()/UDP()/("X"*%d)])' %
-                (port, destination_mac, payload_size))
 
-            tgen_input.append((tx_port, rx_port, "l2fwd_%d.pcap" % port))
+            pkt = Packet(pkt_type='UDP', pkt_len=frame_size)
+            pkt.config_layer('ether', {'dst': '%s' % destination_mac})
+            save_packets([pkt], "%s/multi_path_%d.pcap" % (self.out_path, port))
+            tgen_input.append((tx_port, rx_port, "%s/multi_path_%d.pcap" % (self.out_path, port)))
 
-        self.tester.scapy_execute()
-        _, pps = self.tester.traffic_generator_throughput(tgen_input)
+        self.tester.pktgen.clear_streams()
+        streams = self.pktgen_helper.prepare_stream_from_tginput(tgen_input, 100, None, self.tester.pktgen)
+        # set traffic option
+        traffic_opt = {'delay': 5}
+        _, pps = self.tester.pktgen.measure_throughput(stream_ids=streams, options=traffic_opt)
         Mpps = pps / 1000000.0
         self.verify(Mpps > 0, "%s can not receive packets of frame size %d" % (self.running_case, frame_size))
 
@@ -119,10 +127,11 @@ class TestPVPMultiPathPerformance(TestCase):
         self.dut.send_expect("killall -s INT testpmd", "#")
         self.dut.send_expect("killall -s INT qemu-system-x86_64", "#")
         command_line_client = "./%s/app/testpmd -n %d -c %s --socket-mem " + \
-                              " %s --legacy-mem --file-prefix=vhost --vdev " + \
+                              " %s --legacy-mem -w %s --file-prefix=vhost --vdev " + \
                               "'net_vhost0,iface=vhost-net,queues=1,client=0' -- -i --nb-cores=1 --txd=1024 --rxd=1024"
         command_line_client = command_line_client % (self.target,
-            self.dut.get_memory_channels(), self.core_mask_host, self.socket_mem)
+            self.dut.get_memory_channels(), self.core_mask_host,
+            self.socket_mem, self.dut.ports_info[self.dut_ports[0]]['pci'])
         self.vhost.send_expect(command_line_client, "testpmd> ", 120)
         self.vhost.send_expect("set fwd mac", "testpmd> ", 120)
         self.vhost.send_expect("start", "testpmd> ", 120)
diff --git a/tests/TestSuite_pvp_multi_paths_vhost_single_core_performance.py b/tests/TestSuite_pvp_multi_paths_vhost_single_core_performance.py
index 8d94491..fcaadf2 100644
--- a/tests/TestSuite_pvp_multi_paths_vhost_single_core_performance.py
+++ b/tests/TestSuite_pvp_multi_paths_vhost_single_core_performance.py
@@ -1,6 +1,6 @@
 # BSD LICENSE
 #
-# Copyright(c) 2010-2019 Intel Corporation. All rights reserved.
+# Copyright(c) <2019> Intel Corporation. All rights reserved.
 # All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -36,7 +36,8 @@ Test PVP vhost single core performance using virtio_user on 8 tx/rx path.
 
 import utils
 from test_case import TestCase
-from settings import HEADER_SIZE
+from packet import Packet, save_packets
+from pktgen import PacketGeneratorHelper
 
 
 class TestPVPMultiPathVhostPerformance(TestCase):
@@ -48,8 +49,6 @@ class TestPVPMultiPathVhostPerformance(TestCase):
         self.frame_sizes = [64, 128, 256, 512, 1024, 1518]
         self.core_config = "1S/5C/1T"
         self.number_of_ports = 1
-        self.headers_size = HEADER_SIZE['eth'] + HEADER_SIZE['ip'] + \
-            HEADER_SIZE['udp']
         self.dut_ports = self.dut.get_ports()
         self.ports_socket = self.dut.get_numa_id(self.dut_ports[0])
         self.core_list = self.dut.get_core_list(
@@ -58,11 +57,18 @@ class TestPVPMultiPathVhostPerformance(TestCase):
         self.core_list_host = self.core_list[3:5]
         self.core_mask_user = utils.create_mask(self.core_list_user)
         self.core_mask_host = utils.create_mask(self.core_list_host)
-        if self.dut.cores[len(self.dut.cores) - 1]['socket'] == '0':
+        if len(set([int(core['socket']) for core in self.dut.cores])) == 1:
             self.socket_mem = '1024'
         else:
             self.socket_mem = '1024,1024'
 
+        self.out_path = '/tmp'
+        out = self.tester.send_expect('ls -d %s' % self.out_path, '# ')
+        if 'No such file or directory' in out:
+            self.tester.send_expect('mkdir -p %s' % self.out_path, '# ')
+        # create an instance to set stream field setting
+        self.pktgen_helper = PacketGeneratorHelper()
+
     def set_up(self):
         """
         Run before each test case.
@@ -78,7 +84,6 @@ class TestPVPMultiPathVhostPerformance(TestCase):
         """
         Send packet with packet generator and verify
         """
-        payload_size = frame_size - self.headers_size
         tgen_input = []
         for port in xrange(self.number_of_ports):
             rx_port = self.tester.get_local_port(
@@ -87,14 +92,16 @@ class TestPVPMultiPathVhostPerformance(TestCase):
                 self.dut_ports[(port) % self.number_of_ports])
             destination_mac = self.dut.get_mac_address(
                 self.dut_ports[(port) % self.number_of_ports])
-            self.tester.scapy_append(
-                'wrpcap("l2fwd_%d.pcap", [Ether(dst="%s")/IP()/UDP()/("X"*%d)])' %
-                (port, destination_mac, payload_size))
 
-            tgen_input.append((tx_port, rx_port, "l2fwd_%d.pcap" % port))
+            pkt = Packet(pkt_type='UDP', pkt_len=frame_size)
+            pkt.config_layer('ether', {'dst': '%s' % destination_mac})
+            save_packets([pkt], "%s/multi_path_%d.pcap" % (self.out_path, port))
+            tgen_input.append((tx_port, rx_port, "%s/multi_path_%d.pcap" % (self.out_path, port)))
 
-        self.tester.scapy_execute()
-        _, pps = self.tester.traffic_generator_throughput(tgen_input)
+        self.tester.pktgen.clear_streams()
+        streams = self.pktgen_helper.prepare_stream_from_tginput(tgen_input, 100, None, self.tester.pktgen)
+        traffic_opt = {'delay': 5}
+        _, pps = self.tester.pktgen.measure_throughput(stream_ids=streams, options=traffic_opt)
         Mpps = pps / 1000000.0
         self.verify(Mpps > 0, "%s can not receive packets of frame size %d" % (self.running_case, frame_size))
 
diff --git a/tests/TestSuite_pvp_multi_paths_virtio_single_core_performance.py b/tests/TestSuite_pvp_multi_paths_virtio_single_core_performance.py
index 32f5171..6cd3a6d 100644
--- a/tests/TestSuite_pvp_multi_paths_virtio_single_core_performance.py
+++ b/tests/TestSuite_pvp_multi_paths_virtio_single_core_performance.py
@@ -36,7 +36,8 @@ Test PVP virtio single core performance using virtio_user on 8 tx/rx path.
 
 import utils
 from test_case import TestCase
-from settings import HEADER_SIZE
+from packet import Packet, save_packets
+from pktgen import PacketGeneratorHelper
 
 
 class TestPVPMultiPathVirtioPerformance(TestCase):
@@ -48,8 +49,6 @@ class TestPVPMultiPathVirtioPerformance(TestCase):
         self.frame_sizes = [64, 128, 256, 512, 1024, 1518]
         self.core_config = "1S/5C/1T"
         self.number_of_ports = 1
-        self.headers_size = HEADER_SIZE['eth'] + HEADER_SIZE['ip'] + \
-            HEADER_SIZE['udp']
         self.dut_ports = self.dut.get_ports()
         self.verify(len(self.dut_ports) >= 1, "Insufficient ports for testing")
         self.ports_socket = self.dut.get_numa_id(self.dut_ports[0])
@@ -59,11 +58,18 @@ class TestPVPMultiPathVirtioPerformance(TestCase):
         self.core_list_host = self.core_list[2:5]
         self.core_mask_user = utils.create_mask(self.core_list_user)
         self.core_mask_host = utils.create_mask(self.core_list_host)
-        if self.dut.cores[len(self.dut.cores) - 1]['socket'] == '0':
+        if len(set([int(core['socket']) for core in self.dut.cores])) == 1:
             self.socket_mem = '1024'
         else:
             self.socket_mem = '1024,1024'
 
+        self.out_path = '/tmp'
+        out = self.tester.send_expect('ls -d %s' % self.out_path, '# ')
+        if 'No such file or directory' in out:
+            self.tester.send_expect('mkdir -p %s' % self.out_path, '# ')
+        # create an instance to set stream field setting
+        self.pktgen_helper = PacketGeneratorHelper()
+
     def set_up(self):
         """
         Run before each test case.
@@ -81,7 +87,6 @@ class TestPVPMultiPathVirtioPerformance(TestCase):
         """
         Send packet with packet generator and verify
         """
-        payload_size = frame_size - self.headers_size
         tgen_input = []
         for port in xrange(self.number_of_ports):
             rx_port = self.tester.get_local_port(
@@ -90,14 +95,18 @@ class TestPVPMultiPathVirtioPerformance(TestCase):
                 self.dut_ports[(port) % self.number_of_ports])
             destination_mac = self.dut.get_mac_address(
                 self.dut_ports[(port) % self.number_of_ports])
-            self.tester.scapy_append(
-                'wrpcap("l2fwd_%d.pcap", [Ether(dst="%s")/IP()/UDP()/("X"*%d)])' %
-                (port, destination_mac, payload_size))
 
-            tgen_input.append((tx_port, rx_port, "l2fwd_%d.pcap" % port))
+            pkt = Packet(pkt_type='UDP', pkt_len=frame_size)
+            pkt.config_layer('ether', {'dst': '%s' % destination_mac})
+            save_packets([pkt], "%s/multi_path_%d.pcap" % (self.out_path, port))
+
+            tgen_input.append((tx_port, rx_port, "%s/multi_path_%d.pcap" % (self.out_path, port)))
 
-        self.tester.scapy_execute()
-        _, pps = self.tester.traffic_generator_throughput(tgen_input)
+        self.tester.pktgen.clear_streams()
+        streams = self.pktgen_helper.prepare_stream_from_tginput(tgen_input, 100, None, self.tester.pktgen)
+        # set traffic option
+        traffic_opt = {'delay': 5}
+        _, pps = self.tester.pktgen.measure_throughput(stream_ids=streams, options=traffic_opt)
         Mpps = pps / 1000000.0
         self.verify(Mpps > 0, "%s can not receive packets of frame size %d" % (self.running_case, frame_size))
 
@@ -119,10 +128,11 @@ class TestPVPMultiPathVirtioPerformance(TestCase):
         self.dut.send_expect("killall -s INT testpmd", "#")
         self.dut.send_expect("killall -s INT qemu-system-x86_64", "#")
         command_line_client = "./%s/app/testpmd -n %d -c %s --socket-mem " + \
-                              " %s --legacy-mem --file-prefix=vhost --vdev " + \
+                              " %s --legacy-mem -w %s --file-prefix=vhost --vdev " + \
                               "'net_vhost0,iface=vhost-net,queues=1,client=0' -- -i --nb-cores=2 --txd=1024 --rxd=1024"
         command_line_client = command_line_client % (self.target,
-            self.dut.get_memory_channels(), self.core_mask_host, self.socket_mem)
+            self.dut.get_memory_channels(), self.core_mask_host,
+            self.socket_mem, self.dut.ports_info[self.dut_ports[0]]['pci'])
         self.vhost.send_expect(command_line_client, "testpmd> ", 120)
         self.vhost.send_expect("set fwd io", "testpmd> ", 120)
         self.vhost.send_expect("start", "testpmd> ", 120)
-- 
2.7.4


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

end of thread, other threads:[~2019-08-28  5:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-12 23:44 [dts] [PATCH V1] tests/pvp_multi_paths: update code to support trex lihong
2019-08-14  2:42 ` Wang, Yinan
2019-08-28  5:56 ` Tu, Lijuan

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