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 # $Id: Xylan.pm,v 1.1 2010-12-27 00:03:50 ivan Exp $
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;
37 $Torrus::DevDiscover::registry{'Xylan'} = {
39 'checkdevtype' => \&checkdevtype,
40 'discover' => \&discover,
41 'buildConfig' => \&buildConfig
48 'xylanSwitchDevice' => '1.3.6.1.4.1.800.3.1.1',
49 # PORT-MIB::phyPortTable
50 'xylanPhyPortTable' => '1.3.6.1.4.1.800.2.3.3.1',
51 # PORT-MIB::phyPortDescription
52 'xylanPhyPortDescription' => '1.3.6.1.4.1.800.2.3.3.1.1.4',
53 # PORT-MIB::phyPortToInterface
54 'xylanPhyPortToInterface' => '1.3.6.1.4.1.800.2.3.3.1.1.19'
57 # Not all interfaces are normally needed to monitor.
58 # You may override the interface filtering in devdiscover-siteconfig.pl:
59 # redefine $Torrus::DevDiscover::Xylan::interfaceFilter
60 # or define $Torrus::DevDiscover::Xylan::interfaceFilterOverlay
63 our $interfaceFilterOverlay;
64 my %xylInterfaceFilter;
66 if( not defined( $interfaceFilter ) )
68 $interfaceFilter = \%xylInterfaceFilter;
72 # Key is some unique symbolic name, does not mean anything
73 # ifType is the number to match the interface type
74 # ifDescr is the regexp to match the interface description
78 'ifType' => 53 # propVirtual
81 'ifType' => 24 # softwareLoopback
88 my $devdetails = shift;
90 if( not $dd->oidBaseMatch
91 ( 'xylanSwitchDevice',
92 $devdetails->snmpVar( $dd->oiddef('sysObjectID') ) ) )
97 &Torrus::DevDiscover::RFC2863_IF_MIB::addInterfaceFilter
98 ($devdetails, $interfaceFilter);
100 if( defined( $interfaceFilterOverlay ) )
102 &Torrus::DevDiscover::RFC2863_IF_MIB::addInterfaceFilter
103 ($devdetails, $interfaceFilterOverlay);
106 $devdetails->setCap('interfaceIndexingPersistent');
115 my $devdetails = shift;
117 my $data = $devdetails->data();
118 my $session = $dd->session();
120 $data->{'nameref'}{'ifNick'} = 'xylanInterfaceNick';
121 $data->{'nameref'}{'ifSubtreeName'} = 'xylanInterfaceNick';
122 $data->{'nameref'}{'ifComment'} = 'xylanInterfaceComment';
123 $data->{'nameref'}{'ifReferenceName'} = 'xylanInterfaceHumanName';
126 $session->get_table( -baseoid => $dd->oiddef('xylanPhyPortTable') );
128 if( not defined $phyPortTable )
130 Error('Error retrieving PORT-MIB::phyPortTable from Xylan device');
134 $devdetails->storeSnmpVars( $phyPortTable );
136 foreach my $slotDotPort
138 getSnmpIndices( $dd->oiddef('xylanPhyPortDescription') ) )
140 my ( $slot, $port ) = split( '\.', $slotDotPort );
143 $devdetails->snmpVar($dd->oiddef('xylanPhyPortToInterface') .
145 my $interface = $data->{'interfaces'}{$ifIndex};
147 if( defined $interface )
149 $interface->{'xylanInterfaceNick'} =
150 sprintf( '%d_%d', $slot, $port );
152 $interface->{'xylanInterfaceHumanName'} =
153 sprintf( '%d/%d', $slot, $port );
155 $interface->{'xylanInterfaceComment'} =
156 $devdetails->snmpVar($dd->oiddef('xylanPhyPortDescription') .
161 # verify if all interfaces are processed
163 foreach my $ifIndex ( keys %{$data->{'interfaces'}} )
165 my $interface = $data->{'interfaces'}{$ifIndex};
167 if( not defined( $interface->{'xylanInterfaceNick'} ) )
169 Warn('Interface ' . $ifIndex . ' is not in phyPortTable');
171 my $nick = sprintf( 'PORT%d', $ifIndex );
172 $interface->{'xylanInterfaceNick'} = $nick;
173 $interface->{'xylanInterfaceHumanName'} = $nick;
175 $interface->{'xylanInterfaceComment'} = $interface->{'ifDescr'};
185 my $devdetails = shift;
197 # indent-tabs-mode: nil
198 # perl-indent-level: 4