mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 00:28:21 +00:00
a few small fixes to openflow
*rename module from Openflow to OpenFlow *add match_conn function to convert conn_id to openflow match *add a few things back into the openflow records like... table_id *and - a test
This commit is contained in:
parent
70f6635cb1
commit
46058d0b02
6 changed files with 120 additions and 19 deletions
32
testing/btest/scripts/base/frameworks/openflow/ryu-basic.bro
Normal file
32
testing/btest/scripts/base/frameworks/openflow/ryu-basic.bro
Normal file
|
@ -0,0 +1,32 @@
|
|||
# @TEST-EXEC: bro -r $TRACES/smtp.trace %INPUT
|
||||
# @TEST-EXEC: btest-diff .stdout
|
||||
|
||||
@load base/protocols/conn
|
||||
@load base/frameworks/openflow
|
||||
|
||||
global of_controller: OpenFlow::Controller;
|
||||
|
||||
event bro_init()
|
||||
{
|
||||
of_controller = OpenFlow::ryu_new(127.0.0.1, 8080, 42);
|
||||
of_controller$state$ryu_debug=T;
|
||||
|
||||
OpenFlow::flow_clear(of_controller);
|
||||
OpenFlow::flow_mod(of_controller, [], [$cookie=1, $command=OpenFlow::OFPFC_ADD, $out_ports=vector(3, 7)]);
|
||||
}
|
||||
|
||||
event connection_established(c: connection)
|
||||
{
|
||||
local match = OpenFlow::match_conn(c$id);
|
||||
local match_rev = OpenFlow::match_conn(c$id, T);
|
||||
|
||||
local flow_mod: OpenFlow::ofp_flow_mod = [
|
||||
$cookie=42,
|
||||
$command=OpenFlow::OFPFC_ADD,
|
||||
$idle_timeout=30,
|
||||
$priority=5
|
||||
];
|
||||
|
||||
OpenFlow::flow_mod(of_controller, match, flow_mod);
|
||||
OpenFlow::flow_mod(of_controller, match_rev, flow_mod);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue