NAME
PDK::Device::Cisco - Interacts with Cisco devices, managing connections, commands, and configuration backups.
SYNOPSIS
use PDK::Device::Cisco;
my $device = PDK::Device::Cisco->new(
host => '192.168.1.1',
username => 'admin',
password => 'password'
);
$device->login();
$device->send('show running-config');
$device->getConfig();
$device->ftpConfig();
DESCRIPTION
This module provides methods to interact with Cisco devices, including login, command execution, and configuration backups over FTP.
ATTRIBUTES
- prompt
-
Regex for the normal mode prompt (default: '\S+[#>]\s*\z').
- enPrompt
-
Regex for non-privileged mode prompt (default: '\S+[>]\s*\z').
- enCommand
-
Command to switch to enable mode (default: 'enable').
METHODS
- errCodes
-
Returns an array of regexes for common error patterns (e.g., "Permission denied", "Invalid command").
- waitfor
-
Waits for the specified prompt and handles device responses interactively.
- runCommands
-
Executes a list of commands in configuration mode, automatically adding commands like "configure terminal" and "copy running-config startup-config" if needed.
- getConfig
-
Retrieves the device's running configuration, excluding specific lines (e.g., "ntp clock-period").
- ftpConfig
-
Backs up the running configuration to an FTP server.
AUTHOR
WENWU YAN <968828@gmail.com>
LICENSE AND COPYRIGHT
Copyright (C) 2024 WENWU YAN
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.