Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^4: Net::Telnet::Cisco and Terminal Server

by Anonymous Monk
on Mar 22, 2013 at 19:19 UTC ( #1024969=note: print w/ replies, xml ) Need Help??


in reply to Re^3: Net::Telnet::Cisco and Terminal Server
in thread Net::Telnet::Cisco and Terminal Server

Guys, I am facing same issue, I can get into Terminal Server but from there, I couldn't enter in line. "Clear line x" is not working for me. Command timing out on that spot. On line 3 I have linux box I want to access, maually it works please let me know if I need any correction in my script.

#!/usr/bin/perl use Net::Telnet::Cisco; my $session = Net::Telnet::Cisco->new(Host => '172.18.56.3'); $session->login('', 'aryaka'); # Execute a command my @output = $session->cmd('show line '); print @output; # Enable mode if ($session->enable("aryaka") ) { my @output1 = $session->cmd('show ver '); print @output1; my @command = $session->cmd('clear line 3 '); $session->prompt("/[Confirm]/"); $session->print("\n"); my @command = $session->cmd('device3'); #$session->always_waitfor_prompt; $session->print("\n"); $session->print("\n"); my @output3 = 'ifconfig' ; print "ifconfig: @output3\n"; } else { warn "Can't enable: " . $session->errmsg; } $session->close;
Output:
C:\Users\rpatel\Desktop\Perl>perl Login.pl "my" variable @command masks earlier declaration in same scope at Logi +n.pl line 24. Tty Typ Tx/Rx A Modem Roty AccO AccI Uses Noise Overru +ns Int 0 CTY - - - - - 0 0 0/0 + - 1 TTY 115200/115200- - - - - 17 34 461/1 +381 - 2 TTY 115200/115200- - - - - 8 57 402/1 +198 - 3 TTY 115200/115200- - - - - 25 31 141/4 +12 - 4 TTY 115200/115200- - - - - 14 14 17/5 +1 - 5 TTY 115200/115200- - - - - 7 0 0/0 + - * 6 TTY 115200/115200- - - - - 2 0 0/0 + - 7 TTY 115200/115200- - - - - 6 8 529/1 +613 - 8 TTY 9600/9600 - - - - - 5 1196 2744/1 +2 - 9 TTY 115200/115200- - - - - 9 14 24/6 +8 - 10 TTY 115200/115200- - - - - 5 5 592/1 +768 - 11 TTY 115200/115200- - - - - 5 0 0/0 + - 12 TTY 115200/115200- - - - - 0 2 8/2 +3 - * 13 TTY 9600/9600 - - - - - 4 33 8352/2 +5150 - 14 TTY 115200/115200- - - - - 5 1 44/1 +33 - 15 TTY 115200/115200- - - - - 2 0 0/0 + - 16 TTY 19200/19200 F - - - - 2 0 0/0 + - 17 AUX 9600/9600 - - - - - 0 0 0/0 + - * 18 VTY - - - - - 17 0 0/0 + - * 19 VTY - - - - - 132 0 0/0 + - * 20 VTY - - - - - 56 0 0/0 + - 21 VTY - - - - - 19 0 0/0 + - Tty Typ Tx/Rx A Modem Roty AccO AccI Uses Noise Overru +ns Int 22 VTY - - - - - 17 0 0/0 + - Cisco Internetwork Operating System Software IOS (tm) 2500 Software (C2500-I-L), Version 12.0(5)T, RELEASE SOFTWAR +E (fc1) Copyright (c) 1986-1999 by cisco Systems, Inc. Compiled Fri 23-Jul-99 03:14 by kpma Image text-base: 0x03039754, data-base: 0x00001000 ROM: System Bootstrap, Version 11.0(10c)XB1, PLATFORM SPECIFIC RELEASE + SOFTWARE (fc1) BOOTFLASH: 3000 Bootstrap Software (IGS-BOOT-R), Version 11.0(10c)XB1, + PLATFORM SPECIFIC RELEASE SOFTWARE (fc1) ANAP-stack-Term-Server uptime is 3 weeks, 2 days, 20 hours, 34 minutes System returned to ROM by power-on System image file is "flash:c2500-i-l.120-5.T" cisco AS2511-RJ (68030) processor (revision K) with 2048K/2048K bytes +of memory Processor board ID 21339790, with hardware revision 00000000 Bridging software. X.25 software, Version 3.0.0. 1 Ethernet/IEEE 802.3 interface(s) 1 Serial network interface(s) 16 terminal line(s) 32K bytes of non-volatile configuration memory. 8192K bytes of processor board System flash (Read ONLY) Configuration register is 0x2102 command timed-out at Login.pl line 20


Comment on Re^4: Net::Telnet::Cisco and Terminal Server
Select or Download Code
Replies are listed 'Best First'.
Re^5: Net::Telnet::Cisco and Terminal Server
by Anonymous Monk on Jul 15, 2014 at 14:48 UTC

    Had the same issue with time out waiting for confirm. Found this to work for me.

    $session->cmd("clear line $port\n"); #$session->prompt("/\[confirm\]/"); $session->print("\n"); $session->print("\n"); $session->prompt("/OK/");

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1024969]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (15)
As of 2015-07-29 14:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (263 votes), past polls