* [dts] [PATCH V1] fix ieee1588 Ether type is not PTP
@ 2017-08-23 7:36 xu,gang
2017-08-24 5:22 ` Liu, Yong
0 siblings, 1 reply; 2+ messages in thread
From: xu,gang @ 2017-08-23 7:36 UTC (permalink / raw)
To: dts; +Cc: xu,gang
use tcpdump replace sniff caught package
Signed-off-by: xu,gang <gangx.xu@intel.com>
---
tests/TestSuite_ieee1588.py | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/tests/TestSuite_ieee1588.py b/tests/TestSuite_ieee1588.py
index 58d9a10..e06b29d 100644
--- a/tests/TestSuite_ieee1588.py
+++ b/tests/TestSuite_ieee1588.py
@@ -80,21 +80,23 @@ class TestIeee1588(TestCase):
port = self.tester.get_local_port(dutPorts[0])
itf = self.tester.get_interface(port)
- self.tester.scapy_background()
- self.tester.scapy_append('p = sniff(iface="%s", count=2)' % itf)
- self.tester.scapy_append('RESULT = p[1].summary()')
+ #create new session for send packet
+ session_secondary = self.tester.create_session(name = 'send_packet')
- # this is the output of sniff
- # [<Ether dst=01:1b:19:00:00:00 src=00:00:00:00:00:00 type=0x88f7 |<Raw load='\x00\x02' |>>]
- self.tester.scapy_foreground()
- self.tester.scapy_append('nutmac="%s"' % mac)
- self.tester.scapy_append('sendp([Ether(dst=nutmac,type=0x88f7)/"\\x00\\x02"], iface="%s")' % itf)
- self.tester.scapy_append('time.sleep(1)')
+ self.tester.send_expect("tcpdump -i %s -e ether src %s" % (itf,mac), "tcpdump", 20)
- self.tester.scapy_execute()
- out = self.tester.scapy_get_result()
+ session_secondary.send_expect("scapy", "Welcome", 20)
+ session_secondary.send_expect('nutmac="%s"' % mac, ">>> ", 20)
+ session_secondary.send_expect('sendp([Ether(dst=nutmac,type=0x88f7)/"\\x00\\x02"], iface="%s")' % itf, ">>> ", 20)
+
+ out = self.tester.get_session_output(timeout=20)
+
+ session_secondary.send_expect('exit()', "# ", 20)
+
+ self.tester.send_expect("^C", "# ", 20)
+ self.tester.destroy_session(session_secondary)
+
self.verify("0x88f7" in out, "Ether type is not PTP")
- # self.verify("\\x00\\x02" in out, "Payload wrong in PTP")
time.sleep(1)
out = self.dut.get_session_output()
--
1.9.3
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [dts] [PATCH V1] fix ieee1588 Ether type is not PTP
2017-08-23 7:36 [dts] [PATCH V1] fix ieee1588 Ether type is not PTP xu,gang
@ 2017-08-24 5:22 ` Liu, Yong
0 siblings, 0 replies; 2+ messages in thread
From: Liu, Yong @ 2017-08-24 5:22 UTC (permalink / raw)
To: Xu, GangX, dts; +Cc: Xu, GangX
Gang, please use pep8 check with your changes first. I've seen some pep issues in your patch.
Also some comments inline.
Thanks,
Marvin
> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of xu,gang
> Sent: Wednesday, August 23, 2017 3:36 PM
> To: dts@dpdk.org
> Cc: Xu, GangX <gangx.xu@intel.com>
> Subject: [dts] [PATCH V1] fix ieee1588 Ether type is not PTP
>
> use tcpdump replace sniff caught package
>
> Signed-off-by: xu,gang <gangx.xu@intel.com>
> ---
> tests/TestSuite_ieee1588.py | 26 ++++++++++++++------------
> 1 file changed, 14 insertions(+), 12 deletions(-)
>
> diff --git a/tests/TestSuite_ieee1588.py b/tests/TestSuite_ieee1588.py
> index 58d9a10..e06b29d 100644
> --- a/tests/TestSuite_ieee1588.py
> +++ b/tests/TestSuite_ieee1588.py
> @@ -80,21 +80,23 @@ class TestIeee1588(TestCase):
> port = self.tester.get_local_port(dutPorts[0])
> itf = self.tester.get_interface(port)
>
> - self.tester.scapy_background()
> - self.tester.scapy_append('p = sniff(iface="%s", count=2)' % itf)
> - self.tester.scapy_append('RESULT = p[1].summary()')
> + #create new session for send packet
> + session_secondary = self.tester.create_session(name =
> 'send_packet')
>
> - # this is the output of sniff
> - # [<Ether dst=01:1b:19:00:00:00 src=00:00:00:00:00:00
> type=0x88f7 |<Raw load='\x00\x02' |>>]
> - self.tester.scapy_foreground()
> - self.tester.scapy_append('nutmac="%s"' % mac)
> -
> self.tester.scapy_append('sendp([Ether(dst=nutmac,type=0x88f7)/"\\x00\\x02
> "], iface="%s")' % itf)
> - self.tester.scapy_append('time.sleep(1)')
> + self.tester.send_expect("tcpdump -i %s -e ether src %s" %
> (itf,mac), "tcpdump", 20)
>
> - self.tester.scapy_execute()
> - out = self.tester.scapy_get_result()
> + session_secondary.send_expect("scapy", "Welcome", 20)
Even "Welcome" can work here, suggest to use scapy default prompt ">>>".
> + session_secondary.send_expect('nutmac="%s"' % mac, ">>> ", 20)
> +
> session_secondary.send_expect('sendp([Ether(dst=nutmac,type=0x88f7)/"\\x00
> \\x02"], iface="%s")' % itf, ">>> ", 20)
Packet module should support 1588 packets, could you try whether below command workable?
pkt = Packet(pkt_type='TIMESYNC')
pkt.send_pkt(tx_port=itf)
> +
> + out = self.tester.get_session_output(timeout=20)
> +
> + session_secondary.send_expect('exit()', "# ", 20)
> +
> + self.tester.send_expect("^C", "# ", 20)
> + self.tester.destroy_session(session_secondary)
> +
> self.verify("0x88f7" in out, "Ether type is not PTP")
> - # self.verify("\\x00\\x02" in out, "Payload wrong in PTP")
>
> time.sleep(1)
> out = self.dut.get_session_output()
> --
> 1.9.3
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-08-24 5:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-23 7:36 [dts] [PATCH V1] fix ieee1588 Ether type is not PTP xu,gang
2017-08-24 5:22 ` Liu, Yong
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).