| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Cisco::UCS::Common::Fan; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
24
|
|
|
4
|
1
|
|
|
1
|
|
3
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
15
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
3
|
use Scalar::Util qw(weaken); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
39
|
|
|
7
|
1
|
|
|
1
|
|
5
|
use Carp qw(croak); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
80
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.51'; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @ATTRIBUTES = qw(dn id model operability power presence revision serial |
|
12
|
|
|
|
|
|
|
thermal tray vendor voltage); |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our %ATTRIBUTES = ( |
|
15
|
|
|
|
|
|
|
performance => 'perf', |
|
16
|
|
|
|
|
|
|
oper_state => 'operState' |
|
17
|
|
|
|
|
|
|
); |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
{ |
|
20
|
1
|
|
|
1
|
|
4
|
no strict 'refs'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
244
|
|
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
while ( my ($pseudo, $attribute) = each %ATTRIBUTES ) { |
|
23
|
|
|
|
|
|
|
*{ __PACKAGE__ . '::' . $pseudo } = sub { |
|
24
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
|
|
|
|
0
|
|
|
|
|
25
|
0
|
|
|
|
|
|
return $self->{$attribute} |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
foreach my $attribute (@ATTRIBUTES) { |
|
30
|
|
|
|
|
|
|
*{ __PACKAGE__ . '::' . $attribute } = sub { |
|
31
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
32
|
0
|
|
|
|
|
|
return $self->{$attribute} |
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub new { |
|
38
|
0
|
|
|
0
|
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
|
0
|
|
|
|
|
: croak 'dn not defined'; |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
defined $args{id} |
|
48
|
|
|
|
|
|
|
? $self->{id} = $args{id} |
|
49
|
0
|
0
|
|
|
|
|
: croak 'id not defined'; |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
defined $args{ucs} |
|
52
|
|
|
|
|
|
|
? weaken( $self->{ucs} = $args{ucs} ) |
|
53
|
0
|
0
|
|
|
|
|
: croak 'ucs not defined'; |
|
54
|
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
my %attr = %{ $self->{ucs}->resolve_dn( |
|
56
|
|
|
|
|
|
|
dn => $self->{dn} |
|
57
|
|
|
|
|
|
|
) |
|
58
|
0
|
|
|
|
|
|
}; |
|
59
|
|
|
|
|
|
|
|
|
60
|
0
|
|
|
|
|
|
%attr = %{ exists $attr{outConfig}{equipmentFan} |
|
61
|
|
|
|
|
|
|
? $attr{outConfig}{equipmentFan} |
|
62
|
|
|
|
|
|
|
: $attr{outConfig}{equipmentFanModule} |
|
63
|
0
|
0
|
|
|
|
|
}; |
|
64
|
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
while ( my ($k, $v ) = each %attr) { $self->{$k} = $v } |
|
|
0
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
return $self; |
|
68
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
1; |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
__END__ |