#!/usr/bin/perl # test script for RAS::AS5200 ####################################################### print <); print <); print <); print <#]' will be used, which usually works just fine. EOF print "Prompt for AS5200: "; chomp($prompt= ); print <); print "Enable password for seek/kill tests: "; chomp($enablepassword = ); print "\n\n"; ###################################################### ### And now that we have our data, the actual tests use RAS::AS5200; ### Create a new instance print "### Testing new() method for host $pm\n\n"; $foo = new RAS::AS5200( hostname => $pm, password => $password, enablepassword => $enablepassword, login => $login, prompt => $prompt, ); die "ERROR: There was a problem creating the object.\n" unless $foo; print "OK.\n\n"; print "### Testing the printenv() method:\n"; $foo->printenv; print "\n\n"; print "### Testing the run_command() method:\n"; ($x,$y) = $foo->run_command('show modem','show users'); print "Output of \'show modems\' on $pm:\n@$x\n\n"; print "Output of \'show users\' on $pm:\n@$y\n\n"; print "### Testing portusage() method:\n"; @x = $foo->portusage; print "There are ", shift(@x), " modems in all.\n"; print "There are ", scalar(@x), " users online. "; print "They are:\n@x\n\n"; print "### Testing portusage() method:\n"; %x = $foo->userports; print "USERNAME \tPORTS\n"; foreach (keys(%x)) { print "$_", (' ' x (10 - length($_))), "\t", join("\t",@{$x{$_}}), "\n"; } if ($testuser) { print "### Testing usergrep() method on user $testuser\n"; @x = $foo->usergrep($testuser); print "Found user $testuser on $pm ports: @x\n\n" if @x; } else { print "### Skipping usergrep() test\n"; } if ($testuser) { print "### Testing userkill() method on user $testuser\n"; @x = $foo->userkill($testuser); print "Killed user $testuser on $pm ports: @x\n\n" if @x; } else { print "### Skipping userkill() test\n"; } print "Finished with tests.\n";