From 97564f50b8adf212e83a4ac541f680168d653271 Mon Sep 17 00:00:00 2001 From: "Eric A. Miller" Date: Sat, 1 Nov 2014 20:18:58 -0400 Subject: [PATCH] New method qb_fdb_index() for VLAN ID to FDB ID mapping. --- Info/Bridge.pm | 30 +++++++++++++++++++++++++----- Info/Layer3/Enterasys.pm | 35 +++++++++++++++++------------------ 2 files changed, 42 insertions(+), 23 deletions(-) diff --git a/Info/Bridge.pm b/Info/Bridge.pm index 746651ef..a720b6d8 100644 --- a/Info/Bridge.pm +++ b/Info/Bridge.pm @@ -99,7 +99,6 @@ $VERSION = '3.20'; 'qb_i_vlan_in_flt' => 'dot1qPortIngressFiltering', # Q-BRIDGE-MIB : dot1qVlanCurrentTable - 'qb_cv_fdb_id' => 'dot1qVlanFdbId', 'qb_cv_egress' => 'dot1qVlanCurrentEgressPorts', 'qb_cv_untagged' => 'dot1qVlanCurrentUntaggedPorts', 'qb_cv_stat' => 'dot1qVlanStatus', @@ -165,10 +164,8 @@ sub qb_fw_vlan { my $partial = shift; my $qb_fw_port = $bridge->qb_fw_port($partial); - # Some devices may not implement TimeFilter in a standard manner - # appearing to loop on this request. Override in the device class, - # see Enterasys for example. - my $qb_fdb_ids = $bridge->qb_cv_fdb_id() || {}; + my $qb_fdb_ids = $bridge->qb_fdb_index() || {}; + my $qb_fw_vlan = {}; foreach my $idx ( keys %$qb_fw_port ) { @@ -202,6 +199,25 @@ sub qb_i_vlan_t { return $i_vlan; } +sub qb_fdb_index { + my $bridge = shift; + my $partial = shift; + + # Some devices may not implement TimeFilter in a standard manner + # appearing to loop on this request. Override in the device class, + # see Enterasys for example. + my $qb_fdb_ids = $bridge->dot1qVlanFdbId() || {}; + + # Strip the TimeFilter + my $vl_fdb_index = {}; + for my $orig (keys(%$qb_fdb_ids)) { + (my $new = $orig) =~ s/^\d+\.//; + $vl_fdb_index->{$new} = $qb_fdb_ids->{$orig}; + } + + return $vl_fdb_index; +} + # Most devices now support Q-BRIDGE-MIB, fall back to # BRIDGE-MIB for those that don't. sub fw_mac { @@ -684,6 +700,10 @@ the port. Returns reference to hash: key = C, value = either 'trunk' for tagged ports or the VLAN ID. +=item $bridge->qb_fdb_index() + +Returns reference to hash: key = VLAN ID, value = FDB ID. + =item $bridge->v_index() Returns VLAN IDs diff --git a/Info/Layer3/Enterasys.pm b/Info/Layer3/Enterasys.pm index e8650cec..32e02b11 100644 --- a/Info/Layer3/Enterasys.pm +++ b/Info/Layer3/Enterasys.pm @@ -156,26 +156,19 @@ sub i_duplex_admin { # which means no time filter for tables with and index containing a # TimeFilter -sub qb_fw_vlan { +sub qb_fdb_index { my $bridge = shift; - my $partial = shift; - my $qb_fw_port = $bridge->qb_fw_port($partial); - # dot1qVlanCurrentTable TimeFilter index - my $qb_fdb_ids = $bridge->qb_cv_fdb_id(0) || {}; + my $qb_fdb_ids = $bridge->dot1qVlanFdbId(0) || {}; - my $qb_fw_vlan = {}; - foreach my $idx ( keys %$qb_fw_port ) { - my ( $fdb_id, $mac ) = _qb_fdbtable_index($idx); - # Many devices do not populate the dot1qVlanCurrentTable, so default - # to FDB ID = VID, but if we have a mapping use it. - my $vlan = $fdb_id; - if ($qb_fdb_ids->{$fdb_id}) { - $vlan = $qb_fdb_ids->{$fdb_id}; - } - $qb_fw_vlan->{$idx} = $vlan; + # Strip the TimeFilter + my $vl_fdb_index = {}; + for my $orig (keys(%$qb_fdb_ids)) { + (my $new = $orig) =~ s/^\d+\.//; + $vl_fdb_index->{$new} = $qb_fdb_ids->{$orig}; } - return $qb_fw_vlan; + + return $vl_fdb_index; } sub i_vlan_membership { @@ -402,9 +395,9 @@ L. =back -=head2 Link Layer Discovery Protocol (LLDP) Overrides +=head2 Time Filter Table Index Overrides -The LLDP table time filter implementation continuously increments when +The time filter C 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 @@ -412,6 +405,12 @@ 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()