ObjectGroup/Service.pm

filter: Statementstmt 97.2% 35 / 36 Branchbran 95.8% 23 / 24 Conditioncond 88.8% 24 / 27 MC/DCmcdc 75.0% 12 / 16 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 1 totaltotal 90.9% 100 / 110 CC 22 SCAR 27.4
CC
22
Cov
94%
push
20.2
_init
3.0
BEGIN
1.0
CRAP 15.4
↑ Summary ObjectGroup.pm »
1 package Net::Cisco::ObjectGroup::Service;
2 2 ▶use base qw(Net::Cisco::ObjectGroup::Base);
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 2 ▶use warnings FATAL => qw(all);
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 2 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 5 ▶sub _init {
Subroutine _init: called CC=3 SCAR=11.0
10 5 my $self = shift;
11 5 my $arg_ref = shift;
12  
13 croak 'missing parameter "protocol" when creating service group'
14 5 ▶ if !defined $arg_ref->{protocol};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $arg_ref->{"protocol"} 1 4 5
15  
16 croak "unrecognized protocol type: '$arg_ref->{protocol}'"
17 4 ▶ if $arg_ref->{protocol} !~ m/^(?:tcp|udp|tcp-udp)$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $arg_ref->{"protocol"} =~ /^(?:tcp|udp|tcp-udp)$/ 1 3 4
18  
19 3 $self->set_name( $self->get_name ." $arg_ref->{protocol}" );
20 3 $self->SUPER::_init( $arg_ref );
21  
22 3 return $self;
23 }
24  
25 8 ▶sub push {
Subroutine push: called CC=20 SCAR=30.1
Pod undocumented
26 8 my $self = shift;
27 8 my $arg_ref = shift;
28  
29 croak 'must specify either group-object or service definition'
30 8 ▶ if !defined $arg_ref->{group_object} and !defined $arg_ref->{svc};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $arg_ref->{"group_object"} or defined $arg_ref->{"svc"} 1 7 8
Condition100%3/3
defined $arg_ref->{"group_object"} or defined $arg_ref->{"svc"}
l!l&&r!l&&!r
341
MC/DC100%2/2
defined $arg_ref->{"group_object"} or defined $arg_ref->{"svc"}
defined $arg_ref->{"group_object"} defined $arg_ref->{"svc"}
Truth table100%3/3
A or B
A= defined $arg_ref->{"group_object"}B= defined $arg_ref->{"svc"}
ABresult
1X1
011
000
31  
32 croak 'cannot specify both group-object and service definition'
33 7 ▶ if defined $arg_ref->{group_object} and defined $arg_ref->{svc};
Branch: 1 branch
BranchTrueFalseTotal
if defined $arg_ref->{"group_object"} and defined $arg_ref->{"svc"} 1 6 7
Condition100%3/3
defined $arg_ref->{"group_object"} and defined $arg_ref->{"svc"}
!ll&&!rl&&r
421
MC/DC100%2/2
defined $arg_ref->{"group_object"} and defined $arg_ref->{"svc"}
defined $arg_ref->{"group_object"} defined $arg_ref->{"svc"}
Truth table100%3/3
A and B
A= defined $arg_ref->{"group_object"}B= defined $arg_ref->{"svc"}
ABresult
0X0
100
111
34  
35 croak 'missing service operator'
36 6 ▶ if defined $arg_ref->{svc} and !defined $arg_ref->{svc_op};
Branch: 1 branch
BranchTrueFalseTotal
if defined $arg_ref->{"svc"} and not defined $arg_ref->{"svc_op"} 1 5 6
Condition100%3/3
defined $arg_ref->{"svc"} and not defined $arg_ref->{"svc_op"}
!ll&&!rl&&r
231
MC/DC100%2/2
defined $arg_ref->{"svc"} and not defined $arg_ref->{"svc_op"}
defined $arg_ref->{"svc"} not defined $arg_ref->{"svc_op"}
Truth table100%3/3
A and not(B)
A= defined $arg_ref->{"svc"}B= not defined $arg_ref->{"svc_op"}
ABresult
0X0
100
111
37  
38 croak "unrecognized service operator: '$arg_ref->{svc_op}'"
39 if defined $arg_ref->{svc_op}
40 5 ▶ and $arg_ref->{svc_op} !~ m/^(?:eq|range)$/;
Branch: 1 branch
BranchTrueFalseTotal
if defined $arg_ref->{"svc_op"} and not $arg_ref->{"svc_op"} =~ /^(?:eq|range)$/ 1 4 5
Condition100%3/3
defined $arg_ref->{"svc_op"} and not $arg_ref->{"svc_op"} =~ /^(?:eq|range)$/
!ll&&!rl&&r
221
MC/DC100%2/2
defined $arg_ref->{"svc_op"} and not $arg_ref->{"svc_op"} =~ /^(?:eq|range)$/
defined $arg_ref->{"svc_op"} not $arg_ref->{"svc_op"} =~ /^(?:eq|range)$/
Truth table100%3/3
A and not(B)
A= defined $arg_ref->{"svc_op"}B= not $arg_ref->{"svc_op"} =~ /^(?:eq|range)$/
ABresult
0X0
100
111
41  
42 croak 'bad group-object'
43 if defined $arg_ref->{group_object}
44 4 ▶ and ! UNIVERSAL::isa( $arg_ref->{group_object}, __PACKAGE__ );
Branch: 1 branch
BranchTrueFalseTotal
if defined $arg_ref->{"group_object"} and not UNIVERSAL::isa($arg_ref->{"group_object"}, __PACKAGE__) 1 3 4
Condition100%3/3
defined $arg_ref->{"group_object"} and not UNIVERSAL::isa($arg_ref->{"group_object"}, __PACKAGE__)
!ll&&!rl&&r
211
MC/DC100%2/2
defined $arg_ref->{"group_object"} and not UNIVERSAL::isa($arg_ref->{"group_object"}, __PACKAGE__)
defined $arg_ref->{"group_object"} not UNIVERSAL::isa($arg_ref->{"group_object"}, __PACKAGE__)
Truth table100%3/3
A and not(B)
A= defined $arg_ref->{"group_object"}B= not UNIVERSAL::isa($arg_ref->{"group_object"}, __PACKAGE__)
ABresult
0X0
100
111
45  
46  
47 3 ▶ if (defined $arg_ref->{svc}
Branch: 1 branch
BranchTrueFalseTotal
if (defined $arg_ref->{"svc"} and defined __PACKAGE__->__dict and exists __PACKAGE__->__dict->{$arg_ref->{"svc"}}) 1 2 3
Condition83%5/6
defined $arg_ref->{"svc"} and defined __PACKAGE__->__dict and exists __PACKAGE__->__dict->{$arg_ref->{"svc"}}
!ll&&!rl&&r
111
defined $arg_ref->{"svc"} and defined __PACKAGE__->__dict
!ll&&!rl&&r
102
MC/DC66%2/3
defined $arg_ref->{"svc"} and defined __PACKAGE__->__dict and exists __PACKAGE__->__dict->{$arg_ref->{"svc"}}
defined $arg_ref->{"svc"} defined __PACKAGE__->__dict exists __PACKAGE__->__dict->{$arg_ref->{"svc"}}
Truth table75%3/4
A and B and C
A= defined $arg_ref->{"svc"}B= defined __PACKAGE__->__dictC= exists __PACKAGE__->__dict->{$arg_ref->{"svc"}}
ABCresult
0XX0
10X0
1100
1111
48 and defined __PACKAGE__->__dict
49 and exists __PACKAGE__->__dict->{$arg_ref->{svc}}) {
50  
51 1 $arg_ref->{svc} = __PACKAGE__->__dict->{$arg_ref->{svc}};
52 }
53  
54 3 ▶ if (defined $arg_ref->{svc_hi}
Branch: 1 branch
BranchTrueFalseTotal
if (defined $arg_ref->{"svc_hi"} and defined __PACKAGE__->__dict and exists __PACKAGE__->__dict->{$arg_ref->{"svc_hi"}}) 0 3 3
Condition66%4/6
defined $arg_ref->{"svc_hi"} and defined __PACKAGE__->__dict and exists __PACKAGE__->__dict->{$arg_ref->{"svc_hi"}}
!ll&&!rl&&r
210
defined $arg_ref->{"svc_hi"} and defined __PACKAGE__->__dict
!ll&&!rl&&r
201
MC/DC0%0/3
defined $arg_ref->{"svc_hi"} and defined __PACKAGE__->__dict and exists __PACKAGE__->__dict->{$arg_ref->{"svc_hi"}}
defined $arg_ref->{"svc_hi"} defined __PACKAGE__->__dict exists __PACKAGE__->__dict->{$arg_ref->{"svc_hi"}}
Truth table50%2/4
A and B and C
A= defined $arg_ref->{"svc_hi"}B= defined __PACKAGE__->__dictC= exists __PACKAGE__->__dict->{$arg_ref->{"svc_hi"}}
ABCresult
0XX0
10X0
1100
1111
55 and defined __PACKAGE__->__dict
56 and exists __PACKAGE__->__dict->{$arg_ref->{svc_hi}}) {
57  
58 0 $arg_ref->{svc_hi} = __PACKAGE__->__dict->{$arg_ref->{svc_hi}};
59 }
60  
61 my $line = defined $arg_ref->{group_object}
62 ? 'group-object '. $arg_ref->{group_object}->get_name
63 : defined $arg_ref->{svc_hi}
64 3 ▶ ? "port-object $arg_ref->{svc_op} $arg_ref->{svc} $arg_ref->{svc_hi}"
Branch: 2 branches
BranchTrueFalseTotal
defined $arg_ref->{'group_object'} ? : 1 2 3
defined $arg_ref->{'svc_hi'} ? : 1 1 2
65 : "port-object $arg_ref->{svc_op} $arg_ref->{svc}";
66  
67 3 ▶ $line =~ s/ \S+$// if defined $arg_ref->{group_object}; # chop off proto
Branch: 1 branch
BranchTrueFalseTotal
if defined $arg_ref->{"group_object"} 1 2 3
68  
69 3 push @{$self->get_objs}, $line;
70  
71 3 return $self;
72 }
73  
74 2 1;
75  
76 # Copyright (c) The University of Oxford 2006. All Rights Reserved.
77 #
78 # This program is free software; you can redistribute it and/or modify it
79 # under the terms of version 2 of the GNU General Public License as published
80 # by the Free Software Foundation.
81 #
82 # This program is distributed in the hope that it will be useful, but WITHOUT
83 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
84 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
85 # more details.
86 #
87 # You should have received a copy of the GNU General Public License along with
88 # this program; if not, write to the Free Software Foundation, Inc., 51
89 # Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
90  
91 __DATA__
↑ Summary ObjectGroup.pm »