add support for Accelar Layer 3

This commit is contained in:
Eric Miller
2005-04-07 04:03:17 +00:00
parent d314ffe897
commit 0ab5eb2bf1

View File

@@ -88,15 +88,19 @@ use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE/;
sub model { sub model {
my $passport = shift; my $passport = shift;
my $desc = $passport->description(); my $id = $passport->id();
return undef unless defined $desc;
return '8603' if ($desc =~ /8603/); unless (defined $id){
return '8606' if ($desc =~ /8606/); print " SNMP::Info::Layer3::Passport::model() - Device does not support sysObjectID\n" if $passport->debug();
return '8610co' if ($desc =~ /8610co/); return undef;
return '8610' if ($desc =~ /8610/); }
return $desc; my $model = &SNMP::translateObj($id);
return $id unless defined $model;
$model =~ s/^rcA//i;
return $model;
} }
sub vendor { sub vendor {
@@ -112,14 +116,21 @@ sub os_ver {
my $descr = $passport->description(); my $descr = $passport->description();
return undef unless defined $descr; return undef unless defined $descr;
#Passport
if ($descr =~ m/(\d+\.\d+\.\d+\.\d+)/){ if ($descr =~ m/(\d+\.\d+\.\d+\.\d+)/){
return $1; return $1;
} }
#Accelar
if ($descr =~ m/(\d+\.\d+\.\d+)/){
return $1;
}
return undef; return undef;
} }
sub i_index { sub i_index {
my $passport = shift; my $passport = shift;
my $model = $passport->model();
my $i_index = $passport->i_index2(); my $i_index = $passport->i_index2();
my $vlan_index = $passport->rc_vlan_if(); my $vlan_index = $passport->rc_vlan_if();
my $cpu_index = $passport->rc_cpu_ifindex(); my $cpu_index = $passport->rc_cpu_ifindex();
@@ -142,6 +153,8 @@ sub i_index {
$if_index{$v_index} = $v_index; $if_index{$v_index} = $v_index;
} }
if (defined $model and $model =~ /(86)/) {
# Get CPU Ethernet Interfaces # Get CPU Ethernet Interfaces
foreach my $cid (keys %$cpu_index){ foreach my $cid (keys %$cpu_index){
my $c_index = $cpu_index->{$cid}; my $c_index = $cpu_index->{$cid};
@@ -156,16 +169,19 @@ sub i_index {
# Make up an index number, 1 is not reserved AFAIK # Make up an index number, 1 is not reserved AFAIK
$if_index{1} = 1; $if_index{1} = 1;
} }
}
return \%if_index; return \%if_index;
} }
sub interfaces { sub interfaces {
my $passport = shift; my $passport = shift;
my $model = $passport->model();
my $index_factor = $passport->index_factor();
my $port_offset = $passport->port_offset();
my $i_index = $passport->i_index(); my $i_index = $passport->i_index();
my $vlan_id = $passport->rc_vlan_id(); my $vlan_id = $passport->rc_vlan_id();
my $vlan_index = $passport->rc_vlan_if(); my $vlan_index = $passport->rc_vlan_if();
my $model = $passport->model();
my %reverse_vlan = reverse %$vlan_index; my %reverse_vlan = reverse %$vlan_index;
@@ -174,7 +190,7 @@ sub interfaces {
my $index = $i_index->{$iid}; my $index = $i_index->{$iid};
next unless defined $index; next unless defined $index;
if ($index == 1) { if (($index == 1) and ($model =~ /(86)/)) {
$if{$index} = 'CPU.Virtual'; $if{$index} = 'CPU.Virtual';
} }
@@ -182,15 +198,16 @@ sub interfaces {
$if{$index} = 'Cpu3'; $if{$index} = 'Cpu3';
} }
elsif ($index == 320) { elsif (($index == 320) and ($model =~ /(8606|8610|8610co)/)) {
$if{$index} = 'Cpu5'; $if{$index} = 'Cpu5';
} }
elsif ($index == 384) { elsif (($index == 384) and ($model =~ /(8606|8610|8610co)/)) {
$if{$index} = 'Cpu6'; $if{$index} = 'Cpu6';
} }
elsif ($index > 2000) { elsif (($index > 2000 and $model =~ /(86)/) or
($index > 256 and $model =~ /(105|11|12)/)) {
my $vlan_index = $reverse_vlan{$iid}; my $vlan_index = $reverse_vlan{$iid};
my $v_id = $vlan_id->{$vlan_index}; my $v_id = $vlan_id->{$vlan_index};
next unless defined $v_id; next unless defined $v_id;
@@ -199,8 +216,8 @@ sub interfaces {
} }
else { else {
my $port = ($index % 64) + 1; my $port = ($index % $index_factor) + $port_offset;
my $slot = int($index / 64); my $slot = int($index / $index_factor);
my $slotport = "$slot.$port"; my $slotport = "$slot.$port";
$if{$iid} = $slotport; $if{$iid} = $slotport;
@@ -212,6 +229,7 @@ sub interfaces {
sub i_mac { sub i_mac {
my $passport = shift; my $passport = shift;
my $model = $passport->model();
my $i_mac = $passport->i_mac2(); my $i_mac = $passport->i_mac2();
my $vlan_mac = $passport->rc_vlan_mac(); my $vlan_mac = $passport->rc_vlan_mac();
my $vlan_index = $passport->rc_vlan_if(); my $vlan_index = $passport->rc_vlan_if();
@@ -236,6 +254,7 @@ sub i_mac {
$if_mac{$v_id} = $v_mac; $if_mac{$v_id} = $v_mac;
} }
if (defined $model and $model =~ /(86)/) {
# Get CPU Ethernet Interfaces # Get CPU Ethernet Interfaces
foreach my $iid (keys %$cpu_mac){ foreach my $iid (keys %$cpu_mac){
my $mac = $cpu_mac->{$iid}; my $mac = $cpu_mac->{$iid};
@@ -258,6 +277,7 @@ sub i_mac {
$if_mac{1} = $mac; $if_mac{1} = $mac;
} }
}
return \%if_mac; return \%if_mac;
} }
@@ -289,19 +309,20 @@ sub i_description {
sub i_name { sub i_name {
my $passport = shift; my $passport = shift;
my $model = $passport->model();
my $i_index = $passport->i_index(); my $i_index = $passport->i_index();
my $rc_alias = $passport->rc_alias(); my $rc_alias = $passport->rc_alias();
my $i_name2 = $passport->i_name2(); my $i_name2 = $passport->i_name2();
my $v_name = $passport->rc_vlan_name(); my $v_name = $passport->rc_vlan_name();
my $vlan_index = $passport->rc_vlan_if(); my $vlan_index = $passport->rc_vlan_if();
my $model = $passport->model();
my %reverse_vlan = reverse %$vlan_index; my %reverse_vlan = reverse %$vlan_index;
my %i_name; my %i_name;
foreach my $iid (keys %$i_index){ foreach my $iid (keys %$i_index){
if ($iid == 1) { if (($iid == 1) and ($model =~ /(86)/)) {
$i_name{$iid} = 'CPU Virtual Management IP'; $i_name{$iid} = 'CPU Virtual Management IP';
} }
@@ -309,15 +330,16 @@ sub i_name {
$i_name{$iid} = 'CPU 3 Ethernet Port'; $i_name{$iid} = 'CPU 3 Ethernet Port';
} }
elsif ($iid == 320) { elsif (($iid == 320) and ($model =~ /(8606|8610|8610co)/)) {
$i_name{$iid} = 'CPU 5 Ethernet Port'; $i_name{$iid} = 'CPU 5 Ethernet Port';
} }
elsif ($iid == 384) { elsif (($iid == 384) and ($model =~ /(8606|8610|8610co)/)) {
$i_name{$iid} = 'CPU 6 Ethernet Port'; $i_name{$iid} = 'CPU 6 Ethernet Port';
} }
elsif ($iid > 2000) { elsif (($iid > 2000 and defined $model and $model =~ /(86)/) or
($iid > 256 and defined $model and $model =~ /(105|11|12)/)) {
my $vlan_index = $reverse_vlan{$iid}; my $vlan_index = $reverse_vlan{$iid};
my $vlan_name = $v_name->{$vlan_index}; my $vlan_name = $v_name->{$vlan_index};
next unless defined $vlan_name; next unless defined $vlan_name;
@@ -339,6 +361,7 @@ sub i_name {
sub ip_index { sub ip_index {
my $passport = shift; my $passport = shift;
my $model = $passport->model();
my $ip_index = $passport->ip_index2(); my $ip_index = $passport->ip_index2();
my $cpu_ip = $passport->rc_cpu_ip(); my $cpu_ip = $passport->rc_cpu_ip();
my $virt_ip = $passport->rc_virt_ip(); my $virt_ip = $passport->rc_virt_ip();
@@ -351,6 +374,8 @@ sub ip_index {
$ip_index{$ip} = $iid; $ip_index{$ip} = $iid;
} }
# Only 8600 has CPU and Virtual Management IP
if (defined $model and $model =~ /(86)/) {
# Get CPU Ethernet IP # Get CPU Ethernet IP
foreach my $cid (keys %$cpu_ip){ foreach my $cid (keys %$cpu_ip){
my $c_ip = $cpu_ip->{$cid}; my $c_ip = $cpu_ip->{$cid};
@@ -361,12 +386,14 @@ sub ip_index {
# Get Virtual Mgmt IP # Get Virtual Mgmt IP
$ip_index{$virt_ip} = 1; $ip_index{$virt_ip} = 1;
}
return \%ip_index; return \%ip_index;
} }
sub root_ip { sub root_ip {
my $passport = shift; my $passport = shift;
my $model = $passport->model();
my $rc_ip_addr = $passport->rc_ip_addr(); my $rc_ip_addr = $passport->rc_ip_addr();
my $rc_ip_type = $passport->rc_ip_type(); my $rc_ip_type = $passport->rc_ip_type();
my $virt_ip = $passport->rc_virt_ip(); my $virt_ip = $passport->rc_virt_ip();
@@ -374,6 +401,8 @@ sub root_ip {
my $sonmp_topo_port = $passport->sonmp_topo_port(); my $sonmp_topo_port = $passport->sonmp_topo_port();
my $sonmp_topo_ip = $passport->sonmp_topo_ip(); my $sonmp_topo_ip = $passport->sonmp_topo_ip();
# Only 8600 has CLIP or Management Virtual IP
if (defined $model and $model =~ /(86)/) {
# Return CLIP (CircuitLess IP) # Return CLIP (CircuitLess IP)
foreach my $iid (keys %$rc_ip_type){ foreach my $iid (keys %$rc_ip_type){
my $ip_type = $rc_ip_type->{$iid}; my $ip_type = $rc_ip_type->{$iid};
@@ -386,6 +415,7 @@ sub root_ip {
# Return Management Virtual IP address # Return Management Virtual IP address
return $virt_ip if ((defined $virt_ip) and ($virt_ip ne '0.0.0.0')); return $virt_ip if ((defined $virt_ip) and ($virt_ip ne '0.0.0.0'));
}
# Return OSPF Router ID # Return OSPF Router ID
if ((defined $router_ip) and ($router_ip ne '0.0.0.0')) { if ((defined $router_ip) and ($router_ip ne '0.0.0.0')) {
@@ -408,7 +438,12 @@ sub root_ip {
# Required for SNMP::Info::SONMP # Required for SNMP::Info::SONMP
sub index_factor { sub index_factor {
return 64; my $passport = shift;
my $model = $passport->model();
my $index_factor = 64;
# Older Accelar models use base 16 instead of 64
$index_factor = 16 if (defined $model and $model =~ /(105|11|12)/);
return $index_factor;
} }
sub slot_offset { sub slot_offset {
@@ -425,7 +460,7 @@ __END__
=head1 NAME =head1 NAME
SNMP::Info::Layer3::Passport - Perl5 Interface to Nortel Networks' Passport SNMP::Info::Layer3::Passport - Perl5 Interface to Nortel Networks' Passport
8600 Series Switches 8600 and Accelar Series Switches
=head1 AUTHOR =head1 AUTHOR
@@ -449,7 +484,7 @@ Eric Miller (C<eric@jeneric.org>)
=head1 DESCRIPTION =head1 DESCRIPTION
Abstraction subclass for Nortel Networks' Passport 8600 Series Switches. Abstraction subclass for Nortel Networks' Passport 8600 and Accelar Series Switches.
These devices run Passport OS but have some of the same charactersitics as the Baystack family. These devices run Passport OS but have some of the same charactersitics as the Baystack family.
For example, extended interface information is gleened from RAPID-CITY. For example, extended interface information is gleened from RAPID-CITY.
@@ -533,7 +568,7 @@ OSPF Router ID (B<ospfRouterId>), SONMP Advertised IP Address.
=item $passport->index_factor() =item $passport->index_factor()
Required by SNMP::Info::SONMP. Returns 64. Required by SNMP::Info::SONMP. Returns 64 for 8600, 16 for Accelar.
=item $passport->port_offset() =item $passport->port_offset()
@@ -581,10 +616,10 @@ to ensure the virtual router ports are captured.
Returns reference to the map between IID and physical Port. Returns reference to the map between IID and physical Port.
Slot and port numbers on the Passport switches are determined by the formula: Slot and port numbers on the Passport switches are determined by the formula:
port = (ifIndex % 64) + 1, slot = int(ifIndex / 64). port = (ifIndex % index_factor) + port_offset, slot = int(ifIndex / index_factor).
The physical port name is returned as slot.port. CPU Ethernet ports are prefixed The physical port name is returned as slot.port. CPU Ethernet ports are prefixed
with CPU and VLAN interfaces are returned as the VLAN ID prefixed with V. with CPU and VLAN interfaces are returned as the VLAN ID prefixed with Vlan.
=item $passport->i_mac() =item $passport->i_mac()