Last active
August 29, 2015 14:27
-
-
Save dpino/4b231e95d677ed446972 to your computer and use it in GitHub Desktop.
source_nic_sink_2.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Source -> NIC -> Sink | |
-- | |
-- Execute in "chur": | |
-- sudo ./snabb snsh source_nic_sink_2.lua | |
-- | |
-- link report: | |
-- 0 sent on nic1.tx -> sink.in1 (loss rate: 0%) | |
-- 4,319,072 sent on nic2.tx -> sink.in2 (loss rate: 0%) | |
-- 8,604,975 sent on repeater_ms.output -> nic1.rx (loss rate: 0%) | |
-- 1 sent on source_ms.out -> repeater_ms.input (loss rate: 0%) | |
local basic_apps = require("apps.basic.basic_apps") | |
local Intel82599 = require("apps.intel.intel_app").Intel82599 | |
local lib = require("core.lib") | |
function test () | |
local d1 = lib.hexundump ([[ | |
52:54:00:02:02:02 52:54:00:01:01:01 08 00 45 00 | |
00 54 c3 cd 40 00 40 01 f3 23 c0 a8 01 66 c0 a8 | |
01 01 08 00 57 ea 61 1a 00 06 5c ba 16 53 00 00 | |
00 00 04 15 09 00 00 00 00 00 10 11 12 13 14 15 | |
16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 | |
26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 | |
36 37 | |
]], 98) | |
engine.configure(config.new()) | |
local c = config.new() | |
config.app(c, 'source_ms', basic_apps.Join) | |
config.app(c, 'repeater_ms', basic_apps.Repeater) | |
config.app(c, 'sink', basic_apps.Sink) | |
config.app(c, 'nic1', Intel82599, { | |
pciaddr = '0000:05:00.0', | |
macaddr = '52:54:00:01:01:01', | |
}) | |
config.app(c, 'nic2', Intel82599, { | |
pciaddr = '0000:05:00.1', | |
macaddr = '52:54:00:02:02:02', | |
}) | |
config.link(c, 'source_ms.out -> repeater_ms.input') | |
config.link(c, 'repeater_ms.output -> nic1.rx') | |
config.link(c, 'nic1.tx -> sink.in1') | |
config.link(c, 'nic2.tx -> sink.in2') | |
engine.configure(c) | |
link.transmit(engine.app_table.source_ms.output.out, packet.from_string(d1)) | |
engine.main({duration=1, report={showlinks=true}}) | |
end | |
test() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment