Hi,
i tried with below commands to telnet connection to the device
require 'net/telnet'
con = Net::Telnet::new("Host"=> 'X.X.X.X',"Port"=> XXXX, "Prompt"=>
/User:/, "Timeout"=> 240,"Output_log"=>"output_log.log", "Dump_log"=>
"dump_log.log") { |c| print c }
con.cmd("String" => "admin","Match" => /Password:/,"Timeout" => 180) {
c> print c }
con.cmd("String" => "mypass","Match" => /\(#{$prompt}\) \>/,"Timeout"
=> 60) { |c| print c }
con.cmd("String" => "show run","Match" => /\(#{$prompt}\)
\>/,"Timeout" => 60) { |c| print c }
con.close
I am able to connect with the console at some times. but some times i
got error like
C:/Ruby193/lib/ruby/1.9.1/net/telnet.rb:558:in `waitfor': timed out
while waiting for more data (Timeout::Error)
from C:/Ruby193/lib/ruby/1.9.1/net/telnet.rb:697:in `cmd'
from C:/Documents and Settings/Administrator/Desktop/rub.rb:3:in
`<top (required)>'
from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in
`load'
from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in
`block in load_spec_files'
from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in
`map'
from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in
`load_spec_files'
from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb:22:in
`run'
from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:69:in
`run'
from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:8:in
`block in autorun'
If anyone have solution to fix that issue.
Thanks in advance.
···
--
Posted via http://www.ruby-forum.com/\.