diff options
| author | Russ White <russ@riw.us> | 2024-11-12 18:00:46 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-12 18:00:46 -0500 |
| commit | 5456bc5d9313b53b8059583cba7c95f55f08a26b (patch) | |
| tree | 8018f07eda39accccbcd18d4c499ff217475f9bb /tests/topotests/lib/topogen.py | |
| parent | dfd85da52fc853623abc4bf31430d7664663a1bd (diff) | |
| parent | 92ecd0a5d465a9aa3b0e31fb48b8b2556b420ea2 (diff) | |
Merge pull request #17331 from Jafaral/ospf-instance
tests: add support for ospf instances with unified configs
Diffstat (limited to 'tests/topotests/lib/topogen.py')
| -rw-r--r-- | tests/topotests/lib/topogen.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/tests/topotests/lib/topogen.py b/tests/topotests/lib/topogen.py index d04d7b4257..4d7c56423e 100644 --- a/tests/topotests/lib/topogen.py +++ b/tests/topotests/lib/topogen.py @@ -850,12 +850,23 @@ class TopoRouter(TopoGear): result = self.run(grep_cmd, warn=False).strip() if result: self.load_config(daemon, "") + if daemonstr == "ospf": + grep_cmd = "grep -E 'router ospf ([0-9]+*)' {} | grep -o -E '([0-9]*)'".format( + source_path + ) + result = self.run(grep_cmd, warn=False) + if result: # instances + instances = result.split("\n") + for inst in instances: + if inst != "": + self.load_config(daemon, "", None, inst) + else: for item in daemons: daemon, param = item self.load_config(daemon, "", param) - def load_config(self, daemon, source=None, param=None): + def load_config(self, daemon, source=None, param=None, instance=None): """Loads daemon configuration from the specified source Possible daemon values are: TopoRouter.RD_ZEBRA, TopoRouter.RD_RIP, TopoRouter.RD_RIPNG, TopoRouter.RD_OSPF, TopoRouter.RD_OSPF6, @@ -873,7 +884,7 @@ class TopoRouter(TopoGear): """ daemonstr = self.RD.get(daemon) self.logger.debug('loading "{}" configuration: {}'.format(daemonstr, source)) - return self.net.loadConf(daemonstr, source, param) + return self.net.loadConf(daemonstr, source, param, instance) def check_router_running(self): """ |
