Changeset 270


Ignore:
Timestamp:
Sep 15, 2017, 10:25:07 PM (7 years ago)
Author:
g7moreau
Message:
  • Rename switch_port -> switch_port_id
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/klask

    r269 r270  
    491491   my %ret;
    492492   $ret{'switch_description'} = 'unknow';
    493    $ret{'switch_port'} = '0';
     493   $ret{'switch_port_id'} = '0';
    494494
    495495   return %ret if $mac_address eq 'unknow';;
     
    547547      $ret{'switch_hostname'}    = $sw->{'hostname'};
    548548      $ret{'switch_description'} = $sw->{'description'};
    549       $ret{'switch_port'}        = $swport_num;
     549      $ret{'switch_port_id'}     = $swport_num;
    550550      $ret{'switch_port_hr'}     = $swport_hr; # human readable
    551551
     
    850850   for my $ip (keys %{$computerdb}) {
    851851
     852      # Rename switch_port -> switch_port_id (2017/09/15)
     853      if (not exists $computerdb->{$ip}{'switch_port_id' and exists $computerdb->{$ip}{'switch_port'}}) {
     854         $computerdb->{$ip}{'switch_port_id'} = $computerdb->{$ip}{'switch_port'} if defined $computerdb->{$ip}{'switch_port'};
     855         }
     856      delete $computerdb->{$ip}{'switch_port'} if exists $computerdb->{$ip}{'switch_port'};
     857
    852858      next LOOP_ON_IP_ADDRESS if exists $computerdb->{$ip}{'switch_port_hr'} and defined $computerdb->{$ip}{'switch_port_hr'};
    853859
    854       $computerdb->{$ip}{'switch_port_hr'} = $computerdb->{$ip}{'switch_port'};
     860      $computerdb->{$ip}{'switch_port_hr'} = $computerdb->{$ip}{'switch_port_id'};
    855861      }
    856862
     
    11591165               switch_hostname    => $where{'switch_hostname'},
    11601166               switch_description => $where{'switch_description'},
    1161                switch_port        => $where{'switch_port'},
     1167               switch_port_id     => $where{'switch_port_id'},
    11621168               switch_port_hr     => $where{'switch_port_hr'},
    11631169               timestamp          => $timestamp,
     
    11751181               switch_hostname    => $where{'switch_hostname'},
    11761182               switch_description => $where{'switch_description'},
    1177                switch_port        => $where{'switch_port'},
     1183               switch_port_id     => $where{'switch_port_id'},
    11781184               switch_port_hr     => $where{'switch_port_hr'},
    11791185               timestamp          => $resol_arp{'timestamp'},
     
    14881494      my $switch_hostname = $computerdb->{$ip}{'switch_hostname'} || $computerdb->{$ip}{'switch_description'} || 'unkown';
    14891495      chomp $switch_hostname;
    1490       my $switch_hostname_sort = sprintf '%s %3s' ,$switch_hostname, $computerdb->{$ip}{'switch_port_hr'};
     1496      my $switch_hostname_sort = sprintf '%s %06i' ,$switch_hostname, $computerdb->{$ip}{'switch_port_id'}; # Take switch index
    14911497
    14921498      my $ip_sort = sprintf '%03i%03i%03i%03i', split m/ \. /xms, $ip;
     
    17311737      next LOOP_ON_IP_ADDRESS if $computerdb->{$ip}{'hostname_fq'} eq ($computerdb->{$ip}{'switch_hostname'} || $computerdb->{$ip}{'switch_description'}); # switch on himself !
    17321738      next LOOP_ON_IP_ADDRESS if ($computerdb->{$ip}{'switch_hostname'} || $computerdb->{$ip}{'switch_description'}) eq 'unknow';
    1733       next LOOP_ON_IP_ADDRESS if $computerdb->{$ip}{'switch_port'} eq '0';
     1739      next LOOP_ON_IP_ADDRESS if $computerdb->{$ip}{'switch_port_id'} eq '0';
    17341740
    17351741      my $ip_timestamp   = $computerdb->{$ip}{'timestamp'};
Note: See TracChangeset for help on using the changeset viewer.