line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Cisco::UCS::Chassis; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
10
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
521
|
use Cisco::UCS::FEX; |
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
29
|
|
7
|
1
|
|
|
1
|
|
559
|
use Cisco::UCS::Common::FanModule; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
28
|
|
8
|
1
|
|
|
1
|
|
612
|
use Cisco::UCS::Common::Fan; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
29
|
|
9
|
1
|
|
|
1
|
|
527
|
use Cisco::UCS::Chassis::PSU; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use Cisco::UCS::Chassis::Stats; |
11
|
|
|
|
|
|
|
use Carp qw(croak); |
12
|
|
|
|
|
|
|
use Scalar::Util qw(weaken); |
13
|
|
|
|
|
|
|
use vars qw(@ISA); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
@ISA = qw(Cisco::UCS); |
16
|
|
|
|
|
|
|
our %ATTRIBUTES = ( |
17
|
|
|
|
|
|
|
adminState => 'admin_state', |
18
|
|
|
|
|
|
|
connPath => 'conn_path', |
19
|
|
|
|
|
|
|
connStatus => 'conn_status', |
20
|
|
|
|
|
|
|
dn => 'dn', |
21
|
|
|
|
|
|
|
id => 'id', |
22
|
|
|
|
|
|
|
managingInst => 'managing_instance', |
23
|
|
|
|
|
|
|
model => 'model', |
24
|
|
|
|
|
|
|
operState => 'oper_state', |
25
|
|
|
|
|
|
|
operability => 'operability', |
26
|
|
|
|
|
|
|
power => 'power', |
27
|
|
|
|
|
|
|
presence => 'presence', |
28
|
|
|
|
|
|
|
seepromOperState=> 'seeprom_oper_state', |
29
|
|
|
|
|
|
|
serial => 'serial', |
30
|
|
|
|
|
|
|
thermal => 'thermal', |
31
|
|
|
|
|
|
|
usrLbl => 'label', |
32
|
|
|
|
|
|
|
vendor => 'vendor', |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
{ |
36
|
|
|
|
|
|
|
no strict 'refs'; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
while ( my ($attribute, $pseudo) = each %ATTRIBUTES ) { |
39
|
|
|
|
|
|
|
*{ __PACKAGE__ . '::' . $pseudo } = sub { |
40
|
|
|
|
|
|
|
my $self = shift; |
41
|
|
|
|
|
|
|
return $self->{$attribute} |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub new { |
47
|
|
|
|
|
|
|
my ( $class, %args ) = @_; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
my $self = {}; |
50
|
|
|
|
|
|
|
bless $self, $class; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
defined $args{dn} |
53
|
|
|
|
|
|
|
? $self->{dn} = $args{dn} |
54
|
|
|
|
|
|
|
: croak 'dn not defined'; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
defined $args{ucs} |
57
|
|
|
|
|
|
|
? weaken($self->{ucs} = $args{ucs} ) |
58
|
|
|
|
|
|
|
: croak 'ucs not defined'; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
my %attr = %{$self->{ucs}->resolve_dn( |
61
|
|
|
|
|
|
|
dn => $self->{dn} |
62
|
|
|
|
|
|
|
)->{outConfig}->{equipmentChassis}}; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
while ( my ($k, $v) = each %attr ) { $self->{$k} = $v } |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
return $self; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub blade { |
70
|
|
|
|
|
|
|
my ( $self, $id ) = @_; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
return ( |
73
|
|
|
|
|
|
|
defined $self->{blade}->{$id} |
74
|
|
|
|
|
|
|
? $self->{blade}->{$id} |
75
|
|
|
|
|
|
|
: $self->get_blades( $id ) |
76
|
|
|
|
|
|
|
) |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub get_blade { |
80
|
|
|
|
|
|
|
my ( $self, $id ) = @_; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
return ( |
83
|
|
|
|
|
|
|
$id ? $self->get_blades( $id ) |
84
|
|
|
|
|
|
|
: undef |
85
|
|
|
|
|
|
|
) |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub get_blades { |
89
|
|
|
|
|
|
|
my ( $self, $id ) = @_; |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
return $self->_get_child_objects( |
92
|
|
|
|
|
|
|
id => $id, |
93
|
|
|
|
|
|
|
type => 'computeBlade', |
94
|
|
|
|
|
|
|
class => 'Cisco::UCS::Blade', |
95
|
|
|
|
|
|
|
attr => 'blade', |
96
|
|
|
|
|
|
|
uid => 'slotId', |
97
|
|
|
|
|
|
|
class_filter => { |
98
|
|
|
|
|
|
|
classId => 'computeBlade', |
99
|
|
|
|
|
|
|
chassisId => $self->{id} |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
) |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub fex { |
105
|
|
|
|
|
|
|
my ( $self, $id ) = @_; |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
return ( |
108
|
|
|
|
|
|
|
defined $self->{fex}->{$id} |
109
|
|
|
|
|
|
|
? $self->{fex}->{$id} |
110
|
|
|
|
|
|
|
: $self->get_fexs( $id ) |
111
|
|
|
|
|
|
|
) |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
sub get_fex { |
115
|
|
|
|
|
|
|
my ( $self, $id ) = @_; |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
return ( |
118
|
|
|
|
|
|
|
$id ? $self->get_fexs( $id ) |
119
|
|
|
|
|
|
|
: undef |
120
|
|
|
|
|
|
|
) |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
sub get_fexs { |
124
|
|
|
|
|
|
|
my ( $self, $id ) = @_; |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
return $self->_get_child_objects( |
127
|
|
|
|
|
|
|
id => $id, |
128
|
|
|
|
|
|
|
type => 'equipmentIOCard', |
129
|
|
|
|
|
|
|
class => 'Cisco::UCS::FEX', |
130
|
|
|
|
|
|
|
attr => 'fex' |
131
|
|
|
|
|
|
|
) |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
sub fan_module { |
135
|
|
|
|
|
|
|
my ( $self, $id ) = @_; |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
return ( |
138
|
|
|
|
|
|
|
defined $self->{fan_module}->{$id} |
139
|
|
|
|
|
|
|
? $self->{fan_module}->{$id} |
140
|
|
|
|
|
|
|
: $self->get_fan_module( $id ) |
141
|
|
|
|
|
|
|
) |
142
|
|
|
|
|
|
|
} |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
sub get_fan_module { |
145
|
|
|
|
|
|
|
my ( $self, $id ) = @_; |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
return ( |
148
|
|
|
|
|
|
|
$id ? $self->get_fan_modules( $id ) |
149
|
|
|
|
|
|
|
: undef |
150
|
|
|
|
|
|
|
) |
151
|
|
|
|
|
|
|
} |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
sub get_fan_modules { |
154
|
|
|
|
|
|
|
my ( $self, $id ) = @_; |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
return $self->_get_child_objects( |
157
|
|
|
|
|
|
|
id => $id, |
158
|
|
|
|
|
|
|
type => 'equipmentFanModule', |
159
|
|
|
|
|
|
|
class => 'Cisco::UCS::Common::FanModule', |
160
|
|
|
|
|
|
|
attr => 'fan_module' |
161
|
|
|
|
|
|
|
) |
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
sub psu { |
165
|
|
|
|
|
|
|
my ( $self, $id ) = @_; |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
return ( |
168
|
|
|
|
|
|
|
defined $self->{psu}->{$id} |
169
|
|
|
|
|
|
|
? $self->{psu}->{$id} |
170
|
|
|
|
|
|
|
: $self->get_psus( $id ) |
171
|
|
|
|
|
|
|
) |
172
|
|
|
|
|
|
|
} |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
sub get_psu { |
175
|
|
|
|
|
|
|
my ( $self, $id ) = @_; |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
return $self->get_psu( $id ) |
178
|
|
|
|
|
|
|
} |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
sub get_psus { |
181
|
|
|
|
|
|
|
my ( $self, $id ) = @_; |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
return $self->_get_child_objects( |
184
|
|
|
|
|
|
|
id => $id, |
185
|
|
|
|
|
|
|
type => 'equipmentPsu', |
186
|
|
|
|
|
|
|
class => 'Cisco::UCS::Chassis::PSU', |
187
|
|
|
|
|
|
|
attr => 'psu' |
188
|
|
|
|
|
|
|
) |
189
|
|
|
|
|
|
|
} |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
sub stats { |
192
|
|
|
|
|
|
|
my $self = shift; |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
return Cisco::UCS::Chassis::Stats->new( |
195
|
|
|
|
|
|
|
$self->{ucs}->resolve_dn( |
196
|
|
|
|
|
|
|
dn => "$self->{dn}/stats" |
197
|
|
|
|
|
|
|
)->{outConfig}->{equipmentChassisStats} |
198
|
|
|
|
|
|
|
) |
199
|
|
|
|
|
|
|
} |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
1; |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
__END__ |