still trying to get interfaces() right for l2/*

This commit is contained in:
Max Baker
2005-02-18 18:32:41 +00:00
parent 7a023554eb
commit 258b7551ff
3 changed files with 30 additions and 12 deletions

View File

@@ -140,26 +140,18 @@ sub i_ignore {
return \%i_ignore; return \%i_ignore;
} }
# By Default we'll use the description field
sub interfaces { sub interfaces {
my $l2 = shift; my $l2 = shift;
my $interfaces = $l2->i_index(); my $interfaces = $l2->i_index();
my $i_descr = $l2->i_description(); my $i_descr = $l2->i_description();
#my $i_name = $l2->i_name();
my %if; # Replace the Index with the ifDescr field.
foreach my $iid (keys %$interfaces){ foreach my $iid (keys %$i_descr){
my $port = $i_descr->{$iid}; my $port = $i_descr->{$iid};
# what device was this good for? bad idea.
#my $name = $i_name->{$iid};
#$port = $name if (defined $name and $name !~ /^\s*$/);
next unless defined $port; next unless defined $port;
$interfaces->{$iid} = $port;
$if{$iid} = $port;
} }
return \%if return $interfaces;
} }
1; 1;

View File

@@ -77,6 +77,14 @@ use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %MUNGE $INIT/ ;
%SNMP::Info::CiscoStats::MUNGE, %SNMP::Info::CiscoStats::MUNGE,
); );
# Need to specify this or it might grab the ones out of L2 instead of CiscoStack
*SNMP::Info::Layer2::Catalyst::serial = \&SNMP::Info::CiscoStack::serial;
*SNMP::Info::Layer2::Catalyst::interfaces = \&SNMP::Info::CiscoStack::interfaces;
*SNMP::Info::Layer2::Catalyst::i_duplex = \&SNMP::Info::CiscoStack::i_duplex;
*SNMP::Info::Layer2::Catalyst::i_type = \&SNMP::Info::CiscoStack::i_type;
*SNMP::Info::Layer2::Catalyst::i_name = \&SNMP::Info::CiscoStack::i_name;
*SNMP::Info::Layer2::Catalyst::i_duplex_admin = \&SNMP::Info::CiscoStack::i_duplex_admin;
# Overidden Methods # Overidden Methods
# i_physical sets a hash entry as true if the iid is a physical port # i_physical sets a hash entry as true if the iid is a physical port

View File

@@ -158,6 +158,24 @@ sub serial {
return $foundry->SUPER::serial(); return $foundry->SUPER::serial();
} }
sub interfaces {
my $foundry = shift;
my $i_descr = $foundry->i_description;
my $i_name = $foundry->i_name;
# use ifName only if it is in portn
# format. For EdgeIrons
# else use ifDescr
foreach my $iid (keys %$i_name){
my $name = $i_name->{$iid};
next unless defined $name;
$i_descr->{$iid} = $name
if $name =~ /^port\d+/i;
}
return $i_descr;
}
sub i_ignore { sub i_ignore {
my $foundry = shift; my $foundry = shift;
my $i_type = $foundry->i_type(); my $i_type = $foundry->i_type();