migrate from EUMM to Module::Build
This commit is contained in:
397
lib/SNMP/Info/Layer3/Aironet.pm
Normal file
397
lib/SNMP/Info/Layer3/Aironet.pm
Normal file
@@ -0,0 +1,397 @@
|
||||
# SNMP::Info::Layer3::Aironet
|
||||
# $Id$
|
||||
#
|
||||
# Copyright (c) 2008 Max Baker changes from version 0.8 and beyond.
|
||||
#
|
||||
# Copyright (c) 2002,2003 Regents of the University of California
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the University of California, Santa Cruz nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer3::Aironet;
|
||||
|
||||
use strict;
|
||||
use Exporter;
|
||||
use SNMP::Info::Layer3;
|
||||
|
||||
@SNMP::Info::Layer3::Aironet::ISA = qw/SNMP::Info::Layer3 Exporter/;
|
||||
@SNMP::Info::Layer3::Aironet::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %MIBS %FUNCS %GLOBALS %MUNGE/;
|
||||
|
||||
$VERSION = '3.35';
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer3::MIBS,
|
||||
'AWCVX-MIB' => 'awcIfTable',
|
||||
'IEEE802dot11-MIB' => 'dot11StationID',
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer3::GLOBALS,
|
||||
'mac' => 'dot11StationID.2',
|
||||
|
||||
# AWC Ethernet Table
|
||||
'awc_duplex' => 'awcEtherDuplex.0',
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer3::FUNCS,
|
||||
'i_mac2' => 'ifPhysAddress',
|
||||
'i_mtu2' => 'ifMtu',
|
||||
'i_ssid' => 'dot11DesiredSSID',
|
||||
|
||||
# Bridge-mib overrides
|
||||
'fw_mac2' => 'dot1dTpFdbAddress',
|
||||
'fw_port2' => 'dot1dTpFdbPort',
|
||||
'bp_index2' => 'dot1dBasePortIfIndex',
|
||||
|
||||
# AWC Interface Table (awcIfTable)
|
||||
'awc_default_mac' => 'awcIfDefaultPhyAddress',
|
||||
'awc_mac' => 'awcIfPhyAddress',
|
||||
'awc_ip' => 'awcIfIpAddress',
|
||||
'awc_netmask' => 'awcIfIpNetMask',
|
||||
'awc_msdu' => 'awcIfMSDUMaxLength',
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
|
||||
# Inherit all the built in munging
|
||||
%SNMP::Info::Layer3::MUNGE,
|
||||
'i_mac2' => \&SNMP::Info::munge_mac,
|
||||
'awc_mac' => \&SNMP::Info::munge_mac,
|
||||
'fw_mac2' => \&SNMP::Info::munge_mac,
|
||||
);
|
||||
|
||||
sub os {
|
||||
return 'aironet';
|
||||
}
|
||||
|
||||
sub os_ver {
|
||||
my $aironet = shift;
|
||||
my $descr = $aironet->description() || '';
|
||||
|
||||
# CAP340 11.21, AP4800-E 11.21
|
||||
if ( $descr =~ /AP\d{3,4}(-\D+)?\s+(\d{2}\.\d{2})/ ) {
|
||||
return $2;
|
||||
}
|
||||
|
||||
if ( $descr =~ /Series\s*AP\s+(\d{2}\.\d{2})/ ) {
|
||||
return $1;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
# Override wireless port with static info
|
||||
sub bp_index {
|
||||
my $aironet = shift;
|
||||
my $interfaces = $aironet->interfaces();
|
||||
my $bp_index = $aironet->bp_index2();
|
||||
|
||||
foreach my $iid ( keys %$interfaces ) {
|
||||
my $port = $interfaces->{$iid};
|
||||
|
||||
# Hardwire the wireless port to the transparent bridge port
|
||||
if ( $port =~ /awc/ ) {
|
||||
$bp_index->{0} = $iid;
|
||||
}
|
||||
}
|
||||
|
||||
return $bp_index;
|
||||
}
|
||||
|
||||
# Add the static table to the forwarding table
|
||||
sub fw_mac {
|
||||
my $aironet = shift;
|
||||
my $fw_mac = $aironet->fw_mac2();
|
||||
my $fw_port = $aironet->fw_port2();
|
||||
my $bs_mac = $aironet->bs_mac();
|
||||
|
||||
# remove port 0 forwarding table entries, only port 0 static entries
|
||||
foreach my $fw ( keys %$fw_mac ) {
|
||||
my $port = $fw_port->{$fw};
|
||||
next unless defined $port;
|
||||
delete $fw_mac->{$fw} if $port == 0;
|
||||
}
|
||||
|
||||
foreach my $bs ( keys %$bs_mac ) {
|
||||
my $entry = $bs;
|
||||
$entry =~ s/\.0$//;
|
||||
$fw_mac->{$entry} = $bs_mac->{$bs};
|
||||
}
|
||||
|
||||
return $fw_mac;
|
||||
}
|
||||
|
||||
# Add the static table to the forwarding table
|
||||
sub fw_port {
|
||||
my $aironet = shift;
|
||||
my $fw_port = $aironet->fw_port2();
|
||||
my $bs_port = $aironet->bs_port();
|
||||
|
||||
foreach my $bs ( keys %$bs_port ) {
|
||||
my $entry = $bs;
|
||||
$entry =~ s/\.0$//;
|
||||
$fw_port->{$entry} = $bs_port->{$bs};
|
||||
}
|
||||
|
||||
return $fw_port;
|
||||
}
|
||||
|
||||
sub i_duplex {
|
||||
my $aironet = shift;
|
||||
my $interfaces = $aironet->interfaces();
|
||||
my $awc_duplex = $aironet->awc_duplex();
|
||||
|
||||
my %i_duplex;
|
||||
|
||||
foreach my $iid ( keys %$interfaces ) {
|
||||
my $name = $interfaces->{$iid};
|
||||
|
||||
if ( $name =~ /fec/ ) {
|
||||
$i_duplex{$iid} = $awc_duplex;
|
||||
}
|
||||
}
|
||||
|
||||
return \%i_duplex;
|
||||
}
|
||||
|
||||
sub i_mac {
|
||||
my $aironet = shift;
|
||||
|
||||
my $i_mac = $aironet->i_mac2();
|
||||
my $awc_mac = $aironet->awc_mac();
|
||||
|
||||
foreach my $iid ( keys %$awc_mac ) {
|
||||
next unless defined $i_mac->{$iid};
|
||||
$i_mac->{$iid} = $awc_mac->{$iid};
|
||||
}
|
||||
|
||||
return $i_mac;
|
||||
}
|
||||
|
||||
sub i_ignore {
|
||||
my $aironet = shift;
|
||||
my $interfaces = $aironet->interfaces();
|
||||
|
||||
my %i_ignore;
|
||||
foreach my $if ( keys %$interfaces ) {
|
||||
$i_ignore{$if}++ if ( $interfaces->{$if} =~ /(rptr|lo)/ );
|
||||
}
|
||||
|
||||
return \%i_ignore;
|
||||
}
|
||||
|
||||
sub vendor {
|
||||
return 'cisco';
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer3::Aironet - Perl5 Interface to Cisco Aironet Wireless
|
||||
Devices running Aironet software, not IOS
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Max Baker
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $aironet = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
DestHost => 'myswitch',
|
||||
Community => 'public',
|
||||
Version => 2
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $aironet->class();
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
SNMP::Info subclass to provide access to SNMP data for an Aironet device
|
||||
running Aironet software, not cisco IOS.
|
||||
|
||||
Note there are two classes for Aironet devices :
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info::Layer3::Aironet
|
||||
|
||||
This class is for devices running Aironet software (older)
|
||||
|
||||
=item SNMP::Info::Layer2::Aironet
|
||||
|
||||
This class is for devices running Cisco IOS software (newer)
|
||||
|
||||
=back
|
||||
|
||||
For speed or debugging purposes you can call the subclass directly, but not
|
||||
after determining a more specific class using the method above.
|
||||
|
||||
my $aironet = new SNMP::Info::Layer3::Aironet(...);
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info::Layer3
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item F<AWCVX-MIB>
|
||||
|
||||
=item F<IEEE802dot11-MIB>
|
||||
|
||||
=back
|
||||
|
||||
These MIBs are now included in the v2.tar.gz archive available from
|
||||
ftp.cisco.com. Make sure you have a current version.
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar value from SNMP
|
||||
|
||||
=over
|
||||
|
||||
=item $aironet->awc_duplex()
|
||||
|
||||
Gives the admin duplex setting for the Ethernet Port.
|
||||
|
||||
C<awcEtherDuplex.0>
|
||||
|
||||
=item $aironet->mac()
|
||||
|
||||
Gives the MAC Address of the wireless side
|
||||
|
||||
C<dot11StationID.2>
|
||||
|
||||
=item $aironet->os()
|
||||
|
||||
'aironet'
|
||||
|
||||
=item $aironet->os_ver
|
||||
|
||||
Tries to cull the version from the description field.
|
||||
|
||||
=item $aironet->vendor()
|
||||
|
||||
Returns 'cisco'.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Globals imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"GLOBALS"> for details.
|
||||
|
||||
=head1 TABLE METHODS
|
||||
|
||||
These are methods that return tables of information in the form of a reference
|
||||
to a hash.
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=over
|
||||
|
||||
=item $aironet->bp_index()
|
||||
|
||||
Takes the bp_index() value from SNMP::Info::Bridge and overrides the wireless
|
||||
port to be assigned to the transparent bridge port (port 0)
|
||||
|
||||
=item $aironet->fw_mac()
|
||||
|
||||
Adds static table entries from bs_mac() to port 0 so that wireless MAC
|
||||
addresses will be reported. Forwarding table entries for port 0 are removed.
|
||||
|
||||
=item $aironet->fw_port()
|
||||
|
||||
Adds the static table port mappings to the forwarding table port mappings by
|
||||
adding bs_port() to fw_port()
|
||||
|
||||
=item $aironet->i_duplex()
|
||||
|
||||
Adds the value of awc_duplex() to each Ethernet port seen.
|
||||
|
||||
=item $aironet->i_mac()
|
||||
|
||||
Overrides the values for i_mac with the value from awc_mac() if they are set.
|
||||
|
||||
=item $aironet->i_ignore()
|
||||
|
||||
Ignores ports that are of type ``rptr'' and ``lo''.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Aironet specific items
|
||||
|
||||
=over
|
||||
|
||||
=item $aironet->awc_default_mac()
|
||||
|
||||
Gives the default MAC address of each interface.
|
||||
|
||||
C<awcIfDefaultPhyAddress>
|
||||
|
||||
=item $aironet->awc_mac()
|
||||
|
||||
Gives the actual MAC address of each interface.
|
||||
|
||||
C<awcIfPhyAddress>
|
||||
|
||||
=item $aironet->awc_ip()
|
||||
|
||||
Gives the IP Address assigned to each interface.
|
||||
|
||||
C<awcIfIpAddress>
|
||||
|
||||
=item $aironet->awc_netmask()
|
||||
|
||||
Gives the NetMask for each interface.
|
||||
|
||||
C<awcIfIpNetMask>
|
||||
|
||||
=item $aironet->awc_msdu()
|
||||
|
||||
C<awcIfMSDUMaxLength>
|
||||
|
||||
=back
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details.
|
||||
|
||||
=cut
|
||||
466
lib/SNMP/Info/Layer3/AlcatelLucent.pm
Normal file
466
lib/SNMP/Info/Layer3/AlcatelLucent.pm
Normal file
@@ -0,0 +1,466 @@
|
||||
# SNMP::Info::Layer3::AlcatelLucent
|
||||
# $Id$
|
||||
#
|
||||
# Copyright (c) 2008 Bill Fenner
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the University of California, Santa Cruz nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer3::AlcatelLucent;
|
||||
|
||||
use strict;
|
||||
|
||||
use Exporter;
|
||||
use SNMP::Info::Layer3;
|
||||
use SNMP::Info::MAU;
|
||||
use SNMP::Info::AMAP;
|
||||
# Use LLDP
|
||||
# (or at least try. The versions I've seen have two problems:
|
||||
# 1. they report ifIndex values as 'local'; we don't support ifIndex
|
||||
# but *could*
|
||||
# 2. They report 0.0.0.0 as the management address
|
||||
# )
|
||||
use SNMP::Info::LLDP;
|
||||
|
||||
@SNMP::Info::Layer3::AlcatelLucent::ISA = qw/SNMP::Info::AMAP SNMP::Info::LLDP
|
||||
SNMP::Info::MAU SNMP::Info::Layer3 Exporter/;
|
||||
@SNMP::Info::Layer3::AlcatelLucent::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/;
|
||||
|
||||
$VERSION = '3.35';
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer3::MIBS,
|
||||
%SNMP::Info::MAU::MIBS,
|
||||
%SNMP::Info::LLDP::MIBS,
|
||||
%SNMP::Info::AMAP::MIBS,
|
||||
'ALCATEL-IND1-DEVICES' => 'familyOmniSwitch7000',
|
||||
'ALCATEL-IND1-CHASSIS-MIB' => 'chasEntPhysOperStatus',
|
||||
'ALU-POWER-ETHERNET-MIB' => 'pethPsePortDetectionStatus',
|
||||
);
|
||||
|
||||
# Alcatel provides their own version of the POWER-ETHERNET-MIB,
|
||||
# off in vendor-space, without renaming any of the objects.
|
||||
# This means we have to *not* load the POWER-ETHERNET-MIB
|
||||
# but can then still use the standard PowerEthernet module,
|
||||
# but cannot try both so we hope Alcatel doesn't stop supporting
|
||||
# their private version even if they get around to supporting the
|
||||
# standard.
|
||||
delete $MIBS{'POWER-ETHERNET-MIB'};
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer3::GLOBALS, %SNMP::Info::MAU::GLOBALS,
|
||||
%SNMP::Info::LLDP::GLOBALS, %SNMP::Info::AMAP::GLOBALS,
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer3::FUNCS, %SNMP::Info::MAU::FUNCS,
|
||||
%SNMP::Info::LLDP::FUNCS, %SNMP::Info::AMAP::FUNCS,
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
%SNMP::Info::Layer3::MUNGE, %SNMP::Info::MAU::MUNGE,
|
||||
%SNMP::Info::LLDP::MUNGE, %SNMP::Info::AMAP::MUNGE,
|
||||
);
|
||||
|
||||
# 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_speed_admin
|
||||
= \&SNMP::Info::MAU::mau_i_speed_admin;
|
||||
|
||||
sub model {
|
||||
my $alu = shift;
|
||||
my $id = $alu->id();
|
||||
my $model = &SNMP::translateObj($id);
|
||||
|
||||
return $id unless defined $model;
|
||||
|
||||
$model =~ s/^device//;
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
sub os {
|
||||
return 'AOS';
|
||||
}
|
||||
|
||||
sub vendor {
|
||||
return 'alcatel-lucent';
|
||||
}
|
||||
|
||||
sub os_ver {
|
||||
my $alu = shift;
|
||||
|
||||
my $descr = $alu->description();
|
||||
if ( $descr =~ m/^(\S+)/ ) {
|
||||
return $1;
|
||||
}
|
||||
|
||||
# No clue what this will try but hey
|
||||
return $alu->SUPER::os_ver();
|
||||
}
|
||||
|
||||
# ps1_type, ps1_status, ps2_type, ps2_status:
|
||||
# Find the list of power supplies in the ENTITY-MIB
|
||||
# e_class = powerSupply
|
||||
# e_descr = ps_type
|
||||
# chasEntPhysOperStatus = ps_status
|
||||
sub _power_supplies {
|
||||
my $alu = shift;
|
||||
|
||||
my $e_class = $alu->e_class();
|
||||
my @supplies = ();
|
||||
|
||||
foreach my $key ( sort { int($a) cmp int($b) } keys %$e_class ) {
|
||||
if ( $e_class->{$key} eq 'powerSupply' ) {
|
||||
push( @supplies, int($key) );
|
||||
}
|
||||
}
|
||||
return @supplies;
|
||||
}
|
||||
|
||||
sub _ps_type {
|
||||
my $alu = shift;
|
||||
my $psnum = shift;
|
||||
my @ps = $alu->_power_supplies();
|
||||
|
||||
if ( $psnum > $#ps ) {
|
||||
return "none";
|
||||
}
|
||||
my $supply = $ps[$psnum];
|
||||
my $descr = $alu->e_descr($supply);
|
||||
return $descr->{$supply};
|
||||
}
|
||||
|
||||
sub _ps_status {
|
||||
my $alu = shift;
|
||||
my $psnum = shift;
|
||||
my @ps = $alu->_power_supplies();
|
||||
|
||||
if ( $psnum > $#ps ) {
|
||||
return "not present";
|
||||
}
|
||||
my $supply = $ps[$psnum];
|
||||
my $status = $alu->chasEntPhysOperStatus($supply);
|
||||
return $status->{$supply};
|
||||
}
|
||||
|
||||
sub ps1_type {
|
||||
my $alu = shift;
|
||||
return $alu->_ps_type(0);
|
||||
}
|
||||
|
||||
sub ps2_type {
|
||||
my $alu = shift;
|
||||
return $alu->_ps_type(1);
|
||||
}
|
||||
|
||||
sub ps1_status {
|
||||
my $alu = shift;
|
||||
return $alu->_ps_status(0);
|
||||
}
|
||||
|
||||
sub ps2_status {
|
||||
my $alu = shift;
|
||||
return $alu->_ps_status(1);
|
||||
}
|
||||
|
||||
# The interface description contains the software version, so
|
||||
# to avoid losing historical information through a software upgrade
|
||||
# we use interface name instead.
|
||||
sub interfaces {
|
||||
my $alu = shift;
|
||||
my $partial = shift;
|
||||
|
||||
return $alu->orig_i_name($partial);
|
||||
}
|
||||
|
||||
# Work around buggy bp_index in 6.3.1.871.R01 and 6.3.1.975.R01
|
||||
sub bp_index {
|
||||
my $alu = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $bp_index = $alu->SUPER::bp_index($partial);
|
||||
|
||||
#
|
||||
# This device sometimes reports an ifIndex and sometimes reports
|
||||
# dot1dBasePort for the dot1d port values - e.g.,
|
||||
# in 6.3.1.871.R01 both dot1dTpFdbPort and dot1qTpFdbPort report
|
||||
# the ifIndex; in 6.3.1.975.R01 dot1dTpFdbPort has been updated
|
||||
# to report the dot1dBasePort but dot1qTpFdbPort still returns an
|
||||
# ifIndex. For this reason, we augment the dot1dBasePort
|
||||
# mapping with ifIndex->ifIndex mappings -- we can do this because
|
||||
# the ifIndex and dot1dBasePort spaces don't overlap, at least for
|
||||
# the ports we care about.
|
||||
my @keys = keys %$bp_index;
|
||||
foreach my $idx (@keys) {
|
||||
my $ifIndex = $bp_index->{$idx};
|
||||
$bp_index->{$ifIndex} = $ifIndex;
|
||||
}
|
||||
|
||||
#
|
||||
# In addition, aggregates aren't reported at all in bp_index.
|
||||
# We grab them from i_index.
|
||||
my $i_index = $alu->i_index();
|
||||
foreach my $idx ( keys %$i_index ) {
|
||||
my $ifIndex = $i_index->{$idx};
|
||||
if ( int($ifIndex) > 40000001 ) {
|
||||
$bp_index->{$ifIndex} = $ifIndex;
|
||||
|
||||
# dot1dTpFdbPort seems to use 4098, 4099, 4100 for
|
||||
# 40000001, 40000002, 40000003. I guess this is
|
||||
# 4096 + 1 + aggregate number.
|
||||
my $tmp = sprintf( "%d", int($ifIndex) - 39995903 );
|
||||
$bp_index->{$tmp} = $ifIndex;
|
||||
}
|
||||
}
|
||||
return $bp_index;
|
||||
}
|
||||
|
||||
# Workaround for unimplemented Q-BRIDGE-MIB::dot1qPvid
|
||||
# If there is only one VLAN on which a given port is output
|
||||
# untagged, then call that one the PVID. This is a guess that
|
||||
# works in obvious configurations but may be wrong in
|
||||
# subtle cases (like there's one output VLAN but a different
|
||||
# input one - the only way to know that is via the dot1qPvid
|
||||
# object)
|
||||
#
|
||||
# Newer versions have implemented dot1qPvid (but wrong, but
|
||||
# that's just life)
|
||||
#sub i_vlan {
|
||||
# my $alu = shift;
|
||||
#
|
||||
# my $qb_v_untagged = $alu->qb_v_untagged();
|
||||
# my $bp_index = $alu->bp_index();
|
||||
# my $vlan_list = {};
|
||||
# foreach my $vlan (keys %$qb_v_untagged) {
|
||||
# my $portlist = $qb_v_untagged->{$vlan};
|
||||
# my $port;
|
||||
# for ($port = 0; $port <= $#$portlist; $port++) {
|
||||
# if ($portlist->[$port]) {
|
||||
# my $ifindex = $bp_index->{$port + 1};
|
||||
# if ($ifindex) {
|
||||
# push(@{$vlan_list->{$ifindex}}, int($vlan));
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
#
|
||||
# my $i_vlan = {};
|
||||
# foreach my $ifindex (keys %$vlan_list) {
|
||||
# if ($#{$vlan_list->{$ifindex}} == 0) {
|
||||
# $i_vlan->{$ifindex} = ${$vlan_list->{$ifindex}}[0];
|
||||
# }
|
||||
# }
|
||||
# return $i_vlan;
|
||||
#}
|
||||
|
||||
# Power-Ethernet ifIndex mapping. I've only seen this from a
|
||||
# fixed-config single-module system, so this is only a plausible
|
||||
# guess as to the mapping on a stack or modular system.
|
||||
sub peth_port_ifindex {
|
||||
my $alu = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $peth_port_status = $alu->peth_port_status($partial);
|
||||
my $peth_port_ifindex = {};
|
||||
|
||||
foreach my $key ( keys %$peth_port_status ) {
|
||||
my @oid = split( m/\./, $key );
|
||||
$peth_port_ifindex->{$key} = int( $oid[0] ) * 1000 + int( $oid[1] );
|
||||
}
|
||||
return $peth_port_ifindex;
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer3::AlcatelLucent - SNMP Interface to Alcatel-Lucent OmniSwitch
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Bill Fenner
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $alu = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
# These arguments are passed directly to SNMP::Session
|
||||
DestHost => 'myswitch',
|
||||
Community => 'public',
|
||||
Version => 2
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $alu->class();
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Subclass for Alcatel-Lucent OmniSwitch devices
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info::Layer3
|
||||
|
||||
=item SNMP::Info::MAU
|
||||
|
||||
=item SNMP::Info::LLDP
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item F<ALCATEL-IND1-DEVICES>
|
||||
|
||||
=item F<ALCATEL-IND1-CHASSIS-MIB>
|
||||
|
||||
=item F<ALU-POWER-ETHERNET-MIB>
|
||||
|
||||
Note that Alcatel-Lucent distributes their own proprietary version of the
|
||||
F<POWER-ETHERNET-MIB>, but the MIB module name that they distribute is
|
||||
simply F<POWER-ETHERNET-MIB>. This module must be hand-edited to change the
|
||||
module name to F<ALU-POWER-ETHERNET-MIB> so that it can be used simultaneously
|
||||
with the standard F<POWER-ETHERNET-MIB>.
|
||||
|
||||
=item Inherited Classes' MIBs
|
||||
|
||||
See L<SNMP::Info::Layer3/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
See L<SNMP::Info::MAU/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
See L<SNMP::Info::LLDP/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
=back
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar value from SNMP
|
||||
|
||||
=over
|
||||
|
||||
=item $alu->vendor()
|
||||
|
||||
Returns 'alcatel-lucent'
|
||||
|
||||
=item $alu->model()
|
||||
|
||||
Tries to reference $alu->id() to one of the product MIBs listed above
|
||||
|
||||
Removes 'device' from the name for readability.
|
||||
|
||||
=item $alu->os()
|
||||
|
||||
Returns 'AOS'
|
||||
|
||||
=item $alu->os_ver()
|
||||
|
||||
Grabs the os version from C<sysDescr>
|
||||
|
||||
=item $alu->ps1_type()
|
||||
|
||||
Return the type of the first power supply from the F<ENTITY-MIB>
|
||||
|
||||
=item $alu->ps2_type()
|
||||
|
||||
Return the type of the second power supply from the F<ENTITY-MIB>
|
||||
|
||||
=item $alu->ps1_status()
|
||||
|
||||
Return the status of the first power supply from the F<ALCATEL-IND1-CHASSIS-MIB>
|
||||
|
||||
=item $alu->ps2_status()
|
||||
|
||||
Return the status of the second power supply from the F<ALCATEL-IND1-CHASSIS-MIB>
|
||||
|
||||
=back
|
||||
|
||||
=head2 Global Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"GLOBALS"> for details.
|
||||
|
||||
=head2 Global Methods imported from SNMP::Info::MAU
|
||||
|
||||
See documentation in L<SNMP::Info::MAU/"GLOBALS"> for details.
|
||||
|
||||
=head2 Global Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"GLOBALS"> for details.
|
||||
|
||||
=head1 TABLE METHODS
|
||||
|
||||
These are methods that return tables of information in the form of a reference
|
||||
to a hash.
|
||||
|
||||
=over
|
||||
|
||||
=item $alu->interfaces()
|
||||
|
||||
Returns interface name from C<ifName>, since the default return value
|
||||
of C<ifDescr> includes the OS version.
|
||||
|
||||
=item $alu->bp_index()
|
||||
|
||||
Work around various bugs in the F<BRIDGE-MIB> and
|
||||
F<Q-BRIDGE-MIB> implementations, by returning both
|
||||
C<ifIndex> and C<dot1dBasePort> mappings to C<ifIndex> values.
|
||||
|
||||
=item $alu->i_duplex_admin()
|
||||
|
||||
Returns info from F<MAU-MIB>
|
||||
|
||||
=item $alu->i_speed_admin()
|
||||
|
||||
Returns info from F<MAU-MIB>
|
||||
|
||||
=item $alu->peth_port_ifindex()
|
||||
|
||||
Returns the C<ifIndex> value for power-ethernet ports
|
||||
using the OmniSwitch algorithm.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::MAU
|
||||
|
||||
See documentation in L<SNMP::Info::MAU/"TABLE METHODS"> for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::LLDP
|
||||
|
||||
See documentation in L<SNMP::Info::LLDP/"TABLE METHODS"> for details.
|
||||
|
||||
=cut
|
||||
620
lib/SNMP/Info/Layer3/AlteonAD.pm
Normal file
620
lib/SNMP/Info/Layer3/AlteonAD.pm
Normal file
@@ -0,0 +1,620 @@
|
||||
# SNMP::Info::Layer3::AlteonAD
|
||||
# $Id$
|
||||
#
|
||||
# Copyright (c) 2008 Eric Miller
|
||||
# All Rights Reserved
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the University of California, Santa Cruz nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer3::AlteonAD;
|
||||
|
||||
use strict;
|
||||
use Exporter;
|
||||
use SNMP::Info::Layer3;
|
||||
|
||||
@SNMP::Info::Layer3::AlteonAD::ISA = qw/SNMP::Info::Layer3 Exporter/;
|
||||
@SNMP::Info::Layer3::AlteonAD::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/;
|
||||
|
||||
$VERSION = '3.35';
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer3::MIBS,
|
||||
'ALTEON-ROOT-MIB' => 'aceswitch184',
|
||||
'ALTEON-TIGON-SWITCH-MIB' => 'hwPowerSupplyStatus',
|
||||
'ALTEON-CHEETAH-SWITCH-MIB' => 'hwFanStatus',
|
||||
'ALTEON-TS-PHYSICAL-MIB' => 'agPortTableMaxEnt',
|
||||
'ALTEON-CS-PHYSICAL-MIB' => 'vlanCurCfgLearn',
|
||||
'ALTEON-TS-NETWORK-MIB' => 'ripCurCfgSupply',
|
||||
'ALTEON-CHEETAH-NETWORK-MIB' => 'ripCurCfgIntfSupply',
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer3::GLOBALS,
|
||||
'old_sw_ver' => 'ALTEON_TIGON_SWITCH_MIB__agSoftwareVersion',
|
||||
'new_sw_ver' => 'ALTEON_CHEETAH_SWITCH_MIB__agSoftwareVersion',
|
||||
'old_tftp_action' => 'ALTEON_TIGON_SWITCH_MIB__agTftpAction',
|
||||
'new_tftp_action' => 'ALTEON_CHEETAH_SWITCH_MIB__agTftpAction',
|
||||
'old_tftp_host' => 'ALTEON_TIGON_SWITCH_MIB__agTftpServer',
|
||||
'new_tftp_host' => 'ALTEON_CHEETAH_SWITCH_MIB__agTftpServer',
|
||||
'old_tftp_file' => 'ALTEON_TIGON_SWITCH_MIB__agTftpCfgFileName',
|
||||
'new_tftp_file' => 'ALTEON_CHEETAH_SWITCH_MIB__agTftpCfgFileName',
|
||||
'old_tftp_result' => 'ALTEON_TIGON_SWITCH_MIB__agTftpLastActionStatus',
|
||||
'new_tftp_result' => 'ALTEON_CHEETAH_SWITCH_MIB__agTftpLastActionStatus',
|
||||
'old_ip_max' => 'ALTEON_TS_NETWORK_MIB__ipInterfaceTableMax',
|
||||
'new_ip_max' => 'ALTEON_CHEETAH_NETWORK_MIB__ipInterfaceTableMax',
|
||||
'fan' => 'ALTEON_CHEETAH_SWITCH_MIB__hwFanStatus',
|
||||
'old_ps1_stat' => 'ALTEON_TIGON_SWITCH_MIB__hwPowerSupplyStatus',
|
||||
'old_ps2_stat' => 'ALTEON_TIGON_SWITCH_MIB__hwRedundantPSStatus',
|
||||
'new_ps_stat' => 'ALTEON_CHEETAH_SWITCH_MIB__hwPowerSupplyStatus',
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer3::FUNCS,
|
||||
|
||||
# From agPortCurCfgTable
|
||||
'old_ag_p_cfg_idx' => 'ALTEON_TS_PHYSICAL_MIB__agPortCurCfgIndx',
|
||||
'new_ag_p_cfg_idx' => 'ALTEON_CHEETAH_SWITCH_MIB__agPortCurCfgIndx',
|
||||
'old_ag_p_cfg_pref' => 'agPortCurCfgPrefLink',
|
||||
'new_ag_p_cfg_pref' => 'agPortCurCfgPreferred',
|
||||
'old_ag_p_cfg_pvid' => 'ALTEON_TS_PHYSICAL_MIB__agPortCurCfgPVID',
|
||||
'new_ag_p_cfg_pvid' => 'ALTEON_CHEETAH_SWITCH_MIB__agPortCurCfgPVID',
|
||||
'old_ag_p_cfg_fe_auto' =>
|
||||
'ALTEON_TS_PHYSICAL_MIB__agPortCurCfgFastEthAutoNeg',
|
||||
'new_ag_p_cfg_fe_auto' =>
|
||||
'ALTEON_CHEETAH_SWITCH_MIB__agPortCurCfgFastEthAutoNeg',
|
||||
'old_ag_p_cfg_fe_mode' =>
|
||||
'ALTEON_TS_PHYSICAL_MIB__agPortCurCfgFastEthMode',
|
||||
'new_ag_p_cfg_fe_mode' =>
|
||||
'ALTEON_CHEETAH_SWITCH_MIB__agPortCurCfgFastEthMode',
|
||||
'old_ag_p_cfg_ge_auto' =>
|
||||
'ALTEON_TS_PHYSICAL_MIB__agPortCurCfgGigEthAutoNeg',
|
||||
'new_ag_p_cfg_ge_auto' =>
|
||||
'ALTEON_CHEETAH_SWITCH_MIB__agPortCurCfgGigEthAutoNeg',
|
||||
'old_ag_p_cfg_name' => 'ALTEON_TS_PHYSICAL_MIB__agPortCurCfgPortName',
|
||||
'new_ag_p_cfg_name' => 'ALTEON_CHEETAH_SWITCH_MIB__agPortCurCfgPortName',
|
||||
|
||||
# From portInfoTable
|
||||
'old_p_info_idx' => 'ALTEON_TS_PHYSICAL_MIB__portInfoIndx',
|
||||
'new_p_info_idx' => 'ALTEON_CHEETAH_SWITCH_MIB__portInfoIndx',
|
||||
'old_p_info_mode' => 'ALTEON_TS_PHYSICAL_MIB__portInfoMode',
|
||||
'new_p_info_mode' => 'ALTEON_CHEETAH_SWITCH_MIB__portInfoMode',
|
||||
|
||||
# From ipCurCfgIntfTable
|
||||
'old_ip_cfg_vlan' => 'ALTEON_TS_NETWORK_MIB__ipCurCfgIntfVlan',
|
||||
'new_ip_cfg_vlan' => 'ALTEON_CHEETAH_NETWORK_MIB__ipCurCfgIntfVlan',
|
||||
|
||||
# From vlanCurCfgTable
|
||||
'old_vlan_id' => 'ALTEON_TS_PHYSICAL_MIB__vlanCurCfgVlanId',
|
||||
'new_vlan_id' => 'ALTEON_CS_PHYSICAL_MIB__vlanCurCfgVlanId',
|
||||
'old_vlan_state' => 'ALTEON_TS_PHYSICAL_MIB__vlanCurCfgState',
|
||||
'new_vlan_state' => 'ALTEON_CS_PHYSICAL_MIB__vlanCurCfgState',
|
||||
'old_vlan_name' => 'ALTEON_TS_PHYSICAL_MIB__vlanCurCfgVlanName',
|
||||
'new_vlan_name' => 'ALTEON_CS_PHYSICAL_MIB__vlanCurCfgVlanName',
|
||||
'old_vlan_ports' => 'ALTEON_TS_PHYSICAL_MIB__vlanCurCfgPorts',
|
||||
'new_vlan_ports' => 'ALTEON_CS_PHYSICAL_MIB__vlanCurCfgPorts',
|
||||
);
|
||||
|
||||
%MUNGE = ( %SNMP::Info::Layer3::MUNGE, );
|
||||
|
||||
sub model {
|
||||
my $alteon = shift;
|
||||
|
||||
my $id = $alteon->id();
|
||||
|
||||
unless ( defined $id ) {
|
||||
print
|
||||
" SNMP::Info::Layer3::AlteonAD::model() - Device does not support sysObjectID\n"
|
||||
if $alteon->debug();
|
||||
return;
|
||||
}
|
||||
|
||||
my $model = &SNMP::translateObj($id);
|
||||
|
||||
return $id unless defined $model;
|
||||
|
||||
$model =~ s/^(aceswitch|aws|ods)//;
|
||||
$model =~ s/^acedirector/AD/;
|
||||
$model =~ s/^(copper|fiber)Module/BladeCenter GbESM/;
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
sub vendor {
|
||||
return 'radware';
|
||||
}
|
||||
|
||||
sub os {
|
||||
return 'alteon';
|
||||
}
|
||||
|
||||
sub os_ver {
|
||||
my $alteon = shift;
|
||||
my $version = $alteon->new_sw_ver() || $alteon->old_sw_ver();
|
||||
return unless defined $version;
|
||||
|
||||
return $version;
|
||||
}
|
||||
|
||||
sub ps1_status {
|
||||
my $alteon = shift;
|
||||
my $old_ps = $alteon->old_ps1_stat();
|
||||
my $new_ps = $alteon->new_ps_stat();
|
||||
|
||||
return $old_ps if $old_ps;
|
||||
|
||||
if ($new_ps) {
|
||||
return 'ok' if ($new_ps eq 'singlePowerSupplyOk');
|
||||
return 'failed' if ($new_ps eq 'firstPowerSupplyFailed');
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
sub ps2_status {
|
||||
my $alteon = shift;
|
||||
my $old_ps = $alteon->old_ps2_stat();
|
||||
my $new_ps = $alteon->new_ps_stat();
|
||||
|
||||
return $old_ps if $old_ps;
|
||||
|
||||
if ($new_ps) {
|
||||
return 'ok' if ($new_ps eq 'doublePowerSupplyOk');
|
||||
return 'failed' if ($new_ps eq 'secondPowerSupplyFailed');
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
sub interfaces {
|
||||
my $alteon = shift;
|
||||
my $interfaces = $alteon->i_index();
|
||||
my $descriptions = $alteon->i_description();
|
||||
my $ip_max = $alteon->new_ip_max() || $alteon->old_ip_max();
|
||||
|
||||
my %interfaces = ();
|
||||
foreach my $iid ( keys %$interfaces ) {
|
||||
my $desc = $descriptions->{$iid};
|
||||
next unless defined $desc;
|
||||
|
||||
if ( $desc =~ /(^net\d+)/ ) {
|
||||
$desc = $1;
|
||||
}
|
||||
|
||||
# IP interfaces are first followed by physical, number possible
|
||||
# varies by switch model
|
||||
elsif ( defined $ip_max and $iid > $ip_max ) {
|
||||
$desc = ( $iid % $ip_max );
|
||||
$desc = 'mgmt' if $desc == 231;
|
||||
}
|
||||
$interfaces{$iid} = $desc;
|
||||
}
|
||||
return \%interfaces;
|
||||
}
|
||||
|
||||
sub i_duplex {
|
||||
my $alteon = shift;
|
||||
|
||||
my $p_mode = $alteon->new_p_info_mode()
|
||||
|| $alteon->old_p_info_mode()
|
||||
|| {};
|
||||
my $ip_max = $alteon->new_ip_max() || $alteon->old_ip_max();
|
||||
|
||||
my %i_duplex;
|
||||
foreach my $if ( keys %$p_mode ) {
|
||||
my $duplex = $p_mode->{$if};
|
||||
next unless defined $duplex;
|
||||
|
||||
$duplex = 'half' if $duplex =~ /half/i;
|
||||
$duplex = 'full' if $duplex =~ /full/i;
|
||||
|
||||
my $idx;
|
||||
$idx = $if + $ip_max if ( defined $ip_max );
|
||||
|
||||
$i_duplex{$idx} = $duplex;
|
||||
}
|
||||
return \%i_duplex;
|
||||
}
|
||||
|
||||
sub i_duplex_admin {
|
||||
my $alteon = shift;
|
||||
|
||||
my $ag_pref
|
||||
= $alteon->new_ag_p_cfg_pref()
|
||||
|| $alteon->old_ag_p_cfg_pref()
|
||||
|| {};
|
||||
my $ag_fe_auto
|
||||
= $alteon->new_ag_p_cfg_fe_auto()
|
||||
|| $alteon->old_ag_p_cfg_fe_auto()
|
||||
|| {};
|
||||
my $ag_fe_mode
|
||||
= $alteon->new_ag_p_cfg_fe_mode()
|
||||
|| $alteon->old_ag_p_cfg_fe_mode()
|
||||
|| {};
|
||||
my $ag_ge_auto
|
||||
= $alteon->new_ag_p_cfg_ge_auto()
|
||||
|| $alteon->old_ag_p_cfg_ge_auto()
|
||||
|| {};
|
||||
my $ip_max = $alteon->new_ip_max() || $alteon->old_ip_max();
|
||||
my $i_speed = $alteon->i_speed() || {};
|
||||
|
||||
my %i_duplex_admin;
|
||||
foreach my $if ( keys %$ag_ge_auto ) {
|
||||
my $pref = $ag_pref->{$if} || '';
|
||||
my $speed = $i_speed->{$if} || '';
|
||||
my $ge_auto = $ag_ge_auto->{$if} || '';
|
||||
my $fe_auto = $ag_fe_auto->{$if} || '';
|
||||
my $fe_mode = $ag_fe_mode->{$if} || '';
|
||||
|
||||
# Default to auto
|
||||
my $string = 'auto';
|
||||
|
||||
if ( $ge_auto =~ /off/i
|
||||
&& ( $pref =~ /gigabit/i || $speed eq '1.0 Gbps' ) )
|
||||
{
|
||||
$string = 'full';
|
||||
}
|
||||
if ( $fe_auto =~ /off/i
|
||||
&& ( $pref =~ /fast/i || $speed =~ /100?\sMbps/ ) )
|
||||
{
|
||||
$string = 'half'
|
||||
if ( $fe_mode =~ /half/i );
|
||||
$string = 'full'
|
||||
if ( $fe_mode =~ /full/i );
|
||||
}
|
||||
|
||||
my $idx;
|
||||
$idx = $if + $ip_max if ( defined $ip_max );
|
||||
|
||||
$i_duplex_admin{$idx} = $string;
|
||||
}
|
||||
return \%i_duplex_admin;
|
||||
}
|
||||
|
||||
sub i_name {
|
||||
my $alteon = shift;
|
||||
|
||||
my $p_name = $alteon->new_ag_p_cfg_name()
|
||||
|| $alteon->old_ag_p_cfg_name()
|
||||
|| {};
|
||||
my $ip_max = $alteon->new_ip_max() || $alteon->old_ip_max();
|
||||
|
||||
my %i_name;
|
||||
foreach my $iid ( keys %$p_name ) {
|
||||
my $name = $p_name->{$iid};
|
||||
next unless defined $name;
|
||||
my $idx;
|
||||
$idx = $iid + $ip_max if ( defined $ip_max );
|
||||
$i_name{$idx} = $name;
|
||||
}
|
||||
return \%i_name;
|
||||
}
|
||||
|
||||
sub v_index {
|
||||
my $alteon = shift;
|
||||
my $partial = shift;
|
||||
|
||||
return $alteon->new_vlan_id($partial) || $alteon->old_vlan_id($partial);
|
||||
}
|
||||
|
||||
sub v_name {
|
||||
my $alteon = shift;
|
||||
my $partial = shift;
|
||||
|
||||
return $alteon->new_vlan_name($partial)
|
||||
|| $alteon->old_vlan_name($partial);
|
||||
}
|
||||
|
||||
sub i_vlan {
|
||||
my $alteon = shift;
|
||||
|
||||
my $ag_vlans = $alteon->new_ag_p_cfg_pvid()
|
||||
|| $alteon->old_ag_p_cfg_pvid()
|
||||
|| {};
|
||||
my $ip_vlans = $alteon->new_ip_cfg_vlan()
|
||||
|| $alteon->old_ip_cfg_vlan()
|
||||
|| {};
|
||||
my $ip_max = $alteon->new_ip_max() || $alteon->old_ip_max();
|
||||
|
||||
my %i_vlan;
|
||||
foreach my $if ( keys %$ip_vlans ) {
|
||||
my $ip_vlanid = $ip_vlans->{$if};
|
||||
next unless defined $ip_vlanid;
|
||||
|
||||
$i_vlan{$if} = $ip_vlanid;
|
||||
}
|
||||
foreach my $if ( keys %$ag_vlans ) {
|
||||
my $ag_vlanid = $ag_vlans->{$if};
|
||||
next unless defined $ag_vlanid;
|
||||
|
||||
my $idx;
|
||||
$idx = $if + $ip_max if ( defined $ip_max );
|
||||
$i_vlan{$idx} = $ag_vlanid;
|
||||
}
|
||||
return \%i_vlan;
|
||||
}
|
||||
|
||||
sub i_vlan_membership {
|
||||
my $alteon = shift;
|
||||
|
||||
my $v_ports = $alteon->old_vlan_ports()
|
||||
|| $alteon->new_vlan_ports()
|
||||
|| {};
|
||||
my $ip_max = $alteon->new_ip_max() || $alteon->old_ip_max();
|
||||
|
||||
my $i_vlan_membership = {};
|
||||
foreach my $vlan ( keys %$v_ports ) {
|
||||
my $portlist = [ split( //, unpack( "B*", $v_ports->{$vlan} ) ) ];
|
||||
my $ret = [];
|
||||
|
||||
# Convert portlist bit array to ifIndex array
|
||||
for ( my $i = 0; $i <= scalar(@$portlist); $i++ ) {
|
||||
my $idx;
|
||||
$idx = $i + $ip_max if ( defined $ip_max );
|
||||
push( @{$ret}, $idx ) if ( @$portlist[$i] );
|
||||
}
|
||||
|
||||
#Create HoA ifIndex -> VLAN array
|
||||
foreach my $port ( @{$ret} ) {
|
||||
push( @{ $i_vlan_membership->{$port} }, $vlan );
|
||||
}
|
||||
}
|
||||
return $i_vlan_membership;
|
||||
}
|
||||
|
||||
sub i_vlan_membership_untagged {
|
||||
my $alteon = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $vlans = $alteon->i_vlan($partial);
|
||||
my $i_vlan_membership = {};
|
||||
foreach my $port (keys %$vlans) {
|
||||
my $vlan = $vlans->{$port};
|
||||
push( @{ $i_vlan_membership->{$port} }, $vlan );
|
||||
}
|
||||
|
||||
return $i_vlan_membership;
|
||||
}
|
||||
|
||||
# Bridge MIB does not map Bridge Port to ifIndex correctly on some code
|
||||
# versions
|
||||
sub bp_index {
|
||||
my $alteon = shift;
|
||||
|
||||
my $b_index = $alteon->orig_bp_index();
|
||||
my $ip_max = $alteon->new_ip_max() || $alteon->old_ip_max();
|
||||
|
||||
my %bp_index;
|
||||
foreach my $iid ( keys %$b_index ) {
|
||||
my $port = $b_index->{$iid};
|
||||
next unless defined $port;
|
||||
$port = $port + $ip_max if ( defined $ip_max and $iid == $ip_max );
|
||||
|
||||
$bp_index{$iid} = $port;
|
||||
}
|
||||
return \%bp_index;
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer3::AlteonAD - SNMP Interface to Radware Alteon ADC
|
||||
Switches.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Eric Miller
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $alteon = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
DestHost => 'myswitch',
|
||||
Community => 'public',
|
||||
Version => 2
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $alteon->class();
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Abstraction subclass for Radware Alteon Series ADC switches and
|
||||
Nortel BladeCenter Layer2-3 GbE Switch Modules.
|
||||
|
||||
For speed or debugging purposes you can call the subclass directly, but not
|
||||
after determining a more specific class using the method above.
|
||||
|
||||
my $alteon = new SNMP::Info::Layer3::AlteonAD(...);
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info::Layer3
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item F<ALTEON-ROOT-MIB>
|
||||
|
||||
=item F<ALTEON-TIGON-SWITCH-MIB>
|
||||
|
||||
=item F<ALTEON-TS-PHYSICAL-MIB>
|
||||
|
||||
=item F<ALTEON-TS-NETWORK-MIB>
|
||||
|
||||
=item F<ALTEON-CS-PHYSICAL-MIB>
|
||||
|
||||
=item F<ALTEON-CHEETAH-SWITCH-MIB>
|
||||
|
||||
=item F<ALTEON-CHEETAH-NETWORK-MIB>
|
||||
|
||||
=item Inherited Classes' MIBs
|
||||
|
||||
See L<SNMP::Info::Layer3/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
=back
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar value from SNMP
|
||||
|
||||
=over
|
||||
|
||||
=item $alteon->model()
|
||||
|
||||
Returns model type. Checks $alteon->id() against the F<ALTEON-ROOT-MIB> and
|
||||
then parses out C<aceswitch>, C<aws>, and C<ods> replaces C<acedirector>
|
||||
with AD, and replaces copperModule/fiberModule with BladeCenter GbESM.
|
||||
|
||||
=item $alteon->vendor()
|
||||
|
||||
Returns 'radware'
|
||||
|
||||
=item $alteon->os()
|
||||
|
||||
Returns 'alteon'
|
||||
|
||||
=item $alteon->os_ver()
|
||||
|
||||
Returns the software version reported by C<agSoftwareVersion>
|
||||
|
||||
=item $alteon->tftp_action()
|
||||
|
||||
(C<agTftpAction>)
|
||||
|
||||
=item $alteon->tftp_host()
|
||||
|
||||
(C<agTftpServer>)
|
||||
|
||||
=item $alteon->tftp_file()
|
||||
|
||||
(C<agTftpCfgFileName>)
|
||||
|
||||
=item $alteon->tftp_result()
|
||||
|
||||
(C<agTftpLastActionStatus>)
|
||||
|
||||
=item $alteon->fan()
|
||||
|
||||
(C<hwFanStatus>)
|
||||
|
||||
=item $alteon->ps1_status()
|
||||
|
||||
Returns status of primary power supply
|
||||
|
||||
=item $alteon->ps2_status()
|
||||
|
||||
Returns status of redundant power supply
|
||||
|
||||
=back
|
||||
|
||||
=head2 Globals imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"GLOBALS"> for details.
|
||||
|
||||
=head1 TABLE METHODS
|
||||
|
||||
These are methods that return tables of information in the form of a
|
||||
reference to a hash.
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=over
|
||||
|
||||
=item $alteon->interfaces()
|
||||
|
||||
Returns reference to the map between IID and physical port.
|
||||
|
||||
Utilizes description for network interfaces. Ports are determined by
|
||||
formula (C<ifIndex mod 256>).
|
||||
|
||||
=item $alteon->i_duplex()
|
||||
|
||||
Returns reference to hash. Maps port operational duplexes to IIDs.
|
||||
|
||||
=item $alteon->i_duplex_admin()
|
||||
|
||||
Returns reference to hash. Maps port admin duplexes to IIDs.
|
||||
|
||||
=item $alteon->i_vlan()
|
||||
|
||||
Returns a mapping between C<ifIndex> and the PVID or default VLAN.
|
||||
|
||||
=item $alteon->i_vlan_membership()
|
||||
|
||||
Returns reference to hash of arrays: key = C<ifIndex>, value = array of VLAN
|
||||
IDs. These are the VLANs which are members of the egress list for the port.
|
||||
|
||||
Example:
|
||||
my $interfaces = $alteon->interfaces();
|
||||
my $vlans = $alteon->i_vlan_membership();
|
||||
|
||||
foreach my $iid (sort keys %$interfaces) {
|
||||
my $port = $interfaces->{$iid};
|
||||
my $vlan = join(',', sort(@{$vlans->{$iid}}));
|
||||
print "Port: $port VLAN: $vlan\n";
|
||||
}
|
||||
|
||||
=item $alteon->i_vlan_membership_untagged()
|
||||
|
||||
Returns reference to hash of arrays: key = C<ifIndex>, value = array of VLAN
|
||||
IDs. These are the VLANs which are members of the untagged egress list for
|
||||
the port.
|
||||
|
||||
=item $alteon->v_index()
|
||||
|
||||
Returns VLAN IDs
|
||||
|
||||
=item $alteon->v_name()
|
||||
|
||||
Human-entered name for vlans.
|
||||
|
||||
=item $alteon->i_name()
|
||||
|
||||
Maps (C<agPortCurCfgPortName>) to port and returns the human set port name if
|
||||
exists.
|
||||
|
||||
=item $alteon->bp_index()
|
||||
|
||||
Returns a mapping between C<ifIndex> and the Bridge Table.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details.
|
||||
|
||||
=cut
|
||||
392
lib/SNMP/Info/Layer3/Altiga.pm
Normal file
392
lib/SNMP/Info/Layer3/Altiga.pm
Normal file
@@ -0,0 +1,392 @@
|
||||
# SNMP::Info::Layer3::Altiga
|
||||
# $Id$
|
||||
#
|
||||
# Copyright (c) 2008 Jeroen van Ingen Schenau
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the University of California, Santa Cruz nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer3::Altiga;
|
||||
|
||||
use strict;
|
||||
use Exporter;
|
||||
use SNMP::Info::Layer3;
|
||||
|
||||
@SNMP::Info::Layer3::Altiga::ISA = qw/SNMP::Info::Layer3 Exporter/;
|
||||
@SNMP::Info::Layer3::Altiga::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE
|
||||
$int_include_vpn $fake_idx $type_class/;
|
||||
|
||||
$VERSION = '3.35';
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer3::MIBS,
|
||||
'ALTIGA-VERSION-STATS-MIB' => 'alVersionString',
|
||||
'ALTIGA-SESSION-STATS-MIB' => 'alActiveSessionCount',
|
||||
'ALTIGA-HARDWARE-STATS-MIB' => 'alHardwarePs1Type',
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer3::GLOBALS,
|
||||
# From ALTIGA-VERSION-STATS-MIB
|
||||
'os_ver' => 'alVersionString',
|
||||
# From ALTIGA-SESSION-STATS-MIB
|
||||
'vpn_act_sess' => 'alActiveSessionCount',
|
||||
'vpn_total_sess' => 'alTotalSessionCount',
|
||||
'vpn_max_sess' => 'alMaxSessionCount',
|
||||
'vpn_l2l_sess' => 'alActiveLanToLanSessionCount',
|
||||
'vpn_mgmt_sess' => 'alActiveManagementSessionCount',
|
||||
'vpn_ras_sess' => 'alActiveRemoteAccessSessionCount',
|
||||
# From ALTIGA-HARDWARE-STATS-MIB
|
||||
'ps1_type' => 'alHardwarePs1Type',
|
||||
'ps1_3v_alarm' => 'alHardwarePs1Voltage3vAlarm',
|
||||
'ps1_5v_alarm' => 'alHardwarePs1Voltage5vAlarm',
|
||||
'ps2_type' => 'alHardwarePs2Type',
|
||||
'ps2_3v_alarm' => 'alHardwarePs2Voltage3vAlarm',
|
||||
'ps2_5v_alarm' => 'alHardwarePs2Voltage5vAlarm',
|
||||
'fan1_alarm' => 'alHardwareFan1RpmAlarm',
|
||||
'fan2_alarm' => 'alHardwareFan2RpmAlarm',
|
||||
'fan3_alarm' => 'alHardwareFan3RpmAlarm',
|
||||
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer3::FUNCS,
|
||||
'i_type2' => 'ifType',
|
||||
'i_lastchange2' => 'ifLastChange',
|
||||
'vpn_sess_status' => 'alActiveSessionRowStatus',
|
||||
'vpn_sess_user' => 'alActiveSessionUserName',
|
||||
'vpn_sess_peer_ip' => 'alActiveSessionIpAddress',
|
||||
'vpn_sess_protocol' => 'alActiveSessionProtocol',
|
||||
'vpn_sess_encr' => 'alActiveSessionEncrType',
|
||||
'vpn_sess_start' => 'alActiveSessionStartTime',
|
||||
'vpn_sess_conntime' => 'alActiveSessionConnectTime',
|
||||
'vpn_sess_out_oct' => 'alActiveSessionOctetsSent',
|
||||
'vpn_sess_in_oct' => 'alActiveSessionOctetsRcvd',
|
||||
'vpn_sess_group' => 'alActiveSessionGroupName',
|
||||
'vpn_sess_gid' => 'alActiveSessionGroupId',
|
||||
'vpn_sess_rem_ip' => 'alActiveSessionPublicIpAddress',
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
%SNMP::Info::Layer3::MUNGE,
|
||||
'ps1_3v_alarm' => \&munge_alarm,
|
||||
'ps1_5v_alarm' => \&munge_alarm,
|
||||
'ps2_3v_alarm' => \&munge_alarm,
|
||||
'ps2_5v_alarm' => \&munge_alarm,
|
||||
'fan1_alarm' => \&munge_alarm,
|
||||
'fan2_alarm' => \&munge_alarm,
|
||||
'fan3_alarm' => \&munge_alarm,
|
||||
|
||||
);
|
||||
|
||||
# Variable to modify behaviour of "interfaces" subroutine.
|
||||
# * When set to 0, "interfaces" returns only fixed interfaces from the IF-MIB,
|
||||
# * When set to 1, "interfaces" returns fixed interfaces from IF-MIB and LAN-to-LAN tunnels from ALTIGA-SESSION-MIB
|
||||
# TODO: This should be an instance method, not a class global
|
||||
$int_include_vpn = 1;
|
||||
|
||||
# Variable to prepended to each tunnel index when tunnel is added to %interfaces, to avoid overwriting "real" ifIndex entries
|
||||
$fake_idx = 3076;
|
||||
|
||||
# Variable to classify session types into categories: 0 - unclassified, 1 - LAN-to-LAN or fixed, 2 - RAS or dynamic, 3 - administrative
|
||||
$type_class = {
|
||||
'pptp' => 2,
|
||||
'l2tp' => 2,
|
||||
'ipsec' => 2,
|
||||
'http' => 3,
|
||||
'ftp' => 3,
|
||||
'telnet' => 3,
|
||||
'snmp' => 3,
|
||||
'tftp' => 3,
|
||||
'console' => 3,
|
||||
'debugTelnet' => 3,
|
||||
'debugConsole' => 3,
|
||||
'other' => 3,
|
||||
'ike' => 0,
|
||||
'l2tpOverIpSec' => 2,
|
||||
'ipsecLanToLan' => 1,
|
||||
'ipsecOverUdp' => 2,
|
||||
'ssh' => 3,
|
||||
'vcaLanToLan' => 1,
|
||||
'ipsecOverTcp' => 2,
|
||||
'pppoe' => 2,
|
||||
'ipsecOverNatT' => 2,
|
||||
'ipsecLan2LanOverNatT' => 1,
|
||||
'l2tpOverIpsecOverNatT' => 2,
|
||||
'userHttps' => 2,
|
||||
'pop3s' => 2,
|
||||
'imap4s' => 2,
|
||||
'smtps' => 2,
|
||||
'httpsTunnel' => 2,
|
||||
};
|
||||
|
||||
sub vendor {
|
||||
return 'altiga';
|
||||
}
|
||||
|
||||
sub os {
|
||||
return 'altiga';
|
||||
}
|
||||
|
||||
# $altiga->interfaces() - Map the Interfaces to their physical names
|
||||
# Add interface number to interface name to prevent duplicate ifDescr
|
||||
# Included statically configured VPN tunnels if ($int_include_vpn)
|
||||
sub interfaces {
|
||||
my $altiga = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $interfaces = $altiga->i_index($partial);
|
||||
my $descriptions = $altiga->i_description($partial);
|
||||
|
||||
my %int_rev = ();
|
||||
my %interfaces = ();
|
||||
foreach my $iid (sort {$a cmp $b} keys %$interfaces) {
|
||||
my $desc = $descriptions->{$iid};
|
||||
next unless defined $desc;
|
||||
if (!exists $int_rev{$desc}) {
|
||||
$interfaces{$iid} = $desc;
|
||||
$int_rev{$desc} = $iid;
|
||||
} else {
|
||||
my $done = 0;
|
||||
my $unique_desc;
|
||||
my $cnt = 1;
|
||||
until ($done) {
|
||||
$cnt++;
|
||||
$unique_desc = sprintf("%s (%d)", $desc, $cnt);
|
||||
if (!exists $int_rev{$unique_desc}) {
|
||||
$done++;
|
||||
}
|
||||
}
|
||||
$int_rev{$unique_desc} = $iid;
|
||||
$interfaces{$iid} = $unique_desc;
|
||||
$interfaces{ $int_rev{$desc} } = sprintf("%s (%d)", $desc, 1);
|
||||
}
|
||||
}
|
||||
if ($int_include_vpn) {
|
||||
my $tun_type = $altiga->vpn_sess_protocol();
|
||||
my $peer = $altiga->vpn_sess_peer_ip();
|
||||
my $remote = $altiga->vpn_sess_rem_ip();
|
||||
my $group = $altiga->vpn_sess_gid();
|
||||
foreach my $tunnel (keys %$tun_type) {
|
||||
if ($type_class->{$tun_type->{$tunnel}} eq 1) {
|
||||
$interfaces{"$fake_idx.$tunnel"} = sprintf("%s VPN to %s", uc($tun_type->{$tunnel}), $remote->{$tunnel});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return \%interfaces;
|
||||
}
|
||||
|
||||
sub i_type {
|
||||
my $altiga = shift;
|
||||
my $partial = shift;
|
||||
my $types = $altiga->i_type2();
|
||||
if ($int_include_vpn) {
|
||||
my $tun_type = $altiga->vpn_sess_protocol();
|
||||
foreach my $tunnel (keys %$tun_type) {
|
||||
$types->{"$fake_idx.$tunnel"} = $tun_type->{$tunnel};
|
||||
}
|
||||
}
|
||||
return $types;
|
||||
}
|
||||
|
||||
sub i_lastchange {
|
||||
my $altiga = shift;
|
||||
my $partial = shift;
|
||||
|
||||
# TODO: This is what munges are for.
|
||||
my $lastchange = $altiga->i_lastchange2();
|
||||
if ($int_include_vpn) {
|
||||
my $tun_start = $altiga->vpn_sess_start();
|
||||
foreach my $tunnel (keys %$tun_start) {
|
||||
$lastchange->{"$fake_idx.$tunnel"} = $tun_start->{$tunnel};
|
||||
}
|
||||
}
|
||||
return $lastchange;
|
||||
}
|
||||
|
||||
sub ps1_status {
|
||||
my $altiga = shift;
|
||||
my $alarm_3v = $altiga->ps1_3v_alarm() || "";
|
||||
my $alarm_5v = $altiga->ps1_5v_alarm() || "";
|
||||
return sprintf("3V: %s, 5V: %s", $alarm_3v, $alarm_5v);
|
||||
}
|
||||
|
||||
sub ps2_status {
|
||||
my $altiga = shift;
|
||||
my $alarm_3v = $altiga->ps2_3v_alarm() || "";
|
||||
my $alarm_5v = $altiga->ps2_5v_alarm() || "";
|
||||
return sprintf("3V: %s, 5V: %s", $alarm_3v, $alarm_5v);
|
||||
}
|
||||
|
||||
sub fan {
|
||||
my $altiga = shift;
|
||||
my $alarm_fan1 = $altiga->fan1_alarm() || "";
|
||||
my $alarm_fan2 = $altiga->fan2_alarm() || "";
|
||||
my $alarm_fan3 = $altiga->fan3_alarm() || "";
|
||||
return sprintf("Fan 1: %s, Fan 2: %s, Fan 3: %s", $alarm_fan1, $alarm_fan2, $alarm_fan3);
|
||||
}
|
||||
|
||||
sub munge_alarm {
|
||||
my $alarm = shift;
|
||||
if ($alarm eq 'false') {
|
||||
return 'OK';
|
||||
} elsif ($alarm eq 'true') {
|
||||
return 'FAIL';
|
||||
} else {
|
||||
return "(n/a)";
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer3::Altiga - SNMP Interface to Cisco (formerly Altiga) VPN concentrators
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Jeroen van Ingen Schenau
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $altiga = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
DestHost => 'my_vpn_host',
|
||||
Community => 'public',
|
||||
Version => 1
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $altiga->class();
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Subclass for Cisco (formerly Altiga) VPN concentrators
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info::Layer3
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item Inherited Classes' MIBs
|
||||
|
||||
See L<SNMP::Info::Layer3/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
=back
|
||||
|
||||
=head1 Class Variables (options)
|
||||
|
||||
=over
|
||||
|
||||
=item $SNMP::Info::Layer3::Altiga::int_include_vpn
|
||||
|
||||
Variable to modify behavior of "interfaces" subroutine.
|
||||
|
||||
* When set to 0, "interfaces" returns only fixed interfaces from the IF-MIB,
|
||||
* When set to 1, "interfaces" returns fixed interfaces from IF-MIB and
|
||||
LAN-to-LAN tunnels from ALTIGA-SESSION-MIB (default)
|
||||
|
||||
=back
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar value from SNMP
|
||||
|
||||
=over
|
||||
|
||||
=item $altiga->vendor()
|
||||
|
||||
Returns 'altiga'
|
||||
|
||||
=item $altiga->os()
|
||||
|
||||
Returns 'altiga'
|
||||
|
||||
=item $altiga->os_ver()
|
||||
|
||||
Tries to determine OS version from the C<sysDescr.0> field. Returns version or C<sysDescr.0>
|
||||
|
||||
=item $altiga->fan()
|
||||
|
||||
Combines results from C<fan1_alarm>, C<fan2_alarm>, and C<fam3_alarm> methods.
|
||||
|
||||
=item $altiga->ps1_status()
|
||||
|
||||
Combines C<ps1_3v_alarm> and C<ps1_5v_alarm> methods.
|
||||
|
||||
=item $altiga->ps2_status()
|
||||
|
||||
Combines C<ps2_3v_alarm> and C<ps2_5v_alarm> methods.
|
||||
|
||||
=back
|
||||
|
||||
=head1 TABLE METHODS
|
||||
|
||||
These are methods that return tables of information in the form of a reference
|
||||
to a hash.
|
||||
|
||||
=over
|
||||
|
||||
=item $altiga->interfaces()
|
||||
|
||||
This method overrides the interfaces() method inherited from SNMP::Info.
|
||||
It provides a mapping between the Interface Table Index (iid) and the physical
|
||||
port name, adding a port number to the port name to prevent duplicate names.
|
||||
|
||||
=item $altiga->i_lastchange()
|
||||
|
||||
Filters out the results depending on the value of $SNMP::Info::Layer3::Altiga::int_include_vpn
|
||||
|
||||
=item $altiga->i_type()
|
||||
|
||||
Filters out the results depending on the value of $SNMP::Info::Layer3::Altiga::int_include_vpn
|
||||
|
||||
=back
|
||||
|
||||
=head1 MUNGES
|
||||
|
||||
=over
|
||||
|
||||
=item munge_alarm()
|
||||
|
||||
Changes C<true> and C<false> to C<FAIL>, C<OK>, and C<(n/a)>.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
276
lib/SNMP/Info/Layer3/Arista.pm
Normal file
276
lib/SNMP/Info/Layer3/Arista.pm
Normal file
@@ -0,0 +1,276 @@
|
||||
# SNMP::Info::Layer3::Arista
|
||||
# $Id$
|
||||
#
|
||||
# Copyright (c) 2008 Arista Networks, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of Arista Networks, Inc. nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer3::Arista;
|
||||
|
||||
use strict;
|
||||
use Exporter;
|
||||
|
||||
use SNMP::Info::Layer3;
|
||||
use SNMP::Info::MAU;
|
||||
use SNMP::Info::LLDP;
|
||||
use SNMP::Info::Aggregate 'agg_ports_ifstack';
|
||||
|
||||
@SNMP::Info::Layer3::Arista::ISA = qw/
|
||||
SNMP::Info::Aggregate
|
||||
SNMP::Info::LLDP
|
||||
SNMP::Info::MAU
|
||||
SNMP::Info::Layer3 Exporter
|
||||
/;
|
||||
@SNMP::Info::Layer3::Arista::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/;
|
||||
|
||||
$VERSION = '3.35';
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer3::MIBS,
|
||||
%SNMP::Info::MAU::MIBS,
|
||||
%SNMP::Info::LLDP::MIBS,
|
||||
%SNMP::Info::Aggregate::MIBS,
|
||||
'ARISTA-PRODUCTS-MIB' => 'aristaProducts',
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer3::GLOBALS,
|
||||
%SNMP::Info::MAU::GLOBALS,
|
||||
%SNMP::Info::LLDP::GLOBALS,
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer3::FUNCS,
|
||||
%SNMP::Info::MAU::FUNCS,
|
||||
%SNMP::Info::LLDP::FUNCS,
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
%SNMP::Info::Layer3::MUNGE,
|
||||
%SNMP::Info::MAU::MUNGE,
|
||||
%SNMP::Info::LLDP::MUNGE,
|
||||
);
|
||||
|
||||
# use MAU-MIB for admin. duplex and admin. speed
|
||||
*SNMP::Info::Layer3::Arista::i_duplex_admin
|
||||
= \&SNMP::Info::MAU::mau_i_duplex_admin;
|
||||
*SNMP::Info::Layer3::Arista::i_speed_admin
|
||||
= \&SNMP::Info::MAU::mau_i_speed_admin;
|
||||
|
||||
sub vendor {
|
||||
return 'arista';
|
||||
}
|
||||
|
||||
sub os {
|
||||
return 'EOS';
|
||||
}
|
||||
|
||||
sub os_ver {
|
||||
my $arista = shift;
|
||||
my $descr = $arista->description();
|
||||
my $os_ver = undef;
|
||||
|
||||
$os_ver = $1 if ( $descr =~ /\s+EOS\s+version\s+(\S+)\s+/ );
|
||||
return $os_ver;
|
||||
}
|
||||
|
||||
sub model {
|
||||
my $arista = shift;
|
||||
my $id = $arista->id();
|
||||
|
||||
my $model = &SNMP::translateObj($id);
|
||||
return $id unless defined $model;
|
||||
|
||||
$model =~ s/^arista//;
|
||||
return $model;
|
||||
}
|
||||
|
||||
# The LLDP MIB leaves it up in the air what the index means.
|
||||
# On EOS, it's a dot1d port.
|
||||
sub lldp_if {
|
||||
my $arista = shift;
|
||||
my $partial = shift;
|
||||
|
||||
# We pick a column that someone else is likely to want,
|
||||
# so that the cache means that hopefully this doesn't
|
||||
# cause any more SNMP transactions in total.
|
||||
my $desc = $arista->lldp_rem_desc($partial) || {};
|
||||
my $bp_index = $arista->bp_index() || {};
|
||||
|
||||
my $lldp_if = {};
|
||||
foreach my $key ( keys %$desc ) {
|
||||
my @aOID = split( '\.', $key );
|
||||
my $port = $aOID[1];
|
||||
$lldp_if->{$key} = $bp_index->{$port};
|
||||
}
|
||||
return $lldp_if;
|
||||
}
|
||||
|
||||
sub agg_ports { return agg_ports_ifstack(@_) }
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer3::Arista - SNMP Interface to Arista Networks EOS
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Bill Fenner
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $arista = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
# These arguments are passed directly to SNMP::Session
|
||||
DestHost => 'myswitch',
|
||||
Community => 'public',
|
||||
Version => 2
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $arista->class();
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Subclass for Arista Networks EOS-based devices
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info::Aggregate
|
||||
|
||||
=item SNMP::Info::Layer3
|
||||
|
||||
=item SNMP::Info::MAU
|
||||
|
||||
=item SNMP::Info::LLDP
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item F<ARISTA-PRODUCTS-MIB>
|
||||
|
||||
=item Inherited Classes' MIBs
|
||||
|
||||
See L<SNMP::Info::Layer3/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
See L<SNMP::Info::Aggregate/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
See L<SNMP::Info::MAU/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
See L<SNMP::Info::LLDP/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
=back
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar values from SNMP
|
||||
|
||||
=over
|
||||
|
||||
=item $arista->vendor()
|
||||
|
||||
Returns 'Arista Networks, Inc.'
|
||||
|
||||
=item $arista->model()
|
||||
|
||||
Tries to reference $arista->id() to one of the product MIBs listed above
|
||||
|
||||
Removes 'arista' from the name for readability.
|
||||
|
||||
=item $arista->os()
|
||||
|
||||
Returns 'EOS'
|
||||
|
||||
=item $arista->os_ver()
|
||||
|
||||
Grabs the os version from C<sysDescr>
|
||||
|
||||
=back
|
||||
|
||||
=head2 Global Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"GLOBALS"> for details.
|
||||
|
||||
=head2 Global Methods imported from SNMP::Info::MAU
|
||||
|
||||
See documentation in L<SNMP::Info::MAU/"GLOBALS"> for details.
|
||||
|
||||
=head2 Global Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"GLOBALS"> for details.
|
||||
|
||||
=head1 TABLE METHODS
|
||||
|
||||
These are methods that return tables of information in the form of a reference
|
||||
to a hash.
|
||||
|
||||
=over
|
||||
|
||||
=item $arista->i_duplex_admin()
|
||||
|
||||
Returns info from F<MAU-MIB>
|
||||
|
||||
=item $arista->i_speed_admin()
|
||||
|
||||
Returns info from F<MAU-MIB>
|
||||
|
||||
=item $arista->lldp_if()
|
||||
|
||||
Returns the mapping to the SNMP Interface Table.
|
||||
|
||||
=item C<agg_ports>
|
||||
|
||||
Returns a HASH reference mapping from slave to master port for each member of
|
||||
a port bundle on the device. Keys are ifIndex of the slave ports, Values are
|
||||
ifIndex of the corresponding master ports.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::MAU
|
||||
|
||||
See documentation in L<SNMP::Info::MAU/"TABLE METHODS"> for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::LLDP
|
||||
|
||||
See documentation in L<SNMP::Info::LLDP/"TABLE METHODS"> for details.
|
||||
|
||||
=cut
|
||||
1838
lib/SNMP/Info/Layer3/Aruba.pm
Normal file
1838
lib/SNMP/Info/Layer3/Aruba.pm
Normal file
File diff suppressed because it is too large
Load Diff
1654
lib/SNMP/Info/Layer3/BayRS.pm
Normal file
1654
lib/SNMP/Info/Layer3/BayRS.pm
Normal file
File diff suppressed because it is too large
Load Diff
168
lib/SNMP/Info/Layer3/BlueCoatSG.pm
Normal file
168
lib/SNMP/Info/Layer3/BlueCoatSG.pm
Normal file
@@ -0,0 +1,168 @@
|
||||
package SNMP::Info::Layer3::BlueCoatSG;
|
||||
|
||||
# Copyright (c) 2011 Netdisco Project
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the University of California, Santa Cruz nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
use strict;
|
||||
use Exporter;
|
||||
use SNMP::Info::Layer3;
|
||||
|
||||
@SNMP::Info::Layer3::BlueCoatSG::ISA = qw/SNMP::Info::Layer3 Exporter/;
|
||||
@SNMP::Info::Layer3::BlueCoatSG::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/;
|
||||
|
||||
$VERSION = '3.35';
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer2::MIBS, %SNMP::Info::Layer3::MIBS,
|
||||
'BLUECOAT-SG-PROXY-MIB' => 'sgProxyAdmin',
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer2::GLOBALS, %SNMP::Info::Layer3::GLOBALS,
|
||||
#From BLUECOAT-SG-PROXY-MIB
|
||||
'serial1'=> 'sgProxySerialNumber',
|
||||
'sw_ver' => 'sgProxyVersion',
|
||||
);
|
||||
|
||||
%FUNCS = ( %SNMP::Info::Layer2::FUNCS, %SNMP::Info::Layer3::FUNCS, );
|
||||
|
||||
%MUNGE = ( %SNMP::Info::Layer2::MUNGE, %SNMP::Info::Layer3::MUNGE, );
|
||||
|
||||
sub vendor {
|
||||
return 'Blue Coat';
|
||||
}
|
||||
|
||||
sub os {
|
||||
return 'sgos';
|
||||
}
|
||||
|
||||
sub os_ver {
|
||||
my $sg = shift;
|
||||
my $os_string = $sg->sw_ver();
|
||||
if ($os_string =~ /^Version:\s(\w+)\s([\d\.]+)/) {
|
||||
return $2;
|
||||
} else {
|
||||
return ''; # perhaps we can try sysDescr or some other object...
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer3::BlueCoatSG - SNMP Interface to Blue Coat SG Series proxy devices
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Jeroen van Ingen
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $router = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
DestHost => 'myrouter',
|
||||
Community => 'public',
|
||||
Version => 1
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $router->class();
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Subclass for Blue Coat SG Series proxy devices
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info::Layer3
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
BLUECOAT-SG-PROXY-MIB
|
||||
|
||||
=over
|
||||
|
||||
=item Inherited Classes' MIBs
|
||||
|
||||
See L<SNMP::Info::Layer3/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
=back
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar value from SNMP
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=over
|
||||
|
||||
=item $router->vendor()
|
||||
|
||||
Returns C<'Blue Coat'>
|
||||
|
||||
=item $router->os()
|
||||
|
||||
Returns C<'sgos'>
|
||||
|
||||
=item $router->os_ver()
|
||||
|
||||
Tries to resolve version string from C<"sgProxyVersion">.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Globals imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"GLOBALS"> for details.
|
||||
|
||||
=head1 TABLE METHODS
|
||||
|
||||
These are methods that return tables of information in the form of a reference
|
||||
to a hash.
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=over
|
||||
|
||||
=back
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details.
|
||||
|
||||
=cut
|
||||
|
||||
344
lib/SNMP/Info/Layer3/C3550.pm
Normal file
344
lib/SNMP/Info/Layer3/C3550.pm
Normal file
@@ -0,0 +1,344 @@
|
||||
# SNMP::Info::Layer3::C3550
|
||||
# $Id$
|
||||
#
|
||||
# Copyright (c) 2008-2009 Max Baker changes from version 0.8 and beyond.
|
||||
# Copyright (c) 2004 Regents of the University of California
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the University of California, Santa Cruz nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer3::C3550;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Exporter;
|
||||
use SNMP::Info::CiscoStack;
|
||||
use SNMP::Info::Layer3::CiscoSwitch;
|
||||
|
||||
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/;
|
||||
|
||||
# NOTE : Top-most items gets precedence for @ISA
|
||||
@SNMP::Info::Layer3::C3550::ISA = qw/
|
||||
SNMP::Info::CiscoStack
|
||||
SNMP::Info::Layer3::CiscoSwitch
|
||||
Exporter/;
|
||||
|
||||
@SNMP::Info::Layer3::C3550::EXPORT_OK = qw//;
|
||||
|
||||
$VERSION = '3.35';
|
||||
|
||||
# NOTE: Order creates precedence
|
||||
# Example: v_name exists in Bridge.pm and CiscoVTP.pm
|
||||
# Bridge is called from Layer3 and CiscoStpExtensions
|
||||
# So we want CiscoVTP to come last to get the right one.
|
||||
# The @ISA order should match these orders.
|
||||
|
||||
%MIBS
|
||||
= ( %SNMP::Info::Layer3::CiscoSwitch::MIBS, %SNMP::Info::CiscoStack::MIBS,
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer3::CiscoSwitch::GLOBALS,
|
||||
%SNMP::Info::CiscoStack::GLOBALS,
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer3::CiscoSwitch::FUNCS,
|
||||
%SNMP::Info::CiscoStack::FUNCS,
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
%SNMP::Info::Layer3::CiscoSwitch::MUNGE,
|
||||
%SNMP::Info::CiscoStack::MUNGE,
|
||||
);
|
||||
|
||||
sub vendor {
|
||||
return 'cisco';
|
||||
}
|
||||
|
||||
sub model {
|
||||
my $c3550 = shift;
|
||||
my $id = $c3550->id();
|
||||
my $model = &SNMP::translateObj($id) || $id;
|
||||
$model =~ s/^catalyst//;
|
||||
|
||||
# turn 355048 into 3550-48
|
||||
if ( $model =~ /^(35\d\d)(\d\d(T|G)?)$/ ) {
|
||||
$model = "$1-$2";
|
||||
}
|
||||
return $model;
|
||||
}
|
||||
|
||||
# Ports is encoded into the model number
|
||||
sub ports {
|
||||
my $c3550 = shift;
|
||||
|
||||
my $id = $c3550->id();
|
||||
my $model = &SNMP::translateObj($id);
|
||||
if ( $model =~ /(12|24|48)(C|T|TS|G|TS-E|TS-S|T-E)?$/ ) {
|
||||
return $1;
|
||||
}
|
||||
|
||||
my $ports = $c3550->orig_ports();
|
||||
return $ports;
|
||||
}
|
||||
|
||||
# Verions prior to 12.1(22)EA1a use the older CiscoStack method
|
||||
# Newer versions use the ETHERLIKE-MIB to report operational duplex.
|
||||
# See http://www.ciscosystems.com/en/US/products/hw/switches/ps646/prod_release_note09186a00802a08ee.html
|
||||
|
||||
sub i_duplex {
|
||||
my $c3550 = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $el_duplex = $c3550->el_duplex($partial);
|
||||
|
||||
# Newer software
|
||||
if ( defined $el_duplex and scalar( keys %$el_duplex ) ) {
|
||||
my %i_duplex;
|
||||
foreach my $el_port ( keys %$el_duplex ) {
|
||||
my $duplex = $el_duplex->{$el_port};
|
||||
next unless defined $duplex;
|
||||
|
||||
$i_duplex{$el_port} = 'half' if $duplex =~ /half/i;
|
||||
$i_duplex{$el_port} = 'full' if $duplex =~ /full/i;
|
||||
}
|
||||
return \%i_duplex;
|
||||
}
|
||||
|
||||
# Fall back to CiscoStack method
|
||||
else {
|
||||
return $c3550->SUPER::i_duplex($partial);
|
||||
}
|
||||
}
|
||||
|
||||
# Software >= 12.1(22)EA1a uses portDuplex as admin setting
|
||||
|
||||
sub i_duplex_admin {
|
||||
my $c3550 = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $el_duplex = $c3550->el_duplex($partial);
|
||||
|
||||
# Newer software
|
||||
if ( defined $el_duplex and scalar( keys %$el_duplex ) ) {
|
||||
my $p_port = $c3550->p_port() || {};
|
||||
my $p_duplex = $c3550->p_duplex() || {};
|
||||
|
||||
my $i_duplex_admin = {};
|
||||
foreach my $port ( keys %$p_duplex ) {
|
||||
my $iid = $p_port->{$port};
|
||||
next unless defined $iid;
|
||||
next if ( defined $partial and $iid !~ /^$partial$/ );
|
||||
|
||||
$i_duplex_admin->{$iid} = $p_duplex->{$port};
|
||||
}
|
||||
return $i_duplex_admin;
|
||||
}
|
||||
|
||||
# Fall back to CiscoStack method
|
||||
else {
|
||||
return $c3550->SUPER::i_duplex_admin($partial);
|
||||
}
|
||||
}
|
||||
|
||||
sub set_i_duplex_admin {
|
||||
|
||||
# map a textual duplex to an integer one the switch understands
|
||||
my %duplexes = qw/half 1 full 2 auto 4/;
|
||||
|
||||
my $c3550 = shift;
|
||||
my ( $duplex, $iid ) = @_;
|
||||
|
||||
my $el_duplex = $c3550->el_duplex($iid);
|
||||
|
||||
# Auto duplex only supported on newer software
|
||||
if ( defined $el_duplex and scalar( keys %$el_duplex ) ) {
|
||||
my $p_port = $c3550->p_port() || {};
|
||||
my %reverse_p_port = reverse %$p_port;
|
||||
|
||||
$duplex = lc($duplex);
|
||||
|
||||
return 0 unless defined $duplexes{$duplex};
|
||||
|
||||
$iid = $reverse_p_port{$iid};
|
||||
|
||||
return $c3550->set_p_duplex( $duplexes{$duplex}, $iid );
|
||||
}
|
||||
else {
|
||||
return $c3550->SUPER::set_i_duplex_admin;
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer3::C3550 - SNMP Interface to Cisco Catalyst 3550 Layer 2/3
|
||||
Switches running IOS
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Max Baker
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $c3550 = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
# These arguments are passed directly to SNMP::Session
|
||||
DestHost => 'myswitch',
|
||||
Community => 'public',
|
||||
Version => 2
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $c3550->class();
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Abstraction subclass for Cisco Catalyst 3550 Layer 2/3 Switches.
|
||||
|
||||
These devices run IOS but have some of the same characteristics as the
|
||||
Catalyst WS-C family (5xxx,6xxx). For example, forwarding tables are held in
|
||||
VLANs, and extended interface information is gleaned from F<CISCO-SWITCH-MIB>.
|
||||
|
||||
For speed or debugging purposes you can call the subclass directly, but not
|
||||
after determining a more specific class using the method above.
|
||||
|
||||
my $c3550 = new SNMP::Info::Layer3::C3550(...);
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info::CiscoStack
|
||||
|
||||
=item SNMP::Info::Layer3::CiscoSwitch
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item Inherited Classes' MIBs
|
||||
|
||||
See L<SNMP::Info::CiscoStack/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
See L<SNMP::Info::Layer3::CiscoSwitch/"Required MIBs"> for its own MIB
|
||||
requirements.
|
||||
|
||||
=back
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar value from SNMP
|
||||
|
||||
=over
|
||||
|
||||
=item $c3550->vendor()
|
||||
|
||||
Returns 'cisco'
|
||||
|
||||
=item $c3550->model()
|
||||
|
||||
Will take the translated model number and try to format it better.
|
||||
|
||||
355048 -> 3550-48
|
||||
355012G -> 3550-12G
|
||||
|
||||
=item $c3550->ports()
|
||||
|
||||
Tries to cull the number of ports from the model number.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Globals imported from SNMP::Info::CiscoStack
|
||||
|
||||
See documentation in L<SNMP::Info::CiscoStack/"GLOBALS"> for details.
|
||||
|
||||
=head2 Globals imported from SNMP::Info::Layer3::CiscoSwitch
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3::CiscoSwitch/"GLOBALS"> for details.
|
||||
|
||||
=head1 TABLE METHODS
|
||||
|
||||
These are methods that return tables of information in the form of a reference
|
||||
to a hash.
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=over
|
||||
|
||||
=item $c3550->i_duplex()
|
||||
|
||||
Returns reference to hash of iid to current link duplex setting.
|
||||
|
||||
Software version 12.1(22)EA1a or greater returns duplex based upon the
|
||||
result of $c3550->el_duplex(). Otherwise it uses the result of
|
||||
the call to CiscoStack::i_duplex().
|
||||
|
||||
See L<SNMP::Info::Etherlike> for el_duplex() method and
|
||||
L<SNMP::Info::CiscoStack> for its i_duplex() method.
|
||||
|
||||
=item $c3550->i_duplex_admin()
|
||||
|
||||
Returns reference to hash of iid to administrative duplex setting.
|
||||
|
||||
Software version 12.1(22)EA1a or greater returns duplex based upon the
|
||||
result of $c3550->p_duplex(). Otherwise it uses the result of
|
||||
the call to CiscoStack::i_duplex().
|
||||
|
||||
See L<SNMP::Info::CiscoStack> for its i_duplex() and p_duplex() methods.
|
||||
|
||||
=item $c3550->set_i_duplex_admin(duplex, ifIndex)
|
||||
|
||||
Sets port duplex, must be supplied with duplex and port C<ifIndex>.
|
||||
|
||||
Speed choices are 'auto', 'half', 'full'.
|
||||
|
||||
Crosses $c3550->p_port() with $c3550->p_duplex() to utilize port C<ifIndex>.
|
||||
|
||||
Example:
|
||||
my %if_map = reverse %{$c3550->interfaces()};
|
||||
$c3550->set_i_duplex_admin('auto', $if_map{'FastEthernet0/1'})
|
||||
or die "Couldn't change port duplex. ",$c3550->error(1);
|
||||
|
||||
=back
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::CiscoStack
|
||||
|
||||
See documentation in L<SNMP::Info::CiscoStack/"TABLE METHODS"> for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer3::CiscoSwitch
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3::CiscoSwitch/"TABLE METHODS"> for
|
||||
details.
|
||||
|
||||
=cut
|
||||
230
lib/SNMP/Info/Layer3/C4000.pm
Normal file
230
lib/SNMP/Info/Layer3/C4000.pm
Normal file
@@ -0,0 +1,230 @@
|
||||
# SNMP::Info::Layer3::C4000
|
||||
# $Id$
|
||||
#
|
||||
# Copyright (c) 2008 Bill Fenner
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the University of California, Santa Cruz nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer3::C4000;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Exporter;
|
||||
use SNMP::Info::Layer3::CiscoSwitch;
|
||||
use SNMP::Info::MAU;
|
||||
|
||||
@SNMP::Info::Layer3::C4000::ISA = qw/
|
||||
SNMP::Info::Layer3::CiscoSwitch
|
||||
SNMP::Info::MAU
|
||||
Exporter/;
|
||||
@SNMP::Info::Layer3::C4000::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/;
|
||||
|
||||
$VERSION = '3.35';
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::MAU::MIBS,
|
||||
%SNMP::Info::Layer3::CiscoSwitch::MIBS,
|
||||
'CISCO-ENVMON-MIB' => 'ciscoEnvMonMIB',
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::MAU::GLOBALS,
|
||||
%SNMP::Info::Layer3::CiscoSwitch::GLOBALS,
|
||||
'ps1_type' => 'ciscoEnvMonSupplyStatusDescr.1',
|
||||
'ps1_status' => 'ciscoEnvMonSupplyState.1',
|
||||
'ps2_type' => 'ciscoEnvMonSupplyStatusDescr.2',
|
||||
'ps2_status' => 'ciscoEnvMonSupplyState.2',
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::MAU::FUNCS,
|
||||
%SNMP::Info::Layer3::CiscoSwitch::FUNCS,
|
||||
'fan_state' => 'ciscoEnvMonFanState',
|
||||
'fan_descr' => 'ciscoEnvMonFanStatusDescr',
|
||||
);
|
||||
|
||||
%MUNGE
|
||||
= ( %SNMP::Info::MAU::MUNGE, %SNMP::Info::Layer3::CiscoSwitch::MUNGE, );
|
||||
|
||||
# Override Inheritance for these specific methods
|
||||
# use MAU-MIB for admin. duplex and admin. speed
|
||||
*SNMP::Info::Layer3::C4000::i_duplex_admin
|
||||
= \&SNMP::Info::MAU::mau_i_duplex_admin;
|
||||
*SNMP::Info::Layer3::C4000::i_speed_admin
|
||||
= \&SNMP::Info::MAU::mau_i_speed_admin;
|
||||
|
||||
*SNMP::Info::Layer3::C4000::set_i_duplex_admin
|
||||
= \&SNMP::Info::MAU::mau_set_i_duplex_admin;
|
||||
*SNMP::Info::Layer3::C4000::set_i_speed_admin
|
||||
= \&SNMP::Info::MAU::mau_set_i_speed_admin;
|
||||
|
||||
sub fan {
|
||||
my $c4000 = shift;
|
||||
my $fan_state = $c4000->fan_state();
|
||||
my $fan_descr = $c4000->fan_descr();
|
||||
my $ret = "";
|
||||
my $s = "";
|
||||
foreach my $i ( sort { $a <=> $b } keys %$fan_state ) {
|
||||
$ret .= $s . $fan_descr->{$i} . ": " . $fan_state->{$i};
|
||||
$s = ", ";
|
||||
}
|
||||
return if ( $s eq "" );
|
||||
return $ret;
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer3::C4000 - SNMP Interface to Cisco Catalyst 4000 Layer 2/3
|
||||
Switches running IOS
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Bill Fenner
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $c4000 = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
# These arguments are passed directly to SNMP::Session
|
||||
DestHost => 'myswitch',
|
||||
Community => 'public',
|
||||
Version => 2
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $c4000->class();
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Abstraction subclass for Cisco Catalyst 4000 Layer 2/3 Switches.
|
||||
|
||||
For speed or debugging purposes you can call the subclass directly, but not
|
||||
after determining a more specific class using the method above.
|
||||
|
||||
my $c4000 = new SNMP::Info::Layer3::C4000(...);
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info::Layer3::CiscoSwitch
|
||||
|
||||
=item SNMP::Info::MAU
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item Inherited Classes' MIBs
|
||||
|
||||
See L<SNMP::Info::Layer3::CiscoSwitch/"Required MIBs"> for its own MIB
|
||||
requirements.
|
||||
|
||||
See L<SNMP::Info::MAU/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
=back
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar value from SNMP
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=over
|
||||
|
||||
=item $c4000->fan()
|
||||
|
||||
Returns fan status
|
||||
|
||||
=back
|
||||
|
||||
=head2 Globals imported from SNMP::Info::Layer3::CiscoSwitch
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3::CiscoSwitch/"GLOBALS"> for details.
|
||||
|
||||
=head2 Globals imported from SNMP::Info::MAU
|
||||
|
||||
See documentation in L<SNMP::Info::MAU/"GLOBALS"> for details.
|
||||
|
||||
=head1 TABLE METHODS
|
||||
|
||||
These are methods that return tables of information in the form of a reference
|
||||
to a hash.
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=over
|
||||
|
||||
=item $c4000->i_duplex()
|
||||
|
||||
Parses mau_index and mau_link to return the duplex information for
|
||||
interfaces.
|
||||
|
||||
=item $c4000->i_duplex_admin()
|
||||
|
||||
Parses C<mac_index>,C<mau_autostat>,C<mau_type_admin> in
|
||||
order to find the admin duplex setting for all the interfaces.
|
||||
|
||||
Returns either (auto,full,half).
|
||||
|
||||
=item $c4000->i_speed_admin()
|
||||
|
||||
Returns administrative speed for interfaces.
|
||||
|
||||
=item $c4000->set_i_speed_admin(speed, ifIndex)
|
||||
|
||||
Sets port speed, must be supplied with speed and port C<ifIndex>.
|
||||
|
||||
Speed choices are '10', '100', '1000', 'auto'.
|
||||
|
||||
=item $c4000->set_i_duplex_admin(duplex, ifIndex)
|
||||
|
||||
Sets port duplex, must be supplied with duplex and port C<ifIndex>.
|
||||
|
||||
Duplex choices are 'auto', 'half', 'full'.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer3::CiscoSwitch
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3::CiscoSwitch/"TABLE METHODS"> for
|
||||
details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::MAU
|
||||
|
||||
See documentation in L<SNMP::Info::MAU/"TABLE METHODS"> for details.
|
||||
|
||||
=cut
|
||||
413
lib/SNMP/Info/Layer3/C6500.pm
Normal file
413
lib/SNMP/Info/Layer3/C6500.pm
Normal file
@@ -0,0 +1,413 @@
|
||||
# SNMP::Info::Layer3::C6500
|
||||
# $Id$
|
||||
#
|
||||
# Copyright (c) 2008-2009 Max Baker
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the University of California, Santa Cruz nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer3::C6500;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Exporter;
|
||||
use SNMP::Info::CiscoStack;
|
||||
use SNMP::Info::Layer3::CiscoSwitch;
|
||||
use SNMP::Info::MAU;
|
||||
|
||||
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/;
|
||||
|
||||
# NOTE : Top-most items gets precedence for @ISA
|
||||
@SNMP::Info::Layer3::C6500::ISA = qw/
|
||||
SNMP::Info::CiscoStack
|
||||
SNMP::Info::Layer3::CiscoSwitch
|
||||
SNMP::Info::MAU
|
||||
Exporter
|
||||
/;
|
||||
|
||||
@SNMP::Info::Layer3::C6500::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/;
|
||||
|
||||
$VERSION = '3.35';
|
||||
|
||||
# NOTE: Order creates precedence
|
||||
# Example: v_name exists in Bridge.pm and CiscoVTP.pm
|
||||
# Bridge is called from Layer3 and CiscoStpExtensions
|
||||
# So we want CiscoVTP to come last to get the right one.
|
||||
# The @ISA order should match these orders.
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::MAU::MIBS,
|
||||
%SNMP::Info::Layer3::CiscoSwitch::MIBS,
|
||||
%SNMP::Info::CiscoStack::MIBS,
|
||||
'CISCO-VIRTUAL-SWITCH-MIB' => 'cvsSwitchMode',
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::MAU::GLOBALS,
|
||||
%SNMP::Info::Layer3::CiscoSwitch::GLOBALS,
|
||||
%SNMP::Info::CiscoStack::GLOBALS,
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::MAU::FUNCS,
|
||||
%SNMP::Info::Layer3::CiscoSwitch::FUNCS,
|
||||
%SNMP::Info::CiscoStack::FUNCS,
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
%SNMP::Info::MAU::MUNGE,
|
||||
%SNMP::Info::Layer3::CiscoSwitch::MUNGE,
|
||||
%SNMP::Info::CiscoStack::MUNGE,
|
||||
);
|
||||
|
||||
sub vendor {
|
||||
return 'cisco';
|
||||
}
|
||||
|
||||
sub serial {
|
||||
my $c6500 = shift;
|
||||
|
||||
my $serial = $c6500->SUPER::serial();
|
||||
return $serial if defined $serial and $serial;
|
||||
|
||||
# now grab the table only if SUPER cannot find it
|
||||
my $e_serial = $c6500->e_serial();
|
||||
|
||||
# Find entity table entry for this unit
|
||||
foreach my $e ( sort keys %$e_serial ) {
|
||||
if (defined $e_serial->{$e} and $e_serial->{$e} !~ /^\s*$/) {
|
||||
return $e_serial->{$e};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Newer versions use the ETHERLIKE-MIB to report operational duplex.
|
||||
|
||||
sub i_duplex {
|
||||
my $c6500 = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $el_duplex = $c6500->el_duplex($partial);
|
||||
|
||||
# Newer software
|
||||
if ( defined $el_duplex and scalar( keys %$el_duplex ) ) {
|
||||
my %i_duplex;
|
||||
foreach my $el_port ( keys %$el_duplex ) {
|
||||
my $duplex = $el_duplex->{$el_port};
|
||||
next unless defined $duplex;
|
||||
|
||||
$i_duplex{$el_port} = 'half' if $duplex =~ /half/i;
|
||||
$i_duplex{$el_port} = 'full' if $duplex =~ /full/i;
|
||||
}
|
||||
return \%i_duplex;
|
||||
}
|
||||
|
||||
# Fall back to CiscoStack method
|
||||
else {
|
||||
return $c6500->SUPER::i_duplex($partial);
|
||||
}
|
||||
}
|
||||
|
||||
# Newer software uses portDuplex as admin setting
|
||||
|
||||
sub i_duplex_admin {
|
||||
my $c6500 = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $el_duplex = $c6500->el_duplex($partial);
|
||||
|
||||
# Newer software
|
||||
if ( defined $el_duplex and scalar( keys %$el_duplex ) ) {
|
||||
my $p_port = $c6500->p_port() || {};
|
||||
my $p_duplex = $c6500->p_duplex() || {};
|
||||
|
||||
my $i_duplex_admin = {};
|
||||
foreach my $port ( keys %$p_duplex ) {
|
||||
my $iid = $p_port->{$port};
|
||||
next unless defined $iid;
|
||||
next if ( defined $partial and $iid !~ /^$partial$/ );
|
||||
|
||||
$i_duplex_admin->{$iid} = $p_duplex->{$port};
|
||||
}
|
||||
return $i_duplex_admin;
|
||||
}
|
||||
|
||||
# Fall back to CiscoStack method
|
||||
else {
|
||||
return $c6500->SUPER::i_duplex_admin($partial);
|
||||
}
|
||||
}
|
||||
|
||||
sub is_virtual_switch {
|
||||
my $cvs = shift;
|
||||
my $cvsSwM = $cvs->cvsSwitchMode() || '';
|
||||
|
||||
if ( $cvsSwM eq 'multiNode' ) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub set_i_duplex_admin {
|
||||
|
||||
# map a textual duplex to an integer one the switch understands
|
||||
my %duplexes = qw/half 1 full 2 auto 4/;
|
||||
|
||||
my $c6500 = shift;
|
||||
my ( $duplex, $iid ) = @_;
|
||||
|
||||
if ( $c6500->is_virtual_switch() ) {
|
||||
|
||||
# VSS -> MAU
|
||||
# Due to VSS bug
|
||||
# 1. Set the ifMauDefaultType
|
||||
# 2. Disable ifMauAutoNegAdminStatus
|
||||
# If the second set is not done, this is not going to be
|
||||
# working... Cisco Bug id CSCty97033.
|
||||
# SXI is not working (up to at least relase SXI9).
|
||||
# SXJ is working at SXJ3 (not before).
|
||||
|
||||
return $c6500->mau_set_i_duplex_admin( $duplex, $iid );
|
||||
}
|
||||
|
||||
my $el_duplex = $c6500->el_duplex($iid);
|
||||
|
||||
# Auto duplex only supported on newer software
|
||||
if ( defined $el_duplex and scalar( keys %$el_duplex ) ) {
|
||||
my $p_port = $c6500->p_port() || {};
|
||||
my %reverse_p_port = reverse %$p_port;
|
||||
|
||||
$duplex = lc($duplex);
|
||||
|
||||
return 0 unless defined $duplexes{$duplex};
|
||||
|
||||
$iid = $reverse_p_port{$iid};
|
||||
|
||||
return $c6500->set_p_duplex( $duplexes{$duplex}, $iid );
|
||||
}
|
||||
else {
|
||||
return $c6500->SUPER::set_i_duplex_admin( $duplex, $iid );
|
||||
}
|
||||
}
|
||||
|
||||
sub set_i_speed_admin {
|
||||
my $c6500 = shift;
|
||||
my ( $speed, $iid ) = @_;
|
||||
|
||||
if ( $c6500->is_virtual_switch() ) {
|
||||
|
||||
# VSS -> MAU
|
||||
# Due to VSS bug
|
||||
# 1. Set the ifMauDefaultType
|
||||
# 2. Disable ifMauAutoNegAdminStatus
|
||||
# If the second set is not done, this is not going to be working...
|
||||
# Cisco Bug id CSCty97033.
|
||||
# SXI is not working (at least up to relase SXI9).
|
||||
# SXJ is working at SXJ3 (not before).
|
||||
|
||||
return $c6500->mau_set_i_speed_admin( $speed, $iid );
|
||||
}
|
||||
else {
|
||||
|
||||
# normal behavior using the CiscoStack method
|
||||
return $c6500->SUPER::set_i_speed_admin( $speed, $iid );
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer3::C6500 - SNMP Interface to Cisco Catalyst 6500 Layer 2/3
|
||||
Switches running IOS and/or CatOS
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Max Baker
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $c6500 = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
# These arguments are passed directly to SNMP::Session
|
||||
DestHost => 'myswitch',
|
||||
Community => 'public',
|
||||
Version => 2
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $c6500->class();
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Abstraction subclass for Cisco Catalyst 6500 Layer 2/3 Switches.
|
||||
|
||||
These devices run IOS but have some of the same characteristics as the
|
||||
Catalyst WS-C family (5xxx). For example, forwarding tables are held in
|
||||
VLANs, and extended interface information is gleaned from F<CISCO-SWITCH-MIB>.
|
||||
|
||||
For speed or debugging purposes you can call the subclass directly, but not
|
||||
after determining a more specific class using the method above.
|
||||
|
||||
my $c6500 = new SNMP::Info::Layer3::C6500(...);
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info::CiscoStack
|
||||
|
||||
=item SNMP::Info::Layer3::CiscoSwitch
|
||||
|
||||
=item SNMP::Info::MAU
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item Inherited Classes' MIBs
|
||||
|
||||
See L<SNMP::Info::CiscoStack/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
See L<SNMP::Info::Layer3::CiscoSwitch/"Required MIBs"> for its own MIB
|
||||
requirements.
|
||||
|
||||
See L<SNMP::Info::MAU/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
=back
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar value from SNMP
|
||||
|
||||
=over
|
||||
|
||||
=item $c6500->vendor()
|
||||
|
||||
Returns 'cisco'
|
||||
|
||||
=item $c6500->cvsSwitchMode()
|
||||
|
||||
Returns the Switch status: multiNode or standalone.
|
||||
|
||||
=item $c6500->is_virtual_switch()
|
||||
|
||||
Return 1 if the switch (C<cvsSwitchMode>) is in multimode (VSS).
|
||||
|
||||
=item $c6500->serial()
|
||||
|
||||
Returns serial number of unit (falls back to C<entPhysicalSerialNum>).
|
||||
|
||||
=back
|
||||
|
||||
=head2 Globals imported from SNMP::Info::CiscoStack
|
||||
|
||||
See documentation in L<SNMP::Info::CiscoStack/"GLOBALS"> for details.
|
||||
|
||||
=head2 Globals imported from SNMP::Info::Layer3::CiscoSwitch
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3::CiscoSwitch/"GLOBALS"> for details.
|
||||
|
||||
=head2 Globals imported from SNMP::Info::MAU
|
||||
|
||||
See documentation in L<SNMP::Info::MAU/"GLOBALS"> for details.
|
||||
|
||||
=head1 TABLE METHODS
|
||||
|
||||
These are methods that return tables of information in the form of a reference
|
||||
to a hash.
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=over
|
||||
|
||||
=item $c6500->i_duplex()
|
||||
|
||||
Returns reference to hash of iid to current link duplex setting.
|
||||
|
||||
Newer software versions return duplex based upon the result of
|
||||
$c6500->el_duplex(). Otherwise it uses the result of the call to
|
||||
CiscoStack::i_duplex().
|
||||
|
||||
See L<SNMP::Info::Etherlike> for el_duplex() method and
|
||||
L<SNMP::Info::CiscoStack> for its i_duplex() method.
|
||||
|
||||
=item $c6500->i_duplex_admin()
|
||||
|
||||
Returns reference to hash of iid to administrative duplex setting.
|
||||
|
||||
Newer software versions return duplex based upon the result of
|
||||
$c6500->p_duplex(). Otherwise it uses the result of the call to
|
||||
CiscoStack::i_duplex().
|
||||
|
||||
See L<SNMP::Info::CiscoStack> for its i_duplex() and p_duplex() methods.
|
||||
|
||||
=item $c6500->set_i_duplex_admin(duplex, ifIndex)
|
||||
|
||||
Sets port duplex, must be supplied with duplex and port C<ifIndex>.
|
||||
|
||||
Speed choices are 'auto', 'half', 'full'.
|
||||
|
||||
Crosses $c6500->p_port() with $c6500->p_duplex() to utilize port C<ifIndex>.
|
||||
|
||||
Example:
|
||||
my %if_map = reverse %{$c6500->interfaces()};
|
||||
$c6500->set_i_duplex_admin('auto', $if_map{'FastEthernet0/1'})
|
||||
or die "Couldn't change port duplex. ",$c6500->error(1);
|
||||
|
||||
=item $c6500->set_i_speed_admin(speed, ifIndex)
|
||||
|
||||
Sets port speed, must be supplied with speed and port C<ifIndex>.
|
||||
|
||||
Speed choices are '10', '100', '1000'.
|
||||
|
||||
Crosses $c6500->p_port() with $c6500->p_speed() to utilize port C<ifIndex>.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::CiscoStack
|
||||
|
||||
See documentation in L<SNMP::Info::CiscoStack/"TABLE METHODS"> for details.
|
||||
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer3::CiscoSwitch
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3::CiscoSwitch/"TABLE METHODS"> for
|
||||
details.
|
||||
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::MAU
|
||||
|
||||
See documentation in L<SNMP::Info::MAU/"TABLE METHODS"> for details.
|
||||
|
||||
=cut
|
||||
353
lib/SNMP/Info/Layer3/Cisco.pm
Normal file
353
lib/SNMP/Info/Layer3/Cisco.pm
Normal file
@@ -0,0 +1,353 @@
|
||||
# SNMP::Info::Layer3::Cisco
|
||||
# $Id$
|
||||
#
|
||||
# Copyright (c) 2008 Max Baker
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the University of California, Santa Cruz nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer3::Cisco;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Exporter;
|
||||
use SNMP::Info::CiscoVTP;
|
||||
use SNMP::Info::LLDP;
|
||||
use SNMP::Info::CDP;
|
||||
use SNMP::Info::CiscoStats;
|
||||
use SNMP::Info::CiscoRTT;
|
||||
use SNMP::Info::CiscoQOS;
|
||||
use SNMP::Info::CiscoConfig;
|
||||
use SNMP::Info::CiscoPower;
|
||||
use SNMP::Info::CiscoStpExtensions;
|
||||
use SNMP::Info::Layer3;
|
||||
|
||||
@SNMP::Info::Layer3::Cisco::ISA = qw/SNMP::Info::CiscoVTP
|
||||
SNMP::Info::LLDP SNMP::Info::CDP
|
||||
SNMP::Info::CiscoStats SNMP::Info::CiscoRTT
|
||||
SNMP::Info::CiscoQOS SNMP::Info::CiscoConfig
|
||||
SNMP::Info::CiscoPower SNMP::Info::CiscoStpExtensions
|
||||
SNMP::Info::Layer3
|
||||
Exporter/;
|
||||
@SNMP::Info::Layer3::Cisco::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/;
|
||||
|
||||
$VERSION = '3.35';
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer3::MIBS,
|
||||
%SNMP::Info::CiscoStpExtensions::MIBS,
|
||||
%SNMP::Info::CiscoPower::MIBS,
|
||||
%SNMP::Info::CiscoConfig::MIBS,
|
||||
%SNMP::Info::CiscoQOS::MIBS,
|
||||
%SNMP::Info::CiscoRTT::MIBS,
|
||||
%SNMP::Info::CiscoStats::MIBS,
|
||||
%SNMP::Info::CDP::MIBS,
|
||||
%SNMP::Info::LLDP::MIBS,
|
||||
%SNMP::Info::CiscoVTP::MIBS,
|
||||
'CISCO-EIGRP-MIB' => 'cEigrpAsRouterId',
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer3::GLOBALS,
|
||||
%SNMP::Info::CiscoStpExtensions::GLOBALS,
|
||||
%SNMP::Info::CiscoPower::GLOBALS,
|
||||
%SNMP::Info::CiscoConfig::GLOBALS,
|
||||
%SNMP::Info::CiscoQOS::GLOBALS,
|
||||
%SNMP::Info::CiscoRTT::GLOBALS,
|
||||
%SNMP::Info::CiscoStats::GLOBALS,
|
||||
%SNMP::Info::CDP::GLOBALS,
|
||||
%SNMP::Info::LLDP::GLOBALS,
|
||||
%SNMP::Info::CiscoVTP::GLOBALS,
|
||||
'eigrp_id' => 'cEigrpAsRouterId',
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer3::FUNCS,
|
||||
%SNMP::Info::CiscoStpExtensions::FUNCS,
|
||||
%SNMP::Info::CiscoPower::FUNCS,
|
||||
%SNMP::Info::CiscoConfig::FUNCS,
|
||||
%SNMP::Info::CiscoQOS::FUNCS,
|
||||
%SNMP::Info::CiscoRTT::FUNCS,
|
||||
%SNMP::Info::CiscoStats::FUNCS,
|
||||
%SNMP::Info::CDP::FUNCS,
|
||||
%SNMP::Info::LLDP::FUNCS,
|
||||
%SNMP::Info::CiscoVTP::FUNCS,
|
||||
|
||||
# EIGRP
|
||||
'eigrp_peers' => 'cEigrpPeerAddr',
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
%SNMP::Info::Layer3::MUNGE,
|
||||
%SNMP::Info::CiscoStpExtensions::MUNGE,
|
||||
%SNMP::Info::CiscoPower::MUNGE,
|
||||
%SNMP::Info::CiscoConfig::MUNGE,
|
||||
%SNMP::Info::CiscoQOS::MUNGE,
|
||||
%SNMP::Info::CiscoRTT::MUNGE,
|
||||
%SNMP::Info::CiscoStats::MUNGE,
|
||||
%SNMP::Info::CDP::MUNGE,
|
||||
%SNMP::Info::LLDP::MUNGE,
|
||||
%SNMP::Info::CiscoVTP::MUNGE,
|
||||
'eigrp_peers' => \&SNMP::Info::munge_ip,
|
||||
);
|
||||
|
||||
sub i_vlan {
|
||||
my $cisco = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $i_type = $cisco->i_type($partial);
|
||||
my $i_descr = $cisco->i_description($partial);
|
||||
my $i_vlan = $cisco->SUPER::i_vlan($partial);
|
||||
|
||||
foreach my $idx ( keys %$i_descr ) {
|
||||
next unless $i_type->{$idx};
|
||||
if ( $i_type->{$idx} eq 'l2vlan'
|
||||
|| $i_type->{$idx} eq '135' && !defined $i_vlan->{$idx} )
|
||||
{
|
||||
if ( $i_descr->{$idx} =~ /\.(\d+)$/ ) {
|
||||
$i_vlan->{$idx} = $1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $i_vlan;
|
||||
}
|
||||
|
||||
sub cisco_comm_indexing {
|
||||
my $cisco = shift;
|
||||
# If we get a VTP version, it's *extremely* likely that the device needs community based indexing
|
||||
my $vtp = $cisco->vtp_version() || '0';
|
||||
return ($vtp ne '0');
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer3::Cisco - SNMP Interface to L3 and L2+L3 IOS Cisco Device
|
||||
that are not covered in other classes and the base L3 Cisco class for other
|
||||
device specific L3 Cisco classes.
|
||||
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Max Baker
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $cisco = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
# These arguments are passed directly to SNMP::Session
|
||||
DestHost => 'myswitch',
|
||||
Community => 'public',
|
||||
Version => 2
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $cisco->class();
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Subclass for Generic Cisco Routers running IOS and the base L3 Cisco class
|
||||
for other device specific L3 Cisco classes.
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info::CiscoVTP
|
||||
|
||||
=item SNMP::Info::LLDP
|
||||
|
||||
=item SNMP::Info::CDP
|
||||
|
||||
=item SNMP::Info::CiscoStats
|
||||
|
||||
=item SNMP::Info::CiscoRTT
|
||||
|
||||
=item SNMP::Info::CiscoQOS
|
||||
|
||||
=item SNMP::Info::CiscoConfig
|
||||
|
||||
=item SNMP::Info::Power
|
||||
|
||||
=item SNMP::Info::CiscoStpExtensions
|
||||
|
||||
=item SNMP::Info::Layer3
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item F<CISCO-EIGRP-MIB>
|
||||
|
||||
=item Inherited Classes' MIBs
|
||||
|
||||
See L<SNMP::Info::CiscoVTP/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
See L<SNMP::Info::LLDP/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
See L<SNMP::Info::CDP/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
See L<SNMP::Info::CiscoStats/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
See L<SNMP::Info::CiscoRTT/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
See L<SNMP::Info::CiscoQOS/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
See L<SNMP::Info::CiscoConfig/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
See L<SNMP::Info::CiscoPower/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
See L<SNMP::Info::CiscoStpExtensions/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
See L<SNMP::Info::Layer3/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
=back
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar value from SNMP
|
||||
|
||||
=over
|
||||
|
||||
=item $cisco->eigrp_id()
|
||||
|
||||
(C<cEigrpAsRouterId>)
|
||||
|
||||
=item $switch->cisco_comm_indexing()
|
||||
|
||||
Returns 1 when the device is likely to need vlan indexing.
|
||||
Determined by checking C<vtpVersion>.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Global Methods imported from SNMP::Info::CiscoVTP
|
||||
|
||||
See documentation in L<SNMP::Info::CiscoVTP/"GLOBALS"> for details.
|
||||
|
||||
=head2 Globals imported from SNMP::Info::LLDP
|
||||
|
||||
See documentation in L<SNMP::Info::LLDP/"GLOBALS"> for details.
|
||||
|
||||
=head2 Globals imported from SNMP::Info::CDP
|
||||
|
||||
See documentation in L<SNMP::Info::CDP/"GLOBALS"> for details.
|
||||
|
||||
=head2 Globals imported from SNMP::Info::CiscoStats
|
||||
|
||||
See documentation in L<SNMP::Info::CiscoStats/"GLOBALS"> for details.
|
||||
|
||||
=head2 Globals imported from SNMP::Info::CiscoRTT
|
||||
|
||||
See documentation in L<SNMP::Info::CiscoRTT/"GLOBALS"> for details.
|
||||
|
||||
=head2 Globals imported from SNMP::Info::CiscoQOS
|
||||
|
||||
See documentation in L<SNMP::Info::CiscoQOS/"GLOBALS"> for details.
|
||||
|
||||
=head2 Globals imported from SNMP::Info::CiscoConfig
|
||||
|
||||
See documentation in L<SNMP::Info::CiscoConfig/"GLOBALS"> for details.
|
||||
|
||||
=head2 Globals imported from SNMP::Info::CiscoPower
|
||||
|
||||
See documentation in L<SNMP::Info::CiscoPower/"GLOBALS"> for details.
|
||||
|
||||
=head2 Globals imported from SNMP::Info::CiscoStpExtensions
|
||||
|
||||
See documentation in L<SNMP::Info::CiscoStpExtensions/"GLOBALS"> for details.
|
||||
|
||||
=head2 Globals imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"GLOBALS"> for details.
|
||||
|
||||
=head1 TABLE METHODS
|
||||
|
||||
These are methods that return tables of information in the form of a reference
|
||||
to a hash.
|
||||
|
||||
=over
|
||||
|
||||
=item $cisco->eigrp_peers()
|
||||
|
||||
Returns EIGRP peer IP addresses
|
||||
|
||||
(C<cEigrpPeerAddr>)
|
||||
|
||||
=item $cisco->i_vlan()
|
||||
|
||||
Returns a mapping between C<ifIndex> and the PVID or default VLAN.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::CiscoVTP
|
||||
|
||||
See documentation in L<SNMP::Info::CiscoVTP/"TABLE METHODS"> for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::LLDP
|
||||
|
||||
See documentation in L<SNMP::Info::LLDP/"TABLE METHODS"> for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::CDP
|
||||
|
||||
See documentation in L<SNMP::Info::CDP/"TABLE METHODS"> for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::CiscoStats
|
||||
|
||||
See documentation in L<SNMP::Info::CiscoStats/"TABLE METHODS"> for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::CiscoRTT
|
||||
|
||||
See documentation in L<SNMP::Info::CiscoRTT/"TABLE METHODS"> for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::CiscoQOS
|
||||
|
||||
See documentation in L<SNMP::Info::CiscoQOS/"TABLE METHODS"> for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::CiscoConfig
|
||||
|
||||
See documentation in L<SNMP::Info::CiscoConfig/"TABLE METHODS"> for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::CiscoPower
|
||||
|
||||
See documentation in L<SNMP::Info::CiscoPower/"TABLE METHODS"> for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::CiscoStpExtensions
|
||||
|
||||
See documentation in L<SNMP::Info::CiscoStpExtensions/"TABLE METHODS"> for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details.
|
||||
|
||||
=cut
|
||||
195
lib/SNMP/Info/Layer3/CiscoASA.pm
Normal file
195
lib/SNMP/Info/Layer3/CiscoASA.pm
Normal file
@@ -0,0 +1,195 @@
|
||||
# SNMP::Info::Layer3::CiscoASA
|
||||
# $Id$
|
||||
#
|
||||
# Copyright (c) 2013 Moe Kraus
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the University of California, Santa Cruz nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR
|
||||
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer3::CiscoASA;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Exporter;
|
||||
use SNMP::Info::CiscoStats;
|
||||
use SNMP::Info::Layer3;
|
||||
|
||||
@SNMP::Info::Layer3::CiscoASA::ISA = qw/
|
||||
SNMP::Info::CiscoStats
|
||||
SNMP::Info::Layer3
|
||||
Exporter/;
|
||||
@SNMP::Info::Layer3::CiscoASA::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/;
|
||||
|
||||
$VERSION = '3.35';
|
||||
|
||||
%MIBS = ( %SNMP::Info::Layer3::MIBS, %SNMP::Info::CiscoStats::MIBS, );
|
||||
|
||||
%GLOBALS
|
||||
= ( %SNMP::Info::Layer3::GLOBALS, %SNMP::Info::CiscoStats::GLOBALS, );
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer3::FUNCS,
|
||||
%SNMP::Info::CiscoStats::FUNCS,
|
||||
'mac_table' => 'ifPhysAddress',
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
%SNMP::Info::Layer3::MUNGE,
|
||||
%SNMP::Info::CiscoStats::MUNGE,
|
||||
'mac_table' => \&SNMP::Info::munge_mac,
|
||||
);
|
||||
|
||||
sub b_mac {
|
||||
my ($asa) = shift;
|
||||
my $macs = $asa->mac_table();
|
||||
my @macs;
|
||||
|
||||
# gather physical addresses
|
||||
foreach my $i ( keys %$macs ) {
|
||||
my $mac = $macs->{$i};
|
||||
|
||||
# don't catch the bad macs with zeroed OUI
|
||||
if ( $mac !~ m/(0{1,2}:){3}/ ) {
|
||||
push( @macs, $mac );
|
||||
}
|
||||
@macs = sort(@macs);
|
||||
}
|
||||
|
||||
# return the least mac
|
||||
return $macs[0];
|
||||
}
|
||||
|
||||
sub i_description {
|
||||
my $self = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $i_descr = $self->orig_i_description($partial) || {};
|
||||
|
||||
foreach my $ifindex ( keys %$i_descr ) {
|
||||
$i_descr->{$ifindex} =~ /'(.*)'/;
|
||||
$i_descr->{$ifindex} = $1
|
||||
if defined $1;
|
||||
}
|
||||
|
||||
return $i_descr;
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer3::CiscoASA - Cisco Adaptive Security Appliance
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Moe Kraus
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $cisco = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
# These arguments are passed directly to SNMP::Session
|
||||
DestHost => 'myswitch',
|
||||
Community => 'public',
|
||||
Version => 2
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $asa->class();
|
||||
print "SNMP::Info determined this device to fall under subclass: $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Subclass for Cisco ASA Devices
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info::CiscoStats
|
||||
|
||||
=item SNMP::Info::Layer3
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item Inherited Classes' MIBs
|
||||
|
||||
See L<SNMP::Info::CiscoStats/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
See L<SNMP::Info::Layer3/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
=back
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar value from SNMP
|
||||
|
||||
=over
|
||||
|
||||
=item $asa->b_mac()
|
||||
|
||||
Returns base mac.
|
||||
Overrides base mac function in L<SNMP::Info::Layer3>.
|
||||
|
||||
=item $asa->i_description()
|
||||
|
||||
Overrides base interface description function in L<SNMP::Info> to return the
|
||||
configured interface name instead of "Adaptive Security Appliance
|
||||
'$configured interface name' interface".
|
||||
|
||||
=back
|
||||
|
||||
=head2 Globals imported from SNMP::Info::CiscoStats
|
||||
|
||||
See documentation in L<SNMP::Info::CiscoStats/"GLOBALS"> for details.
|
||||
|
||||
=head2 Global Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"GLOBALS"> for details.
|
||||
|
||||
=head1 TABLE METHODS
|
||||
|
||||
These are methods that return tables of information in the form of a
|
||||
reference to a hash.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::CiscoStats
|
||||
|
||||
See documentation in L<SNMP::Info::CiscoStats/"TABLE METHODS"> for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details.
|
||||
|
||||
=cut
|
||||
232
lib/SNMP/Info/Layer3/CiscoFWSM.pm
Normal file
232
lib/SNMP/Info/Layer3/CiscoFWSM.pm
Normal file
@@ -0,0 +1,232 @@
|
||||
# SNMP::Info::Layer3::CiscoFWSM
|
||||
# $Id$
|
||||
#
|
||||
# Copyright (c) 2010 Brian De Wolf
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the University of California, Santa Cruz nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer3::CiscoFWSM;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Exporter;
|
||||
use SNMP::Info::CiscoStats;
|
||||
use SNMP::Info::Layer3;
|
||||
|
||||
@SNMP::Info::Layer3::CiscoFWSM::ISA = qw/SNMP::Info::CiscoStats
|
||||
SNMP::Info::Layer3
|
||||
Exporter/;
|
||||
@SNMP::Info::Layer3::CiscoFWSM::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/;
|
||||
|
||||
$VERSION = '3.35';
|
||||
|
||||
%MIBS = ( %SNMP::Info::Layer3::MIBS, %SNMP::Info::CiscoStats::MIBS, );
|
||||
|
||||
%GLOBALS
|
||||
= ( %SNMP::Info::Layer3::GLOBALS, %SNMP::Info::CiscoStats::GLOBALS, );
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer3::FUNCS,
|
||||
%SNMP::Info::CiscoStats::FUNCS,
|
||||
);
|
||||
|
||||
%MUNGE = ( %SNMP::Info::Layer3::MUNGE, %SNMP::Info::CiscoStats::MUNGE, );
|
||||
|
||||
# For FWSMs, the ipNetToPhysicalPhysAddress table appears to be of the form:
|
||||
# $ifindex.$inetaddresstype.$proto.$ip_address -> $mac_address
|
||||
#
|
||||
# Using the output of ipNetToPhysicalPhysAddress, we can emulate the other
|
||||
# functions.
|
||||
#
|
||||
# This doesn't really line up to what at_* return, so we munge it
|
||||
|
||||
sub at_paddr {
|
||||
my ($fwsm) = shift;
|
||||
my ($partial) = shift;
|
||||
|
||||
my $paddrs = $fwsm->n2p_paddr($partial);
|
||||
my $n_paddrs = {};
|
||||
|
||||
foreach my $key ( keys %$paddrs ) {
|
||||
my $paddr = $paddrs->{$key};
|
||||
my @parts = split /\./, $key;
|
||||
my ( $ifindex, $addrtype, $proto ) = splice @parts, 0, 3;
|
||||
my $ip = join ".", @parts;
|
||||
|
||||
next if ( $proto != 4 ); # at_paddr doesn't support non-IPv4
|
||||
|
||||
$n_paddrs->{"$ifindex.$ip"} = $paddr;
|
||||
}
|
||||
return $n_paddrs;
|
||||
}
|
||||
|
||||
sub at_netaddr {
|
||||
my ($fwsm) = shift;
|
||||
my ($partial) = shift;
|
||||
|
||||
my $paddrs = $fwsm->n2p_paddr($partial);
|
||||
|
||||
my $netaddrs = {};
|
||||
|
||||
foreach my $key ( keys %$paddrs ) {
|
||||
my $paddr = $paddrs->{$key};
|
||||
my @parts = split /\./, $key;
|
||||
my ( $ifindex, $addrtype, $proto ) = splice @parts, 0, 3;
|
||||
my $ip = join ".", @parts;
|
||||
|
||||
next if ( $proto != 4 ); # at_netaddr doesn't support non-IPv4
|
||||
|
||||
$netaddrs->{"$ifindex.$ip"} = $ip;
|
||||
}
|
||||
return $netaddrs;
|
||||
}
|
||||
|
||||
sub at_ifaddr {
|
||||
my ($fwsm) = shift;
|
||||
my ($partial) = shift;
|
||||
|
||||
my $paddrs = $fwsm->n2p_paddr($partial);
|
||||
|
||||
my $ifaddrs = {};
|
||||
|
||||
foreach my $key ( keys %$paddrs ) {
|
||||
my $paddr = $paddrs->{$key};
|
||||
my @parts = split /\./, $key;
|
||||
my ( $ifindex, $addrtype, $proto ) = splice @parts, 0, 3;
|
||||
my $ip = join ".", @parts;
|
||||
|
||||
next if ( $proto != 4 ); # at_ifaddr doesn't support non-IPv4
|
||||
|
||||
$ifaddrs->{"$ifindex.$ip"} = $ip;
|
||||
}
|
||||
return $ifaddrs;
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer3::CiscoFWSM - SNMP Interface to Firewall Services Modules
|
||||
for features not covered elsewhere.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Brian De Wolf
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $fwsm = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
# These arguments are passed directly to SNMP::Session
|
||||
DestHost => 'myswitch',
|
||||
Community => 'public',
|
||||
Version => 2
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $fwsm->class();
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Subclass for Cisco Firewall Services Modules
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info::CiscoStats
|
||||
|
||||
=item SNMP::Info::Layer3
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item Inherited Classes' MIBs
|
||||
|
||||
See L<SNMP::Info::CiscoStats/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
See L<SNMP::Info::Layer3/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
=back
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
=head2 Globals imported from SNMP::Info::CiscoStats
|
||||
|
||||
See documentation in L<SNMP::Info::CiscoStats/"GLOBALS"> for details.
|
||||
|
||||
=head2 Global Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"GLOBALS"> for details.
|
||||
|
||||
=head1 TABLE METHODS
|
||||
|
||||
These are methods that return tables of information in the form of a reference
|
||||
to a hash.
|
||||
|
||||
=over
|
||||
|
||||
=back
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=over
|
||||
|
||||
=item $fwsm->at_paddr()
|
||||
|
||||
This function derives the at_paddr information from the n2p_paddr() table as
|
||||
the MIB to provide that information isn't supported on FWSM.
|
||||
|
||||
=item $fwsm->at_netaddr()
|
||||
|
||||
This function derives the at_netaddr information from the n2p_paddr() table as
|
||||
the MIB to provide that information isn't supported on FWSM.
|
||||
|
||||
=item $fwsm->at_ifaddr()
|
||||
|
||||
This function derives the at_ifaddr information from the n2p_paddr() table as
|
||||
the MIB to provide that information isn't supported on FWSM.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::CiscoStats
|
||||
|
||||
See documentation in L<SNMP::Info::CiscoStats/"TABLE METHODS"> for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details.
|
||||
|
||||
=cut
|
||||
190
lib/SNMP/Info/Layer3/CiscoSwitch.pm
Normal file
190
lib/SNMP/Info/Layer3/CiscoSwitch.pm
Normal file
@@ -0,0 +1,190 @@
|
||||
# SNMP::Info::Layer3::CiscoSwitch
|
||||
# $Id$
|
||||
#
|
||||
# Copyright (c) 2014 Eric Miller
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the University of California, Santa Cruz nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer3::CiscoSwitch;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Exporter;
|
||||
use SNMP::Info::CiscoAgg;
|
||||
use SNMP::Info::CiscoPortSecurity;
|
||||
use SNMP::Info::Layer3::Cisco;
|
||||
|
||||
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/;
|
||||
|
||||
@SNMP::Info::Layer3::CiscoSwitch::ISA = qw/
|
||||
SNMP::Info::CiscoAgg
|
||||
SNMP::Info::CiscoPortSecurity
|
||||
SNMP::Info::Layer3::Cisco
|
||||
Exporter
|
||||
/;
|
||||
|
||||
@SNMP::Info::Layer3::CiscoSwitch::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/;
|
||||
|
||||
$VERSION = '3.35';
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer3::Cisco::MIBS,
|
||||
%SNMP::Info::CiscoPortSecurity::MIBS,
|
||||
%SNMP::Info::CiscoAgg::MIBS,
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer3::Cisco::GLOBALS,
|
||||
%SNMP::Info::CiscoPortSecurity::GLOBALS,
|
||||
%SNMP::Info::CiscoAgg::GLOBALS,
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer3::Cisco::FUNCS,
|
||||
%SNMP::Info::CiscoPortSecurity::FUNCS,
|
||||
%SNMP::Info::CiscoAgg::FUNCS,
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
%SNMP::Info::Layer3::Cisco::MUNGE,
|
||||
%SNMP::Info::CiscoPortSecurity::MUNGE,
|
||||
%SNMP::Info::CiscoAgg::MUNGE,
|
||||
);
|
||||
|
||||
sub cisco_comm_indexing { return 1; }
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer3::CiscoSwitch - Base class for L3 Cisco switches
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Eric Miller
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $switch = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
# These arguments are passed directly to SNMP::Session
|
||||
DestHost => 'myswitch',
|
||||
Community => 'public',
|
||||
Version => 2
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $switch->class();
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Base subclass for Cisco Layer 2/3 Switches.
|
||||
|
||||
These devices have switch specific characteristics beyond those in
|
||||
traditional routers covered by L<SNMP::Info::Layer3::Cisco>. For example,
|
||||
port security interface information from L<SNMP::Info::CiscoPortSecurity>.
|
||||
|
||||
For speed or debugging purposes you can call the subclass directly, but not
|
||||
after determining a more specific class using the method above.
|
||||
|
||||
my $swich = new SNMP::Info::Layer3::CiscoSwitch(...);
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info::CiscoAgg
|
||||
|
||||
=item SNMP::Info::CiscoPortSecurity
|
||||
|
||||
=item SNMP::Info::Layer3::Cisco
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item Inherited Classes' MIBs
|
||||
|
||||
See L<SNMP::Info::CiscoAgg/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
See L<SNMP::Info::CiscoPortSecurity/"Required MIBs"> for its own MIB
|
||||
requirements.
|
||||
|
||||
See L<SNMP::Info::Layer3::Cisco/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
=back
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar value from SNMP
|
||||
|
||||
=over
|
||||
|
||||
=item $switch->cisco_comm_indexing()
|
||||
|
||||
Returns 1. Use vlan indexing.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Global Methods imported from SNMP::Info::CiscoAgg
|
||||
|
||||
See documentation in L<SNMP::Info::CiscoAgg/"GLOBALS"> for details.
|
||||
|
||||
=head2 Globals imported from SNMP::Info::CiscoPortSecurity
|
||||
|
||||
See documentation in L<SNMP::Info::CiscoPortSecurity/"GLOBALS"> for details.
|
||||
|
||||
=head2 Globals imported from SNMP::Info::Layer3::Cisco
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3::Cisco/"GLOBALS"> for details.
|
||||
|
||||
=head1 TABLE METHODS
|
||||
|
||||
These are methods that return tables of information in the form of a reference
|
||||
to a hash.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::CiscoAgg
|
||||
|
||||
See documentation in L<SNMP::Info::CiscoAgg/"TABLE METHODS"> for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::CiscoPortSecurity
|
||||
|
||||
See documentation in L<SNMP::Info::CiscoPortSecurity/"TABLE METHODS"> for
|
||||
details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer3::Cisco
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3::Cisco/"TABLE METHODS"> for details.
|
||||
|
||||
=cut
|
||||
314
lib/SNMP/Info/Layer3/Contivity.pm
Normal file
314
lib/SNMP/Info/Layer3/Contivity.pm
Normal file
@@ -0,0 +1,314 @@
|
||||
# SNMP::Info::Layer3::Contivity
|
||||
# $Id$
|
||||
#
|
||||
# Copyright (c) 2010 Eric Miller
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the University of California, Santa Cruz nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer3::Contivity;
|
||||
|
||||
use strict;
|
||||
use Exporter;
|
||||
use SNMP::Info;
|
||||
use SNMP::Info::Layer3;
|
||||
use SNMP::Info::Entity;
|
||||
|
||||
@SNMP::Info::Layer3::Contivity::ISA
|
||||
= qw/SNMP::Info SNMP::Info::Layer3 SNMP::Info::Entity Exporter/;
|
||||
@SNMP::Info::Layer3::Contivity::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/;
|
||||
|
||||
$VERSION = '3.35';
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::MIBS, %SNMP::Info::Layer3::MIBS, %SNMP::Info::Entity::MIBS,
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::GLOBALS, %SNMP::Info::Layer3::GLOBALS,
|
||||
%SNMP::Info::Entity::GLOBALS,
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::FUNCS, %SNMP::Info::Layer3::FUNCS,
|
||||
%SNMP::Info::Entity::FUNCS,
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
%SNMP::Info::MUNGE, %SNMP::Info::Layer3::MUNGE,
|
||||
%SNMP::Info::Entity::MUNGE,
|
||||
);
|
||||
|
||||
sub layers {
|
||||
return '00000100';
|
||||
}
|
||||
|
||||
sub vendor {
|
||||
return 'avaya';
|
||||
}
|
||||
|
||||
sub model {
|
||||
my $contivity = shift;
|
||||
my $e_model = $contivity->e_model() || {};
|
||||
|
||||
my $model = $e_model->{1} || undef;
|
||||
|
||||
return $1 if ( defined $model and $model =~ /(CES\d+|NVR\d+)/i );
|
||||
return;
|
||||
}
|
||||
|
||||
sub os {
|
||||
return 'contivity';
|
||||
}
|
||||
|
||||
sub os_ver {
|
||||
my $contivity = shift;
|
||||
my $descr = $contivity->description();
|
||||
return unless defined $descr;
|
||||
|
||||
if ( $descr =~ m/V(\d+_\d+\.\d+)/i ) {
|
||||
return $1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
sub mac {
|
||||
my $contivity = shift;
|
||||
my $i_mac = $contivity->i_mac();
|
||||
|
||||
# Return Interface MAC
|
||||
foreach my $entry ( keys %$i_mac ) {
|
||||
my $sn = $i_mac->{$entry};
|
||||
next unless $sn;
|
||||
return $sn;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
sub serial {
|
||||
my $contivity = shift;
|
||||
my $e_serial = $contivity->e_serial() || {};
|
||||
|
||||
my $serial = $e_serial->{1} || undef;
|
||||
|
||||
return $1 if ( defined $serial and $serial =~ /(\d+)/ );
|
||||
return;
|
||||
}
|
||||
|
||||
sub interfaces {
|
||||
my $contivity = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $description = $contivity->i_description($partial) || {};
|
||||
|
||||
my %interfaces = ();
|
||||
foreach my $iid ( keys %$description ) {
|
||||
my $desc = $description->{$iid};
|
||||
|
||||
# Skip everything except Ethernet interfaces
|
||||
next unless ( defined $desc and $desc =~ /fe/i );
|
||||
|
||||
$interfaces{$iid} = $desc;
|
||||
}
|
||||
return \%interfaces;
|
||||
}
|
||||
|
||||
sub i_name {
|
||||
my $contivity = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $i_name2 = $contivity->orig_i_name($partial) || {};
|
||||
|
||||
my %i_name;
|
||||
foreach my $iid ( keys %$i_name2 ) {
|
||||
my $name = $i_name2->{$iid};
|
||||
|
||||
#Skip everything except Ethernet interfaces
|
||||
next unless ( defined $name and $name =~ /fe/i );
|
||||
|
||||
$name = $1 if $name =~ /(fei\.\d+\.\d+)/;
|
||||
|
||||
$i_name{$iid} = $name;
|
||||
}
|
||||
return \%i_name;
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer3::Contivity - SNMP Interface to Avaya/Nortel VPN Routers
|
||||
(formerly Contivity Extranet Switches).
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Eric Miller
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $contivity = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
DestHost => 'myswitch',
|
||||
Community => 'public',
|
||||
Version => 2
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $contivity->class();
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Abstraction subclass for Avaya/Nortel VPN Routers (formerly Contivity
|
||||
Extranet Switch).
|
||||
|
||||
For speed or debugging purposes you can call the subclass directly, but not
|
||||
after determining a more specific class using the method above.
|
||||
|
||||
my $contivity = new SNMP::Info::Layer3::Contivity(...);
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info
|
||||
|
||||
=item SNMP::Info::Layer3
|
||||
|
||||
=item SNMP::Info::Entity
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item Inherited Classes' MIBs
|
||||
|
||||
See L<SNMP::Info/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
See L<SNMP::Info::Layer3/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
See L<SNMP::Info::Entity/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
=back
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar value from SNMP
|
||||
|
||||
=over
|
||||
|
||||
=item $contivity->vendor()
|
||||
|
||||
Returns 'avaya'
|
||||
|
||||
=item $contivity->model()
|
||||
|
||||
Returns the chassis name.
|
||||
|
||||
(C<entPhysicalModelName.1>)
|
||||
|
||||
=item $contivity->os()
|
||||
|
||||
Returns C<'CES'>
|
||||
|
||||
=item $contivity->os_ver()
|
||||
|
||||
Returns the software version extracted from (C<sysDescr>).
|
||||
|
||||
=item $contivity->serial()
|
||||
|
||||
Returns the chassis serial number.
|
||||
|
||||
(C<entPhysicalSerialNum.1>)
|
||||
|
||||
=item $contivity->mac()
|
||||
|
||||
Returns the MAC address of the first Ethernet Interface.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=over
|
||||
|
||||
=item $contivity->layers()
|
||||
|
||||
Returns 00000100. Contivity does not support bridge MIB, so override reported
|
||||
layers.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Globals imported from SNMP::Info
|
||||
|
||||
See documentation in L<SNMP::Info/"GLOBALS"> for details.
|
||||
|
||||
=head2 Globals imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"GLOBALS"> for details.
|
||||
|
||||
=head2 Globals imported from SNMP::Info::Entity
|
||||
|
||||
See documentation in L<SNMP::Info::Entity/"GLOBALS"> for details.
|
||||
|
||||
=head1 TABLE METHODS
|
||||
|
||||
These are methods that return tables of information in the form of a reference
|
||||
to a hash.
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=over
|
||||
|
||||
=item $contivity->interfaces()
|
||||
|
||||
Returns reference to the map between IID and physical Port. Skips loopback
|
||||
and tunnel interfaces.
|
||||
|
||||
=item $contivity->i_name()
|
||||
|
||||
Interface Name field. Skips loopback and tunnel interfaces.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info
|
||||
|
||||
See documentation in L<SNMP::Info/"TABLE METHODS"> for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Entity
|
||||
|
||||
See documentation in L<SNMP::Info::Entity/"TABLE METHODS"> for details.
|
||||
|
||||
=cut
|
||||
126
lib/SNMP/Info/Layer3/DLink.pm
Normal file
126
lib/SNMP/Info/Layer3/DLink.pm
Normal file
@@ -0,0 +1,126 @@
|
||||
package SNMP::Info::Layer3::DLink;
|
||||
|
||||
use strict;
|
||||
use Exporter;
|
||||
use SNMP::Info::Layer3;
|
||||
use SNMP::Info::LLDP;
|
||||
|
||||
@SNMP::Info::Layer3::DLink::ISA = qw/SNMP::Info::LLDP SNMP::Info::Layer3 Exporter/;
|
||||
@SNMP::Info::Layer3::DLink::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/;
|
||||
|
||||
$VERSION = '3.35';
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer3::MIBS,
|
||||
%SNMP::Info::LLDP::MIBS,
|
||||
'DLINK-ID-REC-MIB' => 'dlink',
|
||||
'SWPRIMGMT-DES3200-MIB' => 'dlink-des3200SeriesProd',
|
||||
'SWPRIMGMT-DES30XXP-MIB' => 'dlink-des30xxproductProd',
|
||||
'SWPRIMGMT-DES1228ME-MIB' => 'dlink-des1228MEproductProd',
|
||||
'SWDES3528-52PRIMGMT-MIB' => 'dlink-Des3500Series',
|
||||
'DES-1210-28-AX' => 'des-1210-28ax',
|
||||
'DES-1210-10MEbx' => 'des-1210-10mebx',
|
||||
'DES-1210-26MEbx' => 'des-1210-26mebx',
|
||||
'DES-1210-52-BX' => 'des-1210-52bx',
|
||||
'DES-1210-52-CX' => 'des-1210-52-cx',
|
||||
'DGS-1210-24-AX' => 'dgs-1210-24ax',
|
||||
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer3::GLOBALS,
|
||||
%SNMP::Info::LLDP::GLOBALS,
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer3::FUNCS,
|
||||
%SNMP::Info::LLDP::FUNCS,
|
||||
'dlink_fw' => 'probeSoftwareRev',
|
||||
'dlink_hw' => 'probeHardwareRev',
|
||||
'dlink_stp_i_root_port' => 'MSTP_MIB__swMSTPInstRootPort',
|
||||
'dlink_serial_no' => 'AGENT_GENERAL_MIB__agentSerialNumber',
|
||||
);
|
||||
|
||||
%MUNGE = ( %SNMP::Info::Layer3::MUNGE, %SNMP::Info::LLDP::MUNGE, );
|
||||
|
||||
sub model {
|
||||
my $dlink=shift;
|
||||
my $id = $dlink->id();
|
||||
my $model = &SNMP::translateObj($id);
|
||||
return $id unless defined $model;
|
||||
if (defined $model && $model !~ /dlink-products/) {
|
||||
return $model;
|
||||
} else {
|
||||
#If don't have a device MIB
|
||||
return $dlink->description();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub vendor {
|
||||
return 'dlink';
|
||||
}
|
||||
|
||||
sub serial {
|
||||
my $dlink = shift;
|
||||
my $model = $dlink->model();
|
||||
my $id = $dlink->id();
|
||||
my $serial;
|
||||
if ($model =~ /1210/) {
|
||||
#Due to the zoo of MIB from DLink by 1210 series
|
||||
$serial->{0} = $dlink->session()->get($id.'.1.30.0');
|
||||
} else {
|
||||
$serial = $dlink->dlink_serial_no();
|
||||
}
|
||||
|
||||
return $serial->{0} if ( defined $serial->{0} and $serial->{0} !~ /^\s*$/ and $serial->{0} !~ 'NOSUCHOBJECT' );
|
||||
return $dlink->SUPER::serial();
|
||||
}
|
||||
|
||||
sub fwver {
|
||||
my $dlink=shift;
|
||||
my $model = $dlink->model();
|
||||
my $id = $dlink->id();
|
||||
my $fw;
|
||||
if ($model =~ /1210/) {
|
||||
#Due to the zoo of MIB from DLink by 1210 series
|
||||
$fw->{0} = $dlink->session()->get($id.'.1.3.0');
|
||||
} else {
|
||||
$fw = $dlink->dlink_fw();
|
||||
}
|
||||
return $fw->{0} if ( defined $fw->{0} and $fw->{0} !~ /^\s*$/ and $fw->{0} !~ 'NOSUCHOBJECT');
|
||||
}
|
||||
|
||||
sub hwver {
|
||||
my $dlink=shift;
|
||||
my $model = $dlink->model();
|
||||
my $id = $dlink->id();
|
||||
my $hw;
|
||||
if ($model =~ /1210/) {
|
||||
#Due to the zoo of MIB from DLink by 1210 series
|
||||
$hw->{0} = $dlink->session()->get($id.'.1.2.0');
|
||||
} else {
|
||||
$hw = $dlink->dlink_hw();
|
||||
}
|
||||
return $hw->{0} if ( defined $hw->{0} and $hw->{0} !~ /^\s*$/ and $hw->{0} !~ 'NOSUCHOBJECT');
|
||||
}
|
||||
|
||||
sub stp_i_root_port {
|
||||
my $dlink=shift;
|
||||
my $model = $dlink->model();
|
||||
my $id = $dlink->id();
|
||||
my $stp_i_root_port;
|
||||
if ($model =~ /1210-(?:10|26)/) {
|
||||
#Due to the zoo of MIB from DLink by 1210 series
|
||||
$stp_i_root_port->{0} = $dlink->session()->get($id.'.6.1.13.0');
|
||||
} else {
|
||||
$stp_i_root_port = $dlink->dlink_stp_i_root_port();
|
||||
}
|
||||
return $stp_i_root_port if ( defined $stp_i_root_port->{0} and $stp_i_root_port->{0} !~ /^\s*$/ and $stp_i_root_port->{0} !~ 'NOSUCHOBJECT');
|
||||
return $dlink->SUPER::stp_i_root_port();
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
||||
470
lib/SNMP/Info/Layer3/Dell.pm
Normal file
470
lib/SNMP/Info/Layer3/Dell.pm
Normal file
@@ -0,0 +1,470 @@
|
||||
# SNMP::Info::Layer3::Dell - SNMP Interface to Dell devices
|
||||
# $Id$
|
||||
#
|
||||
# Copyright (c) 2008 Eric Miller
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the University of California, Santa Cruz nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer3::Dell;
|
||||
|
||||
use strict;
|
||||
use Exporter;
|
||||
use SNMP::Info::Layer3;
|
||||
use SNMP::Info::LLDP;
|
||||
|
||||
@SNMP::Info::Layer3::Dell::ISA = qw/SNMP::Info::LLDP SNMP::Info::Layer3 Exporter/;
|
||||
@SNMP::Info::Layer3::Dell::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/;
|
||||
|
||||
$VERSION = '3.35';
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer3::MIBS,
|
||||
%SNMP::Info::LLDP::MIBS,
|
||||
'RADLAN-Physicaldescription-MIB' => 'rlPhdStackReorder',
|
||||
'RADLAN-rlInterfaces' => 'rlIfNumOfLoopbackPorts',
|
||||
'RADLAN-HWENVIROMENT' => 'rlEnvPhysicalDescription',
|
||||
'Dell-Vendor-MIB' => 'productIdentificationVersion',
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer3::GLOBALS,
|
||||
%SNMP::Info::LLDP::GLOBALS,
|
||||
'os_ver' => 'productIdentificationVersion',
|
||||
'dell_id_name' => 'productIdentificationDisplayName',
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer3::FUNCS,
|
||||
%SNMP::Info::LLDP::FUNCS,
|
||||
|
||||
# RADLAN-rlInterfaces:swIfTable
|
||||
'dell_duplex_admin' => 'swIfDuplexAdminMode',
|
||||
'dell_duplex' => 'swIfDuplexOperMode',
|
||||
'dell_tag_mode' => 'swIfTaggedMode',
|
||||
'dell_i_type' => 'swIfType',
|
||||
'dell_fc_admin' => 'swIfFlowControlMode',
|
||||
'dell_speed_admin' => 'swIfSpeedAdminMode',
|
||||
'dell_auto' => 'swIfSpeedDuplexAutoNegotiation',
|
||||
'dell_fc' => 'swIfOperFlowControlMode',
|
||||
|
||||
# RADLAN-Physicaldescription-MIB:rlPhdUnitGenParamTable
|
||||
'dell_unit' => 'rlPhdUnitGenParamStackUnit',
|
||||
'dell_sw_ver' => 'rlPhdUnitGenParamSoftwareVersion',
|
||||
'dell_fw_ver' => 'rlPhdUnitGenParamFirmwareVersion',
|
||||
'dell_hw_ver' => 'rlPhdUnitGenParamHardwareVersion',
|
||||
'dell_serial_no' => 'rlPhdUnitGenParamSerialNum',
|
||||
'dell_asset_no' => 'rlPhdUnitGenParamAssetTag',
|
||||
|
||||
# RADLAN-COPY-MIB:rlCopyTable
|
||||
'dell_cp_idx' => 'rlCopyIndex',
|
||||
'dell_cp_sloc' => 'rlCopySourceLocation',
|
||||
'dell_cp_sip' => 'rlCopySourceIpAddress',
|
||||
'dell_cp_sunit' => 'rlCopySourceUnitNumber',
|
||||
'dell_cp_sfile' => 'rlCopySourceFileName',
|
||||
'dell_cp_stype' => 'rlCopySourceFileType',
|
||||
'dell_cp_dloc' => 'rlCopyDestinationLocation',
|
||||
'dell_cp_dip' => 'rlCopyDestinationIpAddress',
|
||||
'dell_cp_dunit' => 'rlCopyDestinationUnitNumber',
|
||||
'dell_cp_dfile' => 'rlCopyDestinationFileName',
|
||||
'dell_cp_dtype' => 'rlCopyDestinationFileType',
|
||||
'dell_cp_state' => 'rlCopyOperationState',
|
||||
'dell_cp_bkgnd' => 'rlCopyInBackground',
|
||||
'dell_cp_rstatus' => 'rlCopyRowStatus',
|
||||
|
||||
# RADLAN-HWENVIROMENT:rlEnvMonSupplyStatusTable
|
||||
'dell_pwr_src' => 'rlEnvMonSupplySource',
|
||||
'dell_pwr_state' => 'rlEnvMonSupplyState',
|
||||
'dell_pwr_desc' => 'rlEnvMonSupplyStatusDescr',
|
||||
|
||||
# RADLAN-HWENVIROMENT:rlEnvMonFanStatusTable
|
||||
'dell_fan_state' => 'rlEnvMonFanState',
|
||||
'dell_fan_desc' => 'rlEnvMonFanStatusDescr',
|
||||
);
|
||||
|
||||
%MUNGE = ( %SNMP::Info::Layer3::MUNGE, %SNMP::Info::LLDP::MUNGE, );
|
||||
|
||||
# Method OverRides
|
||||
|
||||
sub model {
|
||||
my $dell = shift;
|
||||
|
||||
my $name = $dell->dell_id_name();
|
||||
my $descr = $dell->description();
|
||||
|
||||
if ( defined $name and $name =~ m/(\d+)/ ) {
|
||||
return $1;
|
||||
}
|
||||
|
||||
# Don't have a vendor MIB for D-Link
|
||||
else {
|
||||
return $descr;
|
||||
}
|
||||
}
|
||||
|
||||
sub vendor {
|
||||
my $dell = shift;
|
||||
|
||||
return $dell->_vendor();
|
||||
}
|
||||
|
||||
sub os {
|
||||
my $dell = shift;
|
||||
|
||||
return $dell->_vendor();
|
||||
}
|
||||
|
||||
sub serial {
|
||||
my $dell = shift;
|
||||
|
||||
my $numbers = $dell->dell_serial_no();
|
||||
|
||||
foreach my $key ( keys %$numbers ) {
|
||||
my $serial = $numbers->{$key};
|
||||
return $serial if ( defined $serial and $serial !~ /^\s*$/ );
|
||||
next;
|
||||
}
|
||||
|
||||
# Last resort
|
||||
return $dell->SUPER::serial();
|
||||
}
|
||||
|
||||
# check all fans, and report overall status
|
||||
sub fan {
|
||||
my $dell = shift;
|
||||
|
||||
my $fan = $dell->dell_fan_desc() || {};
|
||||
my $state = $dell->dell_fan_state() || {};
|
||||
my @messages = ();
|
||||
|
||||
foreach my $k (keys %$fan) {
|
||||
next if $state->{$k} and $state->{$k} eq 'normal';
|
||||
push @messages, "$fan->{$k}: $state->{$k}";
|
||||
}
|
||||
|
||||
push @messages, ((scalar keys %$fan). " fans OK")
|
||||
if scalar @messages == 0;
|
||||
|
||||
return (join ", ", @messages);
|
||||
}
|
||||
|
||||
sub _ps_status {
|
||||
my ($dell, $unit) = @_;
|
||||
|
||||
my $status = 'unknown';
|
||||
return $status if !defined $unit;
|
||||
|
||||
my $desc = $dell->dell_pwr_desc() || {};
|
||||
my $state = $dell->dell_pwr_state() || {};
|
||||
|
||||
foreach my $k (keys %$desc) {
|
||||
next unless $desc->{$k} and $desc->{$k} eq "ps1_unit$unit";
|
||||
return ($state->{$k} || $status);
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
sub ps1_type { return 'internalRedundant' }
|
||||
sub ps2_type { return 'internalRedundant' }
|
||||
|
||||
sub ps1_status { return (shift)->_ps_status(1) }
|
||||
sub ps2_status { return (shift)->_ps_status(2) }
|
||||
|
||||
sub interfaces {
|
||||
my $dell = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $i_descr = $dell->i_description($partial) || {};
|
||||
my $i_name = $dell->orig_i_name($partial) || {};
|
||||
|
||||
# Descriptions are all the same on some Dells, so use name instead if
|
||||
# available
|
||||
foreach my $iid ( keys %$i_name ) {
|
||||
my $name = $i_name->{$iid};
|
||||
next unless defined $name;
|
||||
$i_descr->{$iid} = $name;
|
||||
}
|
||||
|
||||
return $i_descr;
|
||||
}
|
||||
|
||||
sub i_duplex_admin {
|
||||
my $dell = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $interfaces = $dell->interfaces($partial) || {};
|
||||
my $dell_duplex = $dell->dell_duplex_admin($partial) || {};
|
||||
my $dell_auto = $dell->dell_auto($partial) || {};
|
||||
|
||||
my %i_duplex_admin;
|
||||
foreach my $if ( keys %$interfaces ) {
|
||||
my $duplex = $dell_duplex->{$if};
|
||||
next unless defined $duplex;
|
||||
my $auto = $dell_auto->{$if} || 'false';
|
||||
|
||||
$duplex = 'half' if ( $duplex =~ /half/i and $auto =~ /false/i );
|
||||
$duplex = 'full' if ( $duplex =~ /half/i and $auto =~ /false/i );
|
||||
$duplex = 'auto' if $auto =~ /true/i;
|
||||
$i_duplex_admin{$if} = $duplex;
|
||||
}
|
||||
return \%i_duplex_admin;
|
||||
}
|
||||
|
||||
sub _vendor {
|
||||
my $dell = shift;
|
||||
|
||||
my $id = $dell->id() || 'undef';
|
||||
my %oidmap = (
|
||||
2 => 'ibm',
|
||||
171 => 'dlink',
|
||||
674 => 'dell',
|
||||
3955 => 'linksys',
|
||||
);
|
||||
$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';
|
||||
}
|
||||
}
|
||||
|
||||
# dot1qTpFdbTable uses dot1qVlanIndex rather than dot1qFdbId as index,
|
||||
# so pretend we don't have the mapping
|
||||
sub qb_fdb_index {return}
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer3::Dell - SNMP Interface to Dell Power Connect Network
|
||||
Devices
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Eric Miller
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $dell = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
DestHost => 'myswitch',
|
||||
Community => 'public',
|
||||
Version => 1
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $dell->class();
|
||||
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Provides abstraction to the configuration information obtainable from an
|
||||
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
|
||||
after determining a more specific class using the method above.
|
||||
|
||||
my $dell = new SNMP::Info::Layer3::Dell(...);
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info::Layer3
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item F<Dell-Vendor-MIB>
|
||||
|
||||
=item F<RADLAN-Physicaldescription-MIB>
|
||||
|
||||
=item F<RADLAN-rlInterfaces>
|
||||
|
||||
=item F<RADLAN-HWENVIROMENT>
|
||||
|
||||
=item Inherited Classes' MIBs
|
||||
|
||||
See classes listed above for their required MIBs.
|
||||
|
||||
=back
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar value from SNMP
|
||||
|
||||
=over
|
||||
|
||||
=item $dell->os_ver()
|
||||
|
||||
(C<productIdentificationVersion>)
|
||||
|
||||
=item $dell->dell_id_name()
|
||||
|
||||
(C<productIdentificationDisplayName>)
|
||||
|
||||
=item $dell->model()
|
||||
|
||||
Returns model type. Returns numeric from
|
||||
(C<productIdentificationDisplayName>) if available, otherwise if returns
|
||||
description().
|
||||
|
||||
=item $dell->vendor()
|
||||
|
||||
Returns 'dell', 'dlink', or 'ibm' based upon the IANA enterprise number in
|
||||
id(). Defaults to 'dlink'.
|
||||
|
||||
=item $dell->os()
|
||||
|
||||
Returns 'dell', 'dlink', or 'ibm' based upon the IANA enterprise number in
|
||||
id(). Defaults to 'dlink'.
|
||||
|
||||
=item $dell->fan()
|
||||
|
||||
Return the status of all fans from the F<Dell-Vendor-MIB>
|
||||
|
||||
=item $dell->ps1_type()
|
||||
|
||||
Return the type of the first power supply from the F<Dell-Vendor-MIB>
|
||||
|
||||
=item $dell->ps2_type()
|
||||
|
||||
Return the type of the second power supply from the F<Dell-Vendor-MIB>
|
||||
|
||||
=item $dell->ps1_status()
|
||||
|
||||
Return the status of the first power supply from the F<Dell-Vendor-MIB>
|
||||
|
||||
=item $dell->ps2_status()
|
||||
|
||||
Return the status of the second power supply from the F<Dell-Vendor-MIB>
|
||||
|
||||
=back
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=over
|
||||
|
||||
=item $dell->serial()
|
||||
|
||||
Returns serial number. Returns (C<rlPhdUnitGenParamSerialNum>) if available,
|
||||
otherwise uses the Layer3 serial method.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Globals imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"GLOBALS"> for details.
|
||||
|
||||
=head2 Globals imported from SNMP::Info::LLDP
|
||||
|
||||
See documentation in L<SNMP::Info::LLDP/"GLOBALS"> for details.
|
||||
|
||||
=head1 TABLE METHODS
|
||||
|
||||
These are methods that return tables of information in the form of a reference
|
||||
to a hash.
|
||||
|
||||
=head2 RADLAN Interface Table (C<swIfTable>)
|
||||
|
||||
=over
|
||||
|
||||
=item $dell->dell_duplex_admin()
|
||||
|
||||
(C<swIfDuplexAdminMode>)
|
||||
|
||||
=item $dell->dell_duplex()
|
||||
|
||||
(C<swIfDuplexOperMode>)
|
||||
|
||||
=item $dell->dell_tag_mode()
|
||||
|
||||
(C<swIfTaggedMode>)
|
||||
|
||||
=item $dell->dell_i_type()
|
||||
|
||||
(C<swIfType>)
|
||||
|
||||
=item $dell->dell_fc_admin()
|
||||
|
||||
(C<swIfFlowControlMode>)
|
||||
|
||||
=item $dell->dell_speed_admin()
|
||||
|
||||
(C<swIfSpeedAdminMode>)
|
||||
|
||||
=item $dell->dell_auto()
|
||||
|
||||
(C<swIfSpeedDuplexAutoNegotiation>)
|
||||
|
||||
=item $dell->dell_fc()
|
||||
|
||||
(C<swIfOperFlowControlMode>)
|
||||
|
||||
=back
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=over
|
||||
|
||||
=item $dell->interfaces()
|
||||
|
||||
Returns the map between SNMP Interface Identifier (iid) and physical port
|
||||
name. Uses name if available instead of description since descriptions are
|
||||
sometimes not unique.
|
||||
|
||||
=item $dell->i_duplex_admin()
|
||||
|
||||
Returns reference to hash of iid to current link administrative duplex
|
||||
setting.
|
||||
|
||||
=item $dell->qb_fdb_index()
|
||||
|
||||
Returns nothing to work around incorrect indexing of C<dot1qTpFdbTable>
|
||||
|
||||
=back
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::LLDP
|
||||
|
||||
See documentation in L<SNMP::Info::LLDP/"TABLE METHODS"> for details.
|
||||
|
||||
=cut
|
||||
442
lib/SNMP/Info/Layer3/Enterasys.pm
Normal file
442
lib/SNMP/Info/Layer3/Enterasys.pm
Normal file
@@ -0,0 +1,442 @@
|
||||
# SNMP::Info::Layer3::Enterasys - SNMP Interface to Enterasys devices
|
||||
# $Id$
|
||||
#
|
||||
# Copyright (c) 2008 Eric Miller
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the University of California, Santa Cruz nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer3::Enterasys;
|
||||
|
||||
use strict;
|
||||
use Exporter;
|
||||
use SNMP::Info::MAU;
|
||||
use SNMP::Info::LLDP;
|
||||
use SNMP::Info::CDP;
|
||||
use SNMP::Info::Layer3;
|
||||
|
||||
@SNMP::Info::Layer3::Enterasys::ISA = qw/SNMP::Info::MAU SNMP::Info::LLDP
|
||||
SNMP::Info::CDP SNMP::Info::Layer3
|
||||
Exporter/;
|
||||
@SNMP::Info::Layer3::Enterasys::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE/;
|
||||
|
||||
$VERSION = '3.35';
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer3::MIBS, %SNMP::Info::CDP::MIBS,
|
||||
%SNMP::Info::LLDP::MIBS, %SNMP::Info::MAU::MIBS,
|
||||
'ENTERASYS-OIDS-MIB' => 'etsysOidDevice',
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer3::GLOBALS, %SNMP::Info::CDP::GLOBALS,
|
||||
%SNMP::Info::LLDP::GLOBALS, %SNMP::Info::MAU::GLOBALS,
|
||||
'mac' => 'dot1dBaseBridgeAddress',
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer3::FUNCS, %SNMP::Info::CDP::FUNCS,
|
||||
%SNMP::Info::LLDP::FUNCS, %SNMP::Info::MAU::FUNCS,
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
%SNMP::Info::Layer3::MUNGE, %SNMP::Info::CDP::MUNGE,
|
||||
%SNMP::Info::LLDP::MUNGE, %SNMP::Info::MAU::MUNGE,
|
||||
);
|
||||
|
||||
sub model {
|
||||
my $enterasys = shift;
|
||||
my $id = $enterasys->id();
|
||||
|
||||
unless ( defined $id ) {
|
||||
print
|
||||
" SNMP::Info::Layer3::Enterasys::model() - Device does not support sysObjectID\n"
|
||||
if $enterasys->debug();
|
||||
return;
|
||||
}
|
||||
|
||||
my $model = &SNMP::translateObj($id);
|
||||
|
||||
$model =~ s/^etsysOidDev//i;
|
||||
$model =~ s/^etsysOidPhy//i;
|
||||
return $id unless defined $model;
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
sub vendor {
|
||||
return 'enterasys';
|
||||
}
|
||||
|
||||
sub os {
|
||||
return 'enterasys';
|
||||
}
|
||||
|
||||
sub os_ver {
|
||||
my $enterasys = shift;
|
||||
my $descr = $enterasys->description();
|
||||
return unless defined $descr;
|
||||
|
||||
if ( $descr =~ m/\bRev ([\d.]*)/ ) {
|
||||
return $1;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
# Use ifName as it is used for CDP and LLDP.
|
||||
sub interfaces {
|
||||
my $enterasys = shift;
|
||||
my $partial = shift;
|
||||
|
||||
# We need the original ifName, SUPER:: would give us a method definition
|
||||
# in a higher class, we could use orig_ but just call the MIB leaf since
|
||||
# that's what we really want anyway.
|
||||
return $enterasys->ifName($partial)
|
||||
|| $enterasys->i_description($partial);
|
||||
}
|
||||
|
||||
sub i_ignore {
|
||||
my $enterasys = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $interfaces = $enterasys->i_type($partial) || {};
|
||||
|
||||
my %i_ignore;
|
||||
foreach my $if ( keys %$interfaces ) {
|
||||
if ( $interfaces->{$if} =~ /(rs232|tunnel|loopback|\blo\b|null)/i ) {
|
||||
$i_ignore{$if}++;
|
||||
}
|
||||
}
|
||||
return \%i_ignore;
|
||||
}
|
||||
|
||||
sub i_duplex {
|
||||
my $enterasys = shift;
|
||||
my $partial = shift;
|
||||
|
||||
return $enterasys->mau_i_duplex($partial);
|
||||
}
|
||||
|
||||
sub i_duplex_admin {
|
||||
my $enterasys = shift;
|
||||
my $partial = shift;
|
||||
|
||||
return $enterasys->mau_i_duplex_admin($partial);
|
||||
}
|
||||
|
||||
# TimeFilter implementation continuously increments when walked
|
||||
# and we may never reach the end of the table. This behavior can be
|
||||
# modified with the "set snmp timefilter break disable" command,
|
||||
# unfortunately it is not the default. Query with a partial value of zero
|
||||
# which means no time filter for tables with and index containing a
|
||||
# TimeFilter
|
||||
|
||||
sub qb_fdb_index {
|
||||
my $bridge = shift;
|
||||
|
||||
my $qb_fdb_ids = $bridge->dot1qVlanFdbId(0) || {};
|
||||
|
||||
# Strip the TimeFilter
|
||||
my $vl_fdb_index = {};
|
||||
for my $fdb_entry (keys(%$qb_fdb_ids)) {
|
||||
(my $vlan = $fdb_entry) =~ s/^\d+\.//;
|
||||
$vl_fdb_index->{$qb_fdb_ids->{$fdb_entry}} = $vlan;
|
||||
}
|
||||
|
||||
return $vl_fdb_index;
|
||||
}
|
||||
|
||||
sub i_vlan_membership {
|
||||
my $bridge = shift;
|
||||
my $partial = shift;
|
||||
|
||||
# dot1qVlanCurrentTable TimeFilter index
|
||||
my $v_ports = $bridge->qb_cv_egress(0) || $bridge->qb_v_egress();
|
||||
|
||||
return $bridge->_vlan_hoa($v_ports, $partial);
|
||||
}
|
||||
|
||||
sub i_vlan_membership_untagged {
|
||||
my $bridge = shift;
|
||||
my $partial = shift;
|
||||
|
||||
# dot1qVlanCurrentTable TimeFilter index
|
||||
my $v_ports = $bridge->qb_cv_untagged(0) || $bridge->qb_v_untagged();
|
||||
|
||||
return $bridge->_vlan_hoa($v_ports, $partial);
|
||||
}
|
||||
|
||||
sub lldp_ip {
|
||||
my $enterasys = shift;
|
||||
my $partial = shift || 0;
|
||||
|
||||
return $enterasys->SUPER::lldp_ip($partial);
|
||||
}
|
||||
|
||||
# [3564920] LLDP-MIB::lldpLocPortDesc isn't always unique,
|
||||
# use LLDP-MIB::lldpLocPortId this cross references to ifName
|
||||
sub lldp_if {
|
||||
my $lldp = shift;
|
||||
my $partial = shift || 0;
|
||||
|
||||
my $addr = $lldp->lldp_rem_pid($partial) || {};
|
||||
my $i_descr = $lldp->ifName() || {};
|
||||
my %r_i_descr = reverse %$i_descr;
|
||||
|
||||
my %lldp_if;
|
||||
foreach my $key ( keys %$addr ) {
|
||||
my @aOID = split( '\.', $key );
|
||||
my $port = $aOID[1];
|
||||
next unless $port;
|
||||
# Local LLDP port may not equate to ifIndex
|
||||
# Cross reference lldpLocPortId with ifName to get ifIndex
|
||||
my $lldp_desc = $lldp->lldpLocPortId($port);
|
||||
my $desc = $lldp_desc->{$port};
|
||||
# If cross reference is successful use it, otherwise stick with lldpRemLocalPortNum
|
||||
if ( exists $r_i_descr{$desc} ) {
|
||||
$port = $r_i_descr{$desc};
|
||||
}
|
||||
|
||||
$lldp_if{$key} = $port;
|
||||
}
|
||||
return \%lldp_if;
|
||||
}
|
||||
|
||||
sub lldp_port {
|
||||
my $enterasys = shift;
|
||||
my $partial = shift || 0;
|
||||
|
||||
return $enterasys->SUPER::lldp_port($partial);
|
||||
}
|
||||
|
||||
sub lldp_id {
|
||||
my $enterasys = shift;
|
||||
my $partial = shift || 0;
|
||||
|
||||
return $enterasys->SUPER::lldp_id($partial);
|
||||
}
|
||||
|
||||
sub lldp_platform {
|
||||
my $enterasys = shift;
|
||||
my $partial = shift || 0;
|
||||
|
||||
return $enterasys->SUPER::lldp_rem_sysdesc($partial);
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer3::Enterasys - SNMP Interface to Enterasys Network Devices
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Eric Miller
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $enterasys = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
DestHost => 'myswitch',
|
||||
Community => 'public',
|
||||
Version => 1
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $enterasys->class();
|
||||
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Provides abstraction to the configuration information obtainable from an
|
||||
Enterasys device through SNMP.
|
||||
|
||||
For speed or debugging purposes you can call the subclass directly, but not
|
||||
after determining a more specific class using the method above.
|
||||
|
||||
my $enterasys = new SNMP::Info::Layer3::Enterasys(...);
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info::MAU
|
||||
|
||||
=item SNMP::Info::LLDP
|
||||
|
||||
=item SNMP::Info::CDP
|
||||
|
||||
=item SNMP::Info::Layer3
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item F<ENTERASYS-OIDS-MIB>
|
||||
|
||||
=back
|
||||
|
||||
=head2 Inherited MIBs
|
||||
|
||||
See L<SNMP::Info::MAU/"Required MIBs"> for its MIB requirements.
|
||||
|
||||
See L<SNMP::Info::LLDP/"Required MIBs"> for its MIB requirements.
|
||||
|
||||
See L<SNMP::Info::CDP/"Required MIBs"> for its MIB requirements.
|
||||
|
||||
See L<SNMP::Info::Layer3/"Required MIBs"> for its MIB requirements.
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar value from SNMP
|
||||
|
||||
=over
|
||||
|
||||
=item $enterasys->model()
|
||||
|
||||
Returns model type. Checks $enterasys->id() against the
|
||||
F<ENTERASYS-OIDS-MIB>.
|
||||
|
||||
=item $enterasys->vendor()
|
||||
|
||||
Returns enterasys
|
||||
|
||||
=item $enterasys->os()
|
||||
|
||||
Returns enterasys
|
||||
|
||||
=item $enterasys->os_ver()
|
||||
|
||||
Returns os version extracted from C<sysDescr>
|
||||
|
||||
=item $enterasys->mac()
|
||||
|
||||
Returns base mac
|
||||
|
||||
(C<dot1dBaseBridgeAddress>)
|
||||
|
||||
=back
|
||||
|
||||
=head2 Globals imported from SNMP::Info::MAU
|
||||
|
||||
See documentation in L<SNMP::Info::MAU/"GLOBALS"> for details.
|
||||
|
||||
=head2 Globals imported from SNMP::Info::LLDP
|
||||
|
||||
See documentation in L<SNMP::Info::LLDP/"GLOBALS"> for details.
|
||||
|
||||
=head2 Globals imported from SNMP::Info::CDP
|
||||
|
||||
See documentation in L<SNMP::Info::CDP/"GLOBALS"> for details.
|
||||
|
||||
=head2 Globals imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"GLOBALS"> for details.
|
||||
|
||||
=head1 TABLE METHODS
|
||||
|
||||
These are methods that return tables of information in the form of a reference
|
||||
to a hash.
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=over
|
||||
|
||||
=item $enterasys->interfaces()
|
||||
|
||||
Mapping between the Interface Table Index (iid) and the physical port name.
|
||||
|
||||
=item $enterasys->i_ignore()
|
||||
|
||||
Returns reference to hash. Creates a key for each IID that should be ignored.
|
||||
|
||||
Currently looks for rs232, tunnel,loopback,lo,null from
|
||||
$enterasys->interfaces()
|
||||
|
||||
=item $enterasys->i_duplex()
|
||||
|
||||
See documentation for mau_i_duplex() in L<SNMP::Info::MAU/"TABLE METHODS">.
|
||||
|
||||
=item $enterasys->i_duplex_admin()
|
||||
|
||||
See documentation for mau_i_duplex_admin() in
|
||||
L<SNMP::Info::MAU/"TABLE METHODS">.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Time Filter Table Index Overrides
|
||||
|
||||
The time filter C<TimeFilter> implementation continuously increments when
|
||||
walked and we may never reach the end of the table. This behavior can be
|
||||
modified with the C<"set snmp timefilter break disable"> command,
|
||||
unfortunately it is not the default. These methods are overridden to
|
||||
supply a partial value of zero which means no time filter.
|
||||
|
||||
=over
|
||||
|
||||
=item $enterasys->qb_fdb_index()
|
||||
|
||||
=item $enterasys->i_vlan_membership()
|
||||
|
||||
=item $enterasys->i_vlan_membership_untagged()
|
||||
|
||||
=item $enterasys->lldp_if()
|
||||
|
||||
=item $enterasys->lldp_ip()
|
||||
|
||||
=item $enterasys->lldp_port()
|
||||
|
||||
=item $enterasys->lldp_id()
|
||||
|
||||
=item $enterasys->lldp_platform()
|
||||
|
||||
=back
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::MAU
|
||||
|
||||
See documentation in L<SNMP::Info::MAU/"TABLE METHODS"> for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::LLDP
|
||||
|
||||
See documentation in L<SNMP::Info::LLDP/"TABLE METHODS"> for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::CDP
|
||||
|
||||
See documentation in L<SNMP::Info::CDP/"TABLE METHODS"> for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details.
|
||||
|
||||
=cut
|
||||
1303
lib/SNMP/Info/Layer3/Extreme.pm
Normal file
1303
lib/SNMP/Info/Layer3/Extreme.pm
Normal file
File diff suppressed because it is too large
Load Diff
458
lib/SNMP/Info/Layer3/F5.pm
Normal file
458
lib/SNMP/Info/Layer3/F5.pm
Normal file
@@ -0,0 +1,458 @@
|
||||
# SNMP::Info::Layer3::F5
|
||||
#
|
||||
# Copyright (c) 2012 Eric Miller
|
||||
# All Rights Reserved
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the University of California, Santa Cruz nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer3::F5;
|
||||
|
||||
use strict;
|
||||
use Exporter;
|
||||
use SNMP::Info::Layer3;
|
||||
|
||||
@SNMP::Info::Layer3::F5::ISA = qw/SNMP::Info::Layer3 Exporter/;
|
||||
@SNMP::Info::Layer3::F5::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/;
|
||||
|
||||
$VERSION = '3.35';
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer3::MIBS,
|
||||
'F5-BIGIP-SYSTEM-MIB' => 'sysAttrArpMaxEntries',
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer3::GLOBALS,
|
||||
'os_ver' => 'sysProductVersion',
|
||||
'mkt_name' => 'sysPlatformInfoMarketingName',
|
||||
'ps1_status' => 'sysChassisPowerSupplyStatus.1',
|
||||
'ps2_status' => 'sysChassisPowerSupplyStatus.2',
|
||||
|
||||
# Named serial1 to override serial1 in L3 serial method
|
||||
'serial1' => 'sysGeneralChassisSerialNum',
|
||||
'qb_vlans' => 'sysVlanNumber',
|
||||
'ports' => 'sysInterfaceNumber',
|
||||
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer3::FUNCS,
|
||||
|
||||
# sysInterfaceTable
|
||||
'i_index' => 'sysInterfaceName',
|
||||
'i_description' => 'sysInterfaceName',
|
||||
'i_mtu' => 'sysInterfaceMtu',
|
||||
'i_speed' => 'sysInterfaceMediaActiveSpeed',
|
||||
'i_mac' => 'sysInterfaceMacAddr',
|
||||
'i_up_admin' => 'sysInterfaceEnabled',
|
||||
'i_up' => 'sysInterfaceStatus',
|
||||
|
||||
# sysIfxStatTable
|
||||
'i_octet_in64' => 'sysIfxStatHcInOctets',
|
||||
'i_octet_out64' => 'sysIfxStatHcOutOctets',
|
||||
'i_pkts_ucast_in64' => 'sysIfxStatHcInUcastPkts',
|
||||
'i_pkts_ucast_out64' => 'sysIfxStatHcOutUcastPkts',
|
||||
'i_pkts_mutli_in64' => 'sysIfxStatInMulticastPkts',
|
||||
'i_pkts_multi_out64' => 'sysIfxStatOutMulticastPkts',
|
||||
'i_pkts_bcast_in64' => 'sysIfxStatInBroadcastPkts',
|
||||
'i_pkts_bcast_out64' => 'sysIfxStatOutBroadcastPkts',
|
||||
|
||||
# sysInterfaceStatTable
|
||||
'i_discards_in' => 'sysInterfaceStatDropsIn',
|
||||
'i_discards_out' => 'sysInterfaceStatDropsOut',
|
||||
'i_errors_in' => 'sysInterfaceStatErrorsIn',
|
||||
'i_errors_out' => 'sysInterfaceStatErrorsOut',
|
||||
|
||||
# sysInterfaceTable
|
||||
'sys_i_duplex' => 'sysInterfaceMediaActiveDuplex',
|
||||
|
||||
# sysChassisFanTable
|
||||
'fan_state' => 'sysChassisFanStatus',
|
||||
|
||||
# sysVlanTable
|
||||
'sys_v_id' => 'sysVlanId',
|
||||
'v_name' => 'sysVlanVname',
|
||||
|
||||
# sysVlanMemberTable
|
||||
'sys_vm_tagged' => 'sysVlanMemberTagged',
|
||||
'sys_vm_name' => 'sysVlanMemberVmname',
|
||||
'sys_vmp_name' => 'sysVlanMemberParentVname',
|
||||
);
|
||||
|
||||
%MUNGE = ( %SNMP::Info::Layer3::MUNGE, );
|
||||
|
||||
sub vendor {
|
||||
return 'f5';
|
||||
}
|
||||
|
||||
sub os {
|
||||
return 'f5';
|
||||
}
|
||||
|
||||
sub fan {
|
||||
my $f5 = shift;
|
||||
my $fan_state = $f5->fan_state();
|
||||
my $ret = "";
|
||||
my $s = "";
|
||||
foreach my $i ( sort { $a <=> $b } keys %$fan_state ) {
|
||||
$ret .= $s . $i . ': ' . $fan_state->{$i};
|
||||
$s = ', ';
|
||||
}
|
||||
return if ( $s eq "" );
|
||||
return $ret;
|
||||
}
|
||||
|
||||
sub model {
|
||||
my $f5 = shift;
|
||||
|
||||
my $name = $f5->mkt_name();
|
||||
|
||||
if ( defined $name ) { return $name; }
|
||||
|
||||
my $id = $f5->id();
|
||||
my $model = &SNMP::translateObj($id);
|
||||
if ( !defined $model ) { return $id; }
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
# Override L3 interfaces
|
||||
sub interfaces {
|
||||
my $f5 = shift;
|
||||
my $partial = shift;
|
||||
|
||||
return $f5->i_index($partial);
|
||||
}
|
||||
|
||||
# Override L3 i_name
|
||||
sub i_name {
|
||||
my $f5 = shift;
|
||||
my $partial = shift;
|
||||
|
||||
return $f5->i_index($partial);
|
||||
}
|
||||
|
||||
# We don't have this, so fake it
|
||||
sub i_type {
|
||||
my $f5 = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $idx = $f5->i_index($partial);
|
||||
|
||||
my %i_type;
|
||||
foreach my $if ( keys %$idx ) {
|
||||
$i_type{$if} =
|
||||
((exists $f5->{sess}->{UseEnums} and $f5->{sess}->{UseEnums})
|
||||
? 'ethernetCsmacd' : 6 );
|
||||
}
|
||||
return \%i_type;
|
||||
}
|
||||
|
||||
# Override L3 i_duplex
|
||||
sub i_duplex {
|
||||
my $f5 = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $duplexes = $f5->sys_i_duplex() || {};
|
||||
|
||||
my %i_duplex;
|
||||
foreach my $if ( keys %$duplexes ) {
|
||||
my $duplex = $duplexes->{$if};
|
||||
next unless defined $duplex;
|
||||
next if ( $duplex eq 'none' );
|
||||
|
||||
$i_duplex{$if} = $duplex;
|
||||
}
|
||||
return \%i_duplex;
|
||||
}
|
||||
|
||||
# Override Bridge v_index
|
||||
sub v_index {
|
||||
my $f5 = shift;
|
||||
my $partial = shift;
|
||||
|
||||
return $f5->sys_v_id($partial);
|
||||
}
|
||||
|
||||
sub i_vlan {
|
||||
my $f5 = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $index = $f5->i_index($partial) || {};
|
||||
my $tagged = $f5->sys_vm_tagged() || {};
|
||||
my $vlans = $f5->v_index() || {};
|
||||
|
||||
my $i_vlan = {};
|
||||
foreach my $iid ( keys %$tagged ) {
|
||||
my $tag = $tagged->{$iid};
|
||||
next if ( $tag eq 'true' );
|
||||
|
||||
# IID is length.vlan name index.length.interface index
|
||||
# Split out and use as the IID to get the VLAN ID and ifIndex
|
||||
my @iid_array = split /\./, $iid;
|
||||
my $len = $iid_array[0];
|
||||
my $v_idx = join '.', ( splice @iid_array, 0, $len + 1 );
|
||||
my $idx = join '.', @iid_array;
|
||||
|
||||
# Check to make sure we can map to a port
|
||||
my $p_idx = $index->{$idx};
|
||||
next unless $p_idx;
|
||||
|
||||
my $vlan = $vlans->{$v_idx};
|
||||
next unless $vlan;
|
||||
|
||||
$i_vlan->{$idx} = $vlan;
|
||||
}
|
||||
return $i_vlan;
|
||||
}
|
||||
|
||||
sub i_vlan_membership {
|
||||
my $f5 = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $index = $f5->i_index($partial) || {};
|
||||
my $tagged = $f5->sys_vm_tagged() || {};
|
||||
my $vlans = $f5->v_index() || {};
|
||||
|
||||
my $i_vlan_membership = {};
|
||||
foreach my $iid ( keys %$tagged ) {
|
||||
|
||||
# IID is length.vlan name index.length.interface index
|
||||
# Split out and use as the IID to get the VLAN ID and ifIndex
|
||||
my @iid_array = split /\./, $iid;
|
||||
my $len = $iid_array[0];
|
||||
my $v_idx = join '.', ( splice @iid_array, 0, $len + 1 );
|
||||
my $idx = join '.', @iid_array;
|
||||
|
||||
# Check to make sure we can map to a port
|
||||
my $p_idx = $index->{$idx};
|
||||
next unless $p_idx;
|
||||
|
||||
my $vlan = $vlans->{$v_idx};
|
||||
next unless $vlan;
|
||||
|
||||
push( @{ $i_vlan_membership->{$idx} }, $vlan );
|
||||
}
|
||||
return $i_vlan_membership;
|
||||
}
|
||||
|
||||
sub i_vlan_membership_untagged {
|
||||
my $f5 = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $index = $f5->i_index($partial) || {};
|
||||
my $tagged = $f5->sys_vm_tagged() || {};
|
||||
my $vlans = $f5->v_index() || {};
|
||||
|
||||
my $i_vlan_membership = {};
|
||||
foreach my $iid ( keys %$tagged ) {
|
||||
|
||||
next unless $tagged->{$iid} eq 'false';
|
||||
# IID is length.vlan name index.length.interface index
|
||||
# Split out and use as the IID to get the VLAN ID and ifIndex
|
||||
my @iid_array = split /\./, $iid;
|
||||
my $len = $iid_array[0];
|
||||
my $v_idx = join '.', ( splice @iid_array, 0, $len + 1 );
|
||||
my $idx = join '.', @iid_array;
|
||||
|
||||
# Check to make sure we can map to a port
|
||||
my $p_idx = $index->{$idx};
|
||||
next unless $p_idx;
|
||||
|
||||
my $vlan = $vlans->{$v_idx};
|
||||
next unless $vlan;
|
||||
|
||||
push( @{ $i_vlan_membership->{$idx} }, $vlan );
|
||||
}
|
||||
return $i_vlan_membership;
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer3::F5 - SNMP Interface to F5 network devices.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Eric Miller
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $f5 = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
DestHost => 'myswitch',
|
||||
Community => 'public',
|
||||
Version => 2
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $f5->class();
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Abstraction subclass for F5 network devices.
|
||||
|
||||
For speed or debugging purposes you can call the subclass directly, but not
|
||||
after determining a more specific class using the method above.
|
||||
|
||||
my $f5 = new SNMP::Info::Layer3::F5(...);
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info::Layer3
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item F<F5-BIGIP-COMMON-MIB>
|
||||
|
||||
=item F<F5-BIGIP-SYSTEM-MIB>
|
||||
|
||||
=item Inherited Classes' MIBs
|
||||
|
||||
See L<SNMP::Info::Layer3/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
=back
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar value from SNMP
|
||||
|
||||
=over
|
||||
|
||||
=item $f5->model()
|
||||
|
||||
Return (C<sysPlatformInfoMarketingName>), otherwise tries to reference
|
||||
$f5->id() to F<F5-BIGIP-COMMON-MIB>.
|
||||
|
||||
=item $f5->vendor()
|
||||
|
||||
Returns 'f5'
|
||||
|
||||
=item $f5->os()
|
||||
|
||||
Returns 'f5'
|
||||
|
||||
=item $f5->os_ver()
|
||||
|
||||
Returns the software version reported by C<sysProductVersion>
|
||||
|
||||
=item $f5->fan()
|
||||
|
||||
Combines (C<sysChassisFanStatus>) into a single string.
|
||||
|
||||
=item $f5->ps1_status()
|
||||
|
||||
Returns status of primary power supply
|
||||
|
||||
=item $f5->ps2_status()
|
||||
|
||||
Returns status of redundant power supply
|
||||
|
||||
=back
|
||||
|
||||
=head2 Globals imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"GLOBALS"> for details.
|
||||
|
||||
=head1 TABLE METHODS
|
||||
|
||||
These are methods that return tables of information in the form of a
|
||||
reference to a hash.
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=over
|
||||
|
||||
=item $f5->interfaces()
|
||||
|
||||
Returns reference to the map between IID and physical port.
|
||||
|
||||
(C<sysInterfaceName>).
|
||||
|
||||
=item $f5->i_duplex()
|
||||
|
||||
Returns reference to hash. Maps port operational duplexes to IIDs.
|
||||
|
||||
=item $f5->i_vlan()
|
||||
|
||||
Returns a mapping between C<ifIndex> and the default VLAN.
|
||||
|
||||
=item $f5->i_vlan_membership()
|
||||
|
||||
Returns reference to hash of arrays: key = C<ifIndex>, value = array of VLAN
|
||||
IDs.
|
||||
|
||||
Example:
|
||||
my $interfaces = $f5->interfaces();
|
||||
my $vlans = $f5->i_vlan_membership();
|
||||
|
||||
foreach my $iid (sort keys %$interfaces) {
|
||||
my $port = $interfaces->{$iid};
|
||||
my $vlan = join(',', sort(@{$vlans->{$iid}}));
|
||||
print "Port: $port VLAN: $vlan\n";
|
||||
}
|
||||
|
||||
=item $f5->i_vlan_membership_untagged()
|
||||
|
||||
Returns reference to hash of arrays: key = C<ifIndex>, value = array of VLAN
|
||||
IDs. These are the VLANs which are members of the untagged egress list for
|
||||
the port.
|
||||
|
||||
=item $f5->v_index()
|
||||
|
||||
Returns VLAN IDs
|
||||
|
||||
=item $f5->v_name()
|
||||
|
||||
Human-entered name for vlans.
|
||||
|
||||
=item $f5->i_name()
|
||||
|
||||
Returns the human set port name if exists.
|
||||
|
||||
=item $f5->i_type()
|
||||
|
||||
Returns C<'ethernetCsmacd'> for each C<ifIndex>.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details.
|
||||
|
||||
=cut
|
||||
298
lib/SNMP/Info/Layer3/Force10.pm
Normal file
298
lib/SNMP/Info/Layer3/Force10.pm
Normal file
@@ -0,0 +1,298 @@
|
||||
# SNMP::Info::Layer3::Force10
|
||||
# $Id$
|
||||
#
|
||||
# Copyright (c) 2012 William Bulley
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of University of California, Santa Cruz nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer3::Force10;
|
||||
|
||||
use strict;
|
||||
use Exporter;
|
||||
|
||||
use SNMP::Info::Layer3;
|
||||
use SNMP::Info::MAU;
|
||||
use SNMP::Info::LLDP;
|
||||
|
||||
@SNMP::Info::Layer3::Force10::ISA = qw/SNMP::Info::LLDP SNMP::Info::MAU
|
||||
SNMP::Info::Layer3 Exporter/;
|
||||
@SNMP::Info::Layer3::Force10::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %MUNGE/;
|
||||
|
||||
$VERSION = '3.35';
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer3::MIBS,
|
||||
%SNMP::Info::MAU::MIBS,
|
||||
%SNMP::Info::LLDP::MIBS,
|
||||
'F10-PRODUCTS-MIB' => 'f10Products',
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer3::GLOBALS,
|
||||
%SNMP::Info::MAU::GLOBALS,
|
||||
%SNMP::Info::LLDP::GLOBALS,
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer3::FUNCS,
|
||||
%SNMP::Info::MAU::FUNCS,
|
||||
%SNMP::Info::LLDP::FUNCS,
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
%SNMP::Info::Layer3::MUNGE,
|
||||
%SNMP::Info::MAU::MUNGE,
|
||||
%SNMP::Info::LLDP::MUNGE,
|
||||
);
|
||||
|
||||
# use MAU-MIB for admin. duplex and admin. speed
|
||||
*SNMP::Info::Layer3::Force10::i_duplex_admin
|
||||
= \&SNMP::Info::MAU::mau_i_duplex_admin;
|
||||
*SNMP::Info::Layer3::Force10::i_speed_admin
|
||||
= \&SNMP::Info::MAU::mau_i_speed_admin;
|
||||
|
||||
sub vendor {
|
||||
return 'force10';
|
||||
}
|
||||
|
||||
sub os {
|
||||
return 'ftos';
|
||||
}
|
||||
|
||||
sub os_ver {
|
||||
my $force10 = shift;
|
||||
my $descr = $force10->description();
|
||||
my $os_ver = undef;
|
||||
|
||||
$os_ver = $1 if ( $descr =~ /Force10\s+Application\s+Software\s+Version:\s+(\S+)/s );
|
||||
|
||||
return $os_ver;
|
||||
}
|
||||
|
||||
sub model {
|
||||
my $force10 = shift;
|
||||
my $id = $force10->id();
|
||||
|
||||
my $model = &SNMP::translateObj($id);
|
||||
return $id unless defined $model;
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
sub v_name {
|
||||
my $force10 = shift;
|
||||
my $partial = shift;
|
||||
|
||||
return $force10->qb_v_name($partial);
|
||||
}
|
||||
|
||||
# ------------------- stub for now-----------------
|
||||
sub i_vlan {
|
||||
my $force10 = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $i_vlan = {};
|
||||
|
||||
return $i_vlan;
|
||||
}
|
||||
|
||||
# Apparently index doesn't use VLAN ID, so override the HOA private
|
||||
# method here to correct the mapping
|
||||
sub _vlan_hoa {
|
||||
my $force10 = shift;
|
||||
my ( $v_ports, $partial ) = @_;
|
||||
|
||||
my $index = $force10->bp_index();
|
||||
my $v_index = $force10->v_index();
|
||||
|
||||
my $vlan_hoa = {};
|
||||
foreach my $idx ( sort keys %{$v_ports} ) {
|
||||
next unless ( defined $v_ports->{$idx} );
|
||||
my $portlist = $v_ports->{$idx}; # is an array reference
|
||||
my $ret = [];
|
||||
my $vlan_ndx = $idx;
|
||||
|
||||
# Strip TimeFilter if we're using VlanCurrentTable
|
||||
( $vlan_ndx = $idx ) =~ s/^\d+\.//;
|
||||
|
||||
# Convert portlist bit array to bp_index array
|
||||
for ( my $i = 0; $i <= $#$portlist; $i++ ) {
|
||||
push( @{$ret}, $i + 1 ) if ( @$portlist[$i] );
|
||||
}
|
||||
|
||||
#Create HoA ifIndex -> VLAN array
|
||||
foreach my $port ( @{$ret} ) {
|
||||
my $ifindex = $index->{$port};
|
||||
next unless ( defined($ifindex) ); # shouldn't happen
|
||||
next if ( defined $partial and $ifindex !~ /^$partial$/ );
|
||||
my $vlan_tag = $v_index->{$vlan_ndx};
|
||||
|
||||
# FIXME: would be preferable to use
|
||||
# the mapping from Q-BRIDGE-MIB::dot1qVlanFdbId
|
||||
my $mod = $vlan_tag % 4096;
|
||||
|
||||
push ( @{ $vlan_hoa->{$ifindex} }, ($mod) );
|
||||
}
|
||||
}
|
||||
return $vlan_hoa;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer3::Force10 - SNMP Interface to Force10 Networks FTOS
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
William Bulley
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $force10 = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
# These arguments are passed directly to SNMP::Session
|
||||
DestHost => 'myswitch',
|
||||
Community => 'public',
|
||||
Version => 2
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $force10->class();
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Subclass for Force10 Networks FTOS-based devices.
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info::Layer3
|
||||
|
||||
=item SNMP::Info::MAU
|
||||
|
||||
=item SNMP::Info::LLDP
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item F<F10-PRODUCTS-MIB>
|
||||
|
||||
=item Inherited Classes' MIBs
|
||||
|
||||
See L<SNMP::Info::Layer3/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
See L<SNMP::Info::MAU/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
See L<SNMP::Info::LLDP/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
=back
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar values from SNMP:
|
||||
|
||||
=over
|
||||
|
||||
=item $force10->vendor()
|
||||
|
||||
Returns C<'force10'>
|
||||
|
||||
=item $force10->model()
|
||||
|
||||
Tries to reference $force10->id() to the Force10 product MIB listed above.
|
||||
|
||||
=item $force10->os()
|
||||
|
||||
Returns C<'ftos'>.
|
||||
|
||||
=item $force10->os_ver()
|
||||
|
||||
Grabs the operating system version from C<sysDescr>
|
||||
|
||||
=back
|
||||
|
||||
=head2 Global Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"GLOBALS"> for details.
|
||||
|
||||
=head2 Global Methods imported from SNMP::Info::MAU
|
||||
|
||||
See documentation in L<SNMP::Info::MAU/"GLOBALS"> for details.
|
||||
|
||||
=head2 Global Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"GLOBALS"> for details.
|
||||
|
||||
=head1 TABLE METHODS
|
||||
|
||||
These are methods that return tables of information in the form of a reference
|
||||
to a hash.
|
||||
|
||||
=over
|
||||
|
||||
=item $force10->v_name()
|
||||
|
||||
Returns the VLAN names.
|
||||
|
||||
=item $force10->i_vlan()
|
||||
|
||||
Currently not implemented.
|
||||
|
||||
=item $force10->i_duplex_admin()
|
||||
|
||||
Returns info from F<MAU-MIB>
|
||||
|
||||
=item $force10->i_speed_admin()
|
||||
|
||||
Returns info from F<MAU-MIB>
|
||||
|
||||
=back
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::MAU
|
||||
|
||||
See documentation in L<SNMP::Info::MAU/"TABLE METHODS"> for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::LLDP
|
||||
|
||||
See documentation in L<SNMP::Info::LLDP/"TABLE METHODS"> for details.
|
||||
|
||||
=cut
|
||||
200
lib/SNMP/Info/Layer3/Fortinet.pm
Normal file
200
lib/SNMP/Info/Layer3/Fortinet.pm
Normal file
@@ -0,0 +1,200 @@
|
||||
# SNMP::Info::Layer3::Fortinet
|
||||
#
|
||||
# Copyright (c) 2014 Eric Miller
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the University of California, Santa Cruz nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer3::Fortinet;
|
||||
|
||||
use strict;
|
||||
use Exporter;
|
||||
use SNMP::Info::Layer3;
|
||||
|
||||
@SNMP::Info::Layer3::Fortinet::ISA
|
||||
= qw/SNMP::Info::Layer3 Exporter/;
|
||||
@SNMP::Info::Layer3::Fortinet::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/;
|
||||
|
||||
$VERSION = '3.35';
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer3::MIBS,
|
||||
'FORTINET-CORE-MIB' => 'fnSysSerial',
|
||||
'FORTINET-FORTIGATE-MIB' => 'fgVdMaxVdoms',
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer3::GLOBALS,
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer3::FUNCS,
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
%SNMP::Info::Layer3::MUNGE,
|
||||
);
|
||||
|
||||
sub vendor {
|
||||
return 'fortinet';
|
||||
}
|
||||
|
||||
sub model {
|
||||
my $fortinet = shift;
|
||||
my $id = $fortinet->id() || '';
|
||||
|
||||
my $model = &SNMP::translateObj($id);
|
||||
|
||||
return $id unless defined $model;
|
||||
|
||||
$model =~ s/^f[grsw][tfw]?//i;
|
||||
return $model;
|
||||
}
|
||||
|
||||
sub os {
|
||||
return 'fortios';
|
||||
}
|
||||
|
||||
sub os_ver {
|
||||
my $fortinet = shift;
|
||||
|
||||
my $ver = $fortinet->fgSysVersion() || '';
|
||||
|
||||
if ( $ver =~ /(\d+[\.\d]+)/ ) {
|
||||
return $1;
|
||||
}
|
||||
|
||||
return $ver;
|
||||
}
|
||||
|
||||
sub serial {
|
||||
my $fortinet = shift;
|
||||
|
||||
return $fortinet->fnSysSerial();
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer3::Fortinet - SNMP Interface to Fortinet network devices.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Eric Miller
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $fortinet = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
DestHost => 'myswitch',
|
||||
Community => 'public',
|
||||
Version => 2
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $fortinet->class();
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Abstraction subclass for Fortinet network devices.
|
||||
|
||||
For speed or debugging purposes you can call the subclass directly, but not
|
||||
after determining a more specific class using the method above.
|
||||
|
||||
my $fortinet = new SNMP::Info::Layer3::Fortinet(...);
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info::Layer3
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item F<FORTINET-CORE-MIB>
|
||||
|
||||
=item F<FORTINET-FORTIGATE-MIB>
|
||||
|
||||
=item Inherited Classes' MIBs
|
||||
|
||||
See L<SNMP::Info::Layer3/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
=back
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar value from SNMP
|
||||
|
||||
=over
|
||||
|
||||
=item $fortinet->vendor()
|
||||
|
||||
Returns 'fortinet'
|
||||
|
||||
=item $fortinet->model()
|
||||
|
||||
Returns the chassis model.
|
||||
|
||||
=item $fortinet->os()
|
||||
|
||||
Returns 'fortios'
|
||||
|
||||
=item $fortinet->os_ver()
|
||||
|
||||
Returns the software version extracted from (C<systemVersion>).
|
||||
|
||||
=item $fortinet->serial()
|
||||
|
||||
Returns the chassis serial number.
|
||||
|
||||
(C<fnSysSerial>)
|
||||
|
||||
=back
|
||||
|
||||
=head2 Globals imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"GLOBALS"> for details.
|
||||
|
||||
=head1 TABLE METHODS
|
||||
|
||||
These are methods that return tables of information in the form of a reference
|
||||
to a hash.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details.
|
||||
|
||||
=cut
|
||||
1282
lib/SNMP/Info/Layer3/Foundry.pm
Normal file
1282
lib/SNMP/Info/Layer3/Foundry.pm
Normal file
File diff suppressed because it is too large
Load Diff
250
lib/SNMP/Info/Layer3/H3C.pm
Normal file
250
lib/SNMP/Info/Layer3/H3C.pm
Normal file
@@ -0,0 +1,250 @@
|
||||
# SNMP::Info::Layer3::H3C
|
||||
#
|
||||
# Copyright (c) 2012 Jeroen van Ingen
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the University of California, Santa Cruz nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer3::H3C;
|
||||
|
||||
use strict;
|
||||
use Exporter;
|
||||
use SNMP::Info::Layer3;
|
||||
use SNMP::Info::LLDP;
|
||||
use SNMP::Info::IEEE802dot3ad 'agg_ports_lag';
|
||||
|
||||
@SNMP::Info::Layer3::H3C::ISA = qw/
|
||||
SNMP::Info::IEEE802dot3ad
|
||||
SNMP::Info::LLDP
|
||||
SNMP::Info::Layer3
|
||||
Exporter
|
||||
/;
|
||||
@SNMP::Info::Layer3::H3C::EXPORT_OK = qw/
|
||||
agg_ports
|
||||
/;
|
||||
|
||||
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/;
|
||||
|
||||
$VERSION = '3.35';
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer3::MIBS,
|
||||
%SNMP::Info::LLDP::MIBS,
|
||||
%SNMP::Info::IEEE802dot3ad::MIBS,
|
||||
'HH3C-LswDEVM-MIB' => 'hh3cDevMFanStatus',
|
||||
'HH3C-LswINF-MIB' => 'hh3cSlotPortMax',
|
||||
'HH3C-LSW-DEV-ADM-MIB' => 'hh3cLswSysVersion',
|
||||
'HH3C-PRODUCT-ID-MIB' => 'hh3c-s5500-28C-EI',
|
||||
'HH3C-ENTITY-VENDORTYPE-OID-MIB' => 'hh3cevtOther',
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer3::GLOBALS,
|
||||
%SNMP::Info::LLDP::GLOBALS,
|
||||
'fan' => 'hh3cDevMFanStatus.1',
|
||||
'ps1_status' => 'hh3cDevMPowerStatus.1',
|
||||
'ps2_status' => 'hh3cDevMPowerStatus.2',
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer3::FUNCS,
|
||||
%SNMP::Info::LLDP::FUNCS,
|
||||
i_duplex_admin => 'hh3cifEthernetDuplex',
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
%SNMP::Info::Layer3::MUNGE,
|
||||
%SNMP::Info::LLDP::MUNGE,
|
||||
);
|
||||
|
||||
sub vendor {
|
||||
my $h3c = shift;
|
||||
my $mfg = $h3c->entPhysicalMfgName(1) || {};
|
||||
return $mfg->{1} || "H3C";
|
||||
}
|
||||
|
||||
sub os {
|
||||
my $h3c = shift;
|
||||
my $descr = $h3c->description();
|
||||
|
||||
return $1 if ( $descr =~ /(\S+)\s+Platform Software/ );
|
||||
return "H3C";
|
||||
}
|
||||
|
||||
sub os_ver {
|
||||
my $h3c = shift;
|
||||
my $descr = $h3c->description();
|
||||
# my $version = $h3c->hh3cLswSysVersion(); # Don't use, indicates base version only, no release details
|
||||
my $ver_release = $h3c->entPhysicalSoftwareRev(2) || {};
|
||||
my $os_ver = undef;
|
||||
|
||||
$os_ver = "$1 $2" if ( $descr =~ /Software Version ([^,]+),.*(Release\s\S+)/i );
|
||||
$os_ver = "$1" if ( $descr =~ /Product Version ([0-9.]+)/i );
|
||||
|
||||
return $ver_release->{2} || $os_ver;
|
||||
}
|
||||
|
||||
sub i_ignore {
|
||||
my $l3 = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $interfaces = $l3->interfaces($partial) || {};
|
||||
|
||||
my %i_ignore;
|
||||
foreach my $if ( keys %$interfaces ) {
|
||||
|
||||
# lo0 etc
|
||||
if ( $interfaces->{$if} =~ /\blo\d*\b/i ) {
|
||||
$i_ignore{$if}++;
|
||||
}
|
||||
}
|
||||
return \%i_ignore;
|
||||
}
|
||||
|
||||
sub agg_ports { return agg_ports_lag(@_) }
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer3::H3C - SNMP Interface to L3 Devices, H3C & HP A-series
|
||||
|
||||
=head1 AUTHORS
|
||||
|
||||
Jeroen van Ingen
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $h3c = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
DestHost => 'myrouter',
|
||||
Community => 'public',
|
||||
Version => 2
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $h3c->class();
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Subclass for H3C & HP A-series devices
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info::Layer3
|
||||
|
||||
=item SNMP::Info::LLDP
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item F<HH3C-LswDEVM-MIB>
|
||||
|
||||
=item F<HH3C-LswINF-MIB>
|
||||
|
||||
=item F<HH3C-LSW-DEV-ADM-MIB>
|
||||
|
||||
=item F<HH3C-PRODUCT-ID-MIB>
|
||||
|
||||
=item F<HH3C-ENTITY-VENDORTYPE-OID-MIB>
|
||||
|
||||
=item Inherited Classes' MIBs
|
||||
|
||||
See L<SNMP::Info::Layer3> for its own MIB requirements.
|
||||
|
||||
See L<SNMP::Info::LLDP> for its own MIB requirements.
|
||||
|
||||
=back
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar value from SNMP
|
||||
|
||||
=over
|
||||
|
||||
=item $h3c->vendor()
|
||||
|
||||
Returns value for C<entPhysicalMfgName.1>.
|
||||
|
||||
=item $h3c->os()
|
||||
|
||||
Returns the OS extracted from C<sysDescr>.
|
||||
|
||||
=item $h3c->os_ver()
|
||||
|
||||
Returns the software version. Either C<entPhysicalSoftwareRev.2> or extracted from
|
||||
C<sysDescr>.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Globals imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3> for details.
|
||||
|
||||
=head2 Globals imported from SNMP::Info::LLDP
|
||||
|
||||
See documentation in L<SNMP::Info::LLDP> for details.
|
||||
|
||||
=head1 TABLE ENTRIES
|
||||
|
||||
These are methods that return tables of information in the form of a reference
|
||||
to a hash.
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=over
|
||||
|
||||
=item $h3c->i_ignore()
|
||||
|
||||
Returns reference to hash. Increments value of IID if port is to be ignored.
|
||||
|
||||
Ignores loopback
|
||||
|
||||
=item C<agg_ports>
|
||||
|
||||
Returns a HASH reference mapping from slave to master port for each member of
|
||||
a port bundle on the device. Keys are ifIndex of the slave ports, Values are
|
||||
ifIndex of the corresponding master ports.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3> for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::LLDP
|
||||
|
||||
See documentation in L<SNMP::Info::LLDP> for details.
|
||||
|
||||
=cut
|
||||
414
lib/SNMP/Info/Layer3/HP9300.pm
Normal file
414
lib/SNMP/Info/Layer3/HP9300.pm
Normal file
@@ -0,0 +1,414 @@
|
||||
# SNMP::Info::Layer3::HP9300 - SNMP Interface to HP Foundry OEM devices
|
||||
# $Id$
|
||||
#
|
||||
# Copyright (c) 2008 Eric Miller
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the University of California, Santa Cruz nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer3::HP9300;
|
||||
|
||||
use strict;
|
||||
use Exporter;
|
||||
use SNMP::Info::Layer3;
|
||||
use SNMP::Info::FDP;
|
||||
use SNMP::Info::LLDP;
|
||||
|
||||
@SNMP::Info::Layer3::HP9300::ISA = qw/SNMP::Info::FDP SNMP::Info::LLDP
|
||||
SNMP::Info::Layer3 Exporter/;
|
||||
@SNMP::Info::Layer3::HP9300::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/;
|
||||
|
||||
$VERSION = '3.35';
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer3::MIBS,
|
||||
%SNMP::Info::LLDP::MIBS,
|
||||
%SNMP::Info::FDP::MIBS,
|
||||
'HP-SN-ROOT-MIB' => 'hp',
|
||||
'HP-SN-AGENT-MIB' => 'snChasPwrSupplyDescription',
|
||||
'HP-SN-SWITCH-GROUP-MIB' => 'snSwGroupOperMode',
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer3::GLOBALS,
|
||||
%SNMP::Info::LLDP::GLOBALS,
|
||||
%SNMP::Info::FDP::GLOBALS,
|
||||
'mac' => 'ifPhysAddress.1',
|
||||
'chassis' => 'entPhysicalDescr.1',
|
||||
'temp' => 'snChasActualTemperature',
|
||||
'ps1_type' => 'snChasPwrSupplyDescription.1',
|
||||
'ps1_status' => 'snChasPwrSupplyOperStatus.1',
|
||||
'fan' => 'snChasFanOperStatus.1',
|
||||
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer3::FUNCS,
|
||||
%SNMP::Info::LLDP::FUNCS,
|
||||
%SNMP::Info::FDP::FUNCS,
|
||||
|
||||
# HP-SN-SWITCH-GROUP-MIB
|
||||
# snSwPortInfoTable - Switch Port Information Group
|
||||
# Fully qualify these since FDP class will load
|
||||
# FOUNDRY-SN-SWITCH-GROUP-MIB which contains the same leaf names
|
||||
'sw_index' => 'HP_SN_SWITCH_GROUP_MIB__snSwPortIfIndex',
|
||||
'sw_duplex' => 'HP_SN_SWITCH_GROUP_MIB__snSwPortInfoChnMode',
|
||||
'sw_type' => 'HP_SN_SWITCH_GROUP_MIB__snSwPortInfoMediaType',
|
||||
'sw_speed' => 'HP_SN_SWITCH_GROUP_MIB__snSwPortInfoSpeed',
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
%SNMP::Info::Layer3::MUNGE, %SNMP::Info::LLDP::MUNGE,
|
||||
%SNMP::Info::FDP::MUNGE,
|
||||
);
|
||||
|
||||
sub i_ignore {
|
||||
my $hp9300 = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $interfaces = $hp9300->interfaces($partial) || {};
|
||||
|
||||
my %i_ignore;
|
||||
foreach my $if ( keys %$interfaces ) {
|
||||
if ( $interfaces->{$if} =~ /(tunnel|loopback|\blo\b|lb|null)/i ) {
|
||||
$i_ignore{$if}++;
|
||||
}
|
||||
}
|
||||
return \%i_ignore;
|
||||
}
|
||||
|
||||
sub i_duplex {
|
||||
my $hp9300 = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $sw_index = $hp9300->sw_index($partial);
|
||||
my $sw_duplex = $hp9300->sw_duplex($partial);
|
||||
|
||||
unless ( defined $sw_index and defined $sw_duplex ) {
|
||||
return $hp9300->SUPER::i_duplex();
|
||||
}
|
||||
|
||||
my %i_duplex;
|
||||
foreach my $sw_port ( keys %$sw_duplex ) {
|
||||
my $iid = $sw_index->{$sw_port};
|
||||
my $duplex = $sw_duplex->{$sw_port};
|
||||
next if $duplex =~ /none/i;
|
||||
$i_duplex{$iid} = 'half' if $duplex =~ /half/i;
|
||||
$i_duplex{$iid} = 'full' if $duplex =~ /full/i;
|
||||
}
|
||||
return \%i_duplex;
|
||||
}
|
||||
|
||||
sub model {
|
||||
my $hp9300 = shift;
|
||||
my $id = $hp9300->id();
|
||||
my $model = &SNMP::translateObj($id);
|
||||
|
||||
return $id unless defined $model;
|
||||
|
||||
$model =~ s/^hpSwitch//;
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
sub os {
|
||||
return 'hp';
|
||||
}
|
||||
|
||||
sub vendor {
|
||||
return 'hp';
|
||||
}
|
||||
|
||||
sub os_ver {
|
||||
my $hp9300 = shift;
|
||||
|
||||
return $hp9300->snAgImgVer() if ( defined $hp9300->snAgImgVer() );
|
||||
|
||||
# Some older ones don't have this value,so we cull it from the description
|
||||
my $descr = $hp9300->description();
|
||||
if ( $descr =~ m/Version (\d\S*)/ ) {
|
||||
return $1;
|
||||
}
|
||||
|
||||
# Last resort
|
||||
return $hp9300->SUPER::os_ver();
|
||||
|
||||
}
|
||||
|
||||
sub serial {
|
||||
my $hp9300 = shift;
|
||||
|
||||
# Return chassis serial number if available
|
||||
return $hp9300->snChasSerNum() if ( $hp9300->snChasSerNum() );
|
||||
|
||||
# If no chassis serial use first module serial
|
||||
my $mod_serials = $hp9300->snAgentConfigModuleSerialNumber();
|
||||
|
||||
foreach my $mod ( sort keys %$mod_serials ) {
|
||||
my $serial = $mod_serials->{$mod} || '';
|
||||
next unless defined $serial;
|
||||
return $serial;
|
||||
}
|
||||
|
||||
# Last resort
|
||||
return $hp9300->SUPER::serial();
|
||||
}
|
||||
|
||||
sub interfaces {
|
||||
my $hp9300 = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $i_descr = $hp9300->i_description($partial) || {};
|
||||
my $i_name = $hp9300->i_name($partial) || {};
|
||||
|
||||
# Use ifName 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;
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer3::HP9300 - SNMP Interface to HP Foundry OEM Network Devices
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Eric Miller
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $hp9300 = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
DestHost => 'myswitch',
|
||||
Community => 'public',
|
||||
Version => 1
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $hp9300->class();
|
||||
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Abstraction subclass for HP network devices which Foundry Networks was the
|
||||
Original Equipment Manufacturer (OEM) such as the HP ProCurve 9300 series.
|
||||
|
||||
For speed or debugging purposes you can call the subclass directly, but not
|
||||
after determining a more specific class using the method above.
|
||||
|
||||
my $hp9300 = new SNMP::Info::Layer3::HP9300(...);
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info::Layer3;
|
||||
|
||||
=item SNMP::Info::FDP;
|
||||
|
||||
=item SNMP::Info::LLDP;
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item F<HP-SN-ROOT-MIB>
|
||||
|
||||
=item F<HP-SN-AGENT-MIB>
|
||||
|
||||
=item F<HP-SN-SWITCH-GROUP-MIB>
|
||||
|
||||
=item Inherited Classes' MIBs
|
||||
|
||||
See L<SNMP::Info::Layer3/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
See L<SNMP::Info::FDP/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
See L<SNMP::Info::LLDP/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
=back
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar value from SNMP
|
||||
|
||||
=over
|
||||
|
||||
=item $hp9300->model()
|
||||
|
||||
Returns model type. Checks $hp9300->id() against the F<HP-SN-ROOT-MIB>
|
||||
and removes C<hpSwitch>.
|
||||
|
||||
=item $hp9300->vendor()
|
||||
|
||||
Returns 'hp'
|
||||
|
||||
=item $hp9300->os()
|
||||
|
||||
Returns 'hp'
|
||||
|
||||
=item $hp9300->os_ver()
|
||||
|
||||
Returns the software version
|
||||
|
||||
=item $hp9300->mac()
|
||||
|
||||
Returns MAC Address of root port.
|
||||
|
||||
(C<ifPhysAddress.1>)
|
||||
|
||||
=item $hp9300->chassis()
|
||||
|
||||
Returns Chassis type.
|
||||
|
||||
(C<entPhysicalDescr.1>)
|
||||
|
||||
=item $hp9300->serial()
|
||||
|
||||
Returns serial number of device.
|
||||
|
||||
=item $hp9300->temp()
|
||||
|
||||
Returns the chassis temperature
|
||||
|
||||
(C<snChasActualTemperature>)
|
||||
|
||||
=item $hp9300->ps1_type()
|
||||
|
||||
Returns the Description for the power supply
|
||||
|
||||
(C<snChasPwrSupplyDescription.1>)
|
||||
|
||||
=item $hp9300->ps1_status()
|
||||
|
||||
Returns the status of the power supply.
|
||||
|
||||
(C<snChasPwrSupplyOperStatus.1>)
|
||||
|
||||
=item $hp9300->fan()
|
||||
|
||||
Returns the status of the chassis fan.
|
||||
|
||||
(C<snChasFanOperStatus.1>)
|
||||
|
||||
=back
|
||||
|
||||
=head2 Global Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"GLOBALS"> for details.
|
||||
|
||||
=head2 Global Methods imported from SNMP::Info::FDP
|
||||
|
||||
See documentation in L<SNMP::Info::FDP/"GLOBALS"> for details.
|
||||
|
||||
=head2 Global Methods imported from SNMP::Info::LLDP
|
||||
|
||||
See documentation in L<SNMP::Info::LLDP/"GLOBALS"> for details.
|
||||
|
||||
=head1 TABLE METHODS
|
||||
|
||||
These are methods that return tables of information in the form of a reference
|
||||
to a hash.
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=over
|
||||
|
||||
=item $hp9300->interfaces()
|
||||
|
||||
Returns reference to hash of interface names to iids.
|
||||
|
||||
=item $hp9300->i_ignore()
|
||||
|
||||
Returns reference to hash of interfaces to be ignored.
|
||||
|
||||
Ignores interfaces with descriptions of tunnel,loopback,null
|
||||
|
||||
=item $hp9300->i_duplex()
|
||||
|
||||
Returns reference to hash of interface link duplex status.
|
||||
|
||||
Crosses $hp9300->sw_duplex() with $hp9300->sw_index()
|
||||
|
||||
=back
|
||||
|
||||
=head2 Switch Port Information Table (C<snSwPortIfTable>)
|
||||
|
||||
=over
|
||||
|
||||
=item $hp9300->sw_index()
|
||||
|
||||
Returns reference to hash. Maps Table to Interface IID.
|
||||
|
||||
(C<snSwPortIfIndex>)
|
||||
|
||||
=item $hp9300->sw_duplex()
|
||||
|
||||
Returns reference to hash. Current duplex status for switch ports.
|
||||
|
||||
(C<snSwPortInfoChnMode>)
|
||||
|
||||
=item $hp9300->sw_type()
|
||||
|
||||
Returns reference to hash. Current Port Type .
|
||||
|
||||
(C<snSwPortInfoMediaType>)
|
||||
|
||||
=item $hp9300->sw_speed()
|
||||
|
||||
Returns reference to hash. Current Port Speed.
|
||||
|
||||
(C<snSwPortInfoSpeed>)
|
||||
|
||||
=back
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::FDP
|
||||
|
||||
See documentation in L<SNMP::Info::FDP/"TABLE METHODS"> for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::LLDP
|
||||
|
||||
See documentation in L<SNMP::Info::LLDP/"TABLE METHODS"> for details.
|
||||
|
||||
=cut
|
||||
232
lib/SNMP/Info/Layer3/Huawei.pm
Normal file
232
lib/SNMP/Info/Layer3/Huawei.pm
Normal file
@@ -0,0 +1,232 @@
|
||||
# SNMP::Info::Layer3::Huawei
|
||||
#
|
||||
# Copyright (c) 2015 Jeroen van Ingen
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the University of California, Santa Cruz nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer3::Huawei;
|
||||
|
||||
use strict;
|
||||
use Exporter;
|
||||
use SNMP::Info::Layer3;
|
||||
use SNMP::Info::LLDP;
|
||||
use SNMP::Info::IEEE802dot3ad 'agg_ports_lag';
|
||||
|
||||
@SNMP::Info::Layer3::Huawei::ISA = qw/
|
||||
SNMP::Info::IEEE802dot3ad
|
||||
SNMP::Info::LLDP
|
||||
SNMP::Info::Layer3
|
||||
Exporter
|
||||
/;
|
||||
@SNMP::Info::Layer3::Huawei::EXPORT_OK = qw/
|
||||
agg_ports
|
||||
/;
|
||||
|
||||
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/;
|
||||
|
||||
$VERSION = '3.35';
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer3::MIBS,
|
||||
%SNMP::Info::LLDP::MIBS,
|
||||
%SNMP::Info::IEEE802dot3ad::MIBS,
|
||||
'HUAWEI-MIB' => 'quidway',
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer3::GLOBALS,
|
||||
%SNMP::Info::LLDP::GLOBALS,
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer3::FUNCS,
|
||||
%SNMP::Info::LLDP::FUNCS,
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
%SNMP::Info::Layer3::MUNGE,
|
||||
%SNMP::Info::LLDP::MUNGE,
|
||||
);
|
||||
|
||||
sub vendor {
|
||||
return "Huawei";
|
||||
}
|
||||
|
||||
sub os {
|
||||
my $huawei = shift;
|
||||
my $descr = $huawei->description();
|
||||
|
||||
return $1 if ( $descr =~ /\b(VRP)\b/ );
|
||||
return "huawei";
|
||||
}
|
||||
|
||||
sub os_ver {
|
||||
my $huawei = shift;
|
||||
my $descr = $huawei->description();
|
||||
my $os_ver = undef;
|
||||
|
||||
$os_ver = "$1" if ( $descr =~ /\bVersion ([0-9.]+)/i );
|
||||
|
||||
return $os_ver;
|
||||
}
|
||||
|
||||
sub i_ignore {
|
||||
my $l3 = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $interfaces = $l3->interfaces($partial) || {};
|
||||
|
||||
my %i_ignore;
|
||||
foreach my $if ( keys %$interfaces ) {
|
||||
|
||||
# lo0 etc
|
||||
if ( $interfaces->{$if} =~ /\b(inloopback|console)\d*\b/i ) {
|
||||
$i_ignore{$if}++;
|
||||
}
|
||||
}
|
||||
return \%i_ignore;
|
||||
}
|
||||
|
||||
sub agg_ports { return agg_ports_lag(@_) }
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer3::Huawei - SNMP Interface to Huawei Layer 3 switches and routers.
|
||||
|
||||
=head1 AUTHORS
|
||||
|
||||
Jeroen van Ingen
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $huawei = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
DestHost => 'myrouter',
|
||||
Community => 'public',
|
||||
Version => 2
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $huawei->class();
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Subclass for Huawei Quidway switches
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info::Layer3
|
||||
|
||||
=item SNMP::Info::LLDP
|
||||
|
||||
=item SNMP::Info::IEEE802dot3ad
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item F<HUAWEI-MIB>
|
||||
|
||||
=item Inherited Classes' MIBs
|
||||
|
||||
See L<SNMP::Info::Layer3> for its own MIB requirements.
|
||||
|
||||
See L<SNMP::Info::LLDP> for its own MIB requirements.
|
||||
|
||||
See L<SNMP::Info::IEEE802dot3ad> for its own MIB requirements.
|
||||
|
||||
=back
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar value from SNMP
|
||||
|
||||
=over
|
||||
|
||||
=item $huawei->vendor()
|
||||
|
||||
Returns 'Huawei'.
|
||||
|
||||
=item $huawei->os()
|
||||
|
||||
Returns 'VRP' if contained in C<sysDescr>, 'huawei' otherwise.
|
||||
|
||||
=item $huawei->os_ver()
|
||||
|
||||
Returns the software version extracted from C<sysDescr>.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Globals imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3> for details.
|
||||
|
||||
=head2 Globals imported from SNMP::Info::LLDP
|
||||
|
||||
See documentation in L<SNMP::Info::LLDP> for details.
|
||||
|
||||
=head1 TABLE ENTRIES
|
||||
|
||||
These are methods that return tables of information in the form of a reference
|
||||
to a hash.
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=over
|
||||
|
||||
=item $huawei->i_ignore()
|
||||
|
||||
Returns reference to hash. Increments value of IID if port is to be ignored.
|
||||
|
||||
Ignores InLoopback and Console interfaces
|
||||
|
||||
=item C<agg_ports>
|
||||
|
||||
Returns a HASH reference mapping from slave to master port for each member of
|
||||
a port bundle on the device. Keys are ifIndex of the slave ports, Values are
|
||||
ifIndex of the corresponding master ports.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3> for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::LLDP
|
||||
|
||||
See documentation in L<SNMP::Info::LLDP> for details.
|
||||
|
||||
=cut
|
||||
407
lib/SNMP/Info/Layer3/IBMGbTor.pm
Normal file
407
lib/SNMP/Info/Layer3/IBMGbTor.pm
Normal file
@@ -0,0 +1,407 @@
|
||||
# SNMP::Info::Layer3::IBMGbTor - SNMP Interface to IBM Rackswitch devices
|
||||
# $Id$
|
||||
#
|
||||
# Copyright (c) 2013 Eric Miller
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the University of California, Santa Cruz nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer3::IBMGbTor;
|
||||
|
||||
use strict;
|
||||
use Exporter;
|
||||
use SNMP::Info::Layer3;
|
||||
use SNMP::Info::LLDP;
|
||||
|
||||
@SNMP::Info::Layer3::IBMGbTor::ISA
|
||||
= qw/SNMP::Info::LLDP SNMP::Info::Layer3 Exporter/;
|
||||
@SNMP::Info::Layer3::IBMGbTor::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/;
|
||||
|
||||
$VERSION = '3.35';
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer3::MIBS,
|
||||
|
||||
# LLDP MIBs not loaded to prevent possible unqualified namespace conflict
|
||||
# with IBM definitions
|
||||
'IBM-GbTOR-10G-L2L3-MIB' => 'lldpInfoRemoteDevicesLocalPort',
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer3::GLOBALS,
|
||||
%SNMP::Info::LLDP::GLOBALS,
|
||||
'temp' => 'hwTempSensors',
|
||||
'fan' => 'hwFanSpeed',
|
||||
|
||||
# Can't find the equivalent in IBM-GbTOR-10G-L2L3-MIB
|
||||
# use a different strategy for lldp_sys_cap in hasLLDP()
|
||||
#'lldp_sysname' => 'lldpLocSysName',
|
||||
#'lldp_sysdesc' => 'lldpLocSysDesc',
|
||||
#'lldp_sys_cap' => 'lldpLocSysCapEnabled',
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer3::FUNCS,
|
||||
%SNMP::Info::LLDP::FUNCS,
|
||||
|
||||
# IBM-GbTOR-10G-L2L3-MIB::portInfoTable
|
||||
'sw_duplex' => 'portInfoMode',
|
||||
|
||||
# Can't find the equivalent in IBM-GbTOR-10G-L2L3-MIB
|
||||
# not currently used in LLDP class
|
||||
#'lldp_lman_addr' => 'lldpLocManAddrIfId',
|
||||
|
||||
# IBM-GbTOR-10G-L2L3-MIB::lldpInfoPortTable
|
||||
'lldp_port_status' => 'lldpInfoPortAdminStatus',
|
||||
|
||||
# IBM-GbTOR-10G-L2L3-MIB::lldpInfoRemoteDevicesTable
|
||||
'lldp_rem_id_type' => 'lldpInfoRemoteDevicesChassisSubtype',
|
||||
'lldp_rem_id' => 'lldpInfoRemoteDevicesSystemName',
|
||||
'lldp_rem_pid_type' => 'lldpInfoRemoteDevicesPortSubtype',
|
||||
'lldp_rem_pid' => 'lldpInfoRemoteDevicesPortId',
|
||||
'lldp_rem_desc' => 'lldpInfoRemoteDevicesPortDescription',
|
||||
'lldp_rem_sysname' => 'lldpInfoRemoteDevicesSystemName',
|
||||
'lldp_rem_sysdesc' => 'lldpInfoRemoteDevicesSystemDescription',
|
||||
'lldp_rem_sys_cap' => 'lldpInfoRemoteDevicesSystemCapEnabled',
|
||||
|
||||
# IBM-GbTOR-10G-L2L3-MIB::lldpInfoRemoteDevicesManAddrTable
|
||||
'lldp_rman_type' => 'lldpInfoRemoteDevicesManAddrSubtype',
|
||||
'lldp_rman_addr' => 'lldpInfoRemoteDevicesManAddr',
|
||||
);
|
||||
|
||||
%MUNGE = ( %SNMP::Info::Layer3::MUNGE, %SNMP::Info::LLDP::MUNGE, );
|
||||
|
||||
sub hasLLDP {
|
||||
my $ibm = shift;
|
||||
|
||||
# We may be have LLDP, but nothing in lldpRemoteSystemsData Tables
|
||||
# Look to see if LLDP Rx enabled on any port
|
||||
my $lldp_cap = $ibm->lldp_port_status();
|
||||
|
||||
foreach my $if ( keys %$lldp_cap ) {
|
||||
if ( $lldp_cap->{$if} =~ /enabledRx/i ) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
sub lldp_ip {
|
||||
my $ibm = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $rman_type = $ibm->lldp_rman_type($partial) || {};
|
||||
my $rman_addr = $ibm->lldp_rman_addr($partial) || {};
|
||||
|
||||
my %lldp_ip;
|
||||
foreach my $key ( keys %$rman_addr ) {
|
||||
my $type = $rman_type->{$key};
|
||||
next unless defined $type;
|
||||
next unless $type eq 'ipV4';
|
||||
if ( $key =~ /^(\d+)\./ ) {
|
||||
$lldp_ip{$1} = $rman_addr->{$key};
|
||||
}
|
||||
}
|
||||
return \%lldp_ip;
|
||||
}
|
||||
|
||||
sub lldp_if {
|
||||
my $lldp = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $lldp_desc = $lldp->lldpInfoRemoteDevicesLocalPort($partial) || {};
|
||||
my $i_descr = $lldp->i_description() || {};
|
||||
my $i_alias = $lldp->i_alias() || {};
|
||||
my %r_i_descr = reverse %$i_descr;
|
||||
my %r_i_alias = reverse %$i_alias;
|
||||
|
||||
my %lldp_if;
|
||||
foreach my $key ( keys %$lldp_desc ) {
|
||||
|
||||
# Cross reference lldpLocPortDesc with ifDescr and ifAlias to get ifIndex,
|
||||
# prefer ifAlias over ifDescr since MIB says 'alias'.
|
||||
my $desc = $lldp_desc->{$key};
|
||||
next unless $desc;
|
||||
my $port = $desc;
|
||||
|
||||
# If cross reference is successful use it, otherwise stick with
|
||||
# lldpRemLocalPortNum
|
||||
if ( exists $r_i_alias{$desc} ) {
|
||||
$port = $r_i_alias{$desc};
|
||||
}
|
||||
elsif ( exists $r_i_descr{$desc} ) {
|
||||
$port = $r_i_descr{$desc};
|
||||
}
|
||||
|
||||
$lldp_if{$key} = $port;
|
||||
}
|
||||
return \%lldp_if;
|
||||
}
|
||||
|
||||
sub lldp_platform {
|
||||
my $ibm = shift;
|
||||
my $partial = shift;
|
||||
|
||||
return $ibm->lldpInfoRemoteDevicesSystemDescription($partial);
|
||||
}
|
||||
|
||||
sub i_ignore {
|
||||
my $ibm = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $interfaces = $ibm->interfaces($partial) || {};
|
||||
|
||||
my %i_ignore;
|
||||
foreach my $if ( keys %$interfaces ) {
|
||||
if ( $interfaces->{$if} =~ /(tunnel|loopback|\blo\b|lb|null)/i ) {
|
||||
$i_ignore{$if}++;
|
||||
}
|
||||
}
|
||||
return \%i_ignore;
|
||||
}
|
||||
|
||||
sub i_duplex {
|
||||
my $ibm = shift;
|
||||
my $partial = shift;
|
||||
|
||||
return $ibm->sw_duplex($partial);
|
||||
}
|
||||
|
||||
sub model {
|
||||
my $ibm = shift;
|
||||
my $id = $ibm->id();
|
||||
my $descr = $ibm->description();
|
||||
my $model = &SNMP::translateObj($id);
|
||||
|
||||
if ( $descr =~ /RackSwitch\s(.*)/ ) {
|
||||
return $1;
|
||||
}
|
||||
|
||||
return $model || $id;
|
||||
}
|
||||
|
||||
sub os {
|
||||
return 'ibm';
|
||||
}
|
||||
|
||||
sub vendor {
|
||||
return 'ibm';
|
||||
}
|
||||
|
||||
sub os_ver {
|
||||
my $ibm = shift;
|
||||
|
||||
return $ibm->agSoftwareVersion();
|
||||
}
|
||||
|
||||
sub interfaces {
|
||||
my $ibm = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $i_descr = $ibm->i_description($partial) || {};
|
||||
my $i_name = $ibm->i_name($partial) || {};
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer3::IBMGbTor - SNMP Interface to IBM Rackswitch devices
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Eric Miller
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $ibm = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
DestHost => 'myswitch',
|
||||
Community => 'public',
|
||||
Version => 1
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $ibm->class();
|
||||
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Abstraction subclass for IBM Rackswitch (formerly Blade Network Technologies)
|
||||
network devices.
|
||||
|
||||
For speed or debugging purposes you can call the subclass directly, but not
|
||||
after determining a more specific class using the method above.
|
||||
|
||||
my $ibm = new SNMP::Info::Layer3::IBMGbTor(...);
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info::Layer3;
|
||||
|
||||
=item SNMP::Info::LLDP;
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item F<IBM-GbTOR-10G-L2L3-MIB>
|
||||
|
||||
=item Inherited Classes' MIBs
|
||||
|
||||
See L<SNMP::Info::Layer3/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
=back
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar value from SNMP
|
||||
|
||||
=over
|
||||
|
||||
=item $ibm->model()
|
||||
|
||||
Returns model type. Attempts to pull model from device description.
|
||||
Otherwise checks $ibm->id() against the F<IBM-GbTOR-10G-L2L3-MIB>.
|
||||
|
||||
=item $ibm->vendor()
|
||||
|
||||
Returns 'ibm'
|
||||
|
||||
=item $ibm->os()
|
||||
|
||||
Returns 'ibm'
|
||||
|
||||
=item $ibm->os_ver()
|
||||
|
||||
Returns the software version
|
||||
|
||||
(C<agSoftwareVersion>)
|
||||
|
||||
=item $ibm->temp()
|
||||
|
||||
(C<hwTempSensors>)
|
||||
|
||||
=item $ibm->fan()
|
||||
|
||||
(C<hwFanSpeed>)
|
||||
|
||||
=back
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=over
|
||||
|
||||
=item $ibm->hasLLDP()
|
||||
|
||||
Is LLDP is active in this device?
|
||||
|
||||
Note: LLDP may be active, but nothing in C<lldpRemoteSystemsData> Tables so
|
||||
the device would not return any useful topology information.
|
||||
|
||||
Checks to see if at least one interface is enabled to receive LLDP packets.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Global Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"GLOBALS"> for details.
|
||||
|
||||
=head2 Global Methods imported from SNMP::Info::LLDP
|
||||
|
||||
See documentation in L<SNMP::Info::LLDP/"GLOBALS"> for details.
|
||||
|
||||
=head1 TABLE METHODS
|
||||
|
||||
These are methods that return tables of information in the form of a reference
|
||||
to a hash.
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=over
|
||||
|
||||
=item $ibm->interfaces()
|
||||
|
||||
Returns reference to hash of interface names to iids.
|
||||
|
||||
=item $ibm->i_ignore()
|
||||
|
||||
Returns reference to hash of interfaces to be ignored.
|
||||
|
||||
Ignores interfaces with descriptions of tunnel, loopback, and null.
|
||||
|
||||
=item $ibm->i_duplex()
|
||||
|
||||
Returns reference to hash of interface link duplex status.
|
||||
|
||||
(C<portInfoMode>)
|
||||
|
||||
=item $ibm->lldp_if()
|
||||
|
||||
Returns the mapping to the SNMP Interface Table. Tries to cross reference
|
||||
(C<lldpInfoRemoteDevicesLocalPort>) with (C<ifDescr>) and (C<ifAlias>)
|
||||
to get (C<ifIndex>).
|
||||
|
||||
=item $ibm->lldp_ip()
|
||||
|
||||
Returns remote IPv4 address. Returns for all other address types, use
|
||||
lldp_addr if you want any return address type.
|
||||
|
||||
=item $ibm->lldp_platform()
|
||||
|
||||
Returns remote device system description.
|
||||
|
||||
(C<lldpInfoRemoteDevicesSystemDescription>)
|
||||
|
||||
=back
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::LLDP
|
||||
|
||||
See documentation in L<SNMP::Info::LLDP/"TABLE METHODS"> for details.
|
||||
|
||||
=cut
|
||||
793
lib/SNMP/Info/Layer3/Juniper.pm
Normal file
793
lib/SNMP/Info/Layer3/Juniper.pm
Normal file
@@ -0,0 +1,793 @@
|
||||
# SNMP::Info::Layer3::Juniper
|
||||
# $Id$
|
||||
#
|
||||
# Copyright (c) 2008 Bill Fenner
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the University of California, Santa Cruz nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer3::Juniper;
|
||||
|
||||
use strict;
|
||||
use Exporter;
|
||||
use SNMP::Info::Layer3;
|
||||
use SNMP::Info::LLDP;
|
||||
|
||||
@SNMP::Info::Layer3::Juniper::ISA = qw/SNMP::Info::Layer3 SNMP::Info::LLDP Exporter/;
|
||||
@SNMP::Info::Layer3::Juniper::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %MUNGE/;
|
||||
|
||||
$VERSION = '3.35';
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer3::MIBS,
|
||||
%SNMP::Info::LLDP::MIBS,
|
||||
'JUNIPER-CHASSIS-DEFINES-MIB' => 'jnxChassisDefines',
|
||||
'JUNIPER-MIB' => 'jnxBoxAnatomy',
|
||||
'JUNIPER-VIRTUALCHASSIS-MIB' => 'jnxVirtualChassisMemberTable',
|
||||
'JUNIPER-VLAN-MIB' => 'jnxVlanMIBObjects',
|
||||
'JUNIPER-L2ALD-MIB' => 'jnxL2aldVlanFdbId',
|
||||
);
|
||||
|
||||
%GLOBALS = ( %SNMP::Info::Layer3::GLOBALS,
|
||||
%SNMP::Info::LLDP::GLOBALS,
|
||||
'serial' => 'jnxBoxSerialNo.0',
|
||||
'mac' => 'dot1dBaseBridgeAddress',
|
||||
'box_descr' => 'jnxBoxDescr'
|
||||
);
|
||||
|
||||
%FUNCS = ( %SNMP::Info::Layer3::FUNCS,
|
||||
%SNMP::Info::LLDP::FUNCS,
|
||||
|
||||
# JUNIPER-VLAN-MIB::jnxExVlanTable
|
||||
'v_index' => 'jnxExVlanTag',
|
||||
'v_type' => 'jnxExVlanType',
|
||||
'v_name' => 'jnxExVlanName',
|
||||
|
||||
# JUNIPER-VLAN-MIB::jnxExVlanPortGroupTable
|
||||
'i_trunk' => 'jnxExVlanPortAccessMode',
|
||||
|
||||
# JUNPIER-MIB
|
||||
'e_contents_type' => 'jnxContentsType',
|
||||
'e_containers_type' => 'jnxContainersType',
|
||||
'e_hwver' => 'jnxContentsRevision',
|
||||
|
||||
'v_fdb_id' => 'jnxL2aldVlanFdbId',
|
||||
'v_vlan_tag' => 'jnxL2aldVlanTag',
|
||||
);
|
||||
|
||||
%MUNGE = ( %SNMP::Info::Layer3::MUNGE,
|
||||
%SNMP::Info::LLDP::MUNGE,
|
||||
'e_containers_type' => \&SNMP::Info::munge_e_type,
|
||||
'e_contents_type' => \&SNMP::Info::munge_e_type,
|
||||
);
|
||||
|
||||
sub vendor {
|
||||
return 'juniper';
|
||||
}
|
||||
|
||||
sub os {
|
||||
return 'junos';
|
||||
}
|
||||
|
||||
sub layers {
|
||||
my $juniper = shift;
|
||||
|
||||
my $layers = $juniper->SUPER::layers();
|
||||
# Some models don't report L2 properly
|
||||
my $macs = $juniper->fw_mac();
|
||||
|
||||
if (keys %$macs) {
|
||||
my $l = substr $layers, 6, 1, "1";
|
||||
}
|
||||
|
||||
return $layers;
|
||||
}
|
||||
|
||||
sub os_ver {
|
||||
my $juniper = shift;
|
||||
|
||||
my $descr = $juniper->description() || '';
|
||||
my $lldp_descr = $juniper->lldp_sysdesc() || '';
|
||||
|
||||
if ( $descr =~ m/kernel JUNOS ([^,\s]+)/ ) {
|
||||
return $1;
|
||||
}
|
||||
elsif ( $lldp_descr =~ m/version\s(\S+)\s/ ) {
|
||||
return $1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
sub model {
|
||||
my $l3 = shift;
|
||||
my $id = $l3->id();
|
||||
|
||||
unless ( defined $id ) {
|
||||
print
|
||||
" SNMP::Info::Layer3::Juniper::model() - Device does not support sysObjectID\n"
|
||||
if $l3->debug();
|
||||
return;
|
||||
}
|
||||
|
||||
my $model = &SNMP::translateObj($id);
|
||||
|
||||
return $id unless defined $model;
|
||||
|
||||
$model =~ s/^jnxProductName//i;
|
||||
return $model;
|
||||
}
|
||||
|
||||
# Override the fancy Layer3.pm serial function
|
||||
sub serial {
|
||||
my $juniper = shift;
|
||||
return $juniper->orig_serial();
|
||||
}
|
||||
|
||||
# 'i_trunk' => 'jnxExVlanPortAccessMode',
|
||||
sub i_trunk {
|
||||
my $juniper = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $access = $juniper->jnxExVlanPortAccessMode($partial);
|
||||
|
||||
my %i_trunk;
|
||||
|
||||
foreach (keys %$access)
|
||||
{
|
||||
my $old_key = $_;
|
||||
m/^\d+\.(\d+)$/o;
|
||||
my $new_key = $1;
|
||||
$i_trunk{$new_key} = $access->{$old_key};
|
||||
}
|
||||
|
||||
return \%i_trunk;
|
||||
}
|
||||
|
||||
sub qb_fdb_index {
|
||||
my $juniper = shift;
|
||||
my $partial = shift;
|
||||
|
||||
return $juniper->jnxExVlanTag($partial);
|
||||
}
|
||||
|
||||
# 'v_type' => 'jnxExVlanType',
|
||||
sub v_type {
|
||||
my $juniper = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $v_type = $juniper->jnxExVlanType($partial);
|
||||
|
||||
return $v_type;
|
||||
}
|
||||
|
||||
# 'v_index' => 'jnxExVlanTag',
|
||||
sub v_index {
|
||||
my ($juniper) = shift;
|
||||
my ($partial) = shift;
|
||||
|
||||
my ($v_index) = $juniper->jnxExVlanTag($partial);
|
||||
|
||||
return $v_index;
|
||||
}
|
||||
|
||||
sub i_vlan {
|
||||
my $juniper = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $index = $juniper->bp_index();
|
||||
|
||||
# If given a partial it will be an ifIndex, we need to use dot1dBasePort
|
||||
if ($partial) {
|
||||
my %r_index = reverse %$index;
|
||||
$partial = $r_index{$partial};
|
||||
}
|
||||
|
||||
my $v_index = $juniper->jnxExVlanTag();
|
||||
my $i_pvid = $juniper->qb_i_vlan($partial) || {};
|
||||
my $i_vlan = {};
|
||||
|
||||
foreach my $bport ( keys %$i_pvid ) {
|
||||
my $q_vlan = $i_pvid->{$bport};
|
||||
my $vlan = $v_index->{$q_vlan} || $q_vlan;
|
||||
my $ifindex = $index->{$bport};
|
||||
unless ( defined $ifindex ) {
|
||||
print " Port $bport has no bp_index mapping. Skipping.\n"
|
||||
if $DEBUG;
|
||||
next;
|
||||
}
|
||||
$i_vlan->{$ifindex} = $vlan;
|
||||
}
|
||||
|
||||
return $i_vlan;
|
||||
}
|
||||
|
||||
# Index doesn't use VLAN ID, so override the HOA private method here to
|
||||
# correct the mapping
|
||||
sub _vlan_hoa {
|
||||
my $juniper = shift;
|
||||
my ( $v_ports, $partial ) = @_;
|
||||
|
||||
my $index = $juniper->bp_index();
|
||||
my $v_index = $juniper->jnxExVlanTag($partial);
|
||||
|
||||
my $vlan_hoa = {};
|
||||
foreach my $idx ( keys %$v_ports ) {
|
||||
next unless ( defined $v_ports->{$idx} );
|
||||
my $portlist = $v_ports->{$idx};
|
||||
my $ret = [];
|
||||
my $vlan_ndx;
|
||||
|
||||
# Strip TimeFilter if we're using VlanCurrentTable
|
||||
( $vlan_ndx = $idx ) =~ s/^\d+\.//;
|
||||
|
||||
# Convert portlist bit array to bp_index array
|
||||
for ( my $i = 0; $i <= $#$portlist; $i++ ) {
|
||||
push( @{$ret}, $i + 1 ) if ( @$portlist[$i] );
|
||||
}
|
||||
|
||||
#Create HoA ifIndex -> VLAN array
|
||||
foreach my $port ( @{$ret} ) {
|
||||
my $ifindex = $index->{$port};
|
||||
next unless ( defined($ifindex) ); # shouldn't happen
|
||||
next if ( defined $partial and $ifindex !~ /^$partial$/ );
|
||||
push( @{ $vlan_hoa->{$ifindex} }, $v_index->{$vlan_ndx} );
|
||||
}
|
||||
}
|
||||
return $vlan_hoa;
|
||||
}
|
||||
|
||||
sub i_vlan_membership {
|
||||
my $juniper = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $res;
|
||||
|
||||
my $dot1qVlanStaticEgressPorts = $juniper->dot1qVlanCurrentEgressPorts($partial) || $juniper->dot1qVlanStaticEgressPorts($partial);
|
||||
my $bp_index = $juniper->bp_index();
|
||||
foreach my $vlan (keys %$dot1qVlanStaticEgressPorts) {
|
||||
my @bp_indexes = split /,/, $dot1qVlanStaticEgressPorts->{$vlan};
|
||||
push @{$res->{$bp_index->{$_}}}, $vlan for @bp_indexes;
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
sub qb_fw_vlan {
|
||||
my $juniper = shift;
|
||||
|
||||
my $qb_fw_vlan = $juniper->SUPER::qb_fw_vlan();
|
||||
my $v_fdb_id = $juniper->v_fdb_id();
|
||||
my $v_vlan_tag = $juniper->v_vlan_tag();
|
||||
return $qb_fw_vlan unless $v_fdb_id && $v_vlan_tag;
|
||||
my %fdb_id_to_tag = reverse %$v_fdb_id;
|
||||
|
||||
foreach my $key (keys %$qb_fw_vlan) {
|
||||
my $v = $qb_fw_vlan->{$key};
|
||||
$qb_fw_vlan->{$key} = $v_vlan_tag->{$fdb_id_to_tag{$v}};
|
||||
}
|
||||
|
||||
return $qb_fw_vlan;
|
||||
}
|
||||
|
||||
# Pseudo ENTITY-MIB methods
|
||||
|
||||
# This class supports both virtual chassis (stackable) and physical chassis
|
||||
# based devices, identify if we have a virtual chassis so that we return
|
||||
# appropriate entPhysicalClass and correct ordering
|
||||
|
||||
sub _e_is_virtual {
|
||||
my $juniper = shift;
|
||||
|
||||
my $v_test = $juniper->jnxVirtualChassisMemberRole() || {};
|
||||
|
||||
#If we are functioning as a stack someone should be master
|
||||
foreach my $iid ( keys %$v_test ) {
|
||||
my $role = $v_test->{$iid};
|
||||
return 1 if ($role =~ /master/i);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub _e_virtual_index {
|
||||
my $juniper = shift;
|
||||
|
||||
my $containers = $juniper->jnxContainersWithin() || {};
|
||||
my $members = $juniper->jnxVirtualChassisMemberRole() || {};
|
||||
|
||||
my %v_index;
|
||||
foreach my $key (keys %$containers) {
|
||||
foreach my $member ( keys %$members ) {
|
||||
# Virtual chassis members start at zero
|
||||
$member++;
|
||||
# We will be duplicating and eliminating some keys,
|
||||
# but this is for the benefit of e_parent()
|
||||
my $index = sprintf ("%02d", $key) . sprintf ("%02d", $member) . "0000";
|
||||
my $iid = "$key\.$member\.0\.0";
|
||||
$v_index{$iid} = $index;
|
||||
}
|
||||
unless ($containers->{$key}) {
|
||||
my $index = sprintf ("%02d", $key) . "000000";
|
||||
$v_index{$key} = $index;
|
||||
}
|
||||
}
|
||||
return \%v_index;
|
||||
}
|
||||
|
||||
sub e_index {
|
||||
my $juniper = shift;
|
||||
|
||||
my $contents = $juniper->jnxContentsDescr() || {};
|
||||
my $containers = $juniper->jnxContainersDescr() || {};
|
||||
my $virtuals = $juniper->_e_virtual_index() || {};
|
||||
my $is_virtual = $juniper->_e_is_virtual();
|
||||
|
||||
# Format into consistent integer format so that numeric sorting works
|
||||
my %e_index;
|
||||
if ($is_virtual) {
|
||||
foreach my $key ( keys %$virtuals ) {
|
||||
$e_index{$key} = $virtuals->{$key};
|
||||
}
|
||||
}
|
||||
else {
|
||||
foreach my $key ( keys %$containers ) {
|
||||
$e_index{$key} = sprintf ("%02d", $key) . "000000";
|
||||
}
|
||||
}
|
||||
foreach my $key ( keys %$contents ) {
|
||||
$e_index{$key} = join( '', map { sprintf "%02d", $_ } split /\./, $key );
|
||||
}
|
||||
|
||||
return \%e_index;
|
||||
}
|
||||
|
||||
sub e_class {
|
||||
my $juniper = shift;
|
||||
|
||||
my $e_index = $juniper->e_index() || {};
|
||||
my $fru_type = $juniper->jnxFruType() || {};
|
||||
my $c_type = $juniper->jnxContainersDescr() || {};
|
||||
my $is_virtual = $juniper->_e_is_virtual();
|
||||
|
||||
my %e_class;
|
||||
foreach my $iid ( keys %$e_index ) {
|
||||
|
||||
my $type = $fru_type->{$iid} || 0;
|
||||
my $container = $c_type->{$iid} || 0;
|
||||
|
||||
if ( $type =~ /power/i ) {
|
||||
$e_class{$iid} = 'powerSupply';
|
||||
}
|
||||
elsif ( $type =~ /fan/i ) {
|
||||
$e_class{$iid} = 'fan';
|
||||
}
|
||||
elsif ( $type ) {
|
||||
$e_class{$iid} = 'module';
|
||||
}
|
||||
# Shouldn't get here if we have type which means
|
||||
# we only have container, chassis, and stack left
|
||||
elsif (($container =~ /chassis/i) and (!$is_virtual) ) {
|
||||
$e_class{$iid} = 'chassis';
|
||||
}
|
||||
elsif (($container =~ /chassis/i) and ($is_virtual)) {
|
||||
$e_class{$iid} = 'stack';
|
||||
}
|
||||
# Were calling the second level chassis a container in the case
|
||||
# of a virtual chassis but not sure that it really matters
|
||||
else {
|
||||
$e_class{$iid} = 'container';
|
||||
}
|
||||
}
|
||||
return \%e_class;
|
||||
}
|
||||
|
||||
sub e_descr {
|
||||
my $juniper = shift;
|
||||
|
||||
my $e_index = $juniper->e_index() || {};
|
||||
my $box_descr = $juniper->box_descr;
|
||||
my $contents = $juniper->jnxContentsDescr() || {};
|
||||
my $containers = $juniper->jnxContainersDescr() || {};
|
||||
|
||||
my %e_descr;
|
||||
foreach my $iid ( keys %$e_index ) {
|
||||
|
||||
my $content_descr = $contents->{$iid} || 0;
|
||||
my $container_descr = $containers->{$iid} || 0;
|
||||
|
||||
if ($content_descr) {
|
||||
$e_descr{$iid} = $content_descr;
|
||||
}
|
||||
elsif ($container_descr and $container_descr !~ /chassis/) {
|
||||
$e_descr{$iid} = $container_descr;
|
||||
}
|
||||
elsif ($container_descr and $container_descr =~ /chassis/) {
|
||||
$e_descr{$iid} = $box_descr;
|
||||
}
|
||||
# We should only be left with virtual entries created in
|
||||
# _e_virtual_index()
|
||||
elsif ($iid =~ /^(\d+)\.(\d+)(\.0)+?/) {
|
||||
my $descr = $containers->{$1};
|
||||
$e_descr{$iid} = $descr;
|
||||
}
|
||||
# Anything past here undef
|
||||
}
|
||||
return \%e_descr;
|
||||
}
|
||||
|
||||
sub e_serial {
|
||||
my $juniper = shift;
|
||||
|
||||
my $e_index = $juniper->e_index() || {};
|
||||
my $serials = $juniper->jnxContentsSerialNo() || {};
|
||||
my $e_class = $juniper->e_class() || {};
|
||||
my $is_virtual = $juniper->_e_is_virtual();
|
||||
my $box_serial = $juniper->serial();
|
||||
|
||||
my %e_serial;
|
||||
foreach my $iid ( keys %$e_index ) {
|
||||
my $serial = $serials->{$iid} || '';
|
||||
my $class = $e_class->{$iid} || '';
|
||||
# Chassis serial number is seperate on true chassis
|
||||
# Virtual chassis (stack) report master switch serial
|
||||
if (!$is_virtual and ($class =~ /chassis/i)){
|
||||
$e_serial{$iid} = $box_serial;
|
||||
}
|
||||
elsif (($serial !~ /^\w/) or ($serial =~ /builtin/i)) {
|
||||
next;
|
||||
}
|
||||
else {
|
||||
$e_serial{$iid} = $serial;
|
||||
}
|
||||
}
|
||||
return \%e_serial;
|
||||
}
|
||||
|
||||
sub e_fru {
|
||||
my $juniper = shift;
|
||||
|
||||
my $e_index = $juniper->e_index() || {};
|
||||
my $frus = $juniper->jnxContentsPartNo() || {};
|
||||
|
||||
my %e_fru;
|
||||
foreach my $iid ( keys %$e_index ) {
|
||||
my $fru = $frus->{$iid} || '';
|
||||
if ( ($fru !~ /^\w/) or ($fru =~ /builtin/i)) {
|
||||
$e_fru{$iid} = "false";
|
||||
}
|
||||
else {
|
||||
$e_fru{$iid} = "true";
|
||||
}
|
||||
}
|
||||
return \%e_fru;
|
||||
}
|
||||
|
||||
sub e_type {
|
||||
my $juniper = shift;
|
||||
|
||||
my $e_index = $juniper->e_index() || {};
|
||||
my $contents = $juniper->e_contents_type() || {};
|
||||
my $containers = $juniper->e_containers_type() || {};
|
||||
|
||||
my %e_type;
|
||||
foreach my $iid ( keys %$e_index ) {
|
||||
|
||||
my $content_type = $contents->{$iid} || 0;
|
||||
my $container_type = $containers->{$iid} || 0;
|
||||
|
||||
if ($content_type) {
|
||||
$content_type =~ s/\.0//;
|
||||
$e_type{$iid} = $content_type;
|
||||
}
|
||||
elsif ($container_type) {
|
||||
$container_type =~ s/\.0//;
|
||||
$e_type{$iid} = $container_type;
|
||||
}
|
||||
# We should only be left with virtual entries created in
|
||||
# _e_virtual_index()
|
||||
elsif ($iid =~ /^(\d+)\.(\d+)(\.0)+?/) {
|
||||
my $descr = $containers->{$1};
|
||||
$descr =~ s/\.0//;
|
||||
$e_type{$iid} = $descr;
|
||||
}
|
||||
# Anything past here undef
|
||||
}
|
||||
return \%e_type;
|
||||
}
|
||||
|
||||
sub e_vendor {
|
||||
my $juniper = shift;
|
||||
|
||||
my $e_idx = $juniper->e_index() || {};
|
||||
|
||||
my %e_vendor;
|
||||
foreach my $iid ( keys %$e_idx ) {
|
||||
$e_vendor{$iid} = 'juniper';
|
||||
}
|
||||
return \%e_vendor;
|
||||
}
|
||||
|
||||
sub e_pos {
|
||||
my $juniper = shift;
|
||||
|
||||
# We could look at index levels, but his will work as well
|
||||
return $juniper->e_index();
|
||||
}
|
||||
|
||||
sub e_parent {
|
||||
my $juniper = shift;
|
||||
|
||||
my $e_idx = $juniper->e_index() || {};
|
||||
my $c_within = $juniper->jnxContainersWithin() || {};
|
||||
my $e_descr = $juniper->e_descr() || {};
|
||||
my $is_virtual = $juniper->_e_is_virtual();
|
||||
|
||||
my %e_parent;
|
||||
foreach my $iid ( keys %$e_idx ) {
|
||||
next unless $iid;
|
||||
|
||||
my ($idx, $l1,$l2, $l3) = split /\./, $iid;
|
||||
my $within = $c_within->{$idx};
|
||||
my $descr = $e_descr->{$iid};
|
||||
|
||||
if ( !$is_virtual and ($iid =~ /^(\d+)\.\d+/) ) {
|
||||
$e_parent{$iid} = sprintf ("%02d", $1) . "000000";
|
||||
}
|
||||
elsif ( $is_virtual and ($descr =~ /chassis/i) and ($iid =~ /^(\d+)\.(\d+)(\.0)+?/) ) {
|
||||
$e_parent{$iid} = sprintf ("%02d", $1) . "000000";
|
||||
}
|
||||
elsif ( $is_virtual and ($iid =~ /^(\d+)\.(\d+)(\.0)+?/) ) {
|
||||
$e_parent{$iid} = sprintf ("%02d", $within) . sprintf ("%02d", $2) . "0000";
|
||||
}
|
||||
elsif ( $is_virtual and ($iid =~ /^(\d+)\.(\d+)\.[1-9]+/) ) {
|
||||
$e_parent{$iid} = sprintf ("%02d", $1) . sprintf ("%02d", $2) . "0000";
|
||||
}
|
||||
elsif ( defined $within and $iid =~ /\d+/ ) {
|
||||
$e_parent{$iid} = sprintf ("%02d", $within) . "000000";
|
||||
}
|
||||
else {
|
||||
next;
|
||||
}
|
||||
}
|
||||
return \%e_parent;
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer3::Juniper - SNMP Interface to L3 Juniper Devices
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Bill Fenner
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $juniper = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
DestHost => 'myrouter',
|
||||
Community => 'public',
|
||||
Version => 2
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $juniper->class();
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Subclass for Juniper Devices running JUNOS
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info::Layer3
|
||||
|
||||
=item SNMP::Info::LLDP
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item F<JUNIPER-VLAN-MIB> dated "200901090000Z" or later.
|
||||
|
||||
=item F<JUNIPER-CHASSIS-DEFINES-MIB>
|
||||
|
||||
=item F<JUNIPER-MIB>
|
||||
|
||||
=item F<JUNIPER-VIRTUALCHASSIS-MIB>
|
||||
|
||||
=back
|
||||
|
||||
=head2 Inherited Classes' MIBs
|
||||
|
||||
See L<SNMP::Info::Layer3/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
See L<SNMP::Info::LLDP/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar value from SNMP
|
||||
|
||||
=over
|
||||
|
||||
=item $juniper->vendor()
|
||||
|
||||
Returns 'juniper'
|
||||
|
||||
=item $juniper->os()
|
||||
|
||||
Returns 'junos'
|
||||
|
||||
=item $juniper->layers()
|
||||
|
||||
Checks forwarding table for Layer 2 support since some routers with switches
|
||||
do not report layers properly.
|
||||
|
||||
=item $juniper->os_ver()
|
||||
|
||||
Returns the software version extracted first from C<sysDescr> or
|
||||
C<lldpLocSysDesc> if not available in C<sysDescr>.
|
||||
|
||||
=item $juniper->model()
|
||||
|
||||
Returns the model from C<sysObjectID>, with C<jnxProductName> removed from the
|
||||
beginning.
|
||||
|
||||
=item $juniper->serial()
|
||||
|
||||
Returns serial number
|
||||
|
||||
(C<jnxBoxSerialNo.0>)
|
||||
|
||||
=item $juniper->mac()
|
||||
|
||||
Returns the MAC address used by this bridge when it must be referred
|
||||
to in a unique fashion.
|
||||
|
||||
(C<dot1dBaseBridgeAddress>)
|
||||
|
||||
=item $juniper->box_descr()
|
||||
|
||||
The name, model, or detailed description of the device.
|
||||
|
||||
(C<jnxBoxDescr.0>)
|
||||
|
||||
=back
|
||||
|
||||
=head2 Globals imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"GLOBALS"> for details.
|
||||
|
||||
=head2 Global Methods imported from SNMP::Info::LLDP
|
||||
|
||||
See documentation in L<SNMP::Info::LLDP/"GLOBALS"> for details.
|
||||
|
||||
=head1 TABLE METHODS
|
||||
|
||||
These are methods that return tables of information in the form of a reference
|
||||
to a hash.
|
||||
|
||||
=over
|
||||
|
||||
=item $juniper->qb_fdb_index()
|
||||
|
||||
Returns reference to hash: key = VLAN ID, value = FDB ID.
|
||||
|
||||
=item $juniper->v_index()
|
||||
|
||||
(C<jnxExVlanTag>)
|
||||
|
||||
=item $juniper->v_name()
|
||||
|
||||
(C<jnxExVlanName>)
|
||||
|
||||
=item $juniper->v_type()
|
||||
|
||||
(C<jnxExVlanType>)
|
||||
|
||||
=item $juniper->i_trunk()
|
||||
|
||||
(C<jnxExVlanPortAccessMode>)
|
||||
|
||||
=item $juniper->i_vlan()
|
||||
|
||||
Returns a mapping between C<ifIndex> and the PVID or default VLAN.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Pseudo F<ENTITY-MIB> information
|
||||
|
||||
These methods emulate F<ENTITY-MIB> Physical Table methods using
|
||||
F<JUNIPER-MIB> and F<JUNIPER-VIRTUALCHASSIS-MIB>.
|
||||
|
||||
=over
|
||||
|
||||
=item $juniper->e_index()
|
||||
|
||||
Returns reference to hash. Key: IID, Value: Integer, Indices are combined
|
||||
into a eight digit integer, each index is two digits padded with leading zero
|
||||
if required.
|
||||
|
||||
=item $juniper->e_class()
|
||||
|
||||
Returns reference to hash. Key: IID, Value: General hardware type.
|
||||
|
||||
=item $juniper->e_descr()
|
||||
|
||||
Returns reference to hash. Key: IID, Value: Human friendly name
|
||||
|
||||
=item $juniper->e_hwver()
|
||||
|
||||
Returns reference to hash. Key: IID, Value: Hardware version
|
||||
|
||||
=item $juniper->e_vendor()
|
||||
|
||||
Returns reference to hash. Key: IID, Value: juniper
|
||||
|
||||
=item $juniper->e_serial()
|
||||
|
||||
Returns reference to hash. Key: IID, Value: Serial number
|
||||
|
||||
=item $juniper->e_pos()
|
||||
|
||||
Returns reference to hash. Key: IID, Value: The relative position among all
|
||||
entities sharing the same parent.
|
||||
|
||||
=item $juniper->e_type()
|
||||
|
||||
Returns reference to hash. Key: IID, Value: Type of component/sub-component
|
||||
as defined in F<JUNIPER-CHASSIS-DEFINES-MIB>.
|
||||
|
||||
=item $juniper->e_parent()
|
||||
|
||||
Returns reference to hash. Key: IID, Value: The value of e_index() for the
|
||||
entity which 'contains' this entity. A value of zero indicates this entity
|
||||
is not contained in any other entity.
|
||||
|
||||
=item $entity->e_fru()
|
||||
|
||||
BOOLEAN. Is a Field Replaceable unit?
|
||||
|
||||
(C<entPhysicalFRU>)
|
||||
|
||||
=back
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::LLDP
|
||||
|
||||
See documentation in L<SNMP::Info::LLDP/"TABLE METHODS"> for details.
|
||||
|
||||
=cut
|
||||
271
lib/SNMP/Info/Layer3/Lantronix.pm
Normal file
271
lib/SNMP/Info/Layer3/Lantronix.pm
Normal file
@@ -0,0 +1,271 @@
|
||||
# SNMP::Info::Layer3::Lantronix
|
||||
# $Id$
|
||||
#
|
||||
# Copyright (c) 2012 J R Binks
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the University of California, Santa Cruz nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer3::Lantronix;
|
||||
|
||||
use strict;
|
||||
use Exporter;
|
||||
use SNMP::Info::Layer3;
|
||||
|
||||
@SNMP::Info::Layer3::Lantronix::ISA = qw/
|
||||
SNMP::Info::Layer3
|
||||
Exporter
|
||||
/;
|
||||
@SNMP::Info::Layer3::Lantronix::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
|
||||
|
||||
$VERSION = '3.35';
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer3::MIBS,
|
||||
'LANTRONIX-MIB' => 'products',
|
||||
'LANTRONIX-SLC-MIB' => 'slcNetwork',
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer3::GLOBALS,
|
||||
'slc_os_ver' => 'slcSystemFWRev',
|
||||
'slc_serial' => 'slcSystemSerialNo',
|
||||
'slc_model' => 'slcSystemModel',
|
||||
'slc_psu_a_status' => 'slcDevPowerSupplyA',
|
||||
'slc_psu_b_status' => 'slcDevPowerSupplyB',
|
||||
);
|
||||
|
||||
%FUNCS = ( %SNMP::Info::Layer3::FUNCS, );
|
||||
|
||||
%MUNGE = ( %SNMP::Info::Layer3::MUNGE, );
|
||||
|
||||
# General notes:
|
||||
#
|
||||
# Products like the EDS have very minimal MIB support for the basics.
|
||||
# Much information has to be derived from sysDescr string.
|
||||
#
|
||||
sub vendor {
|
||||
return 'lantronix';
|
||||
}
|
||||
|
||||
sub os {
|
||||
my $device = shift;
|
||||
my $descr = $device->description() || '';
|
||||
my $os;
|
||||
|
||||
# On EDS, it is called the "Evolution OS"
|
||||
# Not sure what, if any, name it has a name on other products
|
||||
$os = 'EvolutionOS' if ( $descr =~ m/Lantronix EDS\w+ V([\d\.R]+)/ );
|
||||
|
||||
return 'LantronixOS';
|
||||
}
|
||||
|
||||
sub os_ver {
|
||||
my $device = shift;
|
||||
my $descr = $device->description() || '';
|
||||
my $slc_os_ver = $device->slc_os_ver;
|
||||
my $os_ver;
|
||||
|
||||
return $slc_os_ver if defined $slc_os_ver;
|
||||
|
||||
return unless defined $descr;
|
||||
|
||||
# EDS: "Lantronix EDS16PR V4.0.0.0R15 (1307.....X)"
|
||||
$os_ver = $1 if ( $descr =~ m/Lantronix EDS\w+ V([\d\.R]+)/ );
|
||||
|
||||
return $os_ver;
|
||||
}
|
||||
|
||||
sub serial {
|
||||
my $device = shift;
|
||||
my $descr = $device->description() || '';
|
||||
my $slc_serial = $device->slc_serial;
|
||||
my $serial;
|
||||
|
||||
return $slc_serial if defined $slc_serial;
|
||||
|
||||
return unless defined $descr;
|
||||
|
||||
# EDS: "Lantronix EDS16PR V4.0.0.0R15 (1307.....X)"
|
||||
$serial = $1 if ( $descr =~ m/Lantronix EDS\w+ V[\d\.R]+ \((\w+)\)/ );
|
||||
|
||||
return $serial;
|
||||
}
|
||||
|
||||
sub model {
|
||||
my $device = shift;
|
||||
my $descr = $device->description() || '';
|
||||
my $slc_model = $device->slc_model;
|
||||
my $model;
|
||||
|
||||
return $slc_model if defined $slc_model;
|
||||
|
||||
return unless defined $descr;
|
||||
|
||||
# EDS: "Lantronix EDS16PR V4.0.0.0R15 (1307.....X)"
|
||||
$model = $1 if ( $descr =~ m/Lantronix (EDS\w+)/ );
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
sub ps1_status {
|
||||
my $device = shift;
|
||||
my $slc_psu_a_status = $device->slc_psu_a_status;
|
||||
|
||||
return $slc_psu_a_status if defined $slc_psu_a_status;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
sub ps2_status {
|
||||
my $device = shift;
|
||||
my $slc_psu_b_status = $device->slc_psu_b_status;
|
||||
|
||||
return $slc_psu_b_status if defined $slc_psu_b_status;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer3::Lantronix - SNMP Interface to Lantronix devices such as terminal servers
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
J R Binks
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $device = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
DestHost => 'mydevice',
|
||||
Community => 'public',
|
||||
Version => 2
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $device->class();
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Subclass for Lantronix devices such as terminal servers.
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info::Layer3
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item F<LANTRONIX-MIB>
|
||||
|
||||
=item F<LANTRONIX-SLC-MIB>
|
||||
|
||||
=back
|
||||
|
||||
=head2 Inherited Classes' MIBs
|
||||
|
||||
See L<SNMP::Info::Layer3/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar value from SNMP.
|
||||
|
||||
=over
|
||||
|
||||
=item $device->vendor()
|
||||
|
||||
Returns 'lantronix'.
|
||||
|
||||
=item $device->os()
|
||||
|
||||
Returns 'EvolutionOS' for EDS devices.
|
||||
|
||||
=item $device->os_ver()
|
||||
|
||||
Returns the software version.
|
||||
|
||||
=item $device->model()
|
||||
|
||||
Returns the model.
|
||||
|
||||
=item $device->serial()
|
||||
|
||||
Returns the serial number.
|
||||
|
||||
=item $device->ps1_status()
|
||||
|
||||
Power supply 1 status
|
||||
|
||||
=item $device->ps2_status()
|
||||
|
||||
Power supply 2 status
|
||||
|
||||
=back
|
||||
|
||||
=head2 Globals imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"GLOBALS"> for details.
|
||||
|
||||
=head1 TABLE ENTRIES
|
||||
|
||||
These are methods that return tables of information in the form of a reference
|
||||
to a hash.
|
||||
|
||||
=over
|
||||
|
||||
=back
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=over
|
||||
|
||||
=item $device->i_ignore()
|
||||
|
||||
Returns reference to hash. Increments value of IID if port is to be ignored.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Lantronix specific items
|
||||
|
||||
None at present.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details.
|
||||
|
||||
=cut
|
||||
196
lib/SNMP/Info/Layer3/Microsoft.pm
Normal file
196
lib/SNMP/Info/Layer3/Microsoft.pm
Normal file
@@ -0,0 +1,196 @@
|
||||
# SNMP::Info::Layer3::Microsoft
|
||||
# $Id$
|
||||
#
|
||||
# Copyright (c) 2008 Eric Miller
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the University of California, Santa Cruz nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer3::Microsoft;
|
||||
|
||||
use strict;
|
||||
use Exporter;
|
||||
use SNMP::Info::Layer3;
|
||||
|
||||
@SNMP::Info::Layer3::Microsoft::ISA = qw/SNMP::Info::Layer3 Exporter/;
|
||||
@SNMP::Info::Layer3::Microsoft::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/;
|
||||
|
||||
$VERSION = '3.35';
|
||||
|
||||
%MIBS = ( %SNMP::Info::Layer3::MIBS, );
|
||||
|
||||
%GLOBALS = ( %SNMP::Info::Layer3::GLOBALS, );
|
||||
|
||||
%FUNCS = ( %SNMP::Info::Layer3::FUNCS, );
|
||||
|
||||
%MUNGE = ( %SNMP::Info::Layer3::MUNGE, );
|
||||
|
||||
sub vendor {
|
||||
return 'microsoft';
|
||||
}
|
||||
|
||||
sub os {
|
||||
return 'windows';
|
||||
}
|
||||
|
||||
sub os_ver {
|
||||
return '';
|
||||
}
|
||||
|
||||
sub model {
|
||||
return 'Windows Router';
|
||||
}
|
||||
|
||||
sub serial {
|
||||
return '';
|
||||
}
|
||||
|
||||
# $l3->interfaces() - Map the Interfaces to their physical names
|
||||
# Add interface number to interface name because if MS Win
|
||||
# have identical interface cards ("HP NC7782 Gigabit Server Adapter"
|
||||
# for example), than MS Win return identical ifDescr
|
||||
sub interfaces {
|
||||
my $l3 = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $interfaces = $l3->i_index($partial);
|
||||
my $descriptions = $l3->i_description($partial);
|
||||
|
||||
my %interfaces = ();
|
||||
foreach my $iid ( keys %$interfaces ) {
|
||||
my $desc = $descriptions->{$iid};
|
||||
next unless defined $desc;
|
||||
|
||||
$interfaces{$iid} = sprintf( "(%U) %s", $iid, $desc );
|
||||
}
|
||||
|
||||
return \%interfaces;
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer3::Microsoft - SNMP Interface to L3 Microsoft Windows router
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
begemot
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $router = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
DestHost => 'myrouter',
|
||||
Community => 'public',
|
||||
Version => 1
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $router->class();
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Subclass for Generic Microsoft Routers running Microsoft Windows OS
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info::Layer3
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item Inherited Classes' MIBs
|
||||
|
||||
See L<SNMP::Info::Layer3/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
=back
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar value from SNMP
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=over
|
||||
|
||||
=item $router->vendor()
|
||||
|
||||
Returns C<'microsoft'>
|
||||
|
||||
=item $router->os()
|
||||
|
||||
Returns C<'windows'>
|
||||
|
||||
=item $router->os_ver()
|
||||
|
||||
Returns ''
|
||||
|
||||
=item $router->model()
|
||||
|
||||
Returns C<'Windows Router'>
|
||||
|
||||
=item $router->serial()
|
||||
|
||||
Returns ''
|
||||
|
||||
=back
|
||||
|
||||
=head2 Globals imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"GLOBALS"> for details.
|
||||
|
||||
=head1 TABLE METHODS
|
||||
|
||||
These are methods that return tables of information in the form of a reference
|
||||
to a hash.
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=over
|
||||
|
||||
=item $router->interfaces()
|
||||
|
||||
Map the Interfaces to their physical names. Adds interface number to
|
||||
interface name because identical interface cards return identical C<ifDescr>.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details.
|
||||
|
||||
=cut
|
||||
217
lib/SNMP/Info/Layer3/Mikrotik.pm
Normal file
217
lib/SNMP/Info/Layer3/Mikrotik.pm
Normal file
@@ -0,0 +1,217 @@
|
||||
# SNMP::Info::Layer3::Mikrotik
|
||||
# $Id$
|
||||
#
|
||||
# Copyright (c) 2011 Jeroen van Ingen
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the University of California, Santa Cruz nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer3::Mikrotik;
|
||||
|
||||
use strict;
|
||||
use Exporter;
|
||||
use SNMP::Info::Layer3;
|
||||
|
||||
@SNMP::Info::Layer3::Mikrotik::ISA = qw/SNMP::Info::Layer3 Exporter/;
|
||||
@SNMP::Info::Layer3::Mikrotik::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/;
|
||||
|
||||
$VERSION = '3.35';
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer3::MIBS,
|
||||
'HOST-RESOURCES-MIB' => 'hrSystem',
|
||||
'MIKROTIK-MIB' => 'mtxrLicVersion',
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer3::GLOBALS,
|
||||
'hrSystemUptime' => 'hrSystemUptime',
|
||||
'os_level' => 'mtxrLicLevel',
|
||||
'os_ver' => 'mtxrLicVersion',
|
||||
'serial1' => 'mtxrSystem.3.0',
|
||||
'firmware' => 'mtxrSystem.4.0',
|
||||
'fan_type' => 'mtxrHlActiveFan',
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer3::FUNCS,
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
%SNMP::Info::Layer3::MUNGE,
|
||||
);
|
||||
|
||||
sub vendor {
|
||||
return 'mikrotik';
|
||||
}
|
||||
|
||||
sub serial {
|
||||
my $mikrotik = shift;
|
||||
return $mikrotik->serial1;
|
||||
}
|
||||
|
||||
sub model {
|
||||
my $mikrotik = shift;
|
||||
my $descr = $mikrotik->description() || '';
|
||||
my $model = undef;
|
||||
$model = $1 if ( $descr =~ /^RouterOS\s+(\S+)$/i );
|
||||
return $model;
|
||||
}
|
||||
|
||||
sub os {
|
||||
return 'routeros';
|
||||
}
|
||||
|
||||
sub board_temp {
|
||||
my $mikrotik = shift;
|
||||
my $temp = $mikrotik->mtxrHlTemperature;
|
||||
return $temp / 10.0;
|
||||
}
|
||||
|
||||
sub cpu_temp {
|
||||
my $mikrotik = shift;
|
||||
my $temp = $mikrotik->mtxrHlProcessorTemperature;
|
||||
return $temp / 10.0;
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer3::Mikrotik - SNMP Interface to Mikrotik devices
|
||||
|
||||
=head1 AUTHORS
|
||||
|
||||
Jeroen van Ingen
|
||||
initial version based on SNMP::Info::Layer3::NetSNMP by Bradley Baetz and Bill Fenner
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $mikrotik = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
DestHost => 'myrouter',
|
||||
Community => 'public',
|
||||
Version => 2
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $mikrotik->class();
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Subclass for Mikrotik devices
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info::Layer3
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item F<HOST-RESOURCES-MIB>
|
||||
|
||||
=item F<MIKROTIK-MIB>
|
||||
|
||||
=item Inherited Classes' MIBs
|
||||
|
||||
See L<SNMP::Info::Layer3> for its own MIB requirements.
|
||||
|
||||
=back
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar value from SNMP
|
||||
|
||||
=over
|
||||
|
||||
=item $mikrotik->vendor()
|
||||
|
||||
Returns C<'mikrotik'>.
|
||||
|
||||
=item $mikrotik->os()
|
||||
|
||||
Returns C<'routeros'>.
|
||||
|
||||
=item $mikrotik->model()
|
||||
|
||||
Tries to extract the device model from C<sysDescr>.
|
||||
|
||||
=item $mikrotik->os_ver()
|
||||
|
||||
Returns the value of C<mtxrLicVersion>.
|
||||
|
||||
=item $mikrotik->os_level()
|
||||
|
||||
Returns the value of RouterOS level C<mtxrLicLevel>
|
||||
|
||||
=item $mikrotik->board_temp()
|
||||
=item $mikrotik->cpu_temp()
|
||||
|
||||
Returns the appropriate temperature values
|
||||
|
||||
=item $mikrotik->serial()
|
||||
|
||||
Returns the device serial.
|
||||
|
||||
=item $mikrotik->firmware()
|
||||
|
||||
Returns the firmware version of hardware.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Globals imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3> for details.
|
||||
|
||||
=head1 TABLE ENTRIES
|
||||
|
||||
These are methods that return tables of information in the form of a reference
|
||||
to a hash.
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
None.
|
||||
|
||||
=over
|
||||
|
||||
=back
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3> for details.
|
||||
|
||||
|
||||
=cut
|
||||
319
lib/SNMP/Info/Layer3/N1600.pm
Normal file
319
lib/SNMP/Info/Layer3/N1600.pm
Normal file
@@ -0,0 +1,319 @@
|
||||
# SNMP::Info::Layer3::N1600 - SNMP Interface to Nortel N16XX devices
|
||||
# $Id$
|
||||
#
|
||||
# Copyright (c) 2008 Eric Miller
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the University of California, Santa Cruz nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer3::N1600;
|
||||
|
||||
use strict;
|
||||
use Exporter;
|
||||
use SNMP::Info::Layer3;
|
||||
use SNMP::Info::SONMP;
|
||||
|
||||
@SNMP::Info::Layer3::N1600::ISA
|
||||
= qw/SNMP::Info::Layer3 SNMP::Info::SONMP Exporter/;
|
||||
@SNMP::Info::Layer3::N1600::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/;
|
||||
|
||||
$VERSION = '3.35';
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer3::MIBS,
|
||||
%SNMP::Info::SONMP::MIBS,
|
||||
'SWL2MGMT-MIB' => 'swL2MgmtMIB',
|
||||
'RAPID-CITY' => 'rapidCity',
|
||||
);
|
||||
|
||||
%GLOBALS = ( %SNMP::Info::Layer3::GLOBALS, %SNMP::Info::SONMP::GLOBALS, );
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer3::FUNCS,
|
||||
%SNMP::Info::SONMP::FUNCS,
|
||||
|
||||
# SWL2MGMT-MIB
|
||||
# swL2PortInfoTable
|
||||
'n1600_nway_status' => 'swL2PortInfoNwayStatus',
|
||||
|
||||
# swL2PortCtrlTable
|
||||
'n1600_nway_state' => 'swL2PortCtrlNwayState',
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
|
||||
# Inherit all the built in munging
|
||||
%SNMP::Info::Layer3::MUNGE,
|
||||
%SNMP::Info::SONMP::MUNGE,
|
||||
);
|
||||
|
||||
# Method OverRides
|
||||
|
||||
sub model {
|
||||
my $n1600 = shift;
|
||||
my $id = $n1600->id();
|
||||
|
||||
unless ( defined $id ) {
|
||||
print
|
||||
" SNMP::Info::Layer3::N1600::model() - Device does not support sysObjectID\n"
|
||||
if $n1600->debug();
|
||||
return;
|
||||
}
|
||||
|
||||
my $model = &SNMP::translateObj($id);
|
||||
|
||||
return $id unless defined $model;
|
||||
|
||||
$model =~ s/^rcA//i;
|
||||
return $model;
|
||||
}
|
||||
|
||||
sub vendor {
|
||||
return 'avaya';
|
||||
}
|
||||
|
||||
sub os {
|
||||
return 'passport';
|
||||
}
|
||||
|
||||
sub os_ver {
|
||||
my $n1600 = shift;
|
||||
my $descr = $n1600->description();
|
||||
return unless defined $descr;
|
||||
|
||||
if ( $descr =~ m/(\d+\.\d+\.\d+\.\d+)/ ) {
|
||||
return $1;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
sub interfaces {
|
||||
my $n1600 = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $i_index = $n1600->i_index($partial) || {};
|
||||
|
||||
my %if;
|
||||
foreach my $iid ( keys %$i_index ) {
|
||||
my $index = $i_index->{$iid};
|
||||
next unless defined $index;
|
||||
|
||||
my $slotport = "1.$index";
|
||||
$if{$iid} = $slotport;
|
||||
}
|
||||
return \%if;
|
||||
}
|
||||
|
||||
sub i_duplex {
|
||||
my $n1600 = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $nway_status = $n1600->n1600_nway_status($partial) || {};
|
||||
|
||||
my %i_duplex;
|
||||
foreach my $iid ( keys %$nway_status ) {
|
||||
my $duplex = $nway_status->{$iid};
|
||||
next unless defined $duplex;
|
||||
next if $duplex =~ /other/i;
|
||||
$i_duplex{$iid} = 'half' if $duplex =~ /half/i;
|
||||
$i_duplex{$iid} = 'full' if $duplex =~ /full/i;
|
||||
}
|
||||
return \%i_duplex;
|
||||
}
|
||||
|
||||
sub i_duplex_admin {
|
||||
my $n1600 = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $nway_state = $n1600->n1600_nway_state($partial) || {};
|
||||
|
||||
my %i_duplex;
|
||||
foreach my $iid ( keys %$nway_state ) {
|
||||
my $duplex = $nway_state->{$iid};
|
||||
next unless defined $duplex;
|
||||
next if $duplex =~ /other/i;
|
||||
$i_duplex{$iid} = 'half' if $duplex =~ /half/i;
|
||||
$i_duplex{$iid} = 'full' if $duplex =~ /full/i;
|
||||
$i_duplex{$iid} = 'auto' if $duplex =~ /nway-enabled/i;
|
||||
}
|
||||
return \%i_duplex;
|
||||
}
|
||||
|
||||
# Required for SNMP::Info::SONMP
|
||||
sub index_factor {
|
||||
return 64;
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer3::N1600 - SNMP Interface to Avaya/Nortel 16XX Network
|
||||
Devices
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Eric Miller
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $n1600 = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
DestHost => 'myswitch',
|
||||
Community => 'public',
|
||||
Version => 1
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $n1600->class();
|
||||
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Provides abstraction to the configuration information obtainable from an
|
||||
Avaya/Nortel N16XX device through SNMP.
|
||||
|
||||
For speed or debugging purposes you can call the subclass directly, but not
|
||||
after determining a more specific class using the method above.
|
||||
|
||||
my $n1600 = new SNMP::Info::Layer3::N1600(...);
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info::Layer3
|
||||
|
||||
=item SNMP::Info::SONMP
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item F<SWL2MGMT-MIB>
|
||||
|
||||
=item F<RAPID-CITY>
|
||||
|
||||
=item Inherited Classes' MIBs
|
||||
|
||||
See classes listed above for their required MIBs.
|
||||
|
||||
=back
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar value from SNMP
|
||||
|
||||
=over
|
||||
|
||||
=item $n1600->bulkwalk_no
|
||||
|
||||
Return C<1>. Bulkwalk is currently turned off for this class.
|
||||
|
||||
=item $n1600->model()
|
||||
|
||||
Returns model type. Checks $n1600->id() against the
|
||||
F<RAPID-CITY-MIB> and then parses out C<rcA>.
|
||||
|
||||
=item $n1600->vendor()
|
||||
|
||||
Returns 'avaya'
|
||||
|
||||
=item $n1600->os()
|
||||
|
||||
Returns 'passport'
|
||||
|
||||
=item $n1600->os_ver()
|
||||
|
||||
Returns os version extracted from C<sysDescr>.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=over
|
||||
|
||||
=item $n1600->index_factor()
|
||||
|
||||
Required by SNMP::Info::SONMP. Number representing the number of ports
|
||||
reserved per slot within the device MIB.
|
||||
|
||||
Returns 64 since largest switch has 48 ports. Since these switches can
|
||||
not stack, the only requirement to reserve more than the max number of ports.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Globals imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"GLOBALS"> for details.
|
||||
|
||||
=head2 Globals imported from SNMP::Info::SONMP
|
||||
|
||||
See documentation in SNMP::SONMP::Layer3 for details.
|
||||
|
||||
=head1 TABLE METHODS
|
||||
|
||||
These are methods that return tables of information in the form of a reference
|
||||
to a hash.
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=over
|
||||
|
||||
=item $n1600->interfaces()
|
||||
|
||||
Returns reference to hash of interface names to iids.
|
||||
|
||||
Places a 1 in front of index number. This is required for compatibility with
|
||||
SNMP::Info::SONMP.
|
||||
|
||||
=item $n1600->i_duplex()
|
||||
|
||||
Returns reference to hash of interface operational link duplex status.
|
||||
|
||||
=item $n1600->i_duplex_admin()
|
||||
|
||||
Returns reference to hash of interface administrative link duplex status.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::SONMP
|
||||
|
||||
See documentation in L<SNMP::Info::SONMP/"TABLE METHODS"> for details.
|
||||
|
||||
=cut
|
||||
272
lib/SNMP/Info/Layer3/NetSNMP.pm
Normal file
272
lib/SNMP/Info/Layer3/NetSNMP.pm
Normal file
@@ -0,0 +1,272 @@
|
||||
# SNMP::Info::Layer3::NetSNMP
|
||||
# $Id$
|
||||
#
|
||||
# Copyright (c) 2008 Bill Fenner
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the University of California, Santa Cruz nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer3::NetSNMP;
|
||||
|
||||
use strict;
|
||||
use Exporter;
|
||||
use SNMP::Info::Layer3;
|
||||
use SNMP::Info::LLDP;
|
||||
|
||||
@SNMP::Info::Layer3::NetSNMP::ISA = qw/SNMP::Info::LLDP SNMP::Info::Layer3 Exporter/;
|
||||
@SNMP::Info::Layer3::NetSNMP::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/;
|
||||
|
||||
$VERSION = '3.35';
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer3::MIBS,
|
||||
%SNMP::Info::LLDP::MIBS,
|
||||
'UCD-SNMP-MIB' => 'versionTag',
|
||||
'NET-SNMP-TC' => 'netSnmpAgentOIDs',
|
||||
'HOST-RESOURCES-MIB' => 'hrSystem',
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer3::GLOBALS,
|
||||
%SNMP::Info::LLDP::GLOBALS,
|
||||
'netsnmp_vers' => 'versionTag',
|
||||
'hrSystemUptime' => 'hrSystemUptime',
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer3::FUNCS,
|
||||
%SNMP::Info::LLDP::FUNCS,
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
%SNMP::Info::Layer3::MUNGE,
|
||||
%SNMP::Info::LLDP::MUNGE,
|
||||
);
|
||||
|
||||
sub vendor {
|
||||
return 'Net-SNMP';
|
||||
}
|
||||
|
||||
sub os {
|
||||
my $netsnmp = shift;
|
||||
my $descr = $netsnmp->description();
|
||||
|
||||
return $1 if ( $descr =~ /^(\S+)\s+/ );
|
||||
return;
|
||||
}
|
||||
|
||||
sub os_ver {
|
||||
my $netsnmp = shift;
|
||||
my $descr = $netsnmp->description();
|
||||
my $vers = $netsnmp->netsnmp_vers();
|
||||
my $os_ver = undef;
|
||||
|
||||
$os_ver = $1 if ( $descr =~ /^\S+\s+\S+\s+(\S+)\s+/ );
|
||||
if ($vers) {
|
||||
$os_ver = "???" unless defined($os_ver);
|
||||
$os_ver .= " / Net-SNMP " . $vers;
|
||||
}
|
||||
|
||||
return $os_ver;
|
||||
}
|
||||
|
||||
sub serial {
|
||||
return '';
|
||||
}
|
||||
|
||||
# sysUptime gives us the time since the SNMP daemon has restarted,
|
||||
# so return the system uptime since that's probably what the user
|
||||
# wants. (Caution: this could cause trouble if using
|
||||
# sysUptime-based discontinuity timers or other TimeStamp
|
||||
# objects.
|
||||
sub uptime {
|
||||
my $netsnmp = shift;
|
||||
my $uptime;
|
||||
|
||||
$uptime = $netsnmp->hrSystemUptime();
|
||||
return $uptime if defined $uptime;
|
||||
|
||||
return $netsnmp->SUPER::uptime();
|
||||
}
|
||||
|
||||
sub i_ignore {
|
||||
my $l3 = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $interfaces = $l3->interfaces($partial) || {};
|
||||
|
||||
my %i_ignore;
|
||||
foreach my $if ( keys %$interfaces ) {
|
||||
|
||||
# lo0 etc
|
||||
if ( $interfaces->{$if} =~ /\blo\d*\b/i ) {
|
||||
$i_ignore{$if}++;
|
||||
}
|
||||
}
|
||||
return \%i_ignore;
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer3::NetSNMP - SNMP Interface to L3 Net-SNMP Devices
|
||||
|
||||
=head1 AUTHORS
|
||||
|
||||
Bradley Baetz and Bill Fenner
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $netsnmp = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
DestHost => 'myrouter',
|
||||
Community => 'public',
|
||||
Version => 2
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $netsnmp->class();
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Subclass for Generic Net-SNMP devices
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info::Layer3
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item F<UCD-SNMP-MIB>
|
||||
|
||||
=item F<NET-SNMP-TC>
|
||||
|
||||
=item F<HOST-RESOURCES-MIB>
|
||||
|
||||
=item Inherited Classes' MIBs
|
||||
|
||||
See L<SNMP::Info::Layer3> for its own MIB requirements.
|
||||
|
||||
See L<SNMP::Info::LLDP> for its own MIB requirements.
|
||||
|
||||
=back
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar value from SNMP
|
||||
|
||||
=over
|
||||
|
||||
=item $netsnmp->vendor()
|
||||
|
||||
Returns 'Net-SNMP'.
|
||||
|
||||
=item $netsnmp->os()
|
||||
|
||||
Returns the OS extracted from C<sysDescr>.
|
||||
|
||||
=item $netsnmp->os_ver()
|
||||
|
||||
Returns the software version extracted from C<sysDescr>, along
|
||||
with the Net-SNMP version.
|
||||
|
||||
=item $netsnmp->uptime()
|
||||
|
||||
Returns the system uptime instead of the agent uptime.
|
||||
NOTE: discontinuity timers and other Time Stamp based objects
|
||||
are based on agent uptime, so use orig_uptime().
|
||||
|
||||
=item $netsnmp->serial()
|
||||
|
||||
Returns ''.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Globals imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3> for details.
|
||||
|
||||
=head2 Globals imported from SNMP::Info::LLDP
|
||||
|
||||
See documentation in L<SNMP::Info::LLDP> for details.
|
||||
|
||||
=head1 TABLE ENTRIES
|
||||
|
||||
These are methods that return tables of information in the form of a reference
|
||||
to a hash.
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=over
|
||||
|
||||
=item $netsnmp->i_ignore()
|
||||
|
||||
Returns reference to hash. Increments value of IID if port is to be ignored.
|
||||
|
||||
Ignores loopback
|
||||
|
||||
=back
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3> for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::LLDP
|
||||
|
||||
See documentation in L<SNMP::Info::LLDP> for details.
|
||||
|
||||
=head1 NOTES
|
||||
|
||||
In order to cause SNMP::Info to classify your device into this class, it
|
||||
may be necessary to put a configuration line into your F<snmpd.conf>
|
||||
similar to
|
||||
|
||||
sysobjectid .1.3.6.1.4.1.8072.3.2.N
|
||||
|
||||
where N is the object ID for your OS from the C<NET-SNMP-TC> MIB (or
|
||||
255 if not listed). Some Net-SNMP installations default to an
|
||||
incorrect return value for C<system.sysObjectId>.
|
||||
|
||||
In order to recognize a Net-SNMP device as Layer3, it may be necessary
|
||||
to put a configuration line similar to
|
||||
|
||||
sysservices 76
|
||||
|
||||
in your F<snmpd.conf>.
|
||||
|
||||
=cut
|
||||
811
lib/SNMP/Info/Layer3/Netscreen.pm
Normal file
811
lib/SNMP/Info/Layer3/Netscreen.pm
Normal file
@@ -0,0 +1,811 @@
|
||||
# SNMP::Info::Layer3::Netscreen
|
||||
#
|
||||
# Copyright (c) 2012 Eric Miller
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the University of California, Santa Cruz nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer3::Netscreen;
|
||||
|
||||
use strict;
|
||||
use Exporter;
|
||||
use SNMP::Info::Layer3;
|
||||
use SNMP::Info::IEEE802dot11;
|
||||
|
||||
@SNMP::Info::Layer3::Netscreen::ISA
|
||||
= qw/SNMP::Info::Layer3 SNMP::Info::IEEE802dot11 Exporter/;
|
||||
@SNMP::Info::Layer3::Netscreen::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
|
||||
|
||||
$VERSION = '3.35';
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer3::MIBS,
|
||||
%SNMP::Info::IEEE802dot11::MIBS,
|
||||
'NETSCREEN-SMI' => 'netscreenSetting',
|
||||
'NETSCREEN-PRODUCTS-MIB' => 'netscreenGeneric',
|
||||
'NETSCREEN-INTERFACE-MIB' => 'nsIfIndex',
|
||||
'NETSCREEN-SET-GEN-MIB' => 'nsSetGenSwVer',
|
||||
'NETSCREEN-IP-ARP-MIB' => 'nsIpArpAOD',
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer3::GLOBALS,
|
||||
%SNMP::Info::IEEE802dot11::GLOBALS,
|
||||
'os_version' => 'nsSetGenSwVer',
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer3::FUNCS,
|
||||
%SNMP::Info::IEEE802dot11::FUNCS,
|
||||
|
||||
ns_i_index => 'nsIfIndex',
|
||||
ns_i_name => 'nsIfName',
|
||||
ns_i_description => 'nsIfDescr',
|
||||
ns_i_mac => 'nsIfMAC',
|
||||
ns_i_up => 'nsIfStatus',
|
||||
ns_ip_table => 'nsIfIp',
|
||||
ns_ip_netmask => 'nsIfNetmask',
|
||||
bp_index => 'nsIfInfo',
|
||||
std_at_paddr => 'ipNetToMediaPhysAddress',
|
||||
ns_at_paddr => 'nsIpArpMac',
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
%SNMP::Info::Layer3::MUNGE,
|
||||
%SNMP::Info::IEEE802dot11::MUNGE,
|
||||
'ns_i_mac' => \&SNMP::Info::munge_mac,
|
||||
'ns_at_paddr' => \&SNMP::Info::munge_mac,
|
||||
'std_at_paddr' => \&SNMP::Info::munge_mac,
|
||||
);
|
||||
|
||||
sub layers {
|
||||
return '01001110';
|
||||
}
|
||||
|
||||
sub vendor {
|
||||
return 'juniper';
|
||||
}
|
||||
|
||||
sub os {
|
||||
return 'screenos';
|
||||
}
|
||||
|
||||
sub os_ver {
|
||||
my $netscreen = shift;
|
||||
|
||||
my $descr = $netscreen->description();
|
||||
if ( $descr =~ m/version (\d\S*) \(SN: / ) {
|
||||
return $1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
sub serial {
|
||||
my $netscreen = shift;
|
||||
|
||||
my $e_serial = $netscreen->e_serial() || {};
|
||||
|
||||
my $serial = $e_serial->{1} || undef;
|
||||
|
||||
return $1 if ( defined $serial and $serial =~ /(\d+)/ );
|
||||
my $descr = $netscreen->description();
|
||||
if ( $descr =~ m/version .*\(SN: (\d\S*),/ ) {
|
||||
return $1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
sub model {
|
||||
my $netscreen = shift;
|
||||
|
||||
my $id = $netscreen->id();
|
||||
|
||||
unless ( defined $id ) {
|
||||
print
|
||||
" SNMP::Info::Layer3::model() - Device does not support sysObjectID\n"
|
||||
if $netscreen->debug();
|
||||
return;
|
||||
}
|
||||
|
||||
my $model = &SNMP::translateObj($id);
|
||||
|
||||
return $id unless defined $model;
|
||||
|
||||
$model =~ s/^netscreen//i;
|
||||
return $model;
|
||||
}
|
||||
|
||||
# provides mapping from IF-MIB to nsIf interfaces - many to 1 (!)
|
||||
# - on WLAN devices wireless0/0(|-[ag]) -> wireless0/0 !!
|
||||
sub _if_nsif_map {
|
||||
my $netscreen = shift;
|
||||
my $i_descr = $netscreen->SUPER::i_description;
|
||||
my $ns_descr = $netscreen->i_description;
|
||||
my %if_nsif_map = ();
|
||||
my @ikeys = sort { $a <=> $b } keys %$i_descr;
|
||||
my @nskeys = sort { $a <=> $b } keys %$ns_descr;
|
||||
my $i = 0;
|
||||
my $n = 0;
|
||||
|
||||
# assumes descriptions are in the same order from both walks
|
||||
while ( $i < @ikeys && $n < @nskeys ) {
|
||||
|
||||
# find matching sub interfaces
|
||||
while (
|
||||
$i < @ikeys
|
||||
&& substr(
|
||||
$i_descr->{ $ikeys[$i] },
|
||||
0,
|
||||
length $ns_descr->{ $nskeys[$n] }
|
||||
) eq $ns_descr->{ $nskeys[$n] }
|
||||
)
|
||||
{
|
||||
|
||||
$if_nsif_map{ $ikeys[$i] } = $nskeys[$n];
|
||||
$i++;
|
||||
}
|
||||
|
||||
$n++;
|
||||
|
||||
# skip non-matching interfaces (e.g. tunnel.N)
|
||||
while (
|
||||
$i < @ikeys
|
||||
&& substr(
|
||||
$i_descr->{ $ikeys[$i] },
|
||||
0,
|
||||
length $ns_descr->{ $nskeys[$n] }
|
||||
) ne $ns_descr->{ $nskeys[$n] }
|
||||
&& $n < @nskeys
|
||||
)
|
||||
{
|
||||
|
||||
$if_nsif_map{ $ikeys[$i] } = 0; # no matching interface
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
return \%if_nsif_map;
|
||||
}
|
||||
|
||||
# Provides mapping from nsIf interfaces to IF-MIB interfaces - many to 1
|
||||
# Example, tunnel.# interfaces are not present in IF-MIB. There exist no
|
||||
# mapping of index IID's between the tables so create mapping based on names
|
||||
sub _nsif_if_map {
|
||||
my $netscreen = shift;
|
||||
|
||||
my $i_descr = $netscreen->SUPER::i_description;
|
||||
my $ns_descr = $netscreen->i_description;
|
||||
my %rev_i_descr = reverse %$i_descr;
|
||||
my %rev_ns_descr = reverse %$ns_descr;
|
||||
|
||||
my %nsif_if_map = ();
|
||||
foreach my $value ( values %$ns_descr ) {
|
||||
if ( exists $rev_i_descr{$value} ) {
|
||||
$nsif_if_map{ $rev_ns_descr{$value} } = $rev_i_descr{$value};
|
||||
}
|
||||
else {
|
||||
$nsif_if_map{ $rev_ns_descr{$value} } = 0;
|
||||
}
|
||||
}
|
||||
return \%nsif_if_map;
|
||||
}
|
||||
|
||||
sub interfaces {
|
||||
my $netscreen = shift;
|
||||
return $netscreen->i_description();
|
||||
}
|
||||
|
||||
sub i_index {
|
||||
my $netscreen = shift;
|
||||
return $netscreen->ns_i_index();
|
||||
}
|
||||
|
||||
sub i_name {
|
||||
my $netscreen = shift;
|
||||
return $netscreen->ns_i_name();
|
||||
}
|
||||
|
||||
sub i_description {
|
||||
my $netscreen = shift;
|
||||
|
||||
# Versions prior to 5.4 do not support nsIfDescr but do have nsIfName
|
||||
return $netscreen->ns_i_description() || $netscreen->ns_i_name();
|
||||
}
|
||||
|
||||
sub i_mac {
|
||||
my $netscreen = shift;
|
||||
|
||||
my $ns_mac = $netscreen->ns_i_mac() || {};
|
||||
my $if_i_mac = $netscreen->SUPER::i_mac() || {};
|
||||
my $ns_i_map = $netscreen->_nsif_if_map();
|
||||
|
||||
my %i_mac = ();
|
||||
foreach my $iid ( keys %$ns_i_map ) {
|
||||
$i_mac{$iid} = $ns_mac->{$iid} || $if_i_mac->{ $ns_i_map->{$iid} };
|
||||
}
|
||||
|
||||
return \%i_mac;
|
||||
}
|
||||
|
||||
sub i_lastchange {
|
||||
my $netscreen = shift;
|
||||
|
||||
my $if_i_lastchange = $netscreen->SUPER::i_lastchange() || {};
|
||||
my $ns_i_map = $netscreen->_nsif_if_map();
|
||||
my %i_lastchange;
|
||||
|
||||
foreach my $iid ( keys %$ns_i_map ) {
|
||||
$i_lastchange{$iid} = $if_i_lastchange->{ $ns_i_map->{$iid} };
|
||||
}
|
||||
return \%i_lastchange;
|
||||
}
|
||||
|
||||
sub i_up {
|
||||
my $netscreen = shift;
|
||||
return $netscreen->ns_i_up();
|
||||
}
|
||||
|
||||
sub i_up_admin {
|
||||
my $netscreen = shift;
|
||||
my $i_up = $netscreen->i_up();
|
||||
my $i_up_admin = $netscreen->SUPER::i_up_admin();
|
||||
my $ns_i_map = $netscreen->_nsif_if_map();
|
||||
my %i_up_admin;
|
||||
|
||||
foreach my $iid ( keys %$ns_i_map ) {
|
||||
$i_up_admin{$iid}
|
||||
= $i_up->{$iid} eq "up" && "up"
|
||||
|| $i_up_admin->{ $ns_i_map->{$iid} }
|
||||
|| 0;
|
||||
}
|
||||
return \%i_up_admin;
|
||||
}
|
||||
|
||||
sub i_type {
|
||||
my $netscreen = shift;
|
||||
|
||||
my $if_i_type = $netscreen->SUPER::i_type() || {};
|
||||
my $ns_i_map = $netscreen->_nsif_if_map();
|
||||
my %i_type;
|
||||
|
||||
foreach my $iid ( keys %$ns_i_map ) {
|
||||
$i_type{$iid} = $if_i_type->{ $ns_i_map->{$iid} } || "tunnel";
|
||||
}
|
||||
return \%i_type;
|
||||
}
|
||||
|
||||
sub i_mtu {
|
||||
my $netscreen = shift;
|
||||
|
||||
my $i_type = $netscreen->SUPER::i_mtu() || {};
|
||||
my $ns_i_map = $netscreen->_nsif_if_map();
|
||||
my %i_mtu;
|
||||
|
||||
foreach my $iid ( keys %$ns_i_map ) {
|
||||
$i_mtu{$iid} = $i_type->{ $ns_i_map->{$iid} };
|
||||
}
|
||||
return \%i_mtu;
|
||||
}
|
||||
|
||||
sub i_ignore {
|
||||
return;
|
||||
}
|
||||
|
||||
sub i_speed {
|
||||
my $netscreen = shift;
|
||||
|
||||
my $i_speed = $netscreen->SUPER::i_speed();
|
||||
my $i_name = $netscreen->i_name();
|
||||
my $ns_i_map = $netscreen->_nsif_if_map;
|
||||
my %i_speed;
|
||||
|
||||
foreach my $iid ( keys %$ns_i_map ) {
|
||||
$i_speed{$iid}
|
||||
= $i_speed->{ $ns_i_map->{$iid} }
|
||||
|| $i_name->{$iid} =~ /tunnel/ && "vpn"
|
||||
|| 0;
|
||||
}
|
||||
return \%i_speed;
|
||||
}
|
||||
|
||||
sub _mac_map {
|
||||
my $netscreen = shift;
|
||||
|
||||
my $arp_mac = $netscreen->nsIpArpMac() || {};
|
||||
|
||||
my %mac_map = ();
|
||||
foreach my $iid ( keys %$arp_mac ) {
|
||||
my $oid = join( ".", ( unpack( "C6", $arp_mac->{$iid} ) ) );
|
||||
$mac_map{$oid} = $iid;
|
||||
}
|
||||
return \%mac_map;
|
||||
}
|
||||
|
||||
# Interfaces can have two addresses, we want to capture both the network
|
||||
# address and the management address
|
||||
sub ip_index {
|
||||
my $netscreen = shift;
|
||||
|
||||
my $ns_ip = $netscreen->ns_ip_table() || {};
|
||||
my $if_mng_ip = $netscreen->nsIfMngIp() || {};
|
||||
|
||||
my %ip_index = ();
|
||||
foreach my $iid ( keys %$ns_ip ) {
|
||||
$ip_index{ $ns_ip->{$iid} } = $iid if $ns_ip->{$iid} ne "0.0.0.0";
|
||||
}
|
||||
foreach my $iid ( keys %$if_mng_ip ) {
|
||||
$ip_index{ $if_mng_ip->{$iid} } = $iid
|
||||
if $if_mng_ip->{$iid} ne "0.0.0.0";
|
||||
}
|
||||
return \%ip_index;
|
||||
}
|
||||
|
||||
sub ip_table {
|
||||
my $netscreen = shift;
|
||||
|
||||
my $ip_index = $netscreen->ip_index() || {};
|
||||
my $if_mng_ip = $netscreen->nsIfMngIp() || {};
|
||||
|
||||
my %ip_table = ();
|
||||
foreach my $iid ( keys %$ip_index ) {
|
||||
my $mgmt_ip = $if_mng_ip->{$iid};
|
||||
|
||||
if ( defined $mgmt_ip && $mgmt_ip ne '0.0.0.0' ) {
|
||||
$ip_table{$iid} = $mgmt_ip;
|
||||
}
|
||||
else {
|
||||
$ip_table{$iid} = $iid;
|
||||
}
|
||||
}
|
||||
return \%ip_table;
|
||||
}
|
||||
|
||||
# There is only one netmask for the interface both network and management
|
||||
# addresses should have the same netmask
|
||||
sub ip_netmask {
|
||||
my $netscreen = shift;
|
||||
|
||||
my $ip_index = $netscreen->ip_index() || {};
|
||||
my $ns_netmask = $netscreen->ns_ip_netmask();
|
||||
|
||||
my %ip_netmask = ();
|
||||
foreach my $iid ( keys %$ip_index ) {
|
||||
$ip_netmask{$iid} = $ns_netmask->{ $ip_index->{$iid} };
|
||||
}
|
||||
return \%ip_netmask;
|
||||
}
|
||||
|
||||
sub fw_index {
|
||||
my $netscreen = shift;
|
||||
my %fw_index = ();
|
||||
my $arp_mac = $netscreen->nsIpArpMac() || {};
|
||||
|
||||
foreach my $iid ( keys %$arp_mac ) {
|
||||
my $oid = join( ".", ( unpack( "C6", $arp_mac->{$iid} ) ) );
|
||||
$fw_index{$iid} = $oid;
|
||||
}
|
||||
return \%fw_index;
|
||||
}
|
||||
|
||||
sub fw_mac {
|
||||
my $netscreen = shift;
|
||||
|
||||
my $mac_map = $netscreen->_mac_map() || {};
|
||||
|
||||
my %fw_mac = ();
|
||||
foreach my $oid ( keys %$mac_map ) {
|
||||
my $mac
|
||||
= join( ":", ( map { sprintf "%lx", $_ } split( /\./, $oid ) ) );
|
||||
$fw_mac{$oid} = $mac;
|
||||
}
|
||||
return \%fw_mac;
|
||||
}
|
||||
|
||||
sub bp_index {
|
||||
my $netscreen = shift;
|
||||
|
||||
my $if_info = $netscreen->nsIfInfo() || {};
|
||||
|
||||
my %bp_index = ();
|
||||
foreach my $iid ( keys %$if_info ) {
|
||||
$bp_index{ $if_info->{$iid} } = $iid;
|
||||
}
|
||||
return \%bp_index;
|
||||
}
|
||||
|
||||
sub fw_port {
|
||||
my $netscreen = shift;
|
||||
|
||||
my $fw_index = $netscreen->fw_index();
|
||||
my $arp_if = $netscreen->nsIpArpIfIdx() || {};
|
||||
|
||||
my %fw_port;
|
||||
foreach my $iid ( keys %$arp_if ) {
|
||||
$fw_port{ $fw_index->{$iid} } = $arp_if->{$iid}
|
||||
if defined $fw_index->{$iid};
|
||||
}
|
||||
return \%fw_port;
|
||||
}
|
||||
|
||||
# need to remap from IF-MIB index to nsIf index
|
||||
sub i_ssidlist {
|
||||
my $netscreen = shift;
|
||||
|
||||
my $i_ssidlist = $netscreen->SUPER::i_ssidlist() || {};
|
||||
my $ns_i_map = $netscreen->_if_nsif_map();
|
||||
|
||||
my %i_ssidlist;
|
||||
foreach my $iid ( keys %$i_ssidlist ) {
|
||||
$i_ssidlist{ $ns_i_map->{$iid} } = $i_ssidlist->{$iid};
|
||||
}
|
||||
return \%i_ssidlist;
|
||||
}
|
||||
|
||||
sub i_80211channel {
|
||||
my $netscreen = shift;
|
||||
|
||||
my $i_80211channel = $netscreen->SUPER::i_80211channel() || {};
|
||||
my $ns_i_map = $netscreen->_if_nsif_map();
|
||||
|
||||
my %i_80211channel;
|
||||
foreach my $iid ( keys %$i_80211channel ) {
|
||||
$i_80211channel{ $ns_i_map->{$iid} } = $i_80211channel->{$iid};
|
||||
}
|
||||
return \%i_80211channel;
|
||||
}
|
||||
|
||||
sub at_index {
|
||||
my $netscreen = shift;
|
||||
|
||||
my $std = $netscreen->ipNetToMediaIfIndex();
|
||||
return $std if (ref {} eq ref $std and scalar keys %$std);
|
||||
|
||||
return $netscreen->nsIpArpIfIdx();
|
||||
}
|
||||
|
||||
sub at_paddr {
|
||||
my $netscreen = shift;
|
||||
|
||||
my $std = $netscreen->std_at_paddr();
|
||||
return $std if (ref {} eq ref $std and scalar keys %$std);
|
||||
|
||||
return $netscreen->ns_at_paddr();
|
||||
}
|
||||
|
||||
sub at_netaddr {
|
||||
my $netscreen = shift;
|
||||
|
||||
my $std = $netscreen->ipNetToMediaNetAddress();
|
||||
return $std if (ref {} eq ref $std and scalar keys %$std);
|
||||
|
||||
return $netscreen->nsIpArpIp();
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer3::Netscreen - SNMP Interface to Juniper Netscreen Devices
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Kent Hamilton
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
#Let SNMP::Info determine the correct subclass for you.
|
||||
|
||||
my $netscreen = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
DestHost => 'myswitch',
|
||||
Community => 'public',
|
||||
Version => 2
|
||||
)
|
||||
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $netscreen->class();
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Provides abstraction to the configuration information obtainable from a
|
||||
Juniper Netscreen devices through SNMP.
|
||||
|
||||
For speed or debugging purposes you can call the subclass directly, but not
|
||||
after determining a more specific class using the method above.
|
||||
|
||||
my $netscreen = new SNMP::Info::Layer3::Netscreen(...);
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info::Layer3
|
||||
|
||||
=item SNMP::Info::IEEE802dot11
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item F<NETSCREEN-SMI>
|
||||
|
||||
=item F<NETSCREEN-PRODUCTS-MIB>
|
||||
|
||||
=item F<NETSCREEN-INTERFACE-MIB>
|
||||
|
||||
=item F<NETSCREEN-SET-GEN-MIB>
|
||||
|
||||
=item F<NETSCREEN-IP-ARP-MIB>
|
||||
|
||||
=item Inherited Classes' MIBs
|
||||
|
||||
See L<SNMP::Info::Layer3/"Required MIBs"> for its MIB requirements.
|
||||
|
||||
See L<SNMP::Info::IEEE802dot11/"Required MIBs"> for its MIB requirements.
|
||||
|
||||
=back
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar value from SNMP
|
||||
|
||||
=over
|
||||
|
||||
=item $netscreen->model()
|
||||
|
||||
Tries to reference $netscreen->id() to F<NETSCREEN-PRODUCTS-MIB>
|
||||
|
||||
=item $netscreen->vendor()
|
||||
|
||||
Returns C<'juniper'>
|
||||
|
||||
=item $netscreen->os()
|
||||
|
||||
Returns C<'screenos'>
|
||||
|
||||
=item $netscreen->os_ver()
|
||||
|
||||
Extracts the OS version from the description string.
|
||||
|
||||
=item $netscreen->serial()
|
||||
|
||||
Returns serial number.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=over
|
||||
|
||||
=item $netscreen->layers()
|
||||
|
||||
Returns 01001110. Device doesn't report layers properly, modified to reflect
|
||||
Layer 2 and 3 functionality.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Globals imported from SNMP::Info::Layer3
|
||||
|
||||
See L<SNMP::Info::Layer3/"GLOBALS"> for details.
|
||||
|
||||
=head2 Globals imported from SNMP::Info::IEEE802dot11
|
||||
|
||||
See L<SNMP::Info::IEEE802dot11/"GLOBALS"> for details.
|
||||
|
||||
=head1 TABLE METHODS
|
||||
|
||||
These are methods that return tables of information in the form of a reference
|
||||
to a hash.
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=head3 Interface Information
|
||||
|
||||
=over
|
||||
|
||||
=item $netscreen->interfaces()
|
||||
|
||||
Creates a map between the interface identifier (iid) and the physical port
|
||||
name.
|
||||
|
||||
Defaults to C<insIfDescr> if available, uses C<nsIfName> if not.
|
||||
|
||||
=item $netscreen->i_description()
|
||||
|
||||
Description of the interface. Uses C<insIfDescr> if available, C<nsIfName>
|
||||
if not.
|
||||
|
||||
=item $netscreen->i_ignore()
|
||||
|
||||
Returns without defining any interfaces to ignore.
|
||||
|
||||
=item $netscreen->i_index()
|
||||
|
||||
Default SNMP IID to Interface index.
|
||||
|
||||
(C<nsIfIndex>)
|
||||
|
||||
=item $netscreen->i_lastchange()
|
||||
|
||||
The value of C<sysUpTime> when this port last changed states (up,down),
|
||||
maps from C<ifIndex> to C<nsIfIndex>.
|
||||
|
||||
(C<ifLastChange>)
|
||||
|
||||
=item $netscreen->i_mac()
|
||||
|
||||
MAC address of the interface. Note this is just the MAC of the port, not
|
||||
anything connected to it. Uses C<nsIfMAC> if available, C<ifPhysAddress>
|
||||
if not.
|
||||
|
||||
=item $netscreen->i_mtu()
|
||||
|
||||
INTEGER. Interface MTU value, maps from C<ifIndex> to C<nsIfIndex>.
|
||||
|
||||
(C<ifMtu>)
|
||||
|
||||
=item $netscreen->i_name()
|
||||
|
||||
Interface Name field.
|
||||
|
||||
(C<nsIfName>)
|
||||
|
||||
=item $netscreen->i_speed()
|
||||
|
||||
Speed of the link, maps from C<ifIndex> to C<nsIfIndex>.
|
||||
|
||||
=item $netscreen->i_type()
|
||||
|
||||
Interface type. Maps from C<ifIndex> to C<nsIfIndex>.
|
||||
|
||||
(C<ifType>)
|
||||
|
||||
=item $netscreen->i_up()
|
||||
|
||||
Link Status of the interface. Typical values are 'up' and 'down'.
|
||||
|
||||
(C<nsIfStatus>)
|
||||
|
||||
=item $netscreen->i_up_admin()
|
||||
|
||||
Administrative status of the port. Checks both C<ifAdminStatus> and
|
||||
C<nsIfStatus>.
|
||||
|
||||
=back
|
||||
|
||||
=head3 IP Address Table
|
||||
|
||||
Each entry in this table is an IP address in use on this device.
|
||||
|
||||
=over
|
||||
|
||||
=item $netscreen->ip_index()
|
||||
|
||||
Maps the IP Table to the IID
|
||||
|
||||
=item $netscreen->ip_table()
|
||||
|
||||
Maps the Table to the IP address
|
||||
|
||||
(C<nsIfIp>)
|
||||
|
||||
=item $netscreen->ip_netmask()
|
||||
|
||||
Gives netmask setting for IP table entry.
|
||||
|
||||
(C<nsIfNetmask>)
|
||||
|
||||
=back
|
||||
|
||||
=head3 Forwarding Table
|
||||
|
||||
Uses C<nsIpArpTable> to emulate the forwarding table.
|
||||
|
||||
=over
|
||||
|
||||
=item $netscreen->fw_index()
|
||||
|
||||
Maps the Forwarding Table to the IID
|
||||
|
||||
=item $netscreen->fw_mac()
|
||||
|
||||
Returns reference to hash of forwarding table MAC Addresses.
|
||||
|
||||
=item $netscreen->fw_port()
|
||||
|
||||
Returns reference to hash of forwarding table entries port interface
|
||||
identifier (IID).
|
||||
|
||||
=item $netscreen->bp_index()
|
||||
|
||||
Returns reference to hash of bridge port table entries map back to interface
|
||||
identifier (IID).
|
||||
|
||||
=back
|
||||
|
||||
=head2 Arp Cache Table
|
||||
|
||||
=over
|
||||
|
||||
=item $netscreen->at_index()
|
||||
|
||||
Returns reference to hash. Maps ARP table entries to Interface IIDs
|
||||
|
||||
If the device doesn't support C<ipNetToMediaIfIndex>, this will try
|
||||
the proprietary C<nsIpArpIfIdx>.
|
||||
|
||||
=item $netscreen->at_paddr()
|
||||
|
||||
Returns reference to hash. Maps ARP table entries to MAC addresses.
|
||||
|
||||
If the device doesn't support C<ipNetToMediaPhysAddress>, this will try
|
||||
the proprietary C<nsIpArpMac>.
|
||||
|
||||
=item $netscreen->at_netaddr()
|
||||
|
||||
Returns reference to hash. Maps ARP table entries to IP addresses.
|
||||
|
||||
If the device doesn't support C<ipNetToMediaNetAddress>, this will try
|
||||
the proprietary C<nsIpArpIp>.
|
||||
|
||||
=back
|
||||
|
||||
=head3 Wireless Information
|
||||
|
||||
=over
|
||||
|
||||
=item $dot11->i_ssidlist()
|
||||
|
||||
Returns reference to hash. SSID's recognized by the radio interface.
|
||||
Remaps from C<ifIndex> to C<nsIfIndex>.
|
||||
|
||||
(C<dot11DesiredSSID>)
|
||||
|
||||
=item $dot11->i_80211channel()
|
||||
|
||||
Returns reference to hash. Current operating frequency channel of the radio
|
||||
interface. Remaps from C<ifIndex> to C<nsIfIndex>.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See L<SNMP::Info::Layer3/"TABLE METHODS"> for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::IEEE802dot11
|
||||
|
||||
See L<SNMP::Info::IEEE802dot11/"TABLE METHODS"> for details.
|
||||
|
||||
=cut
|
||||
|
||||
392
lib/SNMP/Info/Layer3/Nexus.pm
Normal file
392
lib/SNMP/Info/Layer3/Nexus.pm
Normal file
@@ -0,0 +1,392 @@
|
||||
# SNMP::Info::Layer3::Nexus
|
||||
#
|
||||
# Copyright (c) 2014 Eric Miller
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the University of California, Santa Cruz nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer3::Nexus;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Exporter;
|
||||
use SNMP::Info::Layer3::CiscoSwitch;
|
||||
|
||||
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/;
|
||||
|
||||
# NOTE : Top-most items gets precedence for @ISA
|
||||
@SNMP::Info::Layer3::Nexus::ISA = qw/
|
||||
SNMP::Info::Layer3::CiscoSwitch
|
||||
Exporter
|
||||
/;
|
||||
|
||||
@SNMP::Info::Layer3::Nexus::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/;
|
||||
|
||||
$VERSION = '3.35';
|
||||
|
||||
# NOTE: Order creates precedence
|
||||
# Example: v_name exists in Bridge.pm and CiscoVTP.pm
|
||||
# Bridge is called from Layer3 and CiscoStpExtensions
|
||||
# So we want CiscoVTP to come last to get the right one.
|
||||
# The @ISA order should be reverse of these orders.
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer3::CiscoSwitch::MIBS,
|
||||
'CISCO-ENTITY-VENDORTYPE-OID-MIB' => 'cevMIBObjects',
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer3::CiscoSwitch::GLOBALS,
|
||||
'mac' => 'dot1dBaseBridgeAddress',
|
||||
);
|
||||
|
||||
%FUNCS = ( %SNMP::Info::Layer3::CiscoSwitch::FUNCS, );
|
||||
|
||||
%MUNGE = ( %SNMP::Info::Layer3::CiscoSwitch::MUNGE, );
|
||||
|
||||
sub os {
|
||||
return 'nx-os';
|
||||
}
|
||||
|
||||
sub os_ver {
|
||||
my $nexus = shift;
|
||||
my $descr = $nexus->description();
|
||||
|
||||
return $1 if ( $descr =~ /\),\s+Version\s+(.+?),/ );
|
||||
return $descr;
|
||||
}
|
||||
|
||||
sub _get_snmpid_chassis {
|
||||
my $self = shift;
|
||||
my $funcname = (caller(0))[3]; # Name of this sub, including package, used for debug logging
|
||||
|
||||
my $snmpid_chassis;
|
||||
my $position;
|
||||
|
||||
my $entity_entry = $self->e_class;
|
||||
for ( keys %$entity_entry ) {
|
||||
# filter by class (chassis is 3, but with proper MIBs loaded we should get the translated textual value)
|
||||
if ( ($entity_entry->{$_} eq 'chassis') or ($entity_entry->{$_} eq '3') ) {
|
||||
printf("%s - chassis with id %s found, position %s\n", $funcname, $_, $self->e_pos->{$_}) if $self->debug();
|
||||
|
||||
# and if it's the topmost one
|
||||
if ( !defined $position || $self->e_pos->{$_} < $position ) {
|
||||
$snmpid_chassis = $_;
|
||||
$position = $self->e_pos->{$_};
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( defined $snmpid_chassis && defined $position ) {
|
||||
printf(" %s - chassis with id %s, position %s selected\n", $funcname, $snmpid_chassis, $position);
|
||||
} else {
|
||||
printf(" %s - no chassis found\n", $funcname);
|
||||
}
|
||||
|
||||
return $snmpid_chassis;
|
||||
}
|
||||
|
||||
sub serial {
|
||||
my $nexus = shift;
|
||||
my $snmpid_chassis = $nexus->_get_snmpid_chassis;
|
||||
return $nexus->e_serial($snmpid_chassis)->{$snmpid_chassis} if defined $snmpid_chassis;
|
||||
return;
|
||||
}
|
||||
|
||||
# sysObjectID returns an IID to an entry in the CISCO-ENTITY-VENDORTYPE-OID-MIB.
|
||||
# Look it up and return it.
|
||||
sub model {
|
||||
my $nexus = shift;
|
||||
my $id = $nexus->id();
|
||||
|
||||
unless ( defined $id ) {
|
||||
print " SNMP::Info::Layer3::Nexus::model() - Device does not support sysObjectID\n" if $nexus->debug();
|
||||
return;
|
||||
}
|
||||
|
||||
my $model = &SNMP::translateObj($id);
|
||||
|
||||
return $id unless defined $model;
|
||||
|
||||
$model =~ s/^cevChassis//i;
|
||||
return $model;
|
||||
}
|
||||
|
||||
# Reported version 6.x of NX-OS doesn't use the IPv4 address as index
|
||||
# override methods in ipAddrTable
|
||||
sub ip_table {
|
||||
my $nexus = shift;
|
||||
my $orig_ip_table = $nexus->orig_ip_table();
|
||||
|
||||
my %ip_table;
|
||||
foreach my $iid ( keys %$orig_ip_table ) {
|
||||
my $ip = $orig_ip_table->{$iid};
|
||||
next unless defined $ip;
|
||||
|
||||
$ip_table{$ip} = $ip;
|
||||
}
|
||||
|
||||
my $local_addrs = $nexus->_local_addr();
|
||||
foreach my $addr (keys %$local_addrs) {
|
||||
$ip_table{$addr} = $addr unless exists $ip_table{$addr};
|
||||
}
|
||||
|
||||
return \%ip_table;
|
||||
}
|
||||
|
||||
sub ip_index {
|
||||
my $nexus = shift;
|
||||
my $orig_ip_table = $nexus->orig_ip_table();
|
||||
my $orig_ip_index = $nexus->orig_ip_index();
|
||||
|
||||
my %ip_index;
|
||||
foreach my $iid ( keys %$orig_ip_table ) {
|
||||
my $ip = $orig_ip_table->{$iid};
|
||||
my $index = $orig_ip_index->{$iid};
|
||||
|
||||
next unless ( defined $ip && defined $index );
|
||||
|
||||
$ip_index{$ip} = $index;
|
||||
}
|
||||
|
||||
my $local_addrs = $nexus->_local_addr();
|
||||
foreach my $addr (keys %$local_addrs) {
|
||||
$ip_index{$addr} = 0 unless exists $ip_index{$addr};
|
||||
}
|
||||
|
||||
return \%ip_index;
|
||||
}
|
||||
|
||||
sub ip_netmask {
|
||||
my $nexus = shift;
|
||||
my $orig_ip_table = $nexus->orig_ip_table();
|
||||
my $orig_ip_netmask = $nexus->orig_ip_netmask();
|
||||
|
||||
my %ip_netmask;
|
||||
foreach my $iid ( keys %$orig_ip_table ) {
|
||||
my $ip = $orig_ip_table->{$iid};
|
||||
my $netmask = $orig_ip_netmask->{$iid};
|
||||
|
||||
next unless ( defined $ip && defined $netmask );
|
||||
|
||||
$ip_netmask{$ip} = $netmask;
|
||||
}
|
||||
|
||||
my $local_addrs = $nexus->_local_addr();
|
||||
foreach my $addr (keys %$local_addrs) {
|
||||
$ip_netmask{$addr} = $local_addrs->{$addr} unless exists $ip_netmask{$addr};
|
||||
}
|
||||
|
||||
return \%ip_netmask;
|
||||
}
|
||||
|
||||
sub ip_broadcast {
|
||||
my $nexus = shift;
|
||||
my $orig_ip_table = $nexus->orig_ip_table();
|
||||
my $orig_ip_broadcast = $nexus->orig_ip_broadcast();
|
||||
|
||||
my %ip_broadcast;
|
||||
foreach my $iid ( keys %$orig_ip_table ) {
|
||||
my $ip = $orig_ip_table->{$iid};
|
||||
my $broadcast = $orig_ip_broadcast->{$iid};
|
||||
|
||||
next unless ( defined $ip && defined $broadcast );
|
||||
|
||||
$ip_broadcast{$ip} = $broadcast;
|
||||
}
|
||||
|
||||
my $local_addrs = $nexus->_local_addr();
|
||||
foreach my $addr (keys %$local_addrs) {
|
||||
$ip_broadcast{$addr} = $addr unless exists $ip_broadcast{$addr};
|
||||
}
|
||||
|
||||
return \%ip_broadcast;
|
||||
}
|
||||
|
||||
sub _local_addr {
|
||||
my $nexus = shift;
|
||||
my $listen_addr = $nexus->udpLocalAddress() || {};
|
||||
my %local_addr;
|
||||
foreach my $sock (keys %$listen_addr) {
|
||||
my $addr = $listen_addr->{$sock};
|
||||
next if ($addr =~ /^127\./); # localhost
|
||||
next if ($addr eq '0.0.0.0'); # "any"
|
||||
next if ($addr =~ /^(\d+)\./ and $1 ge 224); # Class D or E space: Multicast or Experimental
|
||||
$local_addr{$addr} = '255.255.255.255'; # Fictional netmask
|
||||
}
|
||||
return \%local_addr;
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer3::Nexus - SNMP Interface to Cisco Nexus Switches running
|
||||
NX-OS
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Eric Miller
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $nexus = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
# These arguments are passed directly to SNMP::Session
|
||||
DestHost => 'myswitch',
|
||||
Community => 'public',
|
||||
Version => 2
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $nexus->class();
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Abstraction subclass for Cisco Nexus Switches running NX-OS.
|
||||
|
||||
For speed or debugging purposes you can call the subclass directly, but not
|
||||
after determining a more specific class using the method above.
|
||||
|
||||
my $nexus = new SNMP::Info::Layer3::Nexus(...);
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info::Layer3::CiscoSwitch
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item F<CISCO-ENTITY-VENDORTYPE-OID-MIB>
|
||||
|
||||
=back
|
||||
|
||||
=over
|
||||
|
||||
=item Inherited Classes' MIBs
|
||||
|
||||
See L<SNMP::Info::Layer3::CiscoSwitch/"Required MIBs"> for its own MIB
|
||||
requirements.
|
||||
|
||||
=back
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return a scalar value from SNMP
|
||||
|
||||
=over
|
||||
|
||||
=item $nexus->os()
|
||||
|
||||
Returns C<'nx-os'>
|
||||
|
||||
=item $nexus->os_ver()
|
||||
|
||||
Returns operating system version extracted from C<sysDescr>.
|
||||
|
||||
=item $nexus->serial()
|
||||
|
||||
Returns the serial number of the chassis from F<ENTITY-MIB>.
|
||||
|
||||
=item $nexus->model()
|
||||
|
||||
Tries to reference $nexus->id() to F<CISCO-ENTITY-VENDORTYPE-OID-MIB>
|
||||
|
||||
Removes C<'cevChassis'> for readability.
|
||||
|
||||
=item $nexus->mac()
|
||||
|
||||
C<dot1dBaseBridgeAddress>
|
||||
|
||||
=back
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=head3 IP Address Table
|
||||
|
||||
Each entry in this table is an IP address in use on this device. Some
|
||||
versions do not index the table with the IPv4 address in accordance with
|
||||
the MIB definition, these overrides correct that behavior.
|
||||
|
||||
Also, the table is augmented with IP addresses in use by UDP sockets on the
|
||||
device, as determined by checking F<RFC1213-MIB::udpLocalAddress>. Valid
|
||||
addresses from this table (any IPv4 that is not localhost, 0.0.0.0, Class D
|
||||
(multicast) or Class E (experimental) are added as a /32 on interface ID 0.
|
||||
This is a workaround to determine possible VPC Keepalive IP addresses on the
|
||||
device, which are probably advertised by CDP/LLDP to neighbors.
|
||||
|
||||
=over
|
||||
|
||||
=item $nexus->ip_index()
|
||||
|
||||
Maps the IP Table to the IID
|
||||
|
||||
(C<ipAdEntIfIndex>)
|
||||
|
||||
=item $nexus->ip_table()
|
||||
|
||||
Maps the Table to the IP address
|
||||
|
||||
(C<ipAdEntAddr>)
|
||||
|
||||
=item $nexus->ip_netmask()
|
||||
|
||||
Gives netmask setting for IP table entry.
|
||||
|
||||
(C<ipAdEntNetMask>)
|
||||
|
||||
=item $nexus->ip_broadcast()
|
||||
|
||||
Gives broadcast address for IP table entry.
|
||||
|
||||
(C<ipAdEntBcastAddr>)
|
||||
|
||||
=back
|
||||
|
||||
=head2 Globals imported from SNMP::Info::Layer3::CiscoSwitch
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3::CiscoSwitch/"GLOBALS"> for details.
|
||||
|
||||
=head1 TABLE METHODS
|
||||
|
||||
These are methods that return tables of information in the form of a reference
|
||||
to a hash.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer3::CiscoSwitch
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3::CiscoSwitch/"TABLE METHODS"> for
|
||||
details.
|
||||
|
||||
=cut
|
||||
240
lib/SNMP/Info/Layer3/PacketFront.pm
Normal file
240
lib/SNMP/Info/Layer3/PacketFront.pm
Normal file
@@ -0,0 +1,240 @@
|
||||
# SNMP::Info::Layer3::PacketFront
|
||||
# $Id$
|
||||
#
|
||||
# Copyright (c) 2011 Jeroen van Ingen
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the University of California, Santa Cruz nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer3::PacketFront;
|
||||
|
||||
use strict;
|
||||
use Exporter;
|
||||
use SNMP::Info::Layer3;
|
||||
|
||||
@SNMP::Info::Layer3::PacketFront::ISA = qw/SNMP::Info::Layer3 Exporter/;
|
||||
@SNMP::Info::Layer3::PacketFront::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/;
|
||||
|
||||
$VERSION = '3.35';
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer3::MIBS,
|
||||
'UCD-SNMP-MIB' => 'versionTag',
|
||||
'NET-SNMP-TC' => 'netSnmpAgentOIDs',
|
||||
'HOST-RESOURCES-MIB' => 'hrSystem',
|
||||
'PACKETFRONT-PRODUCTS-MIB' => 'drg100',
|
||||
'PACKETFRONT-DRG-MIB' => 'productName',
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer3::GLOBALS,
|
||||
'snmpd_vers' => 'versionTag',
|
||||
'hrSystemUptime' => 'hrSystemUptime',
|
||||
);
|
||||
|
||||
%FUNCS = ( %SNMP::Info::Layer3::FUNCS, );
|
||||
|
||||
%MUNGE = ( %SNMP::Info::Layer3::MUNGE, );
|
||||
|
||||
sub vendor {
|
||||
return 'packetfront';
|
||||
}
|
||||
|
||||
sub os {
|
||||
# Only DRGOS for now (not tested with other product lines than DRG series)
|
||||
my $pfront = shift;
|
||||
my $descr = $pfront->description();
|
||||
if ( $descr =~ /drgos/i ) {
|
||||
return 'drgos';
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
sub os_ver {
|
||||
my $pfront = shift;
|
||||
my $descr = $pfront->description();
|
||||
my $os_ver = undef;
|
||||
|
||||
if ( $descr =~ /Version:\sdrgos-(\w+)-([\w\-\.]+)/ ) {
|
||||
$os_ver = $2;
|
||||
}
|
||||
return $os_ver;
|
||||
}
|
||||
|
||||
sub serial {
|
||||
my $pfront = shift;
|
||||
return $pfront->productSerialNo();
|
||||
}
|
||||
|
||||
sub i_ignore {
|
||||
my $l3 = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $interfaces = $l3->interfaces($partial) || {};
|
||||
|
||||
my %i_ignore;
|
||||
foreach my $if ( keys %$interfaces ) {
|
||||
|
||||
# lo0 etc
|
||||
if ( $interfaces->{$if} =~ /\blo\d*\b/i ) {
|
||||
$i_ignore{$if}++;
|
||||
}
|
||||
}
|
||||
return \%i_ignore;
|
||||
}
|
||||
|
||||
sub layers {
|
||||
my $pfront = shift;
|
||||
|
||||
my $layers = $pfront->SUPER::layers();
|
||||
# Some models or softwware versions don't report L2 properly
|
||||
# so add L2 capability to the output if the device has bridge ports.
|
||||
my $bports = $pfront->b_ports();
|
||||
|
||||
if ($bports) {
|
||||
my $l = substr $layers, 6, 1, "1";
|
||||
}
|
||||
|
||||
return $layers;
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer3::PacketFront - SNMP Interface to PacketFront devices
|
||||
|
||||
=head1 AUTHORS
|
||||
|
||||
Jeroen van Ingen
|
||||
initial version based on SNMP::Info::Layer3::NetSNMP by Bradley Baetz and Bill Fenner
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $pfront = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
DestHost => 'myrouter',
|
||||
Community => 'public',
|
||||
Version => 2
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $pfront->class();
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Subclass for PacketFront devices
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info::Layer3
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item F<UCD-SNMP-MIB>
|
||||
|
||||
=item F<NET-SNMP-TC>
|
||||
|
||||
=item F<HOST-RESOURCES-MIB>
|
||||
|
||||
=item F<PACKETFRONT-PRODUCTS-MIB>
|
||||
|
||||
=item F<PACKETFRONT-DRG-MIB>
|
||||
|
||||
=item Inherited Classes' MIBs
|
||||
|
||||
See L<SNMP::Info::Layer3> for its own MIB requirements.
|
||||
|
||||
=back
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar value from SNMP
|
||||
|
||||
=over
|
||||
|
||||
=item $pfront->vendor()
|
||||
|
||||
Returns C<'packetfront'>.
|
||||
|
||||
=item $pfront->os()
|
||||
|
||||
Returns the OS extracted from C<sysDescr>.
|
||||
|
||||
=item $pfront->os_ver()
|
||||
|
||||
Returns the software version extracted from C<sysDescr>.
|
||||
|
||||
=item $pfront->serial()
|
||||
|
||||
Returns the value of C<productSerialNo>.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Globals imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3> for details.
|
||||
|
||||
=head1 TABLE ENTRIES
|
||||
|
||||
These are methods that return tables of information in the form of a reference
|
||||
to a hash.
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=over
|
||||
|
||||
=item $pfront->i_ignore()
|
||||
|
||||
Returns reference to hash. Increments value of IID if port is to be ignored.
|
||||
|
||||
Ignores loopback
|
||||
|
||||
=item $pfront->layers()
|
||||
|
||||
L2 capability isn't always reported correctly by the device itself; what the
|
||||
device reports is augmented with L2 capability if the device has bridge ports.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3> for details.
|
||||
|
||||
|
||||
=cut
|
||||
190
lib/SNMP/Info/Layer3/PaloAlto.pm
Normal file
190
lib/SNMP/Info/Layer3/PaloAlto.pm
Normal file
@@ -0,0 +1,190 @@
|
||||
# SNMP::Info::Layer3::PaloAlto
|
||||
#
|
||||
# Copyright (c) 2014-2016 Max Kosmach
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the University of California, Santa Cruz nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer3::PaloAlto;
|
||||
|
||||
use strict;
|
||||
use Exporter;
|
||||
use SNMP::Info::Layer3;
|
||||
|
||||
@SNMP::Info::Layer3::PaloAlto::ISA = qw/SNMP::Info::Layer3 Exporter/;
|
||||
@SNMP::Info::Layer3::PaloAlto::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/;
|
||||
|
||||
$VERSION = '3.35';
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer3::MIBS,
|
||||
'PAN-COMMON-MIB' => 'panSysSwVersion',
|
||||
'PAN-PRODUCTS-MIB' => 'panProductsMibsModule',
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer3::GLOBALS,
|
||||
'mac' => 'ifPhysAddress.1',
|
||||
# Oids from PAN-COMMON-MIB.
|
||||
'os_ver' => 'panSysSwVersion',
|
||||
'serial1' => 'panSysSerialNumber',
|
||||
'pa_model' => 'panChassisType'
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer3::FUNCS,
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
%SNMP::Info::Layer3::MUNGE,
|
||||
);
|
||||
|
||||
sub vendor {
|
||||
return 'Palo Alto Networks';
|
||||
}
|
||||
|
||||
sub model {
|
||||
my $pa = shift;
|
||||
my $model = $pa->pa_model;
|
||||
$model =~ s/^pan//;
|
||||
return $model;
|
||||
}
|
||||
|
||||
sub os {
|
||||
return 'PAN-OS';
|
||||
}
|
||||
|
||||
sub layers {
|
||||
return '01001100';
|
||||
}
|
||||
|
||||
# TODO:
|
||||
# support fan and temp sensors from ENTITY-SENSOR-MIB
|
||||
# test with other Palo Alto devices
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer3::PaloAlto - SNMP Interface to Palo Alto devices
|
||||
|
||||
=head1 AUTHORS
|
||||
|
||||
Max Kosmach
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $pa = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
DestHost => 'myrouter',
|
||||
Community => 'public',
|
||||
Version => 2
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $pa->class();
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Subclass for Palo Alto devices
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info::Layer3
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item Inherited Classes' MIBs
|
||||
|
||||
See L<SNMP::Info::Layer3> for its own MIB requirements.
|
||||
|
||||
=back
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar value from SNMP
|
||||
|
||||
=over
|
||||
|
||||
=item $pa->vendor()
|
||||
|
||||
Returns C<'Palo Alto Networks'>.
|
||||
|
||||
=item $pa->os()
|
||||
|
||||
Returns C<'PANOS'>.
|
||||
|
||||
=item $pa->model()
|
||||
|
||||
Returns the value of C<panChassisType.0>.
|
||||
|
||||
=item $pa->os_ver()
|
||||
|
||||
Returns the value of C<panSysSwVersion.0>.
|
||||
|
||||
=item $pa->serial()
|
||||
|
||||
Returns the value of C<panSysSerialNumber.0>.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Globals imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3> for details.
|
||||
|
||||
=head1 TABLE ENTRIES
|
||||
|
||||
These are methods that return tables of information in the form of a reference
|
||||
to a hash.
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=over
|
||||
|
||||
=item $pa->layers()
|
||||
|
||||
Returns 01001110. Palo Alto doesn't report layers, modified to reflect
|
||||
Layer 2,3,4,7 functionality.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3> for details.
|
||||
|
||||
|
||||
=cut
|
||||
1458
lib/SNMP/Info/Layer3/Passport.pm
Normal file
1458
lib/SNMP/Info/Layer3/Passport.pm
Normal file
File diff suppressed because it is too large
Load Diff
230
lib/SNMP/Info/Layer3/Pf.pm
Normal file
230
lib/SNMP/Info/Layer3/Pf.pm
Normal file
@@ -0,0 +1,230 @@
|
||||
# SNMP::Info::Layer3::Pf
|
||||
# $Id$
|
||||
#
|
||||
# Copyright (c) 2010 Max Baker
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of Pf Networks, Inc. nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer3::Pf;
|
||||
|
||||
use strict;
|
||||
use Exporter;
|
||||
|
||||
use SNMP::Info::Layer3;
|
||||
use SNMP::Info::LLDP;
|
||||
|
||||
@SNMP::Info::Layer3::Pf::ISA = qw/SNMP::Info::LLDP SNMP::Info::Layer3 Exporter/;
|
||||
@SNMP::Info::Layer3::Pf::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/;
|
||||
|
||||
$VERSION = '3.35';
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer3::MIBS,
|
||||
%SNMP::Info::LLDP::MIBS,
|
||||
# Enterprise container where BEGEMOT-* lives
|
||||
'FOKUS-MIB' => 'fokus',
|
||||
# MIBs used included in Layer3 and above:
|
||||
# UDP-MIB
|
||||
# TCP-MIB
|
||||
# IF-MIB
|
||||
#
|
||||
# Stuff in these MIBs but not used for Netdisco yet for my test device:
|
||||
#
|
||||
#'BEGEMOT-SNMPD-MIB',
|
||||
#'BEGEMOT-PF-MIB',
|
||||
#'BEGEMOT-NETGRAPH-MIB',
|
||||
#'BEGEMOT-MIB2-MIB',
|
||||
#'BEGEMOT-HOSTRES-MIB',
|
||||
# HOST-RESOURCES-MIB
|
||||
# IP-FORWARD-MIB
|
||||
#
|
||||
# Nothing in these MIBs for my test device:
|
||||
#
|
||||
#'BEGEMOT-IP-MIB',
|
||||
#'BEGEMOT-MIB',
|
||||
#'BEGEMOT-BRIDGE-MIB',
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer3::GLOBALS,
|
||||
%SNMP::Info::LLDP::GLOBALS,
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer3::FUNCS,
|
||||
%SNMP::Info::LLDP::FUNCS,
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
%SNMP::Info::Layer3::MUNGE,
|
||||
%SNMP::Info::LLDP::MUNGE,
|
||||
);
|
||||
|
||||
sub vendor {
|
||||
return 'FreeBSD';
|
||||
}
|
||||
|
||||
sub model {
|
||||
my $pf = shift;
|
||||
my $descr = $pf->description() || '';
|
||||
my $model = undef;
|
||||
$model = $1 if ( $descr =~ /FreeBSD\s+(\S+)/ );
|
||||
return $model if defined $model;
|
||||
return $pf->os_ver();
|
||||
}
|
||||
|
||||
sub os {
|
||||
return 'Pf';
|
||||
}
|
||||
|
||||
sub os_ver {
|
||||
my $pf = shift;
|
||||
my $id = $pf->id();
|
||||
|
||||
my $os_ver = &SNMP::translateObj($id);
|
||||
return $id unless defined $os_ver;
|
||||
|
||||
# From /usr/share/snmp/defs/tree.def on a Pf Machine
|
||||
# (2 begemotSnmpdDefs
|
||||
# (1 begemotSnmpdAgent
|
||||
# (1 begemotSnmpdAgentFreeBSD OID op_dummy)
|
||||
# We're leaving the 1.1 and trimming off up to the 2
|
||||
$os_ver =~ s/fokus.1.1.2.//;
|
||||
return $os_ver;
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer3::Pf - SNMP Interface to FreeBSD-Based Firewalls using Pf /Pf Sense
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Max Baker
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $pf = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
# These arguments are passed directly to SNMP::Session
|
||||
DestHost => 'myswitch',
|
||||
Community => 'public',
|
||||
Version => 2
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $pf->class();
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Subclass for Free-BSD PF-Based devices
|
||||
|
||||
=head1 LLDP Support
|
||||
|
||||
LLDP Support is included but untested in this Device Class. It is reported
|
||||
that the available CDP/LLDP modules for net-snmp don't work on FreeBSD (on
|
||||
which pfSense is based) as they assume certain Linux specific Ethernet
|
||||
structures. This problem is apparently solved on PF based firewall appliances
|
||||
by using the ladvd package, for which a port may be found here:
|
||||
L<http://www.freshports.org/net/ladvd/>. I'm not sure if this module ties into
|
||||
Net-SNMP or not.
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info::Layer3
|
||||
|
||||
=item SNMP::Info::LLDP
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item F<FOKUS-MIB>
|
||||
|
||||
=item Inherited Classes' MIBs
|
||||
|
||||
See L<SNMP::Info::Layer3/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
See L<SNMP::Info::LLDP/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
=back
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar values from SNMP
|
||||
|
||||
=over
|
||||
|
||||
=item $pf->vendor()
|
||||
|
||||
Returns 'FreeBSD'
|
||||
|
||||
=item $pf->model()
|
||||
|
||||
Grabs the os version from C<sysDescr>
|
||||
|
||||
=item $pf->os()
|
||||
|
||||
Returns 'Pf'
|
||||
|
||||
=item $pf->os_ver()
|
||||
|
||||
Tries to reference $pf->id() to one of the product MIBs listed above.
|
||||
Will probably return a truncation of the default OID for pf-based systems
|
||||
C<enterprises.12325.1.1.2.1.1>.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Global Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"GLOBALS"> for details.
|
||||
|
||||
=head1 TABLE METHODS
|
||||
|
||||
These are methods that return tables of information in the form of a reference
|
||||
to a hash.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::LLDP
|
||||
|
||||
See documentation in L<SNMP::Info::LLDP/"TABLE METHODS"> for details.
|
||||
|
||||
=cut
|
||||
191
lib/SNMP/Info/Layer3/Pica8.pm
Normal file
191
lib/SNMP/Info/Layer3/Pica8.pm
Normal file
@@ -0,0 +1,191 @@
|
||||
# SNMP::Info::Layer3::Pica8
|
||||
#
|
||||
# Copyright (c) 2013 Jeroen van Ingen
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the University of California, Santa Cruz nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer3::Pica8;
|
||||
|
||||
use strict;
|
||||
use Exporter;
|
||||
use SNMP::Info::Layer3;
|
||||
use SNMP::Info::LLDP;
|
||||
|
||||
@SNMP::Info::Layer3::Pica8::ISA = qw/SNMP::Info::LLDP SNMP::Info::Layer3 Exporter/;
|
||||
@SNMP::Info::Layer3::Pica8::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/;
|
||||
|
||||
$VERSION = '3.35';
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer3::MIBS,
|
||||
%SNMP::Info::LLDP::MIBS,
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer3::GLOBALS,
|
||||
%SNMP::Info::LLDP::GLOBALS,
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer3::FUNCS,
|
||||
%SNMP::Info::LLDP::FUNCS,
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
%SNMP::Info::Layer3::MUNGE,
|
||||
%SNMP::Info::LLDP::MUNGE,
|
||||
);
|
||||
|
||||
sub vendor {
|
||||
return 'Pica8';
|
||||
}
|
||||
|
||||
sub os {
|
||||
my $pica8 = shift;
|
||||
my $descr = $pica8->description();
|
||||
|
||||
return $1 if ( $descr =~ /(\S+)\s+Platform Software/i );
|
||||
return;
|
||||
}
|
||||
|
||||
sub os_ver {
|
||||
my $pica8 = shift;
|
||||
my $descr = $pica8->description();
|
||||
|
||||
return $1 if ( $descr =~ /Software version ([\d\.]+)/i );
|
||||
return;
|
||||
}
|
||||
|
||||
sub model {
|
||||
my $pica8 = shift;
|
||||
my $descr = $pica8->description();
|
||||
|
||||
return $1 if ( $descr =~ /Hardware model (P-\d{4})/i );
|
||||
return;
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer3::Pica8 - SNMP Interface to L3 Devices, Pica8
|
||||
|
||||
=head1 AUTHORS
|
||||
|
||||
Jeroen van Ingen
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $pica8 = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
DestHost => 'myrouter',
|
||||
Community => 'public',
|
||||
Version => 2
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $pica8->class();
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Subclass for Pica8 devices
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info::Layer3
|
||||
|
||||
=item SNMP::Info::LLDP
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item F<PICA-PRIVATE-MIB>
|
||||
|
||||
=item Inherited Classes' MIBs
|
||||
|
||||
See L<SNMP::Info::Layer3> for its own MIB requirements.
|
||||
|
||||
See L<SNMP::Info::LLDP> for its own MIB requirements.
|
||||
|
||||
=back
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar value from SNMP
|
||||
|
||||
=over
|
||||
|
||||
=item $pica8->vendor()
|
||||
|
||||
Returns 'Pica8'
|
||||
|
||||
=item $pica8->model()
|
||||
|
||||
Returns the model name extracted from C<sysDescr>.
|
||||
|
||||
=item $pica8->os()
|
||||
|
||||
Returns the OS extracted from C<sysDescr>.
|
||||
|
||||
=item $pica8->os_ver()
|
||||
|
||||
Returns the OS version extracted from C<sysDescr>.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Globals imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3> for details.
|
||||
|
||||
=head2 Globals imported from SNMP::Info::LLDP
|
||||
|
||||
See documentation in L<SNMP::Info::LLDP> for details.
|
||||
|
||||
=head1 TABLE ENTRIES
|
||||
|
||||
These are methods that return tables of information in the form of a reference
|
||||
to a hash.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3> for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::LLDP
|
||||
|
||||
See documentation in L<SNMP::Info::LLDP> for details.
|
||||
|
||||
=cut
|
||||
189
lib/SNMP/Info/Layer3/SonicWALL.pm
Normal file
189
lib/SNMP/Info/Layer3/SonicWALL.pm
Normal file
@@ -0,0 +1,189 @@
|
||||
package SNMP::Info::Layer3::SonicWALL;
|
||||
|
||||
# Copyright (c) 2011 Netdisco Project
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the University of California, Santa Cruz nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
use strict;
|
||||
use Exporter;
|
||||
use SNMP::Info::Layer3;
|
||||
|
||||
@SNMP::Info::Layer3::SonicWALL::ISA = qw/SNMP::Info::Layer3 Exporter/;
|
||||
@SNMP::Info::Layer3::SonicWALL::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/;
|
||||
|
||||
$VERSION = '3.35';
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer2::MIBS, %SNMP::Info::Layer3::MIBS,
|
||||
'SNWL-COMMON-MIB' => 'snwlCommonModule',
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer2::GLOBALS, %SNMP::Info::Layer3::GLOBALS,
|
||||
#From SNWL-COMMON-MIB
|
||||
'sw_model' => 'snwlSysModel',
|
||||
'sw_serial' => 'snwlSysSerialNumber',
|
||||
'sw_firmware' => 'snwlSysFirmwareVersion',
|
||||
);
|
||||
|
||||
%FUNCS = ( %SNMP::Info::Layer2::FUNCS, %SNMP::Info::Layer3::FUNCS, );
|
||||
|
||||
%MUNGE = ( %SNMP::Info::Layer2::MUNGE, %SNMP::Info::Layer3::MUNGE, );
|
||||
|
||||
sub vendor {
|
||||
return 'SonicWALL';
|
||||
}
|
||||
|
||||
sub os {
|
||||
my $sonicos = shift;
|
||||
my $swos = $sonicos->sw_firmware();
|
||||
if ($swos =~ /Enhanced/) {
|
||||
return 'SonicOS Enhanced';
|
||||
}
|
||||
return 'SonicOS Standard';
|
||||
}
|
||||
|
||||
sub os_ver {
|
||||
my $sonicosver = shift;
|
||||
my $osver = $sonicosver->sw_firmware();
|
||||
if ( $osver =~ /\S+\s\S+\s(\S+)/) {
|
||||
return $1
|
||||
}
|
||||
}
|
||||
|
||||
sub serial {
|
||||
my $sw = shift;
|
||||
my $serial = $sw->sw_serial();
|
||||
return $serial;
|
||||
}
|
||||
|
||||
sub model {
|
||||
my $swmodel = shift;
|
||||
my $model = $swmodel->sw_model();
|
||||
return $model;
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer3::SonicWALL - SNMP Interface to L3 SonicWALL Firewall
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
phishphreek@gmail.com
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $router = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
DestHost => 'myrouter',
|
||||
Community => 'public',
|
||||
Version => 1
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $router->class();
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Subclass for Generic SonicWALL Firewalls
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info::Layer3
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item Inherited Classes' MIBs
|
||||
|
||||
See L<SNMP::Info::Layer3/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
=back
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar value from SNMP
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=over
|
||||
|
||||
=item $router->vendor()
|
||||
|
||||
Returns C<'SonicWALL'>
|
||||
|
||||
=item $router->os()
|
||||
|
||||
Returns C<'SonicOS'>
|
||||
|
||||
=item $router->os_ver()
|
||||
|
||||
Returns '4.2.0.0-10e'
|
||||
|
||||
=item $router->model()
|
||||
|
||||
Returns C<'PRO 3060 Enhanced'>
|
||||
|
||||
=item $router->serial()
|
||||
|
||||
Returns the MAC address of the first X0/LAN interface.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Globals imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"GLOBALS"> for details.
|
||||
|
||||
=head1 TABLE METHODS
|
||||
|
||||
These are methods that return tables of information in the form of a reference
|
||||
to a hash.
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=over
|
||||
|
||||
=back
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details.
|
||||
|
||||
=cut
|
||||
|
||||
216
lib/SNMP/Info/Layer3/Steelhead.pm
Normal file
216
lib/SNMP/Info/Layer3/Steelhead.pm
Normal file
@@ -0,0 +1,216 @@
|
||||
# SNMP::Info::Layer3::Steelhead
|
||||
#
|
||||
# Copyright (c) 2013 Eric Miller
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the University of California, Santa Cruz nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer3::Steelhead;
|
||||
|
||||
use strict;
|
||||
use Exporter;
|
||||
use SNMP::Info::Layer3;
|
||||
|
||||
@SNMP::Info::Layer3::Steelhead::ISA
|
||||
= qw/SNMP::Info::Layer3 Exporter/;
|
||||
@SNMP::Info::Layer3::Steelhead::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/;
|
||||
|
||||
$VERSION = '3.35';
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer3::MIBS,
|
||||
'STEELHEAD-MIB' => 'serialNumber',
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer3::GLOBALS,
|
||||
# Fully qualified to remove ambiguity of 'model'
|
||||
'rb_model' => 'STEELHEAD-MIB::model',
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer3::FUNCS,
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
%SNMP::Info::Layer3::MUNGE,
|
||||
);
|
||||
|
||||
sub layers {
|
||||
return '01001100';
|
||||
}
|
||||
|
||||
sub vendor {
|
||||
return 'riverbed';
|
||||
}
|
||||
|
||||
sub model {
|
||||
my $riverbed = shift;
|
||||
|
||||
my $model = $riverbed->rb_model() || '';
|
||||
|
||||
if ($model =~ /^(\d+)/) {
|
||||
return $1;
|
||||
}
|
||||
return $model;
|
||||
}
|
||||
|
||||
sub os {
|
||||
return 'steelhead';
|
||||
}
|
||||
|
||||
sub os_ver {
|
||||
my $riverbed = shift;
|
||||
|
||||
my $ver = $riverbed->systemVersion() || '';
|
||||
|
||||
if ( $ver =~ /(\d+[\.\d]+)/ ) {
|
||||
return $1;
|
||||
}
|
||||
|
||||
return $ver;
|
||||
}
|
||||
|
||||
sub serial {
|
||||
my $riverbed = shift;
|
||||
|
||||
return $riverbed->serialNumber();
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer3::Steelhead - SNMP Interface to Riverbed Steelhead WAN
|
||||
optimization appliances.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Eric Miller
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $riverbed = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
DestHost => 'myswitch',
|
||||
Community => 'public',
|
||||
Version => 2
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $riverbed->class();
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Abstraction subclass for Riverbed Steelhead WAN optimization appliances.
|
||||
|
||||
For speed or debugging purposes you can call the subclass directly, but not
|
||||
after determining a more specific class using the method above.
|
||||
|
||||
my $riverbed = new SNMP::Info::Layer3::Steelhead(...);
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info::Layer3
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
F<STEELHEAD-MIB>
|
||||
|
||||
=over
|
||||
|
||||
=item Inherited Classes' MIBs
|
||||
|
||||
See L<SNMP::Info::Layer3/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
=back
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar value from SNMP
|
||||
|
||||
=over
|
||||
|
||||
=item $riverbed->vendor()
|
||||
|
||||
Returns 'riverbed'
|
||||
|
||||
=item $riverbed->model()
|
||||
|
||||
Returns the chassis model.
|
||||
|
||||
(C<STEELHEAD-MIB::model>)
|
||||
|
||||
=item $riverbed->os()
|
||||
|
||||
Returns 'steelhead'
|
||||
|
||||
=item $riverbed->os_ver()
|
||||
|
||||
Returns the software version extracted from (C<systemVersion>).
|
||||
|
||||
=item $riverbed->serial()
|
||||
|
||||
Returns the chassis serial number.
|
||||
|
||||
(C<serialNumber>)
|
||||
|
||||
=back
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=over
|
||||
|
||||
=item $riverbed->layers()
|
||||
|
||||
Returns 01001100. Steelhead does not support bridge MIB, so override reported
|
||||
layers.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Globals imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"GLOBALS"> for details.
|
||||
|
||||
=head1 TABLE METHODS
|
||||
|
||||
These are methods that return tables of information in the form of a reference
|
||||
to a hash.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details.
|
||||
|
||||
=cut
|
||||
204
lib/SNMP/Info/Layer3/Sun.pm
Normal file
204
lib/SNMP/Info/Layer3/Sun.pm
Normal file
@@ -0,0 +1,204 @@
|
||||
# SNMP::Info::Layer3::Sun
|
||||
# $Id$
|
||||
#
|
||||
# Copyright (c) 2008 Eric Miller
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the University of California, Santa Cruz nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer3::Sun;
|
||||
|
||||
use strict;
|
||||
use Exporter;
|
||||
use SNMP::Info::Layer3;
|
||||
|
||||
@SNMP::Info::Layer3::Sun::ISA = qw/SNMP::Info::Layer3 Exporter/;
|
||||
@SNMP::Info::Layer3::Sun::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/;
|
||||
|
||||
$VERSION = '3.35';
|
||||
|
||||
%MIBS = ( %SNMP::Info::Layer3::MIBS, );
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer3::GLOBALS,
|
||||
'sun_hostid' => '.1.3.6.1.4.1.42.3.1.2.0',
|
||||
'motd' => '.1.3.6.1.4.1.42.3.1.3.0',
|
||||
);
|
||||
|
||||
%FUNCS = ( %SNMP::Info::Layer3::FUNCS, );
|
||||
|
||||
%MUNGE = ( %SNMP::Info::Layer3::MUNGE, );
|
||||
|
||||
sub vendor {
|
||||
return 'sun';
|
||||
}
|
||||
|
||||
sub os {
|
||||
return 'sun';
|
||||
}
|
||||
|
||||
sub os_ver {
|
||||
my $sun = shift;
|
||||
my $descr = $sun->motd();
|
||||
return unless defined $descr;
|
||||
|
||||
if ( $descr =~ m/SunOS (\S+)/ ) {
|
||||
return $1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
sub model {
|
||||
return 'Solaris Router';
|
||||
}
|
||||
|
||||
sub serial {
|
||||
my $sun = shift;
|
||||
my $serial = unpack( "H*", $sun->sun_hostid() );
|
||||
return $serial;
|
||||
}
|
||||
|
||||
sub i_ignore {
|
||||
my $l3 = shift;
|
||||
my $partial = shift;
|
||||
|
||||
my $interfaces = $l3->interfaces($partial) || {};
|
||||
|
||||
my %i_ignore;
|
||||
foreach my $if ( keys %$interfaces ) {
|
||||
|
||||
# lo0
|
||||
if ( $interfaces->{$if} =~ /\blo0\b/i ) {
|
||||
$i_ignore{$if}++;
|
||||
}
|
||||
}
|
||||
return \%i_ignore;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer3::Sun - SNMP Interface to L3 Sun Solaris
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
begemot
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $sun = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
DestHost => 'mysunrouter',
|
||||
Community => 'public',
|
||||
Version => 1
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $sun->class();
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Subclass for Generic Sun Routers running SunOS
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info::Layer3
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item Inherited Classes' MIBs
|
||||
|
||||
See L<SNMP::Info::Layer3/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
=back
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar value from SNMP
|
||||
|
||||
=over
|
||||
|
||||
=item $sun->vendor()
|
||||
|
||||
Returns 'sun'
|
||||
|
||||
=item $sun->os()
|
||||
|
||||
Returns 'sun'
|
||||
|
||||
=item $sun->os_ver()
|
||||
|
||||
Returns the software version extracted from message of the day.
|
||||
|
||||
=item $sun->model()
|
||||
|
||||
Returns 'Solaris Router'
|
||||
|
||||
=item $sun->serial()
|
||||
|
||||
Returns serial number
|
||||
|
||||
=back
|
||||
|
||||
=head2 Globals imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"GLOBALS"> for details.
|
||||
|
||||
=head1 TABLE METHODS
|
||||
|
||||
These are methods that return tables of information in the form of a reference
|
||||
to a hash.
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=over
|
||||
|
||||
=item $sun->i_ignore()
|
||||
|
||||
Returns reference to hash. Increments value of IID if port is to be ignored.
|
||||
|
||||
Ignores loopback
|
||||
|
||||
=back
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details.
|
||||
|
||||
=cut
|
||||
543
lib/SNMP/Info/Layer3/Tasman.pm
Normal file
543
lib/SNMP/Info/Layer3/Tasman.pm
Normal file
@@ -0,0 +1,543 @@
|
||||
# SNMP::Info::Layer3::Tasman
|
||||
#
|
||||
# Copyright (c) 2012 Eric Miller
|
||||
# All Rights Reserved
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the University of California, Santa Cruz nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer3::Tasman;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Exporter;
|
||||
|
||||
use SNMP::Info::Layer3;
|
||||
use SNMP::Info::MAU;
|
||||
|
||||
@SNMP::Info::Layer3::Tasman::ISA = qw/SNMP::Info::MAU
|
||||
SNMP::Info::Layer3 Exporter/;
|
||||
@SNMP::Info::Layer3::Tasman::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/;
|
||||
|
||||
$VERSION = '3.35';
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer3::MIBS,
|
||||
%SNMP::Info::MAU::MIBS,
|
||||
'NT-ENTERPRISE-DATA-MIB' => 'ntEnterpriseRouters',
|
||||
'SYSTEM-MIB' => 'nnsysVersion',
|
||||
'CHASSIS-MIB' => 'nnchassisModel',
|
||||
'ENVIRONMENT-MIB' => 'nnenvPwrsupStatus',
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer3::GLOBALS,
|
||||
%SNMP::Info::MAU::GLOBALS,
|
||||
'ps1_type' => 'nnenvPwrsupType.1',
|
||||
'ps1_status' => 'nnenvPwrsupStatus.1',
|
||||
'ps2_type' => 'nnenvPwrsupType.2',
|
||||
'ps2_status' => 'nnenvPwrsupStatus.2',
|
||||
'nn_sys_ver' => 'nnsysVersion',
|
||||
'nn_ch_model' => 'nnchassisModel',
|
||||
'nn_ch_op_stat' => 'nnchassisOperStatus',
|
||||
'nn_ch_serial' => 'nnchassisSerialNumber',
|
||||
);
|
||||
|
||||
%FUNCS = ( %SNMP::Info::Layer3::FUNCS, %SNMP::Info::MAU::FUNCS, );
|
||||
|
||||
%MUNGE = ( %SNMP::Info::Layer3::MUNGE, %SNMP::Info::MAU::MUNGE, );
|
||||
|
||||
# use MAU-MIB for admin. duplex and admin. speed
|
||||
*SNMP::Info::Layer3::Tasman::i_duplex_admin
|
||||
= \&SNMP::Info::MAU::mau_i_duplex_admin;
|
||||
*SNMP::Info::Layer3::Tasman::i_speed_admin
|
||||
= \&SNMP::Info::MAU::mau_i_speed_admin;
|
||||
|
||||
my $module_map = {
|
||||
ADSL_ANX_A => '1-port ADSL2+ Annex A',
|
||||
ADSL_ANX_B => '1-port ADSL2+ Annex B',
|
||||
BRI_2ST => '2-port ST-interface ISDN BRI for both TDM and Packet',
|
||||
FXO_2M => 'Voice Interface card - 2 port FXO',
|
||||
FXO_4M => 'Voice Interface card - 4 port FXO',
|
||||
FXS_2M => 'Voice Interface card - 2 port FXS',
|
||||
FXS_4M => 'Voice Interface card - 4 port FXS',
|
||||
HSSI_1 => '1-port High Speed Serial',
|
||||
LMF_24 => '24-port 10/100 Fast Ethernet Layer2/3 switch',
|
||||
LMG_10 =>
|
||||
'10-port non-blocking 10/100/1000 Gigabit Ethernet Layer2/3 switch',
|
||||
LMG_44 => '44-port 10/100/1000 Gigabit Ethernet Layer 2/3 switch',
|
||||
LMP_24 => '24-port 10/100 fast Ethernet Layer2/3 PoE switch',
|
||||
PVIM_A => 'Packetized Voice Module (PVIM)',
|
||||
SCIM_A => 'Ipsec VPN Encryption Module',
|
||||
SERV_MOD => 'Secure Router 4134 Server Module',
|
||||
VCM_A =>
|
||||
'Medium Carrier module supports up to 4 FXO or FXS Small Modules',
|
||||
VOIP_A => 'Packetized Voice Module (PVM)',
|
||||
VPN_A => 'High Performance IPsec VPN Encryption Module',
|
||||
WDS3_1C => '1-port Clear Channel DS3',
|
||||
WT3_1C => '1-port Channelized T3',
|
||||
DS3_1C => '1-port Channelized T3',
|
||||
WTE_1 => '1-port T1/E1 w DS0 and DS1 support for both TDM and Packet',
|
||||
WTE_2S => '2-port Sync and Async Serial',
|
||||
WTE_8 => '8-port T1/E1'
|
||||
};
|
||||
|
||||
sub vendor {
|
||||
return 'avaya';
|
||||
}
|
||||
|
||||
sub os {
|
||||
return 'tasman';
|
||||
}
|
||||
|
||||
sub os_ver {
|
||||
my $tasman = shift;
|
||||
my $version = $tasman->nn_sys_ver() || "";
|
||||
my $descr = $tasman->description() || "";
|
||||
|
||||
# Newer versions
|
||||
return $1 if ( $version =~ /^SW:\s+(.+?)\s+/ );
|
||||
|
||||
# Older versions
|
||||
return $1 if ( $descr =~ /Software Version\s+=\s+[r]*(.+),/ );
|
||||
|
||||
# Can't find
|
||||
return;
|
||||
}
|
||||
|
||||
sub model {
|
||||
my $tasman = shift;
|
||||
|
||||
my $id = $tasman->id();
|
||||
my $ch_model = $tasman->nn_ch_model();
|
||||
|
||||
return $ch_model if $ch_model;
|
||||
|
||||
my $model = &SNMP::translateObj($id);
|
||||
return $id unless defined $model;
|
||||
|
||||
$model =~ s/^ntSecureRouter/SR/;
|
||||
return $model;
|
||||
}
|
||||
|
||||
sub serial {
|
||||
my $tasman = shift;
|
||||
|
||||
# Newer versions of the software redefined the MIB in a non-backwards
|
||||
# compatible manner. Try the old OID first.
|
||||
my $serial = $tasman->nn_ch_op_stat();
|
||||
|
||||
# Newer versions populate status, serial should contain some letters
|
||||
# while a status is an integer
|
||||
return $serial if ( $serial !~ /^\D+$/ );
|
||||
|
||||
# Unfortunately newer versions don't seem to populate the newer OID.
|
||||
# so check modules for a chassis
|
||||
my $e_parent = $tasman->e_parent();
|
||||
|
||||
foreach my $iid ( keys %$e_parent ) {
|
||||
my $parent = $e_parent->{$iid};
|
||||
if ( $parent eq '0' ) {
|
||||
my $ser = $tasman->e_serial($iid);
|
||||
return $ser->{$iid};
|
||||
}
|
||||
}
|
||||
|
||||
# If everything else failed just return what is supposed to hold the
|
||||
# serial although it probably doesn't
|
||||
return $tasman->nn_ch_serial();
|
||||
}
|
||||
|
||||
# Slots 1–4 are Small Module slots. Slots 5–7 are Medium Module slots.
|
||||
# A Large Module spans slots 6 and 7. It will be identified as slot 6.
|
||||
|
||||
sub e_index {
|
||||
my $tasman = shift;
|
||||
|
||||
my $index = $tasman->nnchassisInfoSlotSubSlotString() || {};
|
||||
|
||||
# In some cases the modules are duplicated, remove duplicates
|
||||
my %seen;
|
||||
my %e_index;
|
||||
foreach my $key ( keys %$index ) {
|
||||
my $string = $index->{$key};
|
||||
$string =~ s/\D//;
|
||||
unless ( $seen{$string} ) {
|
||||
$seen{$string}++;
|
||||
$e_index{$key} = $string + 1;
|
||||
}
|
||||
}
|
||||
|
||||
return \%e_index;
|
||||
}
|
||||
|
||||
sub e_class {
|
||||
my $tasman = shift;
|
||||
|
||||
my $e_index = $tasman->e_index() || {};
|
||||
|
||||
my %e_class;
|
||||
foreach my $iid ( keys %$e_index ) {
|
||||
|
||||
my $index = $e_index->{$iid};
|
||||
|
||||
if ( $index == 1 ) {
|
||||
$e_class{$iid} = 'chassis';
|
||||
}
|
||||
else {
|
||||
$e_class{$iid} = 'module';
|
||||
}
|
||||
}
|
||||
return \%e_class;
|
||||
}
|
||||
|
||||
sub e_descr {
|
||||
my $tasman = shift;
|
||||
|
||||
my $e_index = $tasman->e_index() || {};
|
||||
my $types = $tasman->nnchassisInfoCardType || {};
|
||||
|
||||
my %e_descr;
|
||||
foreach my $iid ( keys %$e_index ) {
|
||||
my $type = $types->{$iid};
|
||||
next unless $type;
|
||||
|
||||
if ( $type =~ /^MPU/ ) {
|
||||
$e_descr{$iid} = $tasman->model();
|
||||
}
|
||||
elsif ( defined $module_map->{$type} ) {
|
||||
$e_descr{$iid} = $module_map->{$type};
|
||||
}
|
||||
else {
|
||||
next;
|
||||
}
|
||||
}
|
||||
return \%e_descr;
|
||||
}
|
||||
|
||||
sub e_serial {
|
||||
my $tasman = shift;
|
||||
|
||||
my $e_index = $tasman->e_index() || {};
|
||||
my $serials = $tasman->nnchassisInfoSerialNumber() || {};
|
||||
|
||||
my %e_serial;
|
||||
foreach my $iid ( keys %$e_index ) {
|
||||
$e_serial{$iid} = $serials->{$iid} || '';
|
||||
}
|
||||
return \%e_serial;
|
||||
}
|
||||
|
||||
sub e_fru {
|
||||
my $tasman = shift;
|
||||
|
||||
my $e_index = $tasman->e_index() || {};
|
||||
|
||||
my %e_fru;
|
||||
foreach my $iid ( keys %$e_index ) {
|
||||
$e_fru{$iid} = "true";
|
||||
}
|
||||
return \%e_fru;
|
||||
}
|
||||
|
||||
sub e_type {
|
||||
my $tasman = shift;
|
||||
|
||||
my $e_index = $tasman->e_index() || {};
|
||||
my $types = $tasman->nnchassisInfoCardType || {};
|
||||
|
||||
my %e_type;
|
||||
foreach my $iid ( keys %$e_index ) {
|
||||
$e_type{$iid} = $types->{$iid} || '';
|
||||
}
|
||||
|
||||
return \%e_type;
|
||||
}
|
||||
|
||||
sub e_vendor {
|
||||
my $tasman = shift;
|
||||
|
||||
my $e_idx = $tasman->e_index() || {};
|
||||
|
||||
my %e_vendor;
|
||||
foreach my $iid ( keys %$e_idx ) {
|
||||
$e_vendor{$iid} = 'avaya';
|
||||
}
|
||||
return \%e_vendor;
|
||||
}
|
||||
|
||||
sub e_pos {
|
||||
my $tasman = shift;
|
||||
|
||||
return $tasman->e_index();
|
||||
}
|
||||
|
||||
sub e_parent {
|
||||
my $tasman = shift;
|
||||
|
||||
my $e_idx = $tasman->e_index() || {};
|
||||
my $e_classes = $tasman->e_class() || {};
|
||||
|
||||
my $cha_idx = 0;
|
||||
foreach my $i ( keys %$e_classes ) {
|
||||
my $class = $e_classes->{$i};
|
||||
my $pos = $e_idx->{$i};
|
||||
if ( $class && $class eq 'chassis' ) {
|
||||
$cha_idx = $pos;
|
||||
}
|
||||
}
|
||||
|
||||
my %e_parent;
|
||||
foreach my $iid ( keys %$e_idx ) {
|
||||
my $idx = $e_idx->{$iid};
|
||||
|
||||
if ( $idx == 1 ) {
|
||||
$e_parent{$iid} = 0;
|
||||
}
|
||||
elsif ( $idx =~ /^(\d)\d$/ ) {
|
||||
$e_parent{$iid} = $1;
|
||||
}
|
||||
else {
|
||||
$e_parent{$iid} = $cha_idx;
|
||||
}
|
||||
}
|
||||
return \%e_parent;
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer3::Tasman - SNMP Interface to Avaya Secure Routers
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Eric Miller
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $tasman = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
# These arguments are passed directly to SNMP::Session
|
||||
DestHost => 'myswitch',
|
||||
Community => 'public',
|
||||
Version => 2
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $tasman->class();
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Subclass for Avaya Secure Routers
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info::Layer3
|
||||
|
||||
=item SNMP::Info::MAU
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item F<NT-ENTERPRISE-DATA-MIB>
|
||||
|
||||
=item F<SYSTEM-MIB>
|
||||
|
||||
=item F<CHASSIS-MIB>
|
||||
|
||||
=item F<ENVIRONMENT-MIB>
|
||||
|
||||
=item Inherited Classes' MIBs
|
||||
|
||||
See L<SNMP::Info::Layer3/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
See L<SNMP::Info::MAU/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
=back
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar values from SNMP
|
||||
|
||||
=over
|
||||
|
||||
=item $tasman->vendor()
|
||||
|
||||
Returns C<'avaya'>
|
||||
|
||||
=item $tasman->model()
|
||||
|
||||
Tries to get the model from C<nnchassisModel> and if not available
|
||||
cross references $tasman->id() to F<NT-ENTERPRISE-DATA-MIB>.
|
||||
|
||||
Substitutes 'SR' for C<'ntSecureRouter'> in the name for readability.
|
||||
|
||||
=item $tasman->os()
|
||||
|
||||
Returns C<'tasman'>
|
||||
|
||||
=item $tasman->os_ver()
|
||||
|
||||
Grabs the os version from C<nnsysVersion>
|
||||
|
||||
=item $tasman->ps1_type()
|
||||
|
||||
(C<nnenvPwrsupType.1>)
|
||||
|
||||
=item $tasman->ps1_status()
|
||||
|
||||
(C<nnenvPwrsupStatus.1>)
|
||||
|
||||
=item $tasman->ps2_type()
|
||||
|
||||
(C<nnenvPwrsupType.2>)
|
||||
|
||||
=item $tasman->ps2_status()
|
||||
|
||||
(C<nnenvPwrsupStatus.2>)
|
||||
|
||||
=item $tasman->nn_sys_ver()
|
||||
|
||||
(C<nnsysVersion.0>)
|
||||
|
||||
=item $tasman->nn_ch_model()
|
||||
|
||||
(C<nnchassisModel.0>)
|
||||
|
||||
=item $tasman->nn_ch_op_stat()
|
||||
|
||||
(C<nnchassisOperStatus.0>)
|
||||
|
||||
=item $tasman->nn_ch_serial()
|
||||
|
||||
(C<nnchassisSerialNumber.0>)
|
||||
|
||||
=item $tasman->serial()
|
||||
|
||||
Tries both (C<nnchassisOperStatus>) and (C<nnchassisSerialNumber>) as oid
|
||||
was redefined between versions.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Global Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"GLOBALS"> for details.
|
||||
|
||||
=head2 Global Methods imported from SNMP::Info::MAU
|
||||
|
||||
See documentation in L<SNMP::Info::MAU/"GLOBALS"> for details.
|
||||
|
||||
=head1 TABLE METHODS
|
||||
|
||||
These are methods that return tables of information in the form of a reference
|
||||
to a hash.
|
||||
|
||||
=over 4
|
||||
|
||||
=item $tasman->i_duplex_admin()
|
||||
|
||||
Returns reference to hash of iid to administrative duplex setting.
|
||||
|
||||
First checks for fixed gigabit ports which are always full duplex. Next checks
|
||||
the port administrative speed (C<portAdminSpeed>) which if set to
|
||||
autonegotiate then the duplex will also autonegotiate, otherwise it uses the
|
||||
reported port duplex (C<portDuplex>).
|
||||
|
||||
=item $tasman->i_speed_admin()
|
||||
|
||||
Returns reference to hash of iid to administrative speed setting.
|
||||
|
||||
C<portAdminSpeed>
|
||||
|
||||
=back
|
||||
|
||||
=head2 Pseudo F<ENTITY-MIB> information
|
||||
|
||||
These methods emulate F<ENTITY-MIB> Physical Table methods using
|
||||
F<CHASSIS-MIB>.
|
||||
|
||||
=over
|
||||
|
||||
=item $tasman->e_index()
|
||||
|
||||
Returns reference to hash. Key: IID, Value: Integer.
|
||||
|
||||
=item $tasman->e_class()
|
||||
|
||||
Returns reference to hash. Key: IID, Value: General hardware type.
|
||||
|
||||
=item $tasman->e_descr()
|
||||
|
||||
Returns reference to hash. Key: IID, Value: Human friendly name
|
||||
|
||||
=item $tasman->e_vendor()
|
||||
|
||||
Returns reference to hash. Key: IID, Value: avaya
|
||||
|
||||
=item $tasman->e_serial()
|
||||
|
||||
Returns reference to hash. Key: IID, Value: Serial number
|
||||
|
||||
=item $tasman->e_pos()
|
||||
|
||||
Returns reference to hash. Key: IID, Value: The relative position among all
|
||||
entities sharing the same parent.
|
||||
|
||||
=item $tasman->e_type()
|
||||
|
||||
Returns reference to hash. Key: IID, Value: Type of component/sub-component.
|
||||
|
||||
=item $tasman->e_parent()
|
||||
|
||||
Returns reference to hash. Key: IID, Value: The value of e_index() for the
|
||||
entity which 'contains' this entity. A value of zero indicates this entity
|
||||
is not contained in any other entity.
|
||||
|
||||
=item $entity->e_fru()
|
||||
|
||||
BOOLEAN. Is a Field Replaceable unit?
|
||||
|
||||
=back
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::MAU
|
||||
|
||||
See documentation in L<SNMP::Info::MAU/"TABLE METHODS"> for details.
|
||||
|
||||
=cut
|
||||
194
lib/SNMP/Info/Layer3/Timetra.pm
Normal file
194
lib/SNMP/Info/Layer3/Timetra.pm
Normal file
@@ -0,0 +1,194 @@
|
||||
# SNMP::Info::Layer3::Timetra
|
||||
# $Id$
|
||||
#
|
||||
# Copyright (c) 2008 Bill Fenner
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the University of California, Santa Cruz nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer3::Timetra;
|
||||
|
||||
use strict;
|
||||
|
||||
use Exporter;
|
||||
use SNMP::Info::Layer3;
|
||||
|
||||
@SNMP::Info::Layer3::Timetra::ISA = qw/SNMP::Info::Layer3
|
||||
Exporter/;
|
||||
@SNMP::Info::Layer3::Timetra::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/;
|
||||
|
||||
$VERSION = '3.35';
|
||||
|
||||
%MIBS = ( %SNMP::Info::Layer3::MIBS, 'TIMETRA-GLOBAL-MIB' => 'timetraReg', );
|
||||
|
||||
%GLOBALS = ( %SNMP::Info::Layer3::GLOBALS, );
|
||||
|
||||
%FUNCS = ( %SNMP::Info::Layer3::FUNCS, );
|
||||
|
||||
%MUNGE = ( %SNMP::Info::Layer3::MUNGE, );
|
||||
|
||||
sub model {
|
||||
my $timetra = shift;
|
||||
my $id = $timetra->id();
|
||||
my $model = &SNMP::translateObj($id);
|
||||
|
||||
return $id unless defined $model;
|
||||
|
||||
$model =~ s/^tmnxModel//;
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
sub os {
|
||||
return 'TiMOS';
|
||||
}
|
||||
|
||||
sub vendor {
|
||||
return 'alcatel-lucent';
|
||||
}
|
||||
|
||||
sub os_ver {
|
||||
my $timetra = shift;
|
||||
|
||||
my $descr = $timetra->description();
|
||||
if ( $descr =~ m/^TiMOS-(\S+)/ ) {
|
||||
return $1;
|
||||
}
|
||||
|
||||
# No clue what this will try but hey
|
||||
return $timetra->SUPER::os_ver();
|
||||
}
|
||||
|
||||
# The interface description contains the SFP type, so
|
||||
# to avoid losing historical information through a configuration change
|
||||
# we use interface name instead.
|
||||
sub interfaces {
|
||||
my $alu = shift;
|
||||
my $partial = shift;
|
||||
|
||||
return $alu->orig_i_name($partial);
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer3::Timetra - SNMP Interface to Alcatel-Lucent SR
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Bill Fenner
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $alu = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
# These arguments are passed directly to SNMP::Session
|
||||
DestHost => 'myswitch',
|
||||
Community => 'public',
|
||||
Version => 2
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $alu->class();
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Subclass for Alcatel-Lucent Service Routers
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info::Layer3
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item F<TIMETRA-GLOBAL-MIB>
|
||||
|
||||
=item Inherited Classes' MIBs
|
||||
|
||||
See L<SNMP::Info::Layer3/"Required MIBs"> for its own MIB requirements.
|
||||
|
||||
=back
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar value from SNMP
|
||||
|
||||
=over
|
||||
|
||||
=item $alu->vendor()
|
||||
|
||||
Returns 'alcatel-lucent'
|
||||
|
||||
=item $alu->os()
|
||||
|
||||
Returns 'TiMOS'
|
||||
|
||||
=item $alu->os_ver()
|
||||
|
||||
Grabs the version string from C<sysDescr>.
|
||||
|
||||
=item $alu->model()
|
||||
|
||||
Tries to reference $alu->id() to one of the product MIBs listed above
|
||||
|
||||
Removes 'tmnxModel' from the name for readability.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Globals imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"GLOBALS"> for details.
|
||||
|
||||
=head1 TABLE METHODS
|
||||
|
||||
These are methods that return tables of information in the form of a reference
|
||||
to a hash.
|
||||
|
||||
=over
|
||||
|
||||
=item $alu->interfaces()
|
||||
|
||||
Returns C<ifName>, since the default Layer3 C<ifDescr> varies based
|
||||
upon the transceiver inserted.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details.
|
||||
|
||||
=cut
|
||||
195
lib/SNMP/Info/Layer3/VMware.pm
Normal file
195
lib/SNMP/Info/Layer3/VMware.pm
Normal file
@@ -0,0 +1,195 @@
|
||||
# SNMP::Info::Layer3::VMware
|
||||
#
|
||||
# Copyright (c) 2014-2016 Max Kosmach
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the University of California, Santa Cruz nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer3::VMware;
|
||||
|
||||
use strict;
|
||||
use Exporter;
|
||||
use SNMP::Info::Layer3;
|
||||
use SNMP::Info::IEEE802dot3ad 'agg_ports_lag';
|
||||
|
||||
@SNMP::Info::Layer3::VMware::ISA = qw/SNMP::Info::IEEE802dot3ad SNMP::Info::Layer3 Exporter/;
|
||||
@SNMP::Info::Layer3::VMware::EXPORT_OK = qw/agg_ports/;
|
||||
|
||||
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/;
|
||||
|
||||
$VERSION = '3.35';
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::IEEE802dot3ad::MIBS,
|
||||
%SNMP::Info::Layer3::MIBS,
|
||||
'VMWARE-PRODUCTS-MIB' => 'vmwProducts',
|
||||
'VMWARE-SYSTEM-MIB' => 'vmwProdName',
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer3::GLOBALS,
|
||||
# VMWARE-SYSTEM-MIB
|
||||
'vmwProdVersion' => 'vmwProdVersion',
|
||||
'vmwProdBuild' => 'vmwProdBuild',
|
||||
'vmwProdUpdate' => 'vmwProdUpdate',
|
||||
'vmwProdPatch' => 'vmwProdPatch',
|
||||
'os' => 'vmwProdName',
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::Layer3::FUNCS,
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
%SNMP::Info::Layer3::MUNGE,
|
||||
);
|
||||
|
||||
sub vendor {
|
||||
return 'VMware';
|
||||
}
|
||||
|
||||
sub os_ver {
|
||||
my $vmware = shift;
|
||||
my $vmwProdVersion = $vmware->vmwProdVersion();
|
||||
my $vmwProdBuild = $vmware->vmwProdBuild() || '';
|
||||
my $vmwProdUpdate = $vmware->vmwProdUpdate() || '';
|
||||
my $vmwProdPatch = $vmware->vmwProdPatch() || '';
|
||||
|
||||
my $ver = "$vmwProdVersion" . "-" . "$vmwProdUpdate.$vmwProdPatch.$vmwProdBuild";
|
||||
return $ver;
|
||||
}
|
||||
|
||||
sub agg_ports {
|
||||
return agg_ports_lag(@_);
|
||||
}
|
||||
|
||||
#sub layers {
|
||||
# return '01001010';
|
||||
#}
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer3::VMware - SNMP Interface to VMware ESXi
|
||||
|
||||
=head1 AUTHORS
|
||||
|
||||
Max Kosmach
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $host = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
DestHost => 'myhost',
|
||||
Community => 'public',
|
||||
Version => 2
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $host->class();
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Subclass for VMware ESXi
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info::Layer3
|
||||
|
||||
=item SNMP::Info::IEEE802dot3ad
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item F<VMWARE-SYSTEM-MIB>
|
||||
|
||||
=item F<VMWARE-PRODUCTS-MIB>
|
||||
|
||||
=back
|
||||
|
||||
=head2 Inherited Classes' MIBs
|
||||
|
||||
See L<SNMP::Info::Layer3/"Required MIBs"> for its MIB requirements.
|
||||
|
||||
See L<SNMP::Info::IEEE802dot3ad/"Required MIBs"> for its MIB requirements.
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar value from SNMP
|
||||
|
||||
=over
|
||||
|
||||
=item $vmware->vendor()
|
||||
|
||||
Returns C<'VMware'>.
|
||||
|
||||
=item $vmware->os()
|
||||
|
||||
Returns the value of C<vmwProdName.0>.
|
||||
|
||||
=item $vmware->os_ver()
|
||||
|
||||
Returns the software version specified as major-update.patch.build (ex. 5.1.0-3.55.2583090).
|
||||
|
||||
(C<vmwProdVersion>)-(C<vmwProdUpdate>).(C<vmwProdPatch>).(C<vmwProdBuild>)
|
||||
|
||||
|
||||
=back
|
||||
|
||||
=head2 Globals imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3> for details.
|
||||
|
||||
=head1 TABLE ENTRIES
|
||||
|
||||
These are methods that return tables of information in the form of a reference
|
||||
to a hash.
|
||||
|
||||
=over
|
||||
|
||||
=item C<agg_ports>
|
||||
|
||||
Returns a HASH reference mapping from slave to master port for each member of
|
||||
a port bundle on the device. Keys are ifIndex of the slave ports, Values are
|
||||
ifIndex of the corresponding master ports.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3> for details.
|
||||
|
||||
|
||||
=cut
|
||||
Reference in New Issue
Block a user