Changeset 312
- Timestamp:
- Oct 21, 2017, 6:59:05 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/klask
r311 r312 2854 2854 my %db_switch_connected_on_port = %{$switch_connection->{'connected_on_port'}}; 2855 2855 2856 # Switch output port and parent port connection 2856 2857 my $tb_child = Text::Table->new( # http://www.perlmonks.org/?node_id=988320 2857 2858 {align => 'left', align_title => 'left', title => 'Child_Switch'}, … … 2861 2862 {align => 'left', align_title => 'left', title => 'Parent_Switch'}, 2862 2863 ); 2863 #print "Switch output port and parent port connection\n";2864 #print "---------------------------------------------\n";2865 2864 for my $sw (sort keys %db_switch_output_port) { 2866 2865 my $arrow ='--->'; 2867 2866 $arrow ='===>' if $db_switch_output_port{$sw} =~ m/^(Trk|Br|Po)/; 2868 2867 if (exists $db_switch_parent{$sw}) { 2869 #printf "%-28s %8s %3s %-8s %-25s\n", $sw, $db_switch_output_port{$sw}, $arrow, $db_switch_parent{$sw}->{'port_hr'}, $db_switch_parent{$sw}->{'switch'};2870 2868 $tb_child->add($sw, $db_switch_output_port{$sw}, $arrow, $db_switch_parent{$sw}->{'port_hr'}, $db_switch_parent{$sw}->{'switch'}); 2871 2869 2872 2870 } 2873 2871 else { 2874 #printf "%-28s %8s %3s %-8s %-25s\n", $sw, $db_switch_output_port{$sw}, $arrow, '', 'router';2875 2872 $tb_child->add($sw, $db_switch_output_port{$sw}, $arrow, '', 'router'); 2876 2873 } 2877 2874 } 2878 2875 my @colrange = map { scalar $tb_child->colrange($_) } (0 .. 4); # force scaler context 2879 $tb_child->add(map { ' ' x $_ } reverse @colrange); # add empty line to force symetric table 2876 $tb_child->add(map { ' ' x $_ } reverse @colrange); # add empty line to force symetric table output 2880 2877 print $tb_child->title(); 2881 2878 print $tb_child->rule('-'); … … 2883 2880 $tb_child->clear; 2884 2881 2882 # Switch parent and children port inter-connection 2885 2883 print "\n"; 2886 2884 my $tb_parent = Text::Table->new( # http://www.perlmonks.org/?node_id=988320 … … 2891 2889 {align => 'left', align_title => 'left', title => 'Child_Switch'}, 2892 2890 ); 2893 #print "Switch parent and children port inter-connection\n";2894 #print "------------------------------------------------\n";2895 2891 for my $swport (sort keys %db_switch_connected_on_port) { 2896 2892 my ($sw_connect, $port_connect) = split m/ $SEP_SWITCH_PORT /xms, $swport, 2; 2897 2893 for my $sw (keys %{$db_switch_connected_on_port{$swport}}) { 2898 my $arrow ='<-- ';2899 $arrow ='<== ' if $port_connect =~ m/^(Trk|Br|Po)/;2894 my $arrow ='<---'; 2895 $arrow ='<===' if $port_connect =~ m/^(Trk|Br|Po)/; 2900 2896 if (exists $db_switch_output_port{$sw}) { 2901 #printf "%-28s %8s %3s %-8s %-25s\n", $sw_connect, $port_connect, $arrow, $db_switch_output_port{$sw}, $sw;2902 2897 $tb_parent->add($sw_connect, $port_connect, $arrow, $db_switch_output_port{$sw}, $sw); 2903 2898 } 2904 2899 else { 2905 #printf "%-28s %8s %3s %-8s %-25s\n", $sw_connect, $port_connect, $arrow, '', $sw;2906 2900 $tb_parent->add($sw_connect, $port_connect, $arrow, '', $sw); 2907 2901 } … … 2909 2903 } 2910 2904 @colrange = map { scalar $tb_parent->colrange($_) } (0 .. 4); # force scaler context 2911 $tb_parent->add(map { ' ' x $_ } reverse @colrange); # add empty line to force symetric table 2905 $tb_parent->add(map { ' ' x $_ } reverse @colrange); # add empty line to force symetric table output 2912 2906 print $tb_parent->title(); 2913 2907 print $tb_parent->rule('-');
Note: See TracChangeset
for help on using the changeset viewer.