Add support for D-Link and the IBM BladeCenter Gigabit Ethernet Switch Module, since D-Link uses RADLAN MIB as well.

This commit is contained in:
Eric Miller
2007-12-07 04:09:47 +00:00
parent fed85592cb
commit 98e6693525

View File

@@ -103,28 +103,31 @@ $VERSION = '1.07';
# Method OverRides # Method OverRides
sub bulkwalk_no { 1; }
sub model { sub model {
my $dell = shift; my $dell = shift;
my $name = $dell->dell_id_name(); my $name = $dell->dell_id_name();
my $descr = $dell->description();
if ($name =~ m/(\d+)/){ if (defined $name and $name =~ m/(\d+)/){
return $1; return $1;
} }
# Don't have a vendor MIB for D-Link
return undef; else {
return $descr;
}
} }
sub vendor { sub vendor {
my $dell = shift;
return 'dell'; return $dell->_vendor();
} }
sub os { sub os {
my $dell = shift;
return 'dell'; return $dell->_vendor();
} }
sub serial { sub serial {
@@ -138,26 +141,26 @@ sub serial {
next; next;
} }
return undef; # Last resort
return $dell->SUPER::serial();
} }
# Descriptions are all the same, so use name instead
sub interfaces { sub interfaces {
my $dell = shift; my $dell = shift;
my $partial = shift; my $partial = shift;
my $interfaces = $dell->i_index($partial) || {}; my $i_descr = $dell->i_description($partial) || {};
my $names = $dell->orig_i_name($partial) || {}; my $i_name = $dell->i_name($partial) || {};
my %interfaces = (); # Descriptions are all the same on some Dells, so use name instead if
foreach my $iid (keys %$interfaces){ # available
my $name = $names->{$iid}; foreach my $iid (keys %$i_name){
my $name = $i_name->{$iid};
next unless defined $name; next unless defined $name;
$i_descr->{$iid} = $name;
$interfaces{$iid} = $name;
} }
return \%interfaces; return $i_descr;
} }
sub i_duplex_admin { sub i_duplex_admin {
@@ -182,19 +185,42 @@ sub i_duplex_admin {
return \%i_duplex_admin; return \%i_duplex_admin;
} }
# Normal BRIDGE-MIB not working? Use Q-BRIDGE-MIB for macsuck # Use same methods as netgear. Some device didn't implement the bridge MIB
# forwarding table and some don't return MACs for VLANs other than default yet
# don't support community indexing, so we use the Q-BRIDGE-MIB forwarding
# table. Fall back to the orig functions if the qb versions don't
# return anything.
sub fw_mac { sub fw_mac {
my $dell = shift; my $dell = shift;
my $partial = shift; my $ret = $dell->qb_fw_mac();
$ret = $dell->orig_fw_mac() if (!defined($ret));
return $dell->qb_fw_mac($partial); return $ret;
} }
sub fw_port { sub fw_port {
my $dell = shift; my $dell = shift;
my $partial = shift; my $ret = $dell->qb_fw_port();
$ret = $dell->orig_fw_port() if (!defined($ret));
return $ret;
}
return $dell->qb_fw_port($partial); sub _vendor {
my $dell = shift;
my $id = $dell->id() || 'undef';
my %oidmap = (
2 => 'ibm',
171 => 'dlink',
674 => 'dell',
);
$id = $1 if (defined($id) && $id =~ /^\.1\.3\.6\.1\.4\.1\.(\d+)/);
if (defined($id) and exists($oidmap{$id})) {
return $oidmap{$id};
}
else {
return 'dlink';
}
} }
1; 1;
@@ -228,7 +254,8 @@ Eric Miller
=head1 DESCRIPTION =head1 DESCRIPTION
Provides abstraction to the configuration information obtainable from an Provides abstraction to the configuration information obtainable from an
Dell Power Connect device through SNMP. Dell Power Connect device through SNMP. D-Link and the IBM BladeCenter
Gigabit Ethernet Switch Module also use this module based upon MIB support.
For speed or debugging purposes you can call the subclass directly, but not For speed or debugging purposes you can call the subclass directly, but not
after determining a more specific class using the method above. after determining a more specific class using the method above.
@@ -277,15 +304,18 @@ These are methods that return scalar value from SNMP
=item $dell->model() =item $dell->model()
Returns model type. Returns numeric from (B<productIdentificationDisplayName>). Returns model type. Returns numeric from (B<productIdentificationDisplayName>)
if available, otherwise if returns description().
=item $dell->vendor() =item $dell->vendor()
Returns dell Returns 'dell', 'dlink', or 'ibm' based upon the IANA enterprise number in
id(). Defaults to 'dlink'.
=item $dell->os() =item $dell->os()
Returns dell Returns 'dell', 'dlink', or 'ibm' based upon the IANA enterprise number in
id(). Defaults to 'dlink'.
=back =back
@@ -293,13 +323,10 @@ Returns dell
=over =over
=item $dell->bulkwalk_no
Return C<1>. Bulkwalk is currently turned off for this class.
=item $dell->serial() =item $dell->serial()
Returns serial number. (B<rlPhdUnitGenParamSerialNum>) Returns serial number. Returns (B<rlPhdUnitGenParamSerialNum>) if available,
otherwise uses the Layer3 serial method.
=back =back
@@ -357,9 +384,8 @@ to a hash.
=item $dell->interfaces() =item $dell->interfaces()
Returns the map between SNMP Interface Identifier (iid) and physical port name. Returns the map between SNMP Interface Identifier (iid) and physical port name.
Uses name instead of description since descriptions are not unique. Uses name if available instead of description since descriptions are
sometimes not unique.
Only returns those iids that have a name listed in $l3->i_name()
=item $dell->i_duplex_admin() =item $dell->i_duplex_admin()