Regex cleanup for additional support of Avaya 8800 series in L3::Passport

This commit is contained in:
Eric A. Miller
2014-01-19 12:03:50 -05:00
parent 97ce41e363
commit 7240f034e5
2 changed files with 35 additions and 34 deletions

View File

@@ -12,6 +12,7 @@ version 3.11
* Use Q-BRIDGE-MIB as default with fallback to BRIDGE-MIB across all
classes for the fw_mac, fw_port, and fw_status methods
* Additional support for Avaya 8800 series in L3::Passport
[BUG FIXES]

View File

@@ -127,8 +127,8 @@ sub i_index {
# Get VLAN Virtual Router Interfaces
if (!defined $partial
|| (defined $model
&& ( ( $partial > 2000 && $model =~ /(86|83|81|16|VSP)/ )
|| ( $partial > 256 && $model =~ /(105|11[05]0|12[05])/ ) )
&& ( ( $partial > 2000 && $model =~ /^8[8631]|16|VSP/ )
|| ( $partial > 256 && $model =~ /^1[012][05]0/ ) )
)
)
{
@@ -145,7 +145,7 @@ sub i_index {
}
}
if ( defined $model and $model =~ /(86)/ ) {
if ( defined $model and $model =~ /^8[86]/ ) {
my $cpu_index = $passport->rc_cpu_ifindex($partial) || {};
my $virt_ip = $passport->rc_virt_ip();
@@ -183,8 +183,8 @@ sub interfaces {
if (!defined $partial
|| (defined $model
&& ( ( $partial > 2000 && $model =~ /(86|83|81|16|VSP)/ )
|| ( $partial > 256 && $model =~ /(105|11[05]0|12[05])/ ) )
&& ( ( $partial > 2000 && $model =~ /^8[8631]|16|VSP/ )
|| ( $partial > 256 && $model =~ /^1[012][05]0/ ) )
)
)
{
@@ -198,24 +198,24 @@ sub interfaces {
my $index = $i_index->{$iid};
next unless defined $index;
if ( ( $index == 1 ) and ( $model =~ /(86)/ ) ) {
if ( ( $index == 1 ) and ( $model =~ /^8[86]/ ) ) {
$if{$index} = 'Cpu.Virtual';
}
elsif ( ( $index == 192 ) and ( $model eq '8603' ) ) {
elsif ( ( $index == 192 ) and ( $model =~ /^8[86]03/ ) ) {
$if{$index} = 'Cpu.3';
}
elsif ( ( $index == 320 ) and ( $model =~ /(8606|8610|8610co)/ ) ) {
elsif ( ( $index == 320 ) and ( $model =~ /^8[86][10][06]/ ) ) {
$if{$index} = 'Cpu.5';
}
elsif ( ( $index == 384 ) and ( $model =~ /(8606|8610|8610co)/ ) ) {
elsif ( ( $index == 384 ) and ( $model =~ /^8[86][10][06]/ ) ) {
$if{$index} = 'Cpu.6';
}
elsif (( $index > 2000 and $model =~ /(86|83|81|16|VSP)/ )
or ( $index > 256 and $model =~ /(105|11[05]0|12[05])/ ) )
elsif (( $index > 2000 and $model =~ /^8[8631]|16|VSP/ )
or ( $index > 256 and $model =~ /^1[012][05]0/ ) )
{
my $v_index = $reverse_vlan{$iid};
@@ -256,8 +256,8 @@ sub i_mac {
# Get VLAN Virtual Router Interfaces
if (!defined $partial
|| (defined $model
&& ( ( $partial > 2000 && $model =~ /(86|83|81|16|VSP)/ )
|| ( $partial > 256 && $model =~ /(105|11[05]0|12[05])/ ) )
&& ( ( $partial > 2000 && $model =~ /^8[8631]|16|VSP/ )
|| ( $partial > 256 && $model =~ /^1[012][05]0/ ) )
)
)
{
@@ -276,7 +276,7 @@ sub i_mac {
}
}
if ( defined $model and $model =~ /(86)/ ) {
if ( defined $model and $model =~ /^8[86]/ ) {
my $cpu_mac = $passport->rc_cpu_mac($partial) || {};
my $virt_ip = $passport->rc_virt_ip() || '0.0.0.0';
@@ -330,8 +330,8 @@ sub i_description {
# Get VLAN Virtual Router Interfaces
if (!defined $partial
|| (defined $model
&& ( ( $partial > 2000 && $model =~ /(86|83|81|16|VSP)/ )
|| ( $partial > 256 && $model =~ /(105|11[05]0|12[05])/ ) )
&& ( ( $partial > 2000 && $model =~ /^8[8631]|16|VSP/ )
|| ( $partial > 256 && $model =~ /^1[012][05]0/ ) )
)
)
{
@@ -366,8 +366,8 @@ sub i_name {
if (!defined $partial
|| (defined $model
&& ( ( $partial > 2000 && $model =~ /(86|83|81|16|VSP)/ )
|| ( $partial > 256 && $model =~ /(105|11[05]0|12[05])/ ) )
&& ( ( $partial > 2000 && $model =~ /^8[8631]|16|VSP/ )
|| ( $partial > 256 && $model =~ /^1[012][05]0/ ) )
)
)
{
@@ -379,27 +379,27 @@ sub i_name {
my %i_name;
foreach my $iid ( keys %$i_index ) {
if ( ( $iid == 1 ) and ( $model =~ /(86)/ ) ) {
if ( ( $iid == 1 ) and ( $model =~ /^8[86]/ ) ) {
$i_name{$iid} = 'CPU Virtual Management IP';
}
elsif ( ( $iid == 192 ) and ( $model eq '8603' ) ) {
elsif ( ( $iid == 192 ) and ( $model =~ /^8[86]03/ ) ) {
$i_name{$iid} = 'CPU 3 Ethernet Port';
}
elsif ( ( $iid == 320 ) and ( $model =~ /(8606|8610|8610co)/ ) ) {
elsif ( ( $iid == 320 ) and ( $model =~ /^8[86][10][06]/ ) ) {
$i_name{$iid} = 'CPU 5 Ethernet Port';
}
elsif ( ( $iid == 384 ) and ( $model =~ /(8606|8610|8610co)/ ) ) {
elsif ( ( $iid == 384 ) and ( $model =~ /^8[86][10][06]/ ) ) {
$i_name{$iid} = 'CPU 6 Ethernet Port';
}
elsif (
( $iid > 2000 and defined $model and $model =~ /(86|83|81|16)/ )
( $iid > 2000 and defined $model and $model =~ /^8[8631]|16|VSP/ )
or ( $iid > 256
and defined $model
and $model =~ /(105|11[05]0|12[05])/ )
and $model =~ /^1[012][05]0/ )
)
{
my $vlan_idx = $reverse_vlan{$iid};
@@ -438,7 +438,7 @@ sub ip_index {
}
# Only 8600 has CPU and Virtual Management IP
if ( defined $model and $model =~ /(86)/ ) {
if ( defined $model and $model =~ /^8[86]/ ) {
my $cpu_ip = $passport->rc_cpu_ip($partial) || {};
my $virt_ip = $passport->rc_virt_ip($partial);
@@ -474,7 +474,7 @@ sub ip_netmask {
}
# Only 8600 has CPU and Virtual Management IP
if ( defined $model and $model =~ /(86)/ ) {
if ( defined $model and $model =~ /^8[86]/ ) {
my $cpu_ip = $passport->rc_cpu_ip($partial) || {};
my $cpu_mask = $passport->rc_cpu_mask($partial) || {};
@@ -510,7 +510,7 @@ sub root_ip {
my $sonmp_topo_ip = $passport->sonmp_topo_ip();
# Only 8600 and 1600 have CLIP or Management Virtual IP
if ( defined $model and $model =~ /(86|16|VSP)/ ) {
if ( defined $model and $model =~ /^8[86]|16|VSP/ ) {
# Return CLIP (CircuitLess IP)
foreach my $iid ( keys %$rc_ip_type ) {
@@ -560,7 +560,7 @@ sub index_factor {
# Older Accelar models use base 16 instead of 64
$index_factor = 16
if ( defined $model and $model =~ /(105|11[05]0|12[05])/ );
if ( defined $model and $model =~ /^1[012][05]0/ );
return $index_factor;
}
@@ -627,7 +627,7 @@ sub e_index {
}
# Older Accelars use RAPID-CITY::rcCardTable
if ( defined $model and $model =~ /(105|11[05]0|12[05])/ ) {
if ( defined $model and $model =~ /^1[012][05]0/ ) {
my $rc_c_t = $passport->rc_c_type() || {};
foreach my $idx ( keys %$rc_c_t ) {
next unless $idx;
@@ -715,7 +715,7 @@ sub e_descr {
}
# Older Accelars use RAPID-CITY::rcCardTable
if ( defined $model and $model =~ /(105|11[05]0|12[05])/ ) {
if ( defined $model and $model =~ /^1[012][05]0/ ) {
my $rc_c_t = $passport->rc_c_type() || {};
foreach my $idx ( keys %$rc_c_t ) {
next unless $idx;
@@ -783,7 +783,7 @@ sub e_type {
}
# Older Accelars use RAPID-CITY::rcCardTable
if ( defined $model and $model =~ /(105|11[05]0|12[05])/ ) {
if ( defined $model and $model =~ /^1[012][05]0/ ) {
my $rc_c_t = $passport->rc_c_type() || {};
foreach my $idx ( keys %$rc_c_t ) {
next unless $idx;
@@ -856,7 +856,7 @@ sub e_name {
$rc_e_name{$iid} = "Card $slot, MDA $mod";
}
elsif ( defined $model
and $model =~ /(105|11[05]0|12[05])/
and $model =~ /^1[012][05]0/
and $iid =~ /1$/ )
{
$rc_e_name{$iid} = "Card $slot";
@@ -892,7 +892,7 @@ sub e_hwver {
}
# Older Accelars use RAPID-CITY::rcCardTable
if ( defined $model and $model =~ /(105|11[05]0|12[05])/ ) {
if ( defined $model and $model =~ /^1[012][05]0/ ) {
my $rc_c_t = $passport->rc_c_rev() || {};
foreach my $idx ( keys %$rc_c_t ) {
next unless $idx;
@@ -967,7 +967,7 @@ sub e_serial {
}
# Older Accelars use RAPID-CITY::rcCardTable
if ( defined $model and $model =~ /(105|11[05]0|12[05])/ ) {
if ( defined $model and $model =~ /^1[012][05]0/ ) {
my $rc_c_t = $passport->rc_c_serial() || {};
foreach my $idx ( keys %$rc_c_t ) {
next unless $idx;