Cisco-UCS
view release on metacpan or search on metacpan
lib/Cisco/UCS/FEX.pm view on Meta::CPAN
package Cisco::UCS::FEX;
use warnings;
use strict;
use Carp qw(croak);
use Scalar::Util qw(weaken);
our $VERSION = '0.51';
our @ATTRIBUTES = qw(discovery dn id model operability perf power presence
revision serial side thermal vendor voltage);
our %ATTRIBUTES = (
chassis_id => 'chassisId',
config_state => 'configState',
oper_state => 'operState',
peer_status => 'peerCommStatus',
switch_id => 'switchId',
);
{
no strict 'refs';
while ( my ( $pseudo, $attribute ) = each %ATTRIBUTES ) {
*{ __PACKAGE__ . '::' . $pseudo } = sub {
my $self = shift;
return $self->{$attribute}
}
}
foreach my $attribute ( @ATTRIBUTES ) {
*{ __PACKAGE__ . '::' . $attribute } = sub {
my $self = shift;
return $self->{$attribute}
}
}
}
sub new {
my ( $class, %args ) = @_;
my $self = {};
bless $self, $class;
defined $args{dn}
? $self->{dn} = $args{dn}
: croak 'dn not defined';
defined $args{ucs}
? weaken($self->{ucs} = $args{ucs})
: croak 'ucs not defined';
my %attr = %{ $self->{ucs}->resolve_dn(
dn => $self->{dn}
)->{outConfig}->{equipmentIOCard}};
while ( my ($k, $v) = each %attr ) { $self->{$k} = $v }
return $self;
}
1;
__END__
=pod
=head1 NAME
Cisco::UCS::FEX - Class for operations with a Cisco UCS FEX.
=head1 SYNOPSIS
my @fexs = $ucs->chassis(2)->get_fexs;
print $fexs[0]->thermal;
print $ucs->chassis(1)->fex(1)->model;
=head1 DECRIPTION
Cisco::UCS::FEX is a class providing operations with a Cisco UCS FEX.
Note that you are not supposed to call the constructor yourself, rather a
Cisco::UCS::FEX object is created automatically by method calls to a
L<Cisco::UCS::Chassis> object.
=head1 METHODS
=head3 id
Returns the id of the FEX.
=head3 dn
Returns the distinguished name of the FEX.
=head3 model
returns the model number of the FEX.
=head3 vendor
Returns the vendor name of the FEX.
=head3 revision
returns the revision number of the FEX.
=head3 discovery
( run in 0.500 second using v1.01-cache-2.11-cpan-75ffa21a3d4 )