NAME
PDK::Device::Huawei::Usg - A Perl module for managing Huawei USG devices
SYNOPSIS
use PDK::Device::Huawei::Usg;
# Create a new instance of the device
my $device = PDK::Device::Huawei::Usg->new();
# Get the current configuration from the device
my $config = $device->getConfig();
# Backup configuration to an FTP server
my $ftp_result = $device->ftpConfig($hostname, $server, $username, $password);
DESCRIPTION
PDK::Device::Huawei::Usg
is a Perl module designed to manage and interact with Huawei USG series devices. This module provides methods to retrieve the device configuration and perform FTP backups of the configuration. It extends the base functionality provided by PDK::Device::Huawei
.
METHODS
getConfig
my $config = $device->getConfig();
This method retrieves the current configuration from the Huawei USG device. It sends a series of commands to the device to display the running configuration and ensure that the configuration is saved.
Returns a hash reference with the following keys:
success
- A flag indicating whether the operation was successful (1 for success, 0 for failure).config
- The configuration content retrieved from the device.
ftpConfig
my $ftp_result = $device->ftpConfig($hostname, $server, $username, $password);
This method connects to an FTP server and uploads the current configuration file. It supports loading the FTP credentials from environment variables if they are not provided as arguments.
Arguments:
$hostname
(optional) - The hostname to use when naming the configuration file.$server
- The FTP server address.$username
- The FTP username.$password
- The FTP password.
Returns a hash reference with the following keys:
success
- A flag indicating whether the FTP operation was successful (1 for success, 0 for failure).config
- The output from the FTP session, including the result of the upload.
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.