Annotation of trango/Net-Telnet-Trango/t/54-network-ap-su.t, Revision 1.1
1.1 ! andrew 1: #!perl -T
! 2: # $RedRiver: 50-network.t,v 1.5 2007/02/06 00:42:09 andrew Exp $
! 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: $t->input_log($type . '_input.log'); # XXX Debugging
! 49:
! 50: ok($t->open($host), "Opening connection to $host");
! 51:
! 52: ok($t->is_connected, "connected");
! 53:
! 54: like($t->login_banner, qr/^Welcome to Trango Broadband Wireless/,
! 55: "login banner");
! 56: like($t->firmware_version, qr/^[A-Z]+\s\d+p\d+r[A-Z0-9]+$/,
! 57: "firmware_version");
! 58: like($t->host_type, qr/^[A-Z0-9]+[- ][A-Z0-9]+$/, "host type");
! 59:
! 60: ok($t->login($pass), "Logging in");
! 61:
! 62: ok($t->logged_in, "logged in");
! 63:
! 64: if ( (! ok($t->pipe, "Getting pipe stats"))
! 65: && $t->last_error ) {
! 66: diag('ERR: ' . $t->last_error);
! 67: }
! 68:
! 69: if ( (! ok($t->maclist, "Getting maclist"))
! 70: && $t->last_error ) {
! 71: diag('ERR: ' . $t->last_error);
! 72: }
! 73:
! 74: if ( (! ok($t->maclist_reset, "Resetting maclist"))
! 75: && $t->last_error ) {
! 76: diag('ERR: ' . $t->last_error);
! 77: }
! 78:
! 79: if ( (! ok($t->enable_tftpd, "Enabling TFTPd"))
! 80: && $t->last_error ) {
! 81: diag('ERR: ' . $t->last_error);
! 82: }
! 83:
! 84: my $tftpd;
! 85: if ( (! ok($tftpd = $t->tftpd, "checking TFTPd"))
! 86: && $t->last_error ) {
! 87: diag('ERR: ' . $t->last_error);
! 88: }
! 89:
! 90: is($tftpd->{Tftpd}, 'listen', "TFTPd is listening");
! 91:
! 92: if ( (! ok($t->disable_tftpd, "Disabling TFTPd"))
! 93: && $t->last_error ) {
! 94: diag('ERR: ' . $t->last_error);
! 95: }
! 96:
! 97: if ( (! ok($tftpd = $t->tftpd, "checking TFTPd"))
! 98: && $t->last_error ) {
! 99: diag('ERR: ' . $t->last_error);
! 100: }
! 101:
! 102: is($tftpd->{Tftpd}, 'disabled', "TFTPd is disabled");
! 103:
! 104: # XXX for some reason this doesn't return Success.
! 105: # XXX at least not on the fox I am testing on.
! 106: #if ( (! ok($t->eth_link, "Getting eth link"))
! 107: # && $t->last_error ) {
! 108: # diag('ERR: ' . $t->last_error);
! 109: #}
! 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>