L3::Juniper now inherits i_vlan_membership() and i_vlan_membership_untagged() from Bridge and only overrides VLAN mapping

Correct VLAN mapping of FDB entries in L3::Juniper
This commit is contained in:
Eric A. Miller
2014-11-08 08:50:44 -05:00
parent 1bf62f9524
commit eb046b6a61

View File

@@ -163,6 +163,13 @@ sub i_trunk {
return \%i_trunk; return \%i_trunk;
} }
sub qb_fdb_index {
my $juniper = shift;
my $partial = shift;
return $juniper->jnxExVlanTag($partial);
}
# 'v_type' => 'jnxExVlanType', # 'v_type' => 'jnxExVlanType',
sub v_type { sub v_type {
my $juniper = shift; my $juniper = shift;
@@ -214,22 +221,24 @@ sub i_vlan {
return $i_vlan; return $i_vlan;
} }
sub i_vlan_membership { # Index doesn't use VLAN ID, so override the HOA private method here to
my $juniper = shift; # correct the mapping
my $partial = shift; sub _vlan_hoa {
my $juniper = shift;
my ( $v_ports, $partial ) = @_;
my $index = $juniper->bp_index(); my $index = $juniper->bp_index();
my ($v_index) = $juniper->jnxExVlanTag($partial); my $v_index = $juniper->jnxExVlanTag($partial);
my $v_ports = $juniper->qb_v_egress() || {}; my $vlan_hoa = {};
foreach my $idx ( keys %$v_ports ) {
my $i_vlan_membership = {};
foreach my $idx ( sort keys %$v_ports ) {
next unless ( defined $v_ports->{$idx} ); next unless ( defined $v_ports->{$idx} );
my $portlist = $v_ports->{$idx}; # is an array reference my $portlist = $v_ports->{$idx};
my $ret = []; my $ret = [];
my $vlan_ndx = $idx; my $vlan_ndx;
# Strip TimeFilter if we're using VlanCurrentTable
( $vlan_ndx = $idx ) =~ s/^\d+\.//;
# Convert portlist bit array to bp_index array # Convert portlist bit array to bp_index array
for ( my $i = 0; $i <= $#$portlist; $i++ ) { for ( my $i = 0; $i <= $#$portlist; $i++ ) {
@@ -241,11 +250,10 @@ sub i_vlan_membership {
my $ifindex = $index->{$port}; my $ifindex = $index->{$port};
next unless ( defined($ifindex) ); # shouldn't happen next unless ( defined($ifindex) ); # shouldn't happen
next if ( defined $partial and $ifindex !~ /^$partial$/ ); next if ( defined $partial and $ifindex !~ /^$partial$/ );
push ( @{ $i_vlan_membership->{$ifindex} }, $v_index->{$vlan_ndx} ); push( @{ $vlan_hoa->{$ifindex} }, $v_index->{$vlan_ndx} );
} }
} }
return $vlan_hoa;
return $i_vlan_membership;
} }
# Pseudo ENTITY-MIB methods # Pseudo ENTITY-MIB methods
@@ -655,6 +663,10 @@ to a hash.
=over =over
=item $juniper->qb_fdb_index()
Returns reference to hash: key = VLAN ID, value = FDB ID.
=item $juniper->v_index() =item $juniper->v_index()
(C<jnxExVlanTag>) (C<jnxExVlanTag>)
@@ -675,11 +687,6 @@ to a hash.
Returns a mapping between C<ifIndex> and the PVID or default VLAN. Returns a mapping between C<ifIndex> and the PVID or default VLAN.
=item $juniper->i_vlan_membership()
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.
=back =back
=head2 Pseudo F<ENTITY-MIB> information =head2 Pseudo F<ENTITY-MIB> information