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