* [dts] [PATCH V1] tests/virtio_event_idx_interrupt: update code to support trex
@ 2019-09-15 21:45 lihong
2019-09-19 6:53 ` Wang, Yinan
2019-09-20 6:29 ` Tu, Lijuan
0 siblings, 2 replies; 3+ messages in thread
From: lihong @ 2019-09-15 21:45 UTC (permalink / raw)
To: dts; +Cc: lihong
Signed-off-by: lihong <lihongx.ma@intel.com>
---
tests/TestSuite_virtio_event_idx_interrupt.py | 43 ++++++++++++---------------
1 file changed, 19 insertions(+), 24 deletions(-)
diff --git a/tests/TestSuite_virtio_event_idx_interrupt.py b/tests/TestSuite_virtio_event_idx_interrupt.py
index acaa18a..3ce7b46 100644
--- a/tests/TestSuite_virtio_event_idx_interrupt.py
+++ b/tests/TestSuite_virtio_event_idx_interrupt.py
@@ -40,10 +40,10 @@ import thread
import re
from virt_common import VM
from test_case import TestCase
-from etgen import IxiaPacketGenerator
+from pktgen import PacketGeneratorHelper
-class TestVirtioIdxInterrupt(TestCase, IxiaPacketGenerator):
+class TestVirtioIdxInterrupt(TestCase):
def set_up_all(self):
"""
@@ -59,6 +59,14 @@ class TestVirtioIdxInterrupt(TestCase, IxiaPacketGenerator):
== self.ports_socket])
self.mem_channels = self.dut.get_memory_channels()
self.dst_mac = self.dut.get_mac_address(self.dut_ports[0])
+ self.pf_pci = self.dut.ports_info[0]['pci']
+
+ 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):
"""
@@ -71,23 +79,6 @@ class TestVirtioIdxInterrupt(TestCase, IxiaPacketGenerator):
self.dut.send_expect("rm -rf ./vhost-net*", "#")
self.vhost = self.dut.new_session(suite="vhost")
- def ip(self, port, frag, src, proto, tos, dst, chksum, len, options,
- version, flags, ihl, ttl, id):
- """
- Configure IP protocol.
- """
- self.add_tcl_cmd("protocol config -name ip")
- self.add_tcl_cmd('ip config -sourceIpAddr "%s"' % src)
- self.add_tcl_cmd('ip config -destIpAddrMode ipRandom')
- self.add_tcl_cmd("ip config -ttl %d" % ttl)
- self.add_tcl_cmd("ip config -totalLength %d" % len)
- self.add_tcl_cmd("ip config -fragment %d" % frag)
- self.add_tcl_cmd("ip config -ipProtocol %d" % proto)
- self.add_tcl_cmd("ip config -identifier %d" % id)
- self.add_tcl_cmd("stream config -framesize %d" % (len + 18))
- self.add_tcl_cmd("ip set %d %d %d" % (self.chasId, port['card'],
- port['port']))
-
def get_core_mask(self):
self.core_config = "1S/%dC/1T" % (self.nb_cores + 1)
self.verify(self.cores_num >= (self.nb_cores + 1),
@@ -102,11 +93,11 @@ class TestVirtioIdxInterrupt(TestCase, IxiaPacketGenerator):
"""
# get the core mask depend on the nb_cores number
self.get_core_mask()
- command_line = self.dut.target + "/app/testpmd -c %s -n %d " + \
+ command_line = self.dut.target + "/app/testpmd -c %s -n %d -w %s " + \
"--socket-mem 2048,2048 --legacy-mem --file-prefix=vhost " + \
"--vdev 'net_vhost,iface=vhost-net,queues=%d' -- -i " + \
"--nb-cores=%d --txd=1024 --rxd=1024 --rxq=%d --txq=%d"
- command_line = command_line % (self.core_mask, self.mem_channels,
+ command_line = command_line % (self.core_mask, self.mem_channels, self.pf_pci,
self.queues, self.nb_cores, self.queues, self.queues)
self.vhost.send_expect(command_line, "testpmd> ", 30)
self.vhost.send_expect("start", "testpmd> ", 30)
@@ -155,11 +146,15 @@ class TestVirtioIdxInterrupt(TestCase, IxiaPacketGenerator):
tgen_input = []
port = self.tester.get_local_port(self.dut_ports[0])
self.tester.scapy_append('a=[Ether(dst="%s")/IP(src="0.240.74.101",proto=255)/UDP()/("X"*18)]' % (self.dst_mac))
- self.tester.scapy_append('wrpcap("interrupt.pcap", a)')
+ self.tester.scapy_append('wrpcap("%s/interrupt.pcap", a)' % self.out_path)
self.tester.scapy_execute()
- tgen_input.append((port, port, "interrupt.pcap"))
- _, self.flag = self.tester.traffic_generator_throughput(tgen_input, delay=delay)
+ tgen_input.append((port, port, "%s/interrupt.pcap" % self.out_path))
+ self.tester.pktgen.clear_streams()
+ fields_config = {'ip': {'dst': {'action': 'random'}, }, }
+ streams = self.pktgen_helper.prepare_stream_from_tginput(tgen_input, 1, fields_config, self.tester.pktgen)
+ traffic_opt = {'delay': 5, 'duration': delay, 'rate': 1}
+ _, self.flag = self.tester.pktgen.measure_throughput(stream_ids=streams, options=traffic_opt)
def check_packets_after_reload_virtio_device(self, reload_times):
"""
--
2.7.4
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dts] [PATCH V1] tests/virtio_event_idx_interrupt: update code to support trex
2019-09-15 21:45 [dts] [PATCH V1] tests/virtio_event_idx_interrupt: update code to support trex lihong
@ 2019-09-19 6:53 ` Wang, Yinan
2019-09-20 6:29 ` Tu, Lijuan
1 sibling, 0 replies; 3+ messages in thread
From: Wang, Yinan @ 2019-09-19 6:53 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年9月16日 5:45
> To: dts@dpdk.org
> Cc: Ma, LihongX <lihongx.ma@intel.com>
> Subject: [dts] [PATCH V1] tests/virtio_event_idx_interrupt: update code to
> support trex
>
> Signed-off-by: lihong <lihongx.ma@intel.com>
> ---
> tests/TestSuite_virtio_event_idx_interrupt.py | 43 ++++++++++++---------------
> 1 file changed, 19 insertions(+), 24 deletions(-)
>
> diff --git a/tests/TestSuite_virtio_event_idx_interrupt.py
> b/tests/TestSuite_virtio_event_idx_interrupt.py
> index acaa18a..3ce7b46 100644
> --- a/tests/TestSuite_virtio_event_idx_interrupt.py
> +++ b/tests/TestSuite_virtio_event_idx_interrupt.py
> @@ -40,10 +40,10 @@ import thread
> import re
> from virt_common import VM
> from test_case import TestCase
> -from etgen import IxiaPacketGenerator
> +from pktgen import PacketGeneratorHelper
>
>
> -class TestVirtioIdxInterrupt(TestCase, IxiaPacketGenerator):
> +class TestVirtioIdxInterrupt(TestCase):
>
> def set_up_all(self):
> """
> @@ -59,6 +59,14 @@ class TestVirtioIdxInterrupt(TestCase,
> IxiaPacketGenerator):
> == self.ports_socket])
> self.mem_channels = self.dut.get_memory_channels()
> self.dst_mac = self.dut.get_mac_address(self.dut_ports[0])
> + self.pf_pci = self.dut.ports_info[0]['pci']
> +
> + 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):
> """
> @@ -71,23 +79,6 @@ class TestVirtioIdxInterrupt(TestCase,
> IxiaPacketGenerator):
> self.dut.send_expect("rm -rf ./vhost-net*", "#")
> self.vhost = self.dut.new_session(suite="vhost")
>
> - def ip(self, port, frag, src, proto, tos, dst, chksum, len, options,
> - version, flags, ihl, ttl, id):
> - """
> - Configure IP protocol.
> - """
> - self.add_tcl_cmd("protocol config -name ip")
> - self.add_tcl_cmd('ip config -sourceIpAddr "%s"' % src)
> - self.add_tcl_cmd('ip config -destIpAddrMode ipRandom')
> - self.add_tcl_cmd("ip config -ttl %d" % ttl)
> - self.add_tcl_cmd("ip config -totalLength %d" % len)
> - self.add_tcl_cmd("ip config -fragment %d" % frag)
> - self.add_tcl_cmd("ip config -ipProtocol %d" % proto)
> - self.add_tcl_cmd("ip config -identifier %d" % id)
> - self.add_tcl_cmd("stream config -framesize %d" % (len + 18))
> - self.add_tcl_cmd("ip set %d %d %d" % (self.chasId, port['card'],
> - port['port']))
> -
> def get_core_mask(self):
> self.core_config = "1S/%dC/1T" % (self.nb_cores + 1)
> self.verify(self.cores_num >= (self.nb_cores + 1), @@ -102,11 +93,11
> @@ class TestVirtioIdxInterrupt(TestCase, IxiaPacketGenerator):
> """
> # get the core mask depend on the nb_cores number
> self.get_core_mask()
> - command_line = self.dut.target + "/app/testpmd -c %s -n %d " + \
> + command_line = self.dut.target + "/app/testpmd -c %s -n %d -w
> + %s " + \
> "--socket-mem 2048,2048 --legacy-mem --file-prefix=vhost "
> + \
> "--vdev 'net_vhost,iface=vhost-net,queues=%d' -- -i " + \
> "--nb-cores=%d --txd=1024 --rxd=1024 --rxq=%d --txq=%d"
> - command_line = command_line % (self.core_mask,
> self.mem_channels,
> + command_line = command_line % (self.core_mask,
> + self.mem_channels, self.pf_pci,
> self.queues, self.nb_cores, self.queues,
> self.queues)
> self.vhost.send_expect(command_line, "testpmd> ", 30)
> self.vhost.send_expect("start", "testpmd> ", 30) @@ -155,11 +146,15
> @@ class TestVirtioIdxInterrupt(TestCase, IxiaPacketGenerator):
> tgen_input = []
> port = self.tester.get_local_port(self.dut_ports[0])
>
> self.tester.scapy_append('a=[Ether(dst="%s")/IP(src="0.240.74.101",proto=255)/
> UDP()/("X"*18)]' % (self.dst_mac))
> - self.tester.scapy_append('wrpcap("interrupt.pcap", a)')
> + self.tester.scapy_append('wrpcap("%s/interrupt.pcap", a)' %
> + self.out_path)
> self.tester.scapy_execute()
>
> - tgen_input.append((port, port, "interrupt.pcap"))
> - _, self.flag = self.tester.traffic_generator_throughput(tgen_input,
> delay=delay)
> + tgen_input.append((port, port, "%s/interrupt.pcap" % self.out_path))
> + self.tester.pktgen.clear_streams()
> + fields_config = {'ip': {'dst': {'action': 'random'}, }, }
> + streams =
> self.pktgen_helper.prepare_stream_from_tginput(tgen_input, 1, fields_config,
> self.tester.pktgen)
> + traffic_opt = {'delay': 5, 'duration': delay, 'rate': 1}
> + _, self.flag =
> + self.tester.pktgen.measure_throughput(stream_ids=streams,
> + options=traffic_opt)
>
> def check_packets_after_reload_virtio_device(self, reload_times):
> """
> --
> 2.7.4
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dts] [PATCH V1] tests/virtio_event_idx_interrupt: update code to support trex
2019-09-15 21:45 [dts] [PATCH V1] tests/virtio_event_idx_interrupt: update code to support trex lihong
2019-09-19 6:53 ` Wang, Yinan
@ 2019-09-20 6:29 ` Tu, Lijuan
1 sibling, 0 replies; 3+ messages in thread
From: Tu, Lijuan @ 2019-09-20 6:29 UTC (permalink / raw)
To: Ma, LihongX, dts; +Cc: Ma, LihongX
Applying: tests/virtio_event_idx_interrupt: update code to support trex
error: patch failed: tests/TestSuite_virtio_event_idx_interrupt.py:59
> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of lihong
> Sent: Monday, September 16, 2019 5:45 AM
> To: dts@dpdk.org
> Cc: Ma, LihongX <lihongx.ma@intel.com>
> Subject: [dts] [PATCH V1] tests/virtio_event_idx_interrupt: update code to
> support trex
>
> Signed-off-by: lihong <lihongx.ma@intel.com>
> ---
> tests/TestSuite_virtio_event_idx_interrupt.py | 43 ++++++++++++---------------
> 1 file changed, 19 insertions(+), 24 deletions(-)
>
> diff --git a/tests/TestSuite_virtio_event_idx_interrupt.py
> b/tests/TestSuite_virtio_event_idx_interrupt.py
> index acaa18a..3ce7b46 100644
> --- a/tests/TestSuite_virtio_event_idx_interrupt.py
> +++ b/tests/TestSuite_virtio_event_idx_interrupt.py
> @@ -40,10 +40,10 @@ import thread
> import re
> from virt_common import VM
> from test_case import TestCase
> -from etgen import IxiaPacketGenerator
> +from pktgen import PacketGeneratorHelper
>
>
> -class TestVirtioIdxInterrupt(TestCase, IxiaPacketGenerator):
> +class TestVirtioIdxInterrupt(TestCase):
>
> def set_up_all(self):
> """
> @@ -59,6 +59,14 @@ class TestVirtioIdxInterrupt(TestCase,
> IxiaPacketGenerator):
> == self.ports_socket])
> self.mem_channels = self.dut.get_memory_channels()
> self.dst_mac = self.dut.get_mac_address(self.dut_ports[0])
> + self.pf_pci = self.dut.ports_info[0]['pci']
> +
> + 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):
> """
> @@ -71,23 +79,6 @@ class TestVirtioIdxInterrupt(TestCase,
> IxiaPacketGenerator):
> self.dut.send_expect("rm -rf ./vhost-net*", "#")
> self.vhost = self.dut.new_session(suite="vhost")
>
> - def ip(self, port, frag, src, proto, tos, dst, chksum, len, options,
> - version, flags, ihl, ttl, id):
> - """
> - Configure IP protocol.
> - """
> - self.add_tcl_cmd("protocol config -name ip")
> - self.add_tcl_cmd('ip config -sourceIpAddr "%s"' % src)
> - self.add_tcl_cmd('ip config -destIpAddrMode ipRandom')
> - self.add_tcl_cmd("ip config -ttl %d" % ttl)
> - self.add_tcl_cmd("ip config -totalLength %d" % len)
> - self.add_tcl_cmd("ip config -fragment %d" % frag)
> - self.add_tcl_cmd("ip config -ipProtocol %d" % proto)
> - self.add_tcl_cmd("ip config -identifier %d" % id)
> - self.add_tcl_cmd("stream config -framesize %d" % (len + 18))
> - self.add_tcl_cmd("ip set %d %d %d" % (self.chasId, port['card'],
> - port['port']))
> -
> def get_core_mask(self):
> self.core_config = "1S/%dC/1T" % (self.nb_cores + 1)
> self.verify(self.cores_num >= (self.nb_cores + 1), @@ -102,11 +93,11
> @@ class TestVirtioIdxInterrupt(TestCase, IxiaPacketGenerator):
> """
> # get the core mask depend on the nb_cores number
> self.get_core_mask()
> - command_line = self.dut.target + "/app/testpmd -c %s -n %d " + \
> + command_line = self.dut.target + "/app/testpmd -c %s -n %d -w
> + %s " + \
> "--socket-mem 2048,2048 --legacy-mem --file-prefix=vhost " + \
> "--vdev 'net_vhost,iface=vhost-net,queues=%d' -- -i " + \
> "--nb-cores=%d --txd=1024 --rxd=1024 --rxq=%d --txq=%d"
> - command_line = command_line % (self.core_mask, self.mem_channels,
> + command_line = command_line % (self.core_mask,
> + self.mem_channels, self.pf_pci,
> self.queues, self.nb_cores, self.queues, self.queues)
> self.vhost.send_expect(command_line, "testpmd> ", 30)
> self.vhost.send_expect("start", "testpmd> ", 30) @@ -155,11 +146,15
> @@ class TestVirtioIdxInterrupt(TestCase, IxiaPacketGenerator):
> tgen_input = []
> port = self.tester.get_local_port(self.dut_ports[0])
>
> self.tester.scapy_append('a=[Ether(dst="%s")/IP(src="0.240.74.101",proto=25
> 5)/UDP()/("X"*18)]' % (self.dst_mac))
> - self.tester.scapy_append('wrpcap("interrupt.pcap", a)')
> + self.tester.scapy_append('wrpcap("%s/interrupt.pcap", a)' %
> + self.out_path)
> self.tester.scapy_execute()
>
> - tgen_input.append((port, port, "interrupt.pcap"))
> - _, self.flag = self.tester.traffic_generator_throughput(tgen_input,
> delay=delay)
> + tgen_input.append((port, port, "%s/interrupt.pcap" % self.out_path))
> + self.tester.pktgen.clear_streams()
> + fields_config = {'ip': {'dst': {'action': 'random'}, }, }
> + streams =
> self.pktgen_helper.prepare_stream_from_tginput(tgen_input, 1,
> fields_config, self.tester.pktgen)
> + traffic_opt = {'delay': 5, 'duration': delay, 'rate': 1}
> + _, self.flag =
> + self.tester.pktgen.measure_throughput(stream_ids=streams,
> + options=traffic_opt)
>
> def check_packets_after_reload_virtio_device(self, reload_times):
> """
> --
> 2.7.4
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-09-20 6:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-15 21:45 [dts] [PATCH V1] tests/virtio_event_idx_interrupt: update code to support trex lihong
2019-09-19 6:53 ` Wang, Yinan
2019-09-20 6:29 ` 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).