]> git.sesse.net Git - nms/blobdiff - web/smanagement.pl
Move switch_connect() into nms module.
[nms] / web / smanagement.pl
index 57fa1fc7a880dc829419dfee2ba42b4b8762016b..b900f1ea53e140d0c45460c0f7dd5d7c41052866 100755 (executable)
@@ -1,18 +1,11 @@
 #!/usr/bin/perl
-use lib '../include';
-use nms;
-
-# Seconds to wait for connection
-my $timeout = 15;
-
-
 use warnings;
 use strict;
-use Switch;
 use CGI;
-use Net::Telnet;
 use DBI;
 use Data::Dumper;
+use lib '../include';
+use nms;
 
 # Grab from .htaccess-authentication
 my $user = $ENV{'REMOTE_USER'};
@@ -45,27 +38,6 @@ sub switch_exec($$) {
        return @lines;
 }
 
-sub switch_connect($) {
-       my ($ip) = @_;
-
-       my $conn = new Net::Telnet(     Timeout => $timeout,
-                                       Errmode => 'return',
-                                       Prompt => '/(es3024|e\d+\-\dsw)>/i');
-       my $ret = $conn->open(  Host => $ip);
-       if (!$ret || $ret != 1) {
-               return (0);
-       }
-       # XXX: Just send the password as text, I did not figure out how to
-       # handle authentication with only password through $conn->login().
-       #$conn->login(  Prompt => '/password[: ]*$/i',
-       #               Name => $password,
-       #               Password => $password);
-       $conn->cmd($nms::config::zyxel_password);
-       # Get rid of banner
-       $conn->get;
-       return ($conn);
-}
-
 sub parse_range($) {
        my $switches = $_;
        my @range;