summaryrefslogtreecommitdiff
path: root/tests/topotests/lib/topogen.py
diff options
context:
space:
mode:
authorChristian Hopps <chopps@labn.net>2023-05-24 04:43:09 -0400
committerChristian Hopps <chopps@labn.net>2023-05-26 00:33:07 -0400
commit27c6bfc2175d1891579965d3775323cfdf5fde23 (patch)
treec08cf502013bdc3bf903ca28340f53c43b28c14d /tests/topotests/lib/topogen.py
parent254feba0a504f10a372c11567106d85f7102b537 (diff)
tests: cleanup the config file specification and default code
Also, add a new warning for missing configuration files when user is expecting them. Signed-off-by: Christian Hopps <chopps@labn.net>
Diffstat (limited to 'tests/topotests/lib/topogen.py')
-rw-r--r--tests/topotests/lib/topogen.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/topotests/lib/topogen.py b/tests/topotests/lib/topogen.py
index 2d6138990e..0e685a97b0 100644
--- a/tests/topotests/lib/topogen.py
+++ b/tests/topotests/lib/topogen.py
@@ -798,23 +798,23 @@ class TopoRouter(TopoGear):
Start the daemons in the list
If daemons is None, try to infer daemons from the config file
"""
- self.load_config(self.RD_FRR, source)
+ source_path = self.load_config(self.RD_FRR, source)
if not daemons:
# Always add zebra
- self.load_config(self.RD_ZEBRA)
+ self.load_config(self.RD_ZEBRA, "")
for daemon in self.RD:
# This will not work for all daemons
daemonstr = self.RD.get(daemon).rstrip("d")
if daemonstr == "pim":
- grep_cmd = "grep 'ip {}' {}".format(daemonstr, source)
+ grep_cmd = "grep 'ip {}' {}".format(daemonstr, source_path)
else:
- grep_cmd = "grep 'router {}' {}".format(daemonstr, source)
+ grep_cmd = "grep 'router {}' {}".format(daemonstr, source_path)
result = self.run(grep_cmd, warn=False).strip()
if result:
- self.load_config(daemon)
+ self.load_config(daemon, "")
else:
for daemon in daemons:
- self.load_config(daemon)
+ self.load_config(daemon, "")
def load_config(self, daemon, source=None, param=None):
"""Loads daemon configuration from the specified source
@@ -833,7 +833,7 @@ class TopoRouter(TopoGear):
"""
daemonstr = self.RD.get(daemon)
self.logger.debug('loading "{}" configuration: {}'.format(daemonstr, source))
- self.net.loadConf(daemonstr, source, param)
+ return self.net.loadConf(daemonstr, source, param)
def check_router_running(self):
"""