test suite reviews and discussions
 help / color / mirror / Atom feed
From: lihong <lihongx.ma@intel.com>
To: dts@dpdk.org
Cc: lihong <lihongx.ma@intel.com>
Subject: [dts] [PATCH V1] tests/pvp_vhost_user_reconnect: update code to support trex
Date: Fri,  9 Aug 2019 01:35:13 +0800	[thread overview]
Message-ID: <1565285713-20031-1-git-send-email-lihongx.ma@intel.com> (raw)

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

diff --git a/tests/TestSuite_pvp_vhost_user_reconnect.py b/tests/TestSuite_pvp_vhost_user_reconnect.py
index 5568376..69c4bed 100644
--- a/tests/TestSuite_pvp_vhost_user_reconnect.py
+++ b/tests/TestSuite_pvp_vhost_user_reconnect.py
@@ -40,8 +40,8 @@ import re
 import utils
 import time
 from test_case import TestCase
-from settings import HEADER_SIZE
 from virt_common import VM
+from packet import Packet, save_packets
 from pktgen import PacketGeneratorHelper
 
 
@@ -76,8 +76,11 @@ class TestPVPVhostUserReconnect(TestCase):
         self.src1 = "192.168.4.1"
         self.dst1 = "192.168.3.1"
         self.checked_vm = False
-        self.header_size = HEADER_SIZE['eth'] + HEADER_SIZE['ip'] + HEADER_SIZE['udp']
 
+        self.out_path = '/tmp/%s' % self.suite_name
+        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()
 
@@ -266,15 +269,14 @@ class TestPVPVhostUserReconnect(TestCase):
 
     def send_and_verify(self, cycle=0, tinfo=""):
         for frame_size in self.frame_sizes:
-            payload = frame_size - self.header_size
-            flow = '[Ether(dst="%s")/IP(src="%s",dst="%s")/UDP()/("X"*%d)]' % (
-                    self.dst_mac, self.src1, self.dst1, payload)
-            self.tester.scapy_append('wrpcap("reconnect.pcap", %s)' % flow)
-            self.tester.scapy_execute()
+            pkt = Packet(pkt_type = 'UDP', pkt_len = frame_size)
+            pkt.config_layers([('ether', {'dst': '%s' % self.dst_mac}),
+                            ('ipv4', {'dst': '%s' % self.dst1, 'src': '%s' % self.src1})])
+            save_packets([pkt], "%s/reconnect.pcap" % self.out_path)
 
             tgenInput = []
             port = self.tester.get_local_port(self.pf)
-            tgenInput.append((port, port, "reconnect.pcap"))
+            tgenInput.append((port, port, "%s/reconnect.pcap" % self.out_path))
 
             self.tester.pktgen.clear_streams()
             streams = self.pktgen_helper.prepare_stream_from_tginput(tgenInput, 100,
-- 
2.7.4


             reply	other threads:[~2019-08-09  0:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-08 17:35 lihong [this message]
2019-08-12  6:52 ` Tu, Lijuan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1565285713-20031-1-git-send-email-lihongx.ma@intel.com \
    --to=lihongx.ma@intel.com \
    --cc=dts@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).