diff --git a/mnet/driver.py b/mnet/driver.py index 51cd5e4..6c0fdb1 100644 --- a/mnet/driver.py +++ b/mnet/driver.py @@ -115,6 +115,16 @@ def root(request: Request): good, total = context.frrt.update_monitor_stats() routers = context.frrt.get_router_list() links = context.frrt.get_link_list() + link_stats = {} + link_stats["count"] = len(links) + up_count = 0 + for link in links: + up1, up2 = context.frrt.get_link_state(link[0], link[1]) + if up1 and up2: + up_count += 1 + + link_stats["up_count"] = up_count + src_stats = context.frrt.get_stat_samples() stats = [] for stat in src_stats: @@ -136,7 +146,7 @@ def root(request: Request): "current_time": current_time, "run_time": run_time, "routers": routers, - "links": links, + "link_stats": link_stats, "events": events, "stats": stats, "ping_stats": ping_stats, diff --git a/mnet/frr_topo.py b/mnet/frr_topo.py index d247293..bef4ccd 100644 --- a/mnet/frr_topo.py +++ b/mnet/frr_topo.py @@ -574,9 +574,11 @@ def get_router(self, name: str): for neighbor in self.graph.adj[name].keys(): edge = self.graph.adj[name][neighbor] result["neighbors"][neighbor] = { - "ip": edge["ip"][neighbor], + "ip_local": edge["ip"][name], + "ip_remote": edge["ip"][neighbor], "up": self.get_link_state(name, neighbor), - "intf": edge["intf"][neighbor], + "intf_local": edge["intf"][name], + "intf_remote": edge["intf"][neighbor], } return result diff --git a/mnet/templates/main.html b/mnet/templates/main.html index e471eaa..46b6611 100644 --- a/mnet/templates/main.html +++ b/mnet/templates/main.html @@ -92,6 +92,23 @@