Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

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?

Comment on Cannot reload Cisco device using perl Net::Appliance::Session library
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1019957]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (11)
As of 2015-07-29 07:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (260 votes), past polls