From: Lou Berger Date: Sat, 11 May 2019 18:52:29 +0000 (+0000) Subject: topotests/lib: support sharpd and other daemons in lutils X-Git-Tag: base_7.2~343^2~3 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=a38f008303a570323d47519af9136e2423fcb189;p=matthieu%2Ffrr.git topotests/lib: support sharpd and other daemons in lutils needs both .conf and to be present Signed-off-by: Lou Berger --- diff --git a/tests/topotests/lib/ltemplate.py b/tests/topotests/lib/ltemplate.py index 31eaec7009..1d12d11a26 100644 --- a/tests/topotests/lib/ltemplate.py +++ b/tests/topotests/lib/ltemplate.py @@ -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') diff --git a/tests/topotests/lib/topogen.py b/tests/topotests/lib/topogen.py index 0bc1596eb2..d7145c3be0 100644 --- a/tests/topotests/lib/topogen.py +++ b/tests/topotests/lib/topogen.py @@ -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):