regress: --no_slicing cmd line arg
Add the ability to disable all slicing tests via --no_slicing flag Change submitted by: Jean Tourrilhes <jt@hpl.hp.com>
This commit is contained in:
1 parent
b585b4c1aa
commit
84bd3acc54
6 files changed
+129
-116
No files matched your search
@@ -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) ) {
|
||||
|
||||
@@ -231,6 +231,7 @@ sub nftest_init {
|
||||
"ignore_byte_count",
|
||||
"num_ports=i",
|
||||
"common-st-args=s",
|
||||
"no_slicing",
|
||||
"less_ports"
|
||||
)
|
||||
)
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
@@ -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 );
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user