From 4d45d6d3b0f289e7d338f86736a12a2f1177acac Mon Sep 17 00:00:00 2001 From: Rafael Zalamena Date: Wed, 28 Feb 2018 13:06:16 -0300 Subject: [PATCH] topogen/topotest: add support for BFDd Allow BFDd to be configured and used. Signed-off-by: Rafael Zalamena --- tests/topotests/lib/topogen.py | 2 ++ tests/topotests/lib/topotest.py | 13 +++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/tests/topotests/lib/topogen.py b/tests/topotests/lib/topogen.py index dbfd1414c0..25edfe0324 100644 --- a/tests/topotests/lib/topogen.py +++ b/tests/topotests/lib/topogen.py @@ -534,6 +534,7 @@ class TopoRouter(TopoGear): RD_EIGRP = 10 RD_NHRP = 11 RD_STATIC = 12 + RD_BFD = 13 RD = { RD_ZEBRA: 'zebra', RD_RIP: 'ripd', @@ -547,6 +548,7 @@ class TopoRouter(TopoGear): RD_EIGRP: 'eigrpd', RD_NHRP: 'nhrpd', RD_STATIC: 'staticd', + RD_BFD: 'bfdd', } def __init__(self, tgen, cls, name, **params): diff --git a/tests/topotests/lib/topotest.py b/tests/topotests/lib/topotest.py index 40222b7612..a1998bf87b 100644 --- a/tests/topotests/lib/topotest.py +++ b/tests/topotests/lib/topotest.py @@ -618,7 +618,8 @@ class Router(Node): self.routertype = 'frr' self.daemons = {'zebra': 0, 'ripd': 0, 'ripngd': 0, 'ospfd': 0, 'ospf6d': 0, 'isisd': 0, 'bgpd': 0, 'pimd': 0, - 'ldpd': 0, 'eigrpd': 0, 'nhrpd': 0, 'staticd': 0} + 'ldpd': 0, 'eigrpd': 0, 'nhrpd': 0, 'staticd': 0, + 'bfdd': 0} self.daemons_options = {'zebra': ''} self.reportCores = True self.version = None @@ -821,6 +822,12 @@ class Router(Node): logger.info("EIGRP Test, but no eigrpd compiled or installed") return "EIGRP Test, but no eigrpd compiled or installed" + if self.daemons['bfdd'] == 1: + bfdd_path = os.path.join(self.daemondir, 'bfdd') + if not os.path.isfile(bfdd_path): + logger.info("BFD Test, but no bfdd compiled or installed") + return "BFD Test, but no bfdd compiled or installed" + self.restartRouter() return "" @@ -863,9 +870,7 @@ class Router(Node): if self.daemons[daemon] == 0 or daemon == 'zebra' or daemon == 'staticd': continue daemon_path = os.path.join(self.daemondir, daemon) - self.cmd('{0} > {3}.out 2> {3}.err &'.format( - daemon_path, self.logdir, self.name, daemon - )) + self.cmd('{0} > {1}.out 2> {1}.err &'.format(daemon_path, daemon)) self.waitOutput() logger.debug('{}: {} {} started'.format(self, self.routertype, daemon)) def getStdErr(self, daemon): -- 2.39.5