added generic L2::Cisco class and fixed warnings in CiscoStack

This commit is contained in:
Max Baker
2006-06-20 03:58:10 +00:00
parent af5d1d6c03
commit ddca296e2a
3 changed files with 28 additions and 14 deletions

View File

@@ -4,7 +4,9 @@ ChangeLog $Id$
version 1.04 version 1.04
+ Added C1130 and C1240 to L2::Aironet (Ralf Gross) + Added C1130 and C1240 to L2::Aironet (Ralf Gross)
+ Added detection for Cisco 2960. + Added detection for Cisco 2960.
+ Added generic L2::Cisco Class
* Corrected detection for Cisco Supervisor Engine 2 and 32 (IOS). * Corrected detection for Cisco Supervisor Engine 2 and 32 (IOS).
* Fixed warnings in CiscoStack
version 1.03 (04/14/06) - Beta/developer release version 1.03 (04/14/06) - Beta/developer release
* Use ipNetToMedia table instead of atTable for ARP * Use ipNetToMedia table instead of atTable for ARP

11
Info.pm
View File

@@ -38,7 +38,7 @@ and was orginally written by Max Baker.
Currently being maintained by team of Open Source authors headed by Eric Miller Currently being maintained by team of Open Source authors headed by Eric Miller
and Bill Fenner. and Bill Fenner.
=head1 SYNOPSIS =head1 SYNOPSIS
use SNMP::Info; use SNMP::Info;
@@ -372,6 +372,11 @@ does not support everything that has the name Catalyst.
Subclass for Nortel/Bay Centillion and 5000BH ATM switches. Subclass for Nortel/Bay Centillion and 5000BH ATM switches.
=item SNMP::Info::Layer2::Cisco
Generic Cisco subclass for layer2 devices that are not yet supported
in more specific subclasses.
=item SNMP::Info::Layer2::Foundry =item SNMP::Info::Layer2::Foundry
Subclass for Foundry Switches. Tested on EdgeIron 24G. Subclass for Foundry Switches. Tested on EdgeIron 24G.
@@ -815,6 +820,7 @@ Algorithm for Subclass Detection:
Catalyst 2970 -> SNMP::Info::Layer3::C6500 Catalyst 2970 -> SNMP::Info::Layer3::C6500
Catalyst 3550/3548 -> SNMP::Info::Layer3::C3550 Catalyst 3550/3548 -> SNMP::Info::Layer3::C3550
Catalyst WS-C 2926,5xxx -> SNMP::Info::Layer2::Catalyst Catalyst WS-C 2926,5xxx -> SNMP::Info::Layer2::Catalyst
Cisco (not covered by above) -> SNMP::Info::Layer2::Cisco
Extreme -> SNMP::Info::Layer3::Extreme Extreme -> SNMP::Info::Layer3::Extreme
Foundry (EdgeIron,????) -> SNMP::Info::Layer2::Foundry Foundry (EdgeIron,????) -> SNMP::Info::Layer2::Foundry
HP Procurve -> SNMP::Info::Layer2::HP HP Procurve -> SNMP::Info::Layer2::HP
@@ -954,6 +960,9 @@ sub device_type {
#Nortel 2270 #Nortel 2270
$objtype = 'SNMP::Info::Layer2::N2270' if ($desc =~ /Nortel\s+(Networks\s+)??WLAN\s+-\s+Security\s+Switch/) ; $objtype = 'SNMP::Info::Layer2::N2270' if ($desc =~ /Nortel\s+(Networks\s+)??WLAN\s+-\s+Security\s+Switch/) ;
# Default generic cisco
$objtype = 'SNMP::Info::Layer2::Cisco' if ($objtype eq 'SNMP::Info::Layer2' and $desc =~ /\bCisco\b/);
} elsif ($info->has_layer(1)) { } elsif ($info->has_layer(1)) {
$objtype = 'SNMP::Info::Layer1'; $objtype = 'SNMP::Info::Layer1';
# Allied crap-o-hub # Allied crap-o-hub

View File

@@ -1,7 +1,7 @@
# SNMP::Info::CiscoStack # SNMP::Info::CiscoStack
# Max Baker # Max Baker
# #
# Copyright (c)2003,2004 Max Baker # Copyright (c)2003,2004,2006 Max Baker
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@@ -170,15 +170,16 @@ sub serial {
sub i_type { sub i_type {
my $stack = shift; my $stack = shift;
my $p_port = $stack->p_port(); my $p_port = $stack->p_port() || {};
my $p_type = $stack->p_type(); my $p_type = $stack->p_type() || {};
# Get more generic port types from IF-MIB # Get more generic port types from IF-MIB
my $i_type = $stack->i_type2(); my $i_type = $stack->i_type2() || {};
# Now Override w/ port entries # Now Override w/ port entries
foreach my $port (keys %$p_type) { foreach my $port (keys %$p_type) {
my $iid = $p_port->{$port}; my $iid = $p_port->{$port};
next unless defined $iid;
$i_type->{$iid} = $p_type->{$port}; $i_type->{$iid} = $p_type->{$port};
} }
@@ -190,8 +191,8 @@ sub i_type {
sub i_name { sub i_name {
my $stack = shift; my $stack = shift;
my $p_port = $stack->p_port(); my $p_port = $stack->p_port() || {};
my $p_name = $stack->p_name(); my $p_name = $stack->p_name() || {};
my %i_name; my %i_name;
foreach my $port (keys %$p_name) { foreach my $port (keys %$p_name) {
@@ -206,12 +207,13 @@ sub i_duplex {
my $stack = shift; my $stack = shift;
#my $i_duplex = $stack->SUPER::i_duplex(); #my $i_duplex = $stack->SUPER::i_duplex();
my $p_port = $stack->p_port(); my $p_port = $stack->p_port() || {};
my $p_duplex = $stack->p_duplex(); my $p_duplex = $stack->p_duplex() || {};
my $i_duplex = {}; my $i_duplex = {};
foreach my $port (keys %$p_duplex) { foreach my $port (keys %$p_duplex) {
my $iid = $p_port->{$port}; my $iid = $p_port->{$port};
next unless defined $iid;
$i_duplex->{$iid} = $p_duplex->{$port}; $i_duplex->{$iid} = $p_duplex->{$port};
} }
return $i_duplex; return $i_duplex;
@@ -220,8 +222,8 @@ sub i_duplex {
sub i_duplex_admin { sub i_duplex_admin {
my $stack = shift; my $stack = shift;
my $p_port = $stack->p_port(); my $p_port = $stack->p_port() || {};
my $p_duplex_admin = $stack->p_duplex_admin(); my $p_duplex_admin = $stack->p_duplex_admin() || {};
my %i_duplex_admin; my %i_duplex_admin;
foreach my $port (keys %$p_duplex_admin) { foreach my $port (keys %$p_duplex_admin) {
@@ -250,7 +252,7 @@ sub set_i_speed_admin {
my $stack = shift; my $stack = shift;
my ($speed, $iid) = @_; my ($speed, $iid) = @_;
my $p_port = $stack->p_port(); my $p_port = $stack->p_port() || {};
my %reverse_p_port = reverse %$p_port; my %reverse_p_port = reverse %$p_port;
$speed = lc($speed); $speed = lc($speed);
@@ -268,7 +270,7 @@ sub set_i_duplex_admin {
my $stack = shift; my $stack = shift;
my ($duplex, $iid) = @_; my ($duplex, $iid) = @_;
my $p_port = $stack->p_port(); my $p_port = $stack->p_port() || {};
my %reverse_p_port = reverse %$p_port; my %reverse_p_port = reverse %$p_port;
$duplex = lc($duplex); $duplex = lc($duplex);
@@ -285,11 +287,12 @@ sub set_i_duplex_admin {
sub interfaces { sub interfaces {
my $self = shift; my $self = shift;
my $i_index = $self->i_index(); my $i_index = $self->i_index();
my $portnames = $self->p_port(); my $portnames = $self->p_port() || {};
my %portmap = reverse %$portnames; my %portmap = reverse %$portnames;
my %interfaces = (); my %interfaces = ();
foreach my $iid (keys %$i_index) { foreach my $iid (keys %$i_index) {
next unless defined $iid;
my $if = $i_index->{$iid}; my $if = $i_index->{$iid};
my $port = $portmap{$iid}; my $port = $portmap{$iid};
$interfaces{$iid} = $port || $if; $interfaces{$iid} = $port || $if;