| 1 | package Cisco::UCS::Chassis::PSU; | ||||||||||
| 2 | |||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 2 | ▶ | use Carp qw(croak); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 2 | ▶ | use Scalar::Util qw(weaken); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 2 | ▶ | use Cisco::UCS::Chassis::PSU::Stats; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 2 | our $VERSION = '0.51'; | |||||||||
| 11 | |||||||||||
| 12 | 2 | our %ATTRIBUTES = ( | |||||||||
| 13 | id => 'id', | ||||||||||
| 14 | model => 'model', | ||||||||||
| 15 | operability => 'operability', | ||||||||||
| 16 | operational => 'operState', | ||||||||||
| 17 | performance => 'perf', | ||||||||||
| 18 | power => 'power', | ||||||||||
| 19 | presence => 'presence', | ||||||||||
| 20 | revision => 'revision', | ||||||||||
| 21 | serial => 'serial', | ||||||||||
| 22 | thermal => 'thermal', | ||||||||||
| 23 | vendor => 'vendor', | ||||||||||
| 24 | voltage => 'voltage', | ||||||||||
| 25 | ); | ||||||||||
| 26 | |||||||||||
| 27 | { | ||||||||||
| 28 | 2 | ▶ | no strict 'refs'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 29 | |||||||||||
| 30 | 2 | ▶ | while ( my ($pseudo, $attribute) = each %ATTRIBUTES ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 31 | 24 | ▶ | *{ __PACKAGE__ . '::' . $pseudo } = sub { | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||
| 32 | 0 | return $_[0]->{$attribute} | |||||||||
| 33 | } | ||||||||||
| 34 | 24 | } | |||||||||
| 35 | } | ||||||||||
| 36 | |||||||||||
| 37 | 0 | ▶ | sub new { | ||||||||
|
Subroutine
new: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||
| 38 | 0 | my ( $class, %args ) = @_; | |||||||||
| 39 | |||||||||||
| 40 | 0 | my $self = {}; | |||||||||
| 41 | 0 | bless $self, $class; | |||||||||
| 42 | |||||||||||
| 43 | defined $args{dn} | ||||||||||
| 44 | ? $self->{dn} = $args{dn} | ||||||||||
| 45 | 0 | ▶ | : croak 'dn not defined'; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 46 | |||||||||||
| 47 | defined $args{ucs} | ||||||||||
| 48 | ? weaken($self->{ucs} = $args{ucs}) | ||||||||||
| 49 | 0 | ▶ | : croak 'ucs not defined'; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 50 | |||||||||||
| 51 | 0 | my %attr = %{ $self->{ucs}->resolve_dn( | |||||||||
| 52 | dn => $self->{dn} | ||||||||||
| 53 | 0 | )->{outConfig}->{equipmentPsu}}; | |||||||||
| 54 | |||||||||||
| 55 | 0 | ▶ | while ( my ($k, $v) = each %attr ) { $self->{$k} = $v } | ||||||||
|
Branch: 1 branch
| |||||||||||
| 56 | |||||||||||
| 57 | 0 | return $self; | |||||||||
| 58 | } | ||||||||||
| 59 | |||||||||||
| 60 | 0 | ▶ | sub stats { | ||||||||
|
Subroutine
stats: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 61 | 0 | my $self = shift; | |||||||||
| 62 | return Cisco::UCS::Chassis::PSU::Stats->new( | ||||||||||
| 63 | $self->{ucs}->resolve_dn( | ||||||||||
| 64 | dn => "$self->{dn}/stats" | ||||||||||
| 65 | )->{outConfig}->{equipmentPsuStats} ) | ||||||||||
| 66 | 0 | } | |||||||||
| 67 | |||||||||||
| 68 | 2 | 1; | |||||||||
| 69 | |||||||||||
| 70 | __END__ | ||||||||||