| 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 112 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | # convert decimal dotted IPv4 address to packed format | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 2588 | ▶ | 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 | 190 | ▶ | my @a = split(/\//, $a); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_cmp_ip_net: called CC=2 SCAR=7.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 190 | my @b = split(/\//, $b); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 190 | ▶ | 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]))
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]))
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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 | 183 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create_area_grays: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 183 | ▶ | my $ospf = $self->{ospf} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 183 | my @areas = sort _cmp_ip @{$ospf->{self}{areas}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 183 | my @colors = map { "gray". int(50 + ($_* 50 / @areas)) } (0..$#areas); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 183 | my %areagrays; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 183 | @areagrays{@areas} = @colors; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 183 | $areagrays{ase} = "gray35"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 183 | $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 | 1990 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
colors2string: called CC=7 SCAR=19.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 1990 | my($colors) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 1990 | ▶ | if (my $area = $colors->{gray}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 1875 | ▶ | my $areagrays = $self->{areagrays} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 1875 | my $gray = $areagrays->{$area}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 1875 | delete $colors->{purple}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 1875 | ▶ | if (! $gray) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | $self->error($colors->{purple} = "Unexpected area $area."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 1875 | ▶ | $colors->{$gray} = $area eq "ase" ? "AS external" : "Area: $area"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 1875 | delete $colors->{gray}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 1990 | ▶ | if (my @areas = uniq @{$colors->{black} || []}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 115 | $colors->{black} = "Areas: @areas"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 1990 | 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 112 | ▶ | while (my($rid,$rv) = each %$routehash) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 252 | my %colors; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 252 | my @areas = sort keys %{$rv->{areas}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 252 | ▶ | if (@areas > 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 49 | $colors{black} = \@areas; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 49 | ▶ | if (my @badareas = map { $_->{area} || () } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | $self->error($colors{yellow} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 1 | "Router $rid has multiple entries in areas @badareas."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 252 | ▶ | if ($rv->{missing}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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 | 183 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create_router: called CC=14 SCAR=26.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 183 | my($index) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 183 | my $routerid = $self->{ospf}{self}{routerid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 183 | my %routehash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | my %pointtopointhash; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 183 | my %transithash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 183 | my %transitnets; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 183 | my %stubhash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 183 | my %stubs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 183 | my %stubareas; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 183 | my %virtualhash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 183 | my($transitindex, $stubindex) = (0, 0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 183 | foreach my $r (@{$self->{ospf}{database}{routers}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 453 | ▶ | my $rid = $self->ipv6 ? $r->{routerid} : $r->{router}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 453 | my $area = $r->{area}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 453 | my $bits = $r->{bits}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 453 | my $elem = $routehash{$rid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 453 | ▶ | if (! $elem) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 373 | $routehash{$rid} = $elem = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | $elem->{graph} = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | N => "router$$index", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | label => $rid, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | shape => "box", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 373 | ▶ | style => $bits->{B} ? "bold" : "solid", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 373 | $elem->{index} = $$index++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 373 | ▶ | if ($rid eq $routerid) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 172 | $elem->{graph}{peripheries} = 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 453 | push @{$elem->{hashes}}, $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 453 | ▶ | if ($self->ipv6) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 162 | my $lsid = $r->{router}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 162 | $elem->{areas}{$area}{$lsid}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 291 | $elem->{areas}{$area}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 453 | foreach my $l (@{$r->{pointtopoints}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 40 | $self->add_router_value(\%pointtopointhash, $rid, $area, $l); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 40 | $self->{ifaddrs}{$l->{interface}}{$rid}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 453 | foreach my $l (@{$r->{transits}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 301 | $self->add_transit_value(\%transithash, \%transitnets, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | \$transitindex, $rid, $area, $l); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 301 | $self->{ifaddrs}{$l->{interface}}{$rid}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 453 | foreach my $l (@{$r->{stubs}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 36 | $self->add_stub_value(\%stubhash, \%stubs, \%stubareas, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | \$stubindex, $rid, $area, $l); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 453 | foreach my $l (@{$r->{virtuals}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 40 | $self->add_router_value(\%virtualhash, $rid, $area, $l); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 183 | $self->{routehash} = \%routehash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 183 | $self->{pointtopointhash} = \%pointtopointhash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 183 | $self->{transithash} = \%transithash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 183 | $self->{transitnets} = \%transitnets; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 183 | ▶ | $self->{stubhash} = \%stubhash unless $self->ipv6; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 183 | ▶ | $self->{stubs} = \%stubs unless $self->ipv6; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 183 | ▶ | $self->{stubareas} = \%stubareas unless $self->ipv6; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 183 | $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=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 112 | my($index) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 112 | my %rid2areas; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 112 | ▶ | my $nethash = $self->{nethash} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 92 | my @hashes = map { @{$_->{hashes}} } map { values %$_ } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 112 | map { values %$_ } map { values %$_ } values %$nethash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 112 | foreach my $n (@hashes) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 94 | my $area = $n->{area}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 94 | $rid2areas{$n->{routerid}}{$area} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 94 | foreach (@{$n->{attachments}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 196 | $rid2areas{$_->{routerid}}{$area} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 112 | $self->add_missing_router_common($index, %rid2areas); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | sub add_missing_router_common { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 183 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_missing_router_common: called CC=14 SCAR=26.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 183 | my($index, %rid2areas) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 183 | my $boundhash = $self->{boundhash}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 183 | my $externhash = $self->{externhash}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 99 | my @rids = map { keys %{$_->{routers}} } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 183 | map { values %$_ } values %$externhash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 183 | foreach my $rid (@rids) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | # if ase is conneted to boundary router, router is not missing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 153 | ▶ | next if $boundhash->{$rid}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 43 | $rid2areas{$rid}{ase} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 183 | my $sumhash = $self->{sumhash}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 165 | my @arearids = map { $_->{arearids} } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 183 | (values %$boundhash, map { values %$_ } values %$sumhash); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 183 | foreach my $ar (@arearids) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 165 | ▶ | while (my($area,$av) = each %$ar) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 226 | ▶ | while (my($rid,$num) = each %$av) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 376 | $rid2areas{$rid}{$area} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 183 | foreach my $type (qw(pointtopoint virtual)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 366 | ▶ | my $linkhash = $self->{$type."hash"} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 366 | ▶ | while (my($dstrid,$dv) = each %$linkhash) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 74 | ▶ | while (my($area,$av) = each %$dv) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 74 | $rid2areas{$dstrid}{$area} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 183 | my $routerid = $self->{ospf}{self}{routerid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 183 | ▶ | my $routehash = $self->{routehash} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 183 | foreach my $rid (sort keys %rid2areas) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 346 | my $rv = $rid2areas{$rid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 346 | my $elem = $routehash->{$rid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 346 | ▶ | if (! $elem) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 25 | $routehash->{$rid} = $elem = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | $elem->{graph} = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 25 | N => "router$$index", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | label => $rid, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | shape => "box", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | style => "dotted", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 25 | $elem->{index} = $$index++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 25 | ▶ | if ($rid eq $routerid) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 11 | $elem->{graph}{peripheries} = 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 25 | push @{$elem->{hashes}}, {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 25 | $elem->{areas} = $rv; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 25 | $elem->{missing}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | # take router hash, boundary hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | # remove duplicate routers from boundary hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | sub remove_duplicate_router { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 183 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
remove_duplicate_router: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 183 | ▶ | my $routehash = $self->{routehash} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 183 | my $boundhash = $self->{boundhash}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | # if AS boundary router is also regular router, only use the regular | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 183 | ▶ | while (my($asbr,$bv) = each %$boundhash) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 101 | ▶ | if ($routehash->{$asbr}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 34 | delete $bv->{graph}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | # take hash containing router nodes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | # return list of nodes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | sub router2nodes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 183 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
router2nodes: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 183 | ▶ | my $routehash = $self->{routehash} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 183 | return $self->elements2graphs(values %$routehash); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | # RFC 2328 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | # Type Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | # __________________________________________________ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | # 1 Point-to-point connection to another router | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | # pointtopoints => [ { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | # interface => 'ipv4', # Link Data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | # # interface's ifIndex value | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | # metric => 'int', # metric | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | # routerid => 'ipv4', # Link ID | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | # # Neighboring router's Router ID | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | # ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | # $pointtopointhash{$pointtopointrouterid}{$area}{$routerid} = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | # hashes => [ { link hash } ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | # RFC 2328 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | # Type Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | # __________________________________________________ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | # 4 Virtual link | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | # virtuals => [ { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | # interface => 'ipv4', # Link Data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | # # router interface's IP address | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | # metric => 'int', # metric | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | # routerid => 'ipv4', # Link ID | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | # # Neighboring router's Router ID | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | # ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | # $virtualhash{$virtualrouterid}{$area}{$routerid} = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | # hashes => [ { link hash } ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | # take pointtopoint or virtual hash, type, router id, area, link structure | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | # add new element to pointtopoint or virtual hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | sub add_router_value { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 80 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_router_value: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 80 | my($linkhash, $rid, $area, $link) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 80 | my $dstrid = $link->{routerid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 80 | my $elem = $linkhash->{$dstrid}{$area}{$rid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 80 | ▶ | if (! $elem) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 74 | $linkhash->{$dstrid}{$area}{$rid} = $elem = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 80 | push @{$elem->{hashes}}, $link; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | # take link hash, type (pointtopoint or virtual), router hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | # return list of edges from src router to dst router | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | sub router2edges { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 224 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
router2edges: called CC=21 SCAR=30.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 224 | my($type) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 224 | ▶ | my $name = $type eq "pointtopoint" ? "Point-to-point" : "Virtual"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 224 | ▶ | my $style = $type eq "pointtopoint" ? "solid" : "dotted"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 224 | ▶ | my $routehash = $self->{routehash} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 224 | ▶ | my $linkhash = $self->{$type."hash"} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 224 | my $ifaddrs = $self->{ifaddrs}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 224 | my @elements; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 224 | my $index = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 224 | foreach my $dstrid (sort keys %$linkhash) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 52 | my $dv = $linkhash->{$dstrid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 52 | foreach my $area (sort keys %$dv) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 52 | my $ev = $dv->{$area}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 52 | foreach my $rid (sort keys %$ev) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 52 | my $rv = $ev->{$rid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 52 | my %colors = (gray => $area); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 52 | my $src = $routehash->{$rid}{graph}{N}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | 52 | my $dst = $routehash->{$dstrid}{graph}{N}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 52 | my @hashes = @{$rv->{hashes}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 52 | ▶ | if ($type ne "pointtopoint" && @hashes > 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$type ne "pointtopoint" and @hashes > 1
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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | $self->error($colors{yellow} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 2 | "$name link at router $rid to router $dstrid ". | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | "has multiple entries in area $area."); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 52 | ▶ | if (! $routehash->{$dstrid}{areas}{$area}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | $self->error($colors{orange} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 4 | "$name link at router $rid to router $dstrid ". | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | "not in same area $area."); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | ▶ | } elsif (! ($linkhash->{$rid} && $linkhash->{$rid}{$area} && | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition77%7/9
$linkhash->{$rid} && $linkhash->{$rid}{$area} && $linkhash->{$rid}{$area}{$dstrid} || $routehash->{$dstrid}{'missing'}
$linkhash->{$rid} and $linkhash->{$rid}{$area} and $linkhash->{$rid}{$area}{$dstrid}
$linkhash->{$rid} and $linkhash->{$rid}{$area}
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'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | $linkhash->{$rid}{$area}{$dstrid}) && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | ! $routehash->{$dstrid}{missing}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | $self->error($colors{brown} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | 2 | "$name link at router $rid to router $dstrid ". | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | "not symmetric in area $area."); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 52 | foreach my $link (@hashes) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 55 | my $intf = $link->{interface}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 55 | delete $colors{green}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 55 | ▶ | if ($type eq "pointtopoint" and $ifaddrs->{$intf} && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$type eq "pointtopoint" and ($ifaddrs->{$intf} and $ifaddrs->{$intf}{$rid} > 1)
$ifaddrs->{$intf} and $ifaddrs->{$intf}{$rid} > 1
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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | $ifaddrs->{$intf}{$rid} > 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | $self->error($colors{green} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 1 | "$name link at router $rid to router $dstrid ". | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | "interface address $intf not unique."); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 55 | delete $colors{blue}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 55 | ▶ | if ($type eq "pointtopoint" and my @badrids = sort | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$type eq "pointtopoint" and my(@badrids) = sort(grep({$_ ne $rid;} keys %{$$ifaddrs{$intf};}))
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};}))
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 28 | grep { $_ ne $rid } keys %{$ifaddrs->{$intf}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | $self->error($colors{blue} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | 1 | "$name link at router $rid to router $dstrid ". | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | "interface address $intf also at router @badrids."); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 55 | my $metric = $link->{metric}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 55 | push @elements, { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | graph => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | S => $src, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | D => $dst, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | label => $intf, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | style => $style, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | taillabel => $metric, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | colors => { %colors }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | index => $index++, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | 224 | return $self->elements2graphs(@elements); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | # RFC 2328 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | # Type Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | # __________________________________________________ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | # 2 Connection to a transit network | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | # transits => [ { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | # address => 'ipv4', # Link ID | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | # # IP address of Designated Router | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | # interface => 'ipv4', # Link Data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | # # router interface's IP address | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | # metric => 'int', # metric | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | # ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | # $transithash{$transitaddress}{$area}{$routerid} = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | # graph => { N => transit2, color => red, style => solid, } (optional) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | # hashes => [ { link hash } ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | # $transitnets->{$interface}{$routerid}{$area}{$address}++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | # take transit hash, transit cluster hash, net hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | # detect inconsistencies and set colors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | sub check_transit { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 112 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
check_transit: called CC=14 SCAR=26.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 112 | my($transitcluster) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 112 | ▶ | my $nethash = $self->{nethash} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 112 | ▶ | my $transithash = $self->{transithash} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 112 | foreach my $addr (sort keys %$transithash) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 95 | my $av = $transithash->{$addr}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | 95 | my %colors; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 95 | ▶ | if (! $nethash->{$addr} && keys %$av > 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not $nethash->{$addr} and keys %$av > 1
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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | $self->error($colors{orange} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 3 | "Transit network $addr missing in multiple areas."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 95 | foreach my $area (sort keys %$av) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 101 | my $ev = $av->{$area}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 101 | $colors{gray} = $area; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | 101 | delete $colors{blue}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 101 | ▶ | if (! $nethash->{$addr} && keys %$ev > 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not $nethash->{$addr} and keys %$ev > 1
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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | $self->error($colors{blue} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 3 | "Transit network $addr missing in area $area ". | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | "at multiple routers."); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | 101 | foreach my $rid (sort keys %$ev) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 193 | my $rv = $ev->{$rid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 193 | ▶ | next unless $rv->{graph}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | 15 | delete @colors{qw(yellow red)}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | 15 | ▶ | if ($nethash->{$addr}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | $self->error($colors{yellow} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | 1 | "Transit network $addr in area $area ". | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | "at router $rid and network not in same area."); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | ▶ | } elsif (! $colors{orange} && ! $colors{blue}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$colors{'orange'} || $colors{'blue'}
MC/DC100%2/2
$colors{'orange'} || $colors{'blue'}
$colors{'orange'}
$colors{'blue'}
Truth table100%3/3
A || B
A= $colors{'orange'}B= $colors{'blue'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | $self->error($colors{red} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | 3 | "Transit network $addr network missing."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 15 | %{$rv->{colors}} = %colors; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | 15 | push @{$transitcluster->{$addr}}, $rv->{graph}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | # take transit hash, router id, area, link structure, network hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | # add new element to transit hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | sub add_transit_value { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 195 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_transit_value: called CC=6 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | 195 | my($transithash, $transitnets, $index, $rid, $area, $link) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | 195 | ▶ | my $nethash = $self->{nethash} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | 195 | my $addr = $link->{address}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | 195 | my $intf = $link->{interface}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | 195 | $transitnets->{$intf}{$rid}{$area}{$addr}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | 195 | my $elem = $transithash->{$addr}{$area}{$rid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | 195 | ▶ | if (! $elem) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | 193 | $transithash->{$addr}{$area}{$rid} = $elem = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | # check if address is in nethash and in matching nethash area | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 193 | ▶ | if (! $nethash->{$addr} || ! map { $_->{$area} ? 1 : () } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%3/3
$nethash->{$addr} and map {$_->{$area} ? 1 : ();} map({values %$_;} values %{$$nethash{$addr};})
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};})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | 181 | map { values %$_ } values %{$nethash->{$addr}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | $elem->{graph} = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | 15 | N => "transitnet$$index", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | label => $addr, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | shape => "ellipse", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | style => "dotted", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | 15 | $elem->{index} = $$index++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | 195 | push @{$elem->{hashes}}, $link; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | # take hash containing transit network nodes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | # return list of nodes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | sub transit2nodes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | 112 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
transit2nodes: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | 112 | ▶ | my $transithash = $self->{transithash} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | 112 | return $self->elements2graphs(map { values %$_ } map { values %$_ } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | values %$transithash); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | # take link hash, router hash, network hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | # return list of edges from router to transit network | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | sub transit2edges { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | 112 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
transit2edges: called CC=23 SCAR=31.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | 112 | ▶ | my $nethash = $self->{nethash} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | 112 | ▶ | my $routehash = $self->{routehash} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | 112 | ▶ | my $transithash = $self->{transithash} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | 112 | my $ifaddrs = $self->{ifaddrs}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | 112 | my @elements; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | 112 | my $index = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | 112 | foreach my $addr (sort keys %$transithash) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | 95 | my $av = $transithash->{$addr}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | 95 | foreach my $area (sort keys %$av) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | 101 | my $ev = $av->{$area}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | 101 | foreach my $rid (sort keys %$ev) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | 193 | my $rv = $ev->{$rid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | 193 | my %colors = (gray => $area); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | 193 | my $src = $routehash->{$rid}{graph}{N}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | 193 | ▶ | if (@{$rv->{hashes}} > 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | $self->error($colors{yellow} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | 2 | "Transit network $addr at router $rid ". | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | "has multiple entries in area $area."); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | 193 | foreach my $link (@{$rv->{hashes}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | 195 | my $intf = $link->{interface}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | 195 | delete $colors{green}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | 195 | ▶ | if ($ifaddrs->{$intf} && $ifaddrs->{$intf}{$rid} > 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$ifaddrs->{$intf} and $ifaddrs->{$intf}{$rid} > 1
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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | $self->error($colors{green} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | 3 | "Transit link at router $rid to network $addr ". | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | "interface address $intf not unique."); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | 195 | delete $colors{blue}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | 195 | ▶ | if (my @badrids = sort grep { $_ ne $rid } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | 195 | keys %{$ifaddrs->{$intf}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | $self->error($colors{blue} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | 3 | "Transit link at router $rid to network $addr ". | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | "interface address $intf also at router @badrids."); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | 195 | my $metric = $link->{metric}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | # link from designated router to attached net | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | 195 | ▶ | my $style = $addr eq $intf ? "bold" : "solid"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | 195 | delete $colors{magenta}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | 195 | delete $colors{brown}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | 195 | delete $colors{tan}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | 195 | ▶ | if ($rv->{graph}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | 16 | my $dst = $rv->{graph}{N}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | 16 | push @elements, { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | graph => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | S => $src, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | D => $dst, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | headlabel => $intf, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | style => $style, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | taillabel => $metric, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | colors => { %colors }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | index => $index++, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | 16 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | 179 | my $av = $nethash->{$addr}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | 179 | foreach my $mask (sort keys %$av) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | 181 | my $mv = $av->{$mask}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | 181 | my $nid = "$addr/$mask"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | 181 | my $intfip = $intf; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | 181 | foreach (split(/\./, $mask)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | 724 | ▶ | last if $_ ne 255; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | 543 | $intfip =~ s/^\.?\d+//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | 181 | delete $colors{magenta}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | 181 | ▶ | if (_maskip($addr, $mask) ne _maskip($intf, $mask)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | $self->error($colors{magenta} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | 1 | "Transit network $addr in area $area ". | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | "at router $rid interface $intf ". | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | "not in network $nid."); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | 1 | $intfip = $intf; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | 181 | foreach my $netrid (sort keys %$mv) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | 187 | my $nv = $mv->{$netrid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | 187 | ▶ | my $ev = $nv->{$area} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | 183 | delete $colors{brown}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | 183 | delete $colors{tan}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | 183 | ▶ | if (! $ev->{attachrouters}{$rid}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | $self->error($colors{brown} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | 2 | "Transit link at router $rid not attached ". | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | "by network $nid in area $area."); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | ▶ | } elsif ($addr eq $intf && $netrid ne $rid) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$addr eq $intf and $netrid ne $rid
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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | $self->error($colors{tan} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | 2 | "Transit link at router $rid in area $area ". | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | "is designated but network $nid is not."); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | 183 | my $dst = $ev->{graph}{N}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | 183 | push @elements, { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | graph => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | S => $src, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | D => $dst, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | headlabel => $intfip, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | style => $style, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | taillabel => $metric, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | colors => { %colors }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | index => $index++, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | 112 | return $self->elements2graphs(@elements); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | # RFC 2328 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | # Type Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | # __________________________________________________ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | # 3 Connection to a stub network | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | # stubs => [ { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | # metric => 'int', # metric | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | # netmask => 'ipv4', # Link Data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | # # network's IP address mask | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | # network => 'ipv4', # Link ID | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | # # IP network/subnet number | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | # ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | # $network = $network & $netmask | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | # $stubhash{$network}{$netmask}{$area}{$routerid} = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | # graph => { N => stub3, color => red, style => solid, } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | # hashes => [ { link hash } ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | # take transit hash, net cluster hash, network hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | # detect inconsistencies and set colors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | sub check_stub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | 112 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
check_stub: called CC=16 SCAR=27.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | 112 | my($netcluster) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | 112 | ▶ | my $nethash = $self->{nethash} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | 112 | my %netsmv; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | 112 | foreach my $addr (sort keys %$nethash) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | 88 | my $av = $nethash->{$addr}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | 88 | foreach my $mask (sort keys %$av) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | 89 | my $mv = $av->{$mask}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | 89 | my $net = _maskip($addr, $mask); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | 89 | push @{$netsmv{$net}{$mask}}, $mv; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | 112 | ▶ | my $stubhash = $self->{stubhash} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | 112 | foreach my $net (sort keys %$stubhash) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | 31 | my $nv = $stubhash->{$net}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | 31 | foreach my $mask (sort keys %$nv) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | 31 | my $mv = $nv->{$mask}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | 31 | my %colors; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | 31 | my $nid = "$net/$mask"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | 31 | ▶ | if ($netsmv{$net}{$mask}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | $self->error($colors{blue} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | 5 | "Stub network $nid is also network."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | 31 | delete $colors{orange}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | 31 | ▶ | if (keys %$mv > 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | $self->error($colors{orange} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | 1 | "Stub network $nid in multiple areas."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | 31 | foreach my $area (sort keys %$mv) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | 32 | my $ev = $mv->{$area}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | 32 | $colors{gray} = $area; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | 32 | delete $colors{green}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | 32 | ▶ | if (keys %$ev > 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | $self->error($colors{green} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | 1 | "Stub network $nid in area $area at multiple routers."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | 32 | delete $colors{magenta}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | 32 | ▶ | if ($netsmv{$net}{$mask} and my @otherareas = sort | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$netsmv{$net}{$mask} and my(@otherareas) = sort(grep({$_ ne $area;} map({keys %$_;} map({values %$_;} @{$netsmv{$net}{$mask};}))))
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};}))))
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | 7 | grep { $_ ne $area } map { keys %$_ } map { values %$_ } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | 5 | @{$netsmv{$net}{$mask}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | $self->error($colors{magenta} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | 1 | "Stub network $nid in area $area ". | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | "is also network in areas @otherareas."); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | 32 | foreach my $rid (sort keys %$ev) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | 33 | my $rv = $ev->{$rid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | 33 | delete $colors{yellow}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | 33 | ▶ | if ($netsmv{$net}{$mask} and grep { $_->{$rid} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$netsmv{$net}{$mask} and grep {$_->{$rid};} @{$netsmv{$net}{$mask};}
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};}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | 5 | @{$netsmv{$net}{$mask}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | $self->error($colors{yellow} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | 1 | "Stub network $nid is also network at router $rid."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | 33 | %{$rv->{colors}} = %colors; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | 33 | push @{$netcluster->{"$net/$mask"}}, $rv->{graph}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | # take stub hash, router id, area, link structure | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | # add new element to stub hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | sub add_stub_value { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | 36 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_stub_value: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | 36 | my($stubhash, $stubs, $stubareas, $index, $rid, $area, $link) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | 36 | my $addr = $link->{network}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | 36 | my $mask = $link->{netmask}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | 36 | my $net = _maskip($addr, $mask); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | 36 | $stubs->{$net}{$mask}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | 36 | $stubareas->{$net}{$mask}{$area}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | 36 | my $elem = $stubhash->{$net}{$mask}{$area}{$rid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | 36 | ▶ | if (! $elem) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | 33 | $stubhash->{$net}{$mask}{$area}{$rid} = $elem = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | $elem->{graph} = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | 33 | N => "stubnet$$index", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | label => "$net\\n$mask", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | shape => "ellipse", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | style => "solid", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | 33 | $elem->{index} = $$index++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | 36 | push @{$elem->{hashes}}, $link; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | # take hash containing stub network nodes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | # return list of nodes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | sub stub2nodes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | 112 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stub2nodes: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | 112 | ▶ | my $stubhash = $self->{stubhash} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | 32 | return $self->elements2graphs(map { values %$_ } map { values %$_ } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | 112 | map { values %$_ } values %$stubhash); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | # take link hash, router hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | # return list of edges from router to stub network | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | sub stub2edges { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | 112 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stub2edges: called CC=12 SCAR=24.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | 112 | ▶ | my $routehash = $self->{routehash} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | 112 | ▶ | my $stubhash = $self->{stubhash} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | 112 | my @elements; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | 112 | my $index = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | 112 | foreach my $net (sort keys %$stubhash) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | 31 | my $nv = $stubhash->{$net}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | 31 | foreach my $mask (sort keys %$nv) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | 31 | my $mv = $nv->{$mask}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | 31 | foreach my $area (sort keys %$mv) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | 32 | my $ev = $mv->{$area}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | 32 | foreach my $rid (sort keys %$ev) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | 33 | my $rv = $ev->{$rid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | 33 | my %colors = (gray => $area); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | 33 | my $src = $routehash->{$rid}{graph}{N}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | 33 | my $nid = "$net/$mask"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | 33 | ▶ | if (@{$rv->{hashes}} > 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | $self->error($colors{yellow} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | 2 | "Stub network $nid at router $rid ". | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | "has multiple entries in area $area."); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | 33 | foreach my $link (@{$rv->{hashes}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | 36 | my $dst = $rv->{graph}{N}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | 36 | my $addr = $link->{network}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | 36 | my @headlabel; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | 36 | delete $colors{magenta}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | 36 | ▶ | if ($net ne $addr) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | $self->error($colors{magenta} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | 3 | "Stub network $nid address $addr ". | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | "is not network."); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | 3 | my $intfip = $addr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | 3 | foreach (split(/\./, $mask)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | 12 | ▶ | last if $_ ne 255; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | 9 | $intfip =~ s/^\.?\d+//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | 3 | @headlabel = (headlabel => $intfip); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | 36 | my $metric = $link->{metric}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | 36 | push @elements, { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | graph => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | S => $src, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | D => $dst, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | @headlabel, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | style => "solid", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | taillabel => $metric, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | colors => { %colors }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | index => $index++, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | 112 | return $self->elements2graphs(@elements); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | # RFC 2328 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | # LS LSA LSA description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | # type name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | # ________________________________________________________ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | # 2 Network-LSAs Originated for broadcast | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | # and NBMA networks by | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | # the Designated Router. This | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | # LSA contains the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | # list of routers connected | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | # to the network. Flooded | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | # throughout a single area only. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | # networks => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | # address => 'ipv4', # Link State ID | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | # area => 'ipv4', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | # attachments => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | # routerid => 'ipv4', # Attached Router | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | # ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | # netmask => 'ipv4', # Network Mask | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | # routerid => 'ipv4', # Advertising Router | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | # ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | # $network = $address & $netmask | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | # $nethash{$address}{$netmask}{$routerid}{$area} = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | # graph => { N => network1, color => red, style => bold, } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | # hashes => [ { network hash } ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 970 | # attachrouters => { $attrid => 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 971 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 972 | # $nets{$network}{$netmask}++ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 973 | # $netareas{$network}{$netmask}{$area}++ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 974 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 975 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 976 | # take network hash, net cluster hash, net hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 977 | # detect inconsistencies and set colors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 978 | sub check_network { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 979 | 112 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
check_network: called CC=14 SCAR=26.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 980 | 112 | my($netcluster) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 981 | 112 | ▶ | my $nethash = $self->{nethash} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 982 | 112 | ▶ | my $nets = $self->{nets} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 983 | 112 | my %colors; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 984 | 112 | foreach my $addr (sort keys %$nethash) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 985 | 88 | my $av = $nethash->{$addr}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 986 | 88 | delete $colors{magenta}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 987 | 88 | ▶ | if (keys %$av > 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 988 | $self->error($colors{magenta} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 989 | 1 | "Network $addr with multiple netmasks."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 990 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 991 | 88 | foreach my $mask (sort keys %$av) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 992 | 89 | my $mv = $av->{$mask}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 993 | 89 | my $nid = "$addr/$mask"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 994 | 89 | my $net = _maskip($addr, $mask); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 995 | 89 | delete $colors{green}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 996 | 89 | ▶ | if ($nets->{$net}{$mask} > 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 997 | $self->error($colors{green} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 998 | 11 | "Network $nid not unique in network $net."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 999 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | 89 | delete $colors{blue}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | 89 | ▶ | if (keys %$mv > 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | $self->error($colors{blue} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | 2 | "Network $nid at multiple routers."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | 89 | foreach my $rid (sort keys %$mv) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | 91 | my $rv = $mv->{$rid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | 91 | delete $colors{orange}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | 91 | ▶ | if (keys %$rv > 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | $self->error($colors{orange} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | 1 | "Network $nid at router $rid in multiple areas."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | 91 | foreach my $area (sort keys %$rv) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | 92 | my $ev = $rv->{$area}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | 92 | $colors{gray} = $area; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | 92 | delete $colors{yellow}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | 92 | ▶ | if (@{$ev->{hashes}} > 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | $self->error($colors{yellow} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | 2 | "Network $nid at router $rid ". | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | "has multiple entries in area $area."); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | 92 | delete $colors{brown}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1022 | 92 | my @attrids = keys %{$ev->{attachrouters}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | 92 | ▶ | if (@attrids == 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | $self->error($colors{red} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | 1 | "Network $nid at router $rid not attached ". | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1026 | "to any router in area $area."); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | 92 | ▶ | if (@attrids == 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1029 | $self->error($colors{brown} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1030 | 1 | "Network $nid at router $rid attached only ". | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1031 | "to router @attrids in area $area."); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1032 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1033 | 92 | %{$ev->{colors}} = %colors; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1034 | 92 | push @{$netcluster->{"$net/$mask"}}, $ev->{graph}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1035 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1036 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1037 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1038 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1039 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1040 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1041 | # take network structure, net cluster hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1042 | # return network hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1043 | sub create_network { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1044 | 112 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create_network: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1045 | 112 | my($index) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1046 | 112 | my %nethash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1047 | my %nets; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1048 | 112 | my %netareas; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1049 | 112 | foreach my $n (@{$self->{ospf}{database}{networks}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1050 | 94 | my $addr = $n->{address}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1051 | 94 | my $mask = $n->{netmask}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1052 | 94 | my $nid = "$addr/$mask"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1053 | 94 | my $net = _maskip($addr, $mask); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1054 | 94 | $nets{$net}{$mask}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1055 | 94 | my $rid = $n->{routerid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1056 | 94 | my $area = $n->{area}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1057 | 94 | $netareas{$net}{$mask}{$area}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1058 | 94 | my $elem = $nethash{$addr}{$mask}{$rid}{$area}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1059 | 94 | ▶ | if (! $elem) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1060 | 92 | $nethash{$addr}{$mask}{$rid}{$area} = $elem = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1061 | $elem->{graph} = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1062 | 92 | N => "network$$index", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1063 | label => "$net\\n$mask", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1064 | shape => "ellipse", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1065 | style => "bold", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1066 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1067 | 92 | $elem->{index} = $$index++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1068 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1069 | 94 | push @{$elem->{hashes}}, $n; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1070 | 94 | foreach my $att (@{$n->{attachments}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1071 | 196 | $elem->{attachrouters}{$att->{routerid}} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1072 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1073 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1074 | 112 | $self->{nethash} = \%nethash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1075 | 112 | $self->{nets} = \%nets; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1076 | 112 | $self->{netareas} = \%netareas; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1077 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1078 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1079 | # only necessary for ipv6 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1080 | sub add_missing_network { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1081 | 112 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_missing_network: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1082 | 112 | my($index) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1083 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1084 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1085 | # take hash containing network nodes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1086 | # return list of nodes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1087 | sub network2nodes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1088 | 112 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
network2nodes: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1089 | 112 | ▶ | my $nethash = $self->{nethash} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1090 | 91 | return $self->elements2graphs(map { values %$_ } map { values %$_ } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1091 | 112 | map { values %$_ } values %$nethash); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1092 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1093 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1094 | # take network hash, router hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1095 | # return list of edges from transit network to router | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1096 | sub network2edges { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1097 | 112 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
network2edges: called CC=25 SCAR=32.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1098 | 112 | ▶ | my $nethash = $self->{nethash} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1099 | 112 | ▶ | my $routehash = $self->{routehash} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1100 | 112 | ▶ | my $transithash = $self->{transithash} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1101 | 112 | my @elements; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1102 | 112 | my $index = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1103 | 112 | foreach my $addr (sort keys %$nethash) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1104 | 88 | my $av = $nethash->{$addr}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1105 | 88 | foreach my $mask (sort keys %$av) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1106 | 89 | my $mv = $av->{$mask}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1107 | 89 | my $nid = "$addr/$mask"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1108 | 89 | my $intfip = $addr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1109 | 89 | foreach (split(/\./, $mask)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1110 | 356 | ▶ | last if $_ ne 255; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1111 | 267 | $intfip =~ s/^\.?\d+//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1112 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1113 | 89 | foreach my $rid (sort keys %$mv) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1114 | 91 | my $rv = $mv->{$rid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1115 | 91 | foreach my $area (sort keys %$rv) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1116 | 92 | my $ev = $rv->{$area}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1117 | 92 | my $src = $ev->{graph}{N}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1118 | 92 | foreach my $net (@{$ev->{hashes}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1119 | 94 | my %attcolors; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1120 | 94 | foreach (@{$net->{attachments}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1121 | 196 | my $arid = $_->{routerid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1122 | 196 | ▶ | if ($attcolors{$arid}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1123 | $self->error($attcolors{$arid}{yellow} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1124 | 2 | "Network $nid in area $area at router $rid ". | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1125 | "attached to router $arid multiple times."); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1126 | 2 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1127 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1128 | 194 | $attcolors{$arid}{gray} = $area; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1129 | 194 | ▶ | if ($routehash->{$arid}{areas} && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$routehash->{$arid}{"areas"} and not $routehash->{$arid}{"areas"}{$area}
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}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1130 | ! $routehash->{$arid}{areas}{$area}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1131 | $self->error($attcolors{$arid}{orange} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1132 | 4 | "Network $nid and router $arid ". | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1133 | "not in same area $area."); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1134 | 4 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1135 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1136 | 190 | my $tv = $transithash->{$addr}{$area}{$arid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1137 | 190 | ▶ | if (! $tv && ! $routehash->{$arid}{missing}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$tv or $routehash->{$arid}{"missing"}
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"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1138 | $self->error($attcolors{$arid}{brown} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1139 | 1 | "Network $nid not transit net ". | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1140 | "of attached router $arid in area $area."); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1141 | 1 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1142 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1143 | 189 | ▶ | if ($arid eq $rid && $tv && ! grep { $addr eq | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$arid eq $rid and $tv and not grep({$addr eq $_->{"interface"};} @{$$tv{"hashes"};})
$arid eq $rid and $tv
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"};})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1144 | 86 | $_->{interface} } @{$tv->{hashes}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1145 | $self->error($attcolors{$arid}{tan} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1146 | 11 | "Network $nid at router $arid in area $area ". | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1147 | "is designated but transit link is not."); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1148 | 11 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1149 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1150 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1151 | 94 | foreach (@{$net->{attachments}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1152 | 196 | my $arid = $_->{routerid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1153 | my $dst = $routehash->{$arid}{graph}{N} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1154 | 196 | ▶ | or die "No router graph $arid"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1155 | 196 | my $style = "solid"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1156 | 196 | my @taillabel; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1157 | 196 | ▶ | if ($arid eq $rid) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1158 | # router is designated router | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1159 | 93 | $style = "bold"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1160 | 93 | @taillabel = (taillabel => $intfip); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1161 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1162 | push @elements, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1163 | graph => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1164 | S => $src, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1165 | D => $dst, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1166 | style => $style, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1167 | @taillabel, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1168 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1169 | 196 | colors => { %{$attcolors{$arid}} }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1170 | index => $index++, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1171 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1172 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1173 | 94 | ▶ | if (! $attcolors{$rid}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1174 | my $dst = $routehash->{$rid}{graph}{N} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1175 | 3 | ▶ | or die "No router graph $rid"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1176 | 3 | $attcolors{$rid}{gray} = $area; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1177 | $self->error($attcolors{$rid}{red} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1178 | 3 | "Network $nid not attached ". | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1179 | "to designated router $rid in area $area."); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1180 | push @elements, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1181 | graph => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1182 | S => $src, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1183 | D => $dst, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1184 | style => "bold", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1185 | taillabel => $intfip, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1186 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1187 | 3 | colors => { %{$attcolors{$rid}} }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1188 | index => $index++, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1189 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1190 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1191 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1192 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1193 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1194 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1195 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1196 | 112 | return $self->elements2graphs(@elements); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1197 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1198 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1199 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1200 | # RFC 2328 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1201 | # LS LSA LSA description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1202 | # type name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1203 | # ________________________________________________________ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1204 | # 3 Summary-LSAs Originated by area border | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1205 | # routers, and flooded through- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1206 | # out the LSA's associated | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1207 | # area. Each summary-LSA | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1208 | # describes a route to a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1209 | # destination outside the area, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1210 | # yet still inside the AS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1211 | # (i.e., an inter-area route). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1212 | # Type 3 summary-LSAs describe | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1213 | # routes to networks. Type 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1214 | # summary-LSAs describe | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1215 | # routes to AS boundary routers. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1216 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1217 | # summarys => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1218 | # address => 'ipv4', # Link State ID | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1219 | # area => 'ipv4', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1220 | # metric => 'int', # metric | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1221 | # netmask => 'ipv4', # Network Mask | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1222 | # routerid => 'ipv4', # Advertising Router | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1223 | # ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1224 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1225 | # $network = $address & $netmask | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1226 | # $sumhash{$network}{$netmask} = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1227 | # graph => { N => summary4, color => red, style => solid, } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1228 | # hashes => [ { summary hash } ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1229 | # arearids => { $area => { $routerid => 1 } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1230 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1231 | # $sums{$network}{$netmask}++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1232 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1233 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1234 | # take summary hash, net cluster hash, network hash, stub hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1235 | # detect inconsistencies and set colors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1236 | sub check_summary { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1237 | 92 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
check_summary: called CC=10 SCAR=23.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1238 | 92 | my($netcluster) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1239 | 92 | ▶ | my $netareas = $self->{netareas} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1240 | 92 | ▶ | my $stubareas = $self->{stubareas} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1241 | 92 | ▶ | my $sumhash = $self->{sumhash} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1242 | 92 | foreach my $net (sort keys %$sumhash) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1243 | 55 | my $nv = $sumhash->{$net}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1244 | 55 | foreach my $mask (sort keys %$nv) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1245 | 55 | my $mv = $nv->{$mask}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1246 | 55 | my %colors; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1247 | 55 | my $nid = "$net/$mask"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1248 | 55 | my @areas = sort keys %{$mv->{arearids}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1249 | 55 | ▶ | if (@areas > 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1250 | 25 | $colors{black} = \@areas; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1251 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1252 | 30 | $colors{gray} = $areas[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1253 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1254 | 55 | ▶ | if (my @badareas = grep { $netareas->{$net}{$mask}{$_} } @areas) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1255 | $self->error($colors{blue} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1256 | 2 | "Summary network $nid is also network in areas @badareas."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1257 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1258 | 55 | ▶ | if ($stubareas and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$stubareas and my(@badareas) = grep({$stubareas->{$net}{$mask}{$_};} @areas)
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)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1259 | 80 | my @badareas = grep { $stubareas->{$net}{$mask}{$_} } @areas) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1260 | $self->error($colors{green} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1261 | 3 | "Summary network $nid is also stub network ". | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1262 | "in areas @badareas."); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1263 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1264 | 55 | $mv->{colors} = \%colors; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1265 | 55 | push @{$netcluster->{"$net/$mask"}}, $mv->{graph}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1266 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1267 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1268 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1269 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1270 | # take summary structure, net cluster hash, network hash, link hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1271 | # return summary hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1272 | sub create_summary { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1273 | 92 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create_summary: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1274 | 92 | my $index = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1275 | 92 | my %sumhash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1276 | my %sums; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1277 | 92 | foreach my $s (@{$self->{ospf}{database}{summarys}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1278 | 158 | my $addr = $s->{address}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1279 | 158 | my $mask = $s->{netmask}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1280 | 158 | my $nid = "$addr/$mask"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1281 | 158 | my $net = _maskip($addr, $mask); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1282 | 158 | $sums{$net}{$mask}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1283 | 158 | my $rid = $s->{routerid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1284 | 158 | my $area = $s->{area}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1285 | 158 | my $elem = $sumhash{$net}{$mask}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1286 | 158 | ▶ | if (! $elem) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1287 | 55 | $sumhash{$net}{$mask} = $elem = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1288 | $elem->{graph} = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1289 | 55 | N => "summary$index", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1290 | label => "$net\\n$mask", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1291 | shape => "ellipse", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1292 | style => "dashed", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1293 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1294 | 55 | $elem->{index} = $index++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1295 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1296 | 158 | push @{$elem->{hashes}}, $s; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1297 | 158 | $elem->{arearids}{$area}{$rid}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1298 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1299 | 92 | $self->{sumhash} = \%sumhash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1300 | 92 | $self->{sums} = \%sums; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1301 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1302 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1303 | # take hash containing summary nodes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1304 | # return list of nodes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1305 | sub summary2nodes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1306 | 144 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
summary2nodes: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1307 | 144 | ▶ | my $sumhash = $self->{sumhash} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1308 | 144 | return $self->elements2graphs(map { values %$_ } values %$sumhash); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1309 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1310 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1311 | # take summary hash, router hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1312 | # return list of edges from summary network to router | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1313 | sub summary2edges { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1314 | 92 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
summary2edges: called CC=13 SCAR=25.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1315 | 92 | ▶ | my $routehash = $self->{routehash} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1316 | 92 | ▶ | my $sumhash = $self->{sumhash} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1317 | 92 | my @elements; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1318 | 92 | my $index = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1319 | 92 | foreach my $net (sort keys %$sumhash) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1320 | 55 | my $nv = $sumhash->{$net}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1321 | 55 | foreach my $mask (sort keys %$nv) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1322 | 55 | my $mv = $nv->{$mask}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1323 | 55 | my $nid = "$net/$mask"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1324 | 55 | ▶ | my $src = $mv->{graph} && $mv->{graph}{N}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$mv->{'graph'} && $mv->{'graph'}{'N'}
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'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1325 | 55 | foreach my $s (@{$mv->{hashes}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1326 | 158 | my $rid = $s->{routerid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1327 | my $dst = $routehash->{$rid}{graph}{N} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1328 | 158 | ▶ | or die "No router graph $rid"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1329 | 158 | my $addr = $s->{address}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1330 | 158 | my $addrip = $addr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1331 | 158 | foreach (split(/\./, $mask)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1332 | 632 | ▶ | last if $_ ne 255; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1333 | 474 | $addrip =~ s/^\.?\d+//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1334 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1335 | 158 | my $area = $s->{area}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1336 | 158 | my %colors = (gray => $area); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1337 | 158 | ▶ | if (! $routehash->{$rid}{areas}{$area}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1338 | $self->error($colors{orange} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1339 | 1 | "Summary network $nid and router $rid ". | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1340 | "not in same area $area."); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1341 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1342 | 158 | ▶ | if ($mv->{arearids}{$area}{$rid} > 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1343 | $self->error($colors{yellow} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1344 | 4 | "Summary network $nid at router $rid ". | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1345 | "has multiple entries in area $area."); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1346 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1347 | 158 | my $metric = $s->{metric}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1348 | $s->{graph} = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1349 | 158 | S => $src, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1350 | D => $dst, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1351 | headlabel => $metric, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1352 | style => "dashed", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1353 | taillabel => $addrip, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1354 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1355 | 158 | $s->{colors} = \%colors; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1356 | 158 | $s->{index} = $index++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1357 | # in case of aggregation src is undef | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1358 | 158 | ▶ | push @elements, $s if $src; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1359 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1360 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1361 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1362 | 92 | return $self->elements2graphs(@elements); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1363 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1364 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1365 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1366 | # $sumaggr{$areaaggr}{$netaggr} = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1367 | # graph => { N => summary5, color => black, style => dashed, } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1368 | # routers => { $routerid => { $area => { $metric => [ { sum hash } ] } } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1369 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1370 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1371 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1372 | # take summary hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1373 | # return summary aggregate | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1374 | sub create_sumaggr { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1375 | 25 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create_sumaggr: called CC=27 SCAR=33.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1376 | # $ridnets{$rid}{$network} = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1377 | # color => orange, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1378 | # areas => { $area => { $metric => [ { sum hash } ] } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1379 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1380 | 25 | ▶ | my $sumhash = $self->{sumhash} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1381 | 25 | my %ridareanets; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1382 | 25 | my $index = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1383 | 25 | foreach my $net (sort keys %$sumhash) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1384 | 46 | my $nv = $sumhash->{$net}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1385 | 46 | foreach my $mask (sort keys %$nv) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1386 | 46 | my $mv = $nv->{$mask}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1387 | 46 | my $nid = "$net/$mask"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1388 | # no not aggregate clustered graphs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1389 | 46 | ▶ | next if $mv->{graph}{C}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1390 | 25 | my $colors = $mv->{colors}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1391 | # no not aggregate graphs with errors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1392 | 25 | ▶ | next if grep { ! /^(gray|black)$/ } keys %$colors; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1393 | 24 | my $areaaggr = join('\n', sort _cmp_ip keys %{$mv->{arearids}}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1394 | 24 | foreach my $s (@{$mv->{hashes}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1395 | 31 | my $rid = $s->{routerid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1396 | 31 | my $area = $s->{area}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1397 | 31 | my $metric = $s->{metric}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1398 | 31 | my $elem = $ridareanets{$rid}{$areaaggr}{$nid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1399 | 31 | ▶ | if (! $elem) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1400 | 27 | $ridareanets{$rid}{$areaaggr}{$nid} = $elem = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1401 | colors => { %$colors }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1402 | index => $index++, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1403 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1404 | ▶ | } elsif (! $elem->{colors}{gray} || ! $colors->{gray} || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%4/6
not $elem->{"colors"}{"gray"} && $colors->{"gray"} or $elem->{"colors"}{"gray"} ne $colors->{"gray"}
$elem->{'colors'}{'gray'} && $colors->{'gray'}
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"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1405 | $elem->{colors}{gray} ne $colors->{gray}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1406 | 3 | ▶ | push @{$elem->{colors}{black}}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%2/6
delete $elem->{'colors'}{'gray'} || ()
$colors->{'gray'} || ()
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= ()
Truth table33%1/3
A || B
A= $colors->{'gray'}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1407 | (delete($elem->{colors}{gray}) || ()), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1408 | 3 | ▶ | ($colors->{gray} || ()), @{$colors->{black} || []}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1409 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1410 | 31 | push @{$elem->{areas}{$area}{$metric}}, $s; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1411 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1412 | 24 | delete $mv->{graph}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1413 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1414 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1415 | 25 | my %sumaggr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1416 | 25 | $index = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1417 | 25 | foreach my $rid (sort keys %ridareanets) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1418 | 17 | my $rv = $ridareanets{$rid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1419 | 17 | foreach my $area (sort keys %$rv) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1420 | 18 | my $av = $rv->{$area}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1421 | 18 | my $netaggr = join('\n', sort _cmp_ip_net keys %$av); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1422 | 18 | my $elem = $sumaggr{$netaggr}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1423 | 18 | ▶ | if (! $elem) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1424 | 17 | $sumaggr{$netaggr} = $elem = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1425 | $elem->{graph} = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1426 | 17 | N => "summaryaggregate$index", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1427 | label => $netaggr, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1428 | shape => "ellipse", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1429 | style => "dashed", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1430 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1431 | 17 | $elem->{index} = $index++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1432 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1433 | 18 | foreach my $nid (sort keys %$av) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1434 | 27 | my $nv = $av->{$nid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1435 | 27 | my $colors = $nv->{colors}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1436 | 27 | ▶ | if (! $elem->{colors}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1437 | 17 | %{$elem->{colors}} = %$colors; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1438 | ▶ | } elsif (! $elem->{colors}{gray} || ! $colors->{gray} || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%4/6
not $elem->{"colors"}{"gray"} && $colors->{"gray"} or $elem->{"colors"}{"gray"} ne $colors->{"gray"}
$elem->{'colors'}{'gray'} && $colors->{'gray'}
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"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1439 | $elem->{colors}{gray} ne $colors->{gray}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1440 | 1 | ▶ | push @{$elem->{colors}{black}}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%2/6
delete $elem->{'colors'}{'gray'} || ()
$colors->{'gray'} || ()
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= ()
Truth table33%1/3
A || B
A= $colors->{'gray'}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1441 | (delete($elem->{colors}{gray}) || ()), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1442 | 1 | ▶ | ($colors->{gray} || ()), @{$colors->{black} || []}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1443 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1444 | 27 | foreach my $area (sort keys %{$nv->{areas}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1445 | 30 | my $ev = $nv->{areas}{$area}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1446 | 30 | foreach my $metric (sort keys %$ev) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1447 | 30 | my $ss = $ev->{$metric}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1448 | 30 | push @{$elem->{routers}{$rid}{$area}{$metric}}, @$ss; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1449 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1450 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1451 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1452 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1453 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1454 | 25 | $self->{sumaggr} = \%sumaggr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1455 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1456 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1457 | # take hash containing summary aggregated nodes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1458 | # return list of nodes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1459 | sub sumaggr2nodes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1460 | 25 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sumaggr2nodes: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1461 | 25 | ▶ | my $sumaggr = $self->{sumaggr} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1462 | 25 | return $self->elements2graphs(values %$sumaggr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1463 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1464 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1465 | # take summary aggregate | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1466 | # return list of edges from summary aggregate networks to router | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1467 | sub sumaggr2edges { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1468 | 25 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sumaggr2edges: called CC=9 SCAR=22.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1469 | 25 | ▶ | my $sumaggr = $self->{sumaggr} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1470 | 25 | my @elements; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1471 | 25 | foreach my $netaggr (sort keys %$sumaggr) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1472 | 17 | my $nv = $sumaggr->{$netaggr}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1473 | 17 | my $src = $nv->{graph}{N}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1474 | 17 | foreach my $rid (sort keys %{$nv->{routers}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1475 | 18 | my $rv = $nv->{routers}{$rid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1476 | 18 | foreach my $area (sort keys %$rv) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1477 | 20 | my $av = $rv->{$area}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1478 | 20 | foreach my $metric (sort keys %$av) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1479 | 22 | my $ss = $av->{$metric}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1480 | 22 | my $aggrs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1481 | 22 | foreach my $s (@$ss) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1482 | 31 | $s->{graph}{S} = $src; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1483 | # no not aggregate graphs with errors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1484 | 31 | ▶ | if (grep { ! /^(gray|black)$/ } keys %{$s->{colors}}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1485 | 2 | push @elements, $s; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1486 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1487 | 29 | delete $s->{graph}{taillabel}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1488 | 29 | $aggrs = $s; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1489 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1490 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1491 | 22 | ▶ | push @elements, $aggrs if $aggrs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1492 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1493 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1494 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1495 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1496 | 25 | return $self->elements2graphs(@elements); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1497 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1498 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1499 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1500 | # RFC 2328 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1501 | # LS LSA LSA description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1502 | # type name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1503 | # ________________________________________________________ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1504 | # 4 Summary-LSAs Originated by area border | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1505 | # routers, and flooded through- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1506 | # out the LSA's associated | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1507 | # area. Each summary-LSA | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1508 | # describes a route to a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1509 | # destination outside the area, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1510 | # yet still inside the AS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1511 | # (i.e., an inter-area route). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1512 | # Type 3 summary-LSAs describe | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1513 | # routes to networks. Type 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1514 | # summary-LSAs describe | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1515 | # routes to AS boundary routers. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1516 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1517 | # boundarys => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1518 | # area => 'ipv4', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1519 | # asbrouter => 'ipv4', # Link State ID | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1520 | # metric => 'int', # metric | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1521 | # routerid => 'ipv4', # Advertising Router | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1522 | # ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1523 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1524 | # $boundhash{$asbrouter} = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1525 | # graph => { N => boundary6, color => red, style => dashed, } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1526 | # hashes => [ { boundary hash } ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1527 | # arearids => { $area => { $routerid => 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1528 | # aggregate => { $asbraggr => 1 } (optional) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1529 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1530 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1531 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1532 | # take boundary hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1533 | # detect inconsistencies and set colors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1534 | sub check_boundary { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1535 | 151 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
check_boundary: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1536 | 151 | ▶ | my $boundhash = $self->{boundhash} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1537 | 151 | ▶ | while (my($asbr,$bv) = each %$boundhash) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1538 | 101 | my @areas = sort keys %{$bv->{arearids}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1539 | 101 | ▶ | if (@areas > 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1540 | 31 | $bv->{colors}{black} = \@areas; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1541 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1542 | 70 | $bv->{colors}{gray} = $areas[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1543 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1544 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1545 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1546 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1547 | # take boundary structure | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1548 | # return boundary hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1549 | sub create_boundary { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1550 | 99 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create_boundary: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1551 | 99 | my $index = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1552 | 99 | my %boundhash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1553 | 99 | foreach my $b (@{$self->{ospf}{database}{boundarys}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1554 | 180 | my $asbr = $b->{asbrouter}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1555 | 180 | my $rid = $b->{routerid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1556 | 180 | my $area = $b->{area}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1557 | 180 | my $elem = $boundhash{$asbr}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1558 | 180 | ▶ | if (! $elem) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1559 | 81 | $boundhash{$asbr} = $elem = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1560 | $elem->{graph} = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1561 | 81 | N => "boundary$index", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1562 | label => $asbr, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1563 | shape => "box", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1564 | style => "dashed", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1565 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1566 | 81 | $elem->{index} = $index++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1567 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1568 | 180 | push @{$elem->{hashes}}, $b; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1569 | 180 | $elem->{arearids}{$area}{$rid}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1570 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1571 | 99 | $self->{boundhash} = \%boundhash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1572 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1573 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1574 | # take hash containing boundary nodes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1575 | # return list of nodes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1576 | sub boundary2nodes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1577 | 151 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
boundary2nodes: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1578 | 151 | ▶ | my $boundhash = $self->{boundhash} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1579 | 151 | return $self->elements2graphs(values %$boundhash); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1580 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1581 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1582 | # take boundary hash, router hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1583 | # return list of edges from boundary router to router | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1584 | sub boundary2edges { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1585 | 99 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
boundary2edges: called CC=14 SCAR=26.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1586 | 99 | ▶ | my $routehash = $self->{routehash} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1587 | 99 | ▶ | my $boundhash = $self->{boundhash} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1588 | 99 | my @elements; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1589 | 99 | my $index = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1590 | 99 | foreach my $asbr (sort keys %$boundhash) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1591 | 81 | my $bv = $boundhash->{$asbr}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1592 | 81 | my $src; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1593 | 81 | ▶ | if ($bv->{graph}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1594 | 18 | $src = $bv->{graph}{N}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1595 | } elsif ($routehash->{$asbr}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1596 | $src = $routehash->{$asbr}{graph}{N} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1597 | 27 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1598 | 81 | foreach my $b (@{$bv->{hashes}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1599 | 180 | my $rid = $b->{routerid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1600 | my $dst = $routehash->{$rid}{graph}{N} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1601 | 180 | ▶ | or die "No router graph $rid"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1602 | 180 | my $area = $b->{area}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1603 | 180 | my %colors = (gray => $area); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1604 | 180 | ▶ | if ($asbr eq $rid) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1605 | $self->error($colors{brown} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1606 | 1 | "AS boundary router $asbr is advertized by itself ". | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1607 | "in area $area."); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1608 | ▶ | } elsif ($routehash->{$asbr} && $routehash->{$asbr}{areas}{$area}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$routehash->{$asbr} and $routehash->{$asbr}{"areas"}{$area}
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}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1609 | $self->error($colors{blue} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1610 | 8 | "AS boundary router $asbr is router in same area $area."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1611 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1612 | 180 | ▶ | if (! $routehash->{$rid}{areas}{$area}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1613 | $self->error($colors{orange} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1614 | 2 | "AS boundary router $asbr and router $rid ". | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1615 | "not in same area $area."); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1616 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1617 | 180 | ▶ | if ($bv->{arearids}{$area}{$rid} > 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1618 | $self->error($colors{yellow} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1619 | 8 | "AS boundary router $asbr at router $rid ". | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1620 | "has multiple entries in area $area."); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1621 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1622 | 180 | my $metric = $b->{metric}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1623 | $b->{graph} = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1624 | 180 | S => $src, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1625 | D => $dst, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1626 | headlabel => $metric, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1627 | style => "dashed", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1628 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1629 | 180 | $b->{colors} = \%colors; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1630 | 180 | $b->{index} = $index++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1631 | # in case of aggregation src is undef | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1632 | 180 | ▶ | push @elements, $b if $src; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1633 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1634 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1635 | 99 | return $self->elements2graphs(@elements); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1636 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1637 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1638 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1639 | # $boundaggr{$asbraggr} = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1640 | # graph => { N => boundary7, color => black, style => dashed, } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1641 | # routers => { $routerid => { $area => { $metric => [ { bound hash } ] } } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1642 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1643 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1644 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1645 | # take boundary hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1646 | # return boundary aggregate | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1647 | sub create_boundaggr { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1648 | 30 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create_boundaggr: called CC=25 SCAR=35.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1649 | # $ridasbrs{$rid}{$asbr} = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1650 | # color => orange, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1651 | # areas => { $area => { $metric => [ { bound hash } ] } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1652 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1653 | 30 | ▶ | my $boundhash = $self->{boundhash} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1654 | 30 | my %ridasbrs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1655 | 30 | my $index = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1656 | 30 | foreach my $asbr (sort keys %$boundhash) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1657 | 56 | my $bv = $boundhash->{$asbr}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1658 | # no not aggregate if ASBR has been deleted by create route | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1659 | 56 | ▶ | next unless $bv->{graph}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1660 | 36 | my $colors = $bv->{colors}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1661 | # no not aggregate graphs with errors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1662 | 36 | ▶ | next if grep { ! /^(gray|black)$/ } keys %$colors; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1663 | 36 | foreach my $b (@{$bv->{hashes}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1664 | 46 | my $rid = $b->{routerid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1665 | 46 | my $area = $b->{area}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1666 | 46 | my $metric = $b->{metric}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1667 | 46 | my $elem = $ridasbrs{$rid}{$asbr}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1668 | 46 | ▶ | if (! $elem) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1669 | 44 | $ridasbrs{$rid}{$asbr} = $elem = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1670 | colors => { %$colors }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1671 | index => $index++, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1672 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1673 | ▶ | } elsif (! $elem->{colors}{gray} || ! $colors->{gray} || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%2/6
not $elem->{"colors"}{"gray"} && $colors->{"gray"} or $elem->{"colors"}{"gray"} ne $colors->{"gray"}
$elem->{'colors'}{'gray'} && $colors->{'gray'}
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"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1674 | $elem->{colors}{gray} ne $colors->{gray}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1675 | 0 | ▶ | push @{$elem->{colors}{black}}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
delete $elem->{'colors'}{'gray'} || ()
$colors->{'gray'} || ()
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= ()
Truth table0%0/3
A || B
A= $colors->{'gray'}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1676 | (delete($elem->{colors}{gray}) || ()), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1677 | 0 | ▶ | ($colors->{gray} || ()), @{$colors->{black} || []}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1678 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1679 | 46 | push @{$elem->{areas}{$area}{$metric}}, $b; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1680 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1681 | 36 | delete $bv->{graph}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1682 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1683 | 30 | my %boundaggr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1684 | 30 | $index = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1685 | 30 | foreach my $rid (sort keys %ridasbrs) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1686 | 23 | my $rv = $ridasbrs{$rid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1687 | 23 | my $asbraggr = join('\n', sort _cmp_ip keys %$rv); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1688 | 23 | my $elem = $boundaggr{$asbraggr}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1689 | 23 | ▶ | if (! $elem) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1690 | 22 | $boundaggr{$asbraggr} = $elem = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1691 | $elem->{graph} = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1692 | 22 | N => "boundaryaggregate$index", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1693 | label => $asbraggr, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1694 | shape => "box", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1695 | style => "dashed", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1696 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1697 | 22 | $elem->{index} = $index++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1698 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1699 | 23 | foreach my $asbr (sort keys %$rv) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1700 | 44 | my $bv = $rv->{$asbr}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1701 | 44 | $boundhash->{$asbr}{aggregate}{$asbraggr}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1702 | 44 | my $colors = $bv->{colors}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1703 | 44 | ▶ | if (! $elem->{colors}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1704 | 22 | %{$elem->{colors}} = %$colors; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1705 | ▶ | } elsif (! $elem->{colors}{gray} || ! $colors->{gray} || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition83%5/6
not $elem->{"colors"}{"gray"} && $colors->{"gray"} or $elem->{"colors"}{"gray"} ne $colors->{"gray"}
$elem->{'colors'}{'gray'} && $colors->{'gray'}
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"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1706 | $elem->{colors}{gray} ne $colors->{gray}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1707 | 3 | ▶ | push @{$elem->{colors}{black}}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%3/6
delete $elem->{'colors'}{'gray'} || ()
$colors->{'gray'} || ()
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= ()
Truth table33%1/3
A || B
A= $colors->{'gray'}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1708 | (delete($elem->{colors}{gray}) || ()), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1709 | 3 | ▶ | ($colors->{gray} || ()), @{$colors->{black} || []}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1710 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1711 | 44 | foreach my $area (sort keys %{$bv->{areas}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1712 | 44 | my $ev = $bv->{areas}{$area}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1713 | 44 | foreach my $metric (sort keys %$ev) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1714 | 44 | my $bs = $ev->{$metric}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1715 | 44 | push @{$elem->{routers}{$rid}{$area}{$metric}}, @$bs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1716 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1717 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1718 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1719 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1720 | 30 | $self->{boundaggr} = \%boundaggr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1721 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1722 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1723 | # take hash containing boundary aggregated nodes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1724 | # return list of nodes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1725 | sub boundaggr2nodes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1726 | 30 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
boundaggr2nodes: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1727 | 30 | ▶ | my $boundaggr = $self->{boundaggr} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1728 | 30 | return $self->elements2graphs(values %$boundaggr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1729 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1730 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1731 | # take boundary aggregate | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1732 | # return list of edges from boundary aggregate routers to router | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1733 | sub boundaggr2edges { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1734 | 30 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
boundaggr2edges: called CC=9 SCAR=22.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1735 | 30 | ▶ | my $boundaggr = $self->{boundaggr} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1736 | 30 | my @elements; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1737 | 30 | foreach my $asbraggr (sort keys %$boundaggr) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1738 | 22 | my $bv = $boundaggr->{$asbraggr}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1739 | 22 | my $src = $bv->{graph}{N}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1740 | 22 | foreach my $rid (sort keys %{$bv->{routers}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1741 | 23 | my $rv = $bv->{routers}{$rid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1742 | 23 | foreach my $area (sort keys %$rv) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1743 | 25 | my $av = $rv->{$area}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1744 | 25 | foreach my $metric (sort keys %$av) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1745 | 27 | my $bs = $av->{$metric}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1746 | 27 | my $aggrb; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1747 | 27 | foreach my $b (@$bs) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1748 | 46 | $b->{graph}{S} = $src; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1749 | # no not aggregate graphs with errors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1750 | 46 | ▶ | if (grep { ! /^(gray|black)$/ } keys %{$b->{colors}}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1751 | 4 | push @elements, $b; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1752 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1753 | 42 | $aggrb = $b; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1754 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1755 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1756 | 27 | ▶ | push @elements, $aggrb if $aggrb; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1757 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1758 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1759 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1760 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1761 | 30 | return $self->elements2graphs(@elements); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1762 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1763 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1764 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1765 | # RFC 2328 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1766 | # LS LSA LSA description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1767 | # type name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1768 | # ________________________________________________________ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1769 | # 5 AS-external-LSAs Originated by AS boundary | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1770 | # routers, and flooded through- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1771 | # out the AS. Each | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1772 | # AS-external-LSA describes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1773 | # a route to a destination in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1774 | # another Autonomous System. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1775 | # Default routes for the AS can | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1776 | # also be described by | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1777 | # AS-external-LSAs. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1778 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1779 | # externals => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1780 | # address => 'ipv4', # Link State ID | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1781 | # metric => 'int', # metric | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1782 | # forward => 'ipv4', # Forwarding address | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1783 | # netmask => 'ipv4', # Network Mask | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1784 | # routerid => 'ipv4', # Advertising Router | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1785 | # type => 'int', # bit E | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1786 | # ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1787 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1788 | # $network = $address & $netmask | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1789 | # $externhash{$network}{$netmask} = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1790 | # graph => { N => external8, color => red, style => dashed, } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1791 | # hashes => [ { ase hash } ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1792 | # routers => { $routerid => 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1793 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1794 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1795 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1796 | # take external hash, net cluster hash, network hash, stub hash, summary hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1797 | # detect inconsistencies and set colors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1798 | sub check_external { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1799 | 99 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
check_external: called CC=10 SCAR=23.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1800 | 99 | my($netcluster) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1801 | 99 | ▶ | my $nets = $self->{nets} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1802 | 99 | ▶ | my $stubs = $self->{stubs} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1803 | 99 | my $sums = $self->{sums}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1804 | 99 | ▶ | my $externhash = $self->{externhash} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1805 | 99 | foreach my $net (sort keys %$externhash) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1806 | 87 | my $nv = $externhash->{$net}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1807 | 87 | foreach my $mask (sort keys %$nv) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1808 | 87 | my $mv = $nv->{$mask}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1809 | 87 | my %colors = (gray => "ase"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1810 | 87 | my $nid = "$net/$mask"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1811 | 87 | ▶ | if ($nets->{$net}{$mask}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1812 | $self->error($colors{blue} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1813 | 3 | "AS external network $nid is also network."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1814 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1815 | 87 | ▶ | if ($stubs and $stubs->{$net}{$mask}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$stubs and $stubs->{$net}{$mask}
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}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1816 | $self->error($colors{green} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1817 | 5 | "AS external network $nid is also stub network."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1818 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1819 | 87 | ▶ | if ($sums->{$net}{$mask}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1820 | $self->error($colors{cyan} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1821 | 4 | "AS external network $nid is also summary network."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1822 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1823 | 87 | $mv->{colors} = \%colors; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1824 | 87 | push @{$netcluster->{"$net/$mask"}}, $mv->{graph}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1825 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1826 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1827 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1828 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1829 | # take external structure, net cluster hash, network hash, link hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1830 | # return external hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1831 | sub create_external { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1832 | 99 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create_external: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1833 | 99 | my $index = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1834 | 99 | my %externhash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1835 | 99 | foreach my $e (@{$self->{ospf}{database}{externals}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1836 | 138 | my $addr = $e->{address}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1837 | 138 | my $mask = $e->{netmask}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1838 | 138 | my $nid = "$addr/$mask"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1839 | 138 | my $net = _maskip($addr, $mask); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1840 | 138 | my $rid = $e->{routerid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1841 | 138 | my $elem = $externhash{$net}{$mask}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1842 | 138 | ▶ | if (! $elem) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1843 | 87 | $externhash{$net}{$mask} = $elem = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1844 | $elem->{graph} = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1845 | 87 | N => "external$index", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1846 | label => "$net\\n$mask", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1847 | shape => "egg", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1848 | style => "solid", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1849 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1850 | 87 | $elem->{index} = $index++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1851 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1852 | 138 | push @{$elem->{hashes}}, $e; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1853 | 138 | $elem->{routers}{$rid}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1854 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1855 | 99 | $self->{externhash} = \%externhash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1856 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1857 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1858 | # take hash containing external nodes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1859 | # return list of nodes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1860 | sub external2nodes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1861 | 151 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
external2nodes: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1862 | 151 | ▶ | my $externhash = $self->{externhash} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1863 | 151 | return $self->elements2graphs(map { values %$_ } values %$externhash); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1864 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1865 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1866 | # take external hash, router hash, boundary hash, boundary aggregate | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1867 | # return list of edges from external network to router | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1868 | sub external2edges { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1869 | 99 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
external2edges: called CC=21 SCAR=30.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1870 | 99 | ▶ | my $routehash = $self->{routehash} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1871 | 99 | my $boundhash = $self->{boundhash}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1872 | 99 | my $boundaggr = $self->{boundaggr}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1873 | 99 | ▶ | my $externhash = $self->{externhash} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1874 | 99 | my @elements; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1875 | 99 | my $index = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1876 | 99 | foreach my $net (sort keys %$externhash) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1877 | 87 | my $nv = $externhash->{$net}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1878 | 87 | foreach my $mask (sort keys %$nv) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1879 | 87 | my $mv = $nv->{$mask}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1880 | 87 | my $nid = "$net/$mask"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1881 | 87 | my $src = $mv->{graph}{N}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1882 | 87 | my %dtm; # when dst is aggregated, aggregate edges | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1883 | 87 | foreach my $e (@{$mv->{hashes}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1884 | 138 | my $rid = $e->{routerid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1885 | 138 | my $addr = $e->{address}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1886 | 138 | my $addrip = $addr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1887 | 138 | foreach (split(/\./, $mask)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1888 | 489 | ▶ | last if $_ ne 255; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1889 | 355 | $addrip =~ s/^\.?\d+//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1890 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1891 | 138 | my $type = $e->{type}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1892 | 138 | my $metric = $e->{metric}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1893 | 138 | my %colors = (gray => "ase"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1894 | 138 | ▶ | if ($mv->{routers}{$rid} > 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1895 | $self->error($colors{yellow} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1896 | 9 | "AS external network $nid at router $rid ". | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1897 | "has multiple entries."); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1898 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1899 | 138 | ▶ | my $style = $type == 1 ? "solid" : "dashed"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1900 | 138 | my %graph = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1901 | S => $src, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1902 | headlabel => $metric, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1903 | style => $style, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1904 | taillabel => $addrip, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1905 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1906 | 138 | ▶ | if ($routehash->{$rid}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1907 | my $dst = $routehash->{$rid}{graph}{N} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1908 | 98 | ▶ | or die "No router graph $rid"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1909 | 98 | $graph{D} = $dst; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1910 | 98 | $e->{elems}{$dst} = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1911 | graph => \%graph, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1912 | colors => \%colors, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1913 | index => $index++, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1914 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1915 | 98 | ▶ | push @elements, $e->{elems}{$dst} if $src; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1916 | 98 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1917 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1918 | 40 | my $av = $boundhash->{$rid}{aggregate}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1919 | 40 | ▶ | if (! $av) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1920 | my $dst = $boundhash->{$rid}{graph}{N} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1921 | 12 | ▶ | or die "No ASB router graph $rid"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1922 | 12 | $graph{D} = $dst; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1923 | 12 | $e->{elems}{$dst} = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1924 | graph => \%graph, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1925 | colors => \%colors, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1926 | index => $index++, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1927 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1928 | 12 | ▶ | push @elements, $e->{elems}{$dst} if $src; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1929 | 12 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1930 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1931 | 28 | foreach my $asbraggr (sort keys %$av) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1932 | 36 | my $num = $av->{$asbraggr}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1933 | my $dst = $boundaggr->{$asbraggr}{graph}{N} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1934 | 36 | ▶ | or die "No ASBR graph $asbraggr"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1935 | 36 | $graph{D} = $dst; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1936 | 36 | $e->{elems}{$dst} = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1937 | graph => { %graph }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1938 | colors => { %colors }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1939 | index => $index++, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1940 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1941 | # no not aggregate graphs with errors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1942 | 36 | ▶ | if (grep { ! /^(gray|black)$/ } keys %colors) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1943 | 2 | ▶ | push @elements, $e->{elems}{$dst} if $src; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1944 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1945 | 34 | $dtm{$dst}{$type}{$metric} = $e->{elems}{$dst}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1946 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1947 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1948 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1949 | 87 | ▶ | push @elements, map { values %$_ } map { values %$_ } values %dtm | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1950 | if $src; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1951 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1952 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1953 | 99 | return $self->elements2graphs(@elements); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1954 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1955 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1956 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1957 | # $externaggr{$netaggr} = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1958 | # graph => { N => external9, color => red, style => dashed, } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1959 | # routers => { $routerid => { $type => { $metric => [ { ase hash } ] } } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1960 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1961 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1962 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1963 | # take external hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1964 | # return external aggregate | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1965 | sub create_externaggr { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1966 | 19 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create_externaggr: called CC=26 SCAR=39.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1967 | # $ridnets{$rid}{$network} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1968 | # color => orange, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1969 | # types => { $type => { $metric => [ { ase hash } ] } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1970 | 19 | ▶ | my $externhash = $self->{externhash} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1971 | 19 | my %ridnets; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1972 | 19 | my $index = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1973 | 19 | foreach my $net (sort keys %$externhash) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1974 | 73 | my $nv = $externhash->{$net}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1975 | 73 | foreach my $mask (sort keys %$nv) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1976 | 73 | my $mv = $nv->{$mask}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1977 | 73 | my $nid = "$net/$mask"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1978 | # no not aggregate clustered graphs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1979 | 73 | ▶ | next if $mv->{graph}{C}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1980 | 70 | my $colors = $mv->{colors}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1981 | # no not aggregate graphs with errors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1982 | 70 | ▶ | next if grep { ! /^(gray|black)$/ } keys %$colors; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1983 | 68 | foreach my $e (@{$mv->{hashes}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1984 | 107 | my $rid = $e->{routerid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1985 | 107 | my $type = $e->{type}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1986 | 107 | my $metric = $e->{metric}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1987 | 107 | my $elem = $ridnets{$rid}{$nid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1988 | 107 | ▶ | if (! $elem) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1989 | 105 | $ridnets{$rid}{$nid} = $elem = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1990 | colors => { %$colors }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1991 | index => $index++, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1992 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1993 | ▶ | } elsif (! $elem->{colors}{gray} || ! $colors->{gray} || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%2/6
not $elem->{"colors"}{"gray"} && $colors->{"gray"} or $elem->{"colors"}{"gray"} ne $colors->{"gray"}
$elem->{'colors'}{'gray'} && $colors->{'gray'}
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"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1994 | $elem->{colors}{gray} ne $colors->{gray}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1995 | 0 | ▶ | push @{$elem->{colors}{black}}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
delete $elem->{'colors'}{'gray'} || ()
$colors->{'gray'} || ()
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= ()
Truth table0%0/3
A || B
A= $colors->{'gray'}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1996 | (delete($elem->{colors}{gray}) || ()), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1997 | 0 | ▶ | ($colors->{gray} || ()), @{$colors->{black} || []}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1998 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1999 | 107 | push @{$elem->{types}{$type}{$metric}}, $e; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2000 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2001 | 68 | delete $mv->{graph}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2002 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2003 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2004 | 19 | my %externaggr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2005 | 19 | $index = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2006 | 19 | foreach my $rid (sort keys %ridnets) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2007 | 38 | my $rv = $ridnets{$rid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2008 | 38 | my $netaggr = join('\n', sort _cmp_ip_net keys %$rv); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2009 | 38 | my $elem = $externaggr{$netaggr}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2010 | 38 | ▶ | if (! $elem) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2011 | 32 | $externaggr{$netaggr} = $elem = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2012 | $elem->{graph} = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2013 | 32 | N => "externalaggregate$index", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2014 | label => $netaggr, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2015 | shape => "egg", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2016 | style => "solid", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2017 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2018 | 32 | $elem->{index} = $index++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2019 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2020 | 38 | foreach my $nid (sort keys %$rv) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2021 | 105 | my $nv = $rv->{$nid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2022 | 105 | my $colors = $nv->{colors}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2023 | 105 | ▶ | if (! $elem->{colors}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2024 | 32 | %{$elem->{colors}} = %$colors; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2025 | ▶ | } elsif (! $elem->{colors}{gray} || ! $colors->{gray} || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%2/6
not $elem->{"colors"}{"gray"} && $colors->{"gray"} or $elem->{"colors"}{"gray"} ne $colors->{"gray"}
$elem->{'colors'}{'gray'} && $colors->{'gray'}
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"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2026 | $elem->{colors}{gray} ne $colors->{gray}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2027 | 0 | ▶ | push @{$elem->{colors}{black}}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
delete $elem->{'colors'}{'gray'} || ()
$colors->{'gray'} || ()
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= ()
Truth table0%0/3
A || B
A= $colors->{'gray'}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2028 | (delete($elem->{colors}{gray}) || ()), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2029 | 0 | ▶ | ($colors->{gray} || ()), @{$colors->{black} || []}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2030 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2031 | 105 | foreach my $type (sort keys %{$nv->{types}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2032 | 105 | my $tv = $nv->{types}{$type}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2033 | 105 | foreach my $metric (sort keys %$tv) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2034 | 105 | my $es = $tv->{$metric}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2035 | 105 | push @{$elem->{routers}{$rid}{$type}{$metric}}, @$es; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2036 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2037 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2038 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2039 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2040 | 19 | $self->{externaggr} = \%externaggr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2041 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2042 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2043 | # take hash containing external aggregated nodes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2044 | # return list of nodes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2045 | sub externaggr2nodes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2046 | 19 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
externaggr2nodes: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2047 | 19 | ▶ | my $externaggr = $self->{externaggr} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2048 | 19 | return $self->elements2graphs(values %$externaggr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2049 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2050 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2051 | # take external aggregate | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2052 | # return list of edges from external aggregate network to router | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2053 | sub externaggr2edges { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2054 | 19 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
externaggr2edges: called CC=9 SCAR=22.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2055 | 19 | ▶ | my $externaggr = $self->{externaggr} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2056 | 19 | my @elements; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2057 | 19 | my $index = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2058 | 19 | foreach my $netaggr (sort keys %$externaggr) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2059 | 32 | my $nv = $externaggr->{$netaggr}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2060 | 32 | my $src = $nv->{graph}{N}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2061 | 32 | my %dtm; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2062 | 32 | foreach my $rid (sort keys %{$nv->{routers}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2063 | 38 | my $rv = $nv->{routers}{$rid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2064 | 38 | foreach my $type (sort keys %$rv) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2065 | 38 | my $tv = $rv->{$type}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2066 | 38 | foreach my $metric (sort keys %$tv) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2067 | 40 | my $es = $tv->{$metric}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2068 | 40 | foreach my $e (@$es) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2069 | 107 | foreach my $dst (sort keys %{$e->{elems}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2070 | 111 | my $elem = $e->{elems}{$dst}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2071 | 111 | my %graph = %{$elem->{graph}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2072 | 111 | $graph{S} = $src; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2073 | 111 | delete $graph{taillabel}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2074 | 111 | my %colors = %{$elem->{colors}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2075 | 111 | my $newelem = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2076 | graph => \%graph, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2077 | colors => \%colors, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2078 | index => $index++, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2079 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2080 | # no not aggregate graphs with errors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2081 | 111 | ▶ | if (grep { ! /^(gray|black)$/ } keys %colors) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2082 | 4 | push @elements, $newelem; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2083 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2084 | 107 | $dtm{$dst}{$type}{$metric} = $newelem; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2085 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2086 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2087 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2088 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2089 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2090 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2091 | 32 | push @elements, map { values %$_ } map { values %$_ } values %dtm; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2092 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2093 | 19 | return $self->elements2graphs(@elements); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2094 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2095 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2096 | # take cluster hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2097 | # insert cluster into graphs referenced more than once | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2098 | sub set_cluster { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2099 | 24 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_cluster: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2100 | 24 | my($type) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2101 | 24 | ▶ | my $cluster = $self->{$type."cluster"} or die "Uninitialized member"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2102 | 24 | ▶ | while (my($id,$graphlist) = each %$cluster) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2103 | 98 | ▶ | next if @$graphlist < 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2104 | 24 | foreach (@$graphlist) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2105 | 55 | $_->{C} = $id; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2106 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2107 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2108 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2109 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2110 | # take list of nodes ( { N => node, C => cluster, label => ... }, ... ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2111 | # return nodes of dot graph | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2112 | sub graph_nodes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2113 | 199 | ▶ | my $class = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
graph_nodes: called CC=7 SCAR=19.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2114 | 199 | my @nodes = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2115 | 199 | my $dot = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2116 | 199 | foreach (@nodes) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2117 | 858 | my $cluster = $_->{C}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2118 | 858 | $dot .= "\t"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2119 | 858 | ▶ | $dot .= "subgraph \"cluster $cluster\" { " if $cluster; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2120 | 858 | $dot .= "$_->{N} [\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2121 | 858 | foreach my $k (sort keys %$_) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2122 | 5254 | ▶ | next if $k eq 'C' || $k eq 'N'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$k eq "C" or $k eq "N"
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"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2123 | 4341 | my $v = $_->{$k}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2124 | 4341 | $dot .= "\t\t$k=\"$v\"\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2125 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2126 | 858 | $dot .= "\t]"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2127 | 858 | ▶ | $dot .= " }" if $cluster; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2128 | 858 | $dot .= ";\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2129 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2130 | 199 | return $dot; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2131 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2132 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2133 | # take array containing elements, create color | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2134 | # return nodes or edges of dot graph | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2135 | sub elements2graphs { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2136 | 2565 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
elements2graphs: called CC=6 SCAR=18.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2137 | 2565 | my @elements = sort { $a->{index} <=> $b->{index} } grep { $_->{graph} } @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2138 | 2565 | foreach my $elem (@elements) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2139 | 1990 | my $graph = $elem->{graph}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2140 | 1990 | my $color = $self->colors2string($elem->{colors}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2141 | 1990 | my $message = $elem->{colors}{$color}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2142 | 1990 | $graph->{color} = $color; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2143 | 1990 | $graph->{tooltip} = $message; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2144 | 1990 | ▶ | if ($self->{todo}{warning}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2145 | 1478 | ▶ | if ($graph->{label}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2146 | 707 | $graph->{label} .= '\n'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2147 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2148 | 771 | $graph->{label} = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2149 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2150 | 1478 | ▶ | if ($self->{todo}{warning}{all}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2151 | 0 | $graph->{label} .= join('\n', values %{$elem->{colors}}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2152 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2153 | 1478 | $graph->{label} .= $message; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2154 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2155 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2156 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2157 | 2565 | ▶ | return map { $_->{graph} || () } @elements; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2158 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2159 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2160 | # take list of edges ( { S => srcNode , D => dstNode, label => ... }, ... ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2161 | # return edges of dot graph | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2162 | sub graph_edges { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2163 | 189 | ▶ | my $class = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
graph_edges: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2164 | 189 | my @edges = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2165 | 189 | my $dot = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2166 | 189 | foreach (@edges) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2167 | 1234 | $dot .= "\t$_->{S} -> $_->{D} [\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2168 | 1234 | foreach my $k (sort keys %$_) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2169 | 8539 | ▶ | next if $k eq 'S' || $k eq 'D'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$k eq "S" or $k eq "D"
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"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2170 | 6071 | my $v = $_->{$k}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2171 | 6071 | $dot .= "\t\t$k=\"$v\"\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2172 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2173 | 1234 | $dot .= "\t];\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2174 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2175 | 189 | return $dot; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2176 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2178 | # take lsdb structure, router id, todo hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2179 | # return dot graph | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2180 | sub graph_database { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2181 | 183 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
graph_database: called CC=50 SCAR=39.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2182 | 183 | my $todo = $self->{todo}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2183 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2184 | # convert ospf structure into separate hashes and create cluster hashes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2185 | 183 | my $netindex = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2186 | 183 | $self->create_network(\$netindex); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2187 | 183 | ▶ | if ($todo->{intra}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2188 | 4 | ▶ | $self->create_intranetworks() if $self->ipv6; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2189 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2190 | # add missing network may add graphs to nethash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2191 | # must be called before add_transit_value in create_router | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2192 | 183 | $self->add_missing_network(\$netindex); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2193 | 183 | my $routeindex = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2194 | 183 | $self->create_router(\$routeindex); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2195 | 183 | ▶ | if ($todo->{link}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2196 | 2 | ▶ | $self->create_link() if $self->ipv6; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2197 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2198 | 183 | ▶ | if ($todo->{intra}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2199 | 4 | ▶ | $self->create_intrarouters() if $self->ipv6; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2200 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2201 | 183 | ▶ | $self->create_summary() if $todo->{summary}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2202 | 183 | ▶ | $self->create_boundary() if $todo->{boundary}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2203 | 183 | ▶ | $self->create_external() if $todo->{external}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2204 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2205 | # add missing router may add graphs to routehash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2206 | # must be called before check_router | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2207 | 183 | $self->add_missing_router(\$routeindex); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2208 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2209 | 183 | my %netcluster; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2210 | my %transitcluster; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2211 | 183 | $self->check_network(\%netcluster); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2212 | 183 | $self->check_router(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2213 | 183 | $self->check_transit(\%transitcluster); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2214 | 183 | ▶ | $self->check_stub(\%netcluster) unless $self->ipv6; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2215 | 183 | ▶ | if ($todo->{link}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2216 | 2 | ▶ | $self->check_link() if $self->ipv6; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2217 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2218 | 183 | ▶ | if ($todo->{intra}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2219 | 4 | ▶ | $self->check_intrarouter() if $self->ipv6; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2220 | 4 | ▶ | $self->check_intranetwork() if $self->ipv6; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2221 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2222 | 183 | ▶ | $self->check_summary(\%netcluster) if $todo->{summary}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2223 | 183 | ▶ | $self->check_boundary() if $todo->{boundary}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2224 | 183 | ▶ | $self->check_external(\%netcluster) if $todo->{external}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2225 | 183 | $self->{netcluster} = \%netcluster; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2226 | 183 | $self->{transitcluster} = \%transitcluster; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2227 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2228 | # remove duplicate router may delete graphs from boundhash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2229 | # must be called after check_boundary | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2230 | 183 | $self->remove_duplicate_router(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2231 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2232 | # insert cluster with more than one entry into graphs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2233 | 183 | ▶ | if ($todo->{cluster}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2234 | 12 | $self->set_cluster("net"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2235 | 12 | $self->set_cluster("transit"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2236 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2237 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2238 | # graphs within clusters are not aggregated | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2239 | $self->create_sumaggr() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2240 | 183 | ▶ | if $todo->{summary} && $todo->{summary}{aggregate}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$todo->{"summary"} and $todo->{"summary"}{"aggregate"}
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"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2241 | $self->create_boundaggr() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2242 | 183 | ▶ | if $todo->{boundary} && $todo->{boundary}{aggregate}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$todo->{"boundary"} and $todo->{"boundary"}{"aggregate"}
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"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2243 | $self->create_externaggr() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2244 | 183 | ▶ | if $todo->{external} && $todo->{external}{aggregate}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$todo->{"external"} and $todo->{"external"}{"aggregate"}
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"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2245 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2246 | 183 | my @nodes; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2247 | 183 | push @nodes, $self->router2nodes(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2248 | 183 | push @nodes, $self->transit2nodes(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2249 | 183 | ▶ | push @nodes, $self->stub2nodes() unless $self->ipv6; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2250 | 183 | push @nodes, $self->network2nodes(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2251 | 183 | ▶ | if ($todo->{link}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2252 | 2 | ▶ | push @nodes, $self->link2nodes() if $self->ipv6; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2253 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2254 | 183 | ▶ | if ($todo->{intra}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2255 | 4 | ▶ | push @nodes, $self->intrarouter2nodes() if $self->ipv6; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2256 | 4 | ▶ | push @nodes, $self->intranetwork2nodes() if $self->ipv6; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2257 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2258 | 183 | ▶ | if ($todo->{summary}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2259 | 144 | push @nodes, $self->summary2nodes(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2260 | push @nodes, $self->sumaggr2nodes() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2261 | 144 | ▶ | if $todo->{summary}{aggregate}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2262 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2263 | 183 | ▶ | if ($todo->{boundary}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2264 | 151 | push @nodes, $self->boundary2nodes(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2265 | push @nodes, $self->boundaggr2nodes() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2266 | 151 | ▶ | if $todo->{boundary}{aggregate}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2267 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2268 | 183 | ▶ | if ($todo->{external}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2269 | 151 | push @nodes, $self->external2nodes(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2270 | push @nodes, $self->externaggr2nodes() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2271 | 151 | ▶ | if $todo->{external}{aggregate}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2272 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2273 | 183 | my $dot = $self->graph_nodes(@nodes); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2274 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2275 | 183 | my @edges; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2276 | 183 | push @edges, $self->router2edges("pointtopoint"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2277 | 183 | push @edges, $self->transit2edges(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2278 | 183 | ▶ | push @edges, $self->stub2edges() unless $self->ipv6; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2279 | 183 | push @edges, $self->router2edges("virtual"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2280 | 183 | push @edges, $self->network2edges(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2281 | 183 | ▶ | if ($todo->{link}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2282 | 2 | ▶ | push @edges, $self->link2edges() if $self->ipv6; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2283 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2284 | 183 | ▶ | if ($todo->{intra}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2285 | 4 | ▶ | push @edges, $self->intrarouter2edges() if $self->ipv6; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2286 | 4 | ▶ | push @edges, $self->intranetwork2edges() if $self->ipv6; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2287 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2288 | 183 | ▶ | if ($todo->{summary}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2289 | 144 | push @edges, $self->summary2edges(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2290 | push @edges, $self->sumaggr2edges() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2291 | 144 | ▶ | if $todo->{summary}{aggregate}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2292 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2293 | 183 | ▶ | if ($todo->{boundary}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2294 | 151 | push @edges, $self->boundary2edges(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2295 | push @edges, $self->boundaggr2edges() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2296 | 151 | ▶ | if $todo->{boundary}{aggregate}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2297 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2298 | 183 | ▶ | if ($todo->{external}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2299 | 151 | push @edges, $self->external2edges(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2300 | push @edges, $self->externaggr2edges() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2301 | 151 | ▶ | if $todo->{external}{aggregate}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2302 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2303 | 183 | $dot .= $self->graph_edges(@edges); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2304 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2305 | 183 | return $dot; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2306 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2307 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2308 | # return dot default settings | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2309 | sub graph_default { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2310 | 185 | ▶ | my $class = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
graph_default: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2311 | 185 | my $dot = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2312 | 185 | $dot .= "\tnode [ color=gray50 fontsize=14 ];\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2313 | 185 | $dot .= "\tedge [ color=gray50 fontsize=8 ];\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2314 | 185 | return $dot; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2315 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2316 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2317 | =pod | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2318 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2319 | =over | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2320 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2321 | =item $self-E<gt>graph(%todo) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2322 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2323 | Convert the internal database into graphviz dot format. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2324 | The output for the dot program is returned as string. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2325 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2326 | The B<%todo> parameter allows to tune the displayed details. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2327 | It consists of the subkeys: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2328 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2329 | =over 8 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2330 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2331 | =item B<boundary> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2332 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2333 | Display the summary AS boundary routers. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2334 | If the additional subkey B<aggregate> is given, multiple AS boundary | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2335 | routers are aggregated in one node. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2336 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2337 | =item B<external> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2338 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2339 | Display the AS external networks. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2340 | If the additional subkey B<aggregate> is given, multiple AS external | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2341 | networks are aggregated in one node. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2342 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2343 | =item B<cluster> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2344 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2345 | The same network is always displayed in the same rectangular cluster, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2346 | even if is belongs to different LSA types. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2347 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2348 | =item B<summary> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2349 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2350 | Display the summary networks. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2351 | If the additional subkey B<aggregate> is given, multiple networks | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2352 | are aggregated in one node. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2353 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2354 | =item B<warnings> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2355 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2356 | Write the most severe warning about OSPF inconsistencies into the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2357 | label of the dot graph. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2358 | This warning determines also the color of the node or edge. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2359 | If the additional subkey B<all> is given, all warnings are added. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2360 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2361 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2362 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2363 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2364 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2365 | # take ospf structure, todo hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2366 | # return the complete dot graph | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2367 | sub graph { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2368 | 183 | ▶ | my OSPF::LSDB::View $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
graph: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2369 | 183 | %{$self->{todo}} = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2370 | 183 | $self->create_area_grays(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2371 | 183 | my $dot = "digraph \"ospf lsdb\" {\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2372 | 183 | $dot .= $self->graph_default(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2373 | 183 | $dot .= $self->graph_database(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2374 | 183 | $dot .= "}\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2375 | 183 | return $dot; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2376 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2377 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2378 | # return legend routers as dot graph | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2379 | sub legend_router { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2380 | 1 | ▶ | my $class = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
legend_router: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2381 | 1 | my $index = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2382 | 1 | my @nodes = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2383 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2384 | label => 'ospf\nrouter', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2385 | }, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2386 | label => 'current\nlocation', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2387 | peripheries => 2, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2388 | }, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2389 | label => 'area border\nrouter', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2390 | style => 'bold', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2391 | }, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2392 | label => 'summary AS\nboundary router', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2393 | style => 'dashed', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2394 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2395 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2396 | 1 | foreach (@nodes) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2397 | 4 | $_->{N} = 'router'. $index++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2398 | 4 | ▶ | $_->{shape} ||= 'box'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$_->{"shape"} ||= "box"
MC/DC0%0/1
$_->{"shape"} ||= "box"
$_->{"shape"}
Truth table50%1/2
A
A= $_->{"shape"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2399 | 4 | ▶ | $_->{style} ||= 'solid'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$_->{"style"} ||= "solid"
MC/DC100%1/1
$_->{"style"} ||= "solid"
$_->{"style"}
Truth table100%2/2
A
A= $_->{"style"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2400 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2401 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2402 | 1 | my $dot = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2403 | 1 | $dot .= $class->graph_nodes(@nodes); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2404 | 1 | $dot .= "\t{ rank=same;"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2405 | 1 | $dot .= join("", map { " $_->{N};" } @nodes); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2406 | 1 | $dot .= " }\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2407 | 1 | return $dot; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2408 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2409 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2410 | # return legend networks as dot graph | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2411 | sub legend_network { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2412 | 1 | ▶ | my $class = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
legend_network: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2413 | 1 | my $index = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2414 | 1 | my @nodes = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2415 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2416 | label => 'transit\nnetwork', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2417 | style => 'bold', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2418 | }, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2419 | label => 'stub\nnetwork', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2420 | }, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2421 | label => 'summary\nnetwork', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2422 | style => 'dashed', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2423 | }, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2424 | color => 'gray35', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2425 | label => 'AS external\nnetwork', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2426 | shape => 'egg', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2427 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2428 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2429 | 1 | foreach (@nodes) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2430 | 4 | $_->{N} = 'network'. $index++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2431 | 4 | ▶ | $_->{shape} ||= 'ellipse'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$_->{"shape"} ||= "ellipse"
MC/DC100%1/1
$_->{"shape"} ||= "ellipse"
$_->{"shape"}
Truth table100%2/2
A
A= $_->{"shape"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2432 | 4 | ▶ | $_->{style} ||= 'solid'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$_->{"style"} ||= "solid"
MC/DC100%1/1
$_->{"style"} ||= "solid"
$_->{"style"}
Truth table100%2/2
A
A= $_->{"style"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2433 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2434 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2435 | 1 | my $dot = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2436 | 1 | $dot .= $class->graph_nodes(@nodes); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2437 | 1 | $dot .= "\t{ rank=same;"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2438 | 1 | $dot .= join("", map { " $_->{N};" } @nodes); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2439 | 1 | $dot .= " }\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2440 | 1 | return $dot; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2441 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2442 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2443 | # return legend router network edges as dot graph | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2444 | sub legend_edge { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2445 | 1 | ▶ | my $class = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
legend_edge: called CC=8 SCAR=20.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2446 | 1 | my @networknodes = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2447 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2448 | label => 'network', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2449 | }, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2450 | label => 'transit\nnetwork', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2451 | style => 'bold', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2452 | }, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2453 | color => 'gray35', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2454 | label => 'ASE type 1\nnetwork', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2455 | shape => 'egg', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2456 | }, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2457 | color => 'gray35', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2458 | label => 'ASE type 2\nnetwork', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2459 | shape => 'egg', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2460 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2461 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2462 | 1 | foreach (@networknodes) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2463 | 4 | ▶ | $_->{shape} ||= 'ellipse'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$_->{"shape"} ||= "ellipse"
MC/DC100%1/1
$_->{"shape"} ||= "ellipse"
$_->{"shape"}
Truth table100%2/2
A
A= $_->{"shape"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2464 | 4 | ▶ | $_->{style} ||= 'solid'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$_->{"style"} ||= "solid"
MC/DC100%1/1
$_->{"style"} ||= "solid"
$_->{"style"}
Truth table100%2/2
A
A= $_->{"style"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2465 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2466 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2467 | 1 | my @routernodes = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2468 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2469 | label => 'router', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2470 | }, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2471 | label => 'designated\nrouter', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2472 | }, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2473 | label => 'AS boundary\nrouter', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2474 | }, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2475 | label => 'AS boundary\nrouter', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2476 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2477 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2478 | 1 | foreach (@routernodes) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2479 | 4 | ▶ | $_->{shape} ||= 'box'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$_->{"shape"} ||= "box"
MC/DC0%0/1
$_->{"shape"} ||= "box"
$_->{"shape"}
Truth table50%1/2
A
A= $_->{"shape"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2480 | 4 | ▶ | $_->{style} ||= 'solid'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$_->{"style"} ||= "solid"
MC/DC0%0/1
$_->{"style"} ||= "solid"
$_->{"style"}
Truth table50%1/2
A
A= $_->{"style"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2481 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2482 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2483 | 1 | my $index = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2484 | 1 | my @edges = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2485 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2486 | headlabel => '.IP', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2487 | style => 'solid', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2488 | taillabel => 'cost', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2489 | }, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2490 | style => 'bold', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2491 | taillabel => '.IP', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2492 | }, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2493 | color => 'gray35', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2494 | headlabel => 'cost', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2495 | style => 'solid', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2496 | taillabel => '.IP', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2497 | }, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2498 | color => 'gray35', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2499 | headlabel => 'cost', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2500 | style => 'dashed', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2501 | taillabel => '.IP', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2502 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2503 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2504 | 1 | ▶ | for(my $i=0; $i<@edges; $i++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2505 | 4 | $networknodes[$i]{N} = 'edgenetwork'. $index; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2506 | 4 | $routernodes [$i]{N} = 'edgerouter'. $index; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2507 | 4 | $edges [$i]{S} = 'edgenetwork'. $index; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2508 | 4 | $edges [$i]{D} = 'edgerouter'. $index; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2509 | 4 | $index++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2510 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2511 | # swap arrow for cost .IP explanation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2512 | 1 | ($edges[0]{D}, $edges[0]{S}) = ($edges[0]{S}, $edges[0]{D}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2513 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2514 | 1 | my $dot = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2515 | 1 | $dot .= $class->graph_nodes(@networknodes); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2516 | 1 | $dot .= $class->graph_nodes(@routernodes); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2517 | 1 | $dot .= $class->graph_edges(@edges); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2518 | 1 | $dot .= "\t{ rank=same;"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2519 | 1 | $dot .= join("", map { " $_->{S};" } @edges); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2520 | 1 | $dot .= " }\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2521 | 1 | return $dot; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2522 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2523 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2524 | # return legend router link to router or network as dot graph | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2525 | sub legend_link { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2526 | 1 | ▶ | my $class = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
legend_link: called CC=12 SCAR=24.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2527 | 1 | my @routernodes = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2528 | {}, {}, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2529 | label => 'designated\nrouter', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2530 | }, {}, {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2531 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2532 | 1 | foreach (@routernodes) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2533 | 5 | ▶ | $_->{label} ||= 'router'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$_->{"label"} ||= "router"
MC/DC100%1/1
$_->{"label"} ||= "router"
$_->{"label"}
Truth table100%2/2
A
A= $_->{"label"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2534 | 5 | ▶ | $_->{shape} ||= 'box'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$_->{"shape"} ||= "box"
MC/DC0%0/1
$_->{"shape"} ||= "box"
$_->{"shape"}
Truth table50%1/2
A
A= $_->{"shape"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2535 | 5 | ▶ | $_->{style} ||= 'solid'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$_->{"style"} ||= "solid"
MC/DC0%0/1
$_->{"style"} ||= "solid"
$_->{"style"}
Truth table50%1/2
A
A= $_->{"style"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2536 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2537 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2538 | 1 | my @dstnodes = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2539 | {}, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2540 | label => 'transit\nnetwork', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2541 | style => 'bold', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2542 | shape => 'ellipse', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2543 | }, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2544 | label => 'transit\nnetwork', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2545 | style => 'bold', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2546 | shape => 'ellipse', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2547 | }, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2548 | label => 'stub\nnetwork', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2549 | style => 'solid', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2550 | shape => 'ellipse', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2551 | }, {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2552 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2553 | 1 | foreach (@dstnodes) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2554 | $_->{label} ||= 'router', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2555 | 5 | ▶ | $_->{shape} ||= 'box'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%4/4
$_->{"label"} ||= "router"
$_->{"shape"} ||= "box"
MC/DC100%1/1
$_->{"label"} ||= "router"
$_->{"label"}
MC/DC100%1/1
$_->{"shape"} ||= "box"
$_->{"shape"}
Truth table100%2/2
A
A= $_->{"label"}
Truth table100%2/2
A
A= $_->{"shape"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2556 | 5 | ▶ | $_->{style} ||= 'solid'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$_->{"style"} ||= "solid"
MC/DC100%1/1
$_->{"style"} ||= "solid"
$_->{"style"}
Truth table100%2/2
A
A= $_->{"style"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2557 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2558 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2559 | 1 | my $index = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2560 | 1 | my @edges = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2561 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2562 | label => 'point-to-point\nlink', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2563 | }, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2564 | label => 'link to\ntransit network', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2565 | }, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2566 | label => 'link to\ntransit network', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2567 | style => 'bold', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2568 | }, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2569 | label => 'link to\nstub network', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2570 | }, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2571 | label => 'virtual\nlink', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2572 | style => 'dotted', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2573 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2574 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2575 | 1 | foreach (@edges) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2576 | 5 | ▶ | $_->{style} ||= 'solid'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$_->{"style"} ||= "solid"
MC/DC100%1/1
$_->{"style"} ||= "solid"
$_->{"style"}
Truth table100%2/2
A
A= $_->{"style"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2577 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2578 | 1 | ▶ | for(my $i=0; $i<@edges; $i++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2579 | 5 | $routernodes[$i]{N} = 'linkrouter'. $index; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2580 | 5 | $dstnodes [$i]{N} = 'linkdst'. $index; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2581 | 5 | $edges [$i]{S} = 'linkrouter'. $index; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2582 | 5 | $edges [$i]{D} = 'linkdst'. $index; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2583 | 5 | $index++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2584 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2585 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2586 | 1 | my $dot = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2587 | 1 | $dot .= $class->graph_nodes(@routernodes); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2588 | 1 | $dot .= $class->graph_nodes(@dstnodes); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2589 | 1 | $dot .= $class->graph_edges(@edges); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2590 | 1 | $dot .= "\t{ rank=same;"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2591 | 1 | $dot .= join("", map { " $_->{S};" } @edges); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2592 | 1 | $dot .= " }\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2593 | 1 | return $dot; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2594 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2595 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2596 | # return legend summary network and router edges as dot graph | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2597 | sub legend_summary { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2598 | 1 | ▶ | my $class = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
legend_summary: called CC=9 SCAR=22.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2599 | 1 | my @networknodes = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2600 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2601 | label => 'summary\nnetwork', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2602 | style => 'dashed', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2603 | }, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2604 | label => 'summary AS\nboundary router', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2605 | shape => 'box', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2606 | style => 'dashed', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2607 | }, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2608 | label => 'router and summary \nAS boundary router', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2609 | shape => 'box', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2610 | }, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2611 | color => 'gray35', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2612 | label => 'ASE\nnetwork', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2613 | shape => 'egg', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2614 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2615 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2616 | 1 | foreach (@networknodes) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2617 | 4 | ▶ | $_->{shape} ||= 'ellipse'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$_->{"shape"} ||= "ellipse"
MC/DC100%1/1
$_->{"shape"} ||= "ellipse"
$_->{"shape"}
Truth table100%2/2
A
A= $_->{"shape"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2618 | 4 | ▶ | $_->{style} ||= 'solid'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$_->{"style"} ||= "solid"
MC/DC100%1/1
$_->{"style"} ||= "solid"
$_->{"style"}
Truth table100%2/2
A
A= $_->{"style"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2619 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2620 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2621 | 1 | my @routernodes = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2622 | {}, {}, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2623 | color => 'black', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2624 | }, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2625 | color => 'gray35', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2626 | label => 'summary AS\nboundary router', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2627 | style => 'dashed', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2628 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2629 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2630 | 1 | foreach (@routernodes) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2631 | 4 | ▶ | $_->{label} ||= 'area border\nrouter'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$_->{"label"} ||= "area border\\nrouter"
MC/DC100%1/1
$_->{"label"} ||= "area border\\nrouter"
$_->{"label"}
Truth table100%2/2
A
A= $_->{"label"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2632 | 4 | ▶ | $_->{shape} ||= 'box'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$_->{"shape"} ||= "box"
MC/DC0%0/1
$_->{"shape"} ||= "box"
$_->{"shape"}
Truth table50%1/2
A
A= $_->{"shape"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2633 | 4 | ▶ | $_->{style} ||= 'bold'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$_->{"style"} ||= "bold"
MC/DC100%1/1
$_->{"style"} ||= "bold"
$_->{"style"}
Truth table100%2/2
A
A= $_->{"style"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2634 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2635 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2636 | 1 | my $index = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2637 | 1 | my @edges = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2638 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2639 | headlabel => 'cost', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2640 | style => 'dashed', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2641 | taillabel => '.IP', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2642 | }, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2643 | headlabel => 'cost', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2644 | style => 'dashed', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2645 | }, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2646 | color => 'gray75', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2647 | headlabel => 'cost', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2648 | style => 'dashed', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2649 | }, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2650 | color => 'gray35', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2651 | headlabel => 'cost', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2652 | style => 'solid', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2653 | taillabel => '.IP', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2654 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2655 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2656 | 1 | ▶ | for(my $i=0; $i<@edges; $i++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2657 | 4 | $networknodes[$i]{N} = 'summarynetwork'. $index; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2658 | 4 | $routernodes [$i]{N} = 'summaryrouter'. $index; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2659 | 4 | $edges [$i]{S} = 'summarynetwork'. $index; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2660 | 4 | $edges [$i]{D} = 'summaryrouter'. $index; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2661 | 4 | $index++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2662 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2663 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2664 | 1 | my $dot = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2665 | 1 | $dot .= $class->graph_nodes(@networknodes); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2666 | 1 | $dot .= $class->graph_nodes(@routernodes); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2667 | 1 | $dot .= $class->graph_edges(@edges); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2668 | 1 | $dot .= "\t{ rank=same;"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2669 | 1 | $dot .= join("", map { " $_->{S};" } @edges); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2670 | 1 | $dot .= " }\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2671 | 1 | return $dot; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2672 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2673 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2674 | # return additional invisible edges to get a better layout for the legend | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2675 | sub legend_rank { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2676 | 2 | ▶ | my $class = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
legend_rank: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2677 | 2 | my $dot = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2678 | 2 | $dot .= "\trouter0 -> network0 -> edgerouter0"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2679 | 2 | $dot .= " [ style=invis ];\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2680 | 2 | $dot .= "\tedgenetwork0 -> linkrouter0"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2681 | 2 | $dot .= " [ style=invis ];\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2682 | 2 | $dot .= "\tlinkdst0 -> summarynetwork0"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2683 | 2 | $dot .= " [ style=invis ];\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2684 | 2 | return $dot; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2685 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2686 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2687 | # return legend default settings | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2688 | sub legend_default { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2689 | 2 | ▶ | my $class = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
legend_default: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2690 | 2 | my $dot = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2691 | 2 | $dot .= $class->graph_default(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2692 | 2 | return $dot; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2693 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2694 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2695 | =pod | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2696 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2697 | =item OSPF::LSDB::View-E<gt>legend() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2698 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2699 | Return a string of a dot graphic containing drawing and description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2700 | of possible nodes and edges. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2701 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2702 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2703 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2704 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2705 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2706 | # return legend as dot graph | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2707 | sub legend { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2708 | 2 | ▶ | my $class = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
legend: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2709 | 2 | my $dot = "digraph \"ospf legend\" {\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2710 | 2 | $dot .= $class->legend_default(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2711 | 2 | $dot .= $class->legend_rank(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2712 | 2 | $dot .= $class->legend_router(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2713 | 2 | $dot .= $class->legend_network(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2714 | 2 | $dot .= $class->legend_edge(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2715 | 2 | $dot .= $class->legend_link(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2716 | 2 | $dot .= $class->legend_summary(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2717 | 2 | $dot .= "}\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2718 | 2 | return $dot; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2719 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2720 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2721 | =pod | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2722 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2723 | =head1 ERRORS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2724 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2725 | The methods die if any error occures. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2726 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2727 | Inconsistencies within the OSPF link state database are visualized | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2728 | with different colors. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2729 | The error message may be printed into the graph as warnings. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2730 | All warnings may be optained with the get_errors() method. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2731 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2732 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2733 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2734 | L<OSPF::LSDB>, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2735 | L<OSPF::LSDB::View6> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2736 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2737 | L<ospf2dot>, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2738 | L<ospfview> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2739 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2740 | RFC 2328 - OSPF Version 2 - April 1998 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2741 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2742 | =head1 AUTHORS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2743 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2744 | Alexander Bluhm | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2745 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2746 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2747 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2748 | 13 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||