lib: add router.has_mpls check

Signed-off-by: Lou Berger <lberger@labn.net>
This commit is contained in:
Lou Berger 2018-01-31 20:07:27 -05:00 committed by Donald Sharp
parent 46325763aa
commit 447f2d5a16
2 changed files with 6 additions and 0 deletions

View File

@ -775,6 +775,10 @@ class TopoRouter(TopoGear):
curtype = self.version_info()['type']
return rtype == curtype
def has_mpls(self):
nrouter = self.tgen.net[self.name]
return nrouter.hasmpls
class TopoSwitch(TopoGear):
"""
Switch abstraction. Has the following properties:

View File

@ -464,6 +464,7 @@ class Router(Node):
super(Router, self).__init__(name, **params)
self.logdir = params.get('logdir', '/tmp')
self.daemondir = None
self.hasmpls = False
self.routertype = 'frr'
self.daemons = {'zebra': 0, 'ripd': 0, 'ripngd': 0, 'ospfd': 0,
'ospf6d': 0, 'isisd': 0, 'bgpd': 0, 'pimd': 0,
@ -617,6 +618,7 @@ class Router(Node):
logger.info("LDP Test needs mpls-iptunnel kernel module")
return "LDP Test needs mpls-router kernel module"
self.hasmpls = True
self.cmd('/sbin/modprobe mpls-router')
self.cmd('/sbin/modprobe mpls-iptunnel')
self.cmd('echo 100000 > /proc/sys/net/mpls/platform_labels')