File Coverage

blib/lib/Cisco/UCS/FEX.pm
Criterion Covered Total %
statement 15 29 51.7
branch 0 4 0.0
condition n/a
subroutine 5 8 62.5
pod 0 1 0.0
total 20 42 47.6


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