package pf::SNMP::Cisco::Catalyst_4500_20port_supervisor; =head1 NAME pf::SNMP::Cisco::Catalyst_4500_20port_supervisor - Object oriented module to access SNMP enabled Cisco Catalyst 4500 switches =head1 SYNOPSIS The pf::SNMP::Cisco::Catalyst_4500_20port_supervisor module implements an object oriented interface to access SNMP enabled Cisco::Catalyst_4500_20port_supervisor switches. This modules extends pf::SNMP::Cisco::Catalyst_2950 =head1 BUGS AND LIMITATIONS This module was developped with the slot1 used by the supervisor and other slots holding 48 port cards only. If anything else is to be added please contact an Inverse certified engineer. ;) =cut use strict; use warnings; use diagnostics; use Log::Log4perl; use Net::SNMP; use base ('pf::SNMP::Cisco::Catalyst_4500'); use constant SUPERVISOR_PORTS => 21; # capabilities sub supportsMacAuthBypass { return $TRUE; } sub supportsWiredDot1x { return $TRUE; } # TODO: a 4500 module should be created which does the translation and the value of the number of ports in the supervisor would be # hardocoded in a per-switch-module basis sub NasPortToIfIndex { my ($this, $NAS_port) = @_; my $logger = Log::Log4perl::get_logger(ref($this)); if ($NAS_port =~ /^(\d{3})\d{2}$/) { # Translation is tricky for this router because ifIndex are automatically incremented based on # the slot configuration. # Here's an example: # NAS port is 50223 for Gi2/1. # Remove 50200: 23 # Then add 48 multipled by slot # (502 being slot 0): so 23 + (48 * 0) = 23 # Then add 21 (number of ports in the supervisor slot #1): 23 + 21 = 44 # NAS port 50223 is ifIndex 44 # Remove 50x00. my $ifIndex = $NAS_port - ($1."00"); # Add 48 multipled by slot # (502 being slot 0) $ifIndex = $ifIndex + (48 * ($1-502)); # Add number of supervisor ports $ifIndex = $ifIndex + SUPERVISOR_PORTS; return $ifIndex; } else { $logger->warn("Unknown NAS-Port format. ifIndex translation could have failed. " ."VLAN re-assignment and switch/port accounting will be affected."); } return $NAS_port; } # TODO: hacked for the proof of concept, will need to be working with more than 3 modules sub getSlotNumber { my ($this, $ifIndex, $connection_type) = @_; # ifIndex of slot #3 starts with 70 if ($ifIndex > 69) { return 3; } elsif ($ifIndex > 21) { return 2; } else { return 1; } } =head1 AUTHOR Olivier Bilodeau =head1 COPYRIGHT Copyright (C) 2010 Inverse inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. =cut 1; # vim: set shiftwidth=4: # vim: set expandtab: # vim: set backspace=indent,eol,start: