| 1 |
|
| # SNMP::Info::Layer3::N1600 - SNMP Interface to Nortel N16XX devices |
| 2 |
|
| # |
| 3 |
|
| # Copyright (c) 2008 Eric Miller |
| 4 |
|
| # All rights reserved. |
| 5 |
|
| # |
| 6 |
|
| # Redistribution and use in source and binary forms, with or without |
| 7 |
|
| # modification, are permitted provided that the following conditions are met: |
| 8 |
|
| # |
| 9 |
|
| # * Redistributions of source code must retain the above copyright notice, |
| 10 |
|
| # this list of conditions and the following disclaimer. |
| 11 |
|
| # * Redistributions in binary form must reproduce the above copyright |
| 12 |
|
| # notice, this list of conditions and the following disclaimer in the |
| 13 |
|
| # documentation and/or other materials provided with the distribution. |
| 14 |
|
| # * Neither the name of the University of California, Santa Cruz nor the |
| 15 |
|
| # names of its contributors may be used to endorse or promote products |
| 16 |
|
| # derived from this software without specific prior written permission. |
| 17 |
|
| # |
| 18 |
|
| # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 19 |
|
| # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 20 |
|
| # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 21 |
|
| # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
| 22 |
|
| # LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 23 |
|
| # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 24 |
|
| # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 25 |
|
| # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 26 |
|
| # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 27 |
|
| # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 28 |
|
| # POSSIBILITY OF SUCH DAMAGE. |
| 29 |
|
| |
| 30 |
|
| package SNMP::Info::Layer3::N1600; |
| 31 |
|
| |
| 32 |
|
| use strict; |
| 33 |
|
| use warnings; |
| 34 |
|
| use Exporter; |
| 35 |
|
| use SNMP::Info::Layer3; |
| 36 |
|
| use SNMP::Info::SONMP; |
| 37 |
|
| |
| 38 |
|
| @SNMP::Info::Layer3::N1600::ISA |
| 39 |
|
| = qw/SNMP::Info::Layer3 SNMP::Info::SONMP Exporter/; |
| 40 |
|
| @SNMP::Info::Layer3::N1600::EXPORT_OK = qw//; |
| 41 |
|
| |
| 42 |
|
| our ($VERSION, %GLOBALS, %FUNCS, %MIBS, %MUNGE); |
| 43 |
|
| |
| 44 |
|
| $VERSION = '3.985003'; |
| 45 |
|
| |
| 46 |
|
| %MIBS = ( |
| 47 |
|
| %SNMP::Info::Layer3::MIBS, |
| 48 |
|
| %SNMP::Info::SONMP::MIBS, |
| 49 |
|
| 'SWL2MGMT-MIB' => 'swL2MgmtMIB', |
| 50 |
|
| 'RAPID-CITY' => 'rapidCity', |
| 51 |
|
| ); |
| 52 |
|
| |
| 53 |
|
| %GLOBALS = ( %SNMP::Info::Layer3::GLOBALS, %SNMP::Info::SONMP::GLOBALS, ); |
| 54 |
|
| |
| 55 |
|
| %FUNCS = ( |
| 56 |
|
| %SNMP::Info::Layer3::FUNCS, |
| 57 |
|
| %SNMP::Info::SONMP::FUNCS, |
| 58 |
|
| |
| 59 |
|
| # SWL2MGMT-MIB |
| 60 |
|
| # swL2PortInfoTable |
| 61 |
|
| 'n1600_nway_status' => 'swL2PortInfoNwayStatus', |
| 62 |
|
| |
| 63 |
|
| # swL2PortCtrlTable |
| 64 |
|
| 'n1600_nway_state' => 'swL2PortCtrlNwayState', |
| 65 |
|
| ); |
| 66 |
|
| |
| 67 |
|
| %MUNGE = ( |
| 68 |
|
| |
| 69 |
|
| # Inherit all the built in munging |
| 70 |
|
| %SNMP::Info::Layer3::MUNGE, |
| 71 |
|
| %SNMP::Info::SONMP::MUNGE, |
| 72 |
|
| ); |
| 73 |
|
| |
| 74 |
|
| # Method OverRides |
| 75 |
|
| |
| 76 |
|
| sub model { |
| 77 |
|
| my $n1600 = shift; |
| 78 |
|
| my $id = $n1600->id(); |
| 79 |
|
| |
| 80 |
|
| unless ( defined $id ) { |
| 81 |
|
| print |
| 82 |
|
| " SNMP::Info::Layer3::N1600::model() - Device does not support sysObjectID\n" |
| 83 |
|
| if $n1600->debug(); |
| 84 |
|
| return; |
| 85 |
|
| } |
| 86 |
|
| |
| 87 |
|
| my $model = &SNMP::translateObj($id); |
| 88 |
|
| |
| 89 |
|
| return $id unless defined $model; |
| 90 |
|
| |
| 91 |
|
| $model =~ s/^rcA//i; |
| 92 |
|
| return $model; |
| 93 |
|
| } |
| 94 |
|
| |
| 95 |
|
| sub vendor { |
| 96 |
|
| return 'avaya'; |
| 97 |
|
| } |
| 98 |
|
| |
| 99 |
|
| sub os { |
| 100 |
|
| return 'passport'; |
| 101 |
|
| } |
| 102 |
|
| |
| 103 |
|
| sub os_ver { |
| 104 |
|
| my $n1600 = shift; |
| 105 |
|
| my $descr = $n1600->description(); |
| 106 |
|
| return unless defined $descr; |
| 107 |
|
| |
| 108 |
|
| if ( $descr =~ m/(\d+\.\d+\.\d+\.\d+)/ ) { |
| 109 |
|
| return $1; |
| 110 |
|
| } |
| 111 |
|
| |
| 112 |
|
| return; |
| 113 |
|
| } |
| 114 |
|
| |
| 115 |
|
| sub interfaces { |
| 116 |
|
| my $n1600 = shift; |
| 117 |
|
| my $partial = shift; |
| 118 |
|
| |
| 119 |
|
| my $i_index = $n1600->i_index($partial) || {}; |
| 120 |
|
| |
| 121 |
|
| my %if; |
| 122 |
|
| foreach my $iid ( keys %$i_index ) { |
| 123 |
|
| my $index = $i_index->{$iid}; |
| 124 |
|
| next unless defined $index; |
| 125 |
|
| |
| 126 |
|
| my $slotport = "1.$index"; |
| 127 |
|
| $if{$iid} = $slotport; |
| 128 |
|
| } |
| 129 |
|
| return \%if; |
| 130 |
|
| } |
| 131 |
|
| |
| 132 |
|
| sub i_duplex { |
| 133 |
|
| my $n1600 = shift; |
| 134 |
|
| my $partial = shift; |
| 135 |
|
| |
| 136 |
|
| my $nway_status = $n1600->n1600_nway_status($partial) || {}; |
| 137 |
|
| |
| 138 |
|
| my %i_duplex; |
| 139 |
|
| foreach my $iid ( keys %$nway_status ) { |
| 140 |
|
| my $duplex = $nway_status->{$iid}; |
| 141 |
|
| next unless defined $duplex; |
| 142 |
|
| next if $duplex =~ /other/i; |
| 143 |
|
| $i_duplex{$iid} = 'half' if $duplex =~ /half/i; |
| 144 |
|
| $i_duplex{$iid} = 'full' if $duplex =~ /full/i; |
| 145 |
|
| } |
| 146 |
|
| return \%i_duplex; |
| 147 |
|
| } |
| 148 |
|
| |
| 149 |
|
| sub i_duplex_admin { |
| 150 |
|
| my $n1600 = shift; |
| 151 |
|
| my $partial = shift; |
| 152 |
|
| |
| 153 |
|
| my $nway_state = $n1600->n1600_nway_state($partial) || {}; |
| 154 |
|
| |
| 155 |
|
| my %i_duplex; |
| 156 |
|
| foreach my $iid ( keys %$nway_state ) { |
| 157 |
|
| my $duplex = $nway_state->{$iid}; |
| 158 |
|
| next unless defined $duplex; |
| 159 |
|
| next if $duplex =~ /other/i; |
| 160 |
|
| $i_duplex{$iid} = 'half' if $duplex =~ /half/i; |
| 161 |
|
| $i_duplex{$iid} = 'full' if $duplex =~ /full/i; |
| 162 |
|
| $i_duplex{$iid} = 'auto' if $duplex =~ /nway-enabled/i; |
| 163 |
|
| } |
| 164 |
|
| return \%i_duplex; |
| 165 |
|
| } |
| 166 |
|
| |
| 167 |
|
| # Required for SNMP::Info::SONMP |
| 168 |
|
| sub index_factor { |
| 169 |
|
| return 64; |
| 170 |
|
| } |
| 171 |
|
| |
| 172 |
|
| 1; |
| 173 |
|
| __END__ |