[Dev] question about AutoLogin.pm for CatOS adaptor

Ryan Kruse rkruse at alterpoint.com
Fri Mar 7 17:10:49 CST 2008


Thanks for submitting this back PingShan!  We definitely appreciate the contribution.

We originally took the ">" out of that regular expression because we had some users who had a prompt that didn't contain the ">".  But I see for you it was breaking things without it.  I will find a happy medium and check it in for the upcoming release.

Thanks again!
Ryan

________________________________
From: dev-bounces at ziptie.org [mailto:dev-bounces at ziptie.org] On Behalf Of PingShan Li
Sent: Friday, March 07, 2008 4:00 PM
To: dev at ziptie.org
Subject: [Dev] question about AutoLogin.pm for CatOS adaptor

We have a CatOS device in house. We tried to use the most current AutoLogin.pm for CatOS, but we got problem with that perl script.
http://cvs.ziptie.org/cgi-bin/viewvc.cgi/ziptie.adapters.cisco.catos/scripts/ZipTie/Adapters/Cisco/CatOS/AutoLogin.pm?view=log

We changed the perl script a little bit to make it work, please review the AutoLogin.pm in the attachment and let us know your opinion on the change.

Thanks

PingShan Li



Here is the debug output we got before we made the change, the prompt for the CatOS is "FNKC1234>".

2008-03-07 12:51:20 [ZipTie::Typer] commandList => ZipTie::CliCommands::from_xml
2008-03-07 12:51:20 [ZipTie::Typer] restoreFileInfo => ZipTie::RestoreFile::from_xml
2008-03-07 12:51:20 [ZipTie::Typer] fileServers => ZipTie::ConnectionPath::FileServer::from_xml
2008-03-07 12:51:20 [ZipTie::Typer] protocols => ZipTie::ConnectionPath::Protocol::from_xml
2008-03-07 12:51:20 [ZipTie::Typer] credentials => ZipTie::Credentials::from_xml
2008-03-07 12:51:20 [ZipTie::Typer] connectionPath => ZipTie::ConnectionPath::from_xml
2008-03-07 12:51:20 [ZipTie::CLIProtocolFactory] Using 'ZipTie::Telnet' as the implementation of the specified CLI protocol "Telnet".
2008-03-07 12:51:20 [ZipTie::Adapters::Cisco::CatOS::AutoLogin] Protocol in use: Telnet
2008-03-07 12:51:20 [ZipTie::Adapters::Cisco::CatOS::AutoLogin] Credentials in use: rwCommunityString => '', roCommunityString => '', enableUsername => '', password => 'abc123', enablePassword => '', username => 'testUser',
2008-03-07 12:51:20 [ZipTie::Telnet] About to connect to 192.168.7.3<http://192.168.7.3> over port 23 ...
2008-03-07 12:51:20 [ZipTie::Telnet] Connected successfully to 192.168.7.3<http://192.168.7.3> over port 23.
2008-03-07 12:51:20 [ZipTie::Adapters::Cisco::CatOS::AutoLogin] Verifying the initial connection ...
2008-03-07 12:51:20 [ZipTie::Telnet] -----------------------------------------------------------------------------
2008-03-07 12:51:20 [ZipTie::Telnet] [WAITING 30 SECOND(S) FOR]
2008-03-07 12:51:20 [ZipTie::Telnet] /(sername:|ogin:)|([Pp]assword:)|((?:\(enable\)\s*|\#\s*)$)|(\n\S+\s*$)/
2008-03-07 12:51:20 [ZipTie::Telnet] -----------------------------------------------------------------------------
2008-03-07 12:51:20 [ZipTie::Telnet] -----------------------------------------------------------------------------
2008-03-07 12:51:20 [ZipTie::Telnet] [RESPONSE]
2008-03-07 12:51:20 [ZipTie::Telnet]
2008-03-07 12:51:20 [ZipTie::Telnet]
2008-03-07 12:51:20 [ZipTie::Telnet] Cisco Systems Console
2008-03-07 12:51:20 [ZipTie::Telnet]
2008-03-07 12:51:20 [ZipTie::Telnet]
2008-03-07 12:51:20 [ZipTie::Telnet]
2008-03-07 12:51:20 [ZipTie::CLIProtocol] Matching 'sername:|ogin:' in ' Cisco Systems Console
2008-03-07 12:51:21 [ZipTie::Telnet] [RESPONSE]
2008-03-07 12:51:21 [ZipTie::Telnet]
2008-03-07 12:51:21 [ZipTie::Telnet] F
2008-03-07 12:51:21 [ZipTie::Telnet] -----------------------------------------------------------------------------
2008-03-07 12:51:21 [ZipTie::CLIProtocol] Matching 'sername:|ogin:|authentication failed' in ' F'
2008-03-07 12:51:21 [ZipTie::CLIProtocol]
2008-03-07 12:51:21 [ZipTie::CLIProtocol] Matching 'incorrect|invalid|[Pp]assword:' in ' F'
2008-03-07 12:51:21 [ZipTie::CLIProtocol]
2008-03-07 12:51:21 [ZipTie::CLIProtocol] Matching '\(enable\)\s*$' in ' F'
2008-03-07 12:51:21 [ZipTie::CLIProtocol]
2008-03-07 12:51:21 [ZipTie::CLIProtocol] Matching '\n\S+\s*$' in ' F'
2008-03-07 12:51:21 [ZipTie::CLIProtocol]
2008-03-07 12:51:21 [ZipTie::CLIProtocol] Matched '\n\S+\s*$'
2008-03-07 12:51:21 [ZipTie::CLIProtocol]
2008-03-07 12:51:21 [ZipTie::Adapters::Cisco::CatOS::AutoLogin] ---------------------------------------------------------
2008-03-07 12:51:21 [ZipTie::Adapters::Cisco::CatOS::AutoLogin] [LAST MATCH CAPTURED]
2008-03-07 12:51:21 [ZipTie::Adapters::Cisco::CatOS::AutoLogin]
2008-03-07 12:51:21 [ZipTie::Adapters::Cisco::CatOS::AutoLogin] F
2008-03-07 12:51:21 [ZipTie::Adapters::Cisco::CatOS::AutoLogin] ---------------------------------------------------------
2008-03-07 12:51:21 [ZipTie::Adapters::Cisco::CatOS::AutoLogin] [REGULAR EXPRESSION TO MATCH DEVICE PROMPT]
2008-03-07 12:51:21 [ZipTie::Adapters::Cisco::CatOS::AutoLogin] F\s*$
2008-03-07 12:51:21 [ZipTie::Adapters::Cisco::CatOS::AutoLogin] ---------------------------------------------------------
2008-03-07 12:51:21 [ZipTie::Adapters::Cisco::CatOS::AutoLogin] Login has successfully completed!
2008-03-07 12:51:21 [ZipTie::Adapters::Cisco::CatOS::AutoLogin]
2008-03-07 12:51:21 [ZipTie::Adapters::Utils] Logging adapter output to STDOUT
2008-03-07 12:51:21 [ZipTie::Telnet] -----------------------------------------------------------------------------
2008-03-07 12:51:21 [ZipTie::Telnet] [SENDING]
2008-03-07 12:51:21 [ZipTie::Telnet] set length 0
2008-03-07 12:51:21 [ZipTie::Telnet] -----------------------------------------------------------------------------
2008-03-07 12:51:21 [ZipTie::Telnet] -----------------------------------------------------------------------------
2008-03-07 12:51:21 [ZipTie::Telnet] [WAITING 30 SECOND(S) FOR]
2008-03-07 12:51:21 [ZipTie::Telnet] /F\s*$/
2008-03-07 12:51:21 [ZipTie::Telnet] -----------------------------------------------------------------------------
2008-03-07 12:51:52 [ZipTie::Telnet] [UNEXPECTED_RESPONSE]
2008-03-07 12:51:52 [ZipTie::Telnet] '192.168.7.3<http://192.168.7.3>' timed-out while waiting to match the regular expression '/F\s*$/'.
2008-03-07 12:51:52 [ZipTie::Telnet] [INPUT]
2008-03-07 12:51:52 [ZipTie::Telnet] set length 0
2008-03-07 12:51:52 [ZipTie::Telnet] [ACTUAL RESPONSE]
2008-03-07 12:51:52 [ZipTie::Telnet] NKC1234> (enable) set length 0
2008-03-07 12:51:52 [ZipTie::Telnet] Screen length for this session set to 0.
2008-03-07 12:51:52 [ZipTie::Telnet] FNKC1234> (enable)  at /opt/firemon/DC/core/org.ziptie.adapters/scripts/ZipTie/Telnet.pm line 281
2008-03-07 12:51:52 [ZipTie::Telnet]
[UNEXPECTED_RESPONSE]
'192.168.7.3<http://192.168.7.3>' timed-out while waiting to match the regular expression '/F\s*$/'.
[INPUT]
set length 0
[ACTUAL RESPONSE]
NKC1234> (enable) set length 0
Screen length for this session set to 0.
FNKC1234> (enable)  at /opt/firemon/DC/core/org.ziptie.adapters/scripts/ZipTie/Telnet.pm line 281

















































































-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ziptie.org/pipermail/dev/attachments/20080307/84bbea2a/attachment.html 


More information about the Dev mailing list