New method qb_fdb_index() for VLAN ID to FDB ID mapping.

This commit is contained in:
Eric A. Miller
2014-11-01 20:18:58 -04:00
parent efcf6a0db3
commit 97564f50b8
2 changed files with 42 additions and 23 deletions

View File

@@ -99,7 +99,6 @@ $VERSION = '3.20';
'qb_i_vlan_in_flt' => 'dot1qPortIngressFiltering', 'qb_i_vlan_in_flt' => 'dot1qPortIngressFiltering',
# Q-BRIDGE-MIB : dot1qVlanCurrentTable # Q-BRIDGE-MIB : dot1qVlanCurrentTable
'qb_cv_fdb_id' => 'dot1qVlanFdbId',
'qb_cv_egress' => 'dot1qVlanCurrentEgressPorts', 'qb_cv_egress' => 'dot1qVlanCurrentEgressPorts',
'qb_cv_untagged' => 'dot1qVlanCurrentUntaggedPorts', 'qb_cv_untagged' => 'dot1qVlanCurrentUntaggedPorts',
'qb_cv_stat' => 'dot1qVlanStatus', 'qb_cv_stat' => 'dot1qVlanStatus',
@@ -165,10 +164,8 @@ sub qb_fw_vlan {
my $partial = shift; my $partial = shift;
my $qb_fw_port = $bridge->qb_fw_port($partial); my $qb_fw_port = $bridge->qb_fw_port($partial);
# Some devices may not implement TimeFilter in a standard manner my $qb_fdb_ids = $bridge->qb_fdb_index() || {};
# 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_fw_vlan = {}; my $qb_fw_vlan = {};
foreach my $idx ( keys %$qb_fw_port ) { foreach my $idx ( keys %$qb_fw_port ) {
@@ -202,6 +199,25 @@ sub qb_i_vlan_t {
return $i_vlan; 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 # Most devices now support Q-BRIDGE-MIB, fall back to
# BRIDGE-MIB for those that don't. # BRIDGE-MIB for those that don't.
sub fw_mac { sub fw_mac {
@@ -684,6 +700,10 @@ the port.
Returns reference to hash: key = C<dot1dBasePort>, value = either 'trunk' for Returns reference to hash: key = C<dot1dBasePort>, value = either 'trunk' for
tagged ports or the VLAN ID. 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() =item $bridge->v_index()
Returns VLAN IDs Returns VLAN IDs

View File

@@ -156,26 +156,19 @@ sub i_duplex_admin {
# which means no time filter for tables with and index containing a # which means no time filter for tables with and index containing a
# TimeFilter # TimeFilter
sub qb_fw_vlan { sub qb_fdb_index {
my $bridge = shift; my $bridge = shift;
my $partial = shift;
my $qb_fw_port = $bridge->qb_fw_port($partial); my $qb_fdb_ids = $bridge->dot1qVlanFdbId(0) || {};
# dot1qVlanCurrentTable TimeFilter index
my $qb_fdb_ids = $bridge->qb_cv_fdb_id(0) || {};
my $qb_fw_vlan = {}; # Strip the TimeFilter
foreach my $idx ( keys %$qb_fw_port ) { my $vl_fdb_index = {};
my ( $fdb_id, $mac ) = _qb_fdbtable_index($idx); for my $orig (keys(%$qb_fdb_ids)) {
# Many devices do not populate the dot1qVlanCurrentTable, so default (my $new = $orig) =~ s/^\d+\.//;
# to FDB ID = VID, but if we have a mapping use it. $vl_fdb_index->{$new} = $qb_fdb_ids->{$orig};
my $vlan = $fdb_id;
if ($qb_fdb_ids->{$fdb_id}) {
$vlan = $qb_fdb_ids->{$fdb_id};
} }
$qb_fw_vlan->{$idx} = $vlan;
} return $vl_fdb_index;
return $qb_fw_vlan;
} }
sub i_vlan_membership { sub i_vlan_membership {
@@ -402,9 +395,9 @@ L<SNMP::Info::MAU/"TABLE METHODS">.
=back =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<TimeFilter> implementation continuously increments when
walked and we may never reach the end of the table. This behavior can be 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, modified with the C<"set snmp timefilter break disable"> command,
unfortunately it is not the default. These methods are overridden to 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 =over
=item $enterasys->qb_fdb_index()
=item $enterasys->i_vlan_membership()
=item $enterasys->i_vlan_membership_untagged()
=item $enterasys->lldp_if() =item $enterasys->lldp_if()
=item $enterasys->lldp_ip() =item $enterasys->lldp_ip()