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.
18 # Stanislav Sinyagin <ssinyagin@yahoo.com>
20 # Xylan (Alcatel) switch discovery.
25 # Xylan OmniStack 5024
26 # Switch software: X/OS 4.3.3
28 # Virtual ports are not processed yet
31 package Torrus
::DevDiscover
::Xylan
;
40 $Torrus::DevDiscover
::registry
{'Xylan'} = {
42 'checkdevtype' => \
&checkdevtype
,
43 'discover' => \
&discover
,
44 'buildConfig' => \
&buildConfig
51 'xylanSwitchDevice' => '1.3.6.1.4.1.800.3.1.1',
52 # PORT-MIB::phyPortTable
53 'xylanPhyPortTable' => '1.3.6.1.4.1.800.2.3.3.1',
54 # PORT-MIB::phyPortDescription
55 'xylanPhyPortDescription' => '1.3.6.1.4.1.800.2.3.3.1.1.4',
56 # PORT-MIB::phyPortToInterface
57 'xylanPhyPortToInterface' => '1.3.6.1.4.1.800.2.3.3.1.1.19'
60 # Not all interfaces are normally needed to monitor.
61 # You may override the interface filtering in devdiscover-siteconfig.pl:
62 # redefine $Torrus::DevDiscover::Xylan::interfaceFilter
63 # or define $Torrus::DevDiscover::Xylan::interfaceFilterOverlay
66 our $interfaceFilterOverlay;
67 my %xylInterfaceFilter;
69 if( not defined( $interfaceFilter ) )
71 $interfaceFilter = \
%xylInterfaceFilter;
75 # Key is some unique symbolic name, does not mean anything
76 # ifType is the number to match the interface type
77 # ifDescr is the regexp to match the interface description
81 'ifType' => 53 # propVirtual
84 'ifType' => 24 # softwareLoopback
91 my $devdetails = shift;
93 if( not $dd->oidBaseMatch
94 ( 'xylanSwitchDevice',
95 $devdetails->snmpVar( $dd->oiddef('sysObjectID') ) ) )
100 &Torrus
::DevDiscover
::RFC2863_IF_MIB
::addInterfaceFilter
101 ($devdetails, $interfaceFilter);
103 if( defined( $interfaceFilterOverlay ) )
105 &Torrus
::DevDiscover
::RFC2863_IF_MIB
::addInterfaceFilter
106 ($devdetails, $interfaceFilterOverlay);
109 $devdetails->setCap('interfaceIndexingPersistent');
118 my $devdetails = shift;
120 my $data = $devdetails->data();
121 my $session = $dd->session();
123 $data->{'nameref'}{'ifNick'} = 'xylanInterfaceNick';
124 $data->{'nameref'}{'ifSubtreeName'} = 'xylanInterfaceNick';
125 $data->{'nameref'}{'ifComment'} = 'xylanInterfaceComment';
126 $data->{'nameref'}{'ifReferenceName'} = 'xylanInterfaceHumanName';
129 $session->get_table( -baseoid
=> $dd->oiddef('xylanPhyPortTable') );
131 if( not defined $phyPortTable )
133 Error
('Error retrieving PORT-MIB::phyPortTable from Xylan device');
137 $devdetails->storeSnmpVars( $phyPortTable );
141 getSnmpIndices
( $dd->oiddef('xylanPhyPortDescription') ) )
143 my ( $slot, $port ) = split( '\.', $slotDotPort );
146 $devdetails->snmpVar($dd->oiddef('xylanPhyPortToInterface') .
148 my $interface = $data->{'interfaces'}{$ifIndex};
150 if( defined $interface )
152 $interface->{'xylanInterfaceNick'} =
153 sprintf( '%d_%d', $slot, $port );
155 $interface->{'xylanInterfaceHumanName'} =
156 sprintf( '%d/%d', $slot, $port );
158 $interface->{'xylanInterfaceComment'} =
159 $devdetails->snmpVar($dd->oiddef('xylanPhyPortDescription') .
164 # verify if all interfaces are processed
166 for my $ifIndex ( keys %{$data->{'interfaces'}} )
168 my $interface = $data->{'interfaces'}{$ifIndex};
170 if( not defined( $interface->{'xylanInterfaceNick'} ) )
172 Warn
('Interface ' . $ifIndex . ' is not in phyPortTable');
174 my $nick = sprintf( 'PORT%d', $ifIndex );
175 $interface->{'xylanInterfaceNick'} = $nick;
176 $interface->{'xylanInterfaceHumanName'} = $nick;
178 $interface->{'xylanInterfaceComment'} = $interface->{'ifDescr'};
188 my $devdetails = shift;
200 # indent-tabs-mode: nil
201 # perl-indent-level: 4