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']
|
return css[1]['hostname']
|
||||||
end
|
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
|
-- Returns description of the node
|
||||||
-------------------------------------
|
-------------------------------------
|
||||||
|
|
|
@ -50,4 +50,12 @@ function api.getUciConfSectionOption(conf,sect,option)
|
||||||
return curs:get(conf,sect,option)
|
return curs:get(conf,sect,option)
|
||||||
end
|
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
|
return api
|
||||||
|
|
|
@ -289,6 +289,7 @@ function getTraceroute(target)
|
||||||
for i,v in pairs(lines) do
|
for i,v in pairs(lines) do
|
||||||
data = v:splitWhiteSpace()
|
data = v:splitWhiteSpace()
|
||||||
entry = {}
|
entry = {}
|
||||||
|
if data[2] ~= "*" then
|
||||||
node = data[2]:gsub("^mid[0-9]*%.","") -- strip midXX.
|
node = data[2]:gsub("^mid[0-9]*%.","") -- strip midXX.
|
||||||
node = node:gsub("^dtdlink%.","") -- strip dtdlink.
|
node = node:gsub("^dtdlink%.","") -- strip dtdlink.
|
||||||
node = node:gsub("%.local%.mesh$","") -- strip .local.mesh
|
node = node:gsub("%.local%.mesh$","") -- strip .local.mesh
|
||||||
|
@ -300,6 +301,7 @@ function getTraceroute(target)
|
||||||
priortime = round2(data[4])
|
priortime = round2(data[4])
|
||||||
table.insert(routes, entry)
|
table.insert(routes, entry)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
return routes
|
return routes
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ require("nixio")
|
||||||
local json = require("luci.jsonc")
|
local json = require("luci.jsonc")
|
||||||
require("iwinfo")
|
require("iwinfo")
|
||||||
|
|
||||||
local API_VERSION="1.2"
|
local API_VERSION="1.3"
|
||||||
|
|
||||||
-- Function extensions
|
-- Function extensions
|
||||||
os.capture = capture
|
os.capture = capture
|
||||||
|
@ -54,6 +54,7 @@ function getSysinfo()
|
||||||
local info={}
|
local info={}
|
||||||
info['api_version']=API_VERSION
|
info['api_version']=API_VERSION
|
||||||
info['node']=aredn_info.getNodeName()
|
info['node']=aredn_info.getNodeName()
|
||||||
|
info['tactical']=aredn_info.getTacticalName()
|
||||||
info['description']=aredn_info.getNodeDescription()
|
info['description']=aredn_info.getNodeDescription()
|
||||||
info['firmware_version']=aredn_info.getFirmwareVersion()
|
info['firmware_version']=aredn_info.getFirmwareVersion()
|
||||||
info['model']=aredn_info.getModel()
|
info['model']=aredn_info.getModel()
|
||||||
|
|
Loading…
Reference in New Issue