test suite reviews and discussions
 help / color / Atom feed
* [dts] [PATCH V1] tests/pvp_qemu_multi_paths_port_restart: update code to support trex
@ 2019-08-13  1:15 lihong
  2019-08-14  2:40 ` Wang, Yinan
  0 siblings, 1 reply; 2+ messages in thread
From: lihong @ 2019-08-13  1:15 UTC (permalink / raw)
  To: dts; +Cc: lihong

Signed-off-by: lihong <lihongx.ma@intel.com>
---
 .../TestSuite_pvp_qemu_multi_paths_port_restart.py | 26 +++++++++++++++-------
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/tests/TestSuite_pvp_qemu_multi_paths_port_restart.py b/tests/TestSuite_pvp_qemu_multi_paths_port_restart.py
index 81328e0..429628c 100644
--- a/tests/TestSuite_pvp_qemu_multi_paths_port_restart.py
+++ b/tests/TestSuite_pvp_qemu_multi_paths_port_restart.py
@@ -41,9 +41,10 @@ port restart test with each path
 import utils
 import time
 import re
-from settings import HEADER_SIZE
 from virt_common import VM
 from test_case import TestCase
+from packet import Packet, save_packets
+from pktgen import PacketGeneratorHelper
 
 
 class TestPVPQemuMultiPathPortRestart(TestCase):
@@ -65,6 +66,13 @@ class TestPVPQemuMultiPathPortRestart(TestCase):
         self.vm_dut = None
         self.virtio1_mac = "52:54:00:00:00:01"
 
+        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.
@@ -195,16 +203,18 @@ class TestPVPQemuMultiPathPortRestart(TestCase):
         """
         start to send packet and get the throughput
         """
-        payload = frame_size - HEADER_SIZE['eth'] - HEADER_SIZE['ip']
-        flow = '[Ether(dst="%s")/IP(src="192.168.4.1",dst="192.168.3.1")/("X"*%d)]' % (
-            self.dst_mac, payload)
-        self.tester.scapy_append('wrpcap("pvp_multipath.pcap", %s)' % flow)
-        self.tester.scapy_execute()
+        pkt = Packet(pkt_type='IP_RAW', pkt_len=frame_size)
+        pkt.config_layer('ether', {'dst': '%s' % self.dst_mac})
+        save_packets([pkt], "%s/pvp_multipath.pcap" % (self.out_path))
 
         tgenInput = []
         port = self.tester.get_local_port(self.dut_ports[0])
-        tgenInput.append((port, port, "pvp_multipath.pcap"))
-        _, pps = self.tester.traffic_generator_throughput(tgenInput, delay=30)
+        tgenInput.append((port, port, "%s/pvp_multipath.pcap" % self.out_path))
+        self.tester.pktgen.clear_streams()
+        streams = self.pktgen_helper.prepare_stream_from_tginput(tgenInput, 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, "can not receive packets of frame size %d" % (frame_size))
         throughput = Mpps * 100 / \
-- 
2.7.4


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

* Re: [dts] [PATCH V1] tests/pvp_qemu_multi_paths_port_restart: update code to support trex
  2019-08-13  1:15 [dts] [PATCH V1] tests/pvp_qemu_multi_paths_port_restart: update code to support trex lihong
@ 2019-08-14  2:40 ` Wang, Yinan
  0 siblings, 0 replies; 2+ messages in thread
From: Wang, Yinan @ 2019-08-14  2:40 UTC (permalink / raw)
  To: Ma, LihongX, dts; +Cc: Ma, LihongX

Acked-by: Wang, Yinan <yinan.wang@intel.com>

> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of lihong
> Sent: 2019^[$BG/^[(B8^[$B7n^[(B13^[$BF|^[(B 9:16
> To: dts@dpdk.org
> Cc: Ma, LihongX <lihongx.ma@intel.com>
> Subject: [dts] [PATCH V1] tests/pvp_qemu_multi_paths_port_restart: update
> code to support trex
> 
> Signed-off-by: lihong <lihongx.ma@intel.com>
> ---
>  .../TestSuite_pvp_qemu_multi_paths_port_restart.py | 26
> +++++++++++++++-------
>  1 file changed, 18 insertions(+), 8 deletions(-)
> 
> diff --git a/tests/TestSuite_pvp_qemu_multi_paths_port_restart.py
> b/tests/TestSuite_pvp_qemu_multi_paths_port_restart.py
> index 81328e0..429628c 100644
> --- a/tests/TestSuite_pvp_qemu_multi_paths_port_restart.py
> +++ b/tests/TestSuite_pvp_qemu_multi_paths_port_restart.py
> @@ -41,9 +41,10 @@ port restart test with each path  import utils  import time
> import re -from settings import HEADER_SIZE  from virt_common import VM
> from test_case import TestCase
> +from packet import Packet, save_packets from pktgen import
> +PacketGeneratorHelper
> 
> 
>  class TestPVPQemuMultiPathPortRestart(TestCase):
> @@ -65,6 +66,13 @@ class TestPVPQemuMultiPathPortRestart(TestCase):
>          self.vm_dut = None
>          self.virtio1_mac = "52:54:00:00:00:01"
> 
> +        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.
> @@ -195,16 +203,18 @@ class TestPVPQemuMultiPathPortRestart(TestCase):
>          """
>          start to send packet and get the throughput
>          """
> -        payload = frame_size - HEADER_SIZE['eth'] - HEADER_SIZE['ip']
> -        flow =
> '[Ether(dst="%s")/IP(src="192.168.4.1",dst="192.168.3.1")/("X"*%d)]' % (
> -            self.dst_mac, payload)
> -        self.tester.scapy_append('wrpcap("pvp_multipath.pcap", %s)' % flow)
> -        self.tester.scapy_execute()
> +        pkt = Packet(pkt_type='IP_RAW', pkt_len=frame_size)
> +        pkt.config_layer('ether', {'dst': '%s' % self.dst_mac})
> +        save_packets([pkt], "%s/pvp_multipath.pcap" % (self.out_path))
> 
>          tgenInput = []
>          port = self.tester.get_local_port(self.dut_ports[0])
> -        tgenInput.append((port, port, "pvp_multipath.pcap"))
> -        _, pps = self.tester.traffic_generator_throughput(tgenInput, delay=30)
> +        tgenInput.append((port, port, "%s/pvp_multipath.pcap" %
> self.out_path))
> +        self.tester.pktgen.clear_streams()
> +        streams =
> self.pktgen_helper.prepare_stream_from_tginput(tgenInput, 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, "can not receive packets of frame size %d" %
> (frame_size))
>          throughput = Mpps * 100 / \
> --
> 2.7.4


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

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-13  1:15 [dts] [PATCH V1] tests/pvp_qemu_multi_paths_port_restart: update code to support trex lihong
2019-08-14  2:40 ` Wang, Yinan

test suite reviews and discussions

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/dts/0 dts/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dts dts/ http://inbox.dpdk.org/dts \
		dts@dpdk.org
	public-inbox-index dts


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dts


AGPL code for this site: git clone https://public-inbox.org/ public-inbox