Changeset 242
- Timestamp:
- Sep 7, 2017, 10:35:53 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/klask
r241 r242 800 800 #--------------------------------------------------------------- 801 801 sub snmp_get_switchport_hr { 802 my ($snmp_session, $swport) = @_; 803 804 my $research_index = $OID_NUMBER{ifIndex} .'.'. $swport; 805 my $result_index = $snmp_session->get_request( 806 -varbindlist => [$research_index] 807 ); 808 my $swifindex = $swport; 809 $swifindex = $result_index->{$research_index} if defined $result_index; 810 811 my $research_hr = $OID_NUMBER{ifName} .'.'. $swifindex; 802 my ($snmp_session, $swport_num, $flag) = @_; 803 804 # On H3C, port number and port index are not the same 805 # Double SNMP request to get the name 806 my $swport_index = $swport_num; 807 808 if ($flag ne 'index') { 809 my $research_index = $OID_NUMBER{ifIndex} .'.'. $swport_num; 810 my $result_index = $snmp_session->get_request( 811 -varbindlist => [$research_index] 812 ); 813 $swport_index = $result_index->{$research_index} if defined $result_index; 814 } 815 816 my $research_hr = $OID_NUMBER{ifName} .'.'. $swport_index; 812 817 my $result_hr = $snmp_session->get_request( 813 818 -varbindlist => [$research_hr] 814 819 ); 815 my $swport_hr = $swport ;820 my $swport_hr = $swport_index; 816 821 $swport_hr = normalize_port_human_readable($result_hr->{$research_hr}) if defined $result_hr; 817 822 … … 827 832 # IEEE8023-LAG-MIB::dot3adAggPortSelectedAggID.28 = INTEGER: 337 828 833 # IEEE8023-LAG-MIB::dot3adAggPortAttachedAggID.28 = INTEGER: 337 829 my $port_aggregator = $snmp_session->var_bind_list->{$oid_current};830 my ($ port_index) = reverse split /\./, $oid_current; # last number834 my $port_aggregator_index = $snmp_session->var_bind_list->{$oid_current}; 835 my ($current_port_index) = reverse split /\./, $oid_current; # last number 831 836 832 837 # prepare next loop item 833 838 @args = (-varbindlist => [$oid_current]); 834 839 835 next LOOP_ON_OID_PORT if $port_aggregator == 0;836 next LOOP_ON_OID_PORT if not $port_aggregator == $swport;837 838 my $ port_name = snmp_get_switchport_hr($snmp_session, $port_index);839 $swport_hr .= ":$ port_name";840 next LOOP_ON_OID_PORT if $port_aggregator_index == 0; 841 next LOOP_ON_OID_PORT if not $port_aggregator_index == $swport_index; 842 843 my $current_port_name = snmp_get_switchport_hr($snmp_session, $current_port_index, 'index'); 844 $swport_hr .= ":$current_port_name"; 840 845 } 841 846 }
Note: See TracChangeset
for help on using the changeset viewer.