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: CiscoVDSL.pm,v 1.1 2010-12-27 00:03:53 ivan Exp $
18 # Stanislav Sinyagin <ssinyagin@yahoo.com>
20 # Cisco VDSL Line statistics.
21 # Tested with Catalyst 2950 LRE
23 package Torrus::DevDiscover::CiscoVDSL;
29 $Torrus::DevDiscover::registry{'CiscoVDSL'} = {
31 'checkdevtype' => \&checkdevtype,
32 'discover' => \&discover,
33 'buildConfig' => \&buildConfig
39 # CISCO-IETF-VDSL-LINE-MIB
40 'cvdslCurrSnrMgn' => '1.3.6.1.4.1.9.10.87.1.1.2.1.5',
48 my $devdetails = shift;
50 my $session = $dd->session();
51 my $data = $devdetails->data();
53 if( $devdetails->isDevType('CiscoGeneric') )
56 $session->get_table( -baseoid => $dd->oiddef('cvdslCurrSnrMgn') );
57 if( defined $snrTable )
59 $devdetails->storeSnmpVars( $snrTable );
71 my $devdetails = shift;
73 my $data = $devdetails->data();
75 $data->{'cvdsl'} = [];
77 foreach my $ifIndex ( keys %{$data->{'interfaces'}} )
79 my $oid = $dd->oiddef('cvdslCurrSnrMgn') . '.' . $ifIndex;
80 if( $devdetails->hasOID( $oid . '.1' ) and
81 $devdetails->hasOID( $oid . '.2' ) )
83 push( @{$data->{'cvdsl'}}, $ifIndex );
93 my $devdetails = shift;
97 my $subtreeName = 'VDSL_Line_Stats';
99 my $subtreeNode = $cb->addSubtree( $devNode, $subtreeName, {},
100 ['CiscoVDSL::cvdsl-subtree']);
102 my $data = $devdetails->data();
104 foreach my $ifIndex ( sort {$a<=>$b} @{$data->{'cvdsl'}} )
106 my $interface = $data->{'interfaces'}{$ifIndex};
108 my $ifSubtreeName = $interface->{$data->{'nameref'}{'ifSubtreeName'}};
110 my $templates = ['CiscoVDSL::cvdsl-interface'];
113 'interface-name' => $interface->{'param'}{'interface-name'},
114 'interface-nick' => $interface->{'param'}{'interface-nick'},
115 'comment' => $interface->{'param'}{'comment'}
118 $cb->addSubtree( $subtreeNode, $ifSubtreeName, $param, $templates );
128 # indent-tabs-mode: nil
129 # perl-indent-level: 4