NAME
PDK::Device::Cisco::Nxos - Module for backing up Cisco NX-OS device configuration via FTP
SYNOPSIS
use PDK::Device::Cisco::Nxos;
my $device = PDK::Device::Cisco::Nxos->new( host => 'device_ip' );
$device->ftp_config( $hostname, $server, $username, $password );
DESCRIPTION
The PDK::Device::Cisco::Nxos module provides functionality to back up the running configuration of Cisco NX-OS devices via FTP. It extends PDK::Device::Cisco and interacts with the device using the Expect module to automate the backup process.
METHODS
ftp_config
$device->ftp_config( $hostname, $server, $username, $password );
Backs up the running configuration of a Cisco NX-OS device to an FTP server.
$hostname- Optional hostname to include in the backup filename.$server- The FTP server address. If not provided, it will be loaded from the environment variablePDK_FTP_SERVER.$username- The FTP username. If not provided, it will be loaded from the environment variablePDK_FTP_USERNAME.$password- The FTP password. If not provided, it will be loaded from the environment variablePDK_FTP_PASSWORD.
The method connects to the device, executes the backup command, and saves the configuration file on the FTP server using the default VRF ('default'). If the environment requires a different VRF (such as 'management'), modifications can be made.
ERROR HANDLING
If the connection to the device or the FTP server fails, the method will throw an exception using croak. Common errors include:
Failure to log in to the device.
Invalid FTP server address, username, or password.
Connection timeouts during the backup process.
RETURN VALUE
Returns a hash reference containing:
success- A boolean indicating whether the backup was successful.config- The result of the command execution, including device responses and log details.
DEPENDENCIES
This module depends on the following Perl modules:
Moose- For object-oriented programming.Expect- For interacting with devices through terminal sessions.Carp- For error handling withcroak.
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.