line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Cisco::UCS::Common::FanModule; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
29
|
|
4
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
20
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
3
|
use Carp qw(croak); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
33
|
|
7
|
1
|
|
|
1
|
|
3
|
use Scalar::Util qw(weaken); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
83
|
|
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
|
|
3
|
no strict 'refs'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
297
|
|
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
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub new { |
39
|
0
|
|
|
0
|
0
|
|
my ( $class, %args ) = @_; |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
my $self = {}; |
42
|
0
|
|
|
|
|
|
bless $self, $class; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
defined $args{dn} |
45
|
|
|
|
|
|
|
? $self->{dn} = $args{dn} |
46
|
0
|
0
|
|
|
|
|
: croak 'dn not defined'; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
defined $args{ucs} |
49
|
|
|
|
|
|
|
? weaken($self->{ucs} = $args{ucs}) |
50
|
0
|
0
|
|
|
|
|
: croak 'ucs not defined'; |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
my %attr = %{ $self->{ucs}->resolve_dn( |
53
|
|
|
|
|
|
|
dn => $self->{dn} |
54
|
0
|
|
|
|
|
|
)->{outConfig}->{equipmentFanModule} }; |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
while ( my ( $k, $v ) = each %attr ) { $self->{$k} = $v } |
|
0
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
return $self; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub fan { |
62
|
0
|
|
|
0
|
1
|
|
my ( $self, $id ) = @_; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
return ( defined $self->{fan}->{$id} |
65
|
0
|
0
|
|
|
|
|
? $self->{fan}->{$id} |
66
|
|
|
|
|
|
|
: $self->get_fan($id) |
67
|
|
|
|
|
|
|
) |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub get_fan { |
71
|
0
|
|
|
0
|
1
|
|
my ( $self, $id ) = @_; |
72
|
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
return $self->get_fans( $id ) |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub get_fans { |
77
|
0
|
|
|
0
|
1
|
|
my ( $self, $id ) = @_; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
return $self->{ucs}->_get_child_objects( |
80
|
0
|
|
|
|
|
|
id => $id, |
81
|
|
|
|
|
|
|
type => 'equipmentFan', |
82
|
|
|
|
|
|
|
class => 'Cisco::UCS::Common::Fan', |
83
|
|
|
|
|
|
|
attr => 'fan', |
84
|
|
|
|
|
|
|
self => $self |
85
|
|
|
|
|
|
|
) |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
1; |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
__END__ |