| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Cisco::SNMP::Line; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
################################################## |
|
4
|
|
|
|
|
|
|
# AUTHOR = Michael Vincent |
|
5
|
|
|
|
|
|
|
# www.VinsWorld.com |
|
6
|
|
|
|
|
|
|
################################################## |
|
7
|
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
44621
|
use strict; |
|
|
1
|
|
|
|
|
8
|
|
|
|
1
|
|
|
|
|
25
|
|
|
9
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
23
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
589
|
use Net::SNMP qw(:asn1); |
|
|
1
|
|
|
|
|
61493
|
|
|
|
1
|
|
|
|
|
209
|
|
|
12
|
1
|
|
|
1
|
|
347
|
use Cisco::SNMP; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
1874
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = $Cisco::SNMP::VERSION; |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our @ISA = qw(Cisco::SNMP); |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
################################################## |
|
19
|
|
|
|
|
|
|
# Start Public Module |
|
20
|
|
|
|
|
|
|
################################################## |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub _trmsrvOID { |
|
23
|
0
|
|
|
0
|
|
0
|
return '1.3.6.1.4.1.9.2.9'; |
|
24
|
|
|
|
|
|
|
} |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub _lineOID { |
|
27
|
0
|
|
|
0
|
|
0
|
return _trmsrvOID . '.2.1'; |
|
28
|
|
|
|
|
|
|
} |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub lineOIDs { |
|
31
|
2
|
|
|
2
|
1
|
11
|
return qw(Active Type Autobaud SpeedIn SpeedOut Flow Modem |
|
32
|
|
|
|
|
|
|
Location Term ScrLen ScrWid Esc Tmo Sestmo Rotary Uses Nses |
|
33
|
|
|
|
|
|
|
User Noise Number TimeActive); |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub _sessOID { |
|
37
|
0
|
|
|
0
|
|
0
|
return _trmsrvOID . '.3.1'; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub sessOIDs { |
|
41
|
2
|
|
|
2
|
1
|
11
|
return qw(Type Direction Address Name Current Idle Line); |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub line_clear { |
|
45
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
46
|
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
my $session = $self->{_SESSION_}; |
|
48
|
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
my %params; |
|
50
|
|
|
|
|
|
|
my %args; |
|
51
|
0
|
0
|
|
|
|
|
if ( @_ == 1 ) { |
|
52
|
0
|
|
|
|
|
|
( $params{lines} ) = @_; |
|
53
|
0
|
0
|
|
|
|
|
if (not defined( |
|
54
|
|
|
|
|
|
|
$params{lines} = Cisco::SNMP::_get_range( $params{lines} ) |
|
55
|
|
|
|
|
|
|
) |
|
56
|
|
|
|
|
|
|
) { |
|
57
|
0
|
|
|
|
|
|
return undef; |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
} else { |
|
60
|
0
|
|
|
|
|
|
%args = @_; |
|
61
|
0
|
|
|
|
|
|
for ( keys(%args) ) { |
|
62
|
0
|
0
|
0
|
|
|
|
if ( (/^-?range$/i) || (/^-?line(?:s)?$/i) ) { |
|
63
|
0
|
0
|
|
|
|
|
if (not defined( |
|
64
|
|
|
|
|
|
|
$params{lines} = Cisco::SNMP::_get_range( $args{$_} ) |
|
65
|
|
|
|
|
|
|
) |
|
66
|
|
|
|
|
|
|
) { |
|
67
|
0
|
|
|
|
|
|
return undef; |
|
68
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
|
|
73
|
0
|
0
|
|
|
|
|
if ( not defined $params{lines} ) { |
|
74
|
|
|
|
|
|
|
$params{lines} |
|
75
|
0
|
|
|
|
|
|
= Cisco::SNMP::_snmpwalk( $session, _lineOID() . '.20' ); |
|
76
|
0
|
0
|
|
|
|
|
if ( not defined $params{lines} ) { |
|
77
|
0
|
|
|
|
|
|
$Cisco::SNMP::LASTERROR = "Cannot get lines to clear"; |
|
78
|
0
|
|
|
|
|
|
return undef; |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
my @lines; |
|
83
|
0
|
|
|
|
|
|
for ( @{$params{lines}} ) { |
|
|
0
|
|
|
|
|
|
|
|
84
|
0
|
0
|
|
|
|
|
if (defined $session->set_request( _trmsrvOID . '.10.0', INTEGER, $_ ) |
|
85
|
|
|
|
|
|
|
) { |
|
86
|
0
|
|
|
|
|
|
push @lines, $_; |
|
87
|
|
|
|
|
|
|
} else { |
|
88
|
0
|
|
|
|
|
|
$Cisco::SNMP::LASTERROR = "Failed to clear line $_"; |
|
89
|
0
|
|
|
|
|
|
return undef; |
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
} |
|
92
|
0
|
|
|
|
|
|
return \@lines; |
|
93
|
|
|
|
|
|
|
} |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub line_info { |
|
96
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
97
|
0
|
|
0
|
|
|
|
my $class = ref($self) || $self; |
|
98
|
|
|
|
|
|
|
|
|
99
|
0
|
|
|
|
|
|
my $session = $self->{_SESSION_}; |
|
100
|
|
|
|
|
|
|
|
|
101
|
0
|
|
|
|
|
|
my %ret; |
|
102
|
0
|
|
|
|
|
|
my @LINEKEYS = lineOIDs(); |
|
103
|
0
|
|
|
|
|
|
for my $oid ( 0 .. $#LINEKEYS ) { |
|
104
|
0
|
|
|
|
|
|
$ret{$LINEKEYS[$oid]} = Cisco::SNMP::_snmpwalk( $session, |
|
105
|
|
|
|
|
|
|
_lineOID() . '.' . ( $oid + 1 ) ); |
|
106
|
0
|
0
|
|
|
|
|
if ( not defined $ret{$LINEKEYS[$oid]} ) { |
|
107
|
0
|
|
|
|
|
|
$Cisco::SNMP::LASTERROR |
|
108
|
|
|
|
|
|
|
= "Cannot get line `$LINEKEYS[$oid]' info"; |
|
109
|
0
|
|
|
|
|
|
return undef; |
|
110
|
|
|
|
|
|
|
} |
|
111
|
|
|
|
|
|
|
} |
|
112
|
|
|
|
|
|
|
|
|
113
|
0
|
|
|
|
|
|
my %LineTypes = ( |
|
114
|
|
|
|
|
|
|
2 => 'CON', |
|
115
|
|
|
|
|
|
|
3 => 'TRM', |
|
116
|
|
|
|
|
|
|
4 => 'LNP', |
|
117
|
|
|
|
|
|
|
5 => 'VTY', |
|
118
|
|
|
|
|
|
|
6 => 'AUX' |
|
119
|
|
|
|
|
|
|
); |
|
120
|
0
|
|
|
|
|
|
my %LineModem = ( |
|
121
|
|
|
|
|
|
|
2 => 'none', |
|
122
|
|
|
|
|
|
|
3 => 'callin', |
|
123
|
|
|
|
|
|
|
4 => 'callout', |
|
124
|
|
|
|
|
|
|
5 => 'cts-reqd', |
|
125
|
|
|
|
|
|
|
6 => 'ri-is-cd', |
|
126
|
|
|
|
|
|
|
7 => 'inout' |
|
127
|
|
|
|
|
|
|
); |
|
128
|
0
|
|
|
|
|
|
my %LineFlow = ( |
|
129
|
|
|
|
|
|
|
2 => 'none', |
|
130
|
|
|
|
|
|
|
3 => 'sw-in', |
|
131
|
|
|
|
|
|
|
4 => 'sw-out', |
|
132
|
|
|
|
|
|
|
5 => 'sw-both', |
|
133
|
|
|
|
|
|
|
6 => 'hw-in', |
|
134
|
|
|
|
|
|
|
7 => 'hw-out', |
|
135
|
|
|
|
|
|
|
8 => 'hw-both' |
|
136
|
|
|
|
|
|
|
); |
|
137
|
0
|
|
|
|
|
|
my %LineInfo; |
|
138
|
0
|
|
|
|
|
|
for my $lines ( 0 .. $#{$ret{$LINEKEYS[19]}} ) { |
|
|
0
|
|
|
|
|
|
|
|
139
|
0
|
|
|
|
|
|
my %LineInfoHash; |
|
140
|
0
|
|
|
|
|
|
for ( 0 .. $#LINEKEYS ) { |
|
141
|
0
|
0
|
|
|
|
|
if ( $_ == 1 ) { |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
$LineInfoHash{$LINEKEYS[$_]} |
|
143
|
|
|
|
|
|
|
= exists $LineTypes{$ret{$LINEKEYS[$_]}->[$lines]} |
|
144
|
|
|
|
|
|
|
? $LineTypes{$ret{$LINEKEYS[$_]}->[$lines]} |
|
145
|
0
|
0
|
|
|
|
|
: $ret{$LINEKEYS[$_]}->[$lines]; |
|
146
|
|
|
|
|
|
|
} elsif ( $_ == 5 ) { |
|
147
|
|
|
|
|
|
|
$LineInfoHash{$LINEKEYS[$_]} |
|
148
|
|
|
|
|
|
|
= exists $LineFlow{$ret{$LINEKEYS[$_]}->[$lines]} |
|
149
|
|
|
|
|
|
|
? $LineFlow{$ret{$LINEKEYS[$_]}->[$lines]} |
|
150
|
0
|
0
|
|
|
|
|
: $ret{$LINEKEYS[$_]}->[$lines]; |
|
151
|
|
|
|
|
|
|
} elsif ( $_ == 6 ) { |
|
152
|
|
|
|
|
|
|
$LineInfoHash{$LINEKEYS[$_]} |
|
153
|
|
|
|
|
|
|
= exists $LineModem{$ret{$LINEKEYS[$_]}->[$lines]} |
|
154
|
|
|
|
|
|
|
? $LineModem{$ret{$LINEKEYS[$_]}->[$lines]} |
|
155
|
0
|
0
|
|
|
|
|
: $ret{$LINEKEYS[$_]}->[$lines]; |
|
156
|
|
|
|
|
|
|
} else { |
|
157
|
0
|
|
|
|
|
|
$LineInfoHash{$LINEKEYS[$_]} = $ret{$LINEKEYS[$_]}->[$lines]; |
|
158
|
|
|
|
|
|
|
} |
|
159
|
|
|
|
|
|
|
} |
|
160
|
0
|
|
|
|
|
|
$LineInfo{$ret{$LINEKEYS[19]}->[$lines]} = \%LineInfoHash; |
|
161
|
|
|
|
|
|
|
} |
|
162
|
0
|
|
|
|
|
|
return bless \%LineInfo, $class; |
|
163
|
|
|
|
|
|
|
} |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
for ( lineOIDs() ) { |
|
166
|
|
|
|
|
|
|
Cisco::SNMP::_mk_accessors_hash_1( 'line', $_ ); |
|
167
|
|
|
|
|
|
|
} |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
sub line_sessions { |
|
170
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
171
|
0
|
|
0
|
|
|
|
my $class = ref($self) || $self; |
|
172
|
|
|
|
|
|
|
|
|
173
|
0
|
|
|
|
|
|
my $session = $self->{_SESSION_}; |
|
174
|
|
|
|
|
|
|
|
|
175
|
0
|
|
|
|
|
|
my %ret; |
|
176
|
0
|
|
|
|
|
|
my @SESSIONKEYS = sessOIDs(); |
|
177
|
0
|
|
|
|
|
|
for my $oid ( 0 .. $#SESSIONKEYS ) { |
|
178
|
0
|
|
|
|
|
|
$ret{$SESSIONKEYS[$oid]} = Cisco::SNMP::_snmpwalk( $session, |
|
179
|
|
|
|
|
|
|
_sessOID() . '.' . ( $oid + 1 ) ); |
|
180
|
0
|
0
|
|
|
|
|
if ( not defined $ret{$SESSIONKEYS[$oid]} ) { |
|
181
|
0
|
|
|
|
|
|
$Cisco::SNMP::LASTERROR |
|
182
|
|
|
|
|
|
|
= "Cannot get session `$SESSIONKEYS[$oid]' info"; |
|
183
|
0
|
|
|
|
|
|
return undef; |
|
184
|
|
|
|
|
|
|
} |
|
185
|
|
|
|
|
|
|
} |
|
186
|
|
|
|
|
|
|
|
|
187
|
0
|
|
|
|
|
|
my %SessionTypes = ( |
|
188
|
|
|
|
|
|
|
1 => 'unknown', |
|
189
|
|
|
|
|
|
|
2 => 'PAD', |
|
190
|
|
|
|
|
|
|
3 => 'stream', |
|
191
|
|
|
|
|
|
|
4 => 'rlogin', |
|
192
|
|
|
|
|
|
|
5 => 'telnet', |
|
193
|
|
|
|
|
|
|
6 => 'TCP', |
|
194
|
|
|
|
|
|
|
7 => 'LAT', |
|
195
|
|
|
|
|
|
|
8 => 'MOP', |
|
196
|
|
|
|
|
|
|
9 => 'SLIP', |
|
197
|
|
|
|
|
|
|
10 => 'XRemote', |
|
198
|
|
|
|
|
|
|
11 => 'rshell' |
|
199
|
|
|
|
|
|
|
); |
|
200
|
0
|
|
|
|
|
|
my %SessionDir = ( |
|
201
|
|
|
|
|
|
|
1 => 'unknown', |
|
202
|
|
|
|
|
|
|
2 => 'IN', |
|
203
|
|
|
|
|
|
|
3 => 'OUT' |
|
204
|
|
|
|
|
|
|
); |
|
205
|
0
|
|
|
|
|
|
my %SessionInfo; |
|
206
|
0
|
|
|
|
|
|
for my $sess ( 0 .. $#{$ret{$SESSIONKEYS[6]}} ) { |
|
|
0
|
|
|
|
|
|
|
|
207
|
0
|
|
|
|
|
|
my %SessionInfoHash; |
|
208
|
0
|
|
|
|
|
|
for ( 0 .. $#SESSIONKEYS ) { |
|
209
|
0
|
0
|
|
|
|
|
if ( $_ == 0 ) { |
|
|
|
0
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
$SessionInfoHash{$SESSIONKEYS[$_]} |
|
211
|
|
|
|
|
|
|
= exists( $SessionTypes{$ret{$SESSIONKEYS[$_]}->[$sess]} ) |
|
212
|
|
|
|
|
|
|
? $SessionTypes{$ret{$SESSIONKEYS[$_]}->[$sess]} |
|
213
|
0
|
0
|
|
|
|
|
: $ret{$SESSIONKEYS[$_]}->[$sess]; |
|
214
|
|
|
|
|
|
|
} elsif ( $_ == 1 ) { |
|
215
|
|
|
|
|
|
|
$SessionInfoHash{$SESSIONKEYS[$_]} |
|
216
|
|
|
|
|
|
|
= exists( $SessionDir{$ret{$SESSIONKEYS[$_]}->[$sess]} ) |
|
217
|
|
|
|
|
|
|
? $SessionDir{$ret{$SESSIONKEYS[$_]}->[$sess]} |
|
218
|
0
|
0
|
|
|
|
|
: $ret{$SESSIONKEYS[$_]}->[$sess]; |
|
219
|
|
|
|
|
|
|
} else { |
|
220
|
|
|
|
|
|
|
$SessionInfoHash{$SESSIONKEYS[$_]} |
|
221
|
0
|
|
|
|
|
|
= $ret{$SESSIONKEYS[$_]}->[$sess]; |
|
222
|
|
|
|
|
|
|
} |
|
223
|
|
|
|
|
|
|
} |
|
224
|
0
|
|
|
|
|
|
push @{$SessionInfo{$ret{$SESSIONKEYS[6]}->[$sess]}}, |
|
|
0
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
\%SessionInfoHash; |
|
226
|
|
|
|
|
|
|
} |
|
227
|
0
|
|
|
|
|
|
return bless \%SessionInfo, $class; |
|
228
|
|
|
|
|
|
|
} |
|
229
|
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
for ( sessOIDs() ) { |
|
231
|
|
|
|
|
|
|
Cisco::SNMP::_mk_accessors_hash_2( 'line', 'sess', $_ ); |
|
232
|
|
|
|
|
|
|
} |
|
233
|
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
sub line_message { |
|
235
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
236
|
|
|
|
|
|
|
|
|
237
|
0
|
|
|
|
|
|
my $session = $self->{_SESSION_}; |
|
238
|
|
|
|
|
|
|
|
|
239
|
0
|
|
|
|
|
|
my %params = ( |
|
240
|
|
|
|
|
|
|
message => 'Test Message.', |
|
241
|
|
|
|
|
|
|
lines => [-1] |
|
242
|
|
|
|
|
|
|
); |
|
243
|
|
|
|
|
|
|
|
|
244
|
0
|
|
|
|
|
|
my %args; |
|
245
|
0
|
0
|
|
|
|
|
if ( @_ == 1 ) { |
|
246
|
0
|
|
|
|
|
|
( $params{message} ) = @_; |
|
247
|
|
|
|
|
|
|
} else { |
|
248
|
0
|
|
|
|
|
|
%args = @_; |
|
249
|
0
|
|
|
|
|
|
for ( keys(%args) ) { |
|
250
|
0
|
0
|
|
|
|
|
if (/^-?message$/i) { |
|
|
|
0
|
|
|
|
|
|
|
251
|
0
|
|
|
|
|
|
$params{message} = $args{$_}; |
|
252
|
|
|
|
|
|
|
} elsif (/^-?line(?:s)?$/i) { |
|
253
|
0
|
0
|
|
|
|
|
if (not defined( |
|
254
|
|
|
|
|
|
|
$params{lines} = Cisco::SNMP::_get_range( $args{$_} ) |
|
255
|
|
|
|
|
|
|
) |
|
256
|
|
|
|
|
|
|
) { |
|
257
|
0
|
|
|
|
|
|
return undef; |
|
258
|
|
|
|
|
|
|
} |
|
259
|
|
|
|
|
|
|
} |
|
260
|
|
|
|
|
|
|
} |
|
261
|
|
|
|
|
|
|
} |
|
262
|
|
|
|
|
|
|
|
|
263
|
0
|
|
|
|
|
|
my $response; |
|
264
|
|
|
|
|
|
|
my @lines; |
|
265
|
0
|
|
|
|
|
|
for ( @{$params{lines}} ) { |
|
|
0
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
# Lines |
|
268
|
0
|
|
|
|
|
|
my $response |
|
269
|
|
|
|
|
|
|
= $session->set_request( _trmsrvOID() . '.4.0', INTEGER, $_ ); |
|
270
|
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
# Interval (reissue) |
|
272
|
0
|
|
|
|
|
|
$response |
|
273
|
|
|
|
|
|
|
= $session->set_request( _trmsrvOID() . '.5.0', INTEGER, 0 ); |
|
274
|
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
# Duration |
|
276
|
0
|
|
|
|
|
|
$response |
|
277
|
|
|
|
|
|
|
= $session->set_request( _trmsrvOID() . '.6.0', INTEGER, 0 ); |
|
278
|
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
# Text (256 chars) |
|
280
|
|
|
|
|
|
|
$response = $session->set_request( _trmsrvOID() . '.7.0', |
|
281
|
0
|
|
|
|
|
|
OCTET_STRING, $params{message} ); |
|
282
|
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
# Temp Banner (1=no 2=append) |
|
284
|
0
|
|
|
|
|
|
$response |
|
285
|
|
|
|
|
|
|
= $session->set_request( _trmsrvOID() . '.8.0', INTEGER, 1 ); |
|
286
|
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
# Send |
|
288
|
0
|
|
|
|
|
|
$response |
|
289
|
|
|
|
|
|
|
= $session->set_request( _trmsrvOID() . '.9.0', INTEGER, 1 ); |
|
290
|
0
|
0
|
|
|
|
|
if ( defined $response ) { |
|
291
|
0
|
|
|
|
|
|
push @lines, $_; |
|
292
|
|
|
|
|
|
|
} else { |
|
293
|
0
|
|
|
|
|
|
$Cisco::SNMP::LASTERROR = "Failed to send message to line $_"; |
|
294
|
0
|
|
|
|
|
|
return undef; |
|
295
|
|
|
|
|
|
|
} |
|
296
|
|
|
|
|
|
|
} |
|
297
|
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
# clear message |
|
299
|
0
|
|
|
|
|
|
$session->set_request( _trmsrvOID() . '.7.0', OCTET_STRING, "" ); |
|
300
|
0
|
0
|
|
|
|
|
if ( $lines[0] == -1 ) { $lines[0] = "ALL" } |
|
|
0
|
|
|
|
|
|
|
|
301
|
0
|
|
|
|
|
|
return \@lines; |
|
302
|
|
|
|
|
|
|
} |
|
303
|
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
sub line_numberof { |
|
305
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
306
|
|
|
|
|
|
|
|
|
307
|
0
|
|
|
|
|
|
my $session = $self->{_SESSION_}; |
|
308
|
|
|
|
|
|
|
|
|
309
|
0
|
|
|
|
|
|
my $response; |
|
310
|
0
|
0
|
|
|
|
|
if (not defined( |
|
311
|
|
|
|
|
|
|
$response |
|
312
|
|
|
|
|
|
|
= $session->get_request( -varbindlist => [_trmsrvOID . '.1.0'] ) |
|
313
|
|
|
|
|
|
|
) |
|
314
|
|
|
|
|
|
|
) { |
|
315
|
0
|
|
|
|
|
|
$Cisco::SNMP::LASTERROR = "Cannot get number of lines"; |
|
316
|
0
|
|
|
|
|
|
return undef; |
|
317
|
|
|
|
|
|
|
} else { |
|
318
|
0
|
|
|
|
|
|
return $response->{_trmsrvOID() . '.1.0'}; |
|
319
|
|
|
|
|
|
|
} |
|
320
|
|
|
|
|
|
|
} |
|
321
|
|
|
|
|
|
|
|
|
322
|
1
|
|
|
1
|
|
11
|
no strict 'refs'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
270
|
|
|
323
|
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
# get_ direct |
|
325
|
|
|
|
|
|
|
my @OIDS = lineOIDs(); |
|
326
|
|
|
|
|
|
|
for my $o ( 0 .. $#OIDS ) { |
|
327
|
|
|
|
|
|
|
*{"get_line" . $OIDS[$o]} = sub { |
|
328
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
329
|
0
|
|
|
|
|
|
my ($val) = @_; |
|
330
|
|
|
|
|
|
|
|
|
331
|
0
|
0
|
|
|
|
|
if ( not defined $val ) { $val = 0 } |
|
|
0
|
|
|
|
|
|
|
|
332
|
0
|
|
|
|
|
|
my $s = $self->session; |
|
333
|
0
|
|
|
|
|
|
my $r = $s->get_request( |
|
334
|
|
|
|
|
|
|
varbindlist => [_lineOID() . '.' . ( $o + 1 ) . '.' . $val] ); |
|
335
|
0
|
|
|
|
|
|
return $r->{_lineOID() . '.' . ( $o + 1 ) . '.' . $val}; |
|
336
|
|
|
|
|
|
|
} |
|
337
|
|
|
|
|
|
|
} |
|
338
|
|
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
@OIDS = sessOIDs(); |
|
340
|
|
|
|
|
|
|
for my $o ( 0 .. $#OIDS ) { |
|
341
|
|
|
|
|
|
|
*{"get_sess" . $OIDS[$o]} = sub { |
|
342
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
343
|
0
|
|
|
|
|
|
my ( $val1, $val2 ) = @_; |
|
344
|
|
|
|
|
|
|
|
|
345
|
0
|
0
|
|
|
|
|
if ( not defined $val1 ) { $val1 = 0 } |
|
|
0
|
|
|
|
|
|
|
|
346
|
0
|
0
|
|
|
|
|
if ( not defined $val2 ) { $val2 = 0 } |
|
|
0
|
|
|
|
|
|
|
|
347
|
0
|
|
|
|
|
|
my $s = $self->session; |
|
348
|
0
|
|
|
|
|
|
my $r = $s->get_request( varbindlist => |
|
349
|
|
|
|
|
|
|
[_sessOID() . '.' . ( $o + 1 ) . '.' . "$val1.$val2"] ); |
|
350
|
0
|
|
|
|
|
|
return $r->{_sessOID() . '.' . ( $o + 1 ) . '.' . "$val1.$val2"}; |
|
351
|
|
|
|
|
|
|
} |
|
352
|
|
|
|
|
|
|
} |
|
353
|
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
################################################## |
|
355
|
|
|
|
|
|
|
# End Public Module |
|
356
|
|
|
|
|
|
|
################################################## |
|
357
|
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
1; |
|
359
|
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
__END__ |