1 # Copyright (C) 2002 Stanislav Sinyagin
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
17 # Stanislav Sinyagin <ssinyagin@yahoo.com>
19 # Xylan (Alcatel) switch discovery.
24 # Xylan OmniStack 5024
25 # Switch software: X/OS 4.3.3
27 # Virtual ports are not processed yet
30 package Torrus
::DevDiscover
::Xylan
;
39 $Torrus::DevDiscover
::registry
{'Xylan'} = {
41 'checkdevtype' => \
&checkdevtype
,
42 'discover' => \
&discover
,
43 'buildConfig' => \
&buildConfig
50 'xylanSwitchDevice' => '1.3.6.1.4.1.800.3.1.1',
51 # PORT-MIB::phyPortTable
52 'xylanPhyPortTable' => '1.3.6.1.4.1.800.2.3.3.1',
53 # PORT-MIB::phyPortDescription
54 'xylanPhyPortDescription' => '1.3.6.1.4.1.800.2.3.3.1.1.4',
55 # PORT-MIB::phyPortToInterface
56 'xylanPhyPortToInterface' => '1.3.6.1.4.1.800.2.3.3.1.1.19'
59 # Not all interfaces are normally needed to monitor.
60 # You may override the interface filtering in devdiscover-siteconfig.pl:
61 # redefine $Torrus::DevDiscover::Xylan::interfaceFilter
62 # or define $Torrus::DevDiscover::Xylan::interfaceFilterOverlay
65 our $interfaceFilterOverlay;
66 my %xylInterfaceFilter;
68 if( not defined( $interfaceFilter ) )
70 $interfaceFilter = \
%xylInterfaceFilter;
74 # Key is some unique symbolic name, does not mean anything
75 # ifType is the number to match the interface type
76 # ifDescr is the regexp to match the interface description
80 'ifType' => 53 # propVirtual
83 'ifType' => 24 # softwareLoopback
90 my $devdetails = shift;
92 if( not $dd->oidBaseMatch
93 ( 'xylanSwitchDevice',
94 $devdetails->snmpVar( $dd->oiddef('sysObjectID') ) ) )
99 &Torrus
::DevDiscover
::RFC2863_IF_MIB
::addInterfaceFilter
100 ($devdetails, $interfaceFilter);
102 if( defined( $interfaceFilterOverlay ) )
104 &Torrus
::DevDiscover
::RFC2863_IF_MIB
::addInterfaceFilter
105 ($devdetails, $interfaceFilterOverlay);
108 $devdetails->setCap('interfaceIndexingPersistent');
117 my $devdetails = shift;
119 my $data = $devdetails->data();
120 my $session = $dd->session();
122 $data->{'nameref'}{'ifNick'} = 'xylanInterfaceNick';
123 $data->{'nameref'}{'ifSubtreeName'} = 'xylanInterfaceNick';
124 $data->{'nameref'}{'ifComment'} = 'xylanInterfaceComment';
125 $data->{'nameref'}{'ifReferenceName'} = 'xylanInterfaceHumanName';
128 $session->get_table( -baseoid
=> $dd->oiddef('xylanPhyPortTable') );
130 if( not defined $phyPortTable )
132 Error
('Error retrieving PORT-MIB::phyPortTable from Xylan device');
136 $devdetails->storeSnmpVars( $phyPortTable );
140 getSnmpIndices
( $dd->oiddef('xylanPhyPortDescription') ) )
142 my ( $slot, $port ) = split( '\.', $slotDotPort );
145 $devdetails->snmpVar($dd->oiddef('xylanPhyPortToInterface') .
147 my $interface = $data->{'interfaces'}{$ifIndex};
149 if( defined $interface )
151 $interface->{'xylanInterfaceNick'} =
152 sprintf( '%d_%d', $slot, $port );
154 $interface->{'xylanInterfaceHumanName'} =
155 sprintf( '%d/%d', $slot, $port );
157 $interface->{'xylanInterfaceComment'} =
158 $devdetails->snmpVar($dd->oiddef('xylanPhyPortDescription') .
163 # verify if all interfaces are processed
165 for my $ifIndex ( keys %{$data->{'interfaces'}} )
167 my $interface = $data->{'interfaces'}{$ifIndex};
169 if( not defined( $interface->{'xylanInterfaceNick'} ) )
171 Warn
('Interface ' . $ifIndex . ' is not in phyPortTable');
173 my $nick = sprintf( 'PORT%d', $ifIndex );
174 $interface->{'xylanInterfaceNick'} = $nick;
175 $interface->{'xylanInterfaceHumanName'} = $nick;
177 $interface->{'xylanInterfaceComment'} = $interface->{'ifDescr'};
187 my $devdetails = shift;
199 # indent-tabs-mode: nil
200 # perl-indent-level: 4