Developing lightweight computation at the DSG edge

Commit d2b46e91 authored by p4u's avatar p4u
Browse files

Added new function: qmpinfo links

parent e24454e5
......@@ -101,6 +101,15 @@ function nodes()
end
end
function links()
for _,n in ipairs(qmpinfo.links()) do
if #n == 2 then
print(n[1].." "..n[2])
end
end
end
function key()
print(qmpinfo.get_key())
end
......@@ -129,6 +138,8 @@ elseif question == "nodes" then
nodes()
elseif question == "key" then
key()
elseif question == "links" then
links()
else
print_help()
end
......
......@@ -207,6 +207,21 @@ function qmpinfo.nodes()
return result
end
function qmpinfo.links()
local nodes = util.split(util.exec('bmx6 -c --links | awk \'{print $1 "|" $2}\' | grep -e ".*:.*:"'))
local ni
result = {}
for _,n in ipairs(nodes) do
if n ~= "" then
ni = util.split(n,"|")
ni[1] = util.split(ni[1],".")[1]
table.insert(result,ni)
end
end
return result
end
function qmpinfo.get_key()
local keyf = util.exec("uci get qmp.node.key")
if #keyf < 2 then
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment