11 require "config.local.pm";
16 my $dbh = DBI->connect("dbi:Pg:" .
17 "dbname=" . $nms::config::db_name .
18 ";host=" . $nms::config::db_host,
19 $nms::config::db_username,
20 $nms::config::db_password)
21 or die "Couldn't connect to database";
25 sub switch_connect($) {
28 # Dump_Log => '/tmp/dumplog-queue',
29 my $conn = new Net::Telnet( Timeout => $nms::config::telnet_timeout,
31 Prompt => '/(es3024|e\d+\-\dsw)>/i');
32 my $ret = $conn->open( Host => $ip);
33 if (!$ret || $ret != 1) {
36 # XXX: Just send the password as text, I did not figure out how to
37 # handle authentication with only password through $conn->login().
38 #$conn->login(»·Prompt => '/password[: ]*$/i',
40 # Password => $password);
41 $conn->cmd($nms::config::zyxel_password);
47 # Send a command to switch and return the data recvied from the switch
49 my ($cmd, $conn) = @_;
51 # Send the command and get data from switch
52 my @data = $conn->cmd($cmd);
54 foreach my $line (@data) {
55 # Remove escape-7 sequence
56 $line =~ s/\x1b\x37//g;