Fix evexporter_iface RRD collision and add test case

This commit is contained in:
emanuele-f 2019-05-30 15:29:28 +02:00
parent 99aa386a12
commit c8da6bcf34
2 changed files with 37 additions and 3 deletions

View file

@ -108,6 +108,26 @@ local function schema_get_path(schema, tags)
suffix = tags.port .. "/"
elseif parts[2] == "ndpi_categories" then
suffix = "ndpi_categories/"
elseif #schema._tags >= 3 then
local intermediate_tags = {}
-- tag1:ifid
-- tag2:already handled as host_or_network
-- last tag must be handled separately
for i=3, #schema._tags-1 do
intermediate_tags[#intermediate_tags + 1] = tags[schema._tags[i]]
end
local last_tag = schema._tags[#schema._tags]
if(not WILDCARD_TAGS[last_tag]) then
intermediate_tags[#intermediate_tags + 1] = tags[last_tag]
end
if intermediate_tags[1] ~= nil then
-- All the intermediate tags should be mapped in the path
suffix = table.concat(intermediate_tags, "/") .. "/"
end
end
local path = getRRDName(ifid, host_or_network) .. suffix