Developing lightweight computation at the DSG edge

Commit 92c74481 authored by p4u's avatar p4u
Browse files

Add ignore_devices in the network web interface section

Modify get_devices to return also the virtual switch interfaces and ignore the ones inside ignore_devices
parent 8c415244
......@@ -42,21 +42,44 @@ function qmpinfo.get_devices()
phydevs.wifi = {}
phydevs.all = {}
phydevs.eth = {}
local ignored = util.split(uci:get("qmp","interfaces","ignore_devices") or "")
uci:foreach('network','switch_vlan', function (s)
local name = uci:get("network",s[".name"],"device")
local vlan = uci:get("network",s[".name"],"vid")
if name ~= nil and vlan ~= nil then
table.insert(phydevs.eth,name..'.'..vlan)
table.insert(phydevs.all,name..'.'..vlan)
table.insert(ignored,name)
end
end)
local sysnet = "/sys/class/net/"
for d in nixio.fs.dir(sysnet) do
if nixio.fs.stat(sysnet..d..'/device',"type") ~= nil then
if string.find(d,"%.") == nil and string.find(d,"ap") == nil then
if nixio.fs.stat(sysnet..d..'/phy80211',"type") ~= nil then
table.insert(phydevs.wifi,d)
else
table.insert(phydevs.eth,d)
local ignore = false
local _,id
for _,id in ipairs(ignored) do
if id == d then
ignore = true
break
end
end
if not ignore then
if nixio.fs.stat(sysnet..d..'/phy80211',"type") ~= nil then
table.insert(phydevs.wifi,d)
else
table.insert(phydevs.eth,d)
end
table.insert(phydevs.all,d)
end
table.insert(phydevs.all,d)
end
end
end
return phydevs
end
......
......@@ -33,14 +33,15 @@ net_int = qmpinfo.get_devices().all
-- Option: lan_devices
lan = eth_section:option(MultiValue, "lan_devices", "LAN devices","These devices will be used for end-user connection (DHCP server)")
local i,l
for i,l in ipairs(net_int) do
lan:value(l,l)
end
-- Option wan_device
wan = eth_section:option(MultiValue, "wan_devices", "WAN devices","These devices will be used for internet or any other gateway connection (DHCP client)")
for i,w in ipairs(net_int) do
wan:value(w,w)
for i,l in ipairs(net_int) do
wan:value(l,l)
end
-- Option mesh_devices
......@@ -51,9 +52,11 @@ end
no_vlan = eth_section:option(Value, "no_vlan_devices", translate("No VLAN devices"),translate("Devices we want to use without VLAN tagging (not recommended)"))
ignore_devs = eth_section:option(Value, "ignore_devices", translate("Ignored devices"),translate("Devices are not taken into account for qMp autoconfiguration"))
function m.on_commit(self,map)
http.redirect("/luci-static/resources/qmp/wait_long.html")
luci.sys.call('qmpcontrol configure_network > /tmp/qmp_control_network.log &')
luci.sys.call('qmpcontrol configure_network > /tmp/qmp_control_network.log &')
end
......
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