Use Q-BRIDGE-MIB as default with fallback to BRIDGE-MIB across all classes for the fw_mac, fw_port, and fw_status methods
This commit is contained in:
@@ -2,6 +2,11 @@ SNMP::Info - Friendly OO-style interface to Network devices using SNMP.
|
||||
|
||||
version 3.11
|
||||
|
||||
[ENHANCEMENTS]
|
||||
|
||||
* Use Q-BRIDGE-MIB as default with fallback to BRIDGE-MIB across all
|
||||
classes for the fw_mac, fw_port, and fw_status methods
|
||||
|
||||
[BUG FIXES]
|
||||
|
||||
* Modify cdp_cap() to handle devices which return space delimited strings
|
||||
|
||||
@@ -189,6 +189,35 @@ sub qb_i_vlan_t {
|
||||
return $i_vlan;
|
||||
}
|
||||
|
||||
# Most devices now support Q-BRIDGE-MIB, fall back to
|
||||
# BRIDGE-MIB for those that don't.
|
||||
sub fw_mac {
|
||||
my $bridge = shift;
|
||||
|
||||
my $qb = $bridge->qb_fw_mac();
|
||||
return $qb if (ref {} eq ref $qb and scalar keys %$qb);
|
||||
|
||||
return $bridge->SUPER::fw_mac();
|
||||
}
|
||||
|
||||
sub fw_port {
|
||||
my $bridge = shift;
|
||||
|
||||
my $qb = $bridge->qb_fw_port();
|
||||
return $qb if (ref {} eq ref $qb and scalar keys %$qb);
|
||||
|
||||
return $bridge->SUPER::fw_port();
|
||||
}
|
||||
|
||||
sub fw_status {
|
||||
my $bridge = shift;
|
||||
|
||||
my $qb = $bridge->qb_fw_status();
|
||||
return $qb if (ref {} eq ref $qb and scalar keys %$qb);
|
||||
|
||||
return $bridge->SUPER::fw_status();
|
||||
}
|
||||
|
||||
sub i_stp_state {
|
||||
my $bridge = shift;
|
||||
my $partial = shift;
|
||||
|
||||
@@ -140,25 +140,6 @@ sub interfaces {
|
||||
return $interfaces;
|
||||
}
|
||||
|
||||
|
||||
# This is model-dependent. Some netgear brand devices don't implement
|
||||
# the bridge MIB forwarding table, so we use the Q-BRIDGE-MIB forwarding
|
||||
# table. Fall back to the orig functions if the qb versions don't
|
||||
# return anything.
|
||||
sub fw_mac {
|
||||
my $netgear = shift;
|
||||
my $ret = $netgear->qb_fw_mac();
|
||||
$ret = $netgear->orig_fw_mac() if ( !defined($ret) );
|
||||
return $ret;
|
||||
}
|
||||
|
||||
sub fw_port {
|
||||
my $netgear = shift;
|
||||
my $ret = $netgear->qb_fw_port();
|
||||
$ret = $netgear->orig_fw_port() if ( !defined($ret) );
|
||||
return $ret;
|
||||
}
|
||||
|
||||
# these seem to work for GSM models but not GS
|
||||
# https://sourceforge.net/tracker/?func=detail&aid=3085413&group_id=70362&atid=527529
|
||||
sub os_ver {
|
||||
@@ -299,7 +280,6 @@ sub c_platform {
|
||||
return \%c_platform;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
@@ -413,23 +393,6 @@ a reference to a hash.
|
||||
|
||||
=over
|
||||
|
||||
=item $netgear->fw_mac()
|
||||
|
||||
Returns reference to hash of forwarding table MAC Addresses.
|
||||
|
||||
Some devices don't implement the C<BRIDGE-MIB> forwarding table, so we use
|
||||
the C<Q-BRIDGE-MIB> forwarding table. Fall back to the C<BRIDGE-MIB> if
|
||||
C<Q-BRIDGE-MIB> doesn't return anything.
|
||||
|
||||
=item $netgear->fw_port()
|
||||
|
||||
Returns reference to hash of forwarding table entries port interface
|
||||
identifier (iid)
|
||||
|
||||
Some devices don't implement the C<BRIDGE-MIB> forwarding table, so we use
|
||||
the C<Q-BRIDGE-MIB> forwarding table. Fall back to the C<BRIDGE-MIB> if
|
||||
C<Q-BRIDGE-MIB> doesn't return anything.
|
||||
|
||||
=item $netgear->interfaces()
|
||||
|
||||
Uses the i_name() field.
|
||||
|
||||
@@ -198,21 +198,6 @@ sub interfaces {
|
||||
return $alu->orig_i_name($partial);
|
||||
}
|
||||
|
||||
# Use Q-BRIDGE-MIB
|
||||
sub fw_mac {
|
||||
my $alu = shift;
|
||||
my $partial = shift;
|
||||
|
||||
return $alu->qb_fw_mac($partial);
|
||||
}
|
||||
|
||||
sub fw_port {
|
||||
my $alu = shift;
|
||||
my $partial = shift;
|
||||
|
||||
return $alu->qb_fw_port($partial);
|
||||
}
|
||||
|
||||
# Work around buggy bp_index in 6.3.1.871.R01 and 6.3.1.975.R01
|
||||
sub bp_index {
|
||||
my $alu = shift;
|
||||
@@ -445,14 +430,6 @@ to a hash.
|
||||
Returns interface name from C<ifName>, since the default return value
|
||||
of C<ifDescr> includes the OS version.
|
||||
|
||||
=item $alu->fw_mac()
|
||||
|
||||
Use the F<Q-BRIDGE-MIB> instead of F<BRIDGE-MIB>
|
||||
|
||||
=item $alu->fw_port()
|
||||
|
||||
Use the F<Q-BRIDGE-MIB> instead of F<BRIDGE-MIB>
|
||||
|
||||
=item $alu->bp_index()
|
||||
|
||||
Work around various bugs in the F<BRIDGE-MIB> and
|
||||
|
||||
@@ -104,22 +104,6 @@ sub model {
|
||||
return $model;
|
||||
}
|
||||
|
||||
# Use Q-BRIDGE-MIB
|
||||
|
||||
sub fw_mac {
|
||||
my $arista = shift;
|
||||
my $partial = shift;
|
||||
|
||||
return $arista->qb_fw_mac($partial);
|
||||
}
|
||||
|
||||
sub fw_port {
|
||||
my $arista = shift;
|
||||
my $partial = shift;
|
||||
|
||||
return $arista->qb_fw_port($partial);
|
||||
}
|
||||
|
||||
# The LLDP MIB leaves it up in the air what the index means.
|
||||
# On EOS, it's a dot1d port.
|
||||
sub lldp_if {
|
||||
@@ -245,14 +229,6 @@ to a hash.
|
||||
|
||||
=over
|
||||
|
||||
=item $arista->fw_mac()
|
||||
|
||||
Use the F<Q-BRIDGE-MIB> instead of F<BRIDGE-MIB>
|
||||
|
||||
=item $arista->fw_port()
|
||||
|
||||
Use the F<Q-BRIDGE-MIB> instead of F<BRIDGE-MIB>
|
||||
|
||||
=item $arista->i_duplex_admin()
|
||||
|
||||
Returns info from F<MAU-MIB>
|
||||
|
||||
@@ -193,25 +193,6 @@ sub i_duplex_admin {
|
||||
return \%i_duplex_admin;
|
||||
}
|
||||
|
||||
# Use same methods as netgear. Some device didn't implement the bridge MIB
|
||||
# forwarding table and some don't return MACs for VLANs other than default yet
|
||||
# don't support community indexing, so we use the Q-BRIDGE-MIB forwarding
|
||||
# table. Fall back to the orig functions if the qb versions don't
|
||||
# return anything.
|
||||
sub fw_mac {
|
||||
my $dell = shift;
|
||||
my $ret = $dell->qb_fw_mac();
|
||||
$ret = $dell->orig_fw_mac() if ( !defined($ret) );
|
||||
return $ret;
|
||||
}
|
||||
|
||||
sub fw_port {
|
||||
my $dell = shift;
|
||||
my $ret = $dell->qb_fw_port();
|
||||
$ret = $dell->orig_fw_port() if ( !defined($ret) );
|
||||
return $ret;
|
||||
}
|
||||
|
||||
sub _vendor {
|
||||
my $dell = shift;
|
||||
|
||||
@@ -406,23 +387,6 @@ sometimes not unique.
|
||||
Returns reference to hash of iid to current link administrative duplex
|
||||
setting.
|
||||
|
||||
=item $dell->fw_mac()
|
||||
|
||||
Returns reference to hash of forwarding table MAC Addresses.
|
||||
|
||||
Some devices don't implement the C<BRIDGE-MIB> forwarding table, so we use
|
||||
the C<Q-BRIDGE-MIB> forwarding table. Fall back to the C<BRIDGE-MIB> if
|
||||
C<Q-BRIDGE-MIB> doesn't return anything.
|
||||
|
||||
=item $dell->fw_port()
|
||||
|
||||
Returns reference to hash of forwarding table entries port interface
|
||||
identifier (iid)
|
||||
|
||||
Some devices don't implement the C<BRIDGE-MIB> forwarding table, so we use
|
||||
the C<Q-BRIDGE-MIB> forwarding table. Fall back to the C<BRIDGE-MIB> if
|
||||
C<Q-BRIDGE-MIB> doesn't return anything.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer3
|
||||
|
||||
@@ -149,22 +149,6 @@ sub i_duplex_admin {
|
||||
return $enterasys->mau_i_duplex_admin($partial);
|
||||
}
|
||||
|
||||
# Normal BRIDGE-MIB has issues on some devices, duplicates and
|
||||
# non-increasing oids, Use Q-BRIDGE-MIB for macsuck
|
||||
sub fw_mac {
|
||||
my $enterasys = shift;
|
||||
my $partial = shift;
|
||||
|
||||
return $enterasys->qb_fw_mac($partial);
|
||||
}
|
||||
|
||||
sub fw_port {
|
||||
my $enterasys = shift;
|
||||
my $partial = shift;
|
||||
|
||||
return $enterasys->qb_fw_port($partial);
|
||||
}
|
||||
|
||||
# LLDP table 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,
|
||||
@@ -373,17 +357,6 @@ See documentation for mau_i_duplex() in L<SNMP::Info::MAU/"TABLE METHODS">.
|
||||
See documentation for mau_i_duplex_admin() in
|
||||
L<SNMP::Info::MAU/"TABLE METHODS">.
|
||||
|
||||
=item $enterasys->fw_mac()
|
||||
|
||||
Returns reference to hash of forwarding table MAC Addresses.
|
||||
|
||||
=item $enterasys->fw_port()
|
||||
|
||||
Returns reference to hash of forwarding table entries port interface
|
||||
identifier (iid).
|
||||
|
||||
(C<dot1qTpFdbPort>)
|
||||
|
||||
=back
|
||||
|
||||
=head2 Link Layer Discovery Protocol (LLDP) Overrides
|
||||
|
||||
@@ -290,9 +290,6 @@ sub fw_mac {
|
||||
my $b = $extreme->SUPER::fw_mac();
|
||||
return $b if (keys %$b);
|
||||
|
||||
my $qb = $extreme->qb_fw_mac();
|
||||
return $qb if (keys %$qb);
|
||||
|
||||
return $extreme->ex_fw_mac();
|
||||
}
|
||||
|
||||
@@ -301,9 +298,6 @@ sub fw_port {
|
||||
|
||||
my $b = $extreme->SUPER::fw_port();
|
||||
return $b if (keys %$b);
|
||||
|
||||
my $qb = $extreme->qb_fw_port();
|
||||
return $qb if (keys %$qb);
|
||||
|
||||
return $extreme->ex_fw_port();
|
||||
}
|
||||
@@ -314,9 +308,6 @@ sub fw_status {
|
||||
my $b = $extreme->SUPER::fw_status();
|
||||
return $b if (keys %$b);
|
||||
|
||||
my $qb = $extreme->qb_fw_status();
|
||||
return $qb if (keys %$qb);
|
||||
|
||||
return $extreme->ex_fw_status();
|
||||
}
|
||||
|
||||
|
||||
@@ -104,22 +104,6 @@ sub model {
|
||||
return $model;
|
||||
}
|
||||
|
||||
# Use Q-BRIDGE-MIB
|
||||
|
||||
sub fw_mac {
|
||||
my $force10 = shift;
|
||||
my $partial = shift;
|
||||
|
||||
return $force10->qb_fw_mac($partial);
|
||||
}
|
||||
|
||||
sub fw_port {
|
||||
my $force10 = shift;
|
||||
my $partial = shift;
|
||||
|
||||
return $force10->qb_fw_port($partial);
|
||||
}
|
||||
|
||||
sub v_name {
|
||||
my $force10 = shift;
|
||||
my $partial = shift;
|
||||
@@ -300,14 +284,6 @@ 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.
|
||||
|
||||
=item $force10->fw_mac()
|
||||
|
||||
Use the F<Q-BRIDGE-MIB> instead of F<BRIDGE-MIB>
|
||||
|
||||
=item $force10->fw_port()
|
||||
|
||||
Use the F<Q-BRIDGE-MIB> instead of F<BRIDGE-MIB>
|
||||
|
||||
=item $force10->i_duplex_admin()
|
||||
|
||||
Returns info from F<MAU-MIB>
|
||||
|
||||
@@ -113,22 +113,6 @@ sub i_ignore {
|
||||
return \%i_ignore;
|
||||
}
|
||||
|
||||
# Use Q-BRIDGE-MIB
|
||||
|
||||
sub fw_mac {
|
||||
my $l3 = shift;
|
||||
my $partial = shift;
|
||||
|
||||
return $l3->qb_fw_mac($partial);
|
||||
}
|
||||
|
||||
sub fw_port {
|
||||
my $l3 = shift;
|
||||
my $partial = shift;
|
||||
|
||||
return $l3->qb_fw_port($partial);
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
@@ -235,14 +219,6 @@ Returns reference to hash. Increments value of IID if port is to be ignored.
|
||||
|
||||
Ignores loopback
|
||||
|
||||
=item $h3c->fw_mac()
|
||||
|
||||
Use the F<Q-BRIDGE-MIB> instead of F<BRIDGE-MIB>
|
||||
|
||||
=item $h3c->fw_port()
|
||||
|
||||
Use the F<Q-BRIDGE-MIB> instead of F<BRIDGE-MIB>
|
||||
|
||||
=back
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer3
|
||||
|
||||
@@ -234,21 +234,6 @@ sub i_vlan_membership {
|
||||
return $i_vlan_membership;
|
||||
}
|
||||
|
||||
# Use Q-BRIDGE-MIB for bridge forwarding tables
|
||||
sub fw_mac {
|
||||
my $juniper = shift;
|
||||
my $partial = shift;
|
||||
|
||||
return $juniper->qb_fw_mac($partial);
|
||||
}
|
||||
|
||||
sub fw_port {
|
||||
my $juniper = shift;
|
||||
my $partial = shift;
|
||||
|
||||
return $juniper->qb_fw_port($partial);
|
||||
}
|
||||
|
||||
# Pseudo ENTITY-MIB methods
|
||||
|
||||
# This class supports both virtual chassis (stackable) and physical chassis
|
||||
@@ -678,25 +663,6 @@ IDs. These are the VLANs which are members of the egress list for the port.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Forwarding Table (C<dot1dTpFdbEntry>)
|
||||
|
||||
=over
|
||||
|
||||
=item $juniper->fw_mac()
|
||||
|
||||
Returns reference to hash of forwarding table MAC Addresses
|
||||
|
||||
(C<dot1dTpFdbAddress>)
|
||||
|
||||
=item $juniper->fw_port()
|
||||
|
||||
Returns reference to hash of forwarding table entries port interface
|
||||
identifier (iid)
|
||||
|
||||
(C<dot1dTpFdbPort>)
|
||||
|
||||
=back
|
||||
|
||||
=head2 Pseudo F<ENTITY-MIB> information
|
||||
|
||||
These methods emulate F<ENTITY-MIB> Physical Table methods using
|
||||
|
||||
@@ -89,22 +89,6 @@ sub model {
|
||||
return;
|
||||
}
|
||||
|
||||
# Use Q-BRIDGE-MIB
|
||||
|
||||
sub fw_mac {
|
||||
my $l3 = shift;
|
||||
my $partial = shift;
|
||||
|
||||
return $l3->qb_fw_mac($partial);
|
||||
}
|
||||
|
||||
sub fw_port {
|
||||
my $l3 = shift;
|
||||
my $partial = shift;
|
||||
|
||||
return $l3->qb_fw_port($partial);
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
@@ -196,20 +180,6 @@ See documentation in L<SNMP::Info::LLDP> for details.
|
||||
These are methods that return tables of information in the form of a reference
|
||||
to a hash.
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=over
|
||||
|
||||
=item $pica8->fw_mac()
|
||||
|
||||
Use the F<Q-BRIDGE-MIB> instead of F<BRIDGE-MIB>
|
||||
|
||||
=item $pica8->fw_port()
|
||||
|
||||
Use the F<Q-BRIDGE-MIB> instead of F<BRIDGE-MIB>
|
||||
|
||||
=back
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer3
|
||||
|
||||
See documentation in L<SNMP::Info::Layer3> for details.
|
||||
|
||||
Reference in New Issue
Block a user