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