*** empty log message ***
This commit is contained in:
164
Info/Entity.pm
Normal file
164
Info/Entity.pm
Normal file
@@ -0,0 +1,164 @@
|
|||||||
|
# SNMP::Info::Entity
|
||||||
|
# Max Baker <max@warped.org>
|
||||||
|
#
|
||||||
|
# Copyright (c) 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::Entity;
|
||||||
|
$VERSION = 0.4;
|
||||||
|
# $Id$
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
use Exporter;
|
||||||
|
use SNMP::Info;
|
||||||
|
|
||||||
|
use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE $INIT/;
|
||||||
|
@SNMP::Info::Entity::ISA = qw/SNMP::Info Exporter/;
|
||||||
|
@SNMP::Info::Entity::EXPORT_OK = qw//;
|
||||||
|
|
||||||
|
=head1 NAME
|
||||||
|
|
||||||
|
SNMP::Info::Entity - Perl5 Interface to ENTITY-MIB
|
||||||
|
|
||||||
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
|
ENTITY-MIB is used by Layer 2 devices like HP Switches and Aironet Access Points
|
||||||
|
|
||||||
|
Inherits all methods from SNMP::Info
|
||||||
|
|
||||||
|
Use this module from another device subclass, not directly.
|
||||||
|
|
||||||
|
=head1 AUTHOR
|
||||||
|
|
||||||
|
Max Baker (C<max@warped.org>)
|
||||||
|
|
||||||
|
=head1 SYNOPSIS
|
||||||
|
|
||||||
|
See SNMP::Info
|
||||||
|
|
||||||
|
=cut
|
||||||
|
$INIT = 0;
|
||||||
|
%MIBS = ('ENTITY-MIB' => 'entPhysicalSerialNum');
|
||||||
|
|
||||||
|
%GLOBALS = (
|
||||||
|
);
|
||||||
|
|
||||||
|
%FUNCS = (
|
||||||
|
'e_class' => 'entPhysicalClass',
|
||||||
|
'e_descr' => 'entPhysicalDescr',
|
||||||
|
'e_fwver' => 'entPhysicalFirmwareRev',
|
||||||
|
'e_hwver' => 'entPhysicalHardwareRev',
|
||||||
|
'e_map' => 'entAliasMappingIdentifier',
|
||||||
|
'e_model' => 'entPhysicalModelName',
|
||||||
|
'e_name' => 'entPhysicalName',
|
||||||
|
'e_parent' => 'entPhysicalContainedIn',
|
||||||
|
'e_serial' => 'entPhysicalSerialNum',
|
||||||
|
'e_swver' => 'entPhysicalSoftwareRev',
|
||||||
|
'e_type' => 'entPhysicalVendorType',
|
||||||
|
);
|
||||||
|
|
||||||
|
%MUNGE = (
|
||||||
|
);
|
||||||
|
|
||||||
|
=head2 Entity Table
|
||||||
|
|
||||||
|
=over
|
||||||
|
|
||||||
|
=item $hp->e_class()
|
||||||
|
|
||||||
|
(C<entPhysicalClass>)
|
||||||
|
|
||||||
|
=item $hp->e_descr()
|
||||||
|
|
||||||
|
(C<entPhysicalClass>)
|
||||||
|
|
||||||
|
=item $hp->e_fwver()
|
||||||
|
|
||||||
|
(C<entPhysicalFirmwareRev>)
|
||||||
|
|
||||||
|
=item $hp->e_hwver()
|
||||||
|
|
||||||
|
(C<entPhysicalHardwareRev>)
|
||||||
|
|
||||||
|
=item $hp->e_map()
|
||||||
|
|
||||||
|
(C<entAliasMappingIdentifier>)
|
||||||
|
|
||||||
|
=item $hp->e_model()
|
||||||
|
|
||||||
|
(C<entPhysicalModelName>)
|
||||||
|
|
||||||
|
=item $hp->e_name()
|
||||||
|
|
||||||
|
(C<entPhysicalName>)
|
||||||
|
|
||||||
|
=item $hp->e_parent()
|
||||||
|
|
||||||
|
(C<entPhysicalContainedIn>)
|
||||||
|
|
||||||
|
=item $hp->e_port()
|
||||||
|
|
||||||
|
Maps EntityTable entries to the Interface Table (IfTable) using
|
||||||
|
$hp->e_map()
|
||||||
|
|
||||||
|
=cut
|
||||||
|
sub e_port {
|
||||||
|
my $entity = shift;
|
||||||
|
my $e_map = $entity->e_map();
|
||||||
|
|
||||||
|
my %e_port;
|
||||||
|
|
||||||
|
foreach my $e_id (keys %$e_map) {
|
||||||
|
my $id = $e_id;
|
||||||
|
$id =~ s/\.0$//;
|
||||||
|
|
||||||
|
my $iid = $e_map->{$e_id};
|
||||||
|
$iid =~ s/.*\.//;
|
||||||
|
|
||||||
|
$e_port{$id} = $iid;
|
||||||
|
}
|
||||||
|
|
||||||
|
return \%e_port;
|
||||||
|
}
|
||||||
|
|
||||||
|
=item $hp->e_serial()
|
||||||
|
|
||||||
|
(C<entPhysicalSerialNum>)
|
||||||
|
|
||||||
|
=item $hp->e_swver()
|
||||||
|
|
||||||
|
(C<entPhysicalSoftwareRev>)
|
||||||
|
|
||||||
|
=item $hp->e_type()
|
||||||
|
|
||||||
|
(C<entPhysicalVendorType>)
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
1;
|
||||||
150
Info/Layer2/Aironet.pm
Normal file
150
Info/Layer2/Aironet.pm
Normal file
@@ -0,0 +1,150 @@
|
|||||||
|
# SNMP::Info::Layer2::Aironet
|
||||||
|
# Max Baker <max@warped.org>
|
||||||
|
#
|
||||||
|
# Copyright (c) 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::Layer2::Aironet;
|
||||||
|
$VERSION = 0.4;
|
||||||
|
# $Id$
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
use Exporter;
|
||||||
|
use SNMP::Info::Layer2;
|
||||||
|
use SNMP::Info::Entity;
|
||||||
|
use SNMP::Info::EtherLike;
|
||||||
|
|
||||||
|
@SNMP::Info::Layer2::Aironet::ISA = qw/SNMP::Info::Layer2 SNMP::Info::Entity SNMP::Info::EtherLike Exporter/;
|
||||||
|
@SNMP::Info::Layer2::Aironet::EXPORT_OK = qw//;
|
||||||
|
|
||||||
|
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
|
||||||
|
|
||||||
|
# Set for No CDP
|
||||||
|
%GLOBALS = (
|
||||||
|
%SNMP::Info::Layer2::GLOBALS,
|
||||||
|
%SNMP::Info::Entity::GLOBALS,
|
||||||
|
%SNMP::Info::EtherLike::GLOBALS,
|
||||||
|
'serial' => 'entPhysicalSerialNum.1',
|
||||||
|
'descr' => 'sysDescr'
|
||||||
|
);
|
||||||
|
|
||||||
|
%FUNCS = (%SNMP::Info::Layer2::FUNCS,
|
||||||
|
%SNMP::Info::Entity::FUNCS,
|
||||||
|
%SNMP::Info::EtherLike::FUNCS
|
||||||
|
);
|
||||||
|
|
||||||
|
%MIBS = (
|
||||||
|
%SNMP::Info::Layer2::MIBS,
|
||||||
|
%SNMP::Info::Entity::MIBS,
|
||||||
|
%SNMP::Info::EtherLike::MIBS
|
||||||
|
);
|
||||||
|
|
||||||
|
%MUNGE = (%SNMP::Info::Layer2::MUNGE,
|
||||||
|
%SNMP::Info::Entity::MUNGE,
|
||||||
|
%SNMP::Info::EtherLike::MUNGE
|
||||||
|
);
|
||||||
|
|
||||||
|
sub vendor {
|
||||||
|
# Sorry, but it's true.
|
||||||
|
return 'cisco';
|
||||||
|
}
|
||||||
|
|
||||||
|
sub interfaces {
|
||||||
|
my $aironet = shift;
|
||||||
|
my $i_description = $aironet->i_description();
|
||||||
|
|
||||||
|
return $i_description;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Tag on e_descr.1
|
||||||
|
sub description {
|
||||||
|
my $aironet = shift;
|
||||||
|
my $descr = $aironet->descr();
|
||||||
|
my $e_descr = $aironet->e_descr();
|
||||||
|
|
||||||
|
$descr = "$e_descr->{1} $descr" if defined $e_descr->{1};
|
||||||
|
|
||||||
|
return $descr;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Fetch duplex from EtherLike
|
||||||
|
sub i_duplex {
|
||||||
|
my $aironet = shift;
|
||||||
|
my $el_duplex = $aironet->el_duplex();
|
||||||
|
|
||||||
|
my %i_duplex;
|
||||||
|
foreach my $d (keys %$el_duplex){
|
||||||
|
my $val = $el_duplex->{$d};
|
||||||
|
next unless defined $val;
|
||||||
|
$i_duplex{$d} = 'full' if $val =~ /full/i;
|
||||||
|
$i_duplex{$d} = 'half' if $val =~ /half/i;
|
||||||
|
}
|
||||||
|
|
||||||
|
return \%i_duplex;
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
|
__END__
|
||||||
|
|
||||||
|
=head1 NAME
|
||||||
|
|
||||||
|
SNMP::Info::Layer2::Aironet - SNMP Interface to Aironet devices.
|
||||||
|
|
||||||
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
|
Provides interface to SNMP Data available on an Aironet / Cisco devices.
|
||||||
|
|
||||||
|
=head1 AUTHOR
|
||||||
|
|
||||||
|
Max Baker (C<max@warped.org>)
|
||||||
|
|
||||||
|
=head1 SYNOPSIS
|
||||||
|
|
||||||
|
my $aironet = new SNMP::Info::Layer2::Aironet(DestHost => 'myaironet',
|
||||||
|
Community => 'public' );
|
||||||
|
|
||||||
|
See SNMP::Info for more information. See SNMP::Info::Layer2, SNMP::Info, SNMP::Info::Entity
|
||||||
|
for available methods in addition to the ones below.
|
||||||
|
|
||||||
|
=head1 GLOBALS
|
||||||
|
|
||||||
|
=over
|
||||||
|
|
||||||
|
=item $aironet->vendor()
|
||||||
|
|
||||||
|
Returns 'cisco' :)
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=head1 TABLE ENTRIES
|
||||||
|
|
||||||
|
=head2 Overrides
|
||||||
|
|
||||||
|
=over
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=cut
|
||||||
Reference in New Issue
Block a user