]> git.puffer.fish Git - mirror/frr.git/commitdiff
topotests/lib: support sharpd and other daemons in lutils
authorLou Berger <lberger@labn.net>
Sat, 11 May 2019 18:52:29 +0000 (18:52 +0000)
committerLou Berger <lberger@labn.net>
Wed, 15 May 2019 21:26:13 +0000 (21:26 +0000)
       needs both <daemon>.conf and <daemon> to be present

Signed-off-by: Lou Berger <lberger@labn.net>
tests/topotests/lib/ltemplate.py
tests/topotests/lib/topogen.py

index 31eaec700978df0e4cc6fda9349a5af0808e0fcf..1d12d11a2670c3765abf86c9eac736a361a53321 100644 (file)
@@ -83,22 +83,15 @@ class LTemplate():
 
         # For all registred routers, load the zebra configuration file
         for rname, router in router_list.iteritems():
-            print("Setting up %s" % rname)
-            config = os.path.join(self.testdir, '{}/zebra.conf'.format(rname))
-            if os.path.exists(config):
-                router.load_config(TopoRouter.RD_ZEBRA, config)
-            config = os.path.join(self.testdir, '{}/ospfd.conf'.format(rname))
-            if os.path.exists(config):
-                router.load_config(TopoRouter.RD_OSPF, config)
-            config = os.path.join(self.testdir, '{}/ldpd.conf'.format(rname))
-            if os.path.exists(config):
-                router.load_config(TopoRouter.RD_LDP, config)
-            config = os.path.join(self.testdir, '{}/bgpd.conf'.format(rname))
-            if os.path.exists(config):
-                router.load_config(TopoRouter.RD_BGP, config)
-            config = os.path.join(self.testdir, '{}/isisd.conf'.format(rname))
-            if os.path.exists(config):
-                router.load_config(TopoRouter.RD_ISIS, config)
+            logger.info("Setting up %s" % rname)
+            for rd_val in TopoRouter.RD:
+                config = os.path.join(self.testdir, '{}/{}.conf'.format(rname,TopoRouter.RD[rd_val]))
+                prog = os.path.join(tgen.net[rname].daemondir, TopoRouter.RD[rd_val])
+                if os.path.exists(config):
+                    if os.path.exists(prog):
+                        router.load_config(rd_val, config)
+                    else:
+                        logger.warning("{} not found, but have {}.conf file".format(prog, TopoRouter.RD[rd_val]))
 
         # After loading the configurations, this function loads configured daemons.
         logger.info('Starting routers')
index 0bc1596eb24234e77e609885fdc747e704b80300..d7145c3be0ffb25c4a60943c08847f5d2e9f3953 100644 (file)
@@ -540,6 +540,7 @@ class TopoRouter(TopoGear):
     RD_NHRP = 11
     RD_STATIC = 12
     RD_BFD = 13
+    RD_SHARP = 14
     RD = {
         RD_ZEBRA: 'zebra',
         RD_RIP: 'ripd',
@@ -554,6 +555,7 @@ class TopoRouter(TopoGear):
         RD_NHRP: 'nhrpd',
         RD_STATIC: 'staticd',
         RD_BFD: 'bfdd',
+        RD_SHARP: 'sharpd',
     }
 
     def __init__(self, tgen, cls, name, **params):