Changeset 240


Ignore:
Timestamp:
Sep 7, 2017, 5:18:53 PM (3 years ago)
Author:
g7moreau
Message:
  • Begin Aggregator port support
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/klask

    r239 r240  
    179179   poeState        => '1.3.6.1.2.1.105.1.1.1.3.1',    # 1.3.6.1.2.1.105.1.1.1.3.1.NoPort = 1 (poe up)  = 2 (poe down) - Cisco and Zyxel
    180180   NApoeState      => '1.3.6.1.4.1.266.20.3.1.1.21',  # .NoPort = 2 (poe off)  = 8 (poe atHighPower) - Nexans
     181   ifAggregator    => '1.2.840.10006.300.43.1.2.1.1.12', # dot3adAggPortSelectedAggID - 0 not part of an  Aggregator - Ciso Dell HP Comware -  See https://stackoverflow.com/questions/14960157/how-to-map-portchannel-to-interfaces-via-snmp https://gist.github.com/bldewolf/6314435
    181182   );
    182183
     
    812813   my $swport_hr = $swport;
    813814   $swport_hr = normalize_port_human_readable($result_hr->{$research_hr}) if defined $result_hr;
     815
     816   # Aggregator port
     817   if ($swport_hr =~ m/^(Trk|Br|Po)/) {
     818      my $research_index = $OID_NUMBER{ifAggregator}; # base OID
     819      my @args = ( -varbindlist =>  [$research_index]);
     820      LOOP_ON_OID_PORT:
     821      while ( defined $snmp_session->get_next_request(@args) ) {
     822         my ($oid_current) = $snmp_session->var_bind_names;
     823         last LOOP_ON_OID_PORT if  not Net::SNMP::oid_base_match($research_index, $oid_current);
     824
     825         # IEEE8023-LAG-MIB::dot3adAggPortSelectedAggID.28 = INTEGER: 337
     826         # IEEE8023-LAG-MIB::dot3adAggPortAttachedAggID.28 = INTEGER: 337
     827         my $port_aggregator = $snmp_session->var_bind_list->{$oid_current};
     828         my ($port_index) = reverse split /\./, $oid_current; # last number
     829
     830         # prepare next loop item
     831         @args = (-varbindlist => [$oid_current]);
     832
     833         next LOOP_ON_OID_PORT if $port_aggregator == 0;
     834         next LOOP_ON_OID_PORT if not $port_aggregator == $swport;
     835
     836         my $port_name = snmp_get_switchport_hr($snmp_session, $port_index);
     837         $swport_hr .= ":$port_name";
     838         }
     839      }
    814840   return $swport_hr;
    815841   }
     
    819845sub snmp_get_switchport_num {
    820846   my ($snmp_session, $swport_hr, $verbose) = @_;
     847
     848   # Split for Aggregator port
     849   ($swport_hr) = split /:/, $swport_hr;
    821850
    822851   my $swport_num = $swport_hr;
Note: See TracChangeset for help on using the changeset viewer.