<%+header%> <% local uci = require("luci.model.uci").cursor() local net = require "luci.model.network".init() local ifaces = net:get_interfaces() local ports = {} ports["wan"] = {} ports["lan"] = {} ports["trunk"] = {} ports["tagged"] = {} function addVlan(type, vlan) for i,n in ipairs(ports[type]) do -- Don't add twice the same port if n == vlan then return end end table.insert(ports[type], vlan) end uci:foreach("network", "switch_vlan", function(s) -- Only show otbv2sw switch if s.device == "otbv2sw" then local type = "wan" if s.vlan == '1' then type = "trunk" elseif s.vlan == '2' then type = "lan" end for _, v in ipairs(string.split(s.ports, " ")) do local vlanType = type if string.find(v, "t") then -- Extract the port number ( "5t" -> 5 ) v = string.match(v,"(%d+)t") vlanType = "tagged" end addVlan(vlanType, v) end end end) %>

Configure your switch

This section helps you reset the switch ports to a new configuration by selecting the WAN and LAN ports.

If you need more control, <%:go to expert mode%>

<%+footer%>