From 1464d61faf053fe0399a1ad401f7326afb76ed08 Mon Sep 17 00:00:00 2001 From: Tim Wilkinson Date: Wed, 16 Oct 2024 18:04:52 -0700 Subject: [PATCH] Add topology info to sysinfo.json (#1637) --- files/usr/lib/lua/aredn/olsr.lua | 5 +++++ files/www/cgi-bin/sysinfo.json | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/files/usr/lib/lua/aredn/olsr.lua b/files/usr/lib/lua/aredn/olsr.lua index f6aadb46..a3a8d825 100755 --- a/files/usr/lib/lua/aredn/olsr.lua +++ b/files/usr/lib/lua/aredn/olsr.lua @@ -73,6 +73,11 @@ function model.getOLSRMid() return mid and mid['mid'] or {} end +function model.getOLSRTopology() + local topology=fetch_json("http://127.0.0.1:9090/topology") + return topology and topology['topology'] or {} +end + function model.getOLSRInterfaceType(iface) local it="" if string.match(iface,"wlan") then diff --git a/files/www/cgi-bin/sysinfo.json b/files/www/cgi-bin/sysinfo.json index 47d4eebe..cee871ee 100755 --- a/files/www/cgi-bin/sysinfo.json +++ b/files/www/cgi-bin/sysinfo.json @@ -207,6 +207,11 @@ if string.find(nixio.getenv("QUERY_STRING"):lower(),"nodes=1") then info['nodes']=aredn.info.getOLSRInfo() end +-- TOPOLOGY +if string.find(nixio.getenv("QUERY_STRING"):lower(),"topology=1") then + info['topology']=aredn.olsr.getOLSRTopology() +end + -- Output the HTTP header for JSON print("Content-type: application/json\r") print("Cache-Control: no-store\r")