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: RFC2662_ADSL_LINE.pm,v 1.1 2010-12-27 00:03:53 ivan Exp $
18 # Stanislav Sinyagin <ssinyagin@yahoo.com>
20 # ADSL Line statistics.
22 # We assume that adslAturPhysTable is always present when adslAtucPhysTable
23 # is there. Probably that's wrong, and needs to be redesigned.
25 package Torrus::DevDiscover::RFC2662_ADSL_LINE;
31 $Torrus::DevDiscover::registry{'RFC2662_ADSL_LINE'} = {
33 'checkdevtype' => \&checkdevtype,
34 'discover' => \&discover,
35 'buildConfig' => \&buildConfig
42 'adslAtucPhysTable' => '1.3.6.1.2.1.10.94.1.1.2',
43 'adslAtucCurrSnrMgn' => '1.3.6.1.2.1.10.94.1.1.2.1.4',
44 'adslAturPhysTable' => '1.3.6.1.2.1.10.94.1.1.3'
52 my $devdetails = shift;
54 my $session = $dd->session();
55 my $data = $devdetails->data();
58 $session->get_table( -baseoid => $dd->oiddef('adslAtucPhysTable') );
59 if( not defined $atucTable )
63 $devdetails->storeSnmpVars( $atucTable );
65 ## Do we need to check adslAtucPhysTable ? ##
74 my $devdetails = shift;
76 my $data = $devdetails->data();
78 $data->{'adslAtucPhysTable'} = [];
80 foreach my $ifIndex ( keys %{$data->{'interfaces'}} )
82 if( $devdetails->hasOID( $dd->oiddef('adslAtucCurrSnrMgn') .
85 push( @{$data->{'adslAtucPhysTable'}}, $ifIndex );
95 my $devdetails = shift;
100 my $subtreeName = 'ADSL_Line_Stats';
103 'precedence' => '-600',
104 'comment' => 'ADSL line statistics'
106 my $subtreeNode = $cb->addSubtree( $devNode, $subtreeName, $param );
108 my $data = $devdetails->data();
110 foreach my $ifIndex ( sort {$a<=>$b} @{$data->{'adslAtucPhysTable'}} )
112 my $interface = $data->{'interfaces'}{$ifIndex};
114 my $ifSubtreeName = $interface->{$data->{'nameref'}{'ifSubtreeName'}};
116 my $templates = ['RFC2662_ADSL_LINE::adsl-line-interface'];
119 'interface-name' => $interface->{'param'}{'interface-name'},
120 'interface-nick' => $interface->{'param'}{'interface-nick'},
121 'collector-timeoffset-hashstring' =>'%system-id%:%interface-nick%',
122 'comment' => $interface->{'param'}{'comment'}
125 $param->{'node-display-name'} =
126 $interface->{$data->{'nameref'}{'ifReferenceName'}};
128 $cb->addSubtree( $subtreeNode, $ifSubtreeName, $param, $templates );
138 # indent-tabs-mode: nil
139 # perl-indent-level: 4