[ovs-dev] [v6 07/11] test/sytem-dpdk: Add unit test for mfex autovalidator

Amber, Kumar kumar.amber at intel.com
Wed Jul 7 18:34:07 UTC 2021


Hi Eelco,

Replies are inline.

+++ b/tests/mfex_fuzzy.py
@@ -0,0 +1,32 @@
+#!/usr/bin/python3
+try:
+ from scapy.all import *
+except ModuleNotFoundError as err:
+ print(err + ": Scapy")
+import sys
+import os
+
+path = os.environ['OVS_DIR'] + "/tests/pcap/fuzzy"

This is failing in my setup, as OVS_DIR is not defined:

Is it something you set manually? As from make check-dpdk it fails:

  1.  system-dpdk.at:260: testing OVS-DPDK - MFEX Autovalidator Fuzzy ...

DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf
under the [list] section) to disable this warning.
scapy (2.4.4)
./system-dpdk.at:263: $PYTHON3 $srcdir/mfex_fuzzy.py
--- /dev/null 2021-07-02 08:15:52.158758028 -0400
+++ /root/Documents/Scratch/ovs_review_mfex/OVS_master_DPDK_v20.11.1/ovs_github/tests/system-dpdk-testsuite.dir/at-groups/7/stderr 2021-07-07 10:34:09.364877
754 -0400
@@ -0,0 +1,6 @@
+Traceback (most recent call last):

  *   File "../.././mfex_fuzzy.py", line 10, in <module>
  *   path = os.environ['OVS_DIR'] + "/tests/pcap/fuzzy"
  *   File "/usr/lib64/python3.6/os.py", line 669, in getitem
  *   raise KeyError(key) from None

+KeyError: 'OVS_DIR'
stdout:
./system-dpdk.at:263: exit code was 1, expected 0
7. system-dpdk.at:260: 7. OVS-DPDK - MFEX Autovalidator Fuzzy (system-dpdk.at:260): FAILED (system-dpdk.at:263)

If I set the environment variable it works fine, but should not be needed.



Its fixed now Script used $srcdir.

+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()
+ tcp = TCP()
+

I think we should also randomize the UDP/TCP ports as they get extracted.

Done .

+ # 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))

The generated pcap file does not have an extension, might be nice to at it?

Also add the generated pcap file to the .git_ignore file.

Done.

\ No newline at end of file
diff --git a/tests/pcap/mfex_test b/tests/pcap/mfex_test

I would give the pcap file the .pcap extension just to be clear!



Actually cannot all the pcaps present in test prior to this commit also don't hold extension as the automake tries to compile them keeping them without extension prevents this compilation error.

new file mode 100644
index 0000000000000000000000000000000000000000..1aac67b8d643ecb016c758cba4cc32212a80f52a
GIT binary patch
literal 416
zcmca|c+)~A1{MYw`2U}Qff2}Q<eHVR>K`M68ITRa|G at yFii5$Gfk6YL%z>@uY&}o|
z2s4N<1VH2&7y^V87$)XGOtD~MV$cFgfG~zBGGJ2#YtF$<F=a4i;9x8Q*<ZrSM6Ufz
xK>KST_NTIwYriok6N4Vm)gX-Q@<yO<!C`>c^{cp<7_5LgK^UuU{2>VS0RZ!RQ+EIW

literal 0
HcmV?d00001

diff --git a/tests/system-dpdk.at b/tests/system-dpdk.at
index 802895488..fcab92729 100644
--- a/tests/system-dpdk.at
+++ b/tests/system-dpdk.at
@@ -232,3 +232,49 @@ OVS_VSWITCHD_STOP(["\@does not exist. The Open vSwitch kernel module is probably
\@EAL: No free hugepages reported in hugepages-1048576kB at d"])
AT_CLEANUP
dnl --------------------------------------------------------------------------
+
+dnl --------------------------------------------------------------------------
+dnl Add standard DPDK PHY port

I think we should also skip these tests if we do not have a machine that has AVX512. Just to make sure we do not generate an OK where we are not even testing the AVX512 functions.

Actually we should not what if someone wants to write a new mfex version without AVX but just SIMD or some other way than we are probably blocking the testing

+AT_SETUP([OVS-DPDK - MFEX Autovalidator])
+AT_KEYWORDS([dpdk])
+
+OVS_DPDK_START()
+
+dnl Add userspace bridge and attach it to OVS
+AT_CHECK([ovs-vsctl add-br br0 -- set bridge br0 datapath_type=netdev])
+AT_CHECK([ovs-vsctl add-port br0 p1 -- set Interface p1 type=dpdk options:dpdk-devargs=net_pcap1,rx_pcap=$srcdir/pcap/mfex_test,infinite_rx=1], [], [stdout], [stderr])
+AT_CHECK([ovs-vsctl show], [], [stdout])
+
+
+AT_CHECK([ovs-appctl dpif-netdev/miniflow-parser-set autovalidator], [0], [dnl
+Miniflow implementation set to autovalidator
+])


Here we set the autovalidator, and we stop it right after how do we know enough packets were running through it? I thought we discussed looking at frame count to make sure at least the pcap file was run through it once?

OVS_WAIT_UNTIL([test `ovs-vsctl get interface p1 statistics | grep -oP 'rx_packets=\s*\K\d+'` -ge 100000])

Fixed.

+dnl Clean up
+AT_CHECK([ovs-vsctl del-port br0 p1], [], [stdout], [stderr])
+AT_CLEANUP
+dnl --------------------------------------------------------------------------
+
+dnl --------------------------------------------------------------------------
+dnl Add standard DPDK PHY port
+AT_SETUP([OVS-DPDK - MFEX Autovalidator Fuzzy])
+AT_KEYWORDS([dpdk])
+AT_SKIP_IF([! pip3 list | grep scapy], [], [])
+AT_CHECK([$PYTHON3 $srcdir/mfex_fuzzy.py], [], [stdout])
+OVS_DPDK_START()
+
+dnl Add userspace bridge and attach it to OVS
+AT_CHECK([ovs-vsctl add-br br0 -- set bridge br0 datapath_type=netdev])
+AT_CHECK([ovs-vsctl add-port br0 p1 -- set Interface p1 type=dpdk options:dpdk-devargs=net_pcap1,rx_pcap=$srcdir/pcap/fuzzy,infinite_rx=1], [], [stdout], [stderr])
+AT_CHECK([ovs-vsctl show], [], [stdout])
+
+
+AT_CHECK([ovs-appctl dpif-netdev/miniflow-parser-set autovalidator], [0], [dnl
+Miniflow implementation set to autovalidator
+])
+sleep 5

See above, I do not feel like a sleep will work overtime, we might miss packets on a slower machine.

OVS_WAIT_UNTIL([test `ovs-vsctl get interface p1 statistics | grep -oP 'rx_packets=\s*\K\d+'` -ge 100000])

Removed.

+
+dnl Clean up
+AT_CHECK([ovs-vsctl del-port br0 p1], [], [stdout], [stderr])
+AT_CLEANUP
+dnl --------------------------------------------------------------------------
--
2.32.0


More information about the dev mailing list