diff options
Diffstat (limited to 'quagga-model.lua')
-rw-r--r-- | quagga-model.lua | 69 |
1 files changed, 6 insertions, 63 deletions
diff --git a/quagga-model.lua b/quagga-model.lua index c9ef9d1..21ca098 100644 --- a/quagga-model.lua +++ b/quagga-model.lua @@ -9,27 +9,15 @@ require("validator") local configfile = "/etc/quagga/bgpd.conf" local processname = "bgpd" +local packagename = "quagga" local baseurl = "/etc/quagga/" local descr = { - Type = { - ['incomplete']="The protocol address is being resolved", - ['negative']="This protocol address is not available", - ['cached']="Protocol address was resolved successfully", - ['route']="This is a dynamic shortcut", - ['dynamic']="This entry is from a node that connected to us", - ['local']="Local interface address", - ['static']="Static mapping from configuration file (e.g. address of core)", - }, - Flags= { --- ['up']="Connection is fully usable", - ['lower-up']="ipsec connections is up, but registration is not yet done", - }, } local function get_version() local cmd_output_result, cmd_output_error - local cmd = "/sbin/apk_version -vs " .. processname .." 2>/dev/null" + local cmd = "/sbin/apk_version -vs " .. packagename .." 2>/dev/null" local f = io.popen( cmd ) local cmdresult = f:read("*l") if (cmdresult) and (#cmdresult > 0) then @@ -55,48 +43,6 @@ local function autostarts() return cmd_output_result,cmd_output_error end -local function opennhrpctl_show() - local cmd_output_result={} - local cmd_output_result_table={} - local cmd_output_error, opennhrpstatus - local cmd = "/usr/sbin/opennhrpctl show 2>/dev/null" - local f = io.popen( cmd ) - for line in f:lines() do - if string.find(line, "^Status:") then - opennhrpstatus=line - else - table.insert(cmd_output_result, line) - end - end - f:close() - local cnt = 0 - for k,v in pairs(cmd_output_result) do - if string.find(v,"^Interface") then - cnt = cnt + 1 - cmd_output_result_table[cnt] = {} - end - if ( cnt > 0 ) and (v ~= "") then - local k = string.match(v,"^(.-):%s?.*") - cmd_output_result_table[cnt][k]=cfe({value=string.match(v,"^.-:%s?(.*)")}) - local statusdescription = string.lower(string.match(v,"^.-:%s?(.*)")) - if (type(descr[k]) == "table") then - cmd_output_result_table[cnt][k]['descr']=descr[k][statusdescription] - end - end - end - - local peers_list = {} - for k,v in pairs(cmd_output_result_table) do - if (v.Interface.value) and not (peers_list[v.Interface.value]) then - peers_list[v.Interface.value] = {} - end - table.insert(peers_list[v.Interface.value], v) - end - - return peers_list,opennhrpstatus,cmd_output_error -end - - function process_status_text(procname) local t = procps.pidof(procname) if (t) and (#t > 0) then @@ -138,20 +84,16 @@ function getstatus() errtxt=autostart_errtxt, }) - local opennhrpctl_show, opennhrpctl_status = opennhrpctl_show() + -- THIS IS WHERE WE PRESENT THE OUTPUT FROM TELNET status.stats = cfe({ name="stats", label="Programstatus reports", - value=opennhrpctl_status, - }) - - status.show = cfe({ name="show", - label="Peers", - option=opennhrpctl_show, + value="xxx", }) return status end +--[[ function get_filedetails() local path = configfile local filedetails = fs.stat(path) @@ -185,3 +127,4 @@ function update_filecontent (self, modifications) local file_result,err = fs.write_file(path, format.dostounix(modifications)) return file_result end +--]] |