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: CiscoIOS_Docsis.pm,v 1.1 2010-12-27 00:03:46 ivan Exp $
18 # Stanislav Sinyagin <ssinyagin@yahoo.com>
20 # DOCSIS interface, Cisco specific
22 package Torrus::DevDiscover::CiscoIOS_Docsis;
27 # Sequence number is 600 - we depend on RFC2670_DOCS_IF and CiscoIOS
29 $Torrus::DevDiscover::registry{'CiscoIOS_Docsis'} = {
31 'checkdevtype' => \&checkdevtype,
32 'discover' => \&discover,
33 'buildConfig' => \&buildConfig
36 $Torrus::DevDiscover::RFC2863_IF_MIB::knownSelectorActions{
37 'DocsisMacModemsMonitor'} = 'CiscoIOS_Docsis';
39 $Torrus::DevDiscover::RFC2863_IF_MIB::knownSelectorActions{
40 'DocsisUpUtilMonitor'} = 'CiscoIOS_Docsis';
41 $Torrus::DevDiscover::RFC2863_IF_MIB::knownSelectorActions{
42 'DocsisUpSlotsMonitor'} = 'CiscoIOS_Docsis';
47 # CISCO-DOCS-EXT-MIB:cdxIfUpstreamChannelExtTable
48 'cdxIfUpChannelMaxUGSLastFiveMins' => '1.3.6.1.4.1.9.9.116.1.4.1.1.14'
55 my $devdetails = shift;
57 if( $devdetails->isDevType('CiscoIOS') and
58 $devdetails->isDevType('RFC2670_DOCS_IF') )
70 my $devdetails = shift;
72 my $data = $devdetails->data();
74 if( $dd->checkSnmpTable( 'cdxIfUpChannelMaxUGSLastFiveMins' ) )
76 $devdetails->setCap('cdxIfUpChannelMaxUGSLastFiveMins');
79 push( @{$data->{'docsConfig'}{'docsCableMaclayer'}{'templates'}},
80 'CiscoIOS_Docsis::cisco-docsis-mac-subtree' );
82 foreach my $ifIndex ( @{$data->{'docsCableMaclayer'}} )
84 my $interface = $data->{'interfaces'}{$ifIndex};
86 push( @{$interface->{'docsTemplates'}},
87 'CiscoIOS_Docsis::cisco-docsis-mac-util' );
90 foreach my $ifIndex ( @{$data->{'docsCableUpstream'}} )
92 my $interface = $data->{'interfaces'}{$ifIndex};
94 push( @{$interface->{'docsTemplates'}},
95 'CiscoIOS_Docsis::cisco-docsis-upstream-util' );
104 my $devdetails = shift;
108 my $data = $devdetails->data();
110 if( $devdetails->hasCap('cdxIfUpChannelMaxUGSLastFiveMins') )
112 $cb->setVar( $devNode, 'CiscoIOS_Docsis::ugs-supported', 'true' );
115 if( scalar( @{$data->{'docsCableMaclayer'}} ) > 0 )
117 # Build All_Modems summary graph
119 'ds-type' => 'rrd-multigraph',
120 'ds-names' => 'total,active,registered',
121 'graph-lower-limit' => '0',
122 'precedence' => '1000',
124 'Registered, Active and Total modems on CMTS',
126 'vertical-label' => 'Modems',
128 'graph-legend-total' => 'Total',
129 'line-style-total' => '##totalresource',
130 'line-color-total' => '##totalresource',
131 'line-order-total' => '1',
133 'graph-legend-active' => 'Active',
134 'line-style-active' => '##resourcepartusage',
135 'line-color-active' => '##resourcepartusage',
136 'line-order-active' => '2',
138 'graph-legend-registered' => 'Registered',
139 'line-style-registered' => '##resourceusage',
140 'line-color-registered' => '##resourceusage',
141 'line-order-registered' => '3',
142 'descriptive-nickname' => '%system-id%: All modems'
146 foreach my $ifIndex ( @{$data->{'docsCableMaclayer'}} )
148 my $interface = $data->{'interfaces'}{$ifIndex};
150 my $intf = $interface->{$data->{'nameref'}{'ifSubtreeName'}};
154 $param->{'ds-expr-total'} =
155 '{' . $intf . '/Modems_Total}';
156 $param->{'ds-expr-active'} =
157 '{' . $intf . '/Modems_Active}';
158 $param->{'ds-expr-registered'} =
159 '{' . $intf . '/Modems_Registered}';
164 $param->{'ds-expr-total'} .=
165 ',{' . $intf . '/Modems_Total},+';
166 $param->{'ds-expr-active'} .=
167 ',{' . $intf . '/Modems_Active},+';
168 $param->{'ds-expr-registered'} .=
169 ',{' . $intf . '/Modems_Registered},+';
174 $cb->getChildSubtree( $devNode,
175 $data->{'docsConfig'}{
176 'docsCableMaclayer'}{
178 if( defined( $macNode ) )
180 $cb->addLeaf( $macNode, 'All_Modems', $param, [] );
184 Error('Could not find the MAC layer subtree');
188 # Apply selector actions
189 foreach my $ifIndex ( @{$data->{'docsCableMaclayer'}} )
191 my $interface = $data->{'interfaces'}{$ifIndex};
193 my $intf = $interface->{$data->{'nameref'}{'ifSubtreeName'}};
196 $interface->{'selectorActions'}{'DocsisMacModemsMonitor'};
197 if( defined( $monitor ) )
199 my $intfNode = $cb->getChildSubtree( $macNode, $intf );
200 $cb->addLeaf( $intfNode, 'Modems_Registered',
201 {'monitor' => $monitor } );
206 if( scalar( @{$data->{'docsCableUpstream'}} ) > 0 )
209 $cb->getChildSubtree( $devNode,
210 $data->{'docsConfig'}{'docsCableUpstream'}{
213 foreach my $ifIndex ( @{$data->{'docsCableUpstream'}} )
215 my $interface = $data->{'interfaces'}{$ifIndex};
217 my $intf = $interface->{$data->{'nameref'}{'ifSubtreeName'}};
220 $interface->{'selectorActions'}{'DocsisUpUtilMonitor'};
221 if( defined( $monitor ) )
223 my $intfNode = $cb->getChildSubtree( $upstrNode, $intf );
224 $cb->addLeaf( $intfNode, 'Util',
225 {'monitor' => $monitor } );
229 $interface->{'selectorActions'}{'DocsisUpSlotsMonitor'};
230 if( defined( $monitor ) )
232 my $intfNode = $cb->getChildSubtree( $upstrNode, $intf );
233 $cb->addLeaf( $intfNode, 'ContSlots',
234 {'monitor' => $monitor } );
238 # Override the overview shortcus defined in rfc2670.docsis-if.xml
240 my $shortcuts = 'snr,fec,freq,modems,util';
241 if( $devdetails->hasCap('cdxIfUpChannelMaxUGSLastFiveMins') )
243 $shortcuts .= ',ugs';
247 'overview-shortcuts' =>
250 'overview-subleave-name-modems' => 'Modems',
251 'overview-direct-link-modems' => 'yes',
252 'overview-direct-link-view-modems' => 'expanded-dir-html',
253 'overview-shortcut-text-modems' => 'All modems',
254 'overview-shortcut-title-modems'=>
255 'Show modem quantities in one page',
256 'overview-page-title-modems' => 'Modem quantities',
258 'overview-subleave-name-util' => 'Util_Summary',
259 'overview-direct-link-util' => 'yes',
260 'overview-direct-link-view-util' => 'expanded-dir-html',
261 'overview-shortcut-text-util' => 'All utilization',
262 'overview-shortcut-title-util' => 'All upstream utilization',
263 'overview-page-title-util' => 'Upstream utilization',
265 'overview-subleave-name-ugs' => 'Active_UGS',
266 'overview-direct-link-ugs' => 'yes',
267 'overview-direct-link-view-ugs' => 'expanded-dir-html',
268 'overview-shortcut-text-ugs' => 'All UGS',
269 'overview-shortcut-title-ugs' => 'Show all UGS in one page',
270 'overview-page-title-ugs' => 'UGS Statistics'
273 $cb->addParams( $upstrNode, $param );
283 # indent-tabs-mode: nil
284 # perl-indent-level: 4