diff options
Diffstat (limited to 'tests/topotests/lib/topogen.py')
| -rw-r--r-- | tests/topotests/lib/topogen.py | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/tests/topotests/lib/topogen.py b/tests/topotests/lib/topogen.py index 16d89f079a..f5b3ad06d9 100644 --- a/tests/topotests/lib/topogen.py +++ b/tests/topotests/lib/topogen.py @@ -212,7 +212,10 @@ class Topogen(object): # Mininet(Micronet) to build the actual topology. assert not inspect.isclass(topodef) - self.net = Mininet(controller=None) + self.net = Mininet() + + # Adjust the parent namespace + topotest.fix_netns_limits(self.net) # New direct way: Either a dictionary defines the topology or a build function # is supplied, or a json filename all of which build the topology by calling @@ -485,7 +488,7 @@ class Topogen(object): memleak_file = os.environ.get("TOPOTESTS_CHECK_MEMLEAK") or self.config.get( self.CONFIG_SECTION, "memleak_path" ) - if memleak_file == "" or memleak_file == None: + if memleak_file == "" or memleak_file is None: return False return True @@ -504,7 +507,7 @@ class Topogen(object): def set_error(self, message, code=None): "Sets an error message and signal other tests to skip." - logger.info(message) + logger.info("setting error msg: %s", message) # If no code is defined use a sequential number if code is None: @@ -713,6 +716,7 @@ class TopoRouter(TopoGear): RD_PATH = 17 RD_SNMP = 18 RD_PIM6 = 19 + RD_MGMTD = 20 RD = { RD_FRR: "frr", RD_ZEBRA: "zebra", @@ -734,6 +738,7 @@ class TopoRouter(TopoGear): RD_PBRD: "pbrd", RD_PATH: "pathd", RD_SNMP: "snmpd", + RD_MGMTD: "mgmtd", } def __init__(self, tgen, cls, name, **params): @@ -797,7 +802,7 @@ class TopoRouter(TopoGear): grep_cmd = "grep 'ip {}' {}".format(daemonstr, source) else: grep_cmd = "grep 'router {}' {}".format(daemonstr, source) - result = self.run(grep_cmd).strip() + result = self.run(grep_cmd, warn=False).strip() if result: self.load_config(daemon) else: @@ -810,7 +815,7 @@ class TopoRouter(TopoGear): TopoRouter.RD_RIPNG, TopoRouter.RD_OSPF, TopoRouter.RD_OSPF6, TopoRouter.RD_ISIS, TopoRouter.RD_BGP, TopoRouter.RD_LDP, TopoRouter.RD_PIM, TopoRouter.RD_PIM6, TopoRouter.RD_PBR, - TopoRouter.RD_SNMP. + TopoRouter.RD_SNMP, TopoRouter.RD_MGMTD. Possible `source` values are `None` for an empty config file, a path name which is used directly, or a file name with no path components which is first looked for @@ -820,7 +825,7 @@ class TopoRouter(TopoGear): all routers. """ daemonstr = self.RD.get(daemon) - self.logger.info('loading "{}" configuration: {}'.format(daemonstr, source)) + self.logger.debug('loading "{}" configuration: {}'.format(daemonstr, source)) self.net.loadConf(daemonstr, source, param) def check_router_running(self): @@ -943,16 +948,16 @@ class TopoRouter(TopoGear): vtysh_command = 'vtysh {} -c "{}" 2>/dev/null'.format(dparam, command) - self.logger.info('vtysh command => "{}"'.format(command)) + self.logger.debug('vtysh command => "{}"'.format(command)) output = self.run(vtysh_command) dbgout = output.strip() if dbgout: if "\n" in dbgout: dbgout = dbgout.replace("\n", "\n\t") - self.logger.info("vtysh result:\n\t{}".format(dbgout)) + self.logger.debug("vtysh result:\n\t{}".format(dbgout)) else: - self.logger.info('vtysh result: "{}"'.format(dbgout)) + self.logger.debug('vtysh result: "{}"'.format(dbgout)) if isjson is False: return output @@ -992,7 +997,7 @@ class TopoRouter(TopoGear): dbgcmds = commands if is_string(commands) else "\n".join(commands) dbgcmds = "\t" + dbgcmds.replace("\n", "\n\t") - self.logger.info("vtysh command => FILE:\n{}".format(dbgcmds)) + self.logger.debug("vtysh command => FILE:\n{}".format(dbgcmds)) res = self.run(vtysh_command) os.unlink(fname) @@ -1001,9 +1006,9 @@ class TopoRouter(TopoGear): if dbgres: if "\n" in dbgres: dbgres = dbgres.replace("\n", "\n\t") - self.logger.info("vtysh result:\n\t{}".format(dbgres)) + self.logger.debug("vtysh result:\n\t{}".format(dbgres)) else: - self.logger.info('vtysh result: "{}"'.format(dbgres)) + self.logger.debug('vtysh result: "{}"'.format(dbgres)) return res def report_memory_leaks(self, testname): @@ -1017,7 +1022,7 @@ class TopoRouter(TopoGear): memleak_file = ( os.environ.get("TOPOTESTS_CHECK_MEMLEAK") or self.params["memleak_path"] ) - if memleak_file == "" or memleak_file == None: + if memleak_file == "" or memleak_file is None: return self.stop() @@ -1174,7 +1179,7 @@ class TopoExaBGP(TopoHost): self.run("chown -R exabgp:exabgp /etc/exabgp") output = self.run(exacmd + " -e /etc/exabgp/exabgp.env /etc/exabgp/exabgp.cfg") - if output == None or len(output) == 0: + if output is None or len(output) == 0: output = "<none>" logger.info("{} exabgp started, output={}".format(self.name, output)) @@ -1269,6 +1274,7 @@ def diagnose_env_linux(rundir): "pim6d", "ldpd", "pbrd", + "mgmtd", ]: path = os.path.join(frrdir, fname) if not os.path.isfile(path): @@ -1283,9 +1289,10 @@ def diagnose_env_linux(rundir): logger.error("could not find {} in {}".format(fname, frrdir)) ret = False else: - if fname != "zebra": + if fname != "zebra" or fname != "mgmtd": continue + os.system("{} -v 2>&1 >{}/frr_mgmtd.txt".format(path, rundir)) os.system("{} -v 2>&1 >{}/frr_zebra.txt".format(path, rundir)) # Test MPLS availability |
