Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
eugeneia committed Aug 25, 2022
1 parent b23fe45 commit 413cf19
Show file tree
Hide file tree
Showing 4 changed files with 197 additions and 167 deletions.
155 changes: 79 additions & 76 deletions src/lib/yang/snabb-snabbflow-v1.yang
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module snabb-snabbflow-v1 {
"Configuration for the Snabbflow IPFIX exporter.";

list interface {
key "device";
key device;

description
"Interaces serving as IPFIX Observation Points.";
Expand Down Expand Up @@ -101,7 +101,7 @@ module snabb-snabbflow-v1 {
one or more exporter instances in each RSS group.";

list exporter {
key "name";
key name;
description
"Sofware RSS configuration for the selected exporter.";

Expand Down Expand Up @@ -158,76 +158,86 @@ module snabb-snabbflow-v1 {
}
}
}
}

container flow-director {
container flow-director {
description
"Snabbflow supports distinct sets of flows being processed by
any number of exporters. Flows are matched into traffic classes
which are in turn processed by exporters.";

container default-class {
description
"Snabbflow supports distinct sets of flows being processed by
any number of exporters.
Each exporter selects a traffic class matching the set of flows
it should process. A traffic class can be processed by multple
exporters. The 'default' class matches all packets.";

leaf default-class {
type boolean;
default true;
description
"If this is set to false, packets not matching any other class
are dropped, and the catch-all traffic class 'default' does not
match any packets/flows.";
}
"The default class matches all flows not matched by
any other traffic class.";

list class {
key "name order";
leaf exporter {
type string-name;
description
"A traffic class matches packets making up a set of flows.
Classes are ordered and matched in sequence. Packets may match
multiple classes unless a previous match terminates matching of
the packet.";
"An exporter defined in /snabbflow-config/ipfix/exporter.
Flows matched by the default class are processed by this
exporter. If none is given, then flows matched by the
default class are dropped and not processed by any exporter.";
}
}

ordered-by user; // XXX not yet implemented, hence the 'order' leaf
list class {
key exporter;
unique order;
description
"Traffic classes match packets making up the sets of flows
processed by indivdual exporters.
Each class specifies a single exporter which processes the
matched flows, and exporters can only process a single
traffic class each.
Classes are ordered and matched in sequence. Packets may match
multiple classes via use of the 'continue' option. When a packet
matches multiple classes, it is duplicated for each class and
thereby flows can be processed by multiple exporters.";

leaf name {
type string-name;
description
"Identifier of the class. This is used to select the class in
/snabbflow-config/ipfix/exporter.";
}
ordered-by user; // XXX not yet implemented, hence the 'order' leaf

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

leaf filter {
mandatory true;
type string;
description
"pcap-filter(7) expression that specifies
packets matching this class.";
}
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 continue {
type boolean;
default false;
description
"If set to true, a packet matching this class can also match
further consecutive classes (in match order)
By default the matching of a packet to a class terminates
the matching process.";
}
leaf order {
type uint32 { range 1..max; }
description
"Match order of this class.";
}

leaf filter {
mandatory true;
type string;
description
"pcap-filter(7) expression that specifies
packets matching this class.";
}

leaf remove-ipv6-extension-headers {
leaf continue {
type boolean;
default true;
default false;
description
"IPv6 extention headers are stripped from packets unless this
is set to false.";
"If set to true, a packet matching this class can also match
further consecutive classes (in match order).
By default the matching of a packet to a class terminates
the matching process.";
}
}

leaf remove-ipv6-extension-headers {
type boolean;
default true;
description
"IPv6 extention headers are stripped from packets unless this
is set to false.";
}
}

container ipfix {
Expand Down Expand Up @@ -377,7 +387,7 @@ module snabb-snabbflow-v1 {
}

list collector-pool {
key "name";
key name;

description
"Named pools of collector endpoints. Exporter instances
Expand Down Expand Up @@ -422,9 +432,9 @@ module snabb-snabbflow-v1 {
}

list exporter {
key "name";
key name;
description
"Set of configured exporters. Each exporter receives flows
"Set of configured exporters. Each exporter receives packets
matching a single class defined in /snabbflow-config/rss/flow-director,
aggregates flows according to a set of templates, and
exports them to a specified /snabbflow-config/ipfix/collector-pool.";
Expand All @@ -436,13 +446,6 @@ module snabb-snabbflow-v1 {
/snabbflow-config/rss/software-scaling.";
}

leaf traffic-class {
type string-name;
default "default";
description
"A traffic class defined in /snabbflow-config/rss/flow-director.";
}

leaf-list template {
type string;
description
Expand All @@ -469,7 +472,7 @@ module snabb-snabbflow-v1 {
}

typedef numeric-id {
type uint32 { range "1..max"; }
type uint32 { range 1..max; }
description
"A numeric identifier.";
}
Expand All @@ -491,15 +494,15 @@ module snabb-snabbflow-v1 {
"Inspectable state for the Snabbflow IPFIX exporter.";

list interface {
key "device";
key device;
description
"Network device statistics";

uses interface-state;
}

list exporter {
key "name";
key name;
description
"Exporter statistics.";

Expand All @@ -512,7 +515,7 @@ module snabb-snabbflow-v1 {
uses exporter-state;

list template {
key "id";
key id;
description
"Template statistics.";

Expand All @@ -521,15 +524,15 @@ module snabb-snabbflow-v1 {
}

list rss-group {
key "pid";
key pid;
description
"Statistics for the RSS group workers defined in
/snabbflow-config/rss/hardware-scaling.";

uses worker-state;

list exporter {
key "name";
key name;
description
"Exporter statistics for this RSS group as per
/snabbflow-config/rss/software-scaling.";
Expand All @@ -541,7 +544,7 @@ module snabb-snabbflow-v1 {
}

list instance {
key "pid";
key pid;
description
"Statistics for exporter instance workers for this RSS group.";

Expand All @@ -550,7 +553,7 @@ module snabb-snabbflow-v1 {
uses exporter-instance-state;

list template {
key "id";
key id;
description
"Statistics for template instances.";

Expand Down
16 changes: 8 additions & 8 deletions src/program/ipfix/lib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,9 @@ function configure_graph (arg, in_graph)
end

local ipfix_config = mk_ipfix_config(config)
local ipfix_name = "ipfix"..config.instance
local out_name = "out"..config.instance
local sink_name = "sink"..config.instance
local ipfix_name = "ipfix_"..config.instance
local out_name = "out_"..config.instance
local sink_name = "sink_"..config.instance

local graph = in_graph or app_graph.new()
if config.input then
Expand All @@ -208,7 +208,7 @@ function configure_graph (arg, in_graph)
-- to a pcap writer or a routed tap interface
if (config.output_type ~= "pcap" and
config.output_type ~= "tap_routed") then
local arp_name = "arp"..config.instance
local arp_name = "arp_"..config.instance
local arp_config = { self_mac = config.exporter_mac and
ethernet:pton(config.exporter_mac),
self_ip = ipv4:pton(config.exporter_ip),
Expand Down Expand Up @@ -242,7 +242,7 @@ function configure_graph (arg, in_graph)
})
end
if config.output_type == "tap_routed" then
app_graph.app(graph, "tap_ifmib", iftable.MIB, {
app_graph.app(graph, "tap_ifmib_"..config.instance, iftable.MIB, {
target_app = out_name,
ifname = config.output,
ifalias = "IPFIX Observation Domain "..config.observation_domain,
Expand Down Expand Up @@ -336,7 +336,7 @@ function run (arg, duration, busywait, cpu, jit)
clear_jit_options(jit)

local t2 = now()
local stats = link.stats(engine.app_table['ipfix'..config.instance].input.input)
local stats = link.stats(engine.app_table['ipfix_'..config.instance].input.input)
print("IPFIX probe stats:")
local comma = lib.comma_value
print(string.format("bytes: %s packets: %s bps: %s Mpps: %s",
Expand Down Expand Up @@ -409,10 +409,10 @@ function configure_rss_graph (config, inputs, outputs, log_date)
-- link_name name of the link
-- args probe configuration
-- instance # of embedded instance
output.args.instance = output.instance
output.args.instance = output.instance or output.args.instance
local graph = configure_graph(output.args, graph)
app_graph.link(graph, "rss."..output.link_name
.." -> ipfix"..output.instance..".input")
.." -> ipfix_"..output.args.instance..".input")
end
end

Expand Down
Loading

0 comments on commit 413cf19

Please sign in to comment.