Skip to content

Commit

Permalink
snabb ipfix: remove class order leaf
Browse files Browse the repository at this point in the history
New lib.yang.lists supports ordered lists
  • Loading branch information
eugeneia committed Nov 17, 2022
1 parent 5bd3087 commit 1896a2c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 30 deletions.
9 changes: 1 addition & 8 deletions src/lib/yang/snabb-snabbflow-v1.yang
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ module snabb-snabbflow-v1 {

list class {
key exporter;
unique order;
description
"Traffic classes match packets making up the sets of flows
processed by indivdual exporters.
Expand All @@ -182,20 +181,14 @@ module snabb-snabbflow-v1 {
matches multiple classes, it is duplicated for each class and
thereby flows can be processed by multiple exporters.";

ordered-by user; // XXX not yet implemented, hence the 'order' leaf
ordered-by user;

leaf exporter {
type string-name;
description
"An exporter defined in /snabbflow-config/ipfix/exporter.
Packets matched by the class are processed by this exporter.";
}

leaf order {
type uint32 { range 1..max; }
description
"Match order of this class.";
}

leaf filter {
mandatory true;
Expand Down
1 change: 0 additions & 1 deletion src/program/ipfix/probe/example.conf
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ snabbflow-config {
flow-director {
class {
exporter e2;
order 1;
filter ip6;
}
default-class {
Expand Down
26 changes: 6 additions & 20 deletions src/program/ipfix/probe/probe.lua
Original file line number Diff line number Diff line change
Expand Up @@ -152,19 +152,6 @@ function setup_workers (config)
"Exporter for the default traffic class can not be the exporter for a defined class.")
end

local class_order = {}
for exporter in pairs(flow_director.class) do
table.insert(class_order, exporter)
end
table.sort(class_order, function (x, y)
return flow_director.class[x].order < flow_director.class[y].order
end)

local function class_name (exporter, class)
-- Including order in name to avoid name collision with 'default' class
return ("%s_%d"):format(exporter, class.order)
end

local rss_links = {}
local function rss_link_name (class)
if not rss_links[class] then
Expand Down Expand Up @@ -275,7 +262,7 @@ function setup_workers (config)
local rss_link
local class = flow_director.class[name]
if class then
rss_link = rss_link_name(class_name(name, class))
rss_link = rss_link_name('class_'..name)
elseif name == flow_director.default_class.exporter then
rss_link = rss_link_name('default')
else
Expand Down Expand Up @@ -336,14 +323,13 @@ function setup_workers (config)
classes = {},
remove_extension_headers = flow_director.remove_ipv6_extension_headers
}
for _, exporter in ipairs(class_order) do
local class = flow_director.class[exporter]
if not ipfix.exporter[exporter] then
error(("Exporter '%s' referenced in traffic class %d is not defined.")
:format(exporter, class.order))
for i, class in ipairs(flow_director.class) do
if not ipfix.exporter[class.exporter] then
error(("Exporter '%s' referenced in traffic class #%d is not defined.")
:format(class.exporter, i))
end
table.insert(rss_config.classes, {
name = class_name(exporter, class),
name = 'class_'..class.exporter,
filter = class.filter,
continue = class.continue
})
Expand Down
1 change: 0 additions & 1 deletion src/program/ipfix/tests/test_v4_v6_dnshttp.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ snabbflow-config {
flow-director {
class {
exporter dnshttp;
order 1;
filter "(ip or ip6) and ((udp port 53) or tcp dst port 80)";
continue true;
}
Expand Down

0 comments on commit 1896a2c

Please sign in to comment.