チュートリアル&コードレビューで使う VM とセットアップ方法を説明します。
当日までに VM にログインできることを確認 しておいてください。
class FilteripTap < Controller | |
def start | |
load 'filtering-tap.conf' | |
end | |
def switch_ready dpid | |
$condition.each do | each | | |
each[ :in_port ] = $port_a | |
send_flow_mod_add( dpid, | |
:match => Match.new( each ), |
class PortNameMapper < Controller | |
periodic_timer_event :show_ports, 3 | |
def start | |
@pdb = {} | |
end | |
def switch_ready dpid | |
@pdb[ dpid ] = {} | |
send_message dpid, FeaturesRequest.new |
config 'ofswitch' | |
option 'dp' 'dp0' | |
option 'dpid' '000000000001' | |
option 'ofports' 'eth0.1 eth0.2 eth0.3 eth0.4' | |
option 'ofctl' 'tcp:192.168.1.249:6633' | |
option 'mode' 'outofband' |
#!/bin/sh | |
TREMA_HOME=/home/kazuya/proj/trema/ | |
gcc `$TREMA_HOME/trema-config --cflag` -c $1 | |
gcc ${1%.c}.o `$TREMA_HOME/trema-config --libs` -o ${1%.c} |
#include <stdio.h> | |
#include "trema.h" | |
static void | |
handle_switch_ready( uint64_t datapath_id, void *user_data ) | |
{ | |
UNUSED( user_data ); | |
struct ofp_match match; | |
memset( &match, 0, sizeof( match ) ); |
class MatchTest < Controller | |
def switch_ready datapath_id | |
match = Match.new( | |
:dl_type => 0x0800, | |
:nw_dst => "192.168.1.0/24" | |
) | |
send_flow_mod_add( | |
datapath_id, | |
:match => match |
class MatchTest < Controller | |
def switch_ready datapath_id | |
match = Match.new( | |
:nw_dst => "192.168.1.0/24" | |
) | |
send_flow_mod_add( | |
datapath_id, | |
:match => match | |
) |
vswitch { | |
datapath_id 0x1 | |
} | |
vhost ( "host1" ) | |
vhost ( "host2" ) | |
link "0x1", "host1" | |
link "0x1", "host2" |