mirror of https://github.com/aredn/aredn.git
Add topology info to sysinfo.json (#1637)
This commit is contained in:
parent
a996461ef8
commit
1464d61faf
|
@ -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
|
||||||
|
|
|
@ -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")
|
||||||
|
|
Loading…
Reference in New Issue