Changeset 250
- Timestamp:
- Sep 8, 2017, 4:53:06 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/klask
r249 r250 467 467 468 468 #--------------------------------------------------------------- 469 sub format_aggregator4html { 470 my $port_hr = shift; 471 $port_hr =~ s/($SEP_AGGREGATOR_PORT)/: /; # First occurence 472 $port_hr =~ s/($SEP_AGGREGATOR_PORT)/ /g; # Other occurence 473 return $port_hr; 474 } 475 476 #--------------------------------------------------------------- 477 sub format_aggregator4dot { 478 my $port_hr = shift; 479 $port_hr =~ s/($SEP_AGGREGATOR_PORT)/ - /; # First occurence 480 $port_hr =~ s/($SEP_AGGREGATOR_PORT)/ /g; # Other occurence 481 return $port_hr; 482 } 483 484 #--------------------------------------------------------------- 469 485 # return the port and the switch where the computer is connected 470 486 sub find_switch_port { … … 1483 1499 $vlan = $computerdb->{$ip}{network}.' ('.get_current_vlan_id($computerdb->{$ip}{network}).')' if $computerdb->{$ip}{network}; 1484 1500 1485 my $switch_port_hr = $computerdb->{$ip}{switch_port_hr} =~ s/($SEP_AGGREGATOR_PORT)/: /r; # First occurence1486 $switch_port_hr =~ s/($SEP_AGGREGATOR_PORT)/ /g; # Other occurence1487 1488 1501 print <<"END_HTML"; 1489 1502 <tr class="$typerow"> 1490 1503 <td sorttable_customkey="$switch_hostname_sort">$switch_hostname</td> 1491 <td class="bklask-port"> $switch_port_hr</td>1504 <td class="bklask-port">format_aggregator4html($computerdb->{$ip}{switch_port_hr})</td> 1492 1505 <td colspan="2">$arrow</td> 1493 1506 <td sorttable_customkey="$host_short">$computerdb->{$ip}{hostname_fq}</td> … … 1532 1545 my ( $host_short ) = sprintf '%s %3s' , split(m/ \. /xms, $db_switch_parent{$sw}->{'switch'}, 1), $db_switch_parent{$sw}->{port_hr}; 1533 1546 1534 my $switch_port_hr = $db_switch_output_port{$sw} =~ s/($SEP_AGGREGATOR_PORT)/: /r; # First occurence1535 $switch_port_hr =~ s/($SEP_AGGREGATOR_PORT)/ /g; # Other occurence1536 1537 my $switch_connected_port_hr = $db_switch_parent{$sw}->{port_hr} =~ s/($SEP_AGGREGATOR_PORT)/: /r; # First occurence1538 $switch_connected_port_hr =~ s/($SEP_AGGREGATOR_PORT)/ /g; # Other occurence1539 1540 1547 print <<"END_HTML"; 1541 1548 <tr class="$typerow"> 1542 1549 <td sorttable_customkey="$switch_hostname_sort">$sw</td> 1543 <td class="bklask-port"> $switch_port_hr</td>1544 <td>$arrow</td><td> $switch_connected_port_hr</td>1550 <td class="bklask-port">format_aggregator4html($db_switch_output_port{$sw})</td> 1551 <td>$arrow</td><td>format_aggregator4html($db_switch_parent{$sw}->{port_hr})</td> 1545 1552 <td sorttable_customkey="$host_short">$db_switch_parent{$sw}->{'switch'}</td> 1546 1553 <td sorttable_customkey="$ip_sort">$ipv4_address</td> … … 1552 1559 } 1553 1560 else { 1554 my $switch_port_hr = $db_switch_output_port{$sw} =~ s/($SEP_AGGREGATOR_PORT)/: /r; # First occurence1555 $switch_port_hr =~ s/($SEP_AGGREGATOR_PORT)/ /g; # Other occurence1556 1557 1561 print <<"END_HTML"; 1558 1562 <tr class="$typerow"> 1559 1563 <td sorttable_customkey="$switch_hostname_sort">$sw</td> 1560 <td class="bklask-port"> $switch_port_hr</td>1564 <td class="bklask-port">format_aggregator4html($db_switch_output_port{$sw})</td> 1561 1565 <td>$arrow</td><td></td> 1562 1566 <td sorttable_customkey="router">router</td> … … 1601 1605 <tr class="$typerow"> 1602 1606 <td sorttable_customkey="$switch_hostname_sort">$sw_connect</td> 1603 <td class="bklask-port"> $port_connect</td>1604 <td>$arrow</td><td> $db_switch_output_port{$sw}</td>1607 <td class="bklask-port">format_aggregator4html($port_connect)</td> 1608 <td>$arrow</td><td>format_aggregator4html($db_switch_output_port{$sw})</td> 1605 1609 <td sorttable_customkey="$host_short">$sw</td> 1606 1610 <td sorttable_customkey="$ip_sort">$ipv4_address</td> … … 1615 1619 <tr class="$typerow"> 1616 1620 <td sorttable_customkey="$switch_hostname_sort">$sw_connect</td> 1617 <td class="bklask-port"> $port_connect</td>1621 <td class="bklask-port">format_aggregator4html($port_connect)</td> 1618 1622 <td>$arrow</td><td></td> 1619 1623 <td sorttable_customkey="$sw">$sw</td> … … 2752 2756 for my $sw (keys %{$db_building{$building}->{$loc}}) { 2753 2757 2754 print "\"$sw:$db_switch_output_port{$sw}\" [label = \" $db_switch_output_port{$sw}\", color = black, fillcolor = lightblue, peripheries = 2, style = filled];\n";2758 print "\"$sw:$db_switch_output_port{$sw}\" [label = \"".format_aggregator4dot($db_switch_output_port{$sw})"\", color = black, fillcolor = lightblue, peripheries = 2, style = filled];\n"; 2755 2759 2756 2760 my $swname = $sw; … … 2765 2769 next if not $sw_connect eq $sw; 2766 2770 next if $port_connect eq $db_switch_output_port{$sw}; 2767 print "\"$sw:$port_connect\" [label = \" $port_connect\", color = black, fillcolor = plum, peripheries = 1, style = filled];\n";2771 print "\"$sw:$port_connect\" [label = \"".format_aggregator4dot($port_connect)."\", color = black, fillcolor = plum, peripheries = 1, style = filled];\n"; 2768 2772 print "\"$sw:$port_connect\" -> \"$sw\" [len=2, style=bold, arrowhead= normal, arrowtail = inv]\n"; 2769 2773 }
Note: See TracChangeset
for help on using the changeset viewer.