| 1 | package Cisco::UCS::Common::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 | |||||||||||
| 9 | 2 | our $VERSION = '0.51'; | |||||||||
| 10 | |||||||||||
| 11 | 2 | our @ATTRIBUTES = qw(dn id model operability power presence revision serial | |||||||||
| 12 | thermal vendor voltage); | ||||||||||
| 13 | |||||||||||
| 14 | 2 | our %ATTRIBUTES = ( | |||||||||
| 15 | operational => 'operState', | ||||||||||
| 16 | performance => 'perf' | ||||||||||
| 17 | ); | ||||||||||
| 18 | |||||||||||
| 19 | #our | ||||||||||
| 20 | # 'outputCurrentMin' => '10.000000', | ||||||||||
| 21 | # 'input210vAvg' => '239.000000', | ||||||||||
| 22 | # 'outputPowerAvg' => '120.869995', | ||||||||||
| 23 | # 'outputCurrent' => '10.000000', | ||||||||||
| 24 | # 'ambientTemp' => '26.000000', | ||||||||||
| 25 | # 'psuTemp1' => '0.000000', | ||||||||||
| 26 | # 'output12vAvg' => '12.087000', | ||||||||||
| 27 | # 'output12vMin' => '12.087000', | ||||||||||
| 28 | # 'outputCurrentMax' => '10.000000', | ||||||||||
| 29 | # 'output12v' => '12.087000', | ||||||||||
| 30 | # 'timeCollected' => '2012-10-19T13:07:33.952', | ||||||||||
| 31 | # 'outputCurrentAvg' => '10.000000', | ||||||||||
| 32 | # 'psuTemp2' => '0.000000', | ||||||||||
| 33 | # 'suspect' => 'no', | ||||||||||
| 34 | # 'thresholded' => '', | ||||||||||
| 35 | # 'ambientTempMin' => '26.000000', | ||||||||||
| 36 | # 'ambientTempMax' => '26.000000', | ||||||||||
| 37 | # 'output3v3Max' => '3.048000', | ||||||||||
| 38 | # 'output12vMax' => '12.087000', | ||||||||||
| 39 | # 'outputPowerMin' => '120.869995', | ||||||||||
| 40 | # 'input210v' => '239.000000', | ||||||||||
| 41 | # 'outputPowerMax' => '120.869995', | ||||||||||
| 42 | # 'input210vMin' => '239.000000', | ||||||||||
| 43 | # 'ambientTempAvg' => '26.000000', | ||||||||||
| 44 | # 'outputPower' => '120.869995', | ||||||||||
| 45 | # 'output3v3Avg' => '3.048000', | ||||||||||
| 46 | # 'intervals' => '58982460', | ||||||||||
| 47 | # 'output3v3' => '3.048000', | ||||||||||
| 48 | # 'update' => '131073', | ||||||||||
| 49 | # 'dn' => 'sys/chassis-1/psu-1/stats', | ||||||||||
| 50 | # 'input210vMax' => '239.000000', | ||||||||||
| 51 | # 'output3v3Min' => '3.048000' | ||||||||||
| 52 | |||||||||||
| 53 | |||||||||||
| 54 | |||||||||||
| 55 | 0 | ▶ | sub new { | ||||||||
|
Subroutine
new: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||
| 56 | 0 | my ( $class, %args ) = @_; | |||||||||
| 57 | |||||||||||
| 58 | 0 | my $self = {}; | |||||||||
| 59 | 0 | bless $self, $class; | |||||||||
| 60 | |||||||||||
| 61 | defined $args{dn} | ||||||||||
| 62 | ? $self->{dn} = $args{dn} | ||||||||||
| 63 | 0 | ▶ | : croak 'dn not defined'; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 64 | |||||||||||
| 65 | defined $args{ucs} | ||||||||||
| 66 | ? weaken($self->{ucs} = $args{ucs}) | ||||||||||
| 67 | 0 | ▶ | : croak 'ucs not defined'; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 68 | |||||||||||
| 69 | 0 | my %attr = %{ $self->{ucs}->resolve_dn( | |||||||||
| 70 | dn => $self->{dn} | ||||||||||
| 71 | 0 | )->{outConfig}->{equipmentPsu} }; | |||||||||
| 72 | |||||||||||
| 73 | 0 | ▶ | while ( my ($k, $v) = each %attr ) { $self->{$k} = $v } | ||||||||
|
Branch: 1 branch
| |||||||||||
| 74 | |||||||||||
| 75 | 0 | return $self; | |||||||||
| 76 | } | ||||||||||
| 77 | |||||||||||
| 78 | { | ||||||||||
| 79 | 2 | ▶ | no strict 'refs'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 80 | |||||||||||
| 81 | 2 | ▶ | while ( my ( $pseudo, $attribute ) = each %ATTRIBUTES ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 82 | 4 | ▶ | *{ __PACKAGE__ . '::' . $pseudo } = sub { | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||
| 83 | 0 | return $_[0]->{$attribute} | |||||||||
| 84 | } | ||||||||||
| 85 | 4 | } | |||||||||
| 86 | |||||||||||
| 87 | 2 | foreach my $attribute (@ATTRIBUTES) { | |||||||||
| 88 | 22 | ▶ | *{ __PACKAGE__ . '::' . $attribute } = sub { | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||
| 89 | 0 | return $_[0]->{$attribute} | |||||||||
| 90 | } | ||||||||||
| 91 | 22 | } | |||||||||
| 92 | } | ||||||||||
| 93 | |||||||||||
| 94 | 2 | 1; | |||||||||
| 95 | |||||||||||
| 96 | __END__ | ||||||||||