Failover: Minor changes to failover tests
Now setup scripts should accept a controller argument if desired. Add two failover tests to tests.txt, but third test (controller stops responding) is experimental for now.
This commit is contained in:
1 parent
aeed35b1da
commit
9575db4aae
12 files changed
+140
-69
No files matched your search
@@ -5,10 +5,11 @@ use Getopt::Long;
|
||||
use OF::OFUtil;
|
||||
use Test::TestLib;
|
||||
|
||||
my $mapFile;
|
||||
my $mapFile, $controller;
|
||||
|
||||
# Process command line options
|
||||
unless ( GetOptions( "map=s" => \$mapFile, ) ) {
|
||||
unless ( GetOptions( "map=s" => \$mapFile,
|
||||
"controller=s", \$controller) ) {
|
||||
print "unrecognized option\n";
|
||||
exit 1;
|
||||
}
|
||||
@@ -17,4 +18,4 @@ if ( defined($mapFile) ) {
|
||||
nftest_process_iface_map($mapFile);
|
||||
}
|
||||
|
||||
setup_kmod();
|
||||
setup_kmod($controller);
|
||||
@@ -5,10 +5,11 @@ use Getopt::Long;
|
||||
use OF::OFUtil;
|
||||
use Test::TestLib;
|
||||
|
||||
my $mapFile;
|
||||
my ($mapFile, $controller);
|
||||
|
||||
# Process command line options
|
||||
unless ( GetOptions( "map=s" => \$mapFile, ) ) {
|
||||
unless ( GetOptions( "map=s" => \$mapFile,
|
||||
"controller=s", \$controller) ) {
|
||||
print "unrecognized option\n";
|
||||
exit 1;
|
||||
}
|
||||
@@ -21,4 +22,4 @@ else {
|
||||
nftest_process_iface_map("$ENV{'OFT_ROOT'}/bin/veth.map");
|
||||
}
|
||||
|
||||
setup_kmod();
|
||||
setup_kmod($controller);
|
||||
@@ -6,13 +6,14 @@ use Data::Dumper;
|
||||
use OF::OFUtil;
|
||||
use Test::TestLib;
|
||||
|
||||
my $mapFile;
|
||||
my ($mapFile, $controller);
|
||||
|
||||
print "Calling of_nf2_setup.pl\n";
|
||||
print Dumper(@ARGV) . "\n";
|
||||
|
||||
# Process command line options
|
||||
unless ( GetOptions( "map=s" => \$mapFile, ) ) {
|
||||
unless ( GetOptions( "map=s" => \$mapFile,
|
||||
"controller=s", \$controller) ) {
|
||||
print "unrecognized option\n";
|
||||
exit 1;
|
||||
}
|
||||
@@ -21,4 +22,4 @@ if ( defined($mapFile) ) {
|
||||
nftest_process_iface_map($mapFile);
|
||||
}
|
||||
|
||||
setup_NF2();
|
||||
setup_NF2($controller);
|
||||
@@ -5,10 +5,11 @@ use Getopt::Long;
|
||||
use OF::OFUtil;
|
||||
use Test::TestLib;
|
||||
|
||||
my $mapFile;
|
||||
my ($mapFile, $controller);
|
||||
|
||||
# Process command line options
|
||||
unless ( GetOptions( "map=s" => \$mapFile, ) ) {
|
||||
unless ( GetOptions( "map=s" => \$mapFile,
|
||||
"controller=s", \$controller) ) {
|
||||
print "unrecognized option\n";
|
||||
exit 1;
|
||||
}
|
||||
@@ -17,4 +18,4 @@ if ( defined($mapFile) ) {
|
||||
nftest_process_iface_map($mapFile);
|
||||
}
|
||||
|
||||
setup_user();
|
||||
setup_user($controller);
|
||||
@@ -5,10 +5,11 @@ use Getopt::Long;
|
||||
use OF::OFUtil;
|
||||
use Test::TestLib;
|
||||
|
||||
my $mapFile;
|
||||
my ($mapFile, $controller);
|
||||
|
||||
# Process command line options
|
||||
unless ( GetOptions( "map=s" => \$mapFile, ) ) {
|
||||
unless ( GetOptions( "map=s" => \$mapFile,
|
||||
"controller=s", \$controller) ) {
|
||||
print "unrecognized option\n";
|
||||
exit 1;
|
||||
}
|
||||
@@ -21,4 +22,4 @@ else {
|
||||
nftest_process_iface_map("$ENV{'OFT_ROOT'}/bin/veth.map");
|
||||
}
|
||||
|
||||
setup_user();
|
||||
setup_user($controller);
|
||||
@@ -23,6 +23,6 @@ sub INT_Handler {
|
||||
}
|
||||
|
||||
my $of_port = get_of_port();
|
||||
push @ARGV, "--map=$ENV{'OFT_ROOT'}/bin/veth.map", "--root=$ENV{'OFT_ROOT'}", "--common-st-args=user_veth", "--controller=localhost:$of_port";
|
||||
push( @ARGV, "--map=$ENV{'OFT_ROOT'}/bin/veth.map", "--root=$ENV{'OFT_ROOT'}", "--common-st-args=user_veth");
|
||||
|
||||
run_regress_test( \&INT_Handler, @ARGV );
|
||||
@@ -160,6 +160,17 @@ sub setup_pcap_interfaces {
|
||||
}
|
||||
}
|
||||
|
||||
sub start_ofprotocol {
|
||||
|
||||
my ( $controller ) = @_;
|
||||
if ( !$controller) { $controller = nftest_default_controllers(); }
|
||||
|
||||
my $cmd = "${openflow_dir}/secchan/ofprotocol unix:/var/run/test $controller --inactivity-probe=999999 &";
|
||||
|
||||
print "about to run $cmd\n";
|
||||
system($cmd);
|
||||
}
|
||||
|
||||
sub setup_kmod {
|
||||
|
||||
setup_pcap_interfaces();
|
||||
@@ -190,7 +201,7 @@ sub setup_kmod {
|
||||
`${openflow_dir}/utilities/dpctl addif nl:0 $iface`;
|
||||
}
|
||||
|
||||
system("${openflow_dir}/secchan/ofprotocol --inactivity-probe=999999 nl:0 tcp:127.0.0.1 &");
|
||||
start_ofprotocol(@_);
|
||||
}
|
||||
|
||||
sub setup_NF2 {
|
||||
@@ -239,9 +250,10 @@ sub setup_NF2 {
|
||||
print "added interface\n";
|
||||
}
|
||||
|
||||
system("${openflow_dir}/secchan/ofprotocol --inactivity-probe=999999 nl:0 tcp:127.0.0.1 &");
|
||||
start_ofprotocol(@_);
|
||||
}
|
||||
|
||||
|
||||
sub setup_user {
|
||||
|
||||
setup_pcap_interfaces();
|
||||
@@ -252,11 +264,11 @@ sub setup_user {
|
||||
$if_string .= nftest_get_iface("eth$i") . ',';
|
||||
}
|
||||
$if_string .= nftest_get_iface("eth8");
|
||||
print "about to create ofdatapath punix:/var/run/test -i $if_string \& \
|
||||
n";
|
||||
system("${openflow_dir}/udatapath/ofdatapath punix:/var/run/test -i $if_string \&");
|
||||
print "about to create ofprotocol \& \n";
|
||||
system("${openflow_dir}/secchan/ofprotocol --inactivity-probe=999999 unix:/var/run/test tcp:127.0.0.1 &");
|
||||
|
||||
print "about to create ofdatapath` punix:/var/run/test -i $if_string \& \n";
|
||||
system("${openflow_dir}/udatapath/ofdatapath punix:/var/run/test -i $if_string \&");
|
||||
|
||||
start_ofprotocol(@_);
|
||||
}
|
||||
|
||||
sub teardown_kmod {
|
||||
@@ -355,7 +367,7 @@ sub compare {
|
||||
|
||||
sub create_controller_socket {
|
||||
my ($host, $port) = @_;
|
||||
print "about to make socket\n";
|
||||
print "about to make socket: tcp:$host:$port\n";
|
||||
my $sock = new IO::Socket::INET(
|
||||
LocalHost => $host,
|
||||
LocalPort => $port,
|
||||
@@ -611,26 +623,14 @@ sub set_config {
|
||||
syswrite( $sock, $set_config );
|
||||
}
|
||||
|
||||
|
||||
sub run_black_box_test {
|
||||
|
||||
my ( $test_ref, $argv_ref ) = @_;
|
||||
|
||||
my ( $test_ref, $argv_ref, $dont_exit ) = @_;
|
||||
|
||||
my %options = nftest_init( $argv_ref, \@interfaces, );
|
||||
|
||||
my $host = 'localhost';
|
||||
my $port = $of_port;
|
||||
# extract host and port from controller string if passed in
|
||||
if (defined $options{'controller'}) {
|
||||
# Assume fully qualified string : tcp:<controller>:<port>
|
||||
# Jean II
|
||||
($proto, $host, $port) = split(/:/,$options{'controller'});
|
||||
# Check for string missing the protocol - Jean II
|
||||
if ( ! defined ($port) ) {
|
||||
$proto = "tcp";
|
||||
($host, $port) = split(/:/,$options{'controller'});
|
||||
}
|
||||
}
|
||||
#!!!
|
||||
my ($proto, $host, $port) = nftest_parse_controllers( $options{'controller'} );
|
||||
print "using host $host and port $port\n";
|
||||
|
||||
$sock = create_controller_socket($host, $port);
|
||||
@@ -679,7 +679,7 @@ sub run_black_box_test {
|
||||
print "FAIL: $total_errors errors\n";
|
||||
$exitCode = 1;
|
||||
}
|
||||
exit($exitCode);
|
||||
if (!$dont_exit ) { exit($exitCode); }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -25,13 +25,15 @@ use Test::PacketLib;
|
||||
use threads;
|
||||
use threads::shared;
|
||||
use Net::RawIP;
|
||||
use Getopt::Long;
|
||||
use Getopt::Long qw(GetOptionsFromArray);
|
||||
|
||||
use vars qw(@ISA @EXPORT); # needed cos strict is on
|
||||
|
||||
@ISA = ('Exporter');
|
||||
@EXPORT = qw(
|
||||
&nftest_init
|
||||
&nftest_default_controllers
|
||||
&nftest_parse_controllers
|
||||
&nftest_start
|
||||
&nftest_restart
|
||||
&nftest_send
|
||||
@@ -156,6 +158,45 @@ my %vhostsARPdisable : shared;
|
||||
my %vhARPReqLog : shared;
|
||||
my %vhARPRepLog : shared;
|
||||
|
||||
|
||||
|
||||
###############################################################
|
||||
# Name: nftest_default_controllers
|
||||
#
|
||||
# Returns a string of two default controllers (to support
|
||||
# failover testing)
|
||||
###############################################################
|
||||
sub nftest_default_controllers { return "tcp:127.0.0.1:6633,tcp:127.0.0.1:6634"; }
|
||||
|
||||
###############################################################
|
||||
# Name: nftest_parse_controllers
|
||||
#
|
||||
# Parses a list of controllers for easy access
|
||||
#
|
||||
# Arguments: controllers controller parameter string
|
||||
#
|
||||
# Returns: list of ((proto,host,port)...)
|
||||
#
|
||||
###############################################################
|
||||
sub nftest_parse_controllers {
|
||||
# Parse a list of proto:host:port,proto:host:port...
|
||||
my @controllers = split(/,/, $_[0]);
|
||||
my @default_controllers = split(/,/, nftest_default_controllers());
|
||||
my ($proto, $host, $port) = split(/:/, $default_controllers[0]);
|
||||
my @results = ();
|
||||
foreach my $controller (@controllers) {
|
||||
my @params = split(/:/, $controller);
|
||||
# Accept "proto:host:port", "host:port", "host", or ""
|
||||
if (@params == 1) { $controller = "$proto:$controller:$port"; }
|
||||
if (@params == 2) { $controller = "$proto:$controller"; }
|
||||
if (@params < 1 || @params > 3) { die "bad controller specified: $controller\n"; }
|
||||
@params = split(/:/, $controller);
|
||||
# print "parse: adding $params[0], $params[1], $params[2]\n";
|
||||
push(@results, @params);
|
||||
}
|
||||
return @results;
|
||||
}
|
||||
|
||||
###############################################################
|
||||
# Name: nftest_init
|
||||
#
|
||||
@@ -178,8 +219,9 @@ sub nftest_init {
|
||||
$options{'base_idle'} = 2;
|
||||
|
||||
unless (
|
||||
GetOptions(
|
||||
\%options,
|
||||
GetOptionsFromArray(
|
||||
\@ARGV,
|
||||
\%options,
|
||||
"map=s",
|
||||
"controller=s",
|
||||
"port_base=i",
|
||||
@@ -202,8 +244,11 @@ sub nftest_init {
|
||||
|
||||
# next in line for generalizing the tests
|
||||
$options{'num_ports'} = 4;
|
||||
|
||||
if ( not defined ($options{'controller'})) { die "please define controller\n"};
|
||||
|
||||
if ( not defined ($options{'controller'})) {
|
||||
$options{'controller'} = nftest_default_controllers();
|
||||
print "Using default controller(s) $options{'controller'}\n";
|
||||
}
|
||||
|
||||
# Process the mappings if specified, else use defaults
|
||||
if ( defined( $options{'map'} ) ) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
# Simple Two-controller Failover test
|
||||
# Simple two-controller failover test
|
||||
#
|
||||
# For this test to work, the switch must be set up to use our
|
||||
# two "controllers", e.g.
|
||||
@@ -8,11 +8,14 @@
|
||||
# ofprotocol --controller=tcp:127.0.0.1:6633,tcp:127.0.0.1:6634
|
||||
#
|
||||
# If you use different ports than the defaults, then you must
|
||||
# pass the --controller option into this script as well
|
||||
#
|
||||
# pass the --controller option into this script as well.
|
||||
#
|
||||
# Failover test 2: Controller is fine, but closes connection
|
||||
#
|
||||
# For this test, we accept the Hello sequence and then close
|
||||
# the socket. Then we listen for a failover connection on the
|
||||
# second socket.
|
||||
#
|
||||
|
||||
use strict;
|
||||
use OF::Includes;
|
||||
@@ -20,14 +23,16 @@ use OF::Includes;
|
||||
# Save ARGV for future reference
|
||||
my @ARGS = @ARGV;
|
||||
|
||||
print "Failover Close() Test phase 1: calling run_black_box_test with @ARGV\n";
|
||||
my $test = "Failover test 2 (connection closed)";
|
||||
|
||||
print "$test phase 1: calling run_black_box_test with @ARGV\n";
|
||||
|
||||
# Start up, say Hello, and close connection
|
||||
sub close_failover_test_phase_1 {
|
||||
my ($sock) = @_;
|
||||
print "Close() Failover: got socket $sock\n";
|
||||
print "Startup Failover Close() Test: finished Hello sequence on first controller\n";
|
||||
print "Startup Failover Close() Test: closing socket\n";
|
||||
print "$test: Got socket $sock\n";
|
||||
print "$test: Finished Hello sequence on first controller\n";
|
||||
print "$test: Closing socket\n";
|
||||
$sock->close();
|
||||
}
|
||||
|
||||
@@ -55,9 +60,9 @@ for (my $i = 0; $i < @ARGV; $i++) {
|
||||
|
||||
|
||||
sub close_failover_test_phase_2 {
|
||||
print "Close() Failover: Failover to second controller succeeded\n";
|
||||
print "$test: Failover to second controller succeeded\n";
|
||||
}
|
||||
|
||||
print "Failover Close() Test phase 2: calling run_black_box_test with @ARGV\n";
|
||||
print "$test: Calling run_black_box_test with @ARGV\n";
|
||||
run_black_box_test( \&close_failover_test_phase_2, \@ARGV ); # do exit this time
|
||||
|
||||
@@ -2,20 +2,25 @@
|
||||
|
||||
# Simple two-controller failover test
|
||||
#
|
||||
# Failover Test #1: Startup Failover
|
||||
#
|
||||
# For this test to work, the switch must be set up to use our
|
||||
# two "controllers", e.g.
|
||||
#
|
||||
# ofprotocol --controller=tcp:127.0.0.1:6633,tcp:127.0.0.1:6634
|
||||
#
|
||||
# If you use different ports than the defaults, then you must
|
||||
# pass the --controller option into this script as well
|
||||
# pass the --controller option into this script as well.
|
||||
#
|
||||
# Failover Test 1: Startup Failover
|
||||
#
|
||||
# For this test, we listen on the second controller port rather
|
||||
# than the first.
|
||||
#
|
||||
|
||||
use strict;
|
||||
use OF::Includes;
|
||||
|
||||
my $test="Failover test 1 (startup failover)";
|
||||
|
||||
# If no controllers specified, use default
|
||||
if (not @ARGV =~ "--controller") {
|
||||
push( @ARGV, "--controller=" . nftest_default_controllers() );
|
||||
@@ -30,10 +35,10 @@ for (my $i = 0; $i < @ARGV; $i++) {
|
||||
}
|
||||
}
|
||||
|
||||
"Startup Failover Test: calling run_black_box_test with @ARGV\n";
|
||||
print "$test: Calling run_black_box_test with @ARGV\n";
|
||||
|
||||
sub startup_failover_test {
|
||||
print "Startup Failover Test: failed over successfully\n";
|
||||
print "$test: Failed over successfully\n";
|
||||
}
|
||||
|
||||
run_black_box_test( \&startup_failover_test, \@ARGV );
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
# Simple Two-controller Failover test
|
||||
# Simple two-controller failover test
|
||||
#
|
||||
# For this test to work, the switch must be set up to use our
|
||||
# two "controllers", e.g.
|
||||
@@ -8,10 +8,13 @@
|
||||
# ofprotocol --controller=tcp:127.0.0.1:6633,tcp:127.0.0.1:6634
|
||||
#
|
||||
# If you use different ports than the defaults, then you must
|
||||
# pass the --controller option into this script as well
|
||||
# pass the --controller option into this script as well.
|
||||
#
|
||||
# Failover test 3: Controller is fine, but stops responding
|
||||
#
|
||||
# For this test, we accept the Hello sequence on the first port
|
||||
# but then listen for a failover connection on the second port.
|
||||
#
|
||||
|
||||
use strict;
|
||||
use OF::Includes;
|
||||
@@ -19,15 +22,17 @@ use OF::Includes;
|
||||
# Save ARGV for future reference
|
||||
my @ARGS = @ARGV;
|
||||
|
||||
print "Failover Stop Responding Test phase 1: calling run_black_box_test with @ARGV\n";
|
||||
my $test="Failover test 3 (controller stops responding)";
|
||||
|
||||
print "$test phase 1: calling run_black_box_test with @ARGV\n";
|
||||
|
||||
# Start up, say Hello, and close connection
|
||||
sub stop_responding_test_phase_1 {
|
||||
my ($sock) = @_;
|
||||
print "Close() Failover: got socket $sock\n";
|
||||
print "Startup Failover Stop Responding Test: finished Hello sequence on first controller\n";
|
||||
print "Startup Failover Close() Test: not closing socket\n";
|
||||
print "Startup Failover Close() Test: invoking phase 2\n";
|
||||
print "$test: Got socket $sock\n";
|
||||
print "$test: Finished Hello sequence on first controller\n";
|
||||
print "$test: Not closing socket\n";
|
||||
print "$test: Invoking phase 2\n";
|
||||
stop_responding_phase_2();
|
||||
}
|
||||
|
||||
@@ -50,11 +55,11 @@ sub stop_responding_phase_2 {
|
||||
# run_black_box_test() will use bar's port rather than foo's
|
||||
for (my $i = 0; $i < @ARGV; $i++) {
|
||||
if ($ARGV[$i] =~ /controller=[^,]*,([^\s]+)/ ) {
|
||||
print "failover_startup: got controller $1\n";
|
||||
print "$test: got controller $1\n";
|
||||
$ARGV[$i] = "--controller=$1";
|
||||
}
|
||||
}
|
||||
|
||||
print "Failover Stop Responding Test phase 2: calling run_black_box_test with @ARGV\n";
|
||||
print "$test: Calling run_black_box_test with @ARGV\n";
|
||||
run_black_box_test( \&close_failover_test_phase_2, \@ARGV ); # do exit this time
|
||||
}
|
||||
@@ -47,6 +47,10 @@ test_ip_offset/run.pl
|
||||
test_tcp_options/run.pl
|
||||
##test_llc/run.pl
|
||||
|
||||
# Failover Tests
|
||||
test_failover_startup/run.pl
|
||||
test_failover_close/run.pl
|
||||
|
||||
# BELOW NOT INCLUDED IN CURRRENT RELEASE
|
||||
# WILL BE AVAILABLE SOON
|
||||
# Stress Tests / Performance Evaluation
|
||||
@@ -61,3 +65,5 @@ test_tcp_options/run.pl
|
||||
#test_forward_latency/run.pl
|
||||
#test_switch_bandwidth_random/run.pl
|
||||
#test_switch_bandwidth_random/run.pl
|
||||
# Additional Failover tests
|
||||
#test_failover_stop_responding/run.pl
|
||||
Reference in new issue
Block a user