Skip to content

Commit

Permalink
tests: Add ability to run a fpm listener
Browse files Browse the repository at this point in the history
Add the ability to run a fpm listener to the testing
system.  This is nothing more just allowing the test
system to bring it up.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
  • Loading branch information
donaldsharp committed Feb 16, 2024
1 parent 8c1cbfd commit 31c146a
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 10 deletions.
18 changes: 14 additions & 4 deletions tests/topotests/lib/topogen.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ def exacmd_version_ok(exacmd):
return False
version = m.group(1)
if topotest.version_cmp(version, "4.2.11") < 0:
logging.debug("found exabgp version < 4.2.11 in %s will keep looking", exacmd)
logging.debug(
"found exabgp version < 4.2.11 in %s will keep looking", exacmd
)
return False
logger.info("Using ExaBGP version %s in %s", version, exacmd)
return True
Expand Down Expand Up @@ -746,6 +748,7 @@ class TopoRouter(TopoGear):
RD_PIM6 = 19
RD_MGMTD = 20
RD_TRAP = 21
RD_FPM_LISTENER = 22
RD = {
RD_FRR: "frr",
RD_ZEBRA: "zebra",
Expand All @@ -769,6 +772,7 @@ class TopoRouter(TopoGear):
RD_SNMP: "snmpd",
RD_MGMTD: "mgmtd",
RD_TRAP: "snmptrapd",
RD_FPM_LISTENER: "fpm_listener",
}

def __init__(self, tgen, cls, name, **params):
Expand Down Expand Up @@ -845,7 +849,8 @@ def load_config(self, daemon, source=None, param=None):
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_MGMTD, TopoRouter.RD_TRAP.
TopoRouter.RD_SNMP, TopoRouter.RD_MGMTD, TopoRouter.RD_TRAP,
TopoRouter.RD_FPM_LISTENER.
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
Expand Down Expand Up @@ -883,7 +888,12 @@ def start(self):
# Enable all daemon command logging, logging files
# and set them to the start dir.
for daemon, enabled in nrouter.daemons.items():
if enabled and daemon != "snmpd" and daemon != "snmptrapd":
if (
enabled
and daemon != "snmpd"
and daemon != "snmptrapd"
and daemon != "fpm_listener"
):
self.vtysh_cmd(
"\n".join(
[
Expand Down Expand Up @@ -933,7 +943,7 @@ def startDaemons(self, daemons):
# and set them to the start dir.
for daemon in daemons:
enabled = nrouter.daemons[daemon]
if enabled and daemon != "snmpd":
if enabled and daemon != "snmpd" and daemon != "fpm_listener":
self.vtysh_cmd(
"\n".join(
[
Expand Down
28 changes: 22 additions & 6 deletions tests/topotests/lib/topotest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1262,8 +1262,8 @@ def rlimit_atleast(rname, min_value, raises=False):

def fix_netns_limits(ns):
# Maximum read and write socket buffer sizes
sysctl_atleast(ns, "net.ipv4.tcp_rmem", [10 * 1024, 87380, 16 * 2**20])
sysctl_atleast(ns, "net.ipv4.tcp_wmem", [10 * 1024, 87380, 16 * 2**20])
sysctl_atleast(ns, "net.ipv4.tcp_rmem", [10 * 1024, 87380, 16 * 2 ** 20])
sysctl_atleast(ns, "net.ipv4.tcp_wmem", [10 * 1024, 87380, 16 * 2 ** 20])

sysctl_assure(ns, "net.ipv4.conf.all.rp_filter", 0)
sysctl_assure(ns, "net.ipv4.conf.default.rp_filter", 0)
Expand Down Expand Up @@ -1322,8 +1322,8 @@ def fix_host_limits():
sysctl_atleast(None, "net.core.netdev_max_backlog", 4 * 1024)

# Maximum read and write socket buffer sizes
sysctl_atleast(None, "net.core.rmem_max", 16 * 2**20)
sysctl_atleast(None, "net.core.wmem_max", 16 * 2**20)
sysctl_atleast(None, "net.core.rmem_max", 16 * 2 ** 20)
sysctl_atleast(None, "net.core.wmem_max", 16 * 2 ** 20)

# Garbage Collection Settings for ARP and Neighbors
sysctl_atleast(None, "net.ipv4.neigh.default.gc_thresh2", 4 * 1024)
Expand Down Expand Up @@ -1426,6 +1426,7 @@ def __init__(self, name, *posargs, **params):
"snmpd": 0,
"mgmtd": 0,
"snmptrapd": 0,
"fpm_listener": 0,
}
self.daemons_options = {"zebra": ""}
self.reportCores = True
Expand Down Expand Up @@ -1896,7 +1897,11 @@ def do_gdb_or_rr(gdb):
)

rediropt = " > {0}.out 2> {0}.err".format(daemon)
if daemon == "snmpd":
if daemon == "fpm_listener":
binary = "/usr/lib/frr/fpm_listener"
cmdenv = ""
cmdopt = "-d {}".format(daemon_opts)
elif daemon == "snmpd":
binary = "/usr/sbin/snmpd"
cmdenv = ""
cmdopt = "{} -C -c /etc/frr/snmpd.conf -p ".format(
Expand Down Expand Up @@ -2162,7 +2167,11 @@ def emacs_gdb_ready():
"%s: %s %s started with rr", self, self.routertype, daemon
)
else:
if daemon != "snmpd" and daemon != "snmptrapd":
if (
daemon != "snmpd"
and daemon != "snmptrapd"
and daemon != "fpm_listener"
):
cmdopt += " -d "
cmdopt += rediropt

Expand Down Expand Up @@ -2212,6 +2221,11 @@ def emacs_gdb_ready():
while "snmpd" in daemons_list:
daemons_list.remove("snmpd")

if "fpm_listener" in daemons_list:
start_daemon("fpm_listener")
while "fpm_listener" in daemons_list:
daemons_list.remove("fpm_listener")

# Now start all the other daemons
for daemon in daemons_list:
if self.daemons[daemon] == 0:
Expand Down Expand Up @@ -2407,6 +2421,8 @@ def checkRouterRunning(self):
continue
if daemon == "snmptrapd":
continue
if daemon == "fpm_listener":
continue
if (self.daemons[daemon] == 1) and not (daemon in daemonsRunning):
sys.stderr.write("%s: Daemon %s not running\n" % (self.name, daemon))
if daemon == "staticd":
Expand Down

0 comments on commit 31c146a

Please sign in to comment.