NAME
PDK::Device::Huawei::Usg - A module for interacting with Huawei USG devices
SYNOPSIS
use PDK::Device::Huawei::Usg;
my $device = PDK::Device::Huawei::Usg->new(
host => '192.168.1.1',
username => 'admin',
password => 'password'
);
$device->login();
my $config = $device->getConfig();
my $result = $device->ftpConfig('hostname', 'ftp.example.com', 'ftpuser', 'ftppass');
DESCRIPTION
PDK::Device::Huawei::Usg is a Moose-based module that extends PDK::Device::Huawei to provide specific functionality for Huawei USG (Unified Security Gateway) devices. It includes methods for retrieving device configurations and backing them up via FTP.
INHERITANCE
This module inherits from PDK::Device::Huawei.
METHODS
getConfig()
Retrieves the current configuration from the Huawei USG device.
Returns: A hash reference with keys: =over 4 =item * success
- Boolean indicating if the operation was successful =item * config
- The current configuration of the device =back
Example: my $config = $device->getConfig(); if ($config->{success}) { print "Configuration: $config->{config}\n"; }
ftpConfig($hostname, $server, $username, $password)
Backs up the device configuration via FTP.
Parameters: =over 4 =item * $hostname
- Optional hostname for the backup file =item * $server
- FTP server address =item * $username
- FTP username =item * $password
- FTP password =back
Returns: A hash reference with keys: =over 4 =item * success
- Boolean indicating if the operation was successful =item * config
- The result of the FTP backup operation =back
Example: my $result = $device->ftpConfig('usg1', 'ftp.example.com', 'ftpuser', 'ftppass'); if ($result->{success}) { print "Backup successful: $result->{config}\n"; }
ENVIRONMENT VARIABLES
This module uses the following environment variables if they are set:
- PDK_FTP_SERVER
-
The default FTP server to use for configuration backups.
- PDK_FTP_USERNAME
-
The default username for FTP authentication.
- PDK_FTP_PASSWORD
-
The default password for FTP authentication.
DEPENDENCIES
This module requires the following Perl modules:
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.