http://www.apache.org/licenses/LICENSE-2.0
-$Id$
]]--
-m = Map("network", translate("Switch"), translate("The network ports on your router can be combined to several <abbr title=\"Virtual Local Area Network\">VLAN</abbr>s in which computers can communicate directly with each other. <abbr title=\"Virtual Local Area Network\">VLAN</abbr>s are often used to separate different network segments. Often there is by default one Uplink port for a connection to the next greater network like the internet and other ports for a local network."))
+m = Map("network", translate("Switch"), translate("The network ports on this device can be combined to several <abbr title=\"Virtual Local Area Network\">VLAN</abbr>s in which computers can communicate directly with each other. <abbr title=\"Virtual Local Area Network\">VLAN</abbr>s are often used to separate different network segments. Often there is by default one Uplink port for a connection to the next greater network like the internet and other ports for a local network."))
m.uci:foreach("network", "switch",
function(x)
s:option(Flag, has_vlan, translate("Enable VLAN functionality"))
end
- if enable_vlan4k then
- s:option(Flag, "enable_vlan4k", translate("Enable 4K VLANs"))
- end
-
if has_learn then
x = s:option(Flag, has_learn, translate("Enable learning and aging"))
x.default = x.enabled
end
end)
- m.uci:set("network", sid, "device", switch_name)
- m.uci:set("network", sid, "vlan", max_nr + 1)
+ m:set(sid, "device", switch_name)
+ m:set(sid, "vlan", max_nr + 1)
if has_vlan4k then
- m.uci:set("network", sid, has_vlan4k, max_id + 1)
+ m:set(sid, has_vlan4k, max_id + 1)
end
return sid
end
end
- m.uci:set("network", section, "ports", table.concat(p, " "))
+ if enable_vlan4k then
+ m:set(sid, "enable_vlan4k", "1")
+ end
+
+ m:set(section, "ports", table.concat(p, " "))
return Value.write(self, section, value)
end
-- Build per-port off/untagged/tagged choice lists.
local pt
- local off = 1
for pt = 0, num_ports - 1 do
local title
if pt == cpu_port then
- off = 0
title = translate("CPU")
else
- title = translatef("Port %d", pt + off)
+ title = translatef("Port %d", pt)
end
local po = s:option(ListValue, tostring(pt), title)
port_opts[#port_opts+1] = po
end
+
+
+ -- Switch status template
+ s = m:section(SimpleSection)
+ s.template = "admin_network/switch_status"
+ s.switch = switch_name
end
)