2 # Discovery module for Motorola Broadband Services Router (formely Riverdelta)
4 # Copyright (C) 2006 Stanislav Sinyagin
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: MotorolaBSR.pm,v 1.1 2010-12-27 00:03:53 ivan Exp $
24 # Cisco SCE devices discovery
25 package Torrus::DevDiscover::MotorolaBSR;
31 $Torrus::DevDiscover::registry{'MotorolaBSR'} = {
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
43 'rdnProducts' => '1.3.6.1.4.1.4981.4.1',
45 'rdnCmtsUpstreamChannelTable' => '1.3.6.1.4.1.4981.2.1.2'
51 my $devdetails = shift;
53 if( not $dd->oidBaseMatch
55 $devdetails->snmpVar( $dd->oiddef('sysObjectID') ) ) or
56 not $devdetails->isDevType('RFC2670_DOCS_IF') )
61 $devdetails->setCap('interfaceIndexingPersistent');
69 my $devdetails = shift;
71 my $session = $dd->session();
72 my $data = $devdetails->data();
74 $data->{'param'}{'ifindex-map'} = '$IFIDX_IFINDEX';
75 Torrus::DevDiscover::RFC2863_IF_MIB::storeIfIndexParams( $devdetails );
77 if( $dd->checkSnmpTable( 'rdnCmtsUpstreamChannelTable' ) )
79 $devdetails->setCap('rdnCmtsUpstreamChannelTable');
81 foreach my $ifIndex ( @{$data->{'docsCableUpstream'}} )
83 my $interface = $data->{'interfaces'}{$ifIndex};
85 push( @{$interface->{'docsTemplates'}},
86 'MotorolaBSR::motorola-bsr-docsis-upstream-util' );
95 my $devdetails = shift;
98 my $data = $devdetails->data();
100 if( $devdetails->hasCap('rdnCmtsUpstreamChannelTable') and
101 scalar( @{$data->{'docsCableUpstream'}} ) > 0 )
104 $cb->getChildSubtree( $devNode,
105 $data->{'docsConfig'}{'docsCableUpstream'}{
108 my $shortcuts = 'snr,fec,freq,modems';
111 'overview-shortcuts' =>
114 'overview-subleave-name-modems' => 'Modems',
115 'overview-direct-link-modems' => 'yes',
116 'overview-direct-link-view-modems' => 'expanded-dir-html',
117 'overview-shortcut-text-modems' => 'All modems',
118 'overview-shortcut-title-modems'=>
119 'Show modem quantities in one page',
120 'overview-page-title-modems' => 'Modem quantities',
123 $cb->addParams( $upstrNode, $param );
125 # Build All_Modems summary graph
128 'ds-type' => 'rrd-multigraph',
129 'ds-names' => 'registered,unregistered,offline',
130 'graph-lower-limit' => '0',
131 'precedence' => '1000',
133 'vertical-label' => 'Modems',
134 'descriptive-nickname' => '%system-id%: All modems',
136 'ds-expr-registered' => '{Modems_Registered}',
137 'graph-legend-registered' => 'Registered',
138 'line-style-registered' => 'AREA',
139 'line-color-registered' => '##blue',
140 'line-order-registered' => '1',
142 'ds-expr-unregistered' => '{Modems_Unregistered}',
143 'graph-legend-unregistered' => 'Unregistered',
144 'line-style-unregistered' => 'STACK',
145 'line-color-unregistered' => '##crimson',
146 'line-order-unregistered' => '2',
148 'ds-expr-offline' => '{Modems_Offline}',
149 'graph-legend-offline' => 'Offline',
150 'line-style-offline' => 'STACK',
151 'line-color-offline' => '##silver',
152 'line-order-offline' => '3',
155 $param->{'comment'} =
156 'Registered, Unregistered and Offline modems on CMTS';
159 $data->{'docsConfig'}{'docsCableUpstream'}{'nodeidCategory'} .
160 '//%nodeid-device%//modems';
163 foreach my $ifIndex ( @{$data->{'docsCableUpstream'}} )
165 my $interface = $data->{'interfaces'}{$ifIndex};
167 my $intf = $interface->{$data->{'nameref'}{'ifSubtreeName'}};
171 $param->{'ds-expr-registered'} =
172 '{' . $intf . '/Modems_Registered}';
173 $param->{'ds-expr-unregistered'} =
174 '{' . $intf . '/Modems_Unregistered}';
175 $param->{'ds-expr-offline'} =
176 '{' . $intf . '/Modems_Offline}';
181 $param->{'ds-expr-registered'} .=
182 ',{' . $intf . '/Modems_Registered},+';
183 $param->{'ds-expr-unregistered'} .=
184 ',{' . $intf . '/Modems_Unregistered},+';
185 $param->{'ds-expr-offline'} .=
186 ',{' . $intf . '/Modems_Offline},+';
191 $cb->getChildSubtree( $devNode,
192 $data->{'docsConfig'}{
193 'docsCableUpstream'}{
195 if( defined( $usNode ) )
197 $cb->addLeaf( $usNode, 'All_Modems', $param, [] );
201 Error('Could not find the Upstream subtree');
211 # indent-tabs-mode: nil
212 # perl-indent-level: 4