This commit is contained in:
Bill Fenner
2008-08-01 08:10:47 +00:00
parent 347e1f9f59
commit cfd5c5d9d7
2 changed files with 103 additions and 109 deletions

View File

@@ -51,7 +51,8 @@ $VERSION = '1.09';
'ALCATEL-IND1-DEVICES' => 'familyOmniSwitch7000', 'ALCATEL-IND1-DEVICES' => 'familyOmniSwitch7000',
'ALCATEL-IND1-CHASSIS-MIB' => 'chasEntPhysOperStatus', 'ALCATEL-IND1-CHASSIS-MIB' => 'chasEntPhysOperStatus',
'ALU-POWER-ETHERNET-MIB' => 'pethPsePortDetectionStatus', 'ALU-POWER-ETHERNET-MIB' => 'pethPsePortDetectionStatus',
); );
# Alcatel provides their own version of the POWER-ETHERNET-MIB, # Alcatel provides their own version of the POWER-ETHERNET-MIB,
# off in vendor-space, without renaming any of the objects. # off in vendor-space, without renaming any of the objects.
# This means we have to *not* load the POWER-ETHERNET-MIB # This means we have to *not* load the POWER-ETHERNET-MIB
@@ -62,26 +63,25 @@ $VERSION = '1.09';
delete $MIBS{'POWER-ETHERNET-MIB'}; delete $MIBS{'POWER-ETHERNET-MIB'};
%GLOBALS = ( %GLOBALS = (
%SNMP::Info::Layer3::GLOBALS, %SNMP::Info::Layer3::GLOBALS, %SNMP::Info::MAU::GLOBALS,
%SNMP::Info::MAU::GLOBALS,
%SNMP::Info::LLDP::GLOBALS, %SNMP::Info::LLDP::GLOBALS,
); );
%FUNCS = ( %FUNCS = (
%SNMP::Info::Layer3::FUNCS, %SNMP::Info::Layer3::FUNCS, %SNMP::Info::MAU::FUNCS,
%SNMP::Info::MAU::FUNCS,
%SNMP::Info::LLDP::FUNCS, %SNMP::Info::LLDP::FUNCS,
); );
%MUNGE = ( %MUNGE = (
%SNMP::Info::Layer3::MUNGE, %SNMP::Info::Layer3::MUNGE, %SNMP::Info::MAU::MUNGE,
%SNMP::Info::MAU::MUNGE,
%SNMP::Info::LLDP::MUNGE, %SNMP::Info::LLDP::MUNGE,
); );
# use MAU-MIB for admin. duplex and admin. speed # use MAU-MIB for admin. duplex and admin. speed
*SNMP::Info::Layer3::AlcatelLucent::i_duplex_admin = \&SNMP::Info::MAU::mau_i_duplex_admin; *SNMP::Info::Layer3::AlcatelLucent::i_duplex_admin
*SNMP::Info::Layer3::AlcatelLucent::i_speed_admin = \&SNMP::Info::MAU::mau_i_speed_admin; = \&SNMP::Info::MAU::mau_i_duplex_admin;
*SNMP::Info::Layer3::AlcatelLucent::i_speed_admin
= \&SNMP::Info::MAU::mau_i_speed_admin;
sub model { sub model {
my $alu = shift; my $alu = shift;
@@ -107,7 +107,7 @@ sub os_ver {
my $alu = shift; my $alu = shift;
my $descr = $alu->description(); my $descr = $alu->description();
if ($descr =~ m/^(\S+)/) { if ( $descr =~ m/^(\S+)/ ) {
return $1; return $1;
} }
@@ -126,9 +126,9 @@ sub _power_supplies {
my $e_class = $alu->e_class(); my $e_class = $alu->e_class();
my @supplies = (); my @supplies = ();
foreach my $key (sort { int($a) cmp int($b) } keys %$e_class) { foreach my $key ( sort { int($a) cmp int($b) } keys %$e_class ) {
if ( $e_class->{$key} eq 'powerSupply' ) { if ( $e_class->{$key} eq 'powerSupply' ) {
push( @supplies, int( $key ) ); push( @supplies, int($key) );
} }
} }
return @supplies; return @supplies;
@@ -139,11 +139,11 @@ sub _ps_type {
my $psnum = shift; my $psnum = shift;
my @ps = $alu->_power_supplies(); my @ps = $alu->_power_supplies();
if ($psnum > $#ps) { if ( $psnum > $#ps ) {
return "none"; return "none";
} }
my $supply = $ps[$psnum]; my $supply = $ps[$psnum];
my $descr = $alu->e_descr( $supply ); my $descr = $alu->e_descr($supply);
return $descr->{$supply}; return $descr->{$supply};
} }
@@ -152,32 +152,32 @@ sub _ps_status {
my $psnum = shift; my $psnum = shift;
my @ps = $alu->_power_supplies(); my @ps = $alu->_power_supplies();
if ($psnum > $#ps) { if ( $psnum > $#ps ) {
return "not present"; return "not present";
} }
my $supply = $ps[$psnum]; my $supply = $ps[$psnum];
my $status = $alu->chasEntPhysOperStatus( $supply ); my $status = $alu->chasEntPhysOperStatus($supply);
return $status->{$supply}; return $status->{$supply};
} }
sub ps1_type { sub ps1_type {
my $alu = shift; my $alu = shift;
return $alu->_ps_type( 0 ); return $alu->_ps_type(0);
} }
sub ps2_type { sub ps2_type {
my $alu = shift; my $alu = shift;
return $alu->_ps_type( 1 ); return $alu->_ps_type(1);
} }
sub ps1_status { sub ps1_status {
my $alu = shift; my $alu = shift;
return $alu->_ps_status( 0 ); return $alu->_ps_status(0);
} }
sub ps2_status { sub ps2_status {
my $alu = shift; my $alu = shift;
return $alu->_ps_status( 1 ); return $alu->_ps_status(1);
} }
# The interface description contains the software version, so # The interface description contains the software version, so
@@ -211,6 +211,7 @@ sub bp_index {
my $partial = shift; my $partial = shift;
my $bp_index = $alu->SUPER::bp_index($partial); my $bp_index = $alu->SUPER::bp_index($partial);
# #
# This device sometimes reports an ifIndex and sometimes reports # This device sometimes reports an ifIndex and sometimes reports
# dot1dBasePort for the dot1d port values - e.g., # dot1dBasePort for the dot1d port values - e.g.,
@@ -222,22 +223,24 @@ sub bp_index {
# the ifIndex and dot1dBasePort spaces don't overlap, at least for # the ifIndex and dot1dBasePort spaces don't overlap, at least for
# the ports we care about. # the ports we care about.
my @keys = keys %$bp_index; my @keys = keys %$bp_index;
foreach my $idx (@keys){ foreach my $idx (@keys) {
my $ifIndex = $bp_index->{$idx}; my $ifIndex = $bp_index->{$idx};
$bp_index->{$ifIndex} = $ifIndex; $bp_index->{$ifIndex} = $ifIndex;
} }
# #
# In addition, aggregates aren't reported at all in bp_index. # In addition, aggregates aren't reported at all in bp_index.
# We grab them from i_index. # We grab them from i_index.
my $i_index = $alu->i_index(); my $i_index = $alu->i_index();
foreach my $idx (keys %$i_index) { foreach my $idx ( keys %$i_index ) {
my $ifIndex = $i_index->{$idx}; my $ifIndex = $i_index->{$idx};
if (int($ifIndex) > 40000001) { if ( int($ifIndex) > 40000001 ) {
$bp_index->{$ifIndex} = $ifIndex; $bp_index->{$ifIndex} = $ifIndex;
# dot1dTpFdbPort seems to use 4098, 4099, 4100 for # dot1dTpFdbPort seems to use 4098, 4099, 4100 for
# 40000001, 40000002, 40000003. I guess this is # 40000001, 40000002, 40000003. I guess this is
# 4096 + 1 + aggregate number. # 4096 + 1 + aggregate number.
my $tmp = sprintf("%d", int($ifIndex) - 39995903); my $tmp = sprintf( "%d", int($ifIndex) - 39995903 );
$bp_index->{$tmp} = $ifIndex; $bp_index->{$tmp} = $ifIndex;
} }
} }
@@ -339,9 +342,9 @@ sub peth_port_ifindex {
my $peth_port_status = $alu->peth_port_status($partial); my $peth_port_status = $alu->peth_port_status($partial);
my $peth_port_ifindex = {}; my $peth_port_ifindex = {};
foreach my $key (keys %$peth_port_status) { foreach my $key ( keys %$peth_port_status ) {
my @oid = split( m/\./, $key ); my @oid = split( m/\./, $key );
$peth_port_ifindex->{$key} = int($oid[0]) * 1000 + int($oid[1]); $peth_port_ifindex->{$key} = int( $oid[0] ) * 1000 + int( $oid[1] );
} }
return $peth_port_ifindex; return $peth_port_ifindex;
} }

View File

@@ -42,22 +42,13 @@ use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/;
$VERSION = '1.09'; $VERSION = '1.09';
%MIBS = ( %MIBS = ( %SNMP::Info::Layer3::MIBS, 'TIMETRA-GLOBAL-MIB' => 'timetraReg', );
%SNMP::Info::Layer3::MIBS,
'TIMETRA-GLOBAL-MIB' => 'timetraReg',
);
%GLOBALS = ( %GLOBALS = ( %SNMP::Info::Layer3::GLOBALS, );
%SNMP::Info::Layer3::GLOBALS,
);
%FUNCS = ( %FUNCS = ( %SNMP::Info::Layer3::FUNCS, );
%SNMP::Info::Layer3::FUNCS,
);
%MUNGE = ( %MUNGE = ( %SNMP::Info::Layer3::MUNGE, );
%SNMP::Info::Layer3::MUNGE,
);
sub model { sub model {
my $timetra = shift; my $timetra = shift;
@@ -83,7 +74,7 @@ sub os_ver {
my $timetra = shift; my $timetra = shift;
my $descr = $timetra->description(); my $descr = $timetra->description();
if ($descr =~ m/^TiMOS-(\S+)/) { if ( $descr =~ m/^TiMOS-(\S+)/ ) {
return $1; return $1;
} }