Hi Eelco,
> -----Original Message-----
> From: Eelco Chaudron <[email protected]>
> Sent: Tuesday, May 24, 2022 4:22 PM
> To: Amber, Kumar <[email protected]>
> Cc: [email protected]; Ferriter, Cian <[email protected]>;
> [email protected]; Stokes, Ian <[email protected]>; Van Haaren, Harry
> <[email protected]>
> Subject: Re: [PATCH v4] tests/mfex: Improve pcap script for mfex tests.
>
>
>
> On 24 May 2022, at 12:03, Kumar Amber wrote:
>
> > The mfex pcap generation script is improved for varied length traffic
> > and also removes the hard coded mfex_pcap and instead uses the script
> > itself to generate complex traffic patterns for testing.
> >
> > Signed-off-by: Kumar Amber <[email protected]>
> > Acked-by: Cian Ferriter <[email protected]>
> >
> > ---
> > v4:
> > - Fix MAC and L4 ports to a value.
> > - Generate Ip addresses in fixed range.
> > v3:
> > - Fix comments(Eelco).
> > - Script generates mac/ip/l4_ports in a fixed range.
> > v2:
> > - Add huge page test-skip.
> > - Change core id to 3 to 0 to allow the mfex config test-case
> > to run on any system.
> > ---
> > ---
> > tests/automake.mk | 1 -
> > tests/mfex_fuzzy.py | 85 +++++++++++++++++++++++++++-----------
> > tests/pcap/mfex_test.pcap | Bin 416 -> 0 bytes
> > tests/system-dpdk.at | 53 +++++++++++++-----------
> > 4 files changed, 92 insertions(+), 47 deletions(-) delete mode
> > 100644 tests/pcap/mfex_test.pcap
> >
> > diff --git a/tests/automake.mk b/tests/automake.mk index
> > 34ddda6aa..204e86fac 100644
> > --- a/tests/automake.mk
> > +++ b/tests/automake.mk
> > @@ -146,7 +146,6 @@ $(srcdir)/tests/fuzz-regression-list.at:
> > tests/automake.mk
> >
> > EXTRA_DIST += $(MFEX_AUTOVALIDATOR_TESTS)
> MFEX_AUTOVALIDATOR_TESTS =
> > \
> > - tests/pcap/mfex_test.pcap \
> > tests/mfex_fuzzy.py
> >
> > OVSDB_CLUSTER_TESTSUITE_AT = \
> > diff --git a/tests/mfex_fuzzy.py b/tests/mfex_fuzzy.py index
> > 3efe1152d..b4f8796b4 100755
> > --- a/tests/mfex_fuzzy.py
> > +++ b/tests/mfex_fuzzy.py
> > @@ -3,30 +3,69 @@
> > import sys
> >
> > from scapy.all import RandMAC, RandIP, PcapWriter, RandIP6,
> > RandShort, fuzz -from scapy.all import IPv6, Dot1Q, IP, Ether, UDP,
> > TCP
> > +from scapy.all import IPv6, Dot1Q, IP, Ether, UDP, TCP, random
> >
> > +# Relative path for the pcap file location.
> > path = str(sys.argv[1]) + "/pcap/fuzzy.pcap"
> > +# The number of packets generated will be size * 8.
> > +size = int(sys.argv[2])
> > +# Traffic option is used to choose between fuzzy or simple packet type.
> > +if (len(sys.argv) > 3):
> > + traffic_opt = str(sys.argv[3])
> > +else:
> > + traffic_opt = ""
> > +
> > pktdump = PcapWriter(path, append=False, sync=True)
> >
> > -for i in range(0, 2000):
> > -
> > - # Generate random protocol bases, use a fuzz() over the combined
> packet
> > - # for full fuzzing.
> > - eth = Ether(src=RandMAC(), dst=RandMAC())
> > - vlan = Dot1Q()
> > - ipv4 = IP(src=RandIP(), dst=RandIP())
> > - ipv6 = IPv6(src=RandIP6(), dst=RandIP6())
> > - udp = UDP(dport=RandShort(), sport=RandShort())
> > - tcp = TCP(dport=RandShort(), sport=RandShort())
> > -
> > - # IPv4 packets with fuzzing
> > - pktdump.write(fuzz(eth / ipv4 / udp))
> > - pktdump.write(fuzz(eth / ipv4 / tcp))
> > - pktdump.write(fuzz(eth / vlan / ipv4 / udp))
> > - pktdump.write(fuzz(eth / vlan / ipv4 / tcp))
> > -
> > - # IPv6 packets with fuzzing
> > - pktdump.write(fuzz(eth / ipv6 / udp))
> > - pktdump.write(fuzz(eth / ipv6 / tcp))
> > - pktdump.write(fuzz(eth / vlan / ipv6 / udp))
> > - pktdump.write(fuzz(eth / vlan / ipv6 / tcp))
> > +pkt = []
> > +
> > +for i in range(0, size):
> > + if traffic_opt == "fuzzy":
> > +
> > + eth = Ether(src=RandMAC(), dst=RandMAC())
> > + vlan = Dot1Q()
> > + udp = UDP(dport=RandShort(), sport=RandShort())
> > + ipv4 = IP(src=RandIP(), dst=RandIP(), len=random.randint(0, 100))
> > + ipv6 = IPv6(src=RandIP6(), dst=RandIP6(), plen=random.randint(0,
> 100))
> > + tcp = TCP(dport=RandShort(), sport=RandShort(), flags='S',
> > + dataofs=random.randint(0, 15))
> > +
> > + # IPv4 packets with fuzzing
> > + pkt.append(fuzz(eth / ipv4 / udp))
> > + pkt.append(fuzz(eth / ipv4 / tcp))
> > + pkt.append(fuzz(eth / vlan / ipv4 / udp))
> > + pkt.append(fuzz(eth / vlan / ipv4 / tcp))
> > +
> > + # IPv6 packets with fuzzing
> > + pkt.append(fuzz(eth / ipv6 / udp))
> > + pkt.append(fuzz(eth / ipv6 / tcp))
> > + pkt.append(fuzz(eth / vlan / ipv6 / udp))
> > + pkt.append(fuzz(eth / vlan / ipv6 / tcp))
> > +
> > + else:
> > + mac_addr = "52:54:00:FF:FF:FF"
> > + src_port = 200
> > + dst_port = 1000
>
> So you no longer want the ports and MAC to be a range as I suggested?
>
> > + eth = Ether(src=mac_addr, dst=mac_addr)
>
I understood from earlier comments than you wanted a particular fix value ๐
Sorry fixed it in v5 to a range like IP dependent on I value.
> Now you also have the source and destination MAC the same, is this on
> purpose?
>
Well doesnโt matter much but since you highlighted it would be nice to put
different values.
Done in v5.
> > + vlan = Dot1Q(vlan=(i % 10))
> > + udp = UDP(dport=src_port, sport=dst_port)
> > + # IPv4 address range limits to 255
>
> , and IPv6 limit to 65535.
>
Added in V5.
> > + ipv4_addr = "192.168.150." + str((i % 255))
> > + ipv6_addr = "2001:0db8:85a3:0000:0000:8a2e:0370:" + str(i %
> > + 0xffff)
>
> You missed my previous comment, this need to be a hex value with leading
> zeros.
> Guess you could use "2001:0db8:85a3:0000:0000:8a2e:0370:{:04x}โ.format(i
> % 0xffff) here (please verify ;)
>
Yeah, I misunderstood a bit. Verified it works ๐ and added as well in V5.
> > + ipv4 = IP(src=ipv4_addr, dst=ipv4_addr)
> > + ipv6 = IPv6(src=ipv6_addr, dst=ipv6_addr)
>
> Here also you use the same source and destination IP, is this on purpose? If
> so Iโm ok, but a different src/dst makes more sense.
>
Done .
Regards
Amber
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev