On Wed, Dec 1, 2021 at 3:52 PM Amber, Kumar <[email protected]> wrote:
> > diff --git a/tests/genpkts.py b/tests/genpkts.py new file mode 100755 index
> > 0000000000..f64f786ccb
> > --- /dev/null
> > +++ b/tests/genpkts.py
> > @@ -0,0 +1,56 @@
> > +#!/usr/bin/env python3
> > +
> > +import sys
> > +
> > +from scapy.all import RandMAC, RandIP, RandIP6, RandShort, fuzz from
> > +scapy.all import IPv6, Dot1Q, IP, Ether, UDP, TCP
> > +
> > +if len(sys.argv) < 2:
> > +    print('usage: {} packets_count [fuzz]'.format(sys.argv[0]))
> > +    sys.exit(1)
> > +
> > +tmpl = []
> > +
> > +if len(sys.argv) == 2:
> > +    eth = Ether(dst='ff:ff:ff:ff:ff:ff')
> > +    vlan = eth / Dot1Q(vlan=1)
> > +    p = eth / IP() / TCP(sport=20, dport=80, flags='SA', window=8192)
> > +    tmpl += [p.build().hex()]
> > +    p = eth / IP() / UDP(sport=53, dport=53)
> > +    tmpl += [p.build().hex()]
> > +    p = eth / IP() / TCP(sport=20, dport=80, flags='S', window=8192)
> > +    tmpl += [p.build().hex()]
> > +    p = eth / IP() / UDP(sport=53, dport=53)
> > +    tmpl += [p.build().hex()]
> > +    p = vlan / IP() / UDP(sport=53, dport=53)
> > +    tmpl += [p.build().hex()]
> > +    p = vlan / IP() / TCP(sport=20, dport=80, flags='S', window=8192)
> > +    tmpl += [p.build().hex()]
>
> Hardcoding the values here is not preferable as we wanted to test the 
> optimized implementations
> with various values contained inside the header.

Those hardcoded values comes from the pcap file that was previously used.
If you want to add more protocols, it is easier with this patch as you
only need to update some python script rather than rewrite a pcap
file.


> > +on_exit "pkill -f -x -9 '$PYTHON3 $srcdir/genpkts.py -1 fuzz'"
> > +($PYTHON3 $srcdir/genpkts.py -1 fuzz | while read pkt; do
> > +     ovs-appctl netdev-dummy/receive p1 "$pkt" || break
> > + done) &
> > +
> >  AT_CHECK([ovs-appctl dpif-netdev/miniflow-parser-set autovalidator], [0], 
> > [dnl
> > Miniflow extract implementation set to autovalidator.
> >  ])
> >
> > -OVS_WAIT_UNTIL([test `ovs-vsctl get interface p1 statistics | grep -oP
> > 'rx_packets=\s*\K\d+'` -ge 100000])
>
> We should increase the packet count to at-least 10x the current number to 
> have a proper fuzzy testing and we have measured it would only take 10~ to 
> 15~ sec more. The current runtime did not catch issues when we purposely 
> broke the implementation and by allowing to run for 10000 packets, it did 
> catch the induced error.

For me, the fuzzy testing does not have its place in a CI, because it
is not reproducible.
I let it in place and just made sure it would not reach the timeout.


On the system I used, this test takes 5s with 1k and timeouts with 10k.
So I guess the 10s/15s evaluation is dependent on the system.

I prefer to stick to current value.


Thanks.

-- 
David Marchand

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to