Changeset 245


Ignore:
Timestamp:
Sep 7, 2017, 11:22:01 PM (3 years ago)
Author:
g7moreau
Message:
  • Change agg port name from : to | (: was already use)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/klask

    r244 r245  
    507507
    508508      my $swport_num = $result->{$research1};
    509       my $swport_hr = get_human_readable_port($sw->{model}, snmp_get_switchport_num2hr($session, $swport_num));
     509      my $swport_hr = snmp_get_switchport_num2hr($session, $swport_num);
    510510
    511511      $session->close;
     
    520520      for my $portignore (@{$sw->{portignore}}) {
    521521         next LOOP_ON_SWITCH if $swport_hr eq $portignore;
    522          my ($swport_hr_limited) = split /:/, $swport_hr; # Beginning of the swith port (Aggregator)
     522         my ($swport_hr_limited) = split /|/, $swport_hr; # Beginning of the swith port (Aggregator)
    523523         next LOOP_ON_SWITCH if $swport_hr_limited eq $portignore;
    524524         }
     
    563563      if (defined $result and $result->{$research1} ne 'noSuchInstance') {
    564564         my $swport_num = $result->{$research1};
    565          my $swport_hr = get_human_readable_port($sw->{model}, snmp_get_switchport_num2hr($session, $swport_num));
     565         my $swport_hr = snmp_get_switchport_num2hr($session, $swport_num);
    566566
    567567         SWITCH_PORT_IGNORE:
     
    667667   return @res;
    668668   }
    669 
    670 #---------------------------------------------------------------
    671 sub get_human_readable_port {
    672    my $sw_model = shift;
    673    my $sw_port  = shift;
    674 
    675    # Not need anymore
    676    # get port name by snmp
    677    return $sw_port;
    678    }
    679 
    680 #   if ($sw_model eq 'HP8000M') {
    681 #
    682 #      my $reste = (($sw_port - 1) % 8) + 1;
    683 #      my $major = int (($sw_port - 1) / 8);
    684 #      return "$INTERNAL_PORT_MAP{$major}$reste";
    685 #      }
    686 #
    687 #   if ($sw_model eq 'HP2424M') {
    688 #      if ($sw_port > 24) {
    689 #
    690 #         my $reste = $sw_port - 24;
    691 #         return "A$reste";
    692 #         }
    693 #      }
    694 #
    695 #   if ($sw_model eq 'HP1600M') {
    696 #      if ($sw_port > 16) {
    697 #
    698 #         my $reste = $sw_port - 16;
    699 #         return "A$reste";
    700 #         }
    701 #      }
    702 #
    703 #   if ($sw_model eq 'HP2810-48G' or $sw_model eq 'HP2810-24G') {
    704 #      if ($sw_port > 48) {
    705 #
    706 #         my $reste = $sw_port - 48;
    707 #         return "Trk$reste";
    708 #         }
    709 #      }
    710 #
    711 #   if ($sw_model eq 'HP3500-24G') {
    712 #      if ($sw_port > 289) {
    713 #
    714 #         my $reste = $sw_port - 289;
    715 #         return "Trk$reste";
    716 #         }
    717 #      }
    718 #
    719 #   return $sw_port;
    720 
    721 #sub get_numerical_port {
    722 #   my $sw_model = shift;
    723 #   my $sw_port  = shift;
    724 #
    725 #   if ($sw_model eq 'HP8000M') {
    726 #
    727 #      my $letter = substr $sw_port, 0, 1;
    728 #      my $reste =  substr $sw_port, 1;
    729 #
    730 #      return $INTERNAL_PORT_MAP_REV{$letter} * 8 + $reste;
    731 #      }
    732 #
    733 #   if ($sw_model eq 'HP2424M') {
    734 #      if ($sw_port =~ m/^A/xms ) {
    735 #
    736 #         my $reste =  substr $sw_port, 1;
    737 #
    738 #         return 24 + $reste;
    739 #         }
    740 #      }
    741 #
    742 #   if ($sw_model eq 'HP1600M') {
    743 #      if ($sw_port =~ m/^A/xms ) {
    744 #
    745 #         my $reste =  substr $sw_port, 1;
    746 #
    747 #         return 16 + $reste;
    748 #         }
    749 #      }
    750 #
    751 #   if ($sw_model eq 'HP2810-48G' or $sw_model eq 'HP2810-24G') {
    752 #      if ($sw_port =~ m/^Trk/xms ) {
    753 #
    754 #         my $reste =  substr $sw_port, 3;
    755 #
    756 #         return 48 + $reste;
    757 #         }
    758 #      }
    759 #
    760 #   if ($sw_model eq 'HP3500-24G') {
    761 #      if ($sw_port =~ m/^Trk/xms ) {
    762 #
    763 #         my $reste =  substr $sw_port, 3;
    764 #
    765 #         return 289 + $reste;
    766 #         }
    767 #      }
    768 #
    769 #   return $sw_port;
    770 #   }
    771669
    772670#---------------------------------------------------------------
     
    848746
    849747         my $current_port_name = snmp_get_switchport_index2hr($snmp_session, $current_port_index);
    850          $swport_hr .= ":$current_port_name";
     748         $swport_hr .= "|$current_port_name"; # Join with | (: is already use)
    851749         }
    852750      }
     
    860758
    861759   # Split for Aggregator port
    862    ($swport_hr) = split /:/, $swport_hr;
     760   # Keep only the Aggregator part
     761   ($swport_hr) = split /|/, $swport_hr;
    863762
    864763   my $swport_num = $swport_hr;
     
    11371036   my %db_switch_chained_port = ();
    11381037   for my $swport (keys %db_switch_connected_on_port) {
    1139       my ($sw_connect,$port_connect) = split m/ : /xms, $swport;
     1038      my ($sw_connect,$port_connect) = split m/ : /xms, $swport, 2;
    11401039      $db_switch_chained_port{$sw_connect} .= "$port_connect:";
    11411040      }
     
    16511550
    16521551   for my $swport (sort keys %db_switch_connected_on_port) {
    1653       my ($sw_connect,$port_connect) = split m/ : /xms, $swport;
     1552      my ($sw_connect,$port_connect) = split m/ : /xms, $swport, 2;
    16541553      for my $sw (keys %{$db_switch_connected_on_port{$swport}}) {
    16551554
     
    24852384      if (defined $result and $result->{$research1} ne 'noSuchInstance') {
    24862385         my $swport_num = $result->{$research1};
    2487          my $swport_hr = get_human_readable_port($sw->{model}, snmp_get_switchport_num2hr($session, $swport_num));
     2386         my $swport_hr = snmp_get_switchport_num2hr($session, $swport_num);
    24882387         print "Klask find MAC $mac_address on switch $sw_name port $swport_hr\n";
    24892388         }
     
    26422541         $maybe_more_than_one_switch_connected = 'yes';
    26432542
    2644          my ($sw_connect,$port_connect) = split m/ : /xms, $swport;
     2543         my ($sw_connect,$port_connect) = split m/ : /xms, $swport, 2;
    26452544         my @sw_on_same_port = keys %{$db_switch_connected_on_port{$swport}};
    26462545         print "VERBOSE_10: $swport -- ".$#sw_on_same_port." -- @sw_on_same_port\n" if $verbose;
     
    26942593   print "------------------------------------------------\n";
    26952594   for my $swport (sort keys %db_switch_connected_on_port) {
    2696       my ($sw_connect,$port_connect) = split m/ : /xms, $swport;
     2595      my ($sw_connect,$port_connect) = split m/ : /xms, $swport, 2;
    26972596      for my $sw (keys %{$db_switch_connected_on_port{$swport}}) {
    26982597         if (exists $db_switch_output_port{$sw}) {
     
    27662665   print "------------------------------------------------\n";
    27672666   for my $swport (sort keys %db_switch_connected_on_port) {
    2768       my ($sw_connect,$port_connect) = split m/ : /xms, $swport;
     2667      my ($sw_connect,$port_connect) = split m/ : /xms, $swport, 2;
    27692668      for my $sw (keys %{$db_switch_connected_on_port{$swport}}) {
    27702669         my $arrow ='<--';
     
    28422741
    28432742            for my $swport (keys %db_switch_connected_on_port) {
    2844                my ($sw_connect,$port_connect) = split m/ : /xms, $swport;
     2743               my ($sw_connect,$port_connect) = split m/ : /xms, $swport, 2;
    28452744               next if not $sw_connect eq $sw;
    28462745               next if $port_connect eq $db_switch_output_port{$sw};
     
    28672766#   print "------------------------------------------------\n";
    28682767   for my $swport (sort keys %db_switch_connected_on_port) {
    2869       my ($sw_connect,$port_connect) = split m/ : /xms, $swport;
     2768      my ($sw_connect,$port_connect) = split m/ : /xms, $swport, 2;
    28702769      for my $sw (keys %{$db_switch_connected_on_port{$swport}}) {
    28712770         if (exists $db_switch_output_port{$sw}) {
Note: See TracChangeset for help on using the changeset viewer.