mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-30 16:09:32 +00:00
Added as utils moduls
This commit is contained in:
parent
719d4f993c
commit
6b9575ca3f
1 changed files with 40 additions and 0 deletions
40
scripts/lua/modules/as_utils.lua
Normal file
40
scripts/lua/modules/as_utils.lua
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
--
|
||||
-- (C) 2021 - ntop.org
|
||||
--
|
||||
local dirs = ntop.getDirs()
|
||||
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
|
||||
|
||||
require "ntop_utils"
|
||||
|
||||
local as_utils = {}
|
||||
|
||||
function as_utils.getAllConfigurations()
|
||||
local customer_asn_string =
|
||||
ntop.getCache("ntopng.prefs.config_customer_asn_list") or ""
|
||||
local sub_customer_asn_string = ntop.getCache(
|
||||
"ntopng.prefs.config_sub_customer_asn_list") or
|
||||
""
|
||||
local remote_asn_string = ntop.getCache("ntopng.prefs.config_remote_asn_list") or
|
||||
""
|
||||
|
||||
local customer_asn = {}
|
||||
local sub_customer_asn = {}
|
||||
local remote_asn = {}
|
||||
|
||||
local tmp = split(customer_asn_string, ",")
|
||||
for _, val in pairs(tmp or {}) do
|
||||
customer_asn[val] = 1
|
||||
end
|
||||
tmp = split(sub_customer_asn_string, ",")
|
||||
for _, val in pairs(tmp or {}) do
|
||||
sub_customer_asn[val] = 1
|
||||
end
|
||||
tmp = split(remote_asn_string, ",")
|
||||
for _, val in pairs(tmp or {}) do
|
||||
remote_asn[val] = 1
|
||||
end
|
||||
|
||||
return customer_asn, sub_customer_asn, remote_asn
|
||||
end
|
||||
|
||||
return as_utils
|
||||
Loading…
Add table
Add a link
Reference in a new issue