tests: Add ability to run a fpm listener

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>
This commit is contained in:
Donald Sharp 2024-02-14 12:41:49 -05:00
parent a0c4fe2ca6
commit 841d50e82f
2 changed files with 33 additions and 9 deletions

View File

@ -748,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",
@ -771,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):
@ -847,7 +849,8 @@ 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_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
@ -885,7 +888,12 @@ class TopoRouter(TopoGear):
# 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(
[
@ -935,7 +943,7 @@ class TopoRouter(TopoGear):
# 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(
[

View File

@ -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)
@ -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)
@ -1426,6 +1426,7 @@ class Router(Node):
"snmpd": 0,
"mgmtd": 0,
"snmptrapd": 0,
"fpm_listener": 0,
}
self.daemons_options = {"zebra": ""}
self.reportCores = True
@ -1896,7 +1897,11 @@ class Router(Node):
)
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(
@ -2162,7 +2167,11 @@ class Router(Node):
"%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
@ -2212,6 +2221,11 @@ class Router(Node):
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:
@ -2407,6 +2421,8 @@ class Router(Node):
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":