mirror of https://github.com/aredn/aredn.git
Api add tactical name (#139)
This commit is contained in:
parent
7908c3e2d4
commit
c179ce40b7
|
@ -89,6 +89,14 @@ function model.getNodeName()
|
|||
return css[1]['hostname']
|
||||
end
|
||||
|
||||
-------------------------------------
|
||||
-- Returns tactical name of the node
|
||||
-------------------------------------
|
||||
function model.getTacticalName()
|
||||
css=aredn_uci.getNonStandardUciConfType("/etc/local/uci/", "hsmmmesh", "settings")
|
||||
return css[1]['tactical']
|
||||
end
|
||||
|
||||
-------------------------------------
|
||||
-- Returns description of the node
|
||||
-------------------------------------
|
||||
|
|
|
@ -50,4 +50,12 @@ function api.getUciConfSectionOption(conf,sect,option)
|
|||
return curs:get(conf,sect,option)
|
||||
end
|
||||
|
||||
|
||||
function api.getNonStandardUciConfType(dir, conf,type)
|
||||
local curs=uci.cursor(dir)
|
||||
local ifce={}
|
||||
curs:foreach(conf,type,function(s) table.insert(ifce,s) end)
|
||||
return ifce
|
||||
end
|
||||
|
||||
return api
|
||||
|
|
|
@ -289,16 +289,18 @@ function getTraceroute(target)
|
|||
for i,v in pairs(lines) do
|
||||
data = v:splitWhiteSpace()
|
||||
entry = {}
|
||||
node = data[2]:gsub("^mid[0-9]*%.","") -- strip midXX.
|
||||
node = node:gsub("^dtdlink%.","") -- strip dtdlink.
|
||||
node = node:gsub("%.local%.mesh$","") -- strip .local.mesh
|
||||
entry['nodename'] = node
|
||||
ip = data[3]:match("%((.*)%)")
|
||||
entry['ip'] = ip
|
||||
entry['timeto'] = round2(data[4])
|
||||
entry['timedelta'] = math.abs(round2(data[4] - priortime))
|
||||
priortime = round2(data[4])
|
||||
table.insert(routes, entry)
|
||||
if data[2] ~= "*" then
|
||||
node = data[2]:gsub("^mid[0-9]*%.","") -- strip midXX.
|
||||
node = node:gsub("^dtdlink%.","") -- strip dtdlink.
|
||||
node = node:gsub("%.local%.mesh$","") -- strip .local.mesh
|
||||
entry['nodename'] = node
|
||||
ip = data[3]:match("%((.*)%)")
|
||||
entry['ip'] = ip
|
||||
entry['timeto'] = round2(data[4])
|
||||
entry['timedelta'] = math.abs(round2(data[4] - priortime))
|
||||
priortime = round2(data[4])
|
||||
table.insert(routes, entry)
|
||||
end
|
||||
end
|
||||
return routes
|
||||
end
|
||||
|
|
|
@ -44,7 +44,7 @@ require("nixio")
|
|||
local json = require("luci.jsonc")
|
||||
require("iwinfo")
|
||||
|
||||
local API_VERSION="1.2"
|
||||
local API_VERSION="1.3"
|
||||
|
||||
-- Function extensions
|
||||
os.capture = capture
|
||||
|
@ -54,6 +54,7 @@ function getSysinfo()
|
|||
local info={}
|
||||
info['api_version']=API_VERSION
|
||||
info['node']=aredn_info.getNodeName()
|
||||
info['tactical']=aredn_info.getTacticalName()
|
||||
info['description']=aredn_info.getNodeDescription()
|
||||
info['firmware_version']=aredn_info.getFirmwareVersion()
|
||||
info['model']=aredn_info.getModel()
|
||||
|
|
Loading…
Reference in New Issue