Changeset 181 for trunk/klask


Ignore:
Timestamp:
Aug 26, 2016, 2:19:12 PM (8 years ago)
Author:
g7moreau
Message:
  • limit infinite loop in updatesw to 100 if no good solution
  • return human readable port on search-mac-on-switch
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/klask

    r180 r181  
    499499         my $swport_hr = get_human_readable_port($sw->{model}, snmp_get_swithport_hr($session, $swport_num));
    500500
     501         SWITCH_PORT_IGNORE:
     502         for my $portignore (@{$sw->{portignore}}) {
     503            if ($swport_hr eq $portignore) {
     504               $session->close;
     505               next LOOP_ON_ALL_SWITCH
     506               }
     507            }
     508
    501509         $ret->{$sw->{hostname}} = {};
    502510         $ret->{$sw->{hostname}}{hostname}    = $sw->{hostname};
     
    20172025
    20182026      if (defined $result and $result->{$research1} ne 'noSuchInstance') {
    2019          my $swport = $result->{$research1};
    2020          print "Klask find MAC $mac_address on switch $sw_name port $swport\n";
     2027         my $swport_num = $result->{$research1};
     2028         my $swport_hr = get_human_readable_port($sw->{model}, snmp_get_swithport_hr($session, $swport_num));
     2029         print "Klask find MAC $mac_address on switch $sw_name port $swport_hr\n";
    20212030         }
    20222031      else {
     
    21382147   my %db_switch_connected_on_port = ();
    21392148   my $maybe_more_than_one_switch_connected = 'yes';
    2140 
    2141    while ($maybe_more_than_one_switch_connected eq 'yes') {
     2149   my $cloop = 0;
     2150
     2151   while ($maybe_more_than_one_switch_connected eq 'yes' and $cloop < 100) {
     2152      $cloop++;
     2153      print "VERBOSE_9: cloop reduction step: $cloop\n" if $verbose;
    21422154      for my $sw (keys %db_switch_link_with) {
    21432155         for my $connect (keys %{$db_switch_link_with{$sw}}) {
     
    21612173         my ($sw_connect,$port_connect) = split m/ : /xms, $swport;
    21622174         my @sw_on_same_port = keys %{$db_switch_connected_on_port{$swport}};
     2175         print "VERBOSE_10: $swport -- ".$#sw_on_same_port." -- @sw_on_same_port\n" if $verbose;
    21632176
    21642177         CONNECTED:
Note: See TracChangeset for help on using the changeset viewer.