UCS/MgmtEntity.pm

filter: Statementstmt 65.0% 26 / 40 Branchbran 25.0% 2 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 62.5% 5 / 8 Podpod 0.0% 0 / 1 totaltotal 57.8% 33 / 57 CC 4 SCAR 20.7
CC
4
Cov
58%
new
20.0
__ANON__
1.3
__ANON__
1.3
CRAP 8.0
« UCS/Fault.pm ↑ Summary UCS/ServiceProfile.pm »
1 package Cisco::UCS::MgmtEntity;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use Scalar::Util qw(weaken);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 2 our $VERSION = '0.51';
10  
11 2 our @ATTRIBUTES = qw(chassis1 chassis2 chassis3 dn id leadership state);
12  
13 2 our %ATTRIBUTES = (
14 chassis1_device_io_state => 'chassisDeviceIoState1',
15 chassis2_device_io_state => 'chassisDeviceIoState2',
16 chassis3_device_io_state => 'chassisDeviceIoState3',
17 ha_failure_reason => 'haFailureReason',
18 ha_readiness => 'haReadiness',
19 ha_ready => 'haReady',
20 mgmt_services_state => 'mgmtServicesState',
21 umbilical_state => 'umbilicalState',
22 version_mismatch => 'versionMismatch'
23 );
24  
25 0 ▶sub new {
Subroutine new: not called CC=4 SCAR=30.0
Pod undocumented
26 0 my ( $class, %args ) = @_;
27  
28 0 my $self = {};
29 0 bless $self, $class;
30  
31 defined $args{dn}
32 ? $self->{dn} = $args{dn}
33 0 ▶ : croak 'dn not defined';
Branch: 1 branch
BranchTrueFalseTotal
defined $args{'dn'} ? : 0 0 0
34  
35 defined $args{ucs}
36 ? weaken($self->{ucs} = $args{ucs})
37 0 ▶ : croak 'dn not defined';
Branch: 1 branch
BranchTrueFalseTotal
defined $args{'ucs'} ? : 0 0 0
38  
39 0 my %attr = %{ $self->{ucs}->resolve_dn(
40 dn => $self->{dn}
41 0 )->{outConfig}->{mgmtEntity} };
42  
43 0 ▶ while ( my ($k, $v) = each %attr ) { $self->{$k} = $v }
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %attr) 0 0 0
44  
45 0 return $self
46 }
47  
48 {
49 2 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
50  
51 2 ▶ while ( my ( $pseudo, $attribute ) = each %ATTRIBUTES ) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %Cisco::UCS::MgmtEntity::ATTRIBUTES) 18 2 20
52 18 ▶ *{ __PACKAGE__ . '::' . $pseudo } = sub {
Subroutine __ANON__: not called CC=1 SCAR=2.6
53 0 my $self = shift;
54 0 return $self->{$attribute}
55 }
56 18 }
57  
58 2 foreach my $attribute ( @ATTRIBUTES ) {
59 14 ▶ *{ __PACKAGE__ . '::' . $attribute } = sub {
Subroutine __ANON__: not called CC=1 SCAR=2.6
60 0 my $self = shift;
61 0 return $self->{$attribute}
62 }
63 14 }
64 }
65  
66 2 1;
67  
68 __END__
« UCS/Fault.pm ↑ Summary UCS/ServiceProfile.pm »