mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-05 19:15:03 +00:00
Added Other AS filter (#9665)
This commit is contained in:
parent
272879a3ca
commit
9455936df4
5 changed files with 47 additions and 17 deletions
|
|
@ -1,5 +1,5 @@
|
|||
--
|
||||
-- (C) 2021 - ntop.org
|
||||
-- (C) 2025 - ntop.org
|
||||
--
|
||||
local dirs = ntop.getDirs()
|
||||
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
|
||||
|
|
@ -48,6 +48,30 @@ function as_utils.getAllConfigurations()
|
|||
return customer_asn, sub_customer_asn, remote_asn
|
||||
end
|
||||
|
||||
-- The function filters from a table of ASNs those that are not customers, sub-customers, or remote
|
||||
function as_utils.getOtherASNs(as_info)
|
||||
local customer_asn, sub_customer_asn, remote_asn = as_utils.getAllConfigurations()
|
||||
local res = {}
|
||||
local costumer_sub = table.merge(customer_asn, sub_customer_asn)
|
||||
local total = table.merge(costumer_sub,remote_asn)
|
||||
if as_info ~= nil then
|
||||
for key, value in pairs(as_info) do
|
||||
if total then
|
||||
local value_total = total[tostring(value["asn"])]
|
||||
if not value_total then
|
||||
value_check = res[tostring(value["asn"])]
|
||||
if not value_check then
|
||||
res[tostring(value["asn"])] = 1
|
||||
else
|
||||
res[tostring(value["asn"])] = value_check + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return res
|
||||
end
|
||||
|
||||
function as_utils.getASNConfiguration(asn)
|
||||
local res = nil
|
||||
local customer_asn, sub_customer_asn, remote_asn = as_utils.getAllConfigurations()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue