Adding LLDP support for Juniper and C3550 classes

This commit is contained in:
Carlos Vicente
2010-09-22 21:45:08 +00:00
parent ad1f1933e2
commit bdf5a80868
2 changed files with 298 additions and 10 deletions

View File

@@ -33,8 +33,9 @@ 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 Exporter/;
@SNMP::Info::Layer3::Juniper::ISA = qw/SNMP::Info::Layer3 SNMP::Info::LLDP Exporter/;
@SNMP::Info::Layer3::Juniper::EXPORT_OK = qw//;
use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %MUNGE/;
@@ -43,15 +44,22 @@ $VERSION = '2.01';
%MIBS = (
%SNMP::Info::Layer3::MIBS,
%SNMP::Info::LLDP::MIBS,
'JUNIPER-CHASSIS-DEFINES-MIB' => 'jnxChassisDefines',
'JUNIPER-MIB' => 'jnxBoxAnatomy',
);
%GLOBALS = ( %SNMP::Info::Layer3::GLOBALS, 'serial' => 'jnxBoxSerialNo.0', );
%GLOBALS = ( %SNMP::Info::Layer3::GLOBALS,
%SNMP::Info::LLDP::GLOBALS,
'serial' => 'jnxBoxSerialNo.0', );
%FUNCS = ( %SNMP::Info::Layer3::FUNCS, );
%FUNCS = ( %SNMP::Info::Layer3::FUNCS,
%SNMP::Info::LLDP::FUNCS,
);
%MUNGE = ( %SNMP::Info::Layer3::MUNGE, );
%MUNGE = ( %SNMP::Info::Layer3::MUNGE,
%SNMP::Info::LLDP::MUNGE,
);
sub vendor {
return 'juniper';
@@ -130,6 +138,50 @@ sub fw_port {
return $juniper->qb_fw_port($partial);
}
# Use LLDP
sub hasCDP {
my $juniper = shift;
return $juniper->hasLLDP();
}
sub c_ip {
my $juniper = shift;
my $partial = shift;
return $juniper->lldp_ip($partial);
}
sub c_if {
my $juniper = shift;
my $partial = shift;
return $juniper->lldp_if($partial);
}
sub c_port {
my $juniper = shift;
my $partial = shift;
return $juniper->lldp_port($partial);
}
sub c_id {
my $juniper = shift;
my $partial = shift;
return $juniper->lldp_id($partial);
}
sub c_platform {
my $juniper = shift;
my $partial = shift;
return $juniper->lldp_rem_sysdesc($partial);
}
1;
__END__
@@ -166,6 +218,8 @@ Subclass for Generic Juniper Routers running JUNOS
=item SNMP::Info::Layer3
=item SNMP::Info::LLDP
=back
=head2 Required MIBs
@@ -176,6 +230,8 @@ Subclass for Generic Juniper Routers running JUNOS
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
@@ -207,12 +263,20 @@ Returns serial number
(C<jnxBoxSerialNo.0>)
=item $juniper->hasCDP()
Returns whether LLDP is enabled.
=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
@@ -225,10 +289,34 @@ to a hash.
Returns the list of interfaces whose C<ifType> is l2vlan(135), and
the VLAN ID extracted from the interface description.
=item $juniper->c_id()
Returns LLDP information.
=item $juniper->c_if()
Returns LLDP information.
=item $juniper->c_ip()
Returns LLDP information.
=item $juniper->c_platform()
Returns LLDP information.
=item $juniper->c_port()
Returns LLDP information.
=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