test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH] tests: fix the issue of using scapy to send packet
@ 2019-08-20 19:15 Xinfeng Zhao
  2019-08-30  3:26 ` Tu, Lijuan
  0 siblings, 1 reply; 2+ messages in thread
From: Xinfeng Zhao @ 2019-08-20 19:15 UTC (permalink / raw)
  To: dts; +Cc: Xinfeng Zhao

failed to send packet using the method, because there should be delayed a few seconds bettwen sending packet and exiting scapy,
and now instead it with dts scapy method

Signed-off-by: Xinfeng Zhao <xinfengx.zhao@intel.com>
---
 tests/TestSuite_vlan_ethertype_config.py | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/tests/TestSuite_vlan_ethertype_config.py b/tests/TestSuite_vlan_ethertype_config.py
index 1cb1083..727067f 100644
--- a/tests/TestSuite_vlan_ethertype_config.py
+++ b/tests/TestSuite_vlan_ethertype_config.py
@@ -46,7 +46,6 @@ from pmd_output import PmdOutput
 from scapy.utils import struct, socket, wrpcap, rdpcap
 from scapy.layers.inet import Ether, IP, TCP, UDP, ICMP
 from scapy.layers.l2 import Dot1Q, ARP, GRE
-from scapy.sendrecv import sendp
 from settings import DPDK_RXMODE_SETTING
 from settings import load_global_setting
 
@@ -145,11 +144,10 @@ class TestVlanEthertypeConfig(TestCase):
             out = self.tester.send_expect("hexdump -ve '%s' '%s' |sed 's/8100000181000002/%s/' |xxd -r -p > '%s'" % (
                 fmt, self.tpid_ori_file, replace, self.tpid_new_file), "# ")
 
-        self.tester.send_expect("scapy", ">>> ")
-        self.tester.send_expect(
-            "pkt=rdpcap('%s')" % self.tpid_new_file, ">>> ")
-        self.tester.send_expect("sendp(pkt, iface='%s')" % self.txItf, ">>> ")
-        self.tester.send_expect("quit()", "# ")
+        self.tester.scapy_foreground()
+        self.tester.scapy_append("pkt=rdpcap('%s')" % self.tpid_new_file)
+        self.tester.scapy_append("sendp(pkt, iface='%s')" % self.txItf)
+        self.tester.scapy_execute()
 
     def check_vlan_packets(self, vlan, tpid, rxItf, result=True):
 
-- 
2.17.1


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

* Re: [dts] [PATCH] tests: fix the issue of using scapy to send packet
  2019-08-20 19:15 [dts] [PATCH] tests: fix the issue of using scapy to send packet Xinfeng Zhao
@ 2019-08-30  3:26 ` Tu, Lijuan
  0 siblings, 0 replies; 2+ messages in thread
From: Tu, Lijuan @ 2019-08-30  3:26 UTC (permalink / raw)
  To: Zhao, XinfengX, dts; +Cc: Zhao, XinfengX

Applied, thanks

> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Xinfeng Zhao
> Sent: Wednesday, August 21, 2019 3:16 AM
> To: dts@dpdk.org
> Cc: Zhao, XinfengX <xinfengx.zhao@intel.com>
> Subject: [dts] [PATCH] tests: fix the issue of using scapy to send packet
> 
> failed to send packet using the method, because there should be delayed a
> few seconds bettwen sending packet and exiting scapy, and now instead it
> with dts scapy method
> 
> Signed-off-by: Xinfeng Zhao <xinfengx.zhao@intel.com>
> ---
>  tests/TestSuite_vlan_ethertype_config.py | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/tests/TestSuite_vlan_ethertype_config.py
> b/tests/TestSuite_vlan_ethertype_config.py
> index 1cb1083..727067f 100644
> --- a/tests/TestSuite_vlan_ethertype_config.py
> +++ b/tests/TestSuite_vlan_ethertype_config.py
> @@ -46,7 +46,6 @@ from pmd_output import PmdOutput  from scapy.utils
> import struct, socket, wrpcap, rdpcap  from scapy.layers.inet import Ether, IP,
> TCP, UDP, ICMP  from scapy.layers.l2 import Dot1Q, ARP, GRE -from
> scapy.sendrecv import sendp  from settings import DPDK_RXMODE_SETTING
> from settings import load_global_setting
> 
> @@ -145,11 +144,10 @@ class TestVlanEthertypeConfig(TestCase):
>              out = self.tester.send_expect("hexdump -ve '%s' '%s' |sed
> 's/8100000181000002/%s/' |xxd -r -p > '%s'" % (
>                  fmt, self.tpid_ori_file, replace, self.tpid_new_file), "# ")
> 
> -        self.tester.send_expect("scapy", ">>> ")
> -        self.tester.send_expect(
> -            "pkt=rdpcap('%s')" % self.tpid_new_file, ">>> ")
> -        self.tester.send_expect("sendp(pkt, iface='%s')" % self.txItf, ">>> ")
> -        self.tester.send_expect("quit()", "# ")
> +        self.tester.scapy_foreground()
> +        self.tester.scapy_append("pkt=rdpcap('%s')" % self.tpid_new_file)
> +        self.tester.scapy_append("sendp(pkt, iface='%s')" % self.txItf)
> +        self.tester.scapy_execute()
> 
>      def check_vlan_packets(self, vlan, tpid, rxItf, result=True):
> 
> --
> 2.17.1


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

end of thread, other threads:[~2019-08-30  3:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-20 19:15 [dts] [PATCH] tests: fix the issue of using scapy to send packet Xinfeng Zhao
2019-08-30  3:26 ` 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).