[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.4

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

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