test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH V2 0/3] add new interface for write raw pkt and
@ 2020-12-09  1:59 Zhou Jun
  2020-12-09  1:59 ` [dts] [dts 1/3] framework/packet.py:add interface for write raw pkt Zhou Jun
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Zhou Jun @ 2020-12-09  1:59 UTC (permalink / raw)
  To: dts; +Cc: Zhou Jun

add new interface for write raw pkt and used in suite

Zhou Jun (3):
  framework/packet.py:add interface for write raw pkt
  tests/TestSuite_ddp_gtp_qregion:change send pkt mode and use framework
    interface to write raw pkt
  tests/TestSuite_dynamic_flowtype:change send pkt mode

 framework/packet.py                 |  6 ++++++
 tests/TestSuite_ddp_gtp_qregion.py  | 22 ++++++++--------------
 tests/TestSuite_dynamic_flowtype.py |  7 +++----
 3 files changed, 17 insertions(+), 18 deletions(-)

-- 
2.17.1


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

* [dts] [dts 1/3] framework/packet.py:add interface for write raw pkt
  2020-12-09  1:59 [dts] [PATCH V2 0/3] add new interface for write raw pkt and Zhou Jun
@ 2020-12-09  1:59 ` Zhou Jun
  2020-12-09  1:59 ` [dts] [dts 2/3] tests/TestSuite_ddp_gtp_qregion:change send pkt mode and use framework interface to " Zhou Jun
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Zhou Jun @ 2020-12-09  1:59 UTC (permalink / raw)
  To: dts; +Cc: Zhou Jun

Signed-off-by: Zhou Jun <junx.w.zhou@intel.com>
---
 framework/packet.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/framework/packet.py b/framework/packet.py
index 7d974db0..e13e74f2 100644
--- a/framework/packet.py
+++ b/framework/packet.py
@@ -119,6 +119,12 @@ PKTGEN_PIDS = {}
 # default filter for LLDP packet
 LLDP_FILTER = {'layer': 'ether', 'config': {'type': 'not lldp'}}
 
+def write_raw_pkt(pkt_str, file_name):
+    tmp = eval(pkt_str)
+    tmp = bytearray(bytes(tmp))
+    with open(file_name, 'wb') as w:
+        w.write(tmp)
+        w.close()
 
 class scapy(object):
     SCAPY_LAYERS = {
-- 
2.17.1


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

* [dts] [dts 2/3] tests/TestSuite_ddp_gtp_qregion:change send pkt mode and use framework interface to write raw pkt
  2020-12-09  1:59 [dts] [PATCH V2 0/3] add new interface for write raw pkt and Zhou Jun
  2020-12-09  1:59 ` [dts] [dts 1/3] framework/packet.py:add interface for write raw pkt Zhou Jun
@ 2020-12-09  1:59 ` Zhou Jun
  2020-12-09  1:59 ` [dts] [dts 3/3] tests/TestSuite_dynamic_flowtype:change send pkt mode Zhou Jun
  2020-12-09  2:00 ` [dts] [PATCH V2 0/3] add new interface for write raw pkt and Zhou, JunX W
  3 siblings, 0 replies; 5+ messages in thread
From: Zhou Jun @ 2020-12-09  1:59 UTC (permalink / raw)
  To: dts; +Cc: Zhou Jun

Signed-off-by: Zhou Jun <junx.w.zhou@intel.com>
---
 tests/TestSuite_ddp_gtp_qregion.py | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/tests/TestSuite_ddp_gtp_qregion.py b/tests/TestSuite_ddp_gtp_qregion.py
index 443e1927..2c22756e 100644
--- a/tests/TestSuite_ddp_gtp_qregion.py
+++ b/tests/TestSuite_ddp_gtp_qregion.py
@@ -37,6 +37,7 @@ from scapy.all import *
 from test_case import TestCase
 from pmd_output import PmdOutput
 from settings import get_nic_name
+import packet
 
 
 class TestDdpGtpQregion(TestCase):
@@ -160,14 +161,11 @@ class TestDdpGtpQregion(TestCase):
         template file and packets sent to NIC.
         """
         if flowtype == 23:
-            a = Ether()/IPv6()/UDP(dport=2152)/GTP_U_Header(teid=0xfe)/IPv6(dst="1001:0db8:85a3:0000:0000:8a2e:0370:0001", src="2001:0db8:85a3:0000:0000:8a2e:0370:0001")/UDP(dport=100, sport=200)/Raw("X"*20)
+            a = 'Ether()/IPv6()/UDP(dport=2152)/GTP_U_Header(teid=0xfe)/IPv6(dst="1001:0db8:85a3:0000:0000:8a2e:0370:0001", src="2001:0db8:85a3:0000:0000:8a2e:0370:0001")/UDP(dport=100, sport=200)/Raw("X"*20)'
         if flowtype == 26:
-            a = Ether()/IPv6()/UDP(dport=2152)/GTP_U_Header(teid=0xfe)/IP(dst="1.1.1.1", src="2.2.2.2")/UDP(dport=100, sport=200)/Raw("X"*20)
-        ba = bytearray(bytes(a))
+            a = 'Ether()/IPv6()/UDP(dport=2152)/GTP_U_Header(teid=0xfe)/IP(dst="1.1.1.1", src="2.2.2.2")/UDP(dport=100, sport=200)/Raw("X"*20)'
         rawfile_src = '/tmp/test_gtp.raw'
-        File = open("%s" % rawfile_src, "wb")
-        File.write(ba)
-        File.close()
+        packet.write_test(a, rawfile_src)
         rawfile_dst = "/tmp/"
         self.dut.session.copy_file_to(rawfile_src, rawfile_dst)
 
@@ -177,10 +175,8 @@ class TestDdpGtpQregion(TestCase):
         """
         pkts = self.gtp_pkts(flowtype, keyword, opt)
         for packet_type in list(pkts.keys()):
-            self.tester.scapy_append(
-                'sendp([%s], iface="%s")'
-                % (pkts[packet_type], self.tester_intf))
-            self.tester.scapy_execute()
+            pkt = packet.Packet(pkts[packet_type])
+            pkt.send_pkt(crb=self.tester, tx_port=self.tester_intf)
             out = self.dut.get_session_output(timeout=2)
             pattern = "port (\d)/queue (\d{1,2}): received (\d) packets"
             qnum = self.element_strip(out, pattern)
@@ -239,10 +235,8 @@ class TestDdpGtpQregion(TestCase):
                     keyword = 'src_ipv6'
             pkts = self.gtp_pkts(flowtype, keyword, opt)
             for packet_type in list(pkts.keys()):
-                self.tester.scapy_append(
-                    'sendp([%s], iface="%s")'
-                    % (pkts[packet_type], self.tester_intf))
-                self.tester.scapy_execute()
+                pkt = packet.Packet(pkts[packet_type])
+                pkt.send_pkt(crb=self.tester, tx_port=self.tester_intf)
                 out = self.dut.get_session_output(timeout=2)
                 self.verify("PKT_RX_RSS_HASH" in out, "Failed to test RSS!!!")
                 pattern = "port (\d)/queue (\d{1,2}): received (\d) packets"
-- 
2.17.1


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

* [dts] [dts 3/3] tests/TestSuite_dynamic_flowtype:change send pkt mode
  2020-12-09  1:59 [dts] [PATCH V2 0/3] add new interface for write raw pkt and Zhou Jun
  2020-12-09  1:59 ` [dts] [dts 1/3] framework/packet.py:add interface for write raw pkt Zhou Jun
  2020-12-09  1:59 ` [dts] [dts 2/3] tests/TestSuite_ddp_gtp_qregion:change send pkt mode and use framework interface to " Zhou Jun
@ 2020-12-09  1:59 ` Zhou Jun
  2020-12-09  2:00 ` [dts] [PATCH V2 0/3] add new interface for write raw pkt and Zhou, JunX W
  3 siblings, 0 replies; 5+ messages in thread
From: Zhou Jun @ 2020-12-09  1:59 UTC (permalink / raw)
  To: dts; +Cc: Zhou Jun

Signed-off-by: Zhou Jun <junx.w.zhou@intel.com>
---
 tests/TestSuite_dynamic_flowtype.py | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/tests/TestSuite_dynamic_flowtype.py b/tests/TestSuite_dynamic_flowtype.py
index 99f28d8a..3f47d590 100644
--- a/tests/TestSuite_dynamic_flowtype.py
+++ b/tests/TestSuite_dynamic_flowtype.py
@@ -34,6 +34,7 @@ import re
 import utils
 from test_case import TestCase
 from pmd_output import PmdOutput
+import packet
 
 VM_CORES_MASK = 'all'
 
@@ -202,10 +203,8 @@ class TestDynamicFlowtype(TestCase):
         """
         pkts = self.gtp_packets(flowtype, match_opt)
         for packet_type in list(pkts.keys()):
-            self.tester.scapy_append(
-                'sendp([%s], iface="%s")'
-                % (pkts[packet_type], self.tester_intf))
-            self.tester.scapy_execute()
+            pkt = packet.Packet(pkts[packet_type])
+            pkt.send_pkt(crb=self.tester, tx_port=self.tester_intf)
             out = self.dut.get_session_output(timeout=2)
             if match_opt == 'matched':
                 self.verify("PKT_RX_RSS_HASH" in out,
-- 
2.17.1


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

* Re: [dts] [PATCH V2 0/3] add new interface for write raw pkt and
  2020-12-09  1:59 [dts] [PATCH V2 0/3] add new interface for write raw pkt and Zhou Jun
                   ` (2 preceding siblings ...)
  2020-12-09  1:59 ` [dts] [dts 3/3] tests/TestSuite_dynamic_flowtype:change send pkt mode Zhou Jun
@ 2020-12-09  2:00 ` Zhou, JunX W
  3 siblings, 0 replies; 5+ messages in thread
From: Zhou, JunX W @ 2020-12-09  2:00 UTC (permalink / raw)
  To: Zhou, JunX W, dts

[-- Attachment #1: Type: text/plain, Size: 300 bytes --]

Tested-by: Zhou, Jun <junx.w.zhou@intel.com>

-----Original Message-----
From: Zhou Jun [mailto:junx.w.zhou@intel.com] 
Sent: Wednesday, December 9, 2020 10:00 AM
To: dts@dpdk.org
Cc: Zhou, JunX W <junx.w.zhou@intel.com>
Subject: [dts][PATCH V2 0/3] add new interface for write raw pkt and


[-- Attachment #2: TestDdpGtpQregion.log --]
[-- Type: application/octet-stream, Size: 4513869 bytes --]

[-- Attachment #3: TestDynamicFlowtype.log --]
[-- Type: application/octet-stream, Size: 852753 bytes --]

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

end of thread, other threads:[~2020-12-09  2:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-09  1:59 [dts] [PATCH V2 0/3] add new interface for write raw pkt and Zhou Jun
2020-12-09  1:59 ` [dts] [dts 1/3] framework/packet.py:add interface for write raw pkt Zhou Jun
2020-12-09  1:59 ` [dts] [dts 2/3] tests/TestSuite_ddp_gtp_qregion:change send pkt mode and use framework interface to " Zhou Jun
2020-12-09  1:59 ` [dts] [dts 3/3] tests/TestSuite_dynamic_flowtype:change send pkt mode Zhou Jun
2020-12-09  2:00 ` [dts] [PATCH V2 0/3] add new interface for write raw pkt and Zhou, JunX W

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