diff --git a/src/program/ipfix/tests/bench.snabb b/src/program/ipfix/tests/bench.snabb index 5b65552696..c6df5f6b80 100755 --- a/src/program/ipfix/tests/bench.snabb +++ b/src/program/ipfix/tests/bench.snabb @@ -19,18 +19,20 @@ local numa = require("lib.numa") local worker = require("core.worker") local lib = require("core.lib") -local function make_ipfix_config (template, pci0, cpus) +local function make_ipfix_config (pci0, opts) local rss_groups = 0 local cpu_conf = "" - for cpu in pairs(cpus) do + for cpu in pairs(opts.cpu) do rss_groups = rss_groups + 1 cpu_conf = cpu_conf..("cpu %d; "):format(cpu) end assert(rss_groups > 0, "Need at least one CPU core") - local config_template = lib.readfile(template, "*a") + local config_template = lib.readfile(opts.template, "*a") local tmpfile = os.tmpname() local f = assert(io.open(tmpfile, "w+")) - f:write(config_template:format(pci0, cpu_conf, rss_groups)) + f:write(config_template:format( + pci0, cpu_conf, opts.rss_groups or rss_groups + )) assert(f:close()) return tmpfile end @@ -83,6 +85,7 @@ end local long_opts = { template = "t", ["exporter-name"] = "e", + ["rss-groups"] = "r", cpu = "c", pcap = "p", duration = "D", @@ -112,6 +115,7 @@ local function parameters (args) template = "program/ipfix/tests/bench_v4_v6.conf.template", exporter_name = "e1", cpu = nil, + rss_groups = nil, pcap = "program/ipfix/tests/sanitized4k_truncated128.pcap", duration = 10, loadgen_cpu = nil, @@ -124,6 +128,9 @@ local function parameters (args) function handlers.e (arg) opts.exporter_name = arg end + function handlers.r (arg) + opts.rss_groups = assert(tonumber(arg), "rss-groups is not a number!") + end function handlers.c (arg) opts.cpu = numa.parse_cpuset(arg) end @@ -143,7 +150,7 @@ local function parameters (args) opts.flow_Hz = assert(tonumber(arg), "freq is not a number!") end - local args = lib.dogetopt(args, handlers, "t:e:c:p:D:l:q:f:", long_opts) + local args = lib.dogetopt(args, handlers, "t:e:r:c:p:D:l:q:f:", long_opts) if #args < 2 or not (opts.cpu and opts.loadgen_cpu) then show_usage(1) end local pci0 = table.remove(args, 1) local pci1 = table.remove(args, 1) @@ -152,7 +159,7 @@ end local pci0, pci1, opts = parameters(main.parameters) -local ipfix_confpath = make_ipfix_config(opts.template, pci0, opts.cpu) +local ipfix_confpath = make_ipfix_config(pci0, opts) local probe_pid = worker.start('ipfix_probe', ([[require("program.ipfix.probe.probe").run{ diff --git a/src/program/ipfix/tests/bench_v4_v6_interlink.conf.template b/src/program/ipfix/tests/bench_v4_v6_interlink.conf.template new file mode 100644 index 0000000000..5251f3ebc3 --- /dev/null +++ b/src/program/ipfix/tests/bench_v4_v6_interlink.conf.template @@ -0,0 +1,36 @@ +snabbflow-config { + interface { + device %q; + } + rss { + cpu-pool { %s } + hardware-scaling { rss-groups %d; } + software-scaling { + exporter { name e1; embed false; instances 2;} + } + } + flow-director { + default-class { exporter e1; } + remove-ipv6-extension-headers true; + } + ipfix { + idle-timeout 30; + active-timeout 600; + scan-time 10; + cache-size 8000000; + exporter-ip 10.0.0.1; + collector-pool { name c1; collector { ip 10.0.0.2; port 1234; } } + maps { + pfx4-to-as { file "program/ipfix/tests/maps/pfx4_to_as.csv"; } + pfx6-to-as { file "program/ipfix/tests/maps/pfx6_to_as.csv"; } + vlan-to-ifindex { file "program/ipfix/tests/maps/vlan_to_ifindex"; } + mac-to-as { file "program/ipfix/tests/maps/mac_to_as"; } + } + exporter { + name e1; + template "v4_extended"; + template "v6_extended"; + collector-pool c1; + } + } +} \ No newline at end of file