Increase capture of i_vlan on router interfaces in L3::Cisco

Make sure cisco_comm_indexing() has a return value of either 1 or 0 in L3::Cisco
Add Layer3::Cisco test class
This commit is contained in:
Eric A. Miller
2018-04-11 20:41:14 -04:00
parent 81c7203642
commit a38eafbf56
2 changed files with 109 additions and 2 deletions

View File

@@ -128,9 +128,14 @@ sub i_vlan {
if ( $i_type->{$idx} eq 'l2vlan'
|| $i_type->{$idx} eq '135' && !defined $i_vlan->{$idx} )
{
# Not sure where this regex came from, anchored at end?
if ( $i_descr->{$idx} =~ /\.(\d+)$/ ) {
$i_vlan->{$idx} = $1;
}
# This matches 101 in 'Ethernet0.101-802.1Q vLAN subif'
elsif ( $i_descr->{$idx} =~ /\.(\d+)-/ ) {
$i_vlan->{$idx} = $1;
}
}
}
return $i_vlan;
@@ -138,9 +143,10 @@ sub i_vlan {
sub cisco_comm_indexing {
my $cisco = shift;
# If we get a VTP version, it's *extremely* likely that the device needs community based indexing
# If we get a VTP version, it's *extremely* likely that the device needs
# community based indexing
my $vtp = $cisco->vtp_version() || '0';
return ($vtp ne '0');
return $vtp ? 1 : 0;
}
1;