karavelov -
This is a walled-off garden test lab, so passwords and security for this are default. I have placed on the vty lines privilege level 15 - no need for "enable". I had tried the 'waitfor' with the pound sign, but if you read the docs on Net::Telnet::Cisco, that is a prompt that is already recognized, and default is 'always_waitfor_prompt'. So I don't see how these additions would work. My use of the 'sleep 20' is at the very least reliable and repeatable.
Regards,
Scott | [reply] |
my $backup_host = "tftpserver.somewhere.net";
my $device = "cisco.somewhere.net";
my $type = "router"; # or "switch";
my $ios_version = 12;
my @out;
if ($type eq "router") {
if ($ios_version >= 12) {
@out = $session->cmd("copy system:/running-config "
. "tftp://$backup_host/$device-confg\n\n\n");
} elsif ($ios_version >= 11) {
@out = $session->cmd("copy running-config tftp\n$backup_host
+\n"
. "$device-confg\n");
} elsif ($ios_version >= 10) {
@out = $session->cmd("write net\n$backup_host\n$device-confg
+\n\n");
}
} elsif ($type eq "switch") {
@out = $session->cmd("copy system:/running-config "
. "tftp://$backup_host/$device-confg\n\n\n");
}
Norman | [reply] [d/l] |