Hi, I have been trying to get Net::SSH2::Cisco to work on Cisco XR, but seems to fail.
I have the same script working on a Cisco IOS device.
#!/usr/bin/perl use strict; use warnings; use Net::SSH2::Cisco; my $host = Net::SSH2::Cisco->new( Host => 'device', Always_waitfor_prompt => 1, Prompt => '/(?m:^\\s?(?:[\\w.\/]+\:)?(?:[\\w.-]+\@)?[\\w.-]+\\s?(? +:\(config[^\)]*\))?\\s?(?:\(admin-config[^\)]*\))?\\s?[\$#>]\\s?(?:\( +enable\))?\\s*$)/', Input_log => "log/device.log", Output_log => "log/output_device.log", Dump_Log => "log/dump_device", Waitfor_clear => '0', ); $host->login( name => 'user', password => 'pass', ); #$host->cmd("term leng 0"); my @abc = $host->cmd( String => 'sh ver', Prompt => '/(?m:^\\s?(?:[\\w.\/]+\:)?(?:[\\w.-]+\@)?[\\w.-]+\\ +s?(?:\(config[^\)]*\))?\\s?(?:\(admin-config[^\)]*\))?\\s?[\$#>]\\s?( +?:\(enable\))?\\s*$)/', Timeout => '20' ); print @abc; $host->close;
Prompt for Cisco XR:
RP/0/RSP0/CPU0:DEVICE#


Prompt for Cisco IOS:
DEVICE#


Dump file on XR device:
> 0x00000: 73 68 20 76 65 72 0a sh ver.


Dump file on IOS device:
< 0x00000: 64 65 76 69 63 65 23 . .DEVICE#
> 0x00000: 73 68 20 76 65 72 0a sh ver.
< 0x00000: 73 68 20 76 65 72 0d 0a sh ver..



In reply to Net::SSH2::Cisco not working on Cisco XR by Xane

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.