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