diff --git a/regress/lib/Perl5/OF/OFUtil.pm b/regress/lib/Perl5/OF/OFUtil.pm index 3bfcd9f..97a7272 100644 --- a/regress/lib/Perl5/OF/OFUtil.pm +++ b/regress/lib/Perl5/OF/OFUtil.pm @@ -454,7 +454,8 @@ sub run_learning_switch_test { # Assume fully qualified string : # tcp:: # Jean II - ($proto, $host, $port) = split(/:/,$options{'controller'}); + ($controller, $failover) = split(/,/,$options{'controller'}); + ($proto, $host, $port) = split(/:/,$controller); # Check for string missing the protocol - Jean II if ( ! defined ($port) ) { die "Invalid controller string $options{'controller'}" diff --git a/regress/projects/black_box/regress/test_failover_startup/run.pl b/regress/projects/black_box/regress/test_failover_startup/run.pl index 701951e..1849fe8 100755 --- a/regress/projects/black_box/regress/test_failover_startup/run.pl +++ b/regress/projects/black_box/regress/test_failover_startup/run.pl @@ -18,22 +18,30 @@ use strict; use OF::Includes; +use Getopt::Long; my $test="Failover test 1 (startup failover)"; -# If no controllers specified, use default -if (not @ARGV =~ "--controller") { - push( @ARGV, "--controller=" . nftest_default_controllers() ); -} +my $controllers; -# Replace --controller=foo,bar with --controller=bar so that -# 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"; - $ARGV[$i] = "--controller=$1"; - } +# Remove '--controller' from the option list... - Jean II +Getopt::Long::Configure( 'pass_through' ); +unless ( + GetOptions( + "controller=s" => \$controllers + ) ) +{ + # If no controllers specified, use default + $controllers = nftest_default_controllers(); } +Getopt::Long::Configure( 'default' ); + +# Get controller +my @controller_array = split(/,/, $controllers); +my $failover_controller = @controller_array[1]; + +# Push back a controller string +push( @ARGV, "--controller=$failover_controller" ); print "$test: Calling run_black_box_test with @ARGV\n";