-
My script successfully logs into my CAT devices but ends up hanging in wait for the prompt to return. This is due to the way logging is configured on the box. Upon successful login the following is returned:
device> 2009 Aug 13 17:57:16 %MGMT-6-LOGINPASS:User MyUser logged in from 10.68.86.68 via Telnet
(blinking cursor)
Should $session->send_wakeup('timeout'); solve this?...
2009-08-13 23:03:42 UTC by aarc51
-
I'm trying to ignore the message like
% IPv4 addresses from all interfaces in VRF 264 have been removed
% Applying VLAN changes may take few minutes. Please wait...
Basically any messages starting with %.
Then I found out these, but please tell me how to use these.
$boolean = $obj->ignore_warnings($boolean);
$boolean = $obj->warnings($matchop);
I used like this, but obviously...
2009-06-18 19:41:31 UTC by samky2005
-
Not sure if this will help, but I wrote a script that was heavily tested using N::T::C a few years ago, you can find it here:
http://www.gdd.net/index.php/Execute_commands_on_a_router/switch_using_Telnet_(Perl)
If you need something beyond that, I highly suggest checking out the commercial software package formerly known as Opsware Network Automation System, now known as HP Network...
2009-06-11 17:16:26 UTC by mfreeman451
-
I work for an ISP and we have a few hundred Cisco 24xx routers at customer locations. these routers are all running old code and I have been given the job of updating them all. Our technology department has decided that we need to use IOS 12.4(15)T4. I know that's not the most recent, but that's what they have tested and want to use for now at least. the problem is that most of these routers are...
2009-06-10 23:08:03 UTC by andrewgreenwood
-
I have done the following :
# exec the tcl script
my @int = $session->cmd("tclsh");
my @int2 = $session->cmd('proc trust_state {} {
set sisb [ exec "show ip int brief\n" ]
set intlist [regexp -all -nocase -line -inline {(^[A-Z]*[0-9]/*[0-9]*/*[0-9]*)} $sisb]
foreach int $intlist {
puts "Interface $int"
sh queueing int $int | i Trust|Port
}
}...
2009-05-20 12:19:34 UTC by ghost1235
-
I have done the following :
# exec the tcl script
my @int = $session->cmd("tclsh");
my @int2 = $session->cmd('proc trust_state {} {
set sisb [ exec "show ip int brief\n" ]
set intlist [regexp -all -nocase -line -inline {(^[A-Z]*[0-9]/*[0-9]*/*[0-9]*)} $sisb]
foreach int $intlist {
puts "Interface $int"
sh queueing int $int | i Trust|Port
}
}...
2009-05-20 11:01:07 UTC by ghost1235
-
Hi Michael and thanks for you answer but the TCL script is not stored on the router, would it be possible to include
it in the perl script ? Let me know, thanks !!
2009-05-17 18:47:37 UTC by ghost1235
-
Is the TCL script already stored on the router and you just need to execute it?
#!/usr/bin/perl
use strict;
use warnings;
use Net::Telnet::Cisco;
my @routers = `cat routerlist.txt`;
foreach my $router (@routers) {
chomp($router);
my $session = Net::Telnet::Cisco->new(Host => $router, Port =>"2046");
$session->login('','test');...
2009-05-15 17:43:40 UTC by mfreeman451
-
Hello,
I have a basic perl script that permits to telnet to a cisco router and retrieve whichever command output we enter in the script,
here it is :
#!/usr/bin/perl -w
use Net::Telnet::Cisco;
@routers = `cat routerlist.txt`;
foreach my $router (@routers) {
chomp($router);
my $session = Net::Telnet::Cisco->new(Host => $router, Port =>"2046");.
2009-05-15 14:36:49 UTC by ghost1235
-
Oops, here is the main way I use:
eval{
$session = Net::Telnet::Cisco->new( Host => $ip,
Input_log => "Input.log",
Output_log => "Output.log",
Dump_log => "Dump.log",
Timeout => 100
);
};
if ($@){ print $tee "Could not connect to ".$ip." \n"; next; };
#Login to...
2009-05-08 22:32:12 UTC by razmeth