NAME
PDK::Concern::Netdisco::Role - A Moose role for network device discovery and management
SYNOPSIS
package MyNetworkManager;
use Moose;
with 'PDK::Concern::Netdisco::Role';
# Implement required methods
sub gen_iface_desc { ... }
sub commands { ... }
# Use the role's methods
$self->explore_topology();
$self->write_file($config, $filename);
DESCRIPTION
This role provides functionality for network device discovery, topology exploration, and configuration management. It is designed to be used with classes that represent network devices and their management interfaces.
ATTRIBUTES
device
A read-only attribute that must be an instance of a class that does the PDK::Device::Base role. This represents the network device being managed.
month
A read-only attribute that lazily loads the current month in YYYY-MM format.
date
A read-only attribute that lazily loads the current date in YYYY-MM-DD format.
workdir
A read-write attribute representing the working directory. Defaults to the value of the PDK_CONCERN_HOME environment variable or the user's home directory.
debug
A read-write attribute that controls debug output. Defaults to the value of the PDK_CONCERN_DEBUG environment variable or 0.
METHODS
now
Returns the current date and time in "YYYY-MM-DD HH:MM:SS" format.
dump($message)
Prints debug information. If debug level is 1, it prints to STDOUT. If debug level is greater than 1, it writes to a file in the dump directory.
write_file($config, $name)
Writes the provided configuration to a file in the working directory. The filename defaults to the device's hostname with a .txt extension.
explore_topology
Explores the network topology by executing commands on the device and generating interface descriptions.
refine_if($interface_name)
Normalizes interface names by applying a set of predefined replacements.
REQUIRED METHODS
Classes consuming this role must implement the following methods:
gen_iface_desc
commands
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.