Skip to content

Commit 92e37f2

Browse files
apconoledavem330
authored andcommitted
selftests: openvswitch: Add version check for pyroute2
Paolo Abeni reports that on some systems the pyroute2 version isn't new enough to run the test suite. Ensure that we support a minimum version of 0.6 for all cases (which does include the existing ones). The 0.6.1 version was released in May of 2021, so should be propagated to most installations at this point. The alternative that Paolo proposed was to only skip when the add-flow is being run. This would be okay for most cases, except if a future test case is added that needs to do flow dump without an associated add (just guessing). In that case, it could also be broken and we would need additional skip logic anyway. Just draw a line in the sand now. Fixes: 25f16c8 ("selftests: add openvswitch selftest suite") Reported-by: Paolo Abeni <pabeni@redhat.com> Closes: https://lore.kernel.org/lkml/8470c431e0930d2ea204a9363a60937289b7fdbe.camel@redhat.com/ Signed-off-by: Aaron Conole <aconole@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent fc8b2a6 commit 92e37f2

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

tools/testing/selftests/net/openvswitch/openvswitch.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ run_test() {
525525
fi
526526

527527
if python3 ovs-dpctl.py -h 2>&1 | \
528-
grep "Need to install the python" >/dev/null 2>&1; then
528+
grep -E "Need to (install|upgrade) the python" >/dev/null 2>&1; then
529529
stdbuf -o0 printf "TEST: %-60s [PYLIB]\n" "${tdesc}"
530530
return $ksft_skip
531531
fi

tools/testing/selftests/net/openvswitch/ovs-dpctl.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@
2828
from pyroute2.netlink import nlmsg_atoms
2929
from pyroute2.netlink.exceptions import NetlinkError
3030
from pyroute2.netlink.generic import GenericNetlinkSocket
31+
import pyroute2
32+
3133
except ModuleNotFoundError:
32-
print("Need to install the python pyroute2 package.")
34+
print("Need to install the python pyroute2 package >= 0.6.")
3335
sys.exit(0)
3436

3537

@@ -1998,6 +2000,12 @@ def main(argv):
19982000
nlmsg_atoms.ovskey = ovskey
19992001
nlmsg_atoms.ovsactions = ovsactions
20002002

2003+
# version check for pyroute2
2004+
prverscheck = pyroute2.__version__.split(".")
2005+
if int(prverscheck[0]) == 0 and int(prverscheck[1]) < 6:
2006+
print("Need to upgrade the python pyroute2 package to >= 0.6.")
2007+
sys.exit(0)
2008+
20012009
parser = argparse.ArgumentParser()
20022010
parser.add_argument(
20032011
"-v",

0 commit comments

Comments
 (0)