Skip to content

Commit

Permalink
tests: Move MFEX tests to dpif-netdev.
Browse files Browse the repository at this point in the history
The MFEX code and tests do not depend on DPDK anymore.
We can move the unit tests to dpif-netdev.

Reviewed-by: Maxime Coquelin <[email protected]>
Acked-by: Eelco Chaudron <[email protected]>
Acked-by: Kumar Amber <[email protected]>
Signed-off-by: David Marchand <[email protected]>
  • Loading branch information
david-marchand committed Dec 7, 2023
1 parent 0e0c226 commit 8ae55b6
Show file tree
Hide file tree
Showing 3 changed files with 166 additions and 196 deletions.
3 changes: 2 additions & 1 deletion python/test_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pytest
netaddr
pytest
pyparsing
scapy
164 changes: 164 additions & 0 deletions tests/dpif-netdev.at
Original file line number Diff line number Diff line change
Expand Up @@ -852,3 +852,167 @@ OVS_VSWITCHD_STOP(["dnl
/.*failed to put.*$/d
/.*failed to flow_del.*$/d"])
AT_CLEANUP

AT_SETUP([dpif-netdev - MFEX Autovalidator])
AT_SKIP_IF([! $PYTHON3 -c "import scapy"], [], [])
OVS_VSWITCHD_START(
[add-port br0 p1 \
-- set interface p1 type=dummy-pmd], [], [], [--dummy-numa="0,0,0,0,1,1,1,1"])

AT_SKIP_IF([! ovs-appctl dpif-netdev/miniflow-parser-get | sed 1,4d | grep "True"], [], [dnl
])

AT_CHECK([ovs-appctl dpif-netdev/dpif-impl-set dpif_avx512], [0], [dnl
DPIF implementation set to dpif_avx512.
])

AT_CHECK([ovs-appctl dpif-netdev/miniflow-parser-set autovalidator], [0], [dnl
Miniflow extract implementation set to autovalidator.
])

AT_SKIP_IF([! $PYTHON3 $srcdir/genpkts.py 2000 > packets])
cat packets | while read line; do
AT_CHECK([ovs-appctl netdev-dummy/receive p1 $line], [0], [ignore])
done

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

OVS_VSWITCHD_STOP
AT_CLEANUP

AT_SETUP([dpif-netdev - MFEX Autovalidator Fuzzy])
AT_SKIP_IF([! $PYTHON3 -c "import scapy"], [], [])
OVS_VSWITCHD_START(
[add-port br0 p1 \
-- set interface p1 type=dummy-pmd], [], [], [--dummy-numa="0,0,0,0,1,1,1,1"])

AT_SKIP_IF([! ovs-appctl dpif-netdev/miniflow-parser-get | sed 1,4d | grep "True"], [], [dnl
])

AT_CHECK([ovs-appctl dpif-netdev/dpif-impl-set dpif_avx512], [0], [dnl
DPIF implementation set to dpif_avx512.
])

AT_CHECK([ovs-appctl dpif-netdev/miniflow-parser-set autovalidator], [0], [dnl
Miniflow extract implementation set to autovalidator.
])

AT_SKIP_IF([! $PYTHON3 $srcdir/genpkts.py 2000 fuzzy > packets])
cat packets | while read line; do
AT_CHECK([ovs-appctl netdev-dummy/receive p1 $line], [0], [ignore])
done

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

OVS_VSWITCHD_STOP
AT_CLEANUP

AT_SETUP([dpif-netdev - MFEX Configuration])
OVS_VSWITCHD_START(
[add-port br0 p1 \
-- set Open_vSwitch . other_config:pmd-cpu-mask=0x1 \
-- set interface p1 type=dummy-pmd], [], [], [--dummy-numa="0,0,0,0,1,1,1,1"])

AT_CHECK([ovs-appctl dpif-netdev/miniflow-parser-set scalar 1], [2],
[], [dnl
Error: unknown argument 1.
ovs-appctl: ovs-vswitchd: server returned an error
])

AT_CHECK([ovs-appctl dpif-netdev/miniflow-parser-set -pmd 6 study 300 xyz], [2],
[], [dnl
Error: invalid study_pkt_cnt value: xyz.
ovs-appctl: ovs-vswitchd: server returned an error
])

AT_CHECK([ovs-appctl dpif-netdev/miniflow-parser-set scalar abcd], [2],
[], [dnl
Error: unknown argument abcd.
ovs-appctl: ovs-vswitchd: server returned an error
])

AT_CHECK([ovs-appctl dpif-netdev/miniflow-parser-set -pmd 0 scalar abcd], [2],
[], [dnl
Error: unknown argument abcd.
ovs-appctl: ovs-vswitchd: server returned an error
])

AT_CHECK([ovs-appctl dpif-netdev/miniflow-parser-set -pmd], [2],
[], [dnl
Error: -pmd option requires a thread id argument.
ovs-appctl: ovs-vswitchd: server returned an error
])

AT_CHECK([ovs-appctl dpif-netdev/miniflow-parser-set tudy abcd], [2],
[], [dnl
Error: unknown argument abcd.
ovs-appctl: ovs-vswitchd: server returned an error
])

AT_CHECK([ovs-appctl dpif-netdev/miniflow-parser-set -pmd 7 study abcd], [2],
[], [dnl
Error: invalid study_pkt_cnt value: abcd.
ovs-appctl: ovs-vswitchd: server returned an error
])

AT_CHECK([ovs-appctl dpif-netdev/miniflow-parser-set -pmd 0 study], [0], [dnl
Miniflow extract implementation set to study, on pmd thread 0, studying 128 packets.
])

AT_CHECK([ovs-appctl dpif-netdev/miniflow-parser-set -pmd 0 study 512], [0], [dnl
Miniflow extract implementation set to study, on pmd thread 0, studying 512 packets.
])

AT_CHECK([ovs-appctl dpif-netdev/miniflow-parser-set study 512], [0], [dnl
Miniflow extract implementation set to study, studying 512 packets.
])

AT_CHECK([ovs-appctl dpif-netdev/miniflow-parser-set study], [0], [dnl
Miniflow extract implementation set to study, studying 128 packets.
])

AT_CHECK([ovs-appctl dpif-netdev/miniflow-parser-set -pmd 0 autovalidator], [0], [dnl
Miniflow extract implementation set to autovalidator, on pmd thread 0.
])

AT_CHECK([ovs-appctl dpif-netdev/miniflow-parser-set -pmd zero study], [2],
[], [dnl
Error: miniflow extract parser not changed, PMD thread passed is not valid: 'zero'. Pass a valid pmd thread ID.
ovs-appctl: ovs-vswitchd: server returned an error
])

AT_CHECK([ovs-appctl dpif-netdev/miniflow-parser-set -pmd 1], [2],
[], [dnl
Error: no miniflow extract name provided. Output of miniflow-parser-get shows implementation list.
ovs-appctl: ovs-vswitchd: server returned an error
])

AT_CHECK([ovs-appctl dpif-netdev/miniflow-parser-set -pmd 1 superstudy], [2],
[], [dnl
Error: unknown miniflow extract implementation superstudy.
ovs-appctl: ovs-vswitchd: server returned an error
])

AT_CHECK([ovs-appctl dpif-netdev/miniflow-parser-set superstudy], [2],
[], [dnl
Error: unknown miniflow extract implementation superstudy.
ovs-appctl: ovs-vswitchd: server returned an error
])

AT_CHECK([ovs-appctl dpif-netdev/miniflow-parser-set -pmd 1 study -pmd], [2],
[], [dnl
Error: invalid study_pkt_cnt value: -pmd.
ovs-appctl: ovs-vswitchd: server returned an error
])

OVS_VSWITCHD_STOP(["dnl
/Error: unknown argument 1./d
/Error: invalid study_pkt_cnt value: xyz./d
/Error: unknown argument abcd./d
/Error: -pmd option requires a thread id argument./d
/Error: invalid study_pkt_cnt value: abcd./d
/Error: miniflow extract parser not changed, PMD thread passed is not valid: 'zero'. Pass a valid pmd thread ID./d
/Error: no miniflow extract name provided. Output of miniflow-parser-get shows implementation list./d
/Error: unknown miniflow extract implementation superstudy./d
/Error: invalid study_pkt_cnt value: -pmd./d"])
AT_CLEANUP
195 changes: 0 additions & 195 deletions tests/system-dpdk.at
Original file line number Diff line number Diff line change
Expand Up @@ -813,201 +813,6 @@ OVS_DPDK_STOP_VSWITCHD(["dnl
AT_CLEANUP
dnl --------------------------------------------------------------------------



dnl --------------------------------------------------------------------------
dnl MFEX Autovalidator
AT_SETUP([OVS-DPDK - MFEX Autovalidator])
AT_KEYWORDS([dpdk])
OVS_DPDK_PRE_CHECK()
OVS_DPDK_START([--no-pci], [--enable-dummy])
AT_CHECK([ovs-vsctl add-br br0 -- set bridge br0 datapath_type=netdev])
AT_SKIP_IF([! ovs-appctl dpif-netdev/miniflow-parser-get | sed 1,4d | grep "True"], [], [dnl
])

AT_SKIP_IF([! $PYTHON3 -c "import scapy"], [], [])

dnl Add userspace bridge and attach it to OVS
AT_CHECK([ovs-vsctl add-port br0 p1 -- set interface p1 type=dummy-pmd])
AT_CHECK([ovs-vsctl show], [], [stdout])

AT_CHECK([ovs-appctl dpif-netdev/dpif-impl-set dpif_avx512], [0], [dnl
DPIF implementation set to dpif_avx512.
])

AT_CHECK([ovs-appctl dpif-netdev/miniflow-parser-set autovalidator], [0], [dnl
Miniflow extract implementation set to autovalidator.
])

AT_SKIP_IF([! $PYTHON3 $srcdir/genpkts.py 2000 > packets])
cat packets | while read line; do
AT_CHECK([ovs-appctl netdev-dummy/receive p1 $line], [0], [ignore])
done

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

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

dnl --------------------------------------------------------------------------
dnl MFEX Autovalidator Fuzzy
AT_SETUP([OVS-DPDK - MFEX Autovalidator Fuzzy])
AT_KEYWORDS([dpdk])
OVS_DPDK_PRE_CHECK()
OVS_DPDK_START([--no-pci], [--enable-dummy])
AT_CHECK([ovs-vsctl add-br br0 -- set bridge br0 datapath_type=netdev])
AT_SKIP_IF([! ovs-appctl dpif-netdev/miniflow-parser-get | sed 1,4d | grep "True"], [], [dnl
])

AT_SKIP_IF([! $PYTHON3 -c "import scapy"], [], [])

dnl Add userspace bridge and attach it to OVS
AT_CHECK([ovs-vsctl add-port br0 p1 -- set interface p1 type=dummy-pmd])
AT_CHECK([ovs-vsctl show], [], [stdout])

AT_CHECK([ovs-appctl dpif-netdev/dpif-impl-set dpif_avx512], [0], [dnl
DPIF implementation set to dpif_avx512.
])

AT_CHECK([ovs-appctl dpif-netdev/miniflow-parser-set autovalidator], [0], [dnl
Miniflow extract implementation set to autovalidator.
])

AT_SKIP_IF([! $PYTHON3 $srcdir/genpkts.py 2000 fuzzy > packets])
cat packets | while read line; do
AT_CHECK([ovs-appctl netdev-dummy/receive p1 $line], [0], [ignore])
done

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

dnl Clean up
AT_CHECK([ovs-vsctl del-port br0 p1], [], [stdout], [stderr])
OVS_DPDK_STOP_VSWITCHD(["dnl
/upcall: datapath reached the dynamic limit of .* flows./d"])
AT_CLEANUP
dnl --------------------------------------------------------------------------

dnl --------------------------------------------------------------------------
AT_SETUP([OVS-DPDK - MFEX Configuration])
AT_KEYWORDS([dpdk])
OVS_DPDK_PRE_CHECK()
OVS_DPDK_START([--no-pci], [--enable-dummy])
AT_CHECK([ovs-vsctl --no-wait set Open_vSwitch . other_config:pmd-cpu-mask=0x1])
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=dummy-pmd])
AT_CHECK([ovs-vsctl show], [], [stdout])

AT_CHECK([ovs-appctl dpif-netdev/miniflow-parser-set scalar 1], [2],
[], [dnl
Error: unknown argument 1.
ovs-appctl: ovs-vswitchd: server returned an error
])

AT_CHECK([ovs-appctl dpif-netdev/miniflow-parser-set -pmd 6 study 300 xyz], [2],
[], [dnl
Error: invalid study_pkt_cnt value: xyz.
ovs-appctl: ovs-vswitchd: server returned an error
])

AT_CHECK([ovs-appctl dpif-netdev/miniflow-parser-set scalar abcd], [2],
[], [dnl
Error: unknown argument abcd.
ovs-appctl: ovs-vswitchd: server returned an error
])

AT_CHECK([ovs-appctl dpif-netdev/miniflow-parser-set -pmd 0 scalar abcd], [2],
[], [dnl
Error: unknown argument abcd.
ovs-appctl: ovs-vswitchd: server returned an error
])

AT_CHECK([ovs-appctl dpif-netdev/miniflow-parser-set -pmd], [2],
[], [dnl
Error: -pmd option requires a thread id argument.
ovs-appctl: ovs-vswitchd: server returned an error
])

AT_CHECK([ovs-appctl dpif-netdev/miniflow-parser-set tudy abcd], [2],
[], [dnl
Error: unknown argument abcd.
ovs-appctl: ovs-vswitchd: server returned an error
])

AT_CHECK([ovs-appctl dpif-netdev/miniflow-parser-set -pmd 7 study abcd], [2],
[], [dnl
Error: invalid study_pkt_cnt value: abcd.
ovs-appctl: ovs-vswitchd: server returned an error
])

AT_CHECK([ovs-appctl dpif-netdev/miniflow-parser-set -pmd 0 study], [0], [dnl
Miniflow extract implementation set to study, on pmd thread 0, studying 128 packets.
])

AT_CHECK([ovs-appctl dpif-netdev/miniflow-parser-set -pmd 0 study 512], [0], [dnl
Miniflow extract implementation set to study, on pmd thread 0, studying 512 packets.
])

AT_CHECK([ovs-appctl dpif-netdev/miniflow-parser-set study 512], [0], [dnl
Miniflow extract implementation set to study, studying 512 packets.
])

AT_CHECK([ovs-appctl dpif-netdev/miniflow-parser-set study], [0], [dnl
Miniflow extract implementation set to study, studying 128 packets.
])

AT_CHECK([ovs-appctl dpif-netdev/miniflow-parser-set -pmd 0 autovalidator], [0], [dnl
Miniflow extract implementation set to autovalidator, on pmd thread 0.
])

AT_CHECK([ovs-appctl dpif-netdev/miniflow-parser-set -pmd zero study], [2],
[], [dnl
Error: miniflow extract parser not changed, PMD thread passed is not valid: 'zero'. Pass a valid pmd thread ID.
ovs-appctl: ovs-vswitchd: server returned an error
])

AT_CHECK([ovs-appctl dpif-netdev/miniflow-parser-set -pmd 1], [2],
[], [dnl
Error: no miniflow extract name provided. Output of miniflow-parser-get shows implementation list.
ovs-appctl: ovs-vswitchd: server returned an error
])

AT_CHECK([ovs-appctl dpif-netdev/miniflow-parser-set -pmd 1 superstudy], [2],
[], [dnl
Error: unknown miniflow extract implementation superstudy.
ovs-appctl: ovs-vswitchd: server returned an error
])

AT_CHECK([ovs-appctl dpif-netdev/miniflow-parser-set superstudy], [2],
[], [dnl
Error: unknown miniflow extract implementation superstudy.
ovs-appctl: ovs-vswitchd: server returned an error
])

AT_CHECK([ovs-appctl dpif-netdev/miniflow-parser-set -pmd 1 study -pmd], [2],
[], [dnl
Error: invalid study_pkt_cnt value: -pmd.
ovs-appctl: ovs-vswitchd: server returned an error
])

dnl Clean up
AT_CHECK([ovs-vsctl del-port br0 p1], [], [stdout], [stderr])
OVS_DPDK_STOP_VSWITCHD(["dnl
/Error: unknown argument 1./d
/Error: invalid study_pkt_cnt value: xyz./d
/Error: unknown argument abcd./d
/Error: -pmd option requires a thread id argument./d
/Error: invalid study_pkt_cnt value: abcd./d
/Error: miniflow extract parser not changed, PMD thread passed is not valid: 'zero'. Pass a valid pmd thread ID./d
/Error: no miniflow extract name provided. Output of miniflow-parser-get shows implementation list./d
/Error: unknown miniflow extract implementation superstudy./d
/Error: invalid study_pkt_cnt value: -pmd./d"])
AT_CLEANUP dnl
dnl --------------------------------------------------------------------------

dnl --------------------------------------------------------------------------
dnl Setup user configured mempools
AT_SETUP([OVS-DPDK - user configured mempool])
Expand Down

0 comments on commit 8ae55b6

Please sign in to comment.