test suite reviews and discussions
 help / color / mirror / Atom feed
From: Xie Wei <weix.xie@intel.com>
To: dts@dpdk.org
Cc: Xie Wei <weix.xie@intel.com>
Subject: [dts]  [PATCH V1] tests/vxlan_sample:fix to support py3
Date: Wed, 19 Feb 2020 17:37:33 +0800	[thread overview]
Message-ID: <1582105053-65445-1-git-send-email-weix.xie@intel.com> (raw)

bytes type is str in python2.x, not support python3.x 

Signed-off-by: Xie Wei <weix.xie@intel.com>
---
 tests/TestSuite_vxlan_sample.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tests/TestSuite_vxlan_sample.py b/tests/TestSuite_vxlan_sample.py
index df9d3a6..4ab9f18 100644
--- a/tests/TestSuite_vxlan_sample.py
+++ b/tests/TestSuite_vxlan_sample.py
@@ -298,7 +298,7 @@ class TestVxlanSample(TestCase):
             self.verify(pkts[0].haslayer('VXLAN') == 1,
                         "Packet not encapsulated")
             try:
-                payload = str(pkts[0][UDP]['VXLAN'][UDP].payload)
+                payload = pkts[0][UDP]['VXLAN'][UDP].payload
                 for i in range(18):
                     self.verify(ord(payload[i]) == 88, "Check udp data failed")
             except:
@@ -333,7 +333,7 @@ class TestVxlanSample(TestCase):
                         "Packet not de-encapsulated")
 
             try:
-                payload = str(pkts[0][UDP].payload)
+                payload = pkts[0][UDP].payload
                 for i in range(18):
                     self.verify(ord(payload[i]) == 88, "Check udp data failed")
             except:
@@ -368,7 +368,7 @@ class TestVxlanSample(TestCase):
             self.verify(pkts[0].haslayer('VXLAN') == 1,
                         "Packet not encapsulated")
             try:
-                payload = str(pkts[0][UDP]['VXLAN'][UDP].payload)
+                payload = pkts[0][UDP]['VXLAN'][UDP].payload
                 for i in range(18):
                     self.verify(ord(payload[i]) == 88, "Check udp data failed")
             except:
@@ -457,14 +457,14 @@ class TestVxlanSample(TestCase):
                 inner = pkt['VXLAN']
                 inner_ip_chksum = inner[IP].chksum
                 del inner.chksum
-                inner[IP] = inner[IP].__class__(str(inner[IP]))
+                inner[IP] = inner[IP].__class__(inner[IP])
                 inner_ip_chksum_ref = inner[IP].chksum
                 self.logger.info("inner ip checksum reference: %x" % inner_ip_chksum_ref)
                 self.logger.info("inner ip checksum: %x" % inner_ip_chksum)
                 self.verify(inner_ip_chksum == inner_ip_chksum_ref, "inner ip checksum error")
                 inner_l4_chksum = inner[params['inner_l4_type']].chksum
                 del inner[params['inner_l4_type']].chksum
-                inner[params['inner_l4_type']] = inner[params['inner_l4_type']].__class__(str(inner[params['inner_l4_type']]))
+                inner[params['inner_l4_type']] = inner[params['inner_l4_type']].__class__(inner[params['inner_l4_type']])
                 inner_l4_chksum_ref =  inner[params['inner_l4_type']].chksum
                 self.logger.info("inner l4 checksum reference: %x" % inner_l4_chksum_ref)
                 self.logger.info("inner l4 checksum: %x" % inner_l4_chksum)
@@ -475,7 +475,7 @@ class TestVxlanSample(TestCase):
                 self.verify(pkt.haslayer('VXLAN') == 1,
                             "Packet not encapsulated")
                 try:
-                    payload = str(pkt[UDP]['VXLAN'][TCP].payload)
+                    payload = pkt[UDP]['VXLAN'][TCP].payload
                     self.verify(len(payload) <= self.def_mss,
                                 "TCP payload oversized")
                     length += len(payload)
-- 
2.17.2


             reply	other threads:[~2020-02-19  9:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-19  9:37 Xie Wei [this message]
2020-02-20  2:31 ` Xie, WeiX
2020-02-21  1:58 ` 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=1582105053-65445-1-git-send-email-weix.xie@intel.com \
    --to=weix.xie@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).