From e1b2ce6a70c3b7846d64047b7d4fef854b1ddd17 Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Wed, 26 Jul 2017 13:37:39 -0700 Subject: [PATCH] lib: Add check for MPLS kernel modules to exist before trying LDP tests Signed-off-by: Martin Winter --- tests/topotests/lib/topotest.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/topotests/lib/topotest.py b/tests/topotests/lib/topotest.py index 61f46097e1..f4aa508bf2 100644 --- a/tests/topotests/lib/topotest.py +++ b/tests/topotests/lib/topotest.py @@ -570,6 +570,15 @@ class Router(Node): logger.warning("LDP Test need Linux Kernel 4.5 minimum") return "LDP Test need Linux Kernel 4.5 minimum" + # Check if required kernel modules are available with a dryrun modprobe + # Silent accept of modprobe command assumes ok status + if self.cmd('/sbin/modprobe -n mpls-router' ) != "": + logger.warning("LDP Test needs mpls-router kernel module") + return "LDP Test needs mpls-router kernel module" + if self.cmd('/sbin/modprobe -n mpls-iptunnel') != "": + logger.warning("LDP Test needs mpls-iptunnel kernel module") + return "LDP Test needs mpls-router kernel module" + self.cmd('/sbin/modprobe mpls-router') self.cmd('/sbin/modprobe mpls-iptunnel') self.cmd('echo 100000 > /proc/sys/net/mpls/platform_labels') -- 2.39.5