Add topology info to sysinfo.json (#1637)

This commit is contained in:
Tim Wilkinson 2024-10-16 18:04:52 -07:00 committed by GitHub
parent a996461ef8
commit 1464d61faf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 0 deletions

View File

@ -73,6 +73,11 @@ function model.getOLSRMid()
return mid and mid['mid'] or {} return mid and mid['mid'] or {}
end 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) function model.getOLSRInterfaceType(iface)
local it="" local it=""
if string.match(iface,"wlan") then if string.match(iface,"wlan") then

View File

@ -207,6 +207,11 @@ if string.find(nixio.getenv("QUERY_STRING"):lower(),"nodes=1") then
info['nodes']=aredn.info.getOLSRInfo() info['nodes']=aredn.info.getOLSRInfo()
end 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 -- Output the HTTP header for JSON
print("Content-type: application/json\r") print("Content-type: application/json\r")
print("Cache-Control: no-store\r") print("Cache-Control: no-store\r")