blib/lib/OSPF/LSDB/View.pm

filter: Statementstmt 98.2% 1342 / 1366 Branchbran 78.6% 415 / 528 Conditioncond 68.8% 137 / 199 MC/DCmcdc 54.3% 63 / 116 Subroutinesub 100% 69 / 69 Podpod 5.0% 3 / 59 totaltotal 86.8% 2029 / 2337 CC 459 SCAR 31.5
CC
459
Cov
90%
graph_database
87.8
create_externaggr
51.8
create_boundaggr
33.6
CRAP 23.3
« blib/lib/OSPF/LSDB/ospfd.pm ↑ Summary script/ospf2dot »
1 ##########################################################################
2 # Copyright (c) 2010-2021 Alexander Bluhm <alexander.bluhm@gmx.net>
3 #
4 # Permission to use, copy, modify, and distribute this software for any
5 # purpose with or without fee is hereby granted, provided that the above
6 # copyright notice and this permission notice appear in all copies.
7 #
8 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 ##########################################################################
16  
17 13 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 13 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 =pod
21  
22 =head1 NAME
23  
24 OSPF::LSDB::View - display OSPF database as graphviz dot
25  
26 =head1 SYNOPSIS
27  
28 use OSPF::LSDB;
29  
30 use OSPF::LSDB::View;
31  
32 my $ospf = OSPF::LSDB-E<gt>new();
33  
34 my $view = OSPF::LSDB::View-E<gt>new($ospf);
35  
36 my $dot = view-E<gt>graph();
37  
38 =head1 DESCRIPTION
39  
40 The OSPF::LSDB::View module converts the content of a L<OSPF::LSDB>
41 instance into a graphviz dot string.
42 Routers and Networks become nodes, the links between them are
43 directed edges.
44 The different OSPF vertices are displayed with drawing styles that
45 are documented in the legend.
46  
47 During conversion the link state database is checked.
48 Each inconsistency is reported as L<OSPF::LSDB> error and the color
49 of the object changes.
50 The colors are prioritized by severity.
51  
52 =over 8
53  
54 =item gray
55  
56 All areas and ASE have unique gray levels.
57  
58 =item black
59  
60 Vertex is in multiple areas.
61  
62 =item purple
63  
64 An area is not in the list of all areas.
65  
66 =item tan
67  
68 Asymmetric designated router.
69  
70 =item brown
71  
72 Asymmetric links.
73  
74 =item cyan
75  
76 Conflicting AS external network.
77  
78 =item green
79  
80 Conflicting stub network.
81  
82 =item blue
83  
84 Conflicting network.
85  
86 =item orange
87  
88 Conflicting area.
89  
90 =item yellow
91  
92 Multiple links.
93  
94 =item magenta
95  
96 Conflicting link.
97  
98 =item red
99  
100 Missing node.
101  
102 =back
103  
104 Normally the L<OSPF::LSDB> copy constructor creates the object.
105 The public methods are:
106  
107 =cut
108  
109 package OSPF::LSDB::View;
110 13 ▶use base 'OSPF::LSDB';
Subroutine BEGIN: called CC=1 SCAR=0.0
111 13 ▶use List::MoreUtils qw(uniq);
Subroutine BEGIN: called CC=1 SCAR=0.0
112 13 use fields qw (
113 routehash
114 pointtopointhash transithash transitnets stubhash stubs stubareas
115 virtualhash ifaddrs
116 nethash nets netareas
117 sumhash sums sumaggr
118 boundhash boundaggr
119 externhash externaggr
120 netcluster transitcluster
121 areagrays
122 todo
123 13 ▶);
Subroutine BEGIN: called CC=1 SCAR=0.0
124  
125 sub new {
126 113 ▶ my OSPF::LSDB::View $self = OSPF::LSDB::new(@_);
Subroutine new: called CC=2 SCAR=6.9
Pod documented
127 113 ▶ die "$_[0] does not support IPv6" if $self->ipv6();
Branch: 1 branch
BranchTrueFalseTotal
if $self->ipv6 1 112 113
128 112 return $self;
129 }
130  
131 # convert decimal dotted IPv4 address to packed format
132 2566 ▶sub _ip2pack($) { pack("CCCC", split(/\./, $_[0])) }
Subroutine _ip2pack: called CC=1 SCAR=0.0
133  
134 # convert packed IPv4 address to decimal dotted format
135 966 ▶sub _pack2ip($) { join('.', unpack("CCCC", $_[0])) }
Subroutine _pack2ip: called CC=1 SCAR=0.0
136  
137 # mask decimal dotted IPv4 network with decimal dotted IPv4 netmask
138 966 ▶sub _maskip($$) { _pack2ip(_ip2pack($_[0]) & _ip2pack($_[1])) }
Subroutine _maskip: called CC=1 SCAR=0.0
139  
140 # compare function for sorting decimal dotted IPv4 address
141 138 ▶sub _cmp_ip { unpack("N",_ip2pack($a)) <=> unpack("N",_ip2pack($b)) }
Subroutine _cmp_ip: called CC=1 SCAR=0.0
142  
143 # compare function for sorting IPv4 address / netmask
144 sub _cmp_ip_net {
145 179 ▶ my @a = split(/\//, $a);
Subroutine _cmp_ip_net: called CC=2 SCAR=7.6
146 179 my @b = split(/\//, $b);
147 179 ▶ return unpack("N",_ip2pack($a[0])) <=> unpack("N",_ip2pack($b[0])) ||
Condition33%1/3
unpack('N', &_ip2pack($a[0])) <=> unpack('N', &_ip2pack($b[0])) || unpack('N', &_ip2pack($a[1])) <=> unpack('N', &_ip2pack($b[1]))
l!l&&r!l&&!r
17900
MC/DC0%0/2
unpack('N', &_ip2pack($a[0])) <=> unpack('N', &_ip2pack($b[0])) || unpack('N', &_ip2pack($a[1])) <=> unpack('N', &_ip2pack($b[1]))
unpack('N', &_ip2pack($a[0])) <=> unpack('N', &_ip2pack($b[0])) unpack('N', &_ip2pack($a[1])) <=> unpack('N', &_ip2pack($b[1]))
Truth table33%1/3
A || B
A= unpack('N', &_ip2pack($a[0])) <=> unpack('N', &_ip2pack($b[0]))B= unpack('N', &_ip2pack($a[1])) <=> unpack('N', &_ip2pack($b[1]))
ABresult
1X1
011
000
148 unpack("N",_ip2pack($a[1])) <=> unpack("N",_ip2pack($b[1]));
149 }
150  
151 # take list of all areas
152 # create hash mapping from area to gray color
153 sub create_area_grays {
154 177 ▶ my OSPF::LSDB::View $self = shift;
Subroutine create_area_grays: called CC=2 SCAR=6.9
Pod undocumented
155 177 ▶ my $ospf = $self->{ospf} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $ospf = $self->{"ospf"} or die "Uninitialized member" 0 177 177
156 177 my @areas = sort _cmp_ip @{$ospf->{self}{areas}};
157 177 my @colors = map { "gray". int(50 + ($_* 50 / @areas)) } (0..$#areas);
158 177 my %areagrays;
159 177 @areagrays{@areas} = @colors;
160 177 $areagrays{ase} = "gray35";
161 177 $self->{areagrays} = \%areagrays;
162 }
163  
164 # each color gets a weight indicating the severity of its message
165 13 my %COLORWEIGHT;
166 13 @COLORWEIGHT{qw(black purple tan brown cyan green blue orange yellow magenta
167 red)} = 1..100;
168 13 @COLORWEIGHT{map { "gray$_" } 1..99} = -99..-1;
169 13 $COLORWEIGHT{gray} = -100;
170  
171 # take hash with color names and messages
172 # return color name
173 sub colors2string {
174 1937 ▶ my OSPF::LSDB::View $self = shift;
Subroutine colors2string: called CC=7 SCAR=19.6
Pod undocumented
175 1937 my($colors) = @_;
176 1937 ▶ if (my $area = $colors->{gray}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $area = $colors->{"gray"}) 1825 112 1937
177 1825 ▶ my $areagrays = $self->{areagrays} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $areagrays = $self->{"areagrays"} or die "Uninitialized member" 0 1825 1825
178 1825 my $gray = $areagrays->{$area};
179 1825 delete $colors->{purple};
180 1825 ▶ if (! $gray) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $gray) { } 0 1825 1825
181 0 $self->error($colors->{purple} = "Unexpected area $area.");
182 } else {
183 1825 ▶ $colors->{$gray} = $area eq "ase" ? "AS external" : "Area: $area";
Branch: 1 branch
BranchTrueFalseTotal
$area eq 'ase' ? : 160 1665 1825
184 1825 delete $colors->{gray};
185 }
186 }
187 1937 ▶ if (my @areas = uniq @{$colors->{black} || []}) {
Branch: 2 branches
BranchTrueFalseTotal
if (my(@areas) = &uniq(@{$colors->{"black"} or [];})) 112 1825 1937
$colors->{"black"} or [] 1825 112 1937
188 112 $colors->{black} = "Areas: @areas";
189 }
190 1937 return (sort { $COLORWEIGHT{$a} <=> $COLORWEIGHT{$b} } keys %$colors)[-1];
191 }
192  
193 ########################################################################
194 # RFC 2328
195 # LS LSA LSA description
196 # type name
197 # ________________________________________________________
198 # 1 Router-LSAs Originated by all routers.
199 # This LSA describes
200 # the collected states of the
201 # router's interfaces to an
202 # area. Flooded throughout a
203 # single area only.
204 ########################################################################
205 # routers => [ {
206 # area => 'ipv4',
207 # bits => {
208 # B => 'int', # bit B
209 # E => 'int', # bit E
210 # V => 'int', # bit V
211 # },
212 # pointtopoints => [], # Point-to-point connection to another router
213 # transits => [], # Connection to a transit network
214 # stubs => [], # Connection to a stub network
215 # virtuals => [], # Virtual link
216 # router => 'ipv4', # Link State ID
217 # routerid => 'ipv4', # Advertising Router
218 # ],
219 ########################################################################
220 # $routehash{$router} = {
221 # graph => { N => router10, color => red, style => solid, }
222 # hashes => [ { router hash } ]
223 # areas => { $area => 1 }
224 # missing => 1 (optional)
225 # }
226 # check wether interface addresses are used more than once
227 # $ifaddrs{$interface}{$router}++
228 ########################################################################
229  
230 # take router hash
231 # detect inconsistencies and set colors
232 sub check_router {
233 112 ▶ my OSPF::LSDB::View $self = shift;
Subroutine check_router: called CC=9 SCAR=22.0
Pod undocumented
234 112 ▶ my $routehash = $self->{routehash} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $routehash = $self->{"routehash"} or die "Uninitialized member" 0 112 112
235 112 ▶ while (my($rid,$rv) = each %$routehash) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %$routehash) 252 112 364
236 252 my %colors;
237 252 my @areas = sort keys %{$rv->{areas}};
238 252 ▶ if (@areas > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@areas > 1) { } 49 203 252
239 49 $colors{black} = \@areas;
240 49 ▶ if (my @badareas = map { $_->{area} || () }
Branch: 2 branches
BranchTrueFalseTotal
if (my(@badareas) = map({$_->{"area"} or ();} grep({not $_->{"bits"}{"B"};} @{$$rv{"hashes"};}))) 1 48 49
$_->{"area"} or () 3 1 4
241 100 grep { ! $_->{bits}{B} } @{$rv->{hashes}}) {
242 $self->error($colors{orange} =
243 1 "Router $rid in multiple areas is not border router ".
244 "in areas @badareas.");
245 }
246 } else {
247 203 $colors{gray} = $areas[0];
248 }
249 252 ▶ if (my @badareas = grep { $rv->{areas}{$_} > 1 } @areas) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@badareas) = grep({$rv->{"areas"}{$_} > 1;} @areas)) 1 251 252
250 $self->error($colors{yellow} =
251 1 "Router $rid has multiple entries in areas @badareas.");
252 }
253 252 ▶ if ($rv->{missing}) {
Branch: 2 branches
BranchTrueFalseTotal
if ($rv->{'missing'}) { } 13 239 252
elsif (my(@badids) = grep({$_ ne $rid;} map({$_->{'routerid'};} @{$$rv{'hashes'};}))) { } 1 238 239
254 13 $self->error($colors{red} = "Router $rid missing.");
255 291 } elsif (my @badids = grep { $_ ne $rid } map { $_->{routerid} }
256 239 @{$rv->{hashes}}) {
257 $self->error($colors{magenta} =
258 1 "Router $rid advertized by @badids.");
259 }
260 252 $rv->{colors} = \%colors;
261 }
262 }
263  
264 # take router structure, router id
265 # create routehash
266 # create pointtopointhash transithash transitnets stubhash stubs stubareas
267 # virtualhash
268 sub create_router {
269 177 ▶ my OSPF::LSDB::View $self = shift;
Subroutine create_router: called CC=14 SCAR=26.4
Pod undocumented
270 177 my($index) = @_;
271 177 my $routerid = $self->{ospf}{self}{routerid};
272 177 my %routehash;
273 my %pointtopointhash;
274 177 my %transithash;
275 177 my %transitnets;
276 177 my %stubhash;
277 177 my %stubs;
278 177 my %stubareas;
279 177 my %virtualhash;
280 177 my($transitindex, $stubindex) = (0, 0);
281 177 foreach my $r (@{$self->{ospf}{database}{routers}}) {
282 439 ▶ my $rid = $self->ipv6 ? $r->{routerid} : $r->{router};
Branch: 1 branch
BranchTrueFalseTotal
$self->ipv6 ? : 148 291 439
283 439 my $area = $r->{area};
284 439 my $bits = $r->{bits};
285 439 my $elem = $routehash{$rid};
286 439 ▶ if (! $elem) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($elem) 362 77 439
287 362 $routehash{$rid} = $elem = {};
288 $elem->{graph} = {
289 N => "router$$index",
290 label => $rid,
291 shape => "box",
292 362 ▶ style => $bits->{B} ? "bold" : "solid",
Branch: 1 branch
BranchTrueFalseTotal
$bits->{'B'} ? : 171 191 362
293 };
294 362 $elem->{index} = $$index++;
295 362 ▶ if ($rid eq $routerid) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rid eq $routerid) 166 196 362
296 166 $elem->{graph}{peripheries} = 2;
297 }
298 }
299 439 push @{$elem->{hashes}}, $r;
300 439 ▶ if ($self->ipv6) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->ipv6) { } 148 291 439
301 148 my $lsid = $r->{router};
302 148 $elem->{areas}{$area}{$lsid}++;
303 } else {
304 291 $elem->{areas}{$area}++;
305 }
306  
307 439 foreach my $l (@{$r->{pointtopoints}}) {
308 40 $self->add_router_value(\%pointtopointhash, $rid, $area, $l);
309 40 $self->{ifaddrs}{$l->{interface}}{$rid}++;
310 }
311 439 foreach my $l (@{$r->{transits}}) {
312 295 $self->add_transit_value(\%transithash, \%transitnets,
313 \$transitindex, $rid, $area, $l);
314 295 $self->{ifaddrs}{$l->{interface}}{$rid}++;
315 }
316 439 foreach my $l (@{$r->{stubs}}) {
317 36 $self->add_stub_value(\%stubhash, \%stubs, \%stubareas,
318 \$stubindex, $rid, $area, $l);
319 }
320 439 foreach my $l (@{$r->{virtuals}}) {
321 40 $self->add_router_value(\%virtualhash, $rid, $area, $l);
322 }
323 }
324 177 $self->{routehash} = \%routehash;
325 177 $self->{pointtopointhash} = \%pointtopointhash;
326 177 $self->{transithash} = \%transithash;
327 177 $self->{transitnets} = \%transitnets;
328 177 ▶ $self->{stubhash} = \%stubhash unless $self->ipv6;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->ipv6 112 65 177
329 177 ▶ $self->{stubs} = \%stubs unless $self->ipv6;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->ipv6 112 65 177
330 177 ▶ $self->{stubareas} = \%stubareas unless $self->ipv6;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->ipv6 112 65 177
331 177 $self->{virtualhash} = \%virtualhash;
332 }
333  
334 # take router hash, routerid,
335 # network hash, summary hash, boundary hash, external hash
336 # add missing routers to router hash
337 sub add_missing_router {
338 112 ▶ my OSPF::LSDB::View $self = shift;
Subroutine add_missing_router: called CC=17 SCAR=28.3
Pod undocumented
339 112 my($index) = @_;
340 112 my $boundhash = $self->{boundhash};
341 112 my $externhash = $self->{externhash};
342 # create router hash
343 112 my %rid2areas;
344 87 my @rids = map { keys %{$_->{routers}} }
345 112 map { values %$_ } values %$externhash;
346 112 foreach my $rid (@rids) {
347 # if ase is conneted to boundary router, router is not missing
348 133 ▶ next if $boundhash->{$rid};
Branch: 1 branch
BranchTrueFalseTotal
if $boundhash->{$rid} 100 33 133
349 33 $rid2areas{$rid}{ase} = 1;
350 }
351 112 my $sumhash = $self->{sumhash};
352 136 my @arearids = map { $_->{arearids} }
353 112 (values %$boundhash, map { values %$_ } values %$sumhash);
354 112 foreach my $ar (@arearids) {
355 136 ▶ while (my($area,$av) = each %$ar) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %$ar) 184 136 320
356 184 ▶ while (my($rid,$num) = each %$av) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %$av) 332 184 516
357 332 $rid2areas{$rid}{$area} = 1;
358 }
359 }
360 }
361 112 foreach my $type (qw(pointtopoint virtual)) {
362 224 ▶ my $linkhash = $self->{$type."hash"} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $linkhash = $$self{$type . 'hash'} or die "Uninitialized member" 0 224 224
363 224 ▶ while (my($dstrid,$dv) = each %$linkhash) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %$linkhash) 52 224 276
364 52 ▶ while (my($area,$av) = each %$dv) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %$dv) 52 52 104
365 52 $rid2areas{$dstrid}{$area} = 1;
366 }
367 }
368 }
369 112 ▶ my $nethash = $self->{nethash} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $nethash = $self->{"nethash"} or die "Uninitialized member" 0 112 112
370 92 my @hashes = map { @{$_->{hashes}} } map { values %$_ }
371 112 map { values %$_ } map { values %$_ } values %$nethash;
372 112 foreach my $n (@hashes) {
373 94 my $area = $n->{area};
374 94 $rid2areas{$n->{routerid}}{$area} = 1;
375 94 foreach (@{$n->{attachments}}) {
376 196 $rid2areas{$_->{routerid}}{$area} = 1;
377 }
378 }
379 112 my $routerid = $self->{ospf}{self}{routerid};
380 112 ▶ my $routehash = $self->{routehash} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $routehash = $self->{"routehash"} or die "Uninitialized member" 0 112 112
381 112 foreach my $rid (sort keys %rid2areas) {
382 220 my $rv = $rid2areas{$rid};
383 220 my $elem = $routehash->{$rid};
384 220 ▶ if (! $elem) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($elem) 13 207 220
385 13 $routehash->{$rid} = $elem = {};
386 $elem->{graph} = {
387 13 N => "router$$index",
388 label => $rid,
389 shape => "box",
390 style => "dotted",
391 };
392 13 $elem->{index} = $$index++;
393 13 ▶ if ($rid eq $routerid) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rid eq $routerid) 6 7 13
394 6 $elem->{graph}{peripheries} = 2;
395 }
396 13 push @{$elem->{hashes}}, {};
397 13 $elem->{areas} = $rv;
398 13 $elem->{missing}++;
399 }
400 }
401 }
402  
403 # take router hash, boundary hash
404 # remove duplicate routers from boundary hash
405 sub remove_duplicate_router {
406 177 ▶ my OSPF::LSDB::View $self = shift;
Subroutine remove_duplicate_router: called CC=4 SCAR=13.9
Pod undocumented
407 177 ▶ my $routehash = $self->{routehash} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $routehash = $self->{"routehash"} or die "Uninitialized member" 0 177 177
408 177 my $boundhash = $self->{boundhash};
409 # if AS boundary router is also regular router, only use the regular
410 177 ▶ while (my($asbr,$bv) = each %$boundhash) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %$boundhash) 101 177 278
411 101 ▶ if ($routehash->{$asbr}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($routehash->{$asbr}) 34 67 101
412 34 delete $bv->{graph};
413 }
414 }
415 }
416  
417 # take hash containing router nodes
418 # return list of nodes
419 sub router2nodes {
420 177 ▶ my OSPF::LSDB::View $self = shift;
Subroutine router2nodes: called CC=2 SCAR=7.1
Pod undocumented
421 177 ▶ my $routehash = $self->{routehash} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $routehash = $self->{"routehash"} or die "Uninitialized member" 0 177 177
422 177 return $self->elements2graphs(values %$routehash);
423 }
424  
425 ########################################################################
426 # RFC 2328
427 # Type Description
428 # __________________________________________________
429 # 1 Point-to-point connection to another router
430 ########################################################################
431 # pointtopoints => [ {
432 # interface => 'ipv4', # Link Data
433 # # interface's ifIndex value
434 # metric => 'int', # metric
435 # routerid => 'ipv4', # Link ID
436 # # Neighboring router's Router ID
437 # ],
438 ########################################################################
439 # $pointtopointhash{$pointtopointrouterid}{$area}{$routerid} = {
440 # hashes => [ { link hash } ]
441 # }
442 ########################################################################
443  
444 ########################################################################
445 # RFC 2328
446 # Type Description
447 # __________________________________________________
448 # 4 Virtual link
449 ########################################################################
450 # virtuals => [ {
451 # interface => 'ipv4', # Link Data
452 # # router interface's IP address
453 # metric => 'int', # metric
454 # routerid => 'ipv4', # Link ID
455 # # Neighboring router's Router ID
456 # ],
457 ########################################################################
458 # $virtualhash{$virtualrouterid}{$area}{$routerid} = {
459 # hashes => [ { link hash } ]
460 # }
461 ########################################################################
462  
463 # take pointtopoint or virtual hash, type, router id, area, link structure
464 # add new element to pointtopoint or virtual hash
465 sub add_router_value {
466 80 ▶ my OSPF::LSDB::View $self = shift;
Subroutine add_router_value: called CC=2 SCAR=6.9
Pod undocumented
467 80 my($linkhash, $rid, $area, $link) = @_;
468 80 my $dstrid = $link->{routerid};
469 80 my $elem = $linkhash->{$dstrid}{$area}{$rid};
470 80 ▶ if (! $elem) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($elem) 74 6 80
471 74 $linkhash->{$dstrid}{$area}{$rid} = $elem = {};
472 }
473 80 push @{$elem->{hashes}}, $link;
474 }
475  
476 # take link hash, type (pointtopoint or virtual), router hash
477 # return list of edges from src router to dst router
478 sub router2edges {
479 224 ▶ my OSPF::LSDB::View $self = shift;
Subroutine router2edges: called CC=21 SCAR=30.5
Pod undocumented
480 224 my($type) = @_;
481 224 ▶ my $name = $type eq "pointtopoint" ? "Point-to-point" : "Virtual";
Branch: 1 branch
BranchTrueFalseTotal
$type eq 'pointtopoint' ? : 112 112 224
482 224 ▶ my $style = $type eq "pointtopoint" ? "solid" : "dotted";
Branch: 1 branch
BranchTrueFalseTotal
$type eq 'pointtopoint' ? : 112 112 224
483 224 ▶ my $routehash = $self->{routehash} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $routehash = $self->{"routehash"} or die "Uninitialized member" 0 224 224
484 224 ▶ my $linkhash = $self->{$type."hash"} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $linkhash = $$self{$type . 'hash'} or die "Uninitialized member" 0 224 224
485 224 my $ifaddrs = $self->{ifaddrs};
486 224 my @elements;
487 224 my $index = 0;
488 224 foreach my $dstrid (sort keys %$linkhash) {
489 52 my $dv = $linkhash->{$dstrid};
490 52 foreach my $area (sort keys %$dv) {
491 52 my $ev = $dv->{$area};
492 52 foreach my $rid (sort keys %$ev) {
493 52 my $rv = $ev->{$rid};
494 52 my %colors = (gray => $area);
495 52 my $src = $routehash->{$rid}{graph}{N};
496 52 my $dst = $routehash->{$dstrid}{graph}{N};
497 52 my @hashes = @{$rv->{hashes}};
498 52 ▶ if ($type ne "pointtopoint" && @hashes > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($type ne "pointtopoint" and @hashes > 1) 2 50 52
Condition100%3/3
$type ne "pointtopoint" and @hashes > 1
!ll&&!rl&&r
26242
MC/DC100%2/2
$type ne "pointtopoint" and @hashes > 1
$type ne "pointtopoint" @hashes > 1
Truth table100%3/3
A and B
A= $type ne "pointtopoint"B= @hashes > 1
ABresult
0X0
100
111
499 $self->error($colors{yellow} =
500 2 "$name link at router $rid to router $dstrid ".
501 "has multiple entries in area $area.");
502 }
503 52 ▶ if (! $routehash->{$dstrid}{areas}{$area}) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $routehash->{$dstrid}{'areas'}{$area}) { } 4 48 52
elsif (not $linkhash->{$rid} && $linkhash->{$rid}{$area} && $linkhash->{$rid}{$area}{$dstrid} || $routehash->{$dstrid}{'missing'}) { } 2 46 48
504 $self->error($colors{orange} =
505 4 "$name link at router $rid to router $dstrid ".
506 "not in same area $area.");
507 ▶ } elsif (! ($linkhash->{$rid} && $linkhash->{$rid}{$area} &&
Condition77%7/9
$linkhash->{$rid} && $linkhash->{$rid}{$area} && $linkhash->{$rid}{$area}{$dstrid} || $routehash->{$dstrid}{'missing'}
l!l&&r!l&&!r
4422
$linkhash->{$rid} and $linkhash->{$rid}{$area} and $linkhash->{$rid}{$area}{$dstrid}
!ll&&!rl&&r
4044
$linkhash->{$rid} and $linkhash->{$rid}{$area}
!ll&&!rl&&r
4044
MC/DC50%2/4
$linkhash->{$rid} && $linkhash->{$rid}{$area} && $linkhash->{$rid}{$area}{$dstrid} || $routehash->{$dstrid}{'missing'}
$linkhash->{$rid} $linkhash->{$rid}{$area} $linkhash->{$rid}{$area}{$dstrid} $routehash->{$dstrid}{'missing'}
Truth table42%3/7
A and B and C || D
A= $linkhash->{$rid}B= $linkhash->{$rid}{$area}C= $linkhash->{$rid}{$area}{$dstrid}D= $routehash->{$dstrid}{'missing'}
ABCDresult
111X1
0XX11
10X11
11011
0XX00
10X00
11000
508 $linkhash->{$rid}{$area}{$dstrid}) &&
509 ! $routehash->{$dstrid}{missing}) {
510 $self->error($colors{brown} =
511 2 "$name link at router $rid to router $dstrid ".
512 "not symmetric in area $area.");
513 }
514 52 foreach my $link (@hashes) {
515 55 my $intf = $link->{interface};
516 55 delete $colors{green};
517 55 ▶ if ($type eq "pointtopoint" and $ifaddrs->{$intf} &&
Branch: 1 branch
BranchTrueFalseTotal
if ($type eq "pointtopoint" and ($ifaddrs->{$intf} and $ifaddrs->{$intf}{$rid} > 1)) 1 54 55
Condition83%5/6
$type eq "pointtopoint" and ($ifaddrs->{$intf} and $ifaddrs->{$intf}{$rid} > 1)
!ll&&!rl&&r
28261
$ifaddrs->{$intf} and $ifaddrs->{$intf}{$rid} > 1
!ll&&!rl&&r
0261
MC/DC66%2/3
$type eq "pointtopoint" and ($ifaddrs->{$intf} and $ifaddrs->{$intf}{$rid} > 1)
$type eq "pointtopoint" $ifaddrs->{$intf} $ifaddrs->{$intf}{$rid} > 1
Truth table75%3/4
A and B and C
A= $type eq "pointtopoint"B= $ifaddrs->{$intf}C= $ifaddrs->{$intf}{$rid} > 1
ABCresult
0XX0
10X0
1100
1111
518 $ifaddrs->{$intf}{$rid} > 1) {
519 $self->error($colors{green} =
520 1 "$name link at router $rid to router $dstrid ".
521 "interface address $intf not unique.");
522 }
523 55 delete $colors{blue};
524 55 ▶ if ($type eq "pointtopoint" and my @badrids = sort
Branch: 1 branch
BranchTrueFalseTotal
if ($type eq "pointtopoint" and my(@badrids) = sort(grep({$_ ne $rid;} keys %{$$ifaddrs{$intf};}))) 1 54 55
Condition100%3/3
$type eq "pointtopoint" and my(@badrids) = sort(grep({$_ ne $rid;} keys %{$$ifaddrs{$intf};}))
!ll&&!rl&&r
28261
MC/DC100%2/2
$type eq "pointtopoint" and my(@badrids) = sort(grep({$_ ne $rid;} keys %{$$ifaddrs{$intf};}))
$type eq "pointtopoint" my(@badrids) = sort(grep({$_ ne $rid;} keys %{$$ifaddrs{$intf};}))
Truth table100%3/3
A and B
A= $type eq "pointtopoint"B= my(@badrids) = sort(grep({$_ ne $rid;} keys %{$$ifaddrs{$intf};}))
ABresult
0X0
100
111
525 28 grep { $_ ne $rid } keys %{$ifaddrs->{$intf}}) {
526 $self->error($colors{blue} =
527 1 "$name link at router $rid to router $dstrid ".
528 "interface address $intf also at router @badrids.");
529 }
530 55 my $metric = $link->{metric};
531 55 push @elements, {
532 graph => {
533 S => $src,
534 D => $dst,
535 label => $intf,
536 style => $style,
537 taillabel => $metric,
538 },
539 colors => { %colors },
540 index => $index++,
541 };
542 }
543 }
544 }
545 }
546 224 return $self->elements2graphs(@elements);
547 }
548  
549 ########################################################################
550 # RFC 2328
551 # Type Description
552 # __________________________________________________
553 # 2 Connection to a transit network
554 ########################################################################
555 # transits => [ {
556 # address => 'ipv4', # Link ID
557 # # IP address of Designated Router
558 # interface => 'ipv4', # Link Data
559 # # router interface's IP address
560 # metric => 'int', # metric
561 # ],
562 ########################################################################
563 # $transithash{$transitaddress}{$area}{$routerid} = {
564 # graph => { N => transit2, color => red, style => solid, } (optional)
565 # hashes => [ { link hash } ]
566 # }
567 # $transitnets->{$interface}{$routerid}{$area}{$address}++;
568 ########################################################################
569  
570 # take transit hash, transit cluster hash, net hash
571 # detect inconsistencies and set colors
572 sub check_transit {
573 112 ▶ my OSPF::LSDB::View $self = shift;
Subroutine check_transit: called CC=14 SCAR=26.4
Pod undocumented
574 112 my($transitcluster) = @_;
575 112 ▶ my $nethash = $self->{nethash} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $nethash = $self->{"nethash"} or die "Uninitialized member" 0 112 112
576 112 ▶ my $transithash = $self->{transithash} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $transithash = $self->{"transithash"} or die "Uninitialized member" 0 112 112
577 112 foreach my $addr (sort keys %$transithash) {
578 95 my $av = $transithash->{$addr};
579 95 my %colors;
580 95 ▶ if (! $nethash->{$addr} && keys %$av > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $nethash->{$addr} and keys %$av > 1) 3 92 95
Condition100%3/3
not $nethash->{$addr} and keys %$av > 1
!ll&&!rl&&r
8753
MC/DC100%2/2
not $nethash->{$addr} and keys %$av > 1
not $nethash->{$addr} keys %$av > 1
Truth table100%3/3
not(A) and B
A= not $nethash->{$addr}B= keys %$av > 1
ABresult
0X0
100
111
581 $self->error($colors{orange} =
582 3 "Transit network $addr missing in multiple areas.");
583 }
584 95 foreach my $area (sort keys %$av) {
585 101 my $ev = $av->{$area};
586 101 $colors{gray} = $area;
587 101 delete $colors{blue};
588 101 ▶ if (! $nethash->{$addr} && keys %$ev > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $nethash->{$addr} and keys %$ev > 1) 3 98 101
Condition100%3/3
not $nethash->{$addr} and keys %$ev > 1
!ll&&!rl&&r
9083
MC/DC100%2/2
not $nethash->{$addr} and keys %$ev > 1
not $nethash->{$addr} keys %$ev > 1
Truth table100%3/3
not(A) and B
A= not $nethash->{$addr}B= keys %$ev > 1
ABresult
0X0
100
111
589 $self->error($colors{blue} =
590 3 "Transit network $addr missing in area $area ".
591 "at multiple routers.");
592 }
593 101 foreach my $rid (sort keys %$ev) {
594 193 my $rv = $ev->{$rid};
595 193 ▶ next unless $rv->{graph};
Branch: 1 branch
BranchTrueFalseTotal
unless $rv->{"graph"} 178 15 193
596 15 delete @colors{qw(yellow red)};
597 15 ▶ if ($nethash->{$addr}) {
Branch: 2 branches
BranchTrueFalseTotal
if ($nethash->{$addr}) { } 1 14 15
elsif (not $colors{'orange'} || $colors{'blue'}) { } 3 11 14
598 $self->error($colors{yellow} =
599 1 "Transit network $addr in area $area ".
600 "at router $rid and network not in same area.");
601 ▶ } elsif (! $colors{orange} && ! $colors{blue}) {
Condition100%3/3
$colors{'orange'} || $colors{'blue'}
l!l&&r!l&&!r
743
MC/DC100%2/2
$colors{'orange'} || $colors{'blue'}
$colors{'orange'} $colors{'blue'}
Truth table100%3/3
A || B
A= $colors{'orange'}B= $colors{'blue'}
ABresult
1X1
011
000
602 $self->error($colors{red} =
603 3 "Transit network $addr network missing.");
604 }
605 15 %{$rv->{colors}} = %colors;
606 15 push @{$transitcluster->{$addr}}, $rv->{graph};
607 }
608 }
609 }
610 }
611  
612 # take transit hash, router id, area, link structure, network hash
613 # add new element to transit hash
614 sub add_transit_value {
615 195 ▶ my OSPF::LSDB::View $self = shift;
Subroutine add_transit_value: called CC=6 SCAR=17.9
Pod undocumented
616 195 my($transithash, $transitnets, $index, $rid, $area, $link) = @_;
617 195 ▶ my $nethash = $self->{nethash} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $nethash = $self->{"nethash"} or die "Uninitialized member" 0 195 195
618 195 my $addr = $link->{address};
619 195 my $intf = $link->{interface};
620 195 $transitnets->{$intf}{$rid}{$area}{$addr}++;
621 195 my $elem = $transithash->{$addr}{$area}{$rid};
622 195 ▶ if (! $elem) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($elem) 193 2 195
623 193 $transithash->{$addr}{$area}{$rid} = $elem = {};
624 # check if address is in nethash and in matching nethash area
625 193 ▶ if (! $nethash->{$addr} || ! map { $_->{$area} ? 1 : () }
Branch: 2 branches
BranchTrueFalseTotal
unless ($nethash->{$addr} and map {$_->{$area} ? 1 : ();} map({values %$_;} values %{$$nethash{$addr};})) 15 178 193
$_->{$area} ? : 182 5 187
Condition100%3/3
$nethash->{$addr} and map {$_->{$area} ? 1 : ();} map({values %$_;} values %{$$nethash{$addr};})
!ll&&!rl&&r
141178
MC/DC100%2/2
$nethash->{$addr} and map {$_->{$area} ? 1 : ();} map({values %$_;} values %{$$nethash{$addr};})
$nethash->{$addr} map {$_->{$area} ? 1 : ();} map({values %$_;} values %{$$nethash{$addr};})
Truth table100%3/3
A and B
A= $nethash->{$addr}B= map {$_->{$area} ? 1 : ();} map({values %$_;} values %{$$nethash{$addr};})
ABresult
0X0
100
111
626 181 map { values %$_ } values %{$nethash->{$addr}}) {
627 $elem->{graph} = {
628 15 N => "transitnet$$index",
629 label => $addr,
630 shape => "ellipse",
631 style => "dotted",
632 };
633 15 $elem->{index} = $$index++;
634 }
635 }
636 195 push @{$elem->{hashes}}, $link;
637 }
638  
639 # take hash containing transit network nodes
640 # return list of nodes
641 sub transit2nodes {
642 112 ▶ my OSPF::LSDB::View $self = shift;
Subroutine transit2nodes: called CC=2 SCAR=7.0
Pod undocumented
643 112 ▶ my $transithash = $self->{transithash} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $transithash = $self->{"transithash"} or die "Uninitialized member" 0 112 112
644 112 return $self->elements2graphs(map { values %$_ } map { values %$_ }
645 values %$transithash);
646 }
647  
648 # take link hash, router hash, network hash
649 # return list of edges from router to transit network
650 sub transit2edges {
651 112 ▶ my OSPF::LSDB::View $self = shift;
Subroutine transit2edges: called CC=23 SCAR=31.4
Pod undocumented
652 112 ▶ my $nethash = $self->{nethash} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $nethash = $self->{"nethash"} or die "Uninitialized member" 0 112 112
653 112 ▶ my $routehash = $self->{routehash} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $routehash = $self->{"routehash"} or die "Uninitialized member" 0 112 112
654 112 ▶ my $transithash = $self->{transithash} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $transithash = $self->{"transithash"} or die "Uninitialized member" 0 112 112
655 112 my $ifaddrs = $self->{ifaddrs};
656 112 my @elements;
657 112 my $index = 0;
658 112 foreach my $addr (sort keys %$transithash) {
659 95 my $av = $transithash->{$addr};
660 95 foreach my $area (sort keys %$av) {
661 101 my $ev = $av->{$area};
662 101 foreach my $rid (sort keys %$ev) {
663 193 my $rv = $ev->{$rid};
664 193 my %colors = (gray => $area);
665 193 my $src = $routehash->{$rid}{graph}{N};
666 193 ▶ if (@{$rv->{hashes}} > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@{$rv->{"hashes"};} > 1) 2 191 193
667 $self->error($colors{yellow} =
668 2 "Transit network $addr at router $rid ".
669 "has multiple entries in area $area.");
670 }
671 193 foreach my $link (@{$rv->{hashes}}) {
672 195 my $intf = $link->{interface};
673 195 delete $colors{green};
674 195 ▶ if ($ifaddrs->{$intf} && $ifaddrs->{$intf}{$rid} > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ifaddrs->{$intf} and $ifaddrs->{$intf}{$rid} > 1) 3 192 195
Condition66%2/3
$ifaddrs->{$intf} and $ifaddrs->{$intf}{$rid} > 1
!ll&&!rl&&r
01923
MC/DC50%1/2
$ifaddrs->{$intf} and $ifaddrs->{$intf}{$rid} > 1
$ifaddrs->{$intf} $ifaddrs->{$intf}{$rid} > 1
Truth table66%2/3
A and B
A= $ifaddrs->{$intf}B= $ifaddrs->{$intf}{$rid} > 1
ABresult
0X0
100
111
675 $self->error($colors{green} =
676 3 "Transit link at router $rid to network $addr ".
677 "interface address $intf not unique.");
678 }
679 195 delete $colors{blue};
680 195 ▶ if (my @badrids = sort grep { $_ ne $rid }
Branch: 1 branch
BranchTrueFalseTotal
if (my(@badrids) = sort(grep({$_ ne $rid;} keys %{$$ifaddrs{$intf};}))) 3 192 195
681 195 keys %{$ifaddrs->{$intf}}) {
682 $self->error($colors{blue} =
683 3 "Transit link at router $rid to network $addr ".
684 "interface address $intf also at router @badrids.");
685 }
686 195 my $metric = $link->{metric};
687 # link from designated router to attached net
688 195 ▶ my $style = $addr eq $intf ? "bold" : "solid";
Branch: 1 branch
BranchTrueFalseTotal
$addr eq $intf ? : 81 114 195
689 195 delete $colors{magenta};
690 195 delete $colors{brown};
691 195 delete $colors{tan};
692 195 ▶ if ($rv->{graph}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rv->{"graph"}) 16 179 195
693 16 my $dst = $rv->{graph}{N};
694 16 push @elements, {
695 graph => {
696 S => $src,
697 D => $dst,
698 headlabel => $intf,
699 style => $style,
700 taillabel => $metric,
701 },
702 colors => { %colors },
703 index => $index++,
704 };
705 16 next;
706 }
707 179 my $av = $nethash->{$addr};
708 179 foreach my $mask (sort keys %$av) {
709 181 my $mv = $av->{$mask};
710 181 my $nid = "$addr/$mask";
711 181 my $intfip = $intf;
712 181 foreach (split(/\./, $mask)) {
713 724 ▶ last if $_ ne 255;
Branch: 1 branch
BranchTrueFalseTotal
if $_ ne 255 181 543 724
714 543 $intfip =~ s/^\.?\d+//;
715 }
716 181 delete $colors{magenta};
717 181 ▶ if (_maskip($addr, $mask) ne _maskip($intf, $mask)) {
Branch: 1 branch
BranchTrueFalseTotal
if (&_maskip($addr, $mask) ne &_maskip($intf, $mask)) 1 180 181
718 $self->error($colors{magenta} =
719 1 "Transit network $addr in area $area ".
720 "at router $rid interface $intf ".
721 "not in network $nid.");
722 1 $intfip = $intf;
723 }
724 181 foreach my $netrid (sort keys %$mv) {
725 187 my $nv = $mv->{$netrid};
726 187 ▶ my $ev = $nv->{$area}
Branch: 1 branch
BranchTrueFalseTotal
my $ev = $nv->{$area} or next 4 183 187
727 or next;
728 183 delete $colors{brown};
729 183 delete $colors{tan};
730 183 ▶ if (! $ev->{attachrouters}{$rid}) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $ev->{'attachrouters'}{$rid}) { } 2 181 183
elsif ($addr eq $intf and $netrid ne $rid) { } 2 286 288
731 $self->error($colors{brown} =
732 2 "Transit link at router $rid not attached ".
733 "by network $nid in area $area.");
734 ▶ } elsif ($addr eq $intf && $netrid ne $rid) {
Condition100%3/3
$addr eq $intf and $netrid ne $rid
!ll&&!rl&&r
107722
MC/DC100%2/2
$addr eq $intf and $netrid ne $rid
$addr eq $intf $netrid ne $rid
Truth table100%3/3
A and B
A= $addr eq $intfB= $netrid ne $rid
ABresult
0X0
100
111
735 $self->error($colors{tan} =
736 2 "Transit link at router $rid in area $area ".
737 "is designated but network $nid is not.");
738 }
739 183 my $dst = $ev->{graph}{N};
740 183 push @elements, {
741 graph => {
742 S => $src,
743 D => $dst,
744 headlabel => $intfip,
745 style => $style,
746 taillabel => $metric,
747 },
748 colors => { %colors },
749 index => $index++,
750 };
751 }
752 }
753 }
754 }
755 }
756 }
757 112 return $self->elements2graphs(@elements);
758 }
759  
760 ########################################################################
761 # RFC 2328
762 # Type Description
763 # __________________________________________________
764 # 3 Connection to a stub network
765 ########################################################################
766 # stubs => [ {
767 # metric => 'int', # metric
768 # netmask => 'ipv4', # Link Data
769 # # network's IP address mask
770 # network => 'ipv4', # Link ID
771 # # IP network/subnet number
772 # ],
773 ########################################################################
774 # $network = $network & $netmask
775 # $stubhash{$network}{$netmask}{$area}{$routerid} = {
776 # graph => { N => stub3, color => red, style => solid, }
777 # hashes => [ { link hash } ]
778 # }
779 ########################################################################
780  
781 # take transit hash, net cluster hash, network hash
782 # detect inconsistencies and set colors
783 sub check_stub {
784 112 ▶ my OSPF::LSDB::View $self = shift;
Subroutine check_stub: called CC=16 SCAR=27.7
Pod undocumented
785 112 my($netcluster) = @_;
786 112 ▶ my $nethash = $self->{nethash} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $nethash = $self->{"nethash"} or die "Uninitialized member" 0 112 112
787 112 my %netsmv;
788 112 foreach my $addr (sort keys %$nethash) {
789 88 my $av = $nethash->{$addr};
790 88 foreach my $mask (sort keys %$av) {
791 89 my $mv = $av->{$mask};
792 89 my $net = _maskip($addr, $mask);
793 89 push @{$netsmv{$net}{$mask}}, $mv;
794 }
795 }
796  
797 112 ▶ my $stubhash = $self->{stubhash} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $stubhash = $self->{"stubhash"} or die "Uninitialized member" 0 112 112
798 112 foreach my $net (sort keys %$stubhash) {
799 31 my $nv = $stubhash->{$net};
800 31 foreach my $mask (sort keys %$nv) {
801 31 my $mv = $nv->{$mask};
802 31 my %colors;
803 31 my $nid = "$net/$mask";
804 31 ▶ if ($netsmv{$net}{$mask}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($netsmv{$net}{$mask}) 5 26 31
805 $self->error($colors{blue} =
806 5 "Stub network $nid is also network.");
807 }
808 31 delete $colors{orange};
809 31 ▶ if (keys %$mv > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (keys %$mv > 1) 1 30 31
810 $self->error($colors{orange} =
811 1 "Stub network $nid in multiple areas.");
812 }
813 31 foreach my $area (sort keys %$mv) {
814 32 my $ev = $mv->{$area};
815 32 $colors{gray} = $area;
816 32 delete $colors{green};
817 32 ▶ if (keys %$ev > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (keys %$ev > 1) 1 31 32
818 $self->error($colors{green} =
819 1 "Stub network $nid in area $area at multiple routers.");
820 }
821 32 delete $colors{magenta};
822 32 ▶ if ($netsmv{$net}{$mask} and my @otherareas = sort
Branch: 1 branch
BranchTrueFalseTotal
if ($netsmv{$net}{$mask} and my(@otherareas) = sort(grep({$_ ne $area;} map({keys %$_;} map({values %$_;} @{$netsmv{$net}{$mask};}))))) 1 31 32
Condition100%3/3
$netsmv{$net}{$mask} and my(@otherareas) = sort(grep({$_ ne $area;} map({keys %$_;} map({values %$_;} @{$netsmv{$net}{$mask};}))))
!ll&&!rl&&r
2741
MC/DC100%2/2
$netsmv{$net}{$mask} and my(@otherareas) = sort(grep({$_ ne $area;} map({keys %$_;} map({values %$_;} @{$netsmv{$net}{$mask};}))))
$netsmv{$net}{$mask} my(@otherareas) = sort(grep({$_ ne $area;} map({keys %$_;} map({values %$_;} @{$netsmv{$net}{$mask};}))))
Truth table100%3/3
A and B
A= $netsmv{$net}{$mask}B= my(@otherareas) = sort(grep({$_ ne $area;} map({keys %$_;} map({values %$_;} @{$netsmv{$net}{$mask};}))))
ABresult
0X0
100
111
823 7 grep { $_ ne $area } map { keys %$_ } map { values %$_ }
824 5 @{$netsmv{$net}{$mask}}) {
825 $self->error($colors{magenta} =
826 1 "Stub network $nid in area $area ".
827 "is also network in areas @otherareas.");
828 }
829 32 foreach my $rid (sort keys %$ev) {
830 33 my $rv = $ev->{$rid};
831 33 delete $colors{yellow};
832 33 ▶ if ($netsmv{$net}{$mask} and grep { $_->{$rid} }
Branch: 1 branch
BranchTrueFalseTotal
if ($netsmv{$net}{$mask} and grep {$_->{$rid};} @{$netsmv{$net}{$mask};}) 1 32 33
Condition100%3/3
$netsmv{$net}{$mask} and grep {$_->{$rid};} @{$netsmv{$net}{$mask};}
!ll&&!rl&&r
2841
MC/DC100%2/2
$netsmv{$net}{$mask} and grep {$_->{$rid};} @{$netsmv{$net}{$mask};}
$netsmv{$net}{$mask} grep {$_->{$rid};} @{$netsmv{$net}{$mask};}
Truth table100%3/3
A and B
A= $netsmv{$net}{$mask}B= grep {$_->{$rid};} @{$netsmv{$net}{$mask};}
ABresult
0X0
100
111
833 5 @{$netsmv{$net}{$mask}}) {
834 $self->error($colors{yellow} =
835 1 "Stub network $nid is also network at router $rid.");
836 }
837 33 %{$rv->{colors}} = %colors;
838 33 push @{$netcluster->{"$net/$mask"}}, $rv->{graph};
839 }
840 }
841 }
842 }
843 }
844  
845 # take stub hash, router id, area, link structure
846 # add new element to stub hash
847 sub add_stub_value {
848 36 ▶ my OSPF::LSDB::View $self = shift;
Subroutine add_stub_value: called CC=2 SCAR=6.9
Pod undocumented
849 36 my($stubhash, $stubs, $stubareas, $index, $rid, $area, $link) = @_;
850 36 my $addr = $link->{network};
851 36 my $mask = $link->{netmask};
852 36 my $net = _maskip($addr, $mask);
853 36 $stubs->{$net}{$mask}++;
854 36 $stubareas->{$net}{$mask}{$area}++;
855 36 my $elem = $stubhash->{$net}{$mask}{$area}{$rid};
856 36 ▶ if (! $elem) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($elem) 33 3 36
857 33 $stubhash->{$net}{$mask}{$area}{$rid} = $elem = {};
858 $elem->{graph} = {
859 33 N => "stubnet$$index",
860 label => "$net\\n$mask",
861 shape => "ellipse",
862 style => "solid",
863 };
864 33 $elem->{index} = $$index++;
865 }
866 36 push @{$elem->{hashes}}, $link;
867 }
868  
869 # take hash containing stub network nodes
870 # return list of nodes
871 sub stub2nodes {
872 112 ▶ my OSPF::LSDB::View $self = shift;
Subroutine stub2nodes: called CC=2 SCAR=7.0
Pod undocumented
873 112 ▶ my $stubhash = $self->{stubhash} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $stubhash = $self->{"stubhash"} or die "Uninitialized member" 0 112 112
874 32 return $self->elements2graphs(map { values %$_ } map { values %$_ }
875 112 map { values %$_ } values %$stubhash);
876 }
877  
878 # take link hash, router hash
879 # return list of edges from router to stub network
880 sub stub2edges {
881 112 ▶ my OSPF::LSDB::View $self = shift;
Subroutine stub2edges: called CC=12 SCAR=24.9
Pod undocumented
882 112 ▶ my $routehash = $self->{routehash} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $routehash = $self->{"routehash"} or die "Uninitialized member" 0 112 112
883 112 ▶ my $stubhash = $self->{stubhash} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $stubhash = $self->{"stubhash"} or die "Uninitialized member" 0 112 112
884 112 my @elements;
885 112 my $index = 0;
886 112 foreach my $net (sort keys %$stubhash) {
887 31 my $nv = $stubhash->{$net};
888 31 foreach my $mask (sort keys %$nv) {
889 31 my $mv = $nv->{$mask};
890 31 foreach my $area (sort keys %$mv) {
891 32 my $ev = $mv->{$area};
892 32 foreach my $rid (sort keys %$ev) {
893 33 my $rv = $ev->{$rid};
894 33 my %colors = (gray => $area);
895 33 my $src = $routehash->{$rid}{graph}{N};
896 33 my $nid = "$net/$mask";
897 33 ▶ if (@{$rv->{hashes}} > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@{$rv->{"hashes"};} > 1) 2 31 33
898 $self->error($colors{yellow} =
899 2 "Stub network $nid at router $rid ".
900 "has multiple entries in area $area.");
901 }
902 33 foreach my $link (@{$rv->{hashes}}) {
903 36 my $dst = $rv->{graph}{N};
904 36 my $addr = $link->{network};
905 36 my @headlabel;
906 36 delete $colors{magenta};
907 36 ▶ if ($net ne $addr) {
Branch: 1 branch
BranchTrueFalseTotal
if ($net ne $addr) 3 33 36
908 $self->error($colors{magenta} =
909 3 "Stub network $nid address $addr ".
910 "is not network.");
911 3 my $intfip = $addr;
912 3 foreach (split(/\./, $mask)) {
913 12 ▶ last if $_ ne 255;
Branch: 1 branch
BranchTrueFalseTotal
if $_ ne 255 3 9 12
914 9 $intfip =~ s/^\.?\d+//;
915 }
916 3 @headlabel = (headlabel => $intfip);
917 }
918 36 my $metric = $link->{metric};
919 36 push @elements, {
920 graph => {
921 S => $src,
922 D => $dst,
923 @headlabel,
924 style => "solid",
925 taillabel => $metric,
926 },
927 colors => { %colors },
928 index => $index++,
929 };
930 }
931 }
932 }
933 }
934 }
935 112 return $self->elements2graphs(@elements);
936 }
937  
938 ########################################################################
939 # RFC 2328
940 # LS LSA LSA description
941 # type name
942 # ________________________________________________________
943 # 2 Network-LSAs Originated for broadcast
944 # and NBMA networks by
945 # the Designated Router. This
946 # LSA contains the
947 # list of routers connected
948 # to the network. Flooded
949 # throughout a single area only.
950 ########################################################################
951 # networks => [
952 # address => 'ipv4', # Link State ID
953 # area => 'ipv4',
954 # attachments => [
955 # routerid => 'ipv4', # Attached Router
956 # ],
957 # netmask => 'ipv4', # Network Mask
958 # routerid => 'ipv4', # Advertising Router
959 # ],
960 ########################################################################
961 # $network = $address & $netmask
962 # $nethash{$address}{$netmask}{$routerid}{$area} = {
963 # graph => { N => network1, color => red, style => bold, }
964 # hashes => [ { network hash } ]
965 # attachrouters => { $attrid => 1 }
966 # }
967 # $nets{$network}{$netmask}++
968 # $netareas{$network}{$netmask}{$area}++
969 ########################################################################
970  
971 # take network hash, net cluster hash, net hash
972 # detect inconsistencies and set colors
973 sub check_network {
974 112 ▶ my OSPF::LSDB::View $self = shift;
Subroutine check_network: called CC=14 SCAR=26.4
Pod undocumented
975 112 my($netcluster) = @_;
976 112 ▶ my $nethash = $self->{nethash} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $nethash = $self->{"nethash"} or die "Uninitialized member" 0 112 112
977 112 ▶ my $nets = $self->{nets} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $nets = $self->{"nets"} or die "Uninitialized member" 0 112 112
978 112 my %colors;
979 112 foreach my $addr (sort keys %$nethash) {
980 88 my $av = $nethash->{$addr};
981 88 delete $colors{magenta};
982 88 ▶ if (keys %$av > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (keys %$av > 1) 1 87 88
983 $self->error($colors{magenta} =
984 1 "Network $addr with multiple netmasks.");
985 }
986 88 foreach my $mask (sort keys %$av) {
987 89 my $mv = $av->{$mask};
988 89 my $nid = "$addr/$mask";
989 89 my $net = _maskip($addr, $mask);
990 89 delete $colors{green};
991 89 ▶ if ($nets->{$net}{$mask} > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nets->{$net}{$mask} > 1) 11 78 89
992 $self->error($colors{green} =
993 11 "Network $nid not unique in network $net.");
994 }
995 89 delete $colors{blue};
996 89 ▶ if (keys %$mv > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (keys %$mv > 1) 2 87 89
997 $self->error($colors{blue} =
998 2 "Network $nid at multiple routers.");
999 }
1000 89 foreach my $rid (sort keys %$mv) {
1001 91 my $rv = $mv->{$rid};
1002 91 delete $colors{orange};
1003 91 ▶ if (keys %$rv > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (keys %$rv > 1) 1 90 91
1004 $self->error($colors{orange} =
1005 1 "Network $nid at router $rid in multiple areas.");
1006 }
1007 91 foreach my $area (sort keys %$rv) {
1008 92 my $ev = $rv->{$area};
1009 92 $colors{gray} = $area;
1010 92 delete $colors{yellow};
1011 92 ▶ if (@{$ev->{hashes}} > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@{$ev->{"hashes"};} > 1) 2 90 92
1012 $self->error($colors{yellow} =
1013 2 "Network $nid at router $rid ".
1014 "has multiple entries in area $area.");
1015 }
1016 92 delete $colors{brown};
1017 92 my @attrids = keys %{$ev->{attachrouters}};
1018 92 ▶ if (@attrids == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (@attrids == 0) 1 91 92
1019 $self->error($colors{red} =
1020 1 "Network $nid at router $rid not attached ".
1021 "to any router in area $area.");
1022 }
1023 92 ▶ if (@attrids == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@attrids == 1) 1 91 92
1024 $self->error($colors{brown} =
1025 1 "Network $nid at router $rid attached only ".
1026 "to router @attrids in area $area.");
1027 }
1028 92 %{$ev->{colors}} = %colors;
1029 92 push @{$netcluster->{"$net/$mask"}}, $ev->{graph};
1030 }
1031 }
1032 }
1033 }
1034 }
1035  
1036 # take network structure, net cluster hash
1037 # return network hash
1038 sub create_network {
1039 112 ▶ my OSPF::LSDB::View $self = shift;
Subroutine create_network: called CC=4 SCAR=13.9
Pod undocumented
1040 112 my($index) = @_;
1041 112 my %nethash;
1042 my %nets;
1043 112 my %netareas;
1044 112 foreach my $n (@{$self->{ospf}{database}{networks}}) {
1045 94 my $addr = $n->{address};
1046 94 my $mask = $n->{netmask};
1047 94 my $nid = "$addr/$mask";
1048 94 my $net = _maskip($addr, $mask);
1049 94 $nets{$net}{$mask}++;
1050 94 my $rid = $n->{routerid};
1051 94 my $area = $n->{area};
1052 94 $netareas{$net}{$mask}{$area}++;
1053 94 my $elem = $nethash{$addr}{$mask}{$rid}{$area};
1054 94 ▶ if (! $elem) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($elem) 92 2 94
1055 92 $nethash{$addr}{$mask}{$rid}{$area} = $elem = {};
1056 $elem->{graph} = {
1057 92 N => "network$$index",
1058 label => "$net\\n$mask",
1059 shape => "ellipse",
1060 style => "bold",
1061 };
1062 92 $elem->{index} = $$index++;
1063 }
1064 94 push @{$elem->{hashes}}, $n;
1065 94 foreach my $att (@{$n->{attachments}}) {
1066 196 $elem->{attachrouters}{$att->{routerid}} = 1;
1067 }
1068 }
1069 112 $self->{nethash} = \%nethash;
1070 112 $self->{nets} = \%nets;
1071 112 $self->{netareas} = \%netareas;
1072 }
1073  
1074 # only necessary for ipv6
1075 sub add_missing_network {
1076 112 ▶ my OSPF::LSDB::View $self = shift;
Subroutine add_missing_network: called CC=1 SCAR=0.0
Pod undocumented
1077 112 my($index) = @_;
1078 }
1079  
1080 # take hash containing network nodes
1081 # return list of nodes
1082 sub network2nodes {
1083 112 ▶ my OSPF::LSDB::View $self = shift;
Subroutine network2nodes: called CC=2 SCAR=7.0
Pod undocumented
1084 112 ▶ my $nethash = $self->{nethash} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $nethash = $self->{"nethash"} or die "Uninitialized member" 0 112 112
1085 91 return $self->elements2graphs(map { values %$_ } map { values %$_ }
1086 112 map { values %$_ } values %$nethash);
1087 }
1088  
1089 # take network hash, router hash
1090 # return list of edges from transit network to router
1091 sub network2edges {
1092 112 ▶ my OSPF::LSDB::View $self = shift;
Subroutine network2edges: called CC=25 SCAR=32.2
Pod undocumented
1093 112 ▶ my $nethash = $self->{nethash} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $nethash = $self->{"nethash"} or die "Uninitialized member" 0 112 112
1094 112 ▶ my $routehash = $self->{routehash} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $routehash = $self->{"routehash"} or die "Uninitialized member" 0 112 112
1095 112 ▶ my $transithash = $self->{transithash} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $transithash = $self->{"transithash"} or die "Uninitialized member" 0 112 112
1096 112 my @elements;
1097 112 my $index = 0;
1098 112 foreach my $addr (sort keys %$nethash) {
1099 88 my $av = $nethash->{$addr};
1100 88 foreach my $mask (sort keys %$av) {
1101 89 my $mv = $av->{$mask};
1102 89 my $nid = "$addr/$mask";
1103 89 my $intfip = $addr;
1104 89 foreach (split(/\./, $mask)) {
1105 356 ▶ last if $_ ne 255;
Branch: 1 branch
BranchTrueFalseTotal
if $_ ne 255 89 267 356
1106 267 $intfip =~ s/^\.?\d+//;
1107 }
1108 89 foreach my $rid (sort keys %$mv) {
1109 91 my $rv = $mv->{$rid};
1110 91 foreach my $area (sort keys %$rv) {
1111 92 my $ev = $rv->{$area};
1112 92 my $src = $ev->{graph}{N};
1113 92 foreach my $net (@{$ev->{hashes}}) {
1114 94 my %attcolors;
1115 94 foreach (@{$net->{attachments}}) {
1116 196 my $arid = $_->{routerid};
1117 196 ▶ if ($attcolors{$arid}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($attcolors{$arid}) 2 194 196
1118 $self->error($attcolors{$arid}{yellow} =
1119 2 "Network $nid in area $area at router $rid ".
1120 "attached to router $arid multiple times.");
1121 2 next;
1122 }
1123 194 $attcolors{$arid}{gray} = $area;
1124 194 ▶ if ($routehash->{$arid}{areas} &&
Branch: 1 branch
BranchTrueFalseTotal
if ($routehash->{$arid}{"areas"} and not $routehash->{$arid}{"areas"}{$area}) 4 190 194
Condition66%2/3
$routehash->{$arid}{"areas"} and not $routehash->{$arid}{"areas"}{$area}
!ll&&!rl&&r
01904
MC/DC50%1/2
$routehash->{$arid}{"areas"} and not $routehash->{$arid}{"areas"}{$area}
$routehash->{$arid}{"areas"} not $routehash->{$arid}{"areas"}{$area}
Truth table66%2/3
A and not(B)
A= $routehash->{$arid}{"areas"}B= not $routehash->{$arid}{"areas"}{$area}
ABresult
0X0
100
111
1125 ! $routehash->{$arid}{areas}{$area}) {
1126 $self->error($attcolors{$arid}{orange} =
1127 4 "Network $nid and router $arid ".
1128 "not in same area $area.");
1129 4 next;
1130 }
1131 190 my $tv = $transithash->{$addr}{$area}{$arid};
1132 190 ▶ if (! $tv && ! $routehash->{$arid}{missing}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($tv or $routehash->{$arid}{"missing"}) 1 189 190
Condition100%3/3
$tv or $routehash->{$arid}{"missing"}
l!l&&r!l&&!r
18361
MC/DC100%2/2
$tv or $routehash->{$arid}{"missing"}
$tv $routehash->{$arid}{"missing"}
Truth table100%3/3
A or B
A= $tvB= $routehash->{$arid}{"missing"}
ABresult
1X1
011
000
1133 $self->error($attcolors{$arid}{brown} =
1134 1 "Network $nid not transit net ".
1135 "of attached router $arid in area $area.");
1136 1 next;
1137 }
1138 189 ▶ if ($arid eq $rid && $tv && ! grep { $addr eq
Branch: 1 branch
BranchTrueFalseTotal
if ($arid eq $rid and $tv and not grep({$addr eq $_->{"interface"};} @{$$tv{"hashes"};})) 11 178 189
Condition100%6/6
$arid eq $rid and $tv and not grep({$addr eq $_->{"interface"};} @{$$tv{"hashes"};})
!ll&&!rl&&r
1047411
$arid eq $rid and $tv
!ll&&!rl&&r
101385
MC/DC100%3/3
$arid eq $rid and $tv and not grep({$addr eq $_->{"interface"};} @{$$tv{"hashes"};})
$arid eq $rid $tv not grep({$addr eq $_->{"interface"};} @{$$tv{"hashes"};})
Truth table100%4/4
A and B and not(C)
A= $arid eq $ridB= $tvC= not grep({$addr eq $_->{"interface"};} @{$$tv{"hashes"};})
ABCresult
0XX0
10X0
1100
1111
1139 86 $_->{interface} } @{$tv->{hashes}}) {
1140 $self->error($attcolors{$arid}{tan} =
1141 11 "Network $nid at router $arid in area $area ".
1142 "is designated but transit link is not.");
1143 11 next;
1144 }
1145 }
1146 94 foreach (@{$net->{attachments}}) {
1147 196 my $arid = $_->{routerid};
1148 my $dst = $routehash->{$arid}{graph}{N}
1149 196 ▶ or die "No router graph $arid";
Branch: 1 branch
BranchTrueFalseTotal
my $dst = $routehash->{$arid}{"graph"}{"N"} or die "No router graph $arid" 0 196 196
1150 196 my $style = "solid";
1151 196 my @taillabel;
1152 196 ▶ if ($arid eq $rid) {
Branch: 1 branch
BranchTrueFalseTotal
if ($arid eq $rid) 93 103 196
1153 # router is designated router
1154 93 $style = "bold";
1155 93 @taillabel = (taillabel => $intfip);
1156 }
1157 push @elements, {
1158 graph => {
1159 S => $src,
1160 D => $dst,
1161 style => $style,
1162 @taillabel,
1163 },
1164 196 colors => { %{$attcolors{$arid}} },
1165 index => $index++,
1166 };
1167 }
1168 94 ▶ if (! $attcolors{$rid}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($attcolors{$rid}) 3 91 94
1169 my $dst = $routehash->{$rid}{graph}{N}
1170 3 ▶ or die "No router graph $rid";
Branch: 1 branch
BranchTrueFalseTotal
my $dst = $routehash->{$rid}{"graph"}{"N"} or die "No router graph $rid" 0 3 3
1171 3 $attcolors{$rid}{gray} = $area;
1172 $self->error($attcolors{$rid}{red} =
1173 3 "Network $nid not attached ".
1174 "to designated router $rid in area $area.");
1175 push @elements, {
1176 graph => {
1177 S => $src,
1178 D => $dst,
1179 style => "bold",
1180 taillabel => $intfip,
1181 },
1182 3 colors => { %{$attcolors{$rid}} },
1183 index => $index++,
1184 };
1185 }
1186 }
1187 }
1188 }
1189 }
1190 }
1191 112 return $self->elements2graphs(@elements);
1192 }
1193  
1194 ########################################################################
1195 # RFC 2328
1196 # LS LSA LSA description
1197 # type name
1198 # ________________________________________________________
1199 # 3 Summary-LSAs Originated by area border
1200 # routers, and flooded through-
1201 # out the LSA's associated
1202 # area. Each summary-LSA
1203 # describes a route to a
1204 # destination outside the area,
1205 # yet still inside the AS
1206 # (i.e., an inter-area route).
1207 # Type 3 summary-LSAs describe
1208 # routes to networks. Type 4
1209 # summary-LSAs describe
1210 # routes to AS boundary routers.
1211 ########################################################################
1212 # summarys => [
1213 # address => 'ipv4', # Link State ID
1214 # area => 'ipv4',
1215 # metric => 'int', # metric
1216 # netmask => 'ipv4', # Network Mask
1217 # routerid => 'ipv4', # Advertising Router
1218 # ],
1219 ########################################################################
1220 # $network = $address & $netmask
1221 # $sumhash{$network}{$netmask} = {
1222 # graph => { N => summary4, color => red, style => solid, }
1223 # hashes => [ { summary hash } ]
1224 # arearids => { $area => { $routerid => 1 } }
1225 # }
1226 # $sums{$network}{$netmask}++;
1227 ########################################################################
1228  
1229 # take summary hash, net cluster hash, network hash, stub hash
1230 # detect inconsistencies and set colors
1231 sub check_summary {
1232 92 ▶ my OSPF::LSDB::View $self = shift;
Subroutine check_summary: called CC=10 SCAR=23.1
Pod undocumented
1233 92 my($netcluster) = @_;
1234 92 ▶ my $netareas = $self->{netareas} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $netareas = $self->{"netareas"} or die "Uninitialized member" 0 92 92
1235 92 ▶ my $stubareas = $self->{stubareas} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $stubareas = $self->{"stubareas"} or die "Uninitialized member" 0 92 92
1236 92 ▶ my $sumhash = $self->{sumhash} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $sumhash = $self->{"sumhash"} or die "Uninitialized member" 0 92 92
1237 92 foreach my $net (sort keys %$sumhash) {
1238 55 my $nv = $sumhash->{$net};
1239 55 foreach my $mask (sort keys %$nv) {
1240 55 my $mv = $nv->{$mask};
1241 55 my %colors;
1242 55 my $nid = "$net/$mask";
1243 55 my @areas = sort keys %{$mv->{arearids}};
1244 55 ▶ if (@areas > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@areas > 1) { } 25 30 55
1245 25 $colors{black} = \@areas;
1246 } else {
1247 30 $colors{gray} = $areas[0];
1248 }
1249 55 ▶ if (my @badareas = grep { $netareas->{$net}{$mask}{$_} } @areas) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@badareas) = grep({$netareas->{$net}{$mask}{$_};} @areas)) 2 53 55
1250 $self->error($colors{blue} =
1251 2 "Summary network $nid is also network in areas @badareas.");
1252 }
1253 55 ▶ if ($stubareas and
Branch: 1 branch
BranchTrueFalseTotal
if ($stubareas and my(@badareas) = grep({$stubareas->{$net}{$mask}{$_};} @areas)) 3 52 55
Condition66%2/3
$stubareas and my(@badareas) = grep({$stubareas->{$net}{$mask}{$_};} @areas)
!ll&&!rl&&r
0523
MC/DC50%1/2
$stubareas and my(@badareas) = grep({$stubareas->{$net}{$mask}{$_};} @areas)
$stubareas my(@badareas) = grep({$stubareas->{$net}{$mask}{$_};} @areas)
Truth table66%2/3
A and B
A= $stubareasB= my(@badareas) = grep({$stubareas->{$net}{$mask}{$_};} @areas)
ABresult
0X0
100
111
1254 80 my @badareas = grep { $stubareas->{$net}{$mask}{$_} } @areas) {
1255 $self->error($colors{green} =
1256 3 "Summary network $nid is also stub network ".
1257 "in areas @badareas.");
1258 }
1259 55 $mv->{colors} = \%colors;
1260 55 push @{$netcluster->{"$net/$mask"}}, $mv->{graph};
1261 }
1262 }
1263 }
1264  
1265 # take summary structure, net cluster hash, network hash, link hash
1266 # return summary hash
1267 sub create_summary {
1268 92 ▶ my OSPF::LSDB::View $self = shift;
Subroutine create_summary: called CC=3 SCAR=11.0
Pod undocumented
1269 92 my $index = 0;
1270 92 my %sumhash;
1271 my %sums;
1272 92 foreach my $s (@{$self->{ospf}{database}{summarys}}) {
1273 158 my $addr = $s->{address};
1274 158 my $mask = $s->{netmask};
1275 158 my $nid = "$addr/$mask";
1276 158 my $net = _maskip($addr, $mask);
1277 158 $sums{$net}{$mask}++;
1278 158 my $rid = $s->{routerid};
1279 158 my $area = $s->{area};
1280 158 my $elem = $sumhash{$net}{$mask};
1281 158 ▶ if (! $elem) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($elem) 55 103 158
1282 55 $sumhash{$net}{$mask} = $elem = {};
1283 $elem->{graph} = {
1284 55 N => "summary$index",
1285 label => "$net\\n$mask",
1286 shape => "ellipse",
1287 style => "dashed",
1288 };
1289 55 $elem->{index} = $index++;
1290 }
1291 158 push @{$elem->{hashes}}, $s;
1292 158 $elem->{arearids}{$area}{$rid}++;
1293 }
1294 92 $self->{sumhash} = \%sumhash;
1295 92 $self->{sums} = \%sums;
1296 }
1297  
1298 # take hash containing summary nodes
1299 # return list of nodes
1300 sub summary2nodes {
1301 144 ▶ my OSPF::LSDB::View $self = shift;
Subroutine summary2nodes: called CC=2 SCAR=7.0
Pod undocumented
1302 144 ▶ my $sumhash = $self->{sumhash} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $sumhash = $self->{"sumhash"} or die "Uninitialized member" 0 144 144
1303 144 return $self->elements2graphs(map { values %$_ } values %$sumhash);
1304 }
1305  
1306 # take summary hash, router hash
1307 # return list of edges from summary network to router
1308 sub summary2edges {
1309 92 ▶ my OSPF::LSDB::View $self = shift;
Subroutine summary2edges: called CC=13 SCAR=25.7
Pod undocumented
1310 92 ▶ my $routehash = $self->{routehash} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $routehash = $self->{"routehash"} or die "Uninitialized member" 0 92 92
1311 92 ▶ my $sumhash = $self->{sumhash} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $sumhash = $self->{"sumhash"} or die "Uninitialized member" 0 92 92
1312 92 my @elements;
1313 92 my $index = 0;
1314 92 foreach my $net (sort keys %$sumhash) {
1315 55 my $nv = $sumhash->{$net};
1316 55 foreach my $mask (sort keys %$nv) {
1317 55 my $mv = $nv->{$mask};
1318 55 my $nid = "$net/$mask";
1319 55 ▶ my $src = $mv->{graph} && $mv->{graph}{N};
Condition66%2/3
$mv->{'graph'} && $mv->{'graph'}{'N'}
!ll&&!rl&&r
24031
MC/DC50%1/2
$mv->{'graph'} && $mv->{'graph'}{'N'}
$mv->{'graph'} $mv->{'graph'}{'N'}
Truth table66%2/3
A && B
A= $mv->{'graph'}B= $mv->{'graph'}{'N'}
ABresult
0X0
100
111
1320 55 foreach my $s (@{$mv->{hashes}}) {
1321 158 my $rid = $s->{routerid};
1322 my $dst = $routehash->{$rid}{graph}{N}
1323 158 ▶ or die "No router graph $rid";
Branch: 1 branch
BranchTrueFalseTotal
my $dst = $routehash->{$rid}{"graph"}{"N"} or die "No router graph $rid" 0 158 158
1324 158 my $addr = $s->{address};
1325 158 my $addrip = $addr;
1326 158 foreach (split(/\./, $mask)) {
1327 632 ▶ last if $_ ne 255;
Branch: 1 branch
BranchTrueFalseTotal
if $_ ne 255 158 474 632
1328 474 $addrip =~ s/^\.?\d+//;
1329 }
1330 158 my $area = $s->{area};
1331 158 my %colors = (gray => $area);
1332 158 ▶ if (! $routehash->{$rid}{areas}{$area}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($routehash->{$rid}{"areas"}{$area}) 1 157 158
1333 $self->error($colors{orange} =
1334 1 "Summary network $nid and router $rid ".
1335 "not in same area $area.");
1336 }
1337 158 ▶ if ($mv->{arearids}{$area}{$rid} > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($mv->{"arearids"}{$area}{$rid} > 1) 4 154 158
1338 $self->error($colors{yellow} =
1339 4 "Summary network $nid at router $rid ".
1340 "has multiple entries in area $area.");
1341 }
1342 158 my $metric = $s->{metric};
1343 $s->{graph} = {
1344 158 S => $src,
1345 D => $dst,
1346 headlabel => $metric,
1347 style => "dashed",
1348 taillabel => $addrip,
1349 };
1350 158 $s->{colors} = \%colors;
1351 158 $s->{index} = $index++;
1352 # in case of aggregation src is undef
1353 158 ▶ push @elements, $s if $src;
Branch: 1 branch
BranchTrueFalseTotal
if $src 127 31 158
1354 }
1355 }
1356 }
1357 92 return $self->elements2graphs(@elements);
1358 }
1359  
1360 ########################################################################
1361 # $sumaggr{$areaaggr}{$netaggr} = {
1362 # graph => { N => summary5, color => black, style => dashed, }
1363 # routers => { $routerid => { $area => { $metric => [ { sum hash } ] } } }
1364 # }
1365 ########################################################################
1366  
1367 # take summary hash
1368 # return summary aggregate
1369 sub create_sumaggr {
1370 25 ▶ my OSPF::LSDB::View $self = shift;
Subroutine create_sumaggr: called CC=27 SCAR=33.8
Pod undocumented
1371 # $ridnets{$rid}{$network} = {
1372 # color => orange,
1373 # areas => { $area => { $metric => [ { sum hash } ] } }
1374 # }
1375 25 ▶ my $sumhash = $self->{sumhash} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $sumhash = $self->{"sumhash"} or die "Uninitialized member" 0 25 25
1376 25 my %ridareanets;
1377 25 my $index = 0;
1378 25 foreach my $net (sort keys %$sumhash) {
1379 46 my $nv = $sumhash->{$net};
1380 46 foreach my $mask (sort keys %$nv) {
1381 46 my $mv = $nv->{$mask};
1382 46 my $nid = "$net/$mask";
1383 # no not aggregate clustered graphs
1384 46 ▶ next if $mv->{graph}{C};
Branch: 1 branch
BranchTrueFalseTotal
if $mv->{"graph"}{"C"} 21 25 46
1385 25 my $colors = $mv->{colors};
1386 # no not aggregate graphs with errors
1387 25 ▶ next if grep { ! /^(gray|black)$/ } keys %$colors;
Branch: 1 branch
BranchTrueFalseTotal
if grep {not /^(gray|black)$/;} keys %$colors 1 24 25
1388 24 my $areaaggr = join('\n', sort _cmp_ip keys %{$mv->{arearids}});
1389 24 foreach my $s (@{$mv->{hashes}}) {
1390 31 my $rid = $s->{routerid};
1391 31 my $area = $s->{area};
1392 31 my $metric = $s->{metric};
1393 31 my $elem = $ridareanets{$rid}{$areaaggr}{$nid};
1394 31 ▶ if (! $elem) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $elem) { } 27 4 31
elsif (not $elem->{'colors'}{'gray'} && $colors->{'gray'} or $elem->{'colors'}{'gray'} ne $colors->{'gray'}) { } 3 1 4
1395 27 $ridareanets{$rid}{$areaaggr}{$nid} = $elem = {
1396 colors => { %$colors },
1397 index => $index++,
1398 };
1399 ▶ } elsif (! $elem->{colors}{gray} || ! $colors->{gray} ||
Condition66%4/6
not $elem->{"colors"}{"gray"} && $colors->{"gray"} or $elem->{"colors"}{"gray"} ne $colors->{"gray"}
l!l&&r!l&&!r
301
$elem->{'colors'}{'gray'} && $colors->{'gray'}
!ll&&!rl&&r
301
MC/DC33%1/3
not $elem->{"colors"}{"gray"} && $colors->{"gray"} or $elem->{"colors"}{"gray"} ne $colors->{"gray"}
$elem->{'colors'}{'gray'} $colors->{'gray'} $elem->{"colors"}{"gray"} ne $colors->{"gray"}
Truth table50%2/4
not(A && B) or C
A= $elem->{'colors'}{'gray'}B= $colors->{'gray'}C= $elem->{"colors"}{"gray"} ne $colors->{"gray"}
ABCresult
0XX1
10X1
1111
1100
1400 $elem->{colors}{gray} ne $colors->{gray}) {
1401 3 ▶ push @{$elem->{colors}{black}},
Condition33%2/6
delete $elem->{'colors'}{'gray'} || ()
l!l&&r!l&&!r
003
$colors->{'gray'} || ()
l!l&&r!l&&!r
003
MC/DC0%0/2
delete $elem->{'colors'}{'gray'} || ()
delete $elem->{'colors'}{'gray'} ()
MC/DC0%0/2
$colors->{'gray'} || ()
$colors->{'gray'} ()
Truth table33%1/3
A || B
A= delete $elem->{'colors'}{'gray'}B= ()
ABresult
1X1
011
000
Truth table33%1/3
A || B
A= $colors->{'gray'}B= ()
ABresult
1X1
011
000
1402 (delete($elem->{colors}{gray}) || ()),
1403 3 ▶ ($colors->{gray} || ()), @{$colors->{black} || []};
Branch: 1 branch
BranchTrueFalseTotal
$colors->{"black"} or [] 0 3 3
1404 }
1405 31 push @{$elem->{areas}{$area}{$metric}}, $s;
1406 }
1407 24 delete $mv->{graph};
1408 }
1409 }
1410 25 my %sumaggr;
1411 25 $index = 0;
1412 25 foreach my $rid (sort keys %ridareanets) {
1413 17 my $rv = $ridareanets{$rid};
1414 17 foreach my $area (sort keys %$rv) {
1415 18 my $av = $rv->{$area};
1416 18 my $netaggr = join('\n', sort _cmp_ip_net keys %$av);
1417 18 my $elem = $sumaggr{$netaggr};
1418 18 ▶ if (! $elem) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($elem) 17 1 18
1419 17 $sumaggr{$netaggr} = $elem = {};
1420 $elem->{graph} = {
1421 17 N => "summaryaggregate$index",
1422 label => $netaggr,
1423 shape => "ellipse",
1424 style => "dashed",
1425 };
1426 17 $elem->{index} = $index++;
1427 }
1428 18 foreach my $nid (sort keys %$av) {
1429 27 my $nv = $av->{$nid};
1430 27 my $colors = $nv->{colors};
1431 27 ▶ if (! $elem->{colors}) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $elem->{'colors'}) { } 17 10 27
elsif (not $elem->{'colors'}{'gray'} && $colors->{'gray'} or $elem->{'colors'}{'gray'} ne $colors->{'gray'}) { } 1 9 10
1432 17 %{$elem->{colors}} = %$colors;
1433 ▶ } elsif (! $elem->{colors}{gray} || ! $colors->{gray} ||
Condition66%4/6
not $elem->{"colors"}{"gray"} && $colors->{"gray"} or $elem->{"colors"}{"gray"} ne $colors->{"gray"}
l!l&&r!l&&!r
109
$elem->{'colors'}{'gray'} && $colors->{'gray'}
!ll&&!rl&&r
109
MC/DC33%1/3
not $elem->{"colors"}{"gray"} && $colors->{"gray"} or $elem->{"colors"}{"gray"} ne $colors->{"gray"}
$elem->{'colors'}{'gray'} $colors->{'gray'} $elem->{"colors"}{"gray"} ne $colors->{"gray"}
Truth table50%2/4
not(A && B) or C
A= $elem->{'colors'}{'gray'}B= $colors->{'gray'}C= $elem->{"colors"}{"gray"} ne $colors->{"gray"}
ABCresult
0XX1
10X1
1111
1100
1434 $elem->{colors}{gray} ne $colors->{gray}) {
1435 1 ▶ push @{$elem->{colors}{black}},
Condition33%2/6
delete $elem->{'colors'}{'gray'} || ()
l!l&&r!l&&!r
001
$colors->{'gray'} || ()
l!l&&r!l&&!r
001
MC/DC0%0/2
delete $elem->{'colors'}{'gray'} || ()
delete $elem->{'colors'}{'gray'} ()
MC/DC0%0/2
$colors->{'gray'} || ()
$colors->{'gray'} ()
Truth table33%1/3
A || B
A= delete $elem->{'colors'}{'gray'}B= ()
ABresult
1X1
011
000
Truth table33%1/3
A || B
A= $colors->{'gray'}B= ()
ABresult
1X1
011
000
1436 (delete($elem->{colors}{gray}) || ()),
1437 1 ▶ ($colors->{gray} || ()), @{$colors->{black} || []};
Branch: 1 branch
BranchTrueFalseTotal
$colors->{"black"} or [] 0 1 1
1438 }
1439 27 foreach my $area (sort keys %{$nv->{areas}}) {
1440 30 my $ev = $nv->{areas}{$area};
1441 30 foreach my $metric (sort keys %$ev) {
1442 30 my $ss = $ev->{$metric};
1443 30 push @{$elem->{routers}{$rid}{$area}{$metric}}, @$ss;
1444 }
1445 }
1446 }
1447 }
1448 }
1449 25 $self->{sumaggr} = \%sumaggr;
1450 }
1451  
1452 # take hash containing summary aggregated nodes
1453 # return list of nodes
1454 sub sumaggr2nodes {
1455 25 ▶ my OSPF::LSDB::View $self = shift;
Subroutine sumaggr2nodes: called CC=2 SCAR=7.1
Pod undocumented
1456 25 ▶ my $sumaggr = $self->{sumaggr} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $sumaggr = $self->{"sumaggr"} or die "Uninitialized member" 0 25 25
1457 25 return $self->elements2graphs(values %$sumaggr);
1458 }
1459  
1460 # take summary aggregate
1461 # return list of edges from summary aggregate networks to router
1462 sub sumaggr2edges {
1463 25 ▶ my OSPF::LSDB::View $self = shift;
Subroutine sumaggr2edges: called CC=9 SCAR=22.0
Pod undocumented
1464 25 ▶ my $sumaggr = $self->{sumaggr} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $sumaggr = $self->{"sumaggr"} or die "Uninitialized member" 0 25 25
1465 25 my @elements;
1466 25 foreach my $netaggr (sort keys %$sumaggr) {
1467 17 my $nv = $sumaggr->{$netaggr};
1468 17 my $src = $nv->{graph}{N};
1469 17 foreach my $rid (sort keys %{$nv->{routers}}) {
1470 18 my $rv = $nv->{routers}{$rid};
1471 18 foreach my $area (sort keys %$rv) {
1472 20 my $av = $rv->{$area};
1473 20 foreach my $metric (sort keys %$av) {
1474 22 my $ss = $av->{$metric};
1475 22 my $aggrs;
1476 22 foreach my $s (@$ss) {
1477 31 $s->{graph}{S} = $src;
1478 # no not aggregate graphs with errors
1479 31 ▶ if (grep { ! /^(gray|black)$/ } keys %{$s->{colors}}) {
Branch: 1 branch
BranchTrueFalseTotal
if (grep {not /^(gray|black)$/;} keys %{$$s{'colors'};}) { } 2 29 31
1480 2 push @elements, $s;
1481 } else {
1482 29 delete $s->{graph}{taillabel};
1483 29 $aggrs = $s;
1484 }
1485 }
1486 22 ▶ push @elements, $aggrs if $aggrs;
Branch: 1 branch
BranchTrueFalseTotal
if $aggrs 22 0 22
1487 }
1488 }
1489 }
1490 }
1491 25 return $self->elements2graphs(@elements);
1492 }
1493  
1494 ########################################################################
1495 # RFC 2328
1496 # LS LSA LSA description
1497 # type name
1498 # ________________________________________________________
1499 # 4 Summary-LSAs Originated by area border
1500 # routers, and flooded through-
1501 # out the LSA's associated
1502 # area. Each summary-LSA
1503 # describes a route to a
1504 # destination outside the area,
1505 # yet still inside the AS
1506 # (i.e., an inter-area route).
1507 # Type 3 summary-LSAs describe
1508 # routes to networks. Type 4
1509 # summary-LSAs describe
1510 # routes to AS boundary routers.
1511 ########################################################################
1512 # boundarys => [
1513 # area => 'ipv4',
1514 # asbrouter => 'ipv4', # Link State ID
1515 # metric => 'int', # metric
1516 # routerid => 'ipv4', # Advertising Router
1517 # ],
1518 ########################################################################
1519 # $boundhash{$asbrouter} = {
1520 # graph => { N => boundary6, color => red, style => dashed, }
1521 # hashes => [ { boundary hash } ]
1522 # arearids => { $area => { $routerid => 1 }
1523 # aggregate => { $asbraggr => 1 } (optional)
1524 # }
1525 ########################################################################
1526  
1527 # take boundary hash
1528 # detect inconsistencies and set colors
1529 sub check_boundary {
1530 151 ▶ my OSPF::LSDB::View $self = shift;
Subroutine check_boundary: called CC=4 SCAR=13.9
Pod undocumented
1531 151 ▶ my $boundhash = $self->{boundhash} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $boundhash = $self->{"boundhash"} or die "Uninitialized member" 0 151 151
1532 151 ▶ while (my($asbr,$bv) = each %$boundhash) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %$boundhash) 101 151 252
1533 101 my @areas = sort keys %{$bv->{arearids}};
1534 101 ▶ if (@areas > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@areas > 1) { } 31 70 101
1535 31 $bv->{colors}{black} = \@areas;
1536 } else {
1537 70 $bv->{colors}{gray} = $areas[0];
1538 }
1539 }
1540 }
1541  
1542 # take boundary structure
1543 # return boundary hash
1544 sub create_boundary {
1545 99 ▶ my OSPF::LSDB::View $self = shift;
Subroutine create_boundary: called CC=3 SCAR=11.0
Pod undocumented
1546 99 my $index = 0;
1547 99 my %boundhash;
1548 99 foreach my $b (@{$self->{ospf}{database}{boundarys}}) {
1549 180 my $asbr = $b->{asbrouter};
1550 180 my $rid = $b->{routerid};
1551 180 my $area = $b->{area};
1552 180 my $elem = $boundhash{$asbr};
1553 180 ▶ if (! $elem) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($elem) 81 99 180
1554 81 $boundhash{$asbr} = $elem = {};
1555 $elem->{graph} = {
1556 81 N => "boundary$index",
1557 label => $asbr,
1558 shape => "box",
1559 style => "dashed",
1560 };
1561 81 $elem->{index} = $index++;
1562 }
1563 180 push @{$elem->{hashes}}, $b;
1564 180 $elem->{arearids}{$area}{$rid}++;
1565 }
1566 99 $self->{boundhash} = \%boundhash;
1567 }
1568  
1569 # take hash containing boundary nodes
1570 # return list of nodes
1571 sub boundary2nodes {
1572 151 ▶ my OSPF::LSDB::View $self = shift;
Subroutine boundary2nodes: called CC=2 SCAR=7.1
Pod undocumented
1573 151 ▶ my $boundhash = $self->{boundhash} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $boundhash = $self->{"boundhash"} or die "Uninitialized member" 0 151 151
1574 151 return $self->elements2graphs(values %$boundhash);
1575 }
1576  
1577 # take boundary hash, router hash
1578 # return list of edges from boundary router to router
1579 sub boundary2edges {
1580 99 ▶ my OSPF::LSDB::View $self = shift;
Subroutine boundary2edges: called CC=14 SCAR=26.4
Pod undocumented
1581 99 ▶ my $routehash = $self->{routehash} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $routehash = $self->{"routehash"} or die "Uninitialized member" 0 99 99
1582 99 ▶ my $boundhash = $self->{boundhash} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $boundhash = $self->{"boundhash"} or die "Uninitialized member" 0 99 99
1583 99 my @elements;
1584 99 my $index = 0;
1585 99 foreach my $asbr (sort keys %$boundhash) {
1586 81 my $bv = $boundhash->{$asbr};
1587 81 my $src;
1588 81 ▶ if ($bv->{graph}) {
Branch: 2 branches
BranchTrueFalseTotal
if ($bv->{'graph'}) { } 18 63 81
elsif ($routehash->{$asbr}) { } 27 36 63
1589 18 $src = $bv->{graph}{N};
1590 } elsif ($routehash->{$asbr}) {
1591 $src = $routehash->{$asbr}{graph}{N}
1592 27 }
1593 81 foreach my $b (@{$bv->{hashes}}) {
1594 180 my $rid = $b->{routerid};
1595 my $dst = $routehash->{$rid}{graph}{N}
1596 180 ▶ or die "No router graph $rid";
Branch: 1 branch
BranchTrueFalseTotal
my $dst = $routehash->{$rid}{"graph"}{"N"} or die "No router graph $rid" 0 180 180
1597 180 my $area = $b->{area};
1598 180 my %colors = (gray => $area);
1599 180 ▶ if ($asbr eq $rid) {
Branch: 2 branches
BranchTrueFalseTotal
if ($asbr eq $rid) { } 1 179 180
elsif ($routehash->{$asbr} and $routehash->{$asbr}{'areas'}{$area}) { } 8 244 252
1600 $self->error($colors{brown} =
1601 1 "AS boundary router $asbr is advertized by itself ".
1602 "in area $area.");
1603 ▶ } elsif ($routehash->{$asbr} && $routehash->{$asbr}{areas}{$area}) {
Condition100%3/3
$routehash->{$asbr} and $routehash->{$asbr}{"areas"}{$area}
!ll&&!rl&&r
73988
MC/DC100%2/2
$routehash->{$asbr} and $routehash->{$asbr}{"areas"}{$area}
$routehash->{$asbr} $routehash->{$asbr}{"areas"}{$area}
Truth table100%3/3
A and B
A= $routehash->{$asbr}B= $routehash->{$asbr}{"areas"}{$area}
ABresult
0X0
100
111
1604 $self->error($colors{blue} =
1605 8 "AS boundary router $asbr is router in same area $area.");
1606 }
1607 180 ▶ if (! $routehash->{$rid}{areas}{$area}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($routehash->{$rid}{"areas"}{$area}) 2 178 180
1608 $self->error($colors{orange} =
1609 2 "AS boundary router $asbr and router $rid ".
1610 "not in same area $area.");
1611 }
1612 180 ▶ if ($bv->{arearids}{$area}{$rid} > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bv->{"arearids"}{$area}{$rid} > 1) 8 172 180
1613 $self->error($colors{yellow} =
1614 8 "AS boundary router $asbr at router $rid ".
1615 "has multiple entries in area $area.");
1616 }
1617 180 my $metric = $b->{metric};
1618 $b->{graph} = {
1619 180 S => $src,
1620 D => $dst,
1621 headlabel => $metric,
1622 style => "dashed",
1623 };
1624 180 $b->{colors} = \%colors;
1625 180 $b->{index} = $index++;
1626 # in case of aggregation src is undef
1627 180 ▶ push @elements, $b if $src;
Branch: 1 branch
BranchTrueFalseTotal
if $src 134 46 180
1628 }
1629 }
1630 99 return $self->elements2graphs(@elements);
1631 }
1632  
1633 ########################################################################
1634 # $boundaggr{$asbraggr} = {
1635 # graph => { N => boundary7, color => black, style => dashed, }
1636 # routers => { $routerid => { $area => { $metric => [ { bound hash } ] } } }
1637 # }
1638 ########################################################################
1639  
1640 # take boundary hash
1641 # return boundary aggregate
1642 sub create_boundaggr {
1643 30 ▶ my OSPF::LSDB::View $self = shift;
Subroutine create_boundaggr: called CC=25 SCAR=35.1
Pod undocumented
1644 # $ridasbrs{$rid}{$asbr} = {
1645 # color => orange,
1646 # areas => { $area => { $metric => [ { bound hash } ] } }
1647 # }
1648 30 ▶ my $boundhash = $self->{boundhash} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $boundhash = $self->{"boundhash"} or die "Uninitialized member" 0 30 30
1649 30 my %ridasbrs;
1650 30 my $index = 0;
1651 30 foreach my $asbr (sort keys %$boundhash) {
1652 56 my $bv = $boundhash->{$asbr};
1653 # no not aggregate if ASBR has been deleted by create route
1654 56 ▶ next unless $bv->{graph};
Branch: 1 branch
BranchTrueFalseTotal
unless $bv->{"graph"} 20 36 56
1655 36 my $colors = $bv->{colors};
1656 # no not aggregate graphs with errors
1657 36 ▶ next if grep { ! /^(gray|black)$/ } keys %$colors;
Branch: 1 branch
BranchTrueFalseTotal
if grep {not /^(gray|black)$/;} keys %$colors 0 36 36
1658 36 foreach my $b (@{$bv->{hashes}}) {
1659 46 my $rid = $b->{routerid};
1660 46 my $area = $b->{area};
1661 46 my $metric = $b->{metric};
1662 46 my $elem = $ridasbrs{$rid}{$asbr};
1663 46 ▶ if (! $elem) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $elem) { } 44 2 46
elsif (not $elem->{'colors'}{'gray'} && $colors->{'gray'} or $elem->{'colors'}{'gray'} ne $colors->{'gray'}) { } 0 2 2
1664 44 $ridasbrs{$rid}{$asbr} = $elem = {
1665 colors => { %$colors },
1666 index => $index++,
1667 };
1668 ▶ } elsif (! $elem->{colors}{gray} || ! $colors->{gray} ||
Condition33%2/6
not $elem->{"colors"}{"gray"} && $colors->{"gray"} or $elem->{"colors"}{"gray"} ne $colors->{"gray"}
l!l&&r!l&&!r
002
$elem->{'colors'}{'gray'} && $colors->{'gray'}
!ll&&!rl&&r
002
MC/DC0%0/3
not $elem->{"colors"}{"gray"} && $colors->{"gray"} or $elem->{"colors"}{"gray"} ne $colors->{"gray"}
$elem->{'colors'}{'gray'} $colors->{'gray'} $elem->{"colors"}{"gray"} ne $colors->{"gray"}
Truth table25%1/4
not(A && B) or C
A= $elem->{'colors'}{'gray'}B= $colors->{'gray'}C= $elem->{"colors"}{"gray"} ne $colors->{"gray"}
ABCresult
0XX1
10X1
1111
1100
1669 $elem->{colors}{gray} ne $colors->{gray}) {
1670 0 ▶ push @{$elem->{colors}{black}},
Condition0%0/6
delete $elem->{'colors'}{'gray'} || ()
l!l&&r!l&&!r
000
$colors->{'gray'} || ()
l!l&&r!l&&!r
000
MC/DC0%0/2
delete $elem->{'colors'}{'gray'} || ()
delete $elem->{'colors'}{'gray'} ()
MC/DC0%0/2
$colors->{'gray'} || ()
$colors->{'gray'} ()
Truth table0%0/3
A || B
A= delete $elem->{'colors'}{'gray'}B= ()
ABresult
1X1
011
000
Truth table0%0/3
A || B
A= $colors->{'gray'}B= ()
ABresult
1X1
011
000
1671 (delete($elem->{colors}{gray}) || ()),
1672 0 ▶ ($colors->{gray} || ()), @{$colors->{black} || []};
Branch: 1 branch
BranchTrueFalseTotal
$colors->{"black"} or [] 0 0 0
1673 }
1674 46 push @{$elem->{areas}{$area}{$metric}}, $b;
1675 }
1676 36 delete $bv->{graph};
1677 }
1678 30 my %boundaggr;
1679 30 $index = 0;
1680 30 foreach my $rid (sort keys %ridasbrs) {
1681 23 my $rv = $ridasbrs{$rid};
1682 23 my $asbraggr = join('\n', sort _cmp_ip keys %$rv);
1683 23 my $elem = $boundaggr{$asbraggr};
1684 23 ▶ if (! $elem) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($elem) 22 1 23
1685 22 $boundaggr{$asbraggr} = $elem = {};
1686 $elem->{graph} = {
1687 22 N => "boundaryaggregate$index",
1688 label => $asbraggr,
1689 shape => "box",
1690 style => "dashed",
1691 };
1692 22 $elem->{index} = $index++;
1693 }
1694 23 foreach my $asbr (sort keys %$rv) {
1695 44 my $bv = $rv->{$asbr};
1696 44 $boundhash->{$asbr}{aggregate}{$asbraggr}++;
1697 44 my $colors = $bv->{colors};
1698 44 ▶ if (! $elem->{colors}) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $elem->{'colors'}) { } 22 22 44
elsif (not $elem->{'colors'}{'gray'} && $colors->{'gray'} or $elem->{'colors'}{'gray'} ne $colors->{'gray'}) { } 3 19 22
1699 22 %{$elem->{colors}} = %$colors;
1700 ▶ } elsif (! $elem->{colors}{gray} || ! $colors->{gray} ||
Condition83%5/6
not $elem->{"colors"}{"gray"} && $colors->{"gray"} or $elem->{"colors"}{"gray"} ne $colors->{"gray"}
l!l&&r!l&&!r
1219
$elem->{'colors'}{'gray'} && $colors->{'gray'}
!ll&&!rl&&r
1021
MC/DC66%2/3
not $elem->{"colors"}{"gray"} && $colors->{"gray"} or $elem->{"colors"}{"gray"} ne $colors->{"gray"}
$elem->{'colors'}{'gray'} $colors->{'gray'} $elem->{"colors"}{"gray"} ne $colors->{"gray"}
Truth table75%3/4
not(A && B) or C
A= $elem->{'colors'}{'gray'}B= $colors->{'gray'}C= $elem->{"colors"}{"gray"} ne $colors->{"gray"}
ABCresult
0XX1
10X1
1111
1100
1701 $elem->{colors}{gray} ne $colors->{gray}) {
1702 3 ▶ push @{$elem->{colors}{black}},
Condition50%3/6
delete $elem->{'colors'}{'gray'} || ()
l!l&&r!l&&!r
201
$colors->{'gray'} || ()
l!l&&r!l&&!r
300
MC/DC50%1/2
delete $elem->{'colors'}{'gray'} || ()
delete $elem->{'colors'}{'gray'} ()
MC/DC0%0/2
$colors->{'gray'} || ()
$colors->{'gray'} ()
Truth table66%2/3
A || B
A= delete $elem->{'colors'}{'gray'}B= ()
ABresult
1X1
011
000
Truth table33%1/3
A || B
A= $colors->{'gray'}B= ()
ABresult
1X1
011
000
1703 (delete($elem->{colors}{gray}) || ()),
1704 3 ▶ ($colors->{gray} || ()), @{$colors->{black} || []};
Branch: 1 branch
BranchTrueFalseTotal
$colors->{"black"} or [] 3 0 3
1705 }
1706 44 foreach my $area (sort keys %{$bv->{areas}}) {
1707 44 my $ev = $bv->{areas}{$area};
1708 44 foreach my $metric (sort keys %$ev) {
1709 44 my $bs = $ev->{$metric};
1710 44 push @{$elem->{routers}{$rid}{$area}{$metric}}, @$bs;
1711 }
1712 }
1713 }
1714 }
1715 30 $self->{boundaggr} = \%boundaggr;
1716 }
1717  
1718 # take hash containing boundary aggregated nodes
1719 # return list of nodes
1720 sub boundaggr2nodes {
1721 30 ▶ my OSPF::LSDB::View $self = shift;
Subroutine boundaggr2nodes: called CC=2 SCAR=7.1
Pod undocumented
1722 30 ▶ my $boundaggr = $self->{boundaggr} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $boundaggr = $self->{"boundaggr"} or die "Uninitialized member" 0 30 30
1723 30 return $self->elements2graphs(values %$boundaggr);
1724 }
1725  
1726 # take boundary aggregate
1727 # return list of edges from boundary aggregate routers to router
1728 sub boundaggr2edges {
1729 30 ▶ my OSPF::LSDB::View $self = shift;
Subroutine boundaggr2edges: called CC=9 SCAR=22.0
Pod undocumented
1730 30 ▶ my $boundaggr = $self->{boundaggr} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $boundaggr = $self->{"boundaggr"} or die "Uninitialized member" 0 30 30
1731 30 my @elements;
1732 30 foreach my $asbraggr (sort keys %$boundaggr) {
1733 22 my $bv = $boundaggr->{$asbraggr};
1734 22 my $src = $bv->{graph}{N};
1735 22 foreach my $rid (sort keys %{$bv->{routers}}) {
1736 23 my $rv = $bv->{routers}{$rid};
1737 23 foreach my $area (sort keys %$rv) {
1738 25 my $av = $rv->{$area};
1739 25 foreach my $metric (sort keys %$av) {
1740 27 my $bs = $av->{$metric};
1741 27 my $aggrb;
1742 27 foreach my $b (@$bs) {
1743 46 $b->{graph}{S} = $src;
1744 # no not aggregate graphs with errors
1745 46 ▶ if (grep { ! /^(gray|black)$/ } keys %{$b->{colors}}) {
Branch: 1 branch
BranchTrueFalseTotal
if (grep {not /^(gray|black)$/;} keys %{$$b{'colors'};}) { } 4 42 46
1746 4 push @elements, $b;
1747 } else {
1748 42 $aggrb = $b;
1749 }
1750 }
1751 27 ▶ push @elements, $aggrb if $aggrb;
Branch: 1 branch
BranchTrueFalseTotal
if $aggrb 27 0 27
1752 }
1753 }
1754 }
1755 }
1756 30 return $self->elements2graphs(@elements);
1757 }
1758  
1759 ########################################################################
1760 # RFC 2328
1761 # LS LSA LSA description
1762 # type name
1763 # ________________________________________________________
1764 # 5 AS-external-LSAs Originated by AS boundary
1765 # routers, and flooded through-
1766 # out the AS. Each
1767 # AS-external-LSA describes
1768 # a route to a destination in
1769 # another Autonomous System.
1770 # Default routes for the AS can
1771 # also be described by
1772 # AS-external-LSAs.
1773 ########################################################################
1774 # externals => [
1775 # address => 'ipv4', # Link State ID
1776 # metric => 'int', # metric
1777 # forward => 'ipv4', # Forwarding address
1778 # netmask => 'ipv4', # Network Mask
1779 # routerid => 'ipv4', # Advertising Router
1780 # type => 'int', # bit E
1781 # ],
1782 ########################################################################
1783 # $network = $address & $netmask
1784 # $externhash{$network}{$netmask} = {
1785 # graph => { N => external8, color => red, style => dashed, }
1786 # hashes => [ { ase hash } ]
1787 # routers => { $routerid => 1 }
1788 # }
1789 ########################################################################
1790  
1791 # take external hash, net cluster hash, network hash, stub hash, summary hash
1792 # detect inconsistencies and set colors
1793 sub check_external {
1794 99 ▶ my OSPF::LSDB::View $self = shift;
Subroutine check_external: called CC=10 SCAR=23.2
Pod undocumented
1795 99 my($netcluster) = @_;
1796 99 ▶ my $nets = $self->{nets} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $nets = $self->{"nets"} or die "Uninitialized member" 0 99 99
1797 99 ▶ my $stubs = $self->{stubs} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $stubs = $self->{"stubs"} or die "Uninitialized member" 0 99 99
1798 99 my $sums = $self->{sums};
1799 99 ▶ my $externhash = $self->{externhash} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $externhash = $self->{"externhash"} or die "Uninitialized member" 0 99 99
1800 99 foreach my $net (sort keys %$externhash) {
1801 87 my $nv = $externhash->{$net};
1802 87 foreach my $mask (sort keys %$nv) {
1803 87 my $mv = $nv->{$mask};
1804 87 my %colors = (gray => "ase");
1805 87 my $nid = "$net/$mask";
1806 87 ▶ if ($nets->{$net}{$mask}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nets->{$net}{$mask}) 3 84 87
1807 $self->error($colors{blue} =
1808 3 "AS external network $nid is also network.");
1809 }
1810 87 ▶ if ($stubs and $stubs->{$net}{$mask}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($stubs and $stubs->{$net}{$mask}) 5 82 87
Condition66%2/3
$stubs and $stubs->{$net}{$mask}
!ll&&!rl&&r
0825
MC/DC50%1/2
$stubs and $stubs->{$net}{$mask}
$stubs $stubs->{$net}{$mask}
Truth table66%2/3
A and B
A= $stubsB= $stubs->{$net}{$mask}
ABresult
0X0
100
111
1811 $self->error($colors{green} =
1812 5 "AS external network $nid is also stub network.");
1813 }
1814 87 ▶ if ($sums->{$net}{$mask}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($sums->{$net}{$mask}) 4 83 87
1815 $self->error($colors{cyan} =
1816 4 "AS external network $nid is also summary network.");
1817 }
1818 87 $mv->{colors} = \%colors;
1819 87 push @{$netcluster->{"$net/$mask"}}, $mv->{graph};
1820 }
1821 }
1822 }
1823  
1824 # take external structure, net cluster hash, network hash, link hash
1825 # return external hash
1826 sub create_external {
1827 99 ▶ my OSPF::LSDB::View $self = shift;
Subroutine create_external: called CC=3 SCAR=11.0
Pod undocumented
1828 99 my $index = 0;
1829 99 my %externhash;
1830 99 foreach my $e (@{$self->{ospf}{database}{externals}}) {
1831 138 my $addr = $e->{address};
1832 138 my $mask = $e->{netmask};
1833 138 my $nid = "$addr/$mask";
1834 138 my $net = _maskip($addr, $mask);
1835 138 my $rid = $e->{routerid};
1836 138 my $elem = $externhash{$net}{$mask};
1837 138 ▶ if (! $elem) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($elem) 87 51 138
1838 87 $externhash{$net}{$mask} = $elem = {};
1839 $elem->{graph} = {
1840 87 N => "external$index",
1841 label => "$net\\n$mask",
1842 shape => "egg",
1843 style => "solid",
1844 };
1845 87 $elem->{index} = $index++;
1846 }
1847 138 push @{$elem->{hashes}}, $e;
1848 138 $elem->{routers}{$rid}++;
1849 }
1850 99 $self->{externhash} = \%externhash;
1851 }
1852  
1853 # take hash containing external nodes
1854 # return list of nodes
1855 sub external2nodes {
1856 151 ▶ my OSPF::LSDB::View $self = shift;
Subroutine external2nodes: called CC=2 SCAR=7.0
Pod undocumented
1857 151 ▶ my $externhash = $self->{externhash} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $externhash = $self->{"externhash"} or die "Uninitialized member" 0 151 151
1858 151 return $self->elements2graphs(map { values %$_ } values %$externhash);
1859 }
1860  
1861 # take external hash, router hash, boundary hash, boundary aggregate
1862 # return list of edges from external network to router
1863 sub external2edges {
1864 99 ▶ my OSPF::LSDB::View $self = shift;
Subroutine external2edges: called CC=21 SCAR=30.5
Pod undocumented
1865 99 ▶ my $routehash = $self->{routehash} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $routehash = $self->{"routehash"} or die "Uninitialized member" 0 99 99
1866 99 my $boundhash = $self->{boundhash};
1867 99 my $boundaggr = $self->{boundaggr};
1868 99 ▶ my $externhash = $self->{externhash} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $externhash = $self->{"externhash"} or die "Uninitialized member" 0 99 99
1869 99 my @elements;
1870 99 my $index = 0;
1871 99 foreach my $net (sort keys %$externhash) {
1872 87 my $nv = $externhash->{$net};
1873 87 foreach my $mask (sort keys %$nv) {
1874 87 my $mv = $nv->{$mask};
1875 87 my $nid = "$net/$mask";
1876 87 my $src = $mv->{graph}{N};
1877 87 my %dtm; # when dst is aggregated, aggregate edges
1878 87 foreach my $e (@{$mv->{hashes}}) {
1879 138 my $rid = $e->{routerid};
1880 138 my $addr = $e->{address};
1881 138 my $addrip = $addr;
1882 138 foreach (split(/\./, $mask)) {
1883 489 ▶ last if $_ ne 255;
Branch: 1 branch
BranchTrueFalseTotal
if $_ ne 255 134 355 489
1884 355 $addrip =~ s/^\.?\d+//;
1885 }
1886 138 my $type = $e->{type};
1887 138 my $metric = $e->{metric};
1888 138 my %colors = (gray => "ase");
1889 138 ▶ if ($mv->{routers}{$rid} > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($mv->{"routers"}{$rid} > 1) 9 129 138
1890 $self->error($colors{yellow} =
1891 9 "AS external network $nid at router $rid ".
1892 "has multiple entries.");
1893 }
1894 138 ▶ my $style = $type == 1 ? "solid" : "dashed";
Branch: 1 branch
BranchTrueFalseTotal
$type == 1 ? : 128 10 138
1895 138 my %graph = (
1896 S => $src,
1897 headlabel => $metric,
1898 style => $style,
1899 taillabel => $addrip,
1900 );
1901 138 ▶ if ($routehash->{$rid}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($routehash->{$rid}) 98 40 138
1902 my $dst = $routehash->{$rid}{graph}{N}
1903 98 ▶ or die "No router graph $rid";
Branch: 1 branch
BranchTrueFalseTotal
my $dst = $routehash->{$rid}{"graph"}{"N"} or die "No router graph $rid" 0 98 98
1904 98 $graph{D} = $dst;
1905 98 $e->{elems}{$dst} = {
1906 graph => \%graph,
1907 colors => \%colors,
1908 index => $index++,
1909 };
1910 98 ▶ push @elements, $e->{elems}{$dst} if $src;
Branch: 1 branch
BranchTrueFalseTotal
if $src 17 81 98
1911 98 next;
1912 }
1913 40 my $av = $boundhash->{$rid}{aggregate};
1914 40 ▶ if (! $av) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($av) 12 28 40
1915 my $dst = $boundhash->{$rid}{graph}{N}
1916 12 ▶ or die "No ASB router graph $rid";
Branch: 1 branch
BranchTrueFalseTotal
my $dst = $boundhash->{$rid}{"graph"}{"N"} or die "No ASB router graph $rid" 0 12 12
1917 12 $graph{D} = $dst;
1918 12 $e->{elems}{$dst} = {
1919 graph => \%graph,
1920 colors => \%colors,
1921 index => $index++,
1922 };
1923 12 ▶ push @elements, $e->{elems}{$dst} if $src;
Branch: 1 branch
BranchTrueFalseTotal
if $src 8 4 12
1924 12 next;
1925 }
1926 28 foreach my $asbraggr (sort keys %$av) {
1927 36 my $num = $av->{$asbraggr};
1928 my $dst = $boundaggr->{$asbraggr}{graph}{N}
1929 36 ▶ or die "No ASBR graph $asbraggr";
Branch: 1 branch
BranchTrueFalseTotal
my $dst = $boundaggr->{$asbraggr}{"graph"}{"N"} or die "No ASBR graph $asbraggr" 0 36 36
1930 36 $graph{D} = $dst;
1931 36 $e->{elems}{$dst} = {
1932 graph => { %graph },
1933 colors => { %colors },
1934 index => $index++,
1935 };
1936 # no not aggregate graphs with errors
1937 36 ▶ if (grep { ! /^(gray|black)$/ } keys %colors) {
Branch: 1 branch
BranchTrueFalseTotal
if (grep {not /^(gray|black)$/;} keys %colors) { } 2 34 36
1938 2 ▶ push @elements, $e->{elems}{$dst} if $src;
Branch: 1 branch
BranchTrueFalseTotal
if $src 0 2 2
1939 } else {
1940 34 $dtm{$dst}{$type}{$metric} = $e->{elems}{$dst};
1941 }
1942 }
1943 }
1944 87 ▶ push @elements, map { values %$_ } map { values %$_ } values %dtm
Branch: 1 branch
BranchTrueFalseTotal
if $src 19 68 87
1945 if $src;
1946 }
1947 }
1948 99 return $self->elements2graphs(@elements);
1949 }
1950  
1951 ########################################################################
1952 # $externaggr{$netaggr} = {
1953 # graph => { N => external9, color => red, style => dashed, }
1954 # routers => { $routerid => { $type => { $metric => [ { ase hash } ] } } }
1955 # }
1956 ########################################################################
1957  
1958 # take external hash
1959 # return external aggregate
1960 sub create_externaggr {
1961 19 ▶ my OSPF::LSDB::View $self = shift;
Subroutine create_externaggr: called CC=26 SCAR=39.5
Pod undocumented
1962 # $ridnets{$rid}{$network} =
1963 # color => orange,
1964 # types => { $type => { $metric => [ { ase hash } ] } }
1965 19 ▶ my $externhash = $self->{externhash} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $externhash = $self->{"externhash"} or die "Uninitialized member" 0 19 19
1966 19 my %ridnets;
1967 19 my $index = 0;
1968 19 foreach my $net (sort keys %$externhash) {
1969 73 my $nv = $externhash->{$net};
1970 73 foreach my $mask (sort keys %$nv) {
1971 73 my $mv = $nv->{$mask};
1972 73 my $nid = "$net/$mask";
1973 # no not aggregate clustered graphs
1974 73 ▶ next if $mv->{graph}{C};
Branch: 1 branch
BranchTrueFalseTotal
if $mv->{"graph"}{"C"} 3 70 73
1975 70 my $colors = $mv->{colors};
1976 # no not aggregate graphs with errors
1977 70 ▶ next if grep { ! /^(gray|black)$/ } keys %$colors;
Branch: 1 branch
BranchTrueFalseTotal
if grep {not /^(gray|black)$/;} keys %$colors 2 68 70
1978 68 foreach my $e (@{$mv->{hashes}}) {
1979 107 my $rid = $e->{routerid};
1980 107 my $type = $e->{type};
1981 107 my $metric = $e->{metric};
1982 107 my $elem = $ridnets{$rid}{$nid};
1983 107 ▶ if (! $elem) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $elem) { } 105 2 107
elsif (not $elem->{'colors'}{'gray'} && $colors->{'gray'} or $elem->{'colors'}{'gray'} ne $colors->{'gray'}) { } 0 2 2
1984 105 $ridnets{$rid}{$nid} = $elem = {
1985 colors => { %$colors },
1986 index => $index++,
1987 };
1988 ▶ } elsif (! $elem->{colors}{gray} || ! $colors->{gray} ||
Condition33%2/6
not $elem->{"colors"}{"gray"} && $colors->{"gray"} or $elem->{"colors"}{"gray"} ne $colors->{"gray"}
l!l&&r!l&&!r
002
$elem->{'colors'}{'gray'} && $colors->{'gray'}
!ll&&!rl&&r
002
MC/DC0%0/3
not $elem->{"colors"}{"gray"} && $colors->{"gray"} or $elem->{"colors"}{"gray"} ne $colors->{"gray"}
$elem->{'colors'}{'gray'} $colors->{'gray'} $elem->{"colors"}{"gray"} ne $colors->{"gray"}
Truth table25%1/4
not(A && B) or C
A= $elem->{'colors'}{'gray'}B= $colors->{'gray'}C= $elem->{"colors"}{"gray"} ne $colors->{"gray"}
ABCresult
0XX1
10X1
1111
1100
1989 $elem->{colors}{gray} ne $colors->{gray}) {
1990 0 ▶ push @{$elem->{colors}{black}},
Condition0%0/6
delete $elem->{'colors'}{'gray'} || ()
l!l&&r!l&&!r
000
$colors->{'gray'} || ()
l!l&&r!l&&!r
000
MC/DC0%0/2
delete $elem->{'colors'}{'gray'} || ()
delete $elem->{'colors'}{'gray'} ()
MC/DC0%0/2
$colors->{'gray'} || ()
$colors->{'gray'} ()
Truth table0%0/3
A || B
A= delete $elem->{'colors'}{'gray'}B= ()
ABresult
1X1
011
000
Truth table0%0/3
A || B
A= $colors->{'gray'}B= ()
ABresult
1X1
011
000
1991 (delete($elem->{colors}{gray}) || ()),
1992 0 ▶ ($colors->{gray} || ()), @{$colors->{black} || []};
Branch: 1 branch
BranchTrueFalseTotal
$colors->{"black"} or [] 0 0 0
1993 }
1994 107 push @{$elem->{types}{$type}{$metric}}, $e;
1995 }
1996 68 delete $mv->{graph};
1997 }
1998 }
1999 19 my %externaggr;
2000 19 $index = 0;
2001 19 foreach my $rid (sort keys %ridnets) {
2002 38 my $rv = $ridnets{$rid};
2003 38 my $netaggr = join('\n', sort _cmp_ip_net keys %$rv);
2004 38 my $elem = $externaggr{$netaggr};
2005 38 ▶ if (! $elem) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($elem) 32 6 38
2006 32 $externaggr{$netaggr} = $elem = {};
2007 $elem->{graph} = {
2008 32 N => "externalaggregate$index",
2009 label => $netaggr,
2010 shape => "egg",
2011 style => "solid",
2012 };
2013 32 $elem->{index} = $index++;
2014 }
2015 38 foreach my $nid (sort keys %$rv) {
2016 105 my $nv = $rv->{$nid};
2017 105 my $colors = $nv->{colors};
2018 105 ▶ if (! $elem->{colors}) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $elem->{'colors'}) { } 32 73 105
elsif (not $elem->{'colors'}{'gray'} && $colors->{'gray'} or $elem->{'colors'}{'gray'} ne $colors->{'gray'}) { } 0 73 73
2019 32 %{$elem->{colors}} = %$colors;
2020 ▶ } elsif (! $elem->{colors}{gray} || ! $colors->{gray} ||
Condition33%2/6
not $elem->{"colors"}{"gray"} && $colors->{"gray"} or $elem->{"colors"}{"gray"} ne $colors->{"gray"}
l!l&&r!l&&!r
0073
$elem->{'colors'}{'gray'} && $colors->{'gray'}
!ll&&!rl&&r
0073
MC/DC0%0/3
not $elem->{"colors"}{"gray"} && $colors->{"gray"} or $elem->{"colors"}{"gray"} ne $colors->{"gray"}
$elem->{'colors'}{'gray'} $colors->{'gray'} $elem->{"colors"}{"gray"} ne $colors->{"gray"}
Truth table25%1/4
not(A && B) or C
A= $elem->{'colors'}{'gray'}B= $colors->{'gray'}C= $elem->{"colors"}{"gray"} ne $colors->{"gray"}
ABCresult
0XX1
10X1
1111
1100
2021 $elem->{colors}{gray} ne $colors->{gray}) {
2022 0 ▶ push @{$elem->{colors}{black}},
Condition0%0/6
delete $elem->{'colors'}{'gray'} || ()
l!l&&r!l&&!r
000
$colors->{'gray'} || ()
l!l&&r!l&&!r
000
MC/DC0%0/2
delete $elem->{'colors'}{'gray'} || ()
delete $elem->{'colors'}{'gray'} ()
MC/DC0%0/2
$colors->{'gray'} || ()
$colors->{'gray'} ()
Truth table0%0/3
A || B
A= delete $elem->{'colors'}{'gray'}B= ()
ABresult
1X1
011
000
Truth table0%0/3
A || B
A= $colors->{'gray'}B= ()
ABresult
1X1
011
000
2023 (delete($elem->{colors}{gray}) || ()),
2024 0 ▶ ($colors->{gray} || ()), @{$colors->{black} || []};
Branch: 1 branch
BranchTrueFalseTotal
$colors->{"black"} or [] 0 0 0
2025 }
2026 105 foreach my $type (sort keys %{$nv->{types}}) {
2027 105 my $tv = $nv->{types}{$type};
2028 105 foreach my $metric (sort keys %$tv) {
2029 105 my $es = $tv->{$metric};
2030 105 push @{$elem->{routers}{$rid}{$type}{$metric}}, @$es;
2031 }
2032 }
2033 }
2034 }
2035 19 $self->{externaggr} = \%externaggr;
2036 }
2037  
2038 # take hash containing external aggregated nodes
2039 # return list of nodes
2040 sub externaggr2nodes {
2041 19 ▶ my OSPF::LSDB::View $self = shift;
Subroutine externaggr2nodes: called CC=2 SCAR=7.1
Pod undocumented
2042 19 ▶ my $externaggr = $self->{externaggr} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $externaggr = $self->{"externaggr"} or die "Uninitialized member" 0 19 19
2043 19 return $self->elements2graphs(values %$externaggr);
2044 }
2045  
2046 # take external aggregate
2047 # return list of edges from external aggregate network to router
2048 sub externaggr2edges {
2049 19 ▶ my OSPF::LSDB::View $self = shift;
Subroutine externaggr2edges: called CC=9 SCAR=22.0
Pod undocumented
2050 19 ▶ my $externaggr = $self->{externaggr} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $externaggr = $self->{"externaggr"} or die "Uninitialized member" 0 19 19
2051 19 my @elements;
2052 19 my $index = 0;
2053 19 foreach my $netaggr (sort keys %$externaggr) {
2054 32 my $nv = $externaggr->{$netaggr};
2055 32 my $src = $nv->{graph}{N};
2056 32 my %dtm;
2057 32 foreach my $rid (sort keys %{$nv->{routers}}) {
2058 38 my $rv = $nv->{routers}{$rid};
2059 38 foreach my $type (sort keys %$rv) {
2060 38 my $tv = $rv->{$type};
2061 38 foreach my $metric (sort keys %$tv) {
2062 40 my $es = $tv->{$metric};
2063 40 foreach my $e (@$es) {
2064 107 foreach my $dst (sort keys %{$e->{elems}}) {
2065 111 my $elem = $e->{elems}{$dst};
2066 111 my %graph = %{$elem->{graph}};
2067 111 $graph{S} = $src;
2068 111 delete $graph{taillabel};
2069 111 my %colors = %{$elem->{colors}};
2070 111 my $newelem = {
2071 graph => \%graph,
2072 colors => \%colors,
2073 index => $index++,
2074 };
2075 # no not aggregate graphs with errors
2076 111 ▶ if (grep { ! /^(gray|black)$/ } keys %colors) {
Branch: 1 branch
BranchTrueFalseTotal
if (grep {not /^(gray|black)$/;} keys %colors) { } 4 107 111
2077 4 push @elements, $newelem;
2078 } else {
2079 107 $dtm{$dst}{$type}{$metric} = $newelem;
2080 }
2081 }
2082 }
2083 }
2084 }
2085 }
2086 32 push @elements, map { values %$_ } map { values %$_ } values %dtm;
2087 }
2088 19 return $self->elements2graphs(@elements);
2089 }
2090  
2091 # take cluster hash
2092 # insert cluster into graphs referenced more than once
2093 sub set_cluster {
2094 24 ▶ my OSPF::LSDB::View $self = shift;
Subroutine set_cluster: called CC=5 SCAR=16.1
Pod undocumented
2095 24 my($type) = @_;
2096 24 ▶ my $cluster = $self->{$type."cluster"} or die "Uninitialized member";
Branch: 1 branch
BranchTrueFalseTotal
my $cluster = $$self{$type . 'cluster'} or die "Uninitialized member" 0 24 24
2097 24 ▶ while (my($id,$graphlist) = each %$cluster) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %$cluster) 98 24 122
2098 98 ▶ next if @$graphlist < 2;
Branch: 1 branch
BranchTrueFalseTotal
if @$graphlist < 2 74 24 98
2099 24 foreach (@$graphlist) {
2100 55 $_->{C} = $id;
2101 }
2102 }
2103 }
2104  
2105 # take list of nodes ( { N => node, C => cluster, label => ... }, ... )
2106 # return nodes of dot graph
2107 sub graph_nodes {
2108 193 ▶ my $class = shift;
Subroutine graph_nodes: called CC=7 SCAR=19.5
Pod undocumented
2109 193 my @nodes = @_;
2110 193 my $dot = "";
2111 193 foreach (@nodes) {
2112 830 my $cluster = $_->{C};
2113 830 $dot .= "\t";
2114 830 ▶ $dot .= "subgraph \"cluster $cluster\" { " if $cluster;
Branch: 1 branch
BranchTrueFalseTotal
if $cluster 55 775 830
2115 830 $dot .= "$_->{N} [\n";
2116 830 foreach my $k (sort keys %$_) {
2117 5080 ▶ next if $k eq 'C' || $k eq 'N';
Branch: 1 branch
BranchTrueFalseTotal
if $k eq "C" or $k eq "N" 885 4195 5080
Condition100%3/3
$k eq "C" or $k eq "N"
l!l&&r!l&&!r
558304195
MC/DC100%2/2
$k eq "C" or $k eq "N"
$k eq "C" $k eq "N"
Truth table100%3/3
A or B
A= $k eq "C"B= $k eq "N"
ABresult
1X1
011
000
2118 4195 my $v = $_->{$k};
2119 4195 $dot .= "\t\t$k=\"$v\"\n";
2120 }
2121 830 $dot .= "\t]";
2122 830 ▶ $dot .= " }" if $cluster;
Branch: 1 branch
BranchTrueFalseTotal
if $cluster 55 775 830
2123 830 $dot .= ";\n";
2124 }
2125 193 return $dot;
2126 }
2127  
2128 # take array containing elements, create color
2129 # return nodes or edges of dot graph
2130 sub elements2graphs {
2131 2503 ▶ my OSPF::LSDB::View $self = shift;
Subroutine elements2graphs: called CC=6 SCAR=18.1
Pod undocumented
2132 2503 my @elements = sort { $a->{index} <=> $b->{index} } grep { $_->{graph} } @_;
2133 2503 foreach my $elem (@elements) {
2134 1937 my $graph = $elem->{graph};
2135 1937 my $color = $self->colors2string($elem->{colors});
2136 1937 my $message = $elem->{colors}{$color};
2137 1937 $graph->{color} = $color;
2138 1937 $graph->{tooltip} = $message;
2139 1937 ▶ if ($self->{todo}{warning}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"todo"}{"warning"}) 1425 512 1937
2140 1425 ▶ if ($graph->{label}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($graph->{'label'}) { } 679 746 1425
2141 679 $graph->{label} .= '\n';
2142 } else {
2143 746 $graph->{label} = "";
2144 }
2145 1425 ▶ if ($self->{todo}{warning}{all}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'todo'}{'warning'}{'all'}) { } 0 1425 1425
2146 0 $graph->{label} .= join('\n', values %{$elem->{colors}});
2147 } else {
2148 1425 $graph->{label} .= $message;
2149 }
2150 }
2151 }
2152 2503 ▶ return map { $_->{graph} || () } @elements;
Branch: 1 branch
BranchTrueFalseTotal
$_->{"graph"} or () 0 1937 1937
2153 }
2154  
2155 # take list of edges ( { S => srcNode , D => dstNode, label => ... }, ... )
2156 # return edges of dot graph
2157 sub graph_edges {
2158 183 ▶ my $class = shift;
Subroutine graph_edges: called CC=5 SCAR=16.1
Pod undocumented
2159 183 my @edges = @_;
2160 183 my $dot = "";
2161 183 foreach (@edges) {
2162 1209 $dot .= "\t$_->{S} -> $_->{D} [\n";
2163 1209 foreach my $k (sort keys %$_) {
2164 8365 ▶ next if $k eq 'S' || $k eq 'D';
Branch: 1 branch
BranchTrueFalseTotal
if $k eq "S" or $k eq "D" 2418 5947 8365
Condition100%3/3
$k eq "S" or $k eq "D"
l!l&&r!l&&!r
120912095947
MC/DC100%2/2
$k eq "S" or $k eq "D"
$k eq "S" $k eq "D"
Truth table100%3/3
A or B
A= $k eq "S"B= $k eq "D"
ABresult
1X1
011
000
2165 5947 my $v = $_->{$k};
2166 5947 $dot .= "\t\t$k=\"$v\"\n";
2167 }
2168 1209 $dot .= "\t];\n";
2169 }
2170 183 return $dot;
2171 }
2172  
2173 # take lsdb structure, router id, todo hash
2174 # return dot graph
2175 sub graph_database {
2176 177 ▶ my OSPF::LSDB::View $self = shift;
Subroutine graph_database: called CC=50 SCAR=44.7
Pod undocumented
2177 177 my $todo = $self->{todo};
2178  
2179 # convert ospf structure into separate hashes and create cluster hashes
2180 177 my $netindex = 0;
2181 177 $self->create_network(\$netindex);
2182 177 ▶ if ($todo->{intra}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($todo->{"intra"}) 0 177 177
2183 0 ▶ $self->create_intranetworks() if $self->ipv6;
Branch: 1 branch
BranchTrueFalseTotal
if $self->ipv6 0 0 0
2184 }
2185 # add missing network may add graphs to nethash
2186 # must be called before add_transit_value in create_router
2187 177 $self->add_missing_network(\$netindex);
2188 177 my $routeindex = 0;
2189 177 $self->create_router(\$routeindex);
2190 177 ▶ if ($todo->{link}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($todo->{"link"}) 0 177 177
2191 0 ▶ $self->create_link() if $self->ipv6;
Branch: 1 branch
BranchTrueFalseTotal
if $self->ipv6 0 0 0
2192 }
2193 177 ▶ if ($todo->{intra}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($todo->{"intra"}) 0 177 177
2194 0 ▶ $self->create_intrarouters() if $self->ipv6;
Branch: 1 branch
BranchTrueFalseTotal
if $self->ipv6 0 0 0
2195 }
2196 177 ▶ $self->create_summary() if $todo->{summary};
Branch: 1 branch
BranchTrueFalseTotal
if $todo->{"summary"} 144 33 177
2197 177 ▶ $self->create_boundary() if $todo->{boundary};
Branch: 1 branch
BranchTrueFalseTotal
if $todo->{"boundary"} 151 26 177
2198 177 ▶ $self->create_external() if $todo->{external};
Branch: 1 branch
BranchTrueFalseTotal
if $todo->{"external"} 151 26 177
2199  
2200 # add missing router may add graphs to routehash
2201 # must be called before check_router
2202 177 $self->add_missing_router(\$routeindex);
2203  
2204 177 my %netcluster;
2205 my %transitcluster;
2206 177 $self->check_network(\%netcluster);
2207 177 $self->check_router();
2208 177 $self->check_transit(\%transitcluster);
2209 177 ▶ $self->check_stub(\%netcluster) unless $self->ipv6;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->ipv6 112 65 177
2210 177 ▶ if ($todo->{link}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($todo->{"link"}) 0 177 177
2211 0 ▶ $self->check_link() if $self->ipv6;
Branch: 1 branch
BranchTrueFalseTotal
if $self->ipv6 0 0 0
2212 }
2213 177 ▶ if ($todo->{intra}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($todo->{"intra"}) 0 177 177
2214 0 ▶ $self->check_intrarouter() if $self->ipv6;
Branch: 1 branch
BranchTrueFalseTotal
if $self->ipv6 0 0 0
2215 0 ▶ $self->check_intranetwork() if $self->ipv6;
Branch: 1 branch
BranchTrueFalseTotal
if $self->ipv6 0 0 0
2216 }
2217 177 ▶ $self->check_summary(\%netcluster) if $todo->{summary};
Branch: 1 branch
BranchTrueFalseTotal
if $todo->{"summary"} 144 33 177
2218 177 ▶ $self->check_boundary() if $todo->{boundary};
Branch: 1 branch
BranchTrueFalseTotal
if $todo->{"boundary"} 151 26 177
2219 177 ▶ $self->check_external(\%netcluster) if $todo->{external};
Branch: 1 branch
BranchTrueFalseTotal
if $todo->{"external"} 151 26 177
2220 177 $self->{netcluster} = \%netcluster;
2221 177 $self->{transitcluster} = \%transitcluster;
2222  
2223 # remove duplicate router may delete graphs from boundhash
2224 # must be called after check_boundary
2225 177 $self->remove_duplicate_router();
2226  
2227 # insert cluster with more than one entry into graphs
2228 177 ▶ if ($todo->{cluster}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($todo->{"cluster"}) 12 165 177
2229 12 $self->set_cluster("net");
2230 12 $self->set_cluster("transit");
2231 }
2232  
2233 # graphs within clusters are not aggregated
2234 $self->create_sumaggr()
2235 177 ▶ if $todo->{summary} && $todo->{summary}{aggregate};
Branch: 1 branch
BranchTrueFalseTotal
if $todo->{"summary"} and $todo->{"summary"}{"aggregate"} 25 152 177
Condition100%3/3
$todo->{"summary"} and $todo->{"summary"}{"aggregate"}
!ll&&!rl&&r
3311925
MC/DC100%2/2
$todo->{"summary"} and $todo->{"summary"}{"aggregate"}
$todo->{"summary"} $todo->{"summary"}{"aggregate"}
Truth table100%3/3
A and B
A= $todo->{"summary"}B= $todo->{"summary"}{"aggregate"}
ABresult
0X0
100
111
2236 $self->create_boundaggr()
2237 177 ▶ if $todo->{boundary} && $todo->{boundary}{aggregate};
Branch: 1 branch
BranchTrueFalseTotal
if $todo->{"boundary"} and $todo->{"boundary"}{"aggregate"} 30 147 177
Condition100%3/3
$todo->{"boundary"} and $todo->{"boundary"}{"aggregate"}
!ll&&!rl&&r
2612130
MC/DC100%2/2
$todo->{"boundary"} and $todo->{"boundary"}{"aggregate"}
$todo->{"boundary"} $todo->{"boundary"}{"aggregate"}
Truth table100%3/3
A and B
A= $todo->{"boundary"}B= $todo->{"boundary"}{"aggregate"}
ABresult
0X0
100
111
2238 $self->create_externaggr()
2239 177 ▶ if $todo->{external} && $todo->{external}{aggregate};
Branch: 1 branch
BranchTrueFalseTotal
if $todo->{"external"} and $todo->{"external"}{"aggregate"} 19 158 177
Condition100%3/3
$todo->{"external"} and $todo->{"external"}{"aggregate"}
!ll&&!rl&&r
2613219
MC/DC100%2/2
$todo->{"external"} and $todo->{"external"}{"aggregate"}
$todo->{"external"} $todo->{"external"}{"aggregate"}
Truth table100%3/3
A and B
A= $todo->{"external"}B= $todo->{"external"}{"aggregate"}
ABresult
0X0
100
111
2240  
2241 177 my @nodes;
2242 177 push @nodes, $self->router2nodes();
2243 177 push @nodes, $self->transit2nodes();
2244 177 ▶ push @nodes, $self->stub2nodes() unless $self->ipv6;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->ipv6 112 65 177
2245 177 push @nodes, $self->network2nodes();
2246 177 ▶ if ($todo->{link}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($todo->{"link"}) 0 177 177
2247 0 ▶ push @nodes, $self->link2nodes() if $self->ipv6;
Branch: 1 branch
BranchTrueFalseTotal
if $self->ipv6 0 0 0
2248 }
2249 177 ▶ if ($todo->{intra}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($todo->{"intra"}) 0 177 177
2250 0 ▶ push @nodes, $self->intrarouter2nodes() if $self->ipv6;
Branch: 1 branch
BranchTrueFalseTotal
if $self->ipv6 0 0 0
2251 0 ▶ push @nodes, $self->intranetwork2nodes() if $self->ipv6;
Branch: 1 branch
BranchTrueFalseTotal
if $self->ipv6 0 0 0
2252 }
2253 177 ▶ if ($todo->{summary}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($todo->{"summary"}) 144 33 177
2254 144 push @nodes, $self->summary2nodes();
2255 push @nodes, $self->sumaggr2nodes()
2256 144 ▶ if $todo->{summary}{aggregate};
Branch: 1 branch
BranchTrueFalseTotal
if $todo->{"summary"}{"aggregate"} 25 119 144
2257 }
2258 177 ▶ if ($todo->{boundary}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($todo->{"boundary"}) 151 26 177
2259 151 push @nodes, $self->boundary2nodes();
2260 push @nodes, $self->boundaggr2nodes()
2261 151 ▶ if $todo->{boundary}{aggregate};
Branch: 1 branch
BranchTrueFalseTotal
if $todo->{"boundary"}{"aggregate"} 30 121 151
2262 }
2263 177 ▶ if ($todo->{external}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($todo->{"external"}) 151 26 177
2264 151 push @nodes, $self->external2nodes();
2265 push @nodes, $self->externaggr2nodes()
2266 151 ▶ if $todo->{external}{aggregate};
Branch: 1 branch
BranchTrueFalseTotal
if $todo->{"external"}{"aggregate"} 19 132 151
2267 }
2268 177 my $dot = $self->graph_nodes(@nodes);
2269  
2270 177 my @edges;
2271 177 push @edges, $self->router2edges("pointtopoint");
2272 177 push @edges, $self->transit2edges();
2273 177 ▶ push @edges, $self->stub2edges() unless $self->ipv6;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->ipv6 112 65 177
2274 177 push @edges, $self->router2edges("virtual");
2275 177 push @edges, $self->network2edges();
2276 177 ▶ if ($todo->{link}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($todo->{"link"}) 0 177 177
2277 0 ▶ push @edges, $self->link2edges() if $self->ipv6;
Branch: 1 branch
BranchTrueFalseTotal
if $self->ipv6 0 0 0
2278 }
2279 177 ▶ if ($todo->{intra}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($todo->{"intra"}) 0 177 177
2280 0 ▶ push @edges, $self->intrarouter2edges() if $self->ipv6;
Branch: 1 branch
BranchTrueFalseTotal
if $self->ipv6 0 0 0
2281 0 ▶ push @edges, $self->intranetwork2edges() if $self->ipv6;
Branch: 1 branch
BranchTrueFalseTotal
if $self->ipv6 0 0 0
2282 }
2283 177 ▶ if ($todo->{summary}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($todo->{"summary"}) 144 33 177
2284 144 push @edges, $self->summary2edges();
2285 push @edges, $self->sumaggr2edges()
2286 144 ▶ if $todo->{summary}{aggregate};
Branch: 1 branch
BranchTrueFalseTotal
if $todo->{"summary"}{"aggregate"} 25 119 144
2287 }
2288 177 ▶ if ($todo->{boundary}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($todo->{"boundary"}) 151 26 177
2289 151 push @edges, $self->boundary2edges();
2290 push @edges, $self->boundaggr2edges()
2291 151 ▶ if $todo->{boundary}{aggregate};
Branch: 1 branch
BranchTrueFalseTotal
if $todo->{"boundary"}{"aggregate"} 30 121 151
2292 }
2293 177 ▶ if ($todo->{external}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($todo->{"external"}) 151 26 177
2294 151 push @edges, $self->external2edges();
2295 push @edges, $self->externaggr2edges()
2296 151 ▶ if $todo->{external}{aggregate};
Branch: 1 branch
BranchTrueFalseTotal
if $todo->{"external"}{"aggregate"} 19 132 151
2297 }
2298 177 $dot .= $self->graph_edges(@edges);
2299  
2300 177 return $dot;
2301 }
2302  
2303 # return dot default settings
2304 sub graph_default {
2305 179 ▶ my $class = shift;
Subroutine graph_default: called CC=1 SCAR=0.0
Pod undocumented
2306 179 my $dot = "";
2307 179 $dot .= "\tnode [ color=gray50 fontsize=14 ];\n";
2308 179 $dot .= "\tedge [ color=gray50 fontsize=8 ];\n";
2309 179 return $dot;
2310 }
2311  
2312 =pod
2313  
2314 =over
2315  
2316 =item $self-E<gt>graph(%todo)
2317  
2318 Convert the internal database into graphviz dot format.
2319 The output for the dot program is returned as string.
2320  
2321 The B<%todo> parameter allows to tune the displayed details.
2322 It consists of the subkeys:
2323  
2324 =over 8
2325  
2326 =item B<boundary>
2327  
2328 Display the summary AS boundary routers.
2329 If the additional subkey B<aggregate> is given, multiple AS boundary
2330 routers are aggregated in one node.
2331  
2332 =item B<external>
2333  
2334 Display the AS external networks.
2335 If the additional subkey B<aggregate> is given, multiple AS external
2336 networks are aggregated in one node.
2337  
2338 =item B<cluster>
2339  
2340 The same network is always displayed in the same rectangular cluster,
2341 even if is belongs to different LSA types.
2342  
2343 =item B<summary>
2344  
2345 Display the summary networks.
2346 If the additional subkey B<aggregate> is given, multiple networks
2347 are aggregated in one node.
2348  
2349 =item B<warnings>
2350  
2351 Write the most severe warning about OSPF inconsistencies into the
2352 label of the dot graph.
2353 This warning determines also the color of the node or edge.
2354 If the additional subkey B<all> is given, all warnings are added.
2355  
2356 =back
2357  
2358 =cut
2359  
2360 # take ospf structure, todo hash
2361 # return the complete dot graph
2362 sub graph {
2363 177 ▶ my OSPF::LSDB::View $self = shift;
Subroutine graph: called CC=1 SCAR=0.0
Pod documented
2364 177 %{$self->{todo}} = @_;
2365 177 $self->create_area_grays();
2366 177 my $dot = "digraph \"ospf lsdb\" {\n";
2367 177 $dot .= $self->graph_default();
2368 177 $dot .= $self->graph_database();
2369 177 $dot .= "}\n";
2370 177 return $dot;
2371 }
2372  
2373 # return legend routers as dot graph
2374 sub legend_router {
2375 1 ▶ my $class = shift;
Subroutine legend_router: called CC=4 SCAR=13.9
Pod undocumented
2376 1 my $index = 0;
2377 1 my @nodes = (
2378 {
2379 label => 'ospf\nrouter',
2380 }, {
2381 label => 'current\nlocation',
2382 peripheries => 2,
2383 }, {
2384 label => 'area border\nrouter',
2385 style => 'bold',
2386 }, {
2387 label => 'summary AS\nboundary router',
2388 style => 'dashed',
2389 },
2390 );
2391 1 foreach (@nodes) {
2392 4 $_->{N} = 'router'. $index++;
2393 4 ▶ $_->{shape} ||= 'box';
Condition50%1/2
$_->{"shape"} ||= "box"
l!l
04
MC/DC0%0/1
$_->{"shape"} ||= "box"
$_->{"shape"}
Truth table50%1/2
A
A= $_->{"shape"}
Aresult
11
00
2394 4 ▶ $_->{style} ||= 'solid';
Condition100%2/2
$_->{"style"} ||= "solid"
l!l
22
MC/DC100%1/1
$_->{"style"} ||= "solid"
$_->{"style"}
Truth table100%2/2
A
A= $_->{"style"}
Aresult
11
00
2395 }
2396  
2397 1 my $dot = "";
2398 1 $dot .= $class->graph_nodes(@nodes);
2399 1 $dot .= "\t{ rank=same;";
2400 1 $dot .= join("", map { " $_->{N};" } @nodes);
2401 1 $dot .= " }\n";
2402 1 return $dot;
2403 }
2404  
2405 # return legend networks as dot graph
2406 sub legend_network {
2407 1 ▶ my $class = shift;
Subroutine legend_network: called CC=4 SCAR=13.9
Pod undocumented
2408 1 my $index = 0;
2409 1 my @nodes = (
2410 {
2411 label => 'transit\nnetwork',
2412 style => 'bold',
2413 }, {
2414 label => 'stub\nnetwork',
2415 }, {
2416 label => 'summary\nnetwork',
2417 style => 'dashed',
2418 }, {
2419 color => 'gray35',
2420 label => 'AS external\nnetwork',
2421 shape => 'egg',
2422 },
2423 );
2424 1 foreach (@nodes) {
2425 4 $_->{N} = 'network'. $index++;
2426 4 ▶ $_->{shape} ||= 'ellipse';
Condition100%2/2
$_->{"shape"} ||= "ellipse"
l!l
13
MC/DC100%1/1
$_->{"shape"} ||= "ellipse"
$_->{"shape"}
Truth table100%2/2
A
A= $_->{"shape"}
Aresult
11
00
2427 4 ▶ $_->{style} ||= 'solid';
Condition100%2/2
$_->{"style"} ||= "solid"
l!l
22
MC/DC100%1/1
$_->{"style"} ||= "solid"
$_->{"style"}
Truth table100%2/2
A
A= $_->{"style"}
Aresult
11
00
2428 }
2429  
2430 1 my $dot = "";
2431 1 $dot .= $class->graph_nodes(@nodes);
2432 1 $dot .= "\t{ rank=same;";
2433 1 $dot .= join("", map { " $_->{N};" } @nodes);
2434 1 $dot .= " }\n";
2435 1 return $dot;
2436 }
2437  
2438 # return legend router network edges as dot graph
2439 sub legend_edge {
2440 1 ▶ my $class = shift;
Subroutine legend_edge: called CC=8 SCAR=20.8
Pod undocumented
2441 1 my @networknodes = (
2442 {
2443 label => 'network',
2444 }, {
2445 label => 'transit\nnetwork',
2446 style => 'bold',
2447 }, {
2448 color => 'gray35',
2449 label => 'ASE type 1\nnetwork',
2450 shape => 'egg',
2451 }, {
2452 color => 'gray35',
2453 label => 'ASE type 2\nnetwork',
2454 shape => 'egg',
2455 },
2456 );
2457 1 foreach (@networknodes) {
2458 4 ▶ $_->{shape} ||= 'ellipse';
Condition100%2/2
$_->{"shape"} ||= "ellipse"
l!l
22
MC/DC100%1/1
$_->{"shape"} ||= "ellipse"
$_->{"shape"}
Truth table100%2/2
A
A= $_->{"shape"}
Aresult
11
00
2459 4 ▶ $_->{style} ||= 'solid';
Condition100%2/2
$_->{"style"} ||= "solid"
l!l
13
MC/DC100%1/1
$_->{"style"} ||= "solid"
$_->{"style"}
Truth table100%2/2
A
A= $_->{"style"}
Aresult
11
00
2460 }
2461  
2462 1 my @routernodes = (
2463 {
2464 label => 'router',
2465 }, {
2466 label => 'designated\nrouter',
2467 }, {
2468 label => 'AS boundary\nrouter',
2469 }, {
2470 label => 'AS boundary\nrouter',
2471 },
2472 );
2473 1 foreach (@routernodes) {
2474 4 ▶ $_->{shape} ||= 'box';
Condition50%1/2
$_->{"shape"} ||= "box"
l!l
04
MC/DC0%0/1
$_->{"shape"} ||= "box"
$_->{"shape"}
Truth table50%1/2
A
A= $_->{"shape"}
Aresult
11
00
2475 4 ▶ $_->{style} ||= 'solid';
Condition50%1/2
$_->{"style"} ||= "solid"
l!l
04
MC/DC0%0/1
$_->{"style"} ||= "solid"
$_->{"style"}
Truth table50%1/2
A
A= $_->{"style"}
Aresult
11
00
2476 }
2477  
2478 1 my $index = 0;
2479 1 my @edges = (
2480 {
2481 headlabel => '.IP',
2482 style => 'solid',
2483 taillabel => 'cost',
2484 }, {
2485 style => 'bold',
2486 taillabel => '.IP',
2487 }, {
2488 color => 'gray35',
2489 headlabel => 'cost',
2490 style => 'solid',
2491 taillabel => '.IP',
2492 }, {
2493 color => 'gray35',
2494 headlabel => 'cost',
2495 style => 'dashed',
2496 taillabel => '.IP',
2497 },
2498 );
2499 1 ▶ for(my $i=0; $i<@edges; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < @edges) 4 1 5
2500 4 $networknodes[$i]{N} = 'edgenetwork'. $index;
2501 4 $routernodes [$i]{N} = 'edgerouter'. $index;
2502 4 $edges [$i]{S} = 'edgenetwork'. $index;
2503 4 $edges [$i]{D} = 'edgerouter'. $index;
2504 4 $index++;
2505 }
2506 # swap arrow for cost .IP explanation
2507 1 ($edges[0]{D}, $edges[0]{S}) = ($edges[0]{S}, $edges[0]{D});
2508  
2509 1 my $dot = "";
2510 1 $dot .= $class->graph_nodes(@networknodes);
2511 1 $dot .= $class->graph_nodes(@routernodes);
2512 1 $dot .= $class->graph_edges(@edges);
2513 1 $dot .= "\t{ rank=same;";
2514 1 $dot .= join("", map { " $_->{S};" } @edges);
2515 1 $dot .= " }\n";
2516 1 return $dot;
2517 }
2518  
2519 # return legend router link to router or network as dot graph
2520 sub legend_link {
2521 1 ▶ my $class = shift;
Subroutine legend_link: called CC=12 SCAR=24.9
Pod undocumented
2522 1 my @routernodes = (
2523 {}, {}, {
2524 label => 'designated\nrouter',
2525 }, {}, {},
2526 );
2527 1 foreach (@routernodes) {
2528 5 ▶ $_->{label} ||= 'router';
Condition100%2/2
$_->{"label"} ||= "router"
l!l
14
MC/DC100%1/1
$_->{"label"} ||= "router"
$_->{"label"}
Truth table100%2/2
A
A= $_->{"label"}
Aresult
11
00
2529 5 ▶ $_->{shape} ||= 'box';
Condition50%1/2
$_->{"shape"} ||= "box"
l!l
05
MC/DC0%0/1
$_->{"shape"} ||= "box"
$_->{"shape"}
Truth table50%1/2
A
A= $_->{"shape"}
Aresult
11
00
2530 5 ▶ $_->{style} ||= 'solid';
Condition50%1/2
$_->{"style"} ||= "solid"
l!l
05
MC/DC0%0/1
$_->{"style"} ||= "solid"
$_->{"style"}
Truth table50%1/2
A
A= $_->{"style"}
Aresult
11
00
2531 }
2532  
2533 1 my @dstnodes = (
2534 {}, {
2535 label => 'transit\nnetwork',
2536 style => 'bold',
2537 shape => 'ellipse',
2538 }, {
2539 label => 'transit\nnetwork',
2540 style => 'bold',
2541 shape => 'ellipse',
2542 }, {
2543 label => 'stub\nnetwork',
2544 style => 'solid',
2545 shape => 'ellipse',
2546 }, {},
2547 );
2548 1 foreach (@dstnodes) {
2549 $_->{label} ||= 'router',
2550 5 ▶ $_->{shape} ||= 'box';
Condition100%4/4
$_->{"label"} ||= "router"
l!l
32
$_->{"shape"} ||= "box"
l!l
32
MC/DC100%1/1
$_->{"label"} ||= "router"
$_->{"label"}
MC/DC100%1/1
$_->{"shape"} ||= "box"
$_->{"shape"}
Truth table100%2/2
A
A= $_->{"label"}
Aresult
11
00
Truth table100%2/2
A
A= $_->{"shape"}
Aresult
11
00
2551 5 ▶ $_->{style} ||= 'solid';
Condition100%2/2
$_->{"style"} ||= "solid"
l!l
32
MC/DC100%1/1
$_->{"style"} ||= "solid"
$_->{"style"}
Truth table100%2/2
A
A= $_->{"style"}
Aresult
11
00
2552 }
2553  
2554 1 my $index = 0;
2555 1 my @edges = (
2556 {
2557 label => 'point-to-point\nlink',
2558 }, {
2559 label => 'link to\ntransit network',
2560 }, {
2561 label => 'link to\ntransit network',
2562 style => 'bold',
2563 }, {
2564 label => 'link to\nstub network',
2565 }, {
2566 label => 'virtual\nlink',
2567 style => 'dotted',
2568 },
2569 );
2570 1 foreach (@edges) {
2571 5 ▶ $_->{style} ||= 'solid';
Condition100%2/2
$_->{"style"} ||= "solid"
l!l
23
MC/DC100%1/1
$_->{"style"} ||= "solid"
$_->{"style"}
Truth table100%2/2
A
A= $_->{"style"}
Aresult
11
00
2572 }
2573 1 ▶ for(my $i=0; $i<@edges; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < @edges) 5 1 6
2574 5 $routernodes[$i]{N} = 'linkrouter'. $index;
2575 5 $dstnodes [$i]{N} = 'linkdst'. $index;
2576 5 $edges [$i]{S} = 'linkrouter'. $index;
2577 5 $edges [$i]{D} = 'linkdst'. $index;
2578 5 $index++;
2579 }
2580  
2581 1 my $dot = "";
2582 1 $dot .= $class->graph_nodes(@routernodes);
2583 1 $dot .= $class->graph_nodes(@dstnodes);
2584 1 $dot .= $class->graph_edges(@edges);
2585 1 $dot .= "\t{ rank=same;";
2586 1 $dot .= join("", map { " $_->{S};" } @edges);
2587 1 $dot .= " }\n";
2588 1 return $dot;
2589 }
2590  
2591 # return legend summary network and router edges as dot graph
2592 sub legend_summary {
2593 1 ▶ my $class = shift;
Subroutine legend_summary: called CC=9 SCAR=22.0
Pod undocumented
2594 1 my @networknodes = (
2595 {
2596 label => 'summary\nnetwork',
2597 style => 'dashed',
2598 }, {
2599 label => 'summary AS\nboundary router',
2600 shape => 'box',
2601 style => 'dashed',
2602 }, {
2603 label => 'router and summary \nAS boundary router',
2604 shape => 'box',
2605 }, {
2606 color => 'gray35',
2607 label => 'ASE\nnetwork',
2608 shape => 'egg',
2609 },
2610 );
2611 1 foreach (@networknodes) {
2612 4 ▶ $_->{shape} ||= 'ellipse';
Condition100%2/2
$_->{"shape"} ||= "ellipse"
l!l
31
MC/DC100%1/1
$_->{"shape"} ||= "ellipse"
$_->{"shape"}
Truth table100%2/2
A
A= $_->{"shape"}
Aresult
11
00
2613 4 ▶ $_->{style} ||= 'solid';
Condition100%2/2
$_->{"style"} ||= "solid"
l!l
22
MC/DC100%1/1
$_->{"style"} ||= "solid"
$_->{"style"}
Truth table100%2/2
A
A= $_->{"style"}
Aresult
11
00
2614 }
2615  
2616 1 my @routernodes = (
2617 {}, {}, {
2618 color => 'black',
2619 }, {
2620 color => 'gray35',
2621 label => 'summary AS\nboundary router',
2622 style => 'dashed',
2623 },
2624 );
2625 1 foreach (@routernodes) {
2626 4 ▶ $_->{label} ||= 'area border\nrouter';
Condition100%2/2
$_->{"label"} ||= "area border\\nrouter"
l!l
13
MC/DC100%1/1
$_->{"label"} ||= "area border\\nrouter"
$_->{"label"}
Truth table100%2/2
A
A= $_->{"label"}
Aresult
11
00
2627 4 ▶ $_->{shape} ||= 'box';
Condition50%1/2
$_->{"shape"} ||= "box"
l!l
04
MC/DC0%0/1
$_->{"shape"} ||= "box"
$_->{"shape"}
Truth table50%1/2
A
A= $_->{"shape"}
Aresult
11
00
2628 4 ▶ $_->{style} ||= 'bold';
Condition100%2/2
$_->{"style"} ||= "bold"
l!l
13
MC/DC100%1/1
$_->{"style"} ||= "bold"
$_->{"style"}
Truth table100%2/2
A
A= $_->{"style"}
Aresult
11
00
2629 }
2630  
2631 1 my $index = 0;
2632 1 my @edges = (
2633 {
2634 headlabel => 'cost',
2635 style => 'dashed',
2636 taillabel => '.IP',
2637 }, {
2638 headlabel => 'cost',
2639 style => 'dashed',
2640 }, {
2641 color => 'gray75',
2642 headlabel => 'cost',
2643 style => 'dashed',
2644 }, {
2645 color => 'gray35',
2646 headlabel => 'cost',
2647 style => 'solid',
2648 taillabel => '.IP',
2649 },
2650 );
2651 1 ▶ for(my $i=0; $i<@edges; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < @edges) 4 1 5
2652 4 $networknodes[$i]{N} = 'summarynetwork'. $index;
2653 4 $routernodes [$i]{N} = 'summaryrouter'. $index;
2654 4 $edges [$i]{S} = 'summarynetwork'. $index;
2655 4 $edges [$i]{D} = 'summaryrouter'. $index;
2656 4 $index++;
2657 }
2658  
2659 1 my $dot = "";
2660 1 $dot .= $class->graph_nodes(@networknodes);
2661 1 $dot .= $class->graph_nodes(@routernodes);
2662 1 $dot .= $class->graph_edges(@edges);
2663 1 $dot .= "\t{ rank=same;";
2664 1 $dot .= join("", map { " $_->{S};" } @edges);
2665 1 $dot .= " }\n";
2666 1 return $dot;
2667 }
2668  
2669 # return additional invisible edges to get a better layout for the legend
2670 sub legend_rank {
2671 2 ▶ my $class = shift;
Subroutine legend_rank: called CC=1 SCAR=0.0
Pod undocumented
2672 2 my $dot = "";
2673 2 $dot .= "\trouter0 -> network0 -> edgerouter0";
2674 2 $dot .= " [ style=invis ];\n";
2675 2 $dot .= "\tedgenetwork0 -> linkrouter0";
2676 2 $dot .= " [ style=invis ];\n";
2677 2 $dot .= "\tlinkdst0 -> summarynetwork0";
2678 2 $dot .= " [ style=invis ];\n";
2679 2 return $dot;
2680 }
2681  
2682 # return legend default settings
2683 sub legend_default {
2684 2 ▶ my $class = shift;
Subroutine legend_default: called CC=1 SCAR=0.0
Pod undocumented
2685 2 my $dot = "";
2686 2 $dot .= $class->graph_default();
2687 2 return $dot;
2688 }
2689  
2690 =pod
2691  
2692 =item OSPF::LSDB::View-E<gt>legend()
2693  
2694 Return a string of a dot graphic containing drawing and description
2695 of possible nodes and edges.
2696  
2697 =back
2698  
2699 =cut
2700  
2701 # return legend as dot graph
2702 sub legend {
2703 2 ▶ my $class = shift;
Subroutine legend: called CC=1 SCAR=0.0
Pod documented
2704 2 my $dot = "digraph \"ospf legend\" {\n";
2705 2 $dot .= $class->legend_default();
2706 2 $dot .= $class->legend_rank();
2707 2 $dot .= $class->legend_router();
2708 2 $dot .= $class->legend_network();
2709 2 $dot .= $class->legend_edge();
2710 2 $dot .= $class->legend_link();
2711 2 $dot .= $class->legend_summary();
2712 2 $dot .= "}\n";
2713 2 return $dot;
2714 }
2715  
2716 =pod
2717  
2718 =head1 ERRORS
2719  
2720 The methods die if any error occures.
2721  
2722 Inconsistencies within the OSPF link state database are visualized
2723 with different colors.
2724 The error message may be printed into the graph as warnings.
2725 All warnings may be optained with the get_errors() method.
2726  
2727 =head1 SEE ALSO
2728  
2729 L<OSPF::LSDB>,
2730 L<OSPF::LSDB::View6>
2731  
2732 L<ospf2dot>,
2733 L<ospfview>
2734  
2735 RFC 2328 - OSPF Version 2 - April 1998
2736  
2737 =head1 AUTHORS
2738  
2739 Alexander Bluhm
2740  
2741 =cut
2742  
2743 13 1;
« blib/lib/OSPF/LSDB/ospfd.pm ↑ Summary script/ospf2dot »