[BACK]Return to 54-network-ap-su.t CVS log [TXT][DIR] Up to [local] / trango / Net-Telnet-Trango / t

Annotation of trango/Net-Telnet-Trango/t/54-network-ap-su.t, Revision 1.2

1.1       andrew      1: #!perl -T
1.2     ! andrew      2: # $RedRiver: 54-network-ap-su.t,v 1.1 2007/02/06 18:55:21 andrew Exp $
1.1       andrew      3:
                      4: use Test::More tests => 37;
                      5: use File::Spec;
                      6:
                      7: BEGIN {
                      8:        use_ok( 'Net::Telnet::Trango' );
                      9: }
                     10:
                     11: diag("Testing Net::Telnet::Trango $Net::Telnet::Trango::VERSION, Perl $], $^X");
                     12: diag("  Tests that run on both APs and SUs associated or not");
                     13:
                     14: my $cfg_file = File::Spec->catfile('t', 'tests.cfg');
                     15:
                     16: foreach my $type ('AP', 'SU') {
                     17:     SKIP: {
                     18:         my $skipped = 18;
                     19:         my %cfg;
                     20:         if (-e $cfg_file) {
                     21:             if (open my $fh, $cfg_file) {
                     22:                 while (<$fh>) {
                     23:                     chomp;
                     24:                     my ($key, $value) = split /\t/, $_, 2;
                     25:                     $cfg{$key} = $value;
                     26:                 }
                     27:                 close $fh;
                     28:             }
                     29:         }
                     30:
                     31:         my ($host, $pass);
                     32:
                     33:         if ($cfg{$type} && $cfg{$type} =~ /^(\d+\.\d+\.\d+.\d+)$/) {
                     34:             $host = $1;
                     35:         }
                     36:
                     37:         skip 'No valid ' . $type . ' in config file',        $skipped unless $host;
                     38:
                     39:         if ($cfg{$type . '_PASSWD'} && $cfg{$type . '_PASSWD'} =~ /^(.*)$/) {
                     40:             $pass = $1;
                     41:         }
                     42:
                     43:         skip 'No valid ' . $type . '_PASSWD in config file', $skipped unless $pass;
                     44:
                     45:         my $t;
                     46:         ok($t = Net::Telnet::Trango->new(), "Instantiating object");
                     47:
                     48:         ok($t->open($host), "Opening connection to $host");
                     49:
                     50:         ok($t->is_connected, "connected");
                     51:
                     52:         like($t->login_banner,     qr/^Welcome to Trango Broadband Wireless/,
                     53:             "login banner");
                     54:         like($t->firmware_version, qr/^[A-Z]+\s\d+p\d+r[A-Z0-9]+$/,
                     55:             "firmware_version");
                     56:         like($t->host_type,        qr/^[A-Z0-9]+[- ][A-Z0-9]+$/, "host type");
                     57:
                     58:         ok($t->login($pass), "Logging in");
                     59:
                     60:         ok($t->logged_in, "logged in");
                     61:
                     62:         if ( (! ok($t->pipe, "Getting pipe stats"))
                     63:             && $t->last_error ) {
                     64:             diag('ERR: ' . $t->last_error);
                     65:         }
                     66:
                     67:         if ( (! ok($t->maclist, "Getting maclist"))
                     68:             && $t->last_error ) {
                     69:             diag('ERR: ' . $t->last_error);
                     70:         }
                     71:
                     72:         if ( (! ok($t->maclist_reset, "Resetting maclist"))
                     73:             && $t->last_error ) {
                     74:             diag('ERR: ' . $t->last_error);
                     75:         }
                     76:
                     77:         if ( (! ok($t->enable_tftpd, "Enabling TFTPd"))
                     78:             && $t->last_error ) {
                     79:             diag('ERR: ' . $t->last_error);
                     80:         }
                     81:
                     82:         my $tftpd;
                     83:         if ( (! ok($tftpd = $t->tftpd, "checking TFTPd"))
                     84:             && $t->last_error ) {
                     85:             diag('ERR: ' . $t->last_error);
                     86:         }
                     87:
                     88:         is($tftpd->{Tftpd}, 'listen', "TFTPd is listening");
                     89:
                     90:         if ( (! ok($t->disable_tftpd, "Disabling TFTPd"))
                     91:             && $t->last_error ) {
                     92:             diag('ERR: ' . $t->last_error);
                     93:         }
                     94:
                     95:         if ( (! ok($tftpd = $t->tftpd, "checking TFTPd"))
                     96:             && $t->last_error ) {
                     97:             diag('ERR: ' . $t->last_error);
                     98:         }
                     99:
                    100:         is($tftpd->{Tftpd}, 'disabled', "TFTPd is disabled");
                    101:
                    102:         # XXX for some reason this doesn't return Success.
                    103:         # XXX at least not on the fox I am testing on.
                    104:         #if ( (! ok($t->eth_link, "Getting eth link"))
                    105:         #    && $t->last_error ) {
                    106:         #    diag('ERR: ' . $t->last_error);
                    107:         #}
                    108:
                    109:         ok($t->bye, "Goodbye");
                    110:     }
                    111: }
                    112: #        if ( (! ok($t->, ""))
                    113: #            && $t->last_error ) {
                    114: #            diag('ERR: ' . $t->last_error);
                    115: #        }
                    116:

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>