http://www.perlmonks.org?node_id=1220389


in reply to Re^2: Net::SSH2::Cisco and Nexus switches
in thread Net::SSH2::Cisco and Nexus switches

In waitfor(), if there is a timeout and waitfor_clear() is set, an ios_break('Z') (ctrl-z) is sent. That explains the Z. If you're confident you have the prompt correct, try experimenting with waitfor_clear().

  • Comment on Re^3: Net::SSH2::Cisco and Nexus switches

Replies are listed 'Best First'.
Re^4: Net::SSH2::Cisco and Nexus switches
by cnoyes72 (Initiate) on Aug 16, 2018 at 14:29 UTC

    Thanks again for the response.

    It looks like the prompt match still isn't working. There is something about the NX-OS prompt/response that the underlying net::telnet::cisco module doesn't like. It works great with IOS and IOS-XE. I did find that Control::CLI works great with NX-OS but doesn't work with IOS or IOS-XE (it behaves like nx-os did with net::ssh2::cisco). It could be that the NX-OS cli behaves just like a linux session; not surprising considering nx-os is layered upon linux. So I guess I'll have to use both modules in my backup script (that script works great with Net::Telnet today but we are trying to shutdown Telnet on the switches).

      Try enabling the dump_log which shows the hex characters. It could be how and where newlines are sent. They could be \r\n, \r, \n and you'll see this as hex 13 and 10 in the dump_log. Sometimes the prompt starts with a newline so you'll need to make sure the correct character is matched at the beginning. I'll admit I've had frustrations with this as well using Net::Telnet::Cisco way back when connecting to IOS-XR switches.