Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Cannot reload Cisco device using perl Net::Appliance::Session library

by alptugay (Initiate)
on Feb 21, 2013 at 15:01 UTC ( #1019957=perlquestion: print w/replies, xml ) Need Help??
alptugay has asked for the wisdom of the Perl Monks concerning the following question:

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?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1019957]
Approved by Corion
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (8)
As of 2018-06-21 12:58 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (118 votes). Check out past polls.