Skip to content

Commit

Permalink
lib: Add check for MPLS kernel modules to exist before trying LDP tests
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
  • Loading branch information
mwinter-osr committed Jul 26, 2017
1 parent ef7b523 commit e4d872e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/topotest.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,15 @@ def startRouter(self):
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')
Expand Down

0 comments on commit e4d872e

Please sign in to comment.