From: Donald Sharp Date: Wed, 26 Apr 2017 12:51:50 +0000 (-0400) Subject: lib: Fix kernel version parsing X-Git-Tag: frr-7.1-dev~151^2~333 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=dd4eca4d974c290c48a14bb2dad4d67f0883279b;p=matthieu%2Ffrr.git lib: Fix kernel version parsing When we have a kernel sub version > 10 the float conversion of the kernel version causes 4.10 to be less than 4.5 Get the kernel version in groups on . and do comparison that way Signed-off-by: Donald Sharp --- diff --git a/tests/topotests/lib/topotest.py b/tests/topotests/lib/topotest.py index 221910b13f..a8b3784b0f 100644 --- a/tests/topotests/lib/topotest.py +++ b/tests/topotests/lib/topotest.py @@ -157,9 +157,10 @@ class Router(Node): if not os.path.isfile('/usr/lib/%s/ldpd' % self.routertype): print("LDP Test, but no ldpd compiled or installed") return "LDP Test, but no ldpd compiled or installed" - kernel_version = re.search(r'([0-9]+\.[0-9]+).*', platform.release()) + kernel_version = re.search(r'([0-9]+)\.([0-9]+).*', platform.release()) + if kernel_version: - if float(kernel_version.group(1)) < 4.5: + if float(kernel_version.group(1)) < 4 and float(kernel.version.group(2)) < 5: print("LDP Test need Linux Kernel 4.5 minimum") return "LDP Test need Linux Kernel 4.5 minimum" # Add mpls modules to kernel if we use LDP