From 16764c702b1f548ab069a800e2a05cffcf637195 Mon Sep 17 00:00:00 2001 From: Blake Harnden <32446120+bharnden@users.noreply.github.com> Date: Mon, 30 Mar 2020 12:26:08 -0700 Subject: [PATCH] updated emane link monitor to not run when there is nothing to monitor, added better logging about what is being monitored --- daemon/core/emane/linkmonitor.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/daemon/core/emane/linkmonitor.py b/daemon/core/emane/linkmonitor.py index 7e9c191b..6d4daa8d 100644 --- a/daemon/core/emane/linkmonitor.py +++ b/daemon/core/emane/linkmonitor.py @@ -100,6 +100,7 @@ class EmaneClient: else: logging.warning("unknown emane link model: %s", emane_model) continue + logging.info("monitoring links nem(%s) model(%s)", nem_id, emane_model) loss_table.mac_id = mac_id self.nems[nem_id] = loss_table @@ -187,6 +188,9 @@ class EmaneLinkMonitor: self.link_interval = int(self.emane_manager.get_config("link_interval")) self.link_timeout = int(self.emane_manager.get_config("link_timeout")) self.initialize() + if not self.clients: + logging.info("no valid emane models to monitor links") + return self.scheduler = sched.scheduler() self.scheduler.enter(0, 0, self.check_links) self.running = True @@ -197,13 +201,13 @@ class EmaneLinkMonitor: addresses = self.get_addresses() for address in addresses: client = EmaneClient(address) - self.clients.append(client) + if client.nems: + self.clients.append(client) def get_addresses(self) -> List[str]: addresses = [] nodes = self.emane_manager.getnodes() for node in nodes: - logging.info("link monitor node: %s", node.name) for netif in node.netifs(): if isinstance(netif.net, CtrlNet): ip4 = None