diff --git a/ChangeLog b/ChangeLog index ba482d42..1e13b1dc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 diff --git a/Info/Bridge.pm b/Info/Bridge.pm index 3a8281a3..f8a868fb 100644 --- a/Info/Bridge.pm +++ b/Info/Bridge.pm @@ -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; diff --git a/Info/Layer2/Netgear.pm b/Info/Layer2/Netgear.pm index 0d2bbeb3..9d933534 100644 --- a/Info/Layer2/Netgear.pm +++ b/Info/Layer2/Netgear.pm @@ -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 forwarding table, so we use -the C forwarding table. Fall back to the C if -C 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 forwarding table, so we use -the C forwarding table. Fall back to the C if -C doesn't return anything. - =item $netgear->interfaces() Uses the i_name() field. diff --git a/Info/Layer3/AlcatelLucent.pm b/Info/Layer3/AlcatelLucent.pm index 81730d9e..2265f112 100644 --- a/Info/Layer3/AlcatelLucent.pm +++ b/Info/Layer3/AlcatelLucent.pm @@ -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, since the default return value of C includes the OS version. -=item $alu->fw_mac() - -Use the F instead of F - -=item $alu->fw_port() - -Use the F instead of F - =item $alu->bp_index() Work around various bugs in the F and diff --git a/Info/Layer3/Arista.pm b/Info/Layer3/Arista.pm index c1b4ad30..a8874abd 100644 --- a/Info/Layer3/Arista.pm +++ b/Info/Layer3/Arista.pm @@ -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 instead of F - -=item $arista->fw_port() - -Use the F instead of F - =item $arista->i_duplex_admin() Returns info from F diff --git a/Info/Layer3/Dell.pm b/Info/Layer3/Dell.pm index 8306a02f..f41f64f3 100644 --- a/Info/Layer3/Dell.pm +++ b/Info/Layer3/Dell.pm @@ -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 forwarding table, so we use -the C forwarding table. Fall back to the C if -C 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 forwarding table, so we use -the C forwarding table. Fall back to the C if -C doesn't return anything. - =back =head2 Table Methods imported from SNMP::Info::Layer3 diff --git a/Info/Layer3/Enterasys.pm b/Info/Layer3/Enterasys.pm index 01ace77d..41608c44 100644 --- a/Info/Layer3/Enterasys.pm +++ b/Info/Layer3/Enterasys.pm @@ -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. See documentation for mau_i_duplex_admin() in L. -=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) - =back =head2 Link Layer Discovery Protocol (LLDP) Overrides diff --git a/Info/Layer3/Extreme.pm b/Info/Layer3/Extreme.pm index 2793e39a..3ec981ed 100644 --- a/Info/Layer3/Extreme.pm +++ b/Info/Layer3/Extreme.pm @@ -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(); } diff --git a/Info/Layer3/Force10.pm b/Info/Layer3/Force10.pm index 784fbdbe..ed1eb513 100644 --- a/Info/Layer3/Force10.pm +++ b/Info/Layer3/Force10.pm @@ -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, 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 instead of F - -=item $force10->fw_port() - -Use the F instead of F - =item $force10->i_duplex_admin() Returns info from F diff --git a/Info/Layer3/H3C.pm b/Info/Layer3/H3C.pm index 03ad4183..63e12bff 100644 --- a/Info/Layer3/H3C.pm +++ b/Info/Layer3/H3C.pm @@ -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 instead of F - -=item $h3c->fw_port() - -Use the F instead of F - =back =head2 Table Methods imported from SNMP::Info::Layer3 diff --git a/Info/Layer3/Juniper.pm b/Info/Layer3/Juniper.pm index 581e9eef..a4c25f7a 100644 --- a/Info/Layer3/Juniper.pm +++ b/Info/Layer3/Juniper.pm @@ -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) - -=over - -=item $juniper->fw_mac() - -Returns reference to hash of forwarding table MAC Addresses - -(C) - -=item $juniper->fw_port() - -Returns reference to hash of forwarding table entries port interface -identifier (iid) - -(C) - -=back - =head2 Pseudo F information These methods emulate F Physical Table methods using diff --git a/Info/Layer3/Pica8.pm b/Info/Layer3/Pica8.pm index eaf991df..ffe628e7 100644 --- a/Info/Layer3/Pica8.pm +++ b/Info/Layer3/Pica8.pm @@ -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 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 instead of F - -=item $pica8->fw_port() - -Use the F instead of F - -=back - =head2 Table Methods imported from SNMP::Info::Layer3 See documentation in L for details.