version 1.2, 2007/02/06 16:23:17 |
version 1.5, 2007/02/06 17:40:02 |
|
|
#!perl -T |
#!perl -T |
# $RedRiver: 51-network-add_su.t,v 1.1 2007/02/06 00:42:33 andrew Exp $ |
# $RedRiver: 51-network-add_su-ap.t,v 1.4 2007/02/06 16:52:21 andrew Exp $ |
|
|
use Test::More tests => 17; |
use Test::More tests => 12; |
use File::Spec; |
use File::Spec; |
|
|
BEGIN { |
BEGIN { |
|
|
} |
} |
|
|
diag("Testing Net::Telnet::Trango $Net::Telnet::Trango::VERSION, Perl $], $^X"); |
diag("Testing Net::Telnet::Trango $Net::Telnet::Trango::VERSION, Perl $], $^X"); |
diag(" Generic tests"); |
diag(" AP tests when adding an SU to an AP"); |
|
|
my $cfg_file = File::Spec->catfile('t', 'tests.cfg'); |
my $cfg_file = File::Spec->catfile('t', 'tests.cfg'); |
my ($cir, $mir) = (128, 256); |
my ($cir, $mir) = (128, 256); |
|
|
SKIP: { |
SKIP: { |
my $skipped = 16; |
my $skipped = 11; |
my %cfg; |
my %cfg; |
if (-e $cfg_file) { |
if (-e $cfg_file) { |
if (open my $fh, $cfg_file) { |
if (open my $fh, $cfg_file) { |
|
|
my $t; |
my $t; |
ok($t = Net::Telnet::Trango->new(), "Instantiating object"); |
ok($t = Net::Telnet::Trango->new(), "Instantiating object"); |
|
|
$t->input_log('input.log'); # XXX Debugging |
|
|
|
ok($t->open($host), "Opening connection to $host"); |
ok($t->open($host), "Opening connection to $host"); |
|
|
ok($t->is_connected, "connected"); |
ok($t->is_connected, "connected"); |
|
|
|
|
ok($t->logged_in, "logged in"); |
ok($t->logged_in, "logged in"); |
|
|
|
|
my $sudb; |
my $sudb; |
if ((!ok($sudb = $t->sudb_view, "Getting sudb")) |
if ((!ok($sudb = $t->sudb_view, "Getting sudb")) |
&& $t->last_error ) { |
&& $t->last_error ) { |
|
|
} |
} |
|
|
|
|
my $result; |
if ( (! ok($t->sudb_add($su_id, 'reg', $cir, $mir, $su_mac), "Adding su")) |
if ( (! ok($result = $t->sudb_add($su_id, 'reg', $cir, $mir, $su_mac), |
|
"Adding su")) |
|
&& $t->last_error ) { |
&& $t->last_error ) { |
diag('ERR: ' . $t->last_error); |
diag('ERR: ' . $t->last_error); |
} |
} |
|
|
ok($result = $t->save_sudb, "Saving sudb"); |
if ( (! ok($t->save_sudb, "Saving sudb")) |
if ( (! $result ) && $t->last_error ) { |
&& $t->last_error ) { |
diag('ERR: ' . $t->last_error); |
diag('ERR: ' . $t->last_error); |
} |
} |
|
|
|
|
} |
} |
|
|
is($in_sudb, 1, "Correct SU is in SUDB"); |
is($in_sudb, 1, "Correct SU is in SUDB"); |
|
|
my $opmode; |
|
ok($opmode = $t->opmode, "getting current opmode"); |
|
|
|
if ($opmode->{Opmode} eq 'ap') { |
|
ok(1, "Already opmode ap"); |
|
} else { |
|
if ((! ok($result = $t->opmode('ap y'), "Setting opmode ap y")) |
|
&& $t->last_error ) { |
|
diag('ERR: ' . $t->last_error); |
|
} |
|
} |
|
|
|
$opmode = {}; |
|
ok($opmode = $t->opmode, "getting current opmode"); |
|
if (ref $opmode eq 'HASH' && $opmode->{ERR}) { |
|
diag("Error: $opmode->{ERR}"); |
|
} |
|
|
|
is($opmode->{Opmode}, 'ap', "Checking opmode is ap"); |
|
|
|
if (! ok($result = $t->save_ss, "Saving systemsetting") |
|
&& $t->last_error ) { |
|
diag('ERR: ' . $t->last_error); |
|
} |
|
|
|
ok($t->bye, "Goodbye"); |
ok($t->bye, "Goodbye"); |
} |
} |