Index: /trunk/klask
===================================================================
--- /trunk/klask	(revision 276)
+++ /trunk/klask	(revision 277)
@@ -504,6 +504,6 @@
       }
 
-   my $research1 = $OID_NUMBER{'searchPort1'} . mac_address_hex2dec($mac_address);
-   my $research2 = $OID_NUMBER{'searchPort2'} .'.'. $vlan_id . mac_address_hex2dec($mac_address);
+   my $oid_search_port1 = $OID_NUMBER{'searchPort1'} . mac_address_hex2dec($mac_address);
+   my $oid_search_port2 = $OID_NUMBER{'searchPort2'} .'.'. $vlan_id . mac_address_hex2dec($mac_address);
 
    LOOP_ON_SWITCH:
@@ -513,19 +513,19 @@
 
       my $result = $session->get_request(
-         -varbindlist => [$research1]
+         -varbindlist => [$oid_search_port1]
          );
       if (not defined $result) {
          $result = $session->get_request(
-            -varbindlist => [$research2]
+            -varbindlist => [$oid_search_port2]
             );
-         $result->{$research1} = $result->{$research2} if defined $result;
-         }
-
-      if (not (defined $result and $result->{$research1} ne 'noSuchInstance')) {
+         $result->{$oid_search_port1} = $result->{$oid_search_port2} if defined $result;
+         }
+
+      if (not (defined $result and $result->{$oid_search_port1} ne 'noSuchInstance')) {
          $session->close;
          next LOOP_ON_SWITCH;
          }
 
-      my $swport_id = $result->{$research1};
+      my $swport_id = $result->{$oid_search_port1};
       my $swport_hr = snmp_get_switchport_id2hr($session, $swport_id);
 
@@ -565,6 +565,6 @@
    return $ret if $mac_address eq 'unknow';
 
-   my $research1 = $OID_NUMBER{'searchPort1'} . mac_address_hex2dec($mac_address);
-   my $research2 = $OID_NUMBER{'searchPort2'} .'.'. $vlan_id . mac_address_hex2dec($mac_address);
+   my $oid_search_port1 = $OID_NUMBER{'searchPort1'} . mac_address_hex2dec($mac_address);
+   my $oid_search_port2 = $OID_NUMBER{'searchPort2'} .'.'. $vlan_id . mac_address_hex2dec($mac_address);
    LOOP_ON_ALL_SWITCH:
    for my $sw (@SWITCH_LIST) {
@@ -573,15 +573,15 @@
 
       my $result = $session->get_request(
-         -varbindlist => [$research1]
+         -varbindlist => [$oid_search_port1]
          );
       if (not defined $result) {
          $result = $session->get_request(
-            -varbindlist => [$research2]
+            -varbindlist => [$oid_search_port2]
             );
-         $result->{$research1} = $result->{$research2} if defined $result;
-         }
-
-      if (defined $result and $result->{$research1} ne 'noSuchInstance') {
-         my $swport_id = $result->{$research1};
+         $result->{$oid_search_port1} = $result->{$oid_search_port2} if defined $result;
+         }
+
+      if (defined $result and $result->{$oid_search_port1} ne 'noSuchInstance') {
+         my $swport_id = $result->{$oid_search_port1};
          my $swport_hr = snmp_get_switchport_id2hr($session, $swport_id);
 
@@ -723,11 +723,11 @@
    # First get the index, second get the name (port_hr)
 
-   my $research_ix = $OID_NUMBER{'ifIndex'} .'.'. $swport_id;
+   my $oid_search_ix = $OID_NUMBER{'ifIndex'} .'.'. $swport_id;
    my $result_ix = $snmp_session->get_request(
-      -varbindlist => [$research_ix]
+      -varbindlist => [$oid_search_ix]
       );
 
    my $swport_ix = $swport_id;
-   $swport_ix = $result_ix->{$research_ix} if defined $result_ix;
+   $swport_ix = $result_ix->{$oid_search_ix} if defined $result_ix;
 
    return snmp_get_switchport_ix2hr($snmp_session, $swport_ix);
@@ -738,19 +738,19 @@
    my ($snmp_session, $swport_ix) = @_;
 
-   my $research_hr = $OID_NUMBER{'ifName'} .'.'. $swport_ix;
+   my $oid_search_hr = $OID_NUMBER{'ifName'} .'.'. $swport_ix;
    my $result_hr = $snmp_session->get_request(
-      -varbindlist => [$research_hr]
+      -varbindlist => [$oid_search_hr]
       );
    my $swport_hr = $swport_ix;
-   $swport_hr = normalize_port_human_readable($result_hr->{$research_hr}) if defined $result_hr;
+   $swport_hr = normalize_port_human_readable($result_hr->{$oid_search_hr}) if defined $result_hr;
 
    # Aggregator port
    if ($swport_hr =~ m/^(Trk|Br|Po)/) {
-      my $research_index = $OID_NUMBER{'ifAggregator'}; # base OID
-      my @args = ( -varbindlist =>  [$research_index]);
+      my $oid_search_index = $OID_NUMBER{'ifAggregator'}; # base OID
+      my @args = ( -varbindlist =>  [$oid_search_index]);
       LOOP_ON_OID_PORT:
       while ( defined $snmp_session->get_next_request(@args) ) {
          my ($oid_current) = $snmp_session->var_bind_names;
-         last LOOP_ON_OID_PORT if  not Net::SNMP::oid_base_match($research_index, $oid_current);
+         last LOOP_ON_OID_PORT if  not Net::SNMP::oid_base_match($oid_search_index, $oid_current);
 
          # IEEE8023-LAG-MIB::dot3adAggPortSelectedAggID.28 = INTEGER: 337
@@ -785,10 +785,10 @@
    return $swport_id if $swport_id =~ m/^\d+$/;
 
-   my $research_ix = $OID_NUMBER{'ifIndex'}; # base OID
-   my @args = ( -varbindlist =>  [$research_ix]);
+   my $oid_search_ix = $OID_NUMBER{'ifIndex'}; # base OID
+   my @args = ( -varbindlist =>  [$oid_search_ix]);
    LOOP_ON_OID_PORT:
    while ( defined $snmp_session->get_next_request(@args) ) {
       my ($oid_current) = $snmp_session->var_bind_names;
-      last LOOP_ON_OID_PORT if  not Net::SNMP::oid_base_match($research_ix, $oid_current);
+      last LOOP_ON_OID_PORT if  not Net::SNMP::oid_base_match($oid_search_ix, $oid_current);
       
       my $port_ifIndex = $snmp_session->var_bind_list->{$oid_current};
@@ -799,10 +799,10 @@
       @args = (-varbindlist => [$oid_current]);
       
-      my $oid_ifName = $OID_NUMBER{'ifName'} .'.'. $port_ifIndex;
-      my $result = $snmp_session->get_request(-varbindlist => [$oid_ifName]);
+      my $oid_search_ifName = $OID_NUMBER{'ifName'} .'.'. $port_ifIndex;
+      my $result = $snmp_session->get_request(-varbindlist => [$oid_search_ifName]);
       next LOOP_ON_OID_PORT if not defined $result;
       
-      my $current_port_hr = normalize_port_human_readable($result->{$oid_ifName});
-      printf "PORT2: $oid_ifName => $current_port_hr\n" if $verbose;
+      my $current_port_hr = normalize_port_human_readable($result->{$oid_search_ifName});
+      printf "PORT2: $oid_search_ifName => $current_port_hr\n" if $verbose;
       if ($current_port_hr eq $swport_hr) {
          print "PORT3: $current_port_hr <-> $port_ix\n" if $verbose;
@@ -823,10 +823,10 @@
    my %vlandb = (); # Hash vlan number => vlan name
 
-   my $research_index = $OID_NUMBER{'vlanName'}; # base OID
-   my @args = ( -varbindlist =>  [$research_index]);
+   my $oid_search_index = $OID_NUMBER{'vlanName'}; # base OID
+   my @args = ( -varbindlist =>  [$oid_search_index]);
    LOOP_ON_VLAN:
    while ( defined $snmp_session->get_next_request(@args) ) {
       my ($oid_current) = $snmp_session->var_bind_names;
-      last LOOP_ON_VLAN if not Net::SNMP::oid_base_match($research_index, $oid_current);
+      last LOOP_ON_VLAN if not Net::SNMP::oid_base_match($oid_search_index, $oid_current);
 
       my $vlan_name = $snmp_session->var_bind_list->{$oid_current};
@@ -1835,5 +1835,5 @@
          }
 
-      my $search = $OID_NUMBER{'NApoeState'} . ".$switch_port"; # Only NEXANS switch and low port number
+      my $oid_search = $OID_NUMBER{'NApoeState'} . ".$switch_port"; # Only NEXANS switch and low port number
 
       my $sw = $SWITCH_DB{$sw_name};
@@ -1842,5 +1842,5 @@
 
       my $result = $session->set_request(
-         -varbindlist => [$search, INTEGER, 8], # Only NEXANS
+         -varbindlist => [$oid_search, INTEGER, 8], # Only NEXANS
          );
       print $session->error()."\n" if $session->error_status();
@@ -1873,5 +1873,5 @@
          }
 
-      my $search = $OID_NUMBER{'NApoeState'} . ".$switch_port"; # Only NEXANS switch and low port number
+      my $oid_search = $OID_NUMBER{'NApoeState'} . ".$switch_port"; # Only NEXANS switch and low port number
 
       my $sw = $SWITCH_DB{$sw_name};
@@ -1880,5 +1880,5 @@
 
       my $result = $session->set_request(
-         -varbindlist => [$search, INTEGER, 2], # Only NEXANS
+         -varbindlist => [$oid_search, INTEGER, 2], # Only NEXANS
          );
       print $session->error()."\n" if $session->error_status();
@@ -1911,5 +1911,5 @@
          }
 
-      my $search = $OID_NUMBER{'NApoeState'} . ".$switch_port"; # Only NEXANS switch and low port number
+      my $oid_search = $OID_NUMBER{'NApoeState'} . ".$switch_port"; # Only NEXANS switch and low port number
 
       my $sw = $SWITCH_DB{$sw_name};
@@ -1918,9 +1918,9 @@
 
       my $result = $session->get_request(
-         -varbindlist => [$search],
+         -varbindlist => [$oid_search],
          );
 
-      if (defined $result and $result->{$search} ne 'noSuchInstance') {
-         my $poe_status = $result->{$search} || 'empty';
+      if (defined $result and $result->{$oid_search} ne 'noSuchInstance') {
+         my $poe_status = $result->{$oid_search} || 'empty';
          $poe_status =~ s/8/enable/;
          $poe_status =~ s/2/disable/;
@@ -1953,8 +1953,8 @@
          }
 
-      my $research1 = $OID_NUMBER{'searchPort1'} . mac_address_hex2dec($mac_address);
-      my $research2 = $OID_NUMBER{'searchPort2'} .'.'. 0 . mac_address_hex2dec($mac_address);
-      print "Klask search OID $research1 on switch $sw_name\n";
-      print "Klask search OID $research2 on switch $sw_name\n";
+      my $oid_search_port1 = $OID_NUMBER{'searchPort1'} . mac_address_hex2dec($mac_address);
+      my $oid_search_port2 = $OID_NUMBER{'searchPort2'} .'.'. 0 . mac_address_hex2dec($mac_address);
+      print "Klask search OID $oid_search_port1 on switch $sw_name\n";
+      print "Klask search OID $oid_search_port2 on switch $sw_name\n";
 
       my $sw = $SWITCH_DB{$sw_name};
@@ -1963,15 +1963,15 @@
 
       my $result = $session->get_request(
-         -varbindlist => [$research1]
+         -varbindlist => [$oid_search_port1]
          );
       if (not defined $result) {
          $result = $session->get_request(
-            -varbindlist => [$research2]
+            -varbindlist => [$oid_search_port2]
             );
-         $result->{$research1} = $result->{$research2} if defined $result;
-         }
-
-      if (defined $result and $result->{$research1} ne 'noSuchInstance') {
-         my $swport = $result->{$research1};
+         $result->{$oid_search_port1} = $result->{$oid_search_port2} if defined $result;
+         }
+
+      if (defined $result and $result->{$oid_search_port1} ne 'noSuchInstance') {
+         my $swport = $result->{$oid_search_port1};
          print "Klask find MAC $mac_address on switch $sw_name port $swport\n";
          }
@@ -2006,5 +2006,5 @@
          }
 
-      my $search = $OID_NUMBER{'vlanPortDefault'} . ".$switch_port";
+      my $oid_search = $OID_NUMBER{'vlanPortDefault'} . ".$switch_port";
 
       my $sw = $SWITCH_DB{$sw_name};
@@ -2013,9 +2013,9 @@
 
       my $result = $session->get_request(
-         -varbindlist => [$search],
+         -varbindlist => [$oid_search],
          );
 
-      if (defined $result and $result->{$search} ne 'noSuchInstance') {
-         my $vlan_id = $result->{$search} || 'empty';
+      if (defined $result and $result->{$oid_search} ne 'noSuchInstance') {
+         my $vlan_id = $result->{$oid_search} || 'empty';
          print "Klask VLAN Id $vlan_id on switch $sw_name on port $switch_port\n";
          }
@@ -2083,5 +2083,5 @@
          }
 
-      my $search_vlan_name = $OID_NUMBER{'vlanName'} . ".$vlan_id";
+      my $oid_search_vlan_name = $OID_NUMBER{'vlanName'} . ".$vlan_id";
 
       my $sw = $SWITCH_DB{$sw_name};
@@ -2090,9 +2090,9 @@
 
       my $result = $session->get_request(
-         -varbindlist => [$search_vlan_name]
+         -varbindlist => [$oid_search_vlan_name]
          );
 
-      if (defined $result and $result->{$search_vlan_name} ne 'noSuchInstance') {
-         my $vlan_name = $result->{$search_vlan_name} || 'empty';
+      if (defined $result and $result->{$oid_search_vlan_name} ne 'noSuchInstance') {
+         my $vlan_name = $result->{$oid_search_vlan_name} || 'empty';
          print "Klask find VLAN $vlan_id on switch $sw_name with name $vlan_name\n";
          }
@@ -2333,9 +2333,9 @@
    die "Error : Port $port_hr does not exist on switch $switch_name\n" if not $port_id =~ m/^\d+$/;
 
-   my $search_portstatus = $OID_NUMBER{'portUpDown'} .'.'. $port_id;
-   print "Info: switch $switch_name port $port_hr SNMP OID $search_portstatus\n" if $verbose;
+   my $oid_search_portstatus = $OID_NUMBER{'portUpDown'} .'.'. $port_id;
+   print "Info: switch $switch_name port $port_hr SNMP OID $oid_search_portstatus\n" if $verbose;
 
    my $result = $session->set_request(
-      -varbindlist => [$search_portstatus, INTEGER, 1],
+      -varbindlist => [$oid_search_portstatus, INTEGER, 1],
       );
    print $session->error()."\n" if $session->error_status();
@@ -2378,9 +2378,9 @@
    die "Error : Port $port_hr does not exist on switch $switch_name\n" if not $port_id =~ m/^\d+$/;
 
-   my $search_portstatus = $OID_NUMBER{'portUpDown'} .'.'. $port_id;
-   print "Info: switch $switch_name port $port_hr SNMP OID $search_portstatus\n" if $verbose;
+   my $oid_search_portstatus = $OID_NUMBER{'portUpDown'} .'.'. $port_id;
+   print "Info: switch $switch_name port $port_hr SNMP OID $oid_search_portstatus\n" if $verbose;
 
    my $result = $session->set_request(
-      -varbindlist => [$search_portstatus, INTEGER, 2],
+      -varbindlist => [$oid_search_portstatus, INTEGER, 2],
       );
    print $session->error()."\n" if $session->error_status();
@@ -2421,13 +2421,13 @@
    die "Error : Port $port_hr does not exist on switch $switch_name\n" if not $port_id =~ m/^\d+$/;
 
-   my $search_portstatus = $OID_NUMBER{'portUpDown'} .'.'. $port_id;
-   print "Info: switch $switch_name port $port_hr ($port_id) SNMP OID $search_portstatus\n" if $verbose;
+   my $oid_search_portstatus = $OID_NUMBER{'portUpDown'} .'.'. $port_id;
+   print "Info: switch $switch_name port $port_hr ($port_id) SNMP OID $oid_search_portstatus\n" if $verbose;
 
    my $result = $session->get_request(
-      -varbindlist => [$search_portstatus]
+      -varbindlist => [$oid_search_portstatus]
       );
    print $session->error()."\n" if $session->error_status();
    if (defined $result) {
-      print "$PORT_UPDOWN{$result->{$search_portstatus}}\n";
+      print "$PORT_UPDOWN{$result->{$oid_search_portstatus}}\n";
       }
 
@@ -2465,8 +2465,8 @@
          }
 
-      my $research1 = $OID_NUMBER{'searchPort1'} . mac_address_hex2dec($mac_address);
-      my $research2 = $OID_NUMBER{'searchPort2'} .'.'. $vlan_id . mac_address_hex2dec($mac_address);
-      print "Klask search OID $research1 on switch $sw_name\n" if $verbose;
-      print "Klask search OID $research2 on switch $sw_name\n" if $verbose;
+      my $oid_search_port1 = $OID_NUMBER{'searchPort1'} . mac_address_hex2dec($mac_address);
+      my $oid_search_port2 = $OID_NUMBER{'searchPort2'} .'.'. $vlan_id . mac_address_hex2dec($mac_address);
+      print "Klask search OID $oid_search_port1 on switch $sw_name\n" if $verbose;
+      print "Klask search OID $oid_search_port2 on switch $sw_name\n" if $verbose;
 
       my $sw = $SWITCH_DB{$sw_name};
@@ -2475,15 +2475,15 @@
 
       my $result = $session->get_request(
-         -varbindlist => [$research1]
+         -varbindlist => [$oid_search_port1]
          );
       if (not defined $result) {
          $result = $session->get_request(
-            -varbindlist => [$research2]
+            -varbindlist => [$oid_search_port2]
             );
-         $result->{$research1} = $result->{$research2} if defined $result;
-         }
-
-      if (defined $result and $result->{$research1} ne 'noSuchInstance') {
-         my $swport_id = $result->{$research1};
+         $result->{$oid_search_port1} = $result->{$oid_search_port2} if defined $result;
+         }
+
+      if (defined $result and $result->{$oid_search_port1} ne 'noSuchInstance') {
+         my $swport_id = $result->{$oid_search_port1};
          my $swport_hr = snmp_get_switchport_id2hr($session, $swport_id);
          print "Klask find MAC $mac_address on switch $sw_name port $swport_hr\n";
