import torrus 1.0.9
[freeside.git] / torrus / perllib / Torrus / Collector / SNMP_Params.pm
1 #  Copyright (C) 2002  Stanislav Sinyagin
2 #
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.
7 #
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.
12 #
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.
16
17 # $Id: SNMP_Params.pm,v 1.1 2010-12-27 00:03:57 ivan Exp $
18 # Stanislav Sinyagin <ssinyagin@yahoo.com>
19
20 package Torrus::Collector::SNMP_Params;
21
22 ###  Initialize the configuration validator with module-specific parameters
23 ###  Moved to a separate module to speed up the compiler initialization
24
25 my %validatorLeafParams =
26     (
27      'snmp-ipversion'     => {'4'   => undef, '6'   => undef},
28      'snmp-transport'     => {'udp' => undef, 'tcp' => undef},
29      'snmp-host'          => undef,
30      'snmp-port'          => undef,
31      '+snmp-localaddr'    => undef,
32      '+snmp-localport'    => undef,
33      '+domain-name'       => undef,     
34      'snmp-object'        => undef,
35      'snmp-version'       => { '1'  => { 'snmp-community'     => undef },
36                                '2c' => { 'snmp-community'     => undef },
37                                '3'  => {
38                                    'snmp-username' => undef,
39                                    '+snmp-authkey' => undef,
40                                    '+snmp-authpassword' => undef,
41                                    '+snmp-authprotocol' => {
42                                        'md5' => undef,
43                                        'sha' => undef },
44                                    '+snmp-privkey' => undef,
45                                    '+snmp-privpassword' => undef,
46                                    '+snmp-privprotocol' => {
47                                        'des'       => undef,
48                                        'aes128cfb' => undef,
49                                        '3desede'   => undef } } },
50      'snmp-timeout'       => undef,
51      'snmp-retries'       => undef,
52      'snmp-oids-per-pdu'  => undef,
53      '+snmp-object-type'  => { 'OTHER'     => undef,
54                                'COUNTER64' => undef },
55      '+snmp-check-sysuptime' => { 'yes' => undef,
56                                    'no'  => undef },
57      '+snmp-max-msg-size' => undef,
58      '+snmp-ignore-mib-errors' => undef,
59      );
60
61 sub initValidatorLeafParams
62 {
63     my $hashref = shift;
64     $hashref->{'ds-type'}{'collector'}{'collector-type'}{'snmp'} =
65         \%validatorLeafParams;
66 }
67
68
69 my %admInfoLeafParams =
70     (
71      'snmp-ipversion'     => undef,
72      'snmp-transport'     => undef,
73      'snmp-host'          => undef,
74      'snmp-port'          => undef,
75      'snmp-localaddr'     => undef,
76      'snmp-localport'     => undef,
77      'domain-name'        => undef,
78      'snmp-community'     => undef,
79      'snmp-username'      => undef,
80      'snmp-authkey'       => undef,
81      'snmp-authpassword'  => undef,
82      'snmp-authprotocol'  => undef,
83      'snmp-privkey'       => undef,
84      'snmp-privpassword'  => undef,
85      'snmp-privprotocol'  => undef,
86      'snmp-object'        => undef,
87      'snmp-version'       => undef,
88      'snmp-timeout'       => undef,
89      'snmp-retries'       => undef,
90      'snmp-oids-per-pdu'  => undef,
91      'snmp-object-type'   => undef,
92      'snmp-check-sysuptime' => undef,
93      'snmp-max-msg-size' => undef,
94      'snmp-ignore-mib-errors' => undef,
95      );
96
97
98 my %admInfoParamCategories =
99     (
100      'snmp-ipversion'     => 'SNMP',
101      'snmp-transport'     => 'SNMP',
102      'snmp-host'          => 'SNMP',
103      'snmp-port'          => 'SNMP',
104      'snmp-localaddr'     => 'SNMP',
105      'snmp-localport'     => 'SNMP',
106      'domain-name'        => 'SNMP',
107      'snmp-community'     => 'SNMP',
108      'snmp-username'      => 'SNMP',
109      'snmp-authkey'       => 'SNMP',
110      'snmp-authpassword'  => 'SNMP',
111      'snmp-authprotocol'  => 'SNMP',
112      'snmp-privkey'       => 'SNMP',
113      'snmp-privpassword'  => 'SNMP',
114      'snmp-privprotocol'  => 'SNMP',     
115      'snmp-object'        => 'SNMP',
116      'snmp-version'       => 'SNMP',
117      'snmp-timeout'       => 'SNMP',
118      'snmp-retries'       => 'SNMP',
119      'snmp-oids-per-pdu'  => 'SNMP',
120      'snmp-object-type'   => 'SNMP',
121      'snmp-check-sysuptime' => 'SNMP',
122      'snmp-max-msg-size'  => 'SNMP',
123      'snmp-ignore-mib-errors' => 'SNMP'
124      );
125
126
127 sub initAdmInfo
128 {
129     my $map = shift;
130     my $categories = shift;
131     
132     $map->{'ds-type'}{'collector'}{'collector-type'}{'snmp'} =
133         \%admInfoLeafParams;
134     
135     while( ($pname, $category) = each %admInfoParamCategories )
136     {
137         $categories->{$pname} = $category;
138     }
139 }
140
141
142 1;
143
144
145 # Local Variables:
146 # mode: perl
147 # indent-tabs-mode: nil
148 # perl-indent-level: 4
149 # End: