From: Martin Winter Date: Sat, 8 Apr 2017 10:40:51 +0000 (-0700) Subject: lib: Add function to check for daemon available (i.e. LDPd) and function to return... X-Git-Tag: frr-7.1-dev~151^2~340 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=80eeefb7da6ad100213baa7bd5fac024cae8148a;p=matthieu%2Ffrr.git lib: Add function to check for daemon available (i.e. LDPd) and function to return typ (quagga or frr) Signed-off-by: Martin Winter --- diff --git a/tests/topotests/lib/topotest.py b/tests/topotests/lib/topotest.py index bd797bfafc..221910b13f 100644 --- a/tests/topotests/lib/topotest.py +++ b/tests/topotests/lib/topotest.py @@ -52,7 +52,7 @@ def int2dpid(dpid): 'canonical switch name such as s23.') def addRouter(topo, name): - "Adding a FreeRangeRouter (or Quagga) to Topology" + "Adding a FRRouter (or Quagga) to Topology" MyPrivateDirs = ['/etc/frr', '/etc/quagga', @@ -241,6 +241,24 @@ class Router(Node): else: linklocal += [[interface, local]] return linklocal + def daemon_available(self, daemon): + "Check if specified daemon is installed (and for ldp if kernel supports MPLS)" + + if not os.path.isfile('/usr/lib/%s/%s' % (self.routertype, daemon)): + return False + if (daemon == 'ldpd'): + kernel_version = re.search(r'([0-9]+\.[0-9]+).*', platform.release()) + if kernel_version: + if float(kernel_version.group(1)) < 4.5: + return False + else: + return False + return True + def get_routertype(self): + "Return the type of Router (frr or quagga)" + + return self.routertype + class LegacySwitch(OVSSwitch): "A Legacy Switch without OpenFlow"