* [dts] [PATCH]framework/tester.py: create packets length with protocol type
@ 2016-01-18 6:43 Lijuan Tu
2016-01-18 6:57 ` Liu, Yong
0 siblings, 1 reply; 2+ messages in thread
From: Lijuan Tu @ 2016-01-18 6:43 UTC (permalink / raw)
To: dts
Signed-off-by: Lijuan Tu <lijuanx.a.tu@intel.com>
---
framework/tester.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/framework/tester.py b/framework/tester.py
index c8cebd6..d3deb3b 100644
--- a/framework/tester.py
+++ b/framework/tester.py
@@ -471,10 +471,11 @@ class Tester(Crb):
else:
return None
- def check_random_pkts(self, portList, pktnum=2000, interval=0.01, allow_miss=True, params=None):
+ def check_random_pkts(self, portList, pktnum=10000, interval=0.01, allow_miss=True, params=None):
"""
Send several random packets and check rx packets matched
"""
+# allow_miss=True
# load functions in packet module
module = __import__("packet")
pkt_c = getattr(module, "Packet")
@@ -485,6 +486,7 @@ class Tester(Crb):
pkts = []
# packet type random between tcp/udp/ipv6
random_type = ['TCP', 'UDP', 'IPv6_TCP', 'IPv6_UDP']
+ pkt_minlen = {'TCP': 64, 'UDP': 64, 'IPv6_TCP': 74, 'IPv6_UDP': 64}
# at least wait 2 seconds
timeout = int(pktnum * (interval + 0.01)) + 2
for txport, rxport in portList:
@@ -494,7 +496,7 @@ class Tester(Crb):
# chose random packet
pkt_type = random.choice(random_type)
pkt = pkt_c(pkt_type=pkt_type,
- pkt_len=random.randint(64, 1514),
+ pkt_len=random.randint(pkt_minlen[pkt_type], 1514),
ran_payload=True)
# config packet if has parameters
if params and len(portList) == len(params):
@@ -509,6 +511,7 @@ class Tester(Crb):
pkts.append(pkt)
# send and sniff packets
+ sniff_f(intf=txIntf, count=pktnum, timeout=timeout)
inst = sniff_f(intf=rxIntf, count=pktnum, timeout=timeout)
send_f(intf=txIntf, pkts=pkts, interval=interval)
recv_pkts = load_f(inst)
--
1.9.3
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [dts] [PATCH]framework/tester.py: create packets length with protocol type
2016-01-18 6:43 [dts] [PATCH]framework/tester.py: create packets length with protocol type Lijuan Tu
@ 2016-01-18 6:57 ` Liu, Yong
0 siblings, 0 replies; 2+ messages in thread
From: Liu, Yong @ 2016-01-18 6:57 UTC (permalink / raw)
To: Tu, LijuanX A, dts
Lijuan, few comments below.
> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Lijuan Tu
> Sent: Monday, January 18, 2016 2:43 PM
> To: dts@dpdk.org
> Subject: [dts] [PATCH]framework/tester.py: create packets length with
> protocol type
>
> Signed-off-by: Lijuan Tu <lijuanx.a.tu@intel.com>
> ---
> framework/tester.py | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/framework/tester.py b/framework/tester.py
> index c8cebd6..d3deb3b 100644
> --- a/framework/tester.py
> +++ b/framework/tester.py
> @@ -471,10 +471,11 @@ class Tester(Crb):
> else:
> return None
>
> - def check_random_pkts(self, portList, pktnum=2000, interval=0.01,
> allow_miss=True, params=None):
> + def check_random_pkts(self, portList, pktnum=10000, interval=0.01,
> allow_miss=True, params=None):
> """
> Send several random packets and check rx packets matched
> """
> +# allow_miss=True
Meaningless code, please just remove it.
> # load functions in packet module
> module = __import__("packet")
> pkt_c = getattr(module, "Packet")
> @@ -485,6 +486,7 @@ class Tester(Crb):
> pkts = []
> # packet type random between tcp/udp/ipv6
> random_type = ['TCP', 'UDP', 'IPv6_TCP', 'IPv6_UDP']
> + pkt_minlen = {'TCP': 64, 'UDP': 64, 'IPv6_TCP': 74, 'IPv6_UDP':
> 64}
> # at least wait 2 seconds
> timeout = int(pktnum * (interval + 0.01)) + 2
> for txport, rxport in portList:
> @@ -494,7 +496,7 @@ class Tester(Crb):
> # chose random packet
> pkt_type = random.choice(random_type)
> pkt = pkt_c(pkt_type=pkt_type,
> - pkt_len=random.randint(64, 1514),
> + pkt_len=random.randint(pkt_minlen[pkt_type],
> 1514),
> ran_payload=True)
> # config packet if has parameters
> if params and len(portList) == len(params):
> @@ -509,6 +511,7 @@ class Tester(Crb):
> pkts.append(pkt)
>
> # send and sniff packets
> + sniff_f(intf=txIntf, count=pktnum, timeout=timeout)
Why capture packets send to TX interface? It look like meaningless.
> inst = sniff_f(intf=rxIntf, count=pktnum, timeout=timeout)
> send_f(intf=txIntf, pkts=pkts, interval=interval)
> recv_pkts = load_f(inst)
> --
> 1.9.3
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-01-18 6:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-18 6:43 [dts] [PATCH]framework/tester.py: create packets length with protocol type Lijuan Tu
2016-01-18 6:57 ` 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).