NAME
PDK::Device::Hillstone - A module for interacting with Hillstone devices
SYNOPSIS
use PDK::Device::Hillstone;
my $device = PDK::Device::Hillstone->new(
host => '192.168.1.1',
username => 'admin',
password => 'hillstone_password'
);
# Log in to the device
$device->login();
# Execute commands
$device->execCommands(['show version', 'show interface']);
# Retrieve running configuration
my $config = $device->getConfig();
# FTP configuration backup (Note: This method currently returns getConfig result)
my $backup = $device->ftpConfig('ftp_server', 'hostname', 'ftp_username', 'ftp_password');
DESCRIPTION
This module provides functionality to interact with Hillstone devices, including executing commands and retrieving configurations. It extends the PDK::Device::Base role and is tailored for Hillstone-specific operations.
ATTRIBUTES
- prompt
-
The device's default prompt, defaults to '^.*?($$(?:M|B|F)$$)?[>#]\s*$'. This pattern is designed to handle various Hillstone device prompts.
METHODS
- errCodes
-
Returns a list of possible error patterns for checking errors during command execution. These include patterns for incomplete commands, ambiguous commands, unrecognized keywords, syntax errors, and other common errors.
- waitfor($prompt, $params)
-
Waits for a specific prompt match and handles device responses interactively.
Parameters: - $prompt: The prompt to match (optional) - $params: A hash reference containing send command and other options (optional) - send: The command to send - continue: Whether to continue execution (default: false) - cache: Whether to cache the output (default: true)
Returns: The output of the command execution
- getConfig
-
Retrieves the running configuration of the device. It executes commands to set terminal width, disable screen length limitations, display the current configuration, and save the configuration.
Returns: A hash reference containing a success flag and configuration content.
- ftpConfig($server, $hostname, $username, $password)
-
This method is currently a placeholder and returns the result of getConfig. It does not perform an actual FTP backup.
Parameters: - $server: FTP server address - $hostname: Optional hostname - $username: FTP username - $password: FTP password
Returns: The result of getConfig method.
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.