Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I am trying to reboot a Cisco device using net::appliance::session library. But even the code doesn't give en error the device doesn't reboot. This is the two lines I am using:
$session->cmd(String => 'Reload',Match => ['/Proceed/'], ); $session->cmd(String => "\n", Match => ['//'],);
In the Cisco shell a reload command is given like this:
test#reload Proceed with reload? [confirm] Connection closed by foreign host.
This thread in the cpan forum also tells me to do this way. I think there is a problem with carriage returns and confirm dialogs. Because when I try to create a directory it works fine:
$session->cmd(String => 'mkdir',Match => ['/Create dire.*/'] ); $session->cmd(String => 'test',Match => ['//'] );
The equivelant of this in Cisco shell:
test#mkdir Create directory filename []? test Created dir flash:test
But when I try to delete this directory which needs a carriage return as confirmation the scripts fails again.
$session->cmd(String => 'rmdir asd',Match => ['/Remove directory.*/']) +; $session->cmd(String => '\n' ,Match => ['/Delete flash.*/'] ); $session->cmd(String => '\n');
The equivelant in Cisco is this:
test#rmdir test Remove directory filename [test]? Delete flash:test? [confirm] Removed dir flash:test
So I think the problem isn't with reload command. But the problem is sending carriage returns as confirmation. I have tried \n \r \n\r \r\n and empty string but they didn't work. Any ideas?

In reply to Cannot reload Cisco device using perl Net::Appliance::Session library by alptugay

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2024-03-28 17:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found