2 # Discovery module for Alteon devices
4 # Copyright (C) 2007 Jon Nistor
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
20 # $Id: Alteon.pm,v 1.1 2010-12-27 00:03:55 ivan Exp $
21 # Jon Nistor <nistor at snickers dot org>
25 package Torrus::DevDiscover::Alteon;
31 $Torrus::DevDiscover::registry{'Alteon'} = {
33 'checkdevtype' => \&checkdevtype,
34 'discover' => \&discover,
35 'buildConfig' => \&buildConfig
38 # pmodule-dependend OIDs are presented for module #1 only.
39 # currently devices with more than one module do not exist
44 'alteonOID' => '1.3.6.1.4.1.1872.1',
45 'hwPartNumber' => '1.3.6.1.4.1.1872.2.1.1.1.0',
46 'hwRevision' => '1.3.6.1.4.1.1872.2.1.1.2.0',
47 'agSoftwareVersion' => '1.3.6.1.4.1.1872.2.1.2.1.7.0',
48 'agEnabledSwFeatures' => '1.3.6.1.4.1.1872.2.1.2.1.25.0',
49 'slbCurCfgRealServerName' => '1.3.6.1.4.1.1872.2.1.5.2.1.12',
50 'slbNewCfgRealServerName' => '1.3.6.1.4.1.1872.2.1.5.3.1.13',
51 'slbCurCfgGroupName' => '1.3.6.1.4.1.1872.2.1.5.10.1.7',
52 'slbNewCfgGroupName' => '1.3.6.1.4.1.1872.2.1.5.11.1.10',
53 'slbStatPortMaintPortIndex' => '1.3.6.1.4.1.1872.2.1.8.2.1.1.1',
54 'slbStatVServerIndex' => '1.3.6.1.4.1.1872.2.1.8.2.7.1.3',
60 my $devdetails = shift;
62 if( not $dd->oidBaseMatch
64 $devdetails->snmpVar( $dd->oiddef('sysObjectID') ) ) )
69 $devdetails->setCap('interfaceIndexingPersistent');
77 my $devdetails = shift;
79 my $session = $dd->session();
80 my $data = $devdetails->data();
82 # Get the system info and display it in the comment
83 my $alteonInfo = $dd->retrieveSnmpOIDs
84 ( 'hwPartNumber', 'hwRevision', 'agSoftwareVersion',
85 'agEnabledSwFeatures', 'sysDescr' );
87 $data->{'param'}{'comment'} =
88 $alteonInfo->{'sysDescr'} . ", Hw Serial#: " .
89 $alteonInfo->{'hwPartNumber'} . ", Hw Revision: " .
90 $alteonInfo->{'hwRevision'} . ", " .
91 $alteonInfo->{'agEnabledSwFeatures'} . ", Version: " .
92 $alteonInfo->{'agSoftwareVersion'};
94 # PROG: Discover slbStatVServerIndex (Virtual Server index)
95 my $virtTable = $session->get_table ( -baseoid =>
96 $dd->oiddef('slbStatVServerIndex') );
97 $devdetails->storeSnmpVars( $virtTable );
99 ( $devdetails->getSnmpIndices( $dd->oiddef('slbStatVServerIndex') ) )
101 Debug("Alteon::vserver Found index $virtIndex");
102 $data->{'VSERVER'}{$virtIndex} = 1;
105 # PROG: SLB Port Maintenance Statistics Table
107 $session->get_table ( -baseoid =>
108 $dd->oiddef('slbStatPortMaintPortIndex') );
109 $devdetails->storeSnmpVars( $maintTable );
112 ( $devdetails->getSnmpIndices
113 ( $dd->oiddef('slbStatPortMaintPortIndex') ) )
115 Debug("Alteon::maintTable Index: $mIndex");
116 $data->{'MAINT'}{$mIndex} = 1;
125 my $devdetails = shift;
128 my $data = $devdetails->data();
130 $cb->addTemplateApplication($devNode, 'Alteon::alteon-cpu');
131 $cb->addTemplateApplication($devNode, 'Alteon::alteon-mem');
132 $cb->addTemplateApplication($devNode, 'Alteon::alteon-packets');
133 $cb->addTemplateApplication($devNode, 'Alteon::alteon-sensor');
135 # PROG: Virtual Server information
137 $cb->addSubtree( $devNode, 'VirtualServer_Stats',
138 { 'comment' => 'Stats per Virtual Server' },
139 [ 'Alteon::alteon-vserver-subtree'] );
141 foreach my $virtIndex ( sort {$a <=> $b } keys %{$data->{'VSERVER'}} )
143 $cb->addSubtree( $virtNode, 'VirtualHost_' . $virtIndex,
144 { 'alteon-vserver-index' => $virtIndex },
145 [ 'Alteon::alteon-vserver'] );
148 # PROG: SLB Port Maintenance Statistics Table
150 $cb->addSubtree( $devNode, 'Port_Maintenance_Stats',
151 { 'comment' => 'SLB port maintenance statistics' },
152 [ 'Alteon::alteon-maint-subtree'] );
154 foreach my $mIndex ( sort {$a <=> $b } keys %{$data->{'MAINT'}} )
156 $cb->addSubtree( $maintNode, 'Port_' . $mIndex,
157 { 'alteon-maint-index' => $mIndex },
158 [ 'Alteon::alteon-maint'] );
167 # indent-tabs-mode: nil
168 # perl-indent-level: 4