diff --git a/regress/lib/Perl5/Test/RegressTest.pm b/regress/lib/Perl5/Test/RegressTest.pm index b014bf7..5e9c932 100644 --- a/regress/lib/Perl5/Test/RegressTest.pm +++ b/regress/lib/Perl5/Test/RegressTest.pm @@ -66,6 +66,7 @@ my $portBase = 0; my $sendDelay; my $baseIdle; my $ignoreByteCount; +my $noSlicing; my $lessPorts; sub run_regress_test { @@ -96,6 +97,7 @@ sub run_regress_test { "send_delay=s" => \$sendDelay, "base_idle=s" => \$baseIdle, "ignore_byte_count" => \$ignoreByteCount, + "no_slicing" => \$noSlicing, "less_ports" => \$lessPorts ) and ( $help eq '' ) @@ -581,6 +583,10 @@ sub runTest { if ( defined($ignoreByteCount) ) { $args .= " --ignore_byte_count"; } + # Some platforms can not do Slicing - Jean II + if ( defined($noSlicing) ) { + $args .= " --no_slicing"; + } # Don't do all ports on some platforms, it's slow and useless... if ( defined($lessPorts) ) { diff --git a/regress/lib/Perl5/Test/TestLib.pm b/regress/lib/Perl5/Test/TestLib.pm index 0a01f10..deb7579 100644 --- a/regress/lib/Perl5/Test/TestLib.pm +++ b/regress/lib/Perl5/Test/TestLib.pm @@ -231,6 +231,7 @@ sub nftest_init { "ignore_byte_count", "num_ports=i", "common-st-args=s", + "no_slicing", "less_ports" ) ) diff --git a/regress/projects/black_box/regress/test_queue_config/run.pl b/regress/projects/black_box/regress/test_queue_config/run.pl index 259e1b7..e3f512e 100755 --- a/regress/projects/black_box/regress/test_queue_config/run.pl +++ b/regress/projects/black_box/regress/test_queue_config/run.pl @@ -8,41 +8,43 @@ sub my_test { my ( $sock, $options_ref ) = @_; - my $port_base = $$options_ref{'port_base'}; - my $num_ports = $$options_ref{'num_ports'}; + if ( not defined( $$options_ref{'no_slicing'} ) ) { + my $port_base = $$options_ref{'port_base'}; + my $num_ports = $$options_ref{'num_ports'}; - # for each port, + # for each port, - for (my $i = 1; $i <= $num_ports; $i++){ + for (my $i = 1; $i <= $num_ports; $i++){ - my $hdr_args = { - version => get_of_ver(), - type => $enums{'OFPT_QUEUE_GET_CONFIG_REQUEST'}, - length => $ofp->sizeof('ofp_queue_get_config_request'), # should generate automatically! - xid => 0x00000000 - }; + my $hdr_args = { + version => get_of_ver(), + type => $enums{'OFPT_QUEUE_GET_CONFIG_REQUEST'}, + length => $ofp->sizeof('ofp_queue_get_config_request'), # should generate automatically! + xid => 0x00000000 + }; - my @pad_2 = (0,0); - my $queue_request_args = { - header => $hdr_args, - port => $i, - pad => \@pad_2 - }; + my @pad_2 = (0,0); + my $queue_request_args = { + header => $hdr_args, + port => $i, + pad => \@pad_2 + }; - my $queue_request = $ofp->pack( 'ofp_queue_get_config_request', $queue_request_args ); + my $queue_request = $ofp->pack( 'ofp_queue_get_config_request', $queue_request_args ); - # Send 'stats_request' message - print $sock $queue_request; + # Send 'stats_request' message + print $sock $queue_request; - # Should add timeout here - will crash if no reply - my $recvd_mesg; - sysread( $sock, $recvd_mesg, 1512 ) || die "Failed to receive message: $!"; + # Should add timeout here - will crash if no reply + my $recvd_mesg; + sysread( $sock, $recvd_mesg, 1512 ) || die "Failed to receive message: $!"; - my $msg = $ofp->unpack( 'ofp_queue_get_config_reply', $recvd_mesg ); + my $msg = $ofp->unpack( 'ofp_queue_get_config_reply', $recvd_mesg ); - my $msg_size = length($recvd_mesg); - # Verify fields - verify_header( $msg, 'OFPT_QUEUE_GET_CONFIG_REPLY', $msg_size ); + my $msg_size = length($recvd_mesg); + # Verify fields + verify_header( $msg, 'OFPT_QUEUE_GET_CONFIG_REPLY', $msg_size ); + } } } diff --git a/regress/projects/black_box/regress/test_queue_forward/run.pl b/regress/projects/black_box/regress/test_queue_forward/run.pl index 27ec339..a3b0d73 100755 --- a/regress/projects/black_box/regress/test_queue_forward/run.pl +++ b/regress/projects/black_box/regress/test_queue_forward/run.pl @@ -11,7 +11,9 @@ sub forward_unicast_port { sub my_test { my ($sock, $options_ref) = @_; - for_all_port_pairs($ofp, $sock, $options_ref, \&forward_unicast_port, 0x0); + if ( not defined( $$options_ref{'no_slicing'} ) ) { + for_all_port_pairs($ofp, $sock, $options_ref, \&forward_unicast_port, 0x0); + } } run_black_box_test(\&my_test, \@ARGV); diff --git a/regress/projects/black_box/regress/test_queue_stats/run.pl b/regress/projects/black_box/regress/test_queue_stats/run.pl index f1c7c7a..0f49a32 100755 --- a/regress/projects/black_box/regress/test_queue_stats/run.pl +++ b/regress/projects/black_box/regress/test_queue_stats/run.pl @@ -8,106 +8,108 @@ sub my_test { my ( $sock, $options_ref ) = @_; - my $port_base = $$options_ref{'port_base'}; - my $num_ports = $$options_ref{'num_ports'}; + if ( not defined( $$options_ref{'no_slicing'} ) ) { + + my $port_base = $$options_ref{'port_base'}; + my $num_ports = $$options_ref{'num_ports'}; - # Prepare stats request - my $hdr_args = { - version => get_of_ver(), - type => $enums{'OFPT_STATS_REQUEST'}, - length => $ofp->sizeof('ofp_stats_request') + $ofp->sizeof('ofp_queue_stats_request'), # should generate automatically! - xid => 0x00000000 - }; + # Prepare stats request + my $hdr_args = { + version => get_of_ver(), + type => $enums{'OFPT_STATS_REQUEST'}, + length => $ofp->sizeof('ofp_stats_request') + $ofp->sizeof('ofp_queue_stats_request'), # should generate automatically! + xid => 0x00000000 + }; - my @pad_2 = (0,0); - my $body_args = { - port_no => $port_base, - pad => \@pad_2, - queue_id => 0xffffffff # TODO : export get_define to get OFPQ_ALL - }; + my @pad_2 = (0,0); + my $body_args = { + port_no => $port_base, + pad => \@pad_2, + queue_id => 0xffffffff # TODO : export get_define to get OFPQ_ALL + }; - my $stats_request_args = { - header => $hdr_args, - type => $enums{'OFPST_QUEUE'}, - flags => 0 - }; + my $stats_request_args = { + header => $hdr_args, + type => $enums{'OFPST_QUEUE'}, + flags => 0 + }; - my $request_body = $ofp->pack( 'ofp_queue_stats_request', $body_args ); - my $stats_request = $ofp->pack( 'ofp_stats_request', $stats_request_args ) . $request_body; + my $request_body = $ofp->pack( 'ofp_queue_stats_request', $body_args ); + my $stats_request = $ofp->pack( 'ofp_stats_request', $stats_request_args ) . $request_body; - # Prepare expected stats reply - my $reply_hdr_args = { - version => get_of_ver(), - type => $enums{'OFPT_STATS_REPLY'}, - length => $ofp->sizeof('ofp_stats_reply') + $ofp->sizeof('ofp_queue_stats'), # should generate automatically! - xid => 0x00000000 - }; + # Prepare expected stats reply + my $reply_hdr_args = { + version => get_of_ver(), + type => $enums{'OFPT_STATS_REPLY'}, + length => $ofp->sizeof('ofp_stats_reply') + $ofp->sizeof('ofp_queue_stats'), # should generate automatically! + xid => 0x00000000 + }; - my $stats_reply_args = { - header => $reply_hdr_args, - type => $enums{'OFPST_QUEUE'}, - flags => 0 - }; - - - my $reply_body_args = { - port_no => $port_base, - pad => \@pad_2, - queue_id => 1, - tx_bytes => 0, - tx_packets => 0, - tx_errors => 0 - }; + my $stats_reply_args = { + header => $reply_hdr_args, + type => $enums{'OFPST_QUEUE'}, + flags => 0 + }; - my $reply_body = $ofp->pack( 'ofp_queue_stats', $reply_body_args); - my $stats_reply = $ofp->pack( 'ofp_stats_reply', $stats_reply_args ) . $reply_body; - # Send 'stats_request' message - print $sock $stats_request; + my $reply_body_args = { + port_no => $port_base, + pad => \@pad_2, + queue_id => 1, + tx_bytes => 0, + tx_packets => 0, + tx_errors => 0 + }; - # Should add timeout here - will crash if no reply - my $recvd_mesg; - sysread( $sock, $recvd_mesg, 1512 ) || die "Failed to receive message: $!"; + my $reply_body = $ofp->pack( 'ofp_queue_stats', $reply_body_args); + my $stats_reply = $ofp->pack( 'ofp_stats_reply', $stats_reply_args ) . $reply_body; - # Inspect message - if ($recvd_mesg ne $stats_reply) { - die "ERROR: stats reply didn't match expected"; + # Send 'stats_request' message + print $sock $stats_request; + + # Should add timeout here - will crash if no reply + my $recvd_mesg; + sysread( $sock, $recvd_mesg, 1512 ) || die "Failed to receive message: $!"; + + # Inspect message + if ($recvd_mesg ne $stats_reply) { + die "ERROR: stats reply didn't match expected"; + } + + # Send a packet out + forward_simple($ofp, $sock, $options_ref, 1, 0, 0, 'enqueue'); + + # Wait the flow to expire + sleep 3; + + # Expect increased counters + $reply_body_args = { + port_no => $port_base, + pad => \@pad_2, + queue_id => 1, + tx_bytes => 64, + tx_packets => 1, + tx_errors => 0 + }; + + $reply_body = $ofp->pack( 'ofp_queue_stats', $reply_body_args); + $stats_reply = $ofp->pack( 'ofp_stats_reply', $stats_reply_args ) . $reply_body; + + + # Send 'stats_request' message + print $sock $stats_request; + + # Receive stats reply + sysread( $sock, $recvd_mesg, 1512 ) || die "Failed to receive message: $!"; + + # Inspect message + if ($recvd_mesg ne $stats_reply) { + die "ERROR: stats reply didn't match expected"; + } } - # Send a packet out - forward_simple($ofp, $sock, $options_ref, 1, 0, 0, 'enqueue'); - - # Wait the flow to expire - sleep 3; - - # Expect increased counters - $reply_body_args = { - port_no => $port_base, - pad => \@pad_2, - queue_id => 1, - tx_bytes => 64, - tx_packets => 1, - tx_errors => 0 - }; - - $reply_body = $ofp->pack( 'ofp_queue_stats', $reply_body_args); - $stats_reply = $ofp->pack( 'ofp_stats_reply', $stats_reply_args ) . $reply_body; - - - # Send 'stats_request' message - print $sock $stats_request; - - # Receive stats reply - sysread( $sock, $recvd_mesg, 1512 ) || die "Failed to receive message: $!"; - - # Inspect message - if ($recvd_mesg ne $stats_reply) { - die "ERROR: stats reply didn't match expected"; - } - - } run_black_box_test( \&my_test, \@ARGV ); diff --git a/regress/projects/black_box/regress/tests.txt b/regress/projects/black_box/regress/tests.txt index c30a68a..12aee82 100644 --- a/regress/projects/black_box/regress/tests.txt +++ b/regress/projects/black_box/regress/tests.txt @@ -65,13 +65,13 @@ test_forward_wildcard_arp_fool/run.pl test_cookie_flow_expired/run.pl test_cookie_flow_stats/run.pl -## Slicing Tests +## Slicing Tests - can be disable via --no_slicing test_queue_config/run.pl ## These assume that there is a queue with queue_id=1 at port 1. ## Uncomment if your setup supports this. ## Should work OK with the reference implementation -# test_queue_stats/run.pl -# test_queue_forward/run.pl +test_queue_stats/run.pl +test_queue_forward/run.pl ## Unusual Data test_ip_options/run.pl