regress: run fwd broadcast exact port on all ports

Change submitted by: Jean Tourrilhes <jt@hpl.hp.com>
This commit is contained in:
Glen Gibb committed 2010-03-10 16:43:17 -08:00
1 parent d915e2b6e1
commit bc3d3a58f2
1 file changed
+24 -8
@@ -5,10 +5,13 @@ use strict;
use OF::Includes;
sub forward_broadcast {
my ($sock, $options_ref) = @_;
my $in_port = $$options_ref{'port_base'};
my $out_port = $in_port + 1;
my ( $ofp, $sock, $options_ref, $in_port_offset, $out_port_offset, $wildcards, $type, $nowait ) = @_;
my $in_port = $in_port_offset + $$options_ref{'port_base'};
my $out_port;
$out_port = $out_port_offset + $$options_ref{'port_base'};
my $len = $$options_ref{'pkt_len'};
my $pkt_args = {
@@ -23,9 +26,9 @@ sub forward_broadcast {
};
my $test_pkt = new NF2::UDP_pkt(%$pkt_args);
my $wildcards = 0x0000;
my $flags = $enums{'OFPFF_SEND_FLOW_REM'};
my $flow_mod_pkt;
my $flags = $enums{'OFPFF_SEND_FLOW_REM'};
$flow_mod_pkt = create_flow_mod_from_udp($ofp, $test_pkt, $in_port, $out_port, $$options_ref{'max_idle'}, $flags, $wildcards);
# Send 'flow_mod' message
@@ -35,14 +38,27 @@ sub forward_broadcast {
# Give OF switch time to process the flow mod
usleep($$options_ref{'send_delay'});
nftest_send("eth" . ($in_port), $test_pkt->packed);
nftest_send( "eth" . ($in_port_offset + 1), $test_pkt->packed );
# expect single packet
print "expect single packet\n";
nftest_expect("eth" . ($out_port), $test_pkt->packed);
nftest_expect( "eth" . ( $out_port_offset + 1 ), $test_pkt->packed );
print "wait \n";
wait_for_flow_expired_all( $ofp, $sock, $options_ref );
}
run_black_box_test(\&forward_broadcast, \@ARGV);
sub forward_port {
forward_broadcast(@_, 'port');
}
sub my_test {
my ( $sock, $options_ref ) = @_;
for_all_port_pairs( $ofp, $sock, $options_ref, \&forward_port, 0x0);
}
run_black_box_test( \&my_test, \@ARGV );