]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: Fix kernel version parsing
authorDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 26 Apr 2017 12:51:50 +0000 (08:51 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 28 Nov 2018 01:22:11 +0000 (20:22 -0500)
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 <major>.<minor> and do
comparison that way

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
tests/topotests/lib/topotest.py

index 221910b13fc56b153932ecc8dffd1cccb7c901cf..a8b3784b0f23a196e49c88b6422294f5595c4e8c 100644 (file)
@@ -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