Adds VLANs lua getters

This commit is contained in:
Simone Mainardi 2017-04-23 14:20:04 +02:00
parent 2873438712
commit c8c4505d9c
3 changed files with 147 additions and 0 deletions

View file

@ -0,0 +1,27 @@
--
-- (C) 2013-17 - ntop.org
--
dirs = ntop.getDirs()
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
require "lua_utils"
require "vlan_utils"
local json = require("dkjson")
sendHTTPHeader('text/html; charset=iso-8859-1')
-- sendHTTPHeader('application/json')
interface.select(ifname)
local vlan_id = tonumber(_GET["vlan"])
interface.select(ifname)
local vlan = interface.getVLANInfo(vlan_id)
local res = {}
if vlan ~= nil then
res = vlan2record(vlan)
end
print(json.encode(res, nil))