| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Router::Statistics; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
50962
|
use strict; |
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
5892
|
|
|
4
|
1
|
|
|
1
|
|
757
|
use Router::Statistics::OID; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
32
|
|
|
5
|
1
|
|
|
1
|
|
931
|
use Time::localtime; |
|
|
1
|
|
|
|
|
21425
|
|
|
|
1
|
|
|
|
|
152
|
|
|
6
|
1
|
|
|
1
|
|
1853
|
use Net::SNMP qw (:snmp :asn1); |
|
|
1
|
|
|
|
|
101119
|
|
|
|
1
|
|
|
|
|
621
|
|
|
7
|
1
|
|
|
1
|
|
2038
|
use Net::Telnet; |
|
|
1
|
|
|
|
|
64945
|
|
|
|
1
|
|
|
|
|
58
|
|
|
8
|
1
|
|
|
1
|
|
972
|
use MIME::Base64; |
|
|
1
|
|
|
|
|
807
|
|
|
|
1
|
|
|
|
|
57
|
|
|
9
|
1
|
|
|
1
|
|
5345
|
use IO::Select; |
|
|
1
|
|
|
|
|
1810
|
|
|
|
1
|
|
|
|
|
52
|
|
|
10
|
1
|
|
|
1
|
|
6
|
use IO::Socket; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
11
|
|
|
11
|
1
|
|
|
1
|
|
1819
|
use IO::File; |
|
|
1
|
|
|
|
|
2515
|
|
|
|
1
|
|
|
|
|
47437
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 NAME |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Router::Statistics - Router Statistics and Information Collection |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 VERSION |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
Version 0.99_989 |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=cut |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
our $VERSION = '0.99_989'; |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Router Statistics and Information Colleciton. Currently this covers a |
|
28
|
|
|
|
|
|
|
multitude of areas from different types of routers and in a future release |
|
29
|
|
|
|
|
|
|
this will change. There are some 'action' functions within this module which |
|
30
|
|
|
|
|
|
|
do need moving to another module so no complaining too much, please. |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
The following examples shows how to setup the module to retrieve interface |
|
33
|
|
|
|
|
|
|
statistics from routers that support the standard IFMIB. All the work about |
|
34
|
|
|
|
|
|
|
OIDs etc is taken care of by the module so you are left with a hash tree, rooted |
|
35
|
|
|
|
|
|
|
by the router IPs information was received for. |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
use Router::Statistics; |
|
38
|
|
|
|
|
|
|
use strict; |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
my ( $result, $statistics ); |
|
41
|
|
|
|
|
|
|
my ( %routers, %interfaces ); |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
$statistics = new Router::Statistics(); |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
$result = $statistics->Router_Add( "10.1.1.1" , "public" ); |
|
46
|
|
|
|
|
|
|
$result = $statistics->Router_Ready_Blocking( "10.1.1.1" ); |
|
47
|
|
|
|
|
|
|
.... |
|
48
|
|
|
|
|
|
|
$result = $statistics->Router_Add( "10.1.1.200" , "public" ); |
|
49
|
|
|
|
|
|
|
$result = $statistics->Router_Ready_Blocking( "10.1.1.200" ); |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
$result = $statistics->Router_Test_Connection_Blocking(\%routers); |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
if ( !%routers ) |
|
54
|
|
|
|
|
|
|
{ print "No access to Any of the Routers specified.\n";exit(0); } |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
$result = $statistics->Router_get_interfaces_Blocking( \%interfaces ); |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
foreach my $router ( keys %interfaces ) |
|
59
|
|
|
|
|
|
|
{ |
|
60
|
|
|
|
|
|
|
print "Router IP is '$router'\n"; |
|
61
|
|
|
|
|
|
|
print "Router Hostname is '$routers{$router}{'hostName'}'\n"; |
|
62
|
|
|
|
|
|
|
foreach my $interface ( keys %{$interfaces{$router}} ) |
|
63
|
|
|
|
|
|
|
{ |
|
64
|
|
|
|
|
|
|
print "Interface ID '$interface'\n"; |
|
65
|
|
|
|
|
|
|
print "Interface Description '$interfaces{$ubr}{$interface}{'ifDescr'}'\n"; |
|
66
|
|
|
|
|
|
|
print "Interface ifType '$interfaces{$ubr}{$interface}{'ifType'}'\n"; |
|
67
|
|
|
|
|
|
|
print "Interface ifMtu '$interfaces{$ubr}{$interface}{'ifMtu'}'\n"; |
|
68
|
|
|
|
|
|
|
print "Interface ifSpeed '$interfaces{$ubr}{$interface}{'ifSpeed'}'\n"; |
|
69
|
|
|
|
|
|
|
print "Interface ifPhysAddress '$interfaces{$ubr}{$interface}{'ifPhysAddress'}'\n"; |
|
70
|
|
|
|
|
|
|
print "Interface ifOperStatus '$interfaces{$ubr}{$interface}{'ifOperStatus'}'\n"; |
|
71
|
|
|
|
|
|
|
print "Interface ifInOctets '$interfaces{$ubr}{$interface}{'ifInOctets'}'\n"; |
|
72
|
|
|
|
|
|
|
print "Interface ifInUcastPkts '$interfaces{$ubr}{$interface}{'ifInUcastPkts'}'\n"; |
|
73
|
|
|
|
|
|
|
print "Interface ifInNUcastPkts '$interfaces{$ubr}{$interface}{'ifInNUcastPkts'}'\n"; |
|
74
|
|
|
|
|
|
|
print "Interface ifInDiscards '$interfaces{$ubr}{$interface}{'ifInDiscards'}'\n"; |
|
75
|
|
|
|
|
|
|
print "Interface ifInErrors '$interfaces{$ubr}{$interface}{'ifInErrors'}'\n"; |
|
76
|
|
|
|
|
|
|
print "Interface ifInUnknownProtos '$interfaces{$ubr}{$interface}{'ifInUnknownProtos'}'\n"; |
|
77
|
|
|
|
|
|
|
print "Interface ifOutOctets '$interfaces{$ubr}{$interface}{'ifOutOctets'}'\n"; |
|
78
|
|
|
|
|
|
|
print "Interface ifOutUcastPkts '$interfaces{$ubr}{$interface}{'ifOutUcastPkts'}'\n"; |
|
79
|
|
|
|
|
|
|
print "Interface ifOutNUcastPkts '$interfaces{$ubr}{$interface}{'ifOutNUcastPkts'}'\n"; |
|
80
|
|
|
|
|
|
|
print "Interface ifOutDiscards '$interfaces{$ubr}{$interface}{'ifOutDiscards'}'\n"; |
|
81
|
|
|
|
|
|
|
print "Interface ifOutErrors '$interfaces{$ubr}{$interface}{'ifOutErrors'}'\n"; |
|
82
|
|
|
|
|
|
|
print "\n"; |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
I am currently in need of access to alternative vendor routers, ie. anyone but Cisco ( ABC ) as I only |
|
87
|
|
|
|
|
|
|
have real access to Cisco equipment so this code can not be confirmed 100% against anyone else. |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
I would also like to expand the library to cover other actions , rather than just DOCSIS functions, which |
|
90
|
|
|
|
|
|
|
is the primary action focus at the moment. |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
The module current has two(2) global variables that can be set when creating the object the first DEBUG |
|
93
|
|
|
|
|
|
|
turns on all the debug output, the second, STM_Safety_Limit, allows you to change the STM safety margin |
|
94
|
|
|
|
|
|
|
by subtracting the number (minutes) specified from the end time. This is also settable in the STM functions |
|
95
|
|
|
|
|
|
|
but only if you are also using an enable password. |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
An example of how to use them is |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
$statistics = new Router::Statistics( |
|
100
|
|
|
|
|
|
|
[ |
|
101
|
|
|
|
|
|
|
DEBUG => 1, |
|
102
|
|
|
|
|
|
|
STM_Safety_Limit => 10 |
|
103
|
|
|
|
|
|
|
] |
|
104
|
|
|
|
|
|
|
); |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
This would turn on debug and set the safety marging to 10 minutes. The default safety marging is 15 minutes. |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 FUNCTIONS |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=item C<< Router_Add >> |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
This function adds a Router IP, Community String and Timeout to the internal list of usable routers. It |
|
113
|
|
|
|
|
|
|
does not initialise any SNMP functionality at this stage. If no timeout is specified 2 seconds is |
|
114
|
|
|
|
|
|
|
the default. |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Router_Add ( "", "", ); |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Example of Use |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
my $result = $test->Router_Add( "10.1.1.1" , "public" ); |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
is the same as this |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
my $result = $test->Router_Add( "10.1.1.1" , "public" , 2 ); |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=item C<< Router_Remove >> |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
The function removes a Router IP from the internal list of usable router. If there is an open |
|
129
|
|
|
|
|
|
|
SNMP session, it is closed. |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
Example of Use |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
my $result = $test->Router_Remove ( "10.1.1.1" ); |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=item C<< Router_Remove_All >> |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
The function removes ALL Router IPs from the internal list of usable router. If there is an open |
|
138
|
|
|
|
|
|
|
SNMP session, it is closed. |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
Example of Use |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
my $result = $test->Router_Remove_All ( ); |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
The function was added so you can switch between blocking and non-blocking objects quickly and |
|
145
|
|
|
|
|
|
|
without the need to manually delete any routers already setup. |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=item C<< Router_Ready >> |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
This function sets up the SNMP session object for the IP specified. This is for the non |
|
150
|
|
|
|
|
|
|
blocking function set. |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
Example of Use |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
my $result = $test->Router_Ready ( "10.1.1.1" ); |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=item C<< Router_Ready_Blocking >> |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
This function sets up the SNMP session object for the IP specified. This is for the |
|
159
|
|
|
|
|
|
|
blocking function set. |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
Example of Use |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
my $result = $test->Router_Ready_Blocking ( "10.1.1.1" ); |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=item C<< Router_Test_Connection >> |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
This function sends requests for sysUpTime, hostName and sysDescr SNMP variables and |
|
168
|
|
|
|
|
|
|
if successful populates a given hash pointer rooted by the IP of the routers specified. |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
If the router is not reachable the SNMP session is destroyed ( created by Router_Ready ) |
|
171
|
|
|
|
|
|
|
and thus not polled for information when other functions are called. |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
Example of Use |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
my %routers; |
|
176
|
|
|
|
|
|
|
my $result = $test->Router_Test_Connection(\%routers); |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=item C<< Router_Test_Connection_Blocking >> |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
This function sends requests for sysUpTime, hostName and sysDescr SNMP variables and |
|
181
|
|
|
|
|
|
|
if successful populates a given hash pointer rooted by the IP of the routers specified. |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
This is the Blocking mirror to the Router_Test_Connection function |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
Example of Use |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
my %routers; |
|
188
|
|
|
|
|
|
|
my $result = $test->Router_Test_Connection_Blocking(\%routers); |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=item C<< Router_Return_All >> |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
This function returns a hash with all the current Routers which were added with Router_Add. |
|
193
|
|
|
|
|
|
|
There is little reason to call this function in your own routines and may be move to an |
|
194
|
|
|
|
|
|
|
internal view. |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
Example of Use |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
my %routers = $test->Router_Return_All(); |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=item C<< Router_get_networks >> |
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
No detail given. |
|
203
|
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
=item C<< Router_get_interfaces >> |
|
205
|
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
This function returns the following for each interface found on the router in 32bit mode. |
|
207
|
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
ifDescr ifType ifMtu ifSpeed ifPhysAddress ifAdminStatus ifOperStatus ifLastChange |
|
209
|
|
|
|
|
|
|
ifInOctets ifInUcastPkts ifInNUcastPkts ifInDiscards ifInErrors ifInUnknownProtos |
|
210
|
|
|
|
|
|
|
ifOutOctets ifOutUcastPkts ifOutNUcastPkts ifOutDiscards ifOutErrors ifAlias |
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
you can specify 64Bit when calling this function and it will then get and return |
|
213
|
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
ifName ifInMulticastPkts ifInBroadcastPkts ifOutMulticastPkts ifOutBroadcastPkts |
|
215
|
|
|
|
|
|
|
ifHCInOctets ifHCInUcastPkts ifHCInMulticastPkts ifHCInBroadcastPkts ifHCOutOctets |
|
216
|
|
|
|
|
|
|
ifHCOutUcastPkts ifHCOutMulticastPkts ifHCOutBroadcastPkts ifLinkUpDownTrapEnable |
|
217
|
|
|
|
|
|
|
ifHighSpeed ifPromiscuousMode ifConnectorPresent ifAlias ifCounterDiscontinuityTime |
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
The data is returned in a structured hash as follows |
|
220
|
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
Router IP Address |
|
222
|
|
|
|
|
|
|
Interface Instance Number |
|
223
|
|
|
|
|
|
|
Interface Attribute ie. ifDescr |
|
224
|
|
|
|
|
|
|
Interface Attribute ie. ifType |
|
225
|
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
Example of Use |
|
227
|
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
my %interface_information; |
|
229
|
|
|
|
|
|
|
my $test = $test->Router_get_interfaces( \%interface_information, "32Bit" ); |
|
230
|
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
You can omit 32Bit as it is 32Bit by default, but is shown for clarity here. |
|
232
|
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
=item C<< Router_get_interfaces_Blocking >> |
|
234
|
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
This function returns the following for each interface found on the router and is the |
|
236
|
|
|
|
|
|
|
blocking mirror to the Router_get_interfaces function |
|
237
|
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
This function returns the following for each interface found on the router |
|
239
|
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
ifDescr ifType ifMtu ifSpeed ifPhysAddress ifAdminStatus ifOperStatus ifLastChange |
|
241
|
|
|
|
|
|
|
ifInOctets ifInUcastPkts ifInNUcastPkts ifInDiscards ifInErrors ifInUnknownProtos |
|
242
|
|
|
|
|
|
|
ifOutOctets ifOutUcastPkts ifOutNUcastPkts ifOutDiscards ifOutErrors ifAlias |
|
243
|
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
you can specify 64Bit when calling this function and it will then get and return |
|
245
|
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
ifName ifInMulticastPkts ifInBroadcastPkts ifOutMulticastPkts ifOutBroadcastPkts |
|
247
|
|
|
|
|
|
|
ifHCInOctets ifHCInUcastPkts ifHCInMulticastPkts ifHCInBroadcastPkts ifHCOutOctets |
|
248
|
|
|
|
|
|
|
ifHCOutUcastPkts ifHCOutMulticastPkts ifHCOutBroadcastPkts ifLinkUpDownTrapEnable |
|
249
|
|
|
|
|
|
|
ifHighSpeed ifPromiscuousMode ifConnectorPresent ifAlias ifCounterDiscontinuityTime |
|
250
|
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
The data is returned in a structured hash as follows |
|
252
|
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
Router IP Address |
|
254
|
|
|
|
|
|
|
Interface Instance Number |
|
255
|
|
|
|
|
|
|
Interface Attribute ie. ifDescr |
|
256
|
|
|
|
|
|
|
Interface Attribute ie. ifType |
|
257
|
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
Example of Use |
|
259
|
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
my %interface_information; |
|
261
|
|
|
|
|
|
|
my $test = $test->Router_get_interfaces_Blocking( \%interface_information, "32Bit" ); |
|
262
|
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
You can omit 32Bit as it is 32Bit by default, but is shown for clarity here. |
|
264
|
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
=item C<< CPE_Add >> |
|
266
|
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
This function adds a CPE IP, Community String and Timeout to the internal list of CPEs that can |
|
268
|
|
|
|
|
|
|
be polled for information. All CPE polling is non blocking and also currently requires a unique ID. |
|
269
|
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
It is possible to specify multiple community strings and these will be used in turn should |
|
271
|
|
|
|
|
|
|
no response be received, until no more can be tried. |
|
272
|
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
CPE_Add ( "", "", "", "", ); |
|
274
|
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
Example of Use |
|
276
|
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
my $result = $test->CPE_Add( "10.1.2.100" , "public,testing,hello","10.1.1.1","dr3423d3",2 ); |
|
278
|
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
=item C<< CPE_Remove >> |
|
280
|
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
The function removes a CPE from the internal list of usable CPEs. If there is an open |
|
282
|
|
|
|
|
|
|
SNMP session, it is closed. |
|
283
|
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
CPE_Remove ("") |
|
285
|
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
Example of Use |
|
287
|
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
my $result = $test->CPE_Remove ( "10.1.2.100" ); |
|
289
|
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
=item C<< CPE_Ready >> |
|
291
|
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
This function sets up the SNMP session object for the CPE IP specified. This is for the non |
|
293
|
|
|
|
|
|
|
blocking function set. (CPE functions do not have non-blocking counterparts) |
|
294
|
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
CPE_Ready ("", [ array containing OIDs of the SNMP variables to get ] ) |
|
296
|
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
Example of Use |
|
298
|
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
my $result = $test-> CPE_Ready ( |
|
300
|
|
|
|
|
|
|
"10.1.2.100", |
|
301
|
|
|
|
|
|
|
[ 1.3.6.1.2.1.1.3.0 , 1.3.6.1.2.1.1.1.0 ] ); |
|
302
|
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
This would retrieve sysUptime and sysDescr for the CPE when the collection functions are |
|
304
|
|
|
|
|
|
|
called. You can of course use the references in the OID module provided with this module so |
|
305
|
|
|
|
|
|
|
you can use names instead of OIDs. |
|
306
|
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
=item C<< CPE_Return_All >> |
|
308
|
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
No detail given. |
|
310
|
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
=item C<< CPE_export_import_fields >> |
|
312
|
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
No detail given. |
|
314
|
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
=item C<< CPE_export_fields >> |
|
316
|
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
No detail given. |
|
318
|
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
=item C<< CPE_export_schema >> |
|
320
|
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
No detail given. |
|
322
|
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
=item C<< CPE_export_data_start >> |
|
324
|
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
No detail given. |
|
326
|
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
=item C<< CPE_export_data_end >> |
|
328
|
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
No detail given. |
|
330
|
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
=item C<< CPE_export_data >> |
|
332
|
|
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
No detail given. |
|
334
|
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
=item C<< CPE_gather_all_data_walk >> |
|
336
|
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
No detail given. |
|
338
|
|
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
=item C<< CPE_gather_all_data >> |
|
340
|
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
This function attempts to collect the CPE data previously configured with CPE_Ready. The |
|
342
|
|
|
|
|
|
|
function attempts to use non blocking functionality to do this as quickly as possible, |
|
343
|
|
|
|
|
|
|
however the more OIDs to collect per CPE the longer it will take. |
|
344
|
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
Preliminary testing shows the 5000 CPE devices can be polled, with 4 OIDs each, in 45 |
|
346
|
|
|
|
|
|
|
seconds, making it relatively painless when polling large scale networks. |
|
347
|
|
|
|
|
|
|
|
|
348
|
|
|
|
|
|
|
When using this function and using multiple community strings will cause a significant |
|
349
|
|
|
|
|
|
|
slowing of performance. |
|
350
|
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
The function requires a pointer to a hash |
|
352
|
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
CPE_gather_all_data ( ) |
|
354
|
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
Example of Use |
|
356
|
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
my $result = $test-> CPE_gather_all_data ( |
|
358
|
|
|
|
|
|
|
\%cpe_data |
|
359
|
|
|
|
|
|
|
); |
|
360
|
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
The result is rooted by the unique ID and contains the OIDs, converted to name, |
|
362
|
|
|
|
|
|
|
with their results. If the CPE is NOT in this hash then it was not successfully |
|
363
|
|
|
|
|
|
|
contacted. |
|
364
|
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
CPE Hash |
|
366
|
|
|
|
|
|
|
-- Unique ID |
|
367
|
|
|
|
|
|
|
-- OID (converted to name) |
|
368
|
|
|
|
|
|
|
-- OID (converted to name) |
|
369
|
|
|
|
|
|
|
-- etc |
|
370
|
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
=item C<< CPE_Test_Connection >> |
|
372
|
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
=item C<< Get_UBR_Inventory >> |
|
374
|
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
This has been replaced with |
|
376
|
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
UBR_get_Inventory |
|
378
|
|
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
This function remains for backward compatibility. |
|
380
|
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
=item C<< Export_UBR_Slot_Inventory >> |
|
382
|
|
|
|
|
|
|
|
|
383
|
|
|
|
|
|
|
=item C<< Export_UBR_Port_Inventory >> |
|
384
|
|
|
|
|
|
|
|
|
385
|
|
|
|
|
|
|
=item C<< UBR_get_DOCSIS_upstream_interfaces >> |
|
386
|
|
|
|
|
|
|
|
|
387
|
|
|
|
|
|
|
=item C<< UBR_get_DOCSIS_upstream_interfaces_Blocking >> |
|
388
|
|
|
|
|
|
|
|
|
389
|
|
|
|
|
|
|
=item C<< UBR_get_DOCSIS_interface_information >> |
|
390
|
|
|
|
|
|
|
|
|
391
|
|
|
|
|
|
|
=item C<< UBR_get_DOCSIS_interface_information_Blocking >> |
|
392
|
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
=item C<< UBR_get_DOCSIS_downstream_interfaces >> |
|
394
|
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
=item C<< UBR_get_DOCSIS_downstream_interfaces_Blocking >> |
|
396
|
|
|
|
|
|
|
|
|
397
|
|
|
|
|
|
|
=item C<< UBR_get_CPE_information >> |
|
398
|
|
|
|
|
|
|
|
|
399
|
|
|
|
|
|
|
=item C<< UBR_get_CPE_information_Blocking >> |
|
400
|
|
|
|
|
|
|
|
|
401
|
|
|
|
|
|
|
=item C<< UBR_modify_cpe_DOCSIS_profile >> |
|
402
|
|
|
|
|
|
|
|
|
403
|
|
|
|
|
|
|
=item C<< UBR_reset_cpe_device >> |
|
404
|
|
|
|
|
|
|
|
|
405
|
|
|
|
|
|
|
=item C<< UBR_get_active_cpe_profiles >> |
|
406
|
|
|
|
|
|
|
|
|
407
|
|
|
|
|
|
|
=item C<< UBR_get_active_cpe_profiles_Blocking >> |
|
408
|
|
|
|
|
|
|
|
|
409
|
|
|
|
|
|
|
=item C<< UBR_get_active_upstream_profiles >> |
|
410
|
|
|
|
|
|
|
|
|
411
|
|
|
|
|
|
|
=item C<< UBR_get_active_upstream_profiles_Blocking >> |
|
412
|
|
|
|
|
|
|
|
|
413
|
|
|
|
|
|
|
=item C<< UBR_get_stm >> |
|
414
|
|
|
|
|
|
|
|
|
415
|
|
|
|
|
|
|
The use of the STM functions come with a MASSIVE warning, that due to bugs in Cisco IOS |
|
416
|
|
|
|
|
|
|
your UBR ( Cable router ) will drop all currently connected devices if you poll it OUTSIDE |
|
417
|
|
|
|
|
|
|
of the configured STM time scope. This is a known defect so you HAVE BEEN WARNED. There are |
|
418
|
|
|
|
|
|
|
a couple of possible workarounds however none have been confirmed. |
|
419
|
|
|
|
|
|
|
|
|
420
|
|
|
|
|
|
|
Use of the Non Blocking function should be done with care and the UBR_get_stm_Blocking is |
|
421
|
|
|
|
|
|
|
preferred. |
|
422
|
|
|
|
|
|
|
|
|
423
|
|
|
|
|
|
|
Example of Use |
|
424
|
|
|
|
|
|
|
|
|
425
|
|
|
|
|
|
|
use Router::Statistics; |
|
426
|
|
|
|
|
|
|
use strict; |
|
427
|
|
|
|
|
|
|
|
|
428
|
|
|
|
|
|
|
my $test= new Router::Statistics; |
|
429
|
|
|
|
|
|
|
my (%stm_inventory, %stm_telnet_inventory , %router); |
|
430
|
|
|
|
|
|
|
my $result = $test->Router_Add( "10.1.1.1" , "public" ); |
|
431
|
|
|
|
|
|
|
$result = $test->Router_Ready ( "10.1.1.1" ); |
|
432
|
|
|
|
|
|
|
$result = $test->UBR_get_stm( |
|
433
|
|
|
|
|
|
|
\%router, |
|
434
|
|
|
|
|
|
|
\%stm_information, |
|
435
|
|
|
|
|
|
|
\%stm_telnet_inventory, |
|
436
|
|
|
|
|
|
|
"telnetlogin", |
|
437
|
|
|
|
|
|
|
"telnetpassword", |
|
438
|
|
|
|
|
|
|
"enablepassword", |
|
439
|
|
|
|
|
|
|
"15" ); |
|
440
|
|
|
|
|
|
|
|
|
441
|
|
|
|
|
|
|
The enable password is only required if your login does not put you into the correct |
|
442
|
|
|
|
|
|
|
privs account when logged in initially. |
|
443
|
|
|
|
|
|
|
|
|
444
|
|
|
|
|
|
|
The 15 is the amount of minutes to subtract from the end of the STM period as a safety |
|
445
|
|
|
|
|
|
|
margin for polling. |
|
446
|
|
|
|
|
|
|
|
|
447
|
|
|
|
|
|
|
The %stm_information hash contains a tree rooted by the IP address of the routers Added |
|
448
|
|
|
|
|
|
|
initially and the STM information as follows |
|
449
|
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
Router IP |
|
451
|
|
|
|
|
|
|
-- STM Instance Number |
|
452
|
|
|
|
|
|
|
-- ccqmEnfRuleViolateID ( never seems to be populated ) |
|
453
|
|
|
|
|
|
|
-- ccqmEnfRuleViolateMacAddr - MAC address of the device |
|
454
|
|
|
|
|
|
|
-- ccqmEnfRuleViolateRuleName - Name of the STM rule specified |
|
455
|
|
|
|
|
|
|
-- ccqmEnfRuleViolateByteCount - The Cisco specification is wrong |
|
456
|
|
|
|
|
|
|
-- ccqmEnfRuleViolateLastDetectTime - The time the violation occured |
|
457
|
|
|
|
|
|
|
-- ccqmEnfRuleViolatePenaltyExpTime - The time the violation finishes |
|
458
|
|
|
|
|
|
|
|
|
459
|
|
|
|
|
|
|
|
|
460
|
|
|
|
|
|
|
It should be noted that due to another bug not all entries for STM violations end up |
|
461
|
|
|
|
|
|
|
in the STM MIB. This appears to be caused by the end time of the STM configuration, if |
|
462
|
|
|
|
|
|
|
a devices expiry time is after the end of the STM window, it does not go into the MIB. |
|
463
|
|
|
|
|
|
|
|
|
464
|
|
|
|
|
|
|
=item C<< UBR_get_stm_Blocking >> |
|
465
|
|
|
|
|
|
|
|
|
466
|
|
|
|
|
|
|
The use of the STM functions come with a MASSIVE warning, that due to bugs in Cisco IOS |
|
467
|
|
|
|
|
|
|
your UBR ( Cable router ) will drop all currently connected devices if you poll it OUTSIDE |
|
468
|
|
|
|
|
|
|
of the configured STM time scope. This is a known defect so you HAVE BEEN WARNED. There are |
|
469
|
|
|
|
|
|
|
a couple of possible workarounds however none have been confirmed. |
|
470
|
|
|
|
|
|
|
|
|
471
|
|
|
|
|
|
|
Example of Use |
|
472
|
|
|
|
|
|
|
|
|
473
|
|
|
|
|
|
|
use Router::Statistics; |
|
474
|
|
|
|
|
|
|
use strict; |
|
475
|
|
|
|
|
|
|
|
|
476
|
|
|
|
|
|
|
my $test= new Router::Statistics; |
|
477
|
|
|
|
|
|
|
my (%stm_inventory, %stm_telnet_inventory , %router); |
|
478
|
|
|
|
|
|
|
my $result = $test->Router_Add( "10.1.1.1" , "public" ); |
|
479
|
|
|
|
|
|
|
$result = $test->Router_Ready_Blocking ( "10.1.1.1" ); |
|
480
|
|
|
|
|
|
|
$result = $test->Router_Test_Connection_Blocking(\%routers); |
|
481
|
|
|
|
|
|
|
$result = $test->UBR_get_stm_Blocking( |
|
482
|
|
|
|
|
|
|
\%router, |
|
483
|
|
|
|
|
|
|
\%stm_information, |
|
484
|
|
|
|
|
|
|
\%stm_telnet_inventory, |
|
485
|
|
|
|
|
|
|
"telnetlogin", |
|
486
|
|
|
|
|
|
|
"telnetpassword", |
|
487
|
|
|
|
|
|
|
"enablepassword", |
|
488
|
|
|
|
|
|
|
"15" ); |
|
489
|
|
|
|
|
|
|
|
|
490
|
|
|
|
|
|
|
The enable password is only required if your login does not put you into the correct |
|
491
|
|
|
|
|
|
|
privs account when logged in initially. |
|
492
|
|
|
|
|
|
|
|
|
493
|
|
|
|
|
|
|
The 15 is the amount of minutes to subtract from the end of the STM period as a safety |
|
494
|
|
|
|
|
|
|
margin for polling. |
|
495
|
|
|
|
|
|
|
|
|
496
|
|
|
|
|
|
|
The %stm_information and %stm_telnet_inventory hashes contains a tree rooted by the IP address |
|
497
|
|
|
|
|
|
|
of the routers Added initially and the STM information as follows |
|
498
|
|
|
|
|
|
|
|
|
499
|
|
|
|
|
|
|
Router IP |
|
500
|
|
|
|
|
|
|
-- STM Instance Number |
|
501
|
|
|
|
|
|
|
-- ccqmEnfRuleViolateID ( never seems to be populated ) |
|
502
|
|
|
|
|
|
|
-- ccqmEnfRuleViolateMacAddr - MAC address of the device |
|
503
|
|
|
|
|
|
|
-- ccqmEnfRuleViolateRuleName - Name of the STM rule specified |
|
504
|
|
|
|
|
|
|
-- ccqmEnfRuleViolateByteCount - The Cisco specification is wrong |
|
505
|
|
|
|
|
|
|
-- ccqmEnfRuleViolateLastDetectTime - The time the violation occured |
|
506
|
|
|
|
|
|
|
-- ccqmEnfRuleViolatePenaltyExpTime - The time the violation finishes |
|
507
|
|
|
|
|
|
|
|
|
508
|
|
|
|
|
|
|
It should be noted that due to another bug not all entries for STM violations end up |
|
509
|
|
|
|
|
|
|
in the STM MIB. This appears to be caused by the end time of the STM configuration, if |
|
510
|
|
|
|
|
|
|
a devices expiry time is after the end of the STM window, it does not go into the MIB. |
|
511
|
|
|
|
|
|
|
|
|
512
|
|
|
|
|
|
|
=item C<< Get_7500_Inventory >> |
|
513
|
|
|
|
|
|
|
|
|
514
|
|
|
|
|
|
|
The same construct as Get_UBR_Inventory |
|
515
|
|
|
|
|
|
|
|
|
516
|
|
|
|
|
|
|
=item C<< Export_7500_Slot_Inventory >> |
|
517
|
|
|
|
|
|
|
|
|
518
|
|
|
|
|
|
|
=item C<< Export_7500_Port_Inventory >> |
|
519
|
|
|
|
|
|
|
|
|
520
|
|
|
|
|
|
|
=item C<< Get_GSR_Inventory >> |
|
521
|
|
|
|
|
|
|
|
|
522
|
|
|
|
|
|
|
The same construct as Get_UBR_Inventory |
|
523
|
|
|
|
|
|
|
|
|
524
|
|
|
|
|
|
|
=item C<< Export_GSR_Slot_Inventory >> |
|
525
|
|
|
|
|
|
|
|
|
526
|
|
|
|
|
|
|
=item C<< Export_GSR_Port_Inventory >> |
|
527
|
|
|
|
|
|
|
|
|
528
|
|
|
|
|
|
|
=item C<< Get_7600_Inventory >> |
|
529
|
|
|
|
|
|
|
|
|
530
|
|
|
|
|
|
|
=item C<< Export_7600_Slot_Inventory >> |
|
531
|
|
|
|
|
|
|
|
|
532
|
|
|
|
|
|
|
=item C<< Export_7600_Port_Inventory >> |
|
533
|
|
|
|
|
|
|
|
|
534
|
|
|
|
|
|
|
=item c<< set_format >> |
|
535
|
|
|
|
|
|
|
|
|
536
|
|
|
|
|
|
|
This function sets the format of the date/time output used in the STM |
|
537
|
|
|
|
|
|
|
functions. The default is |
|
538
|
|
|
|
|
|
|
|
|
539
|
|
|
|
|
|
|
:: |
|
540
|
|
|
|
|
|
|
|
|
541
|
|
|
|
|
|
|
The format can include the following |
|
542
|
|
|
|
|
|
|
|
|
543
|
|
|
|
|
|
|
- 4 number year ie. 2007 |
|
544
|
|
|
|
|
|
|
- Name of the Month, ie January |
|
545
|
|
|
|
|
|
|
- Number of the Month ie. 1 for January |
|
546
|
|
|
|
|
|
|
- Day of the month ie. 21 |
|
547
|
|
|
|
|
|
|
- The hour ie. 10 or 22 ( am or pm ) |
|
548
|
|
|
|
|
|
|
- The minute |
|
549
|
|
|
|
|
|
|
- The second |
|
550
|
|
|
|
|
|
|
|
|
551
|
|
|
|
|
|
|
Example of Use |
|
552
|
|
|
|
|
|
|
|
|
553
|
|
|
|
|
|
|
use Router::Statistics; |
|
554
|
|
|
|
|
|
|
use strict; |
|
555
|
|
|
|
|
|
|
|
|
556
|
|
|
|
|
|
|
my $test= new Router::Statistics; |
|
557
|
|
|
|
|
|
|
my $result = $test->set_format(" ::"); |
|
558
|
|
|
|
|
|
|
|
|
559
|
|
|
|
|
|
|
=cut |
|
560
|
|
|
|
|
|
|
|
|
561
|
|
|
|
|
|
|
sub new { |
|
562
|
|
|
|
|
|
|
|
|
563
|
0
|
|
|
0
|
0
|
|
my $self = {}; |
|
564
|
0
|
|
|
|
|
|
bless $self; |
|
565
|
|
|
|
|
|
|
|
|
566
|
0
|
|
|
|
|
|
my ( $class , $attr ) =@_; |
|
567
|
|
|
|
|
|
|
|
|
568
|
0
|
|
|
|
|
|
while (my($field, $val) = splice(@{$attr}, 0, 2)) |
|
|
0
|
|
|
|
|
|
|
|
569
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{$field}=$val; } |
|
570
|
|
|
|
|
|
|
|
|
571
|
0
|
|
|
|
|
|
$self->{_GLOBAL}{'STATUS'}="OK"; |
|
572
|
|
|
|
|
|
|
|
|
573
|
0
|
0
|
|
|
|
|
if ( !$self->{_GLOBAL}{'64Bit'} ) |
|
574
|
|
|
|
|
|
|
{ |
|
575
|
0
|
|
|
|
|
|
$self->{_GLOBAL}{'64Bit'}=0; |
|
576
|
0
|
|
|
|
|
|
$self->{_GLOBAL}{'32Bit'}=1; |
|
577
|
|
|
|
|
|
|
} |
|
578
|
|
|
|
|
|
|
else |
|
579
|
|
|
|
|
|
|
{ |
|
580
|
0
|
|
|
|
|
|
$self->{_GLOBAL}{'32Bit'}=0; |
|
581
|
0
|
|
|
|
|
|
$self->{_GLOBAL}{'64Bit'}=1; |
|
582
|
|
|
|
|
|
|
} |
|
583
|
|
|
|
|
|
|
|
|
584
|
0
|
|
|
|
|
|
$self->{_GLOBAL}{'STM_Safety_Limit'}=15; |
|
585
|
0
|
|
|
|
|
|
$self->{_GLOBAL}{'Telnet'}=0; |
|
586
|
|
|
|
|
|
|
|
|
587
|
0
|
|
|
|
|
|
$self->set_format(); |
|
588
|
|
|
|
|
|
|
|
|
589
|
0
|
|
|
|
|
|
return $self; |
|
590
|
|
|
|
|
|
|
} |
|
591
|
|
|
|
|
|
|
|
|
592
|
|
|
|
|
|
|
sub get_globals |
|
593
|
0
|
|
|
0
|
0
|
|
{ my $self=shift; return $self->{_GLOBAL}; } |
|
|
0
|
|
|
|
|
|
|
|
594
|
|
|
|
|
|
|
|
|
595
|
|
|
|
|
|
|
sub get_global |
|
596
|
0
|
|
|
0
|
0
|
|
{ my $self=shift; my $attribute=shift; return $self->{_GLOBAL}{$attribute}; } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
597
|
|
|
|
|
|
|
|
|
598
|
|
|
|
|
|
|
sub get_status |
|
599
|
|
|
|
|
|
|
{ |
|
600
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
601
|
0
|
|
|
|
|
|
return $self->get_global('STATUS'); |
|
602
|
|
|
|
|
|
|
} |
|
603
|
|
|
|
|
|
|
|
|
604
|
|
|
|
|
|
|
sub CPE_Remove |
|
605
|
|
|
|
|
|
|
{ |
|
606
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
607
|
0
|
|
|
|
|
|
my $ip_address = shift; |
|
608
|
|
|
|
|
|
|
|
|
609
|
0
|
0
|
|
|
|
|
if ( !$self->{_GLOBAL}{'CPE'}{$ip_address} ) |
|
610
|
|
|
|
|
|
|
{ |
|
611
|
0
|
0
|
|
|
|
|
print "IP Address not Added '$ip_address'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
612
|
0
|
|
|
|
|
|
$self->{_GLOBAL}{STATUS}="CPE IP Address Not Added"; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
613
|
0
|
0
|
|
|
|
|
print "Removing IP Address '$ip_address'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
614
|
0
|
|
|
|
|
|
$self->{_GLOBAL}{'CPE'}{$ip_address}{'SESSION'}->close(); |
|
615
|
0
|
|
|
|
|
|
delete ($self->{_GLOBAL}{'CPE'}{$ip_address}{'SESSION'}); |
|
616
|
0
|
|
|
|
|
|
delete ($self->{_GLOBAL}{'CPE'}{$ip_address}); |
|
617
|
0
|
|
|
|
|
|
return 1; |
|
618
|
|
|
|
|
|
|
} |
|
619
|
|
|
|
|
|
|
|
|
620
|
|
|
|
|
|
|
|
|
621
|
|
|
|
|
|
|
sub CPE_Ready |
|
622
|
|
|
|
|
|
|
{ |
|
623
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
624
|
0
|
|
|
|
|
|
my $ip_address = shift; |
|
625
|
0
|
|
|
|
|
|
my $oids = shift; |
|
626
|
|
|
|
|
|
|
|
|
627
|
0
|
0
|
|
|
|
|
if ( !$self->{_GLOBAL}{'CPE'}{$ip_address} ) |
|
628
|
|
|
|
|
|
|
{ |
|
629
|
0
|
|
|
|
|
|
$self->{_GLOBAL}{STATUS}="CPE IP Address Not Added"; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
630
|
|
|
|
|
|
|
|
|
631
|
0
|
|
|
|
|
|
my ( $session, $error ) = |
|
632
|
|
|
|
|
|
|
Net::SNMP->session( |
|
633
|
|
|
|
|
|
|
-hostname => $ip_address, |
|
634
|
|
|
|
|
|
|
-community => $self->{_GLOBAL}{'CPE'}{$ip_address}{'key'}, |
|
635
|
|
|
|
|
|
|
-port => 161, |
|
636
|
|
|
|
|
|
|
-timeout => $self->{_GLOBAL}{'CPE'}{$ip_address}{'timeout'}, |
|
637
|
|
|
|
|
|
|
-version => "snmpv2c", |
|
638
|
|
|
|
|
|
|
-nonblocking => 1, |
|
639
|
|
|
|
|
|
|
-retries => 0, |
|
640
|
|
|
|
|
|
|
-translate => [-timeticks => 0x0,-octetstring => 0x0] |
|
641
|
|
|
|
|
|
|
); |
|
642
|
|
|
|
|
|
|
|
|
643
|
0
|
0
|
|
|
|
|
if ( $error ) |
|
644
|
|
|
|
|
|
|
{ |
|
645
|
0
|
|
|
|
|
|
$self->{_GLOBAL}{'STATUS'}=$error; |
|
646
|
0
|
0
|
|
|
|
|
print "Error setting up '$ip_address' is '$error'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
647
|
0
|
|
|
|
|
|
undef $session; |
|
648
|
0
|
|
|
|
|
|
return 0; |
|
649
|
|
|
|
|
|
|
} |
|
650
|
0
|
|
|
|
|
|
$self->{_GLOBAL}{'CPE'}{$ip_address}{'SESSION'}=$session; |
|
651
|
0
|
|
|
|
|
|
$self->{_GLOBAL}{'CPE'}{$ip_address}{'OID'}=$oids; |
|
652
|
0
|
|
|
|
|
|
return 1; |
|
653
|
|
|
|
|
|
|
} |
|
654
|
|
|
|
|
|
|
|
|
655
|
|
|
|
|
|
|
sub Router_Ready |
|
656
|
|
|
|
|
|
|
{ |
|
657
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
658
|
|
|
|
|
|
|
|
|
659
|
0
|
|
|
|
|
|
my $ip_address = shift; |
|
660
|
|
|
|
|
|
|
|
|
661
|
0
|
0
|
|
|
|
|
if ( !$self->{_GLOBAL}{'Router'}{$ip_address} ) |
|
662
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{STATUS}="UBR IP Address Not Added"; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
663
|
|
|
|
|
|
|
|
|
664
|
0
|
|
|
|
|
|
my ($session, $error) = |
|
665
|
|
|
|
|
|
|
Net::SNMP->session( |
|
666
|
|
|
|
|
|
|
-hostname => $ip_address, |
|
667
|
|
|
|
|
|
|
-community => $self->{_GLOBAL}{'Router'}{$ip_address}{'key'}, |
|
668
|
|
|
|
|
|
|
-port => 161, |
|
669
|
|
|
|
|
|
|
-timeout => $self->{_GLOBAL}{'Router'}{$ip_address}{'timeout'}, |
|
670
|
|
|
|
|
|
|
-version => "snmpv2c", |
|
671
|
|
|
|
|
|
|
-translate => [-timeticks => 0x0,-octetstring => 0x0], |
|
672
|
|
|
|
|
|
|
-nonblocking => 1, |
|
673
|
|
|
|
|
|
|
-retries => 2 ); |
|
674
|
0
|
0
|
|
|
|
|
if ( $error ) |
|
675
|
|
|
|
|
|
|
{ |
|
676
|
0
|
|
|
|
|
|
$self->{_GLOBAL}{'STATUS'}=$error; |
|
677
|
0
|
|
|
|
|
|
undef $session; |
|
678
|
0
|
|
|
|
|
|
return 0; |
|
679
|
|
|
|
|
|
|
} |
|
680
|
0
|
|
|
|
|
|
$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}=$session; |
|
681
|
0
|
|
|
|
|
|
return 1; |
|
682
|
|
|
|
|
|
|
} |
|
683
|
|
|
|
|
|
|
|
|
684
|
|
|
|
|
|
|
sub Router_Ready_Blocking |
|
685
|
|
|
|
|
|
|
{ |
|
686
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
687
|
|
|
|
|
|
|
|
|
688
|
0
|
|
|
|
|
|
my $ip_address = shift; |
|
689
|
|
|
|
|
|
|
|
|
690
|
0
|
0
|
|
|
|
|
if ( !$self->{_GLOBAL}{'Router'}{$ip_address} ) |
|
691
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{STATUS}="UBR IP Address Not Added"; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
692
|
|
|
|
|
|
|
|
|
693
|
0
|
|
|
|
|
|
my ($session, $error) = |
|
694
|
|
|
|
|
|
|
Net::SNMP->session( |
|
695
|
|
|
|
|
|
|
-hostname => $ip_address, |
|
696
|
|
|
|
|
|
|
-community => $self->{_GLOBAL}{'Router'}{$ip_address}{'key'}, |
|
697
|
|
|
|
|
|
|
-port => 161, |
|
698
|
|
|
|
|
|
|
-timeout => $self->{_GLOBAL}{'Router'}{$ip_address}{'timeout'}, |
|
699
|
|
|
|
|
|
|
-version => "snmpv2c", |
|
700
|
|
|
|
|
|
|
-translate => [-timeticks => 0x0,-octetstring => 0x0], |
|
701
|
|
|
|
|
|
|
-nonblocking => 0, |
|
702
|
|
|
|
|
|
|
-retries => 2 ); |
|
703
|
0
|
0
|
|
|
|
|
if ( $error ) |
|
704
|
|
|
|
|
|
|
{ |
|
705
|
0
|
|
|
|
|
|
$self->{_GLOBAL}{'STATUS'}=$error; |
|
706
|
0
|
|
|
|
|
|
undef $session; |
|
707
|
0
|
|
|
|
|
|
return 0; |
|
708
|
|
|
|
|
|
|
} |
|
709
|
0
|
|
|
|
|
|
$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}=$session; |
|
710
|
0
|
|
|
|
|
|
return 1; |
|
711
|
|
|
|
|
|
|
} |
|
712
|
|
|
|
|
|
|
|
|
713
|
|
|
|
|
|
|
|
|
714
|
|
|
|
|
|
|
sub CPE_Return_All |
|
715
|
|
|
|
|
|
|
{ |
|
716
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
717
|
0
|
|
|
|
|
|
return $self->{_GLOBAL}{'CPE'}; |
|
718
|
|
|
|
|
|
|
} |
|
719
|
|
|
|
|
|
|
|
|
720
|
|
|
|
|
|
|
sub Router_Return_All |
|
721
|
|
|
|
|
|
|
{ |
|
722
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
723
|
0
|
|
|
|
|
|
return $self->{_GLOBAL}{'Router'}; |
|
724
|
|
|
|
|
|
|
} |
|
725
|
|
|
|
|
|
|
|
|
726
|
|
|
|
|
|
|
sub CPE_Add |
|
727
|
|
|
|
|
|
|
{ |
|
728
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
729
|
0
|
|
|
|
|
|
my $ip_address = shift; |
|
730
|
0
|
|
|
|
|
|
my $snmp_key = shift; |
|
731
|
0
|
|
|
|
|
|
my $router = shift; |
|
732
|
0
|
|
|
|
|
|
my $cpe_id = shift; |
|
733
|
0
|
|
|
|
|
|
my $timeout = shift; |
|
734
|
0
|
0
|
0
|
|
|
|
if ( !$ip_address || !$snmp_key ) |
|
735
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{STATUS}="No IP Address or SNMP Key Specified."; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
736
|
|
|
|
|
|
|
|
|
737
|
0
|
0
|
|
|
|
|
if ( !$timeout ) |
|
738
|
0
|
|
|
|
|
|
{ $timeout=2; } |
|
739
|
|
|
|
|
|
|
|
|
740
|
0
|
|
|
|
|
|
$self->{_GLOBAL}{'CPE'}{$ip_address}{'keys_to_test'}=join(',',(split(/,/,$snmp_key))[1,2,3,4,5,6,7,8,9,10]); |
|
741
|
0
|
|
|
|
|
|
$self->{_GLOBAL}{'CPE'}{$ip_address}{'key'}=(split(/,/,$snmp_key))[0]; |
|
742
|
0
|
|
|
|
|
|
$self->{_GLOBAL}{'CPE'}{$ip_address}{'router'}=$router; |
|
743
|
0
|
|
|
|
|
|
$self->{_GLOBAL}{'CPE'}{$ip_address}{'timeout'}=$timeout; |
|
744
|
0
|
|
|
|
|
|
$self->{_GLOBAL}{'CPE'}{$ip_address}{'id'} = $cpe_id; |
|
745
|
|
|
|
|
|
|
|
|
746
|
0
|
0
|
|
|
|
|
print "Keys left are '".$self->{_GLOBAL}{'CPE'}{$ip_address}{'keys_to_test'}."'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
747
|
0
|
0
|
|
|
|
|
print "Key is are '".$self->{_GLOBAL}{'CPE'}{$ip_address}{'key'}."'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
748
|
|
|
|
|
|
|
|
|
749
|
0
|
|
|
|
|
|
return 1; |
|
750
|
|
|
|
|
|
|
} |
|
751
|
|
|
|
|
|
|
|
|
752
|
|
|
|
|
|
|
sub Router_Add |
|
753
|
|
|
|
|
|
|
{ |
|
754
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
755
|
0
|
|
|
|
|
|
my $ip_address = shift; |
|
756
|
0
|
|
|
|
|
|
my $snmp_key = shift; |
|
757
|
0
|
|
|
|
|
|
my $timeout = shift; |
|
758
|
0
|
0
|
0
|
|
|
|
if ( !$ip_address || !$snmp_key ) |
|
759
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{STATUS}="No IP Address or SNMP Key Specified."; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
760
|
|
|
|
|
|
|
|
|
761
|
0
|
0
|
|
|
|
|
if ( !$timeout ) { $timeout=2; } |
|
|
0
|
|
|
|
|
|
|
|
762
|
0
|
|
|
|
|
|
$self->{_GLOBAL}{'Router'}{$ip_address}{'key'}=$snmp_key; |
|
763
|
0
|
|
|
|
|
|
$self->{_GLOBAL}{'Router'}{$ip_address}{'timeout'}=$timeout; |
|
764
|
0
|
|
|
|
|
|
return 1; |
|
765
|
|
|
|
|
|
|
} |
|
766
|
|
|
|
|
|
|
|
|
767
|
|
|
|
|
|
|
sub Router_Remove_All |
|
768
|
|
|
|
|
|
|
{ |
|
769
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
770
|
0
|
|
|
|
|
|
my $all_routers = $self->Router_Return_All(); |
|
771
|
0
|
|
|
|
|
|
foreach my $router ( keys %{$all_routers} ) |
|
|
0
|
|
|
|
|
|
|
|
772
|
|
|
|
|
|
|
{ |
|
773
|
0
|
|
|
|
|
|
$self->Router_Remove($router); |
|
774
|
|
|
|
|
|
|
} |
|
775
|
0
|
|
|
|
|
|
return 1; |
|
776
|
|
|
|
|
|
|
} |
|
777
|
|
|
|
|
|
|
|
|
778
|
|
|
|
|
|
|
sub Router_Remove |
|
779
|
|
|
|
|
|
|
{ |
|
780
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
781
|
0
|
|
|
|
|
|
my $ip_address = shift; |
|
782
|
0
|
0
|
|
|
|
|
if ( !$ip_address ) |
|
783
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{STATUS}="No IP Address Specified."; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
784
|
0
|
0
|
|
|
|
|
if ( $self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'} ) |
|
785
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}->close(); } |
|
786
|
0
|
|
|
|
|
|
delete ( $self->{_GLOBAL}{'Router'}{$ip_address} ); |
|
787
|
0
|
|
|
|
|
|
return 1; |
|
788
|
|
|
|
|
|
|
} |
|
789
|
|
|
|
|
|
|
|
|
790
|
|
|
|
|
|
|
sub CPE_export_import_fields |
|
791
|
|
|
|
|
|
|
{ |
|
792
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
793
|
0
|
|
|
|
|
|
my $fields = shift; |
|
794
|
0
|
|
|
|
|
|
$self->{_GLOBAL}{'EXPORT'}{'CPE'}=$fields; |
|
795
|
0
|
|
|
|
|
|
return 1; |
|
796
|
|
|
|
|
|
|
} |
|
797
|
|
|
|
|
|
|
|
|
798
|
|
|
|
|
|
|
sub CPE_export_fields |
|
799
|
|
|
|
|
|
|
{ |
|
800
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
801
|
0
|
|
|
|
|
|
return $self->{_GLOBAL}{'EXPORT'}{'CPE'}; |
|
802
|
|
|
|
|
|
|
} |
|
803
|
|
|
|
|
|
|
|
|
804
|
|
|
|
|
|
|
sub CPE_export_schema |
|
805
|
|
|
|
|
|
|
{ |
|
806
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
807
|
0
|
|
|
|
|
|
my $handle = shift; |
|
808
|
0
|
|
|
|
|
|
my $format = shift; |
|
809
|
0
|
|
|
|
|
|
my $fields = $self->CPE_return_export_fields(); |
|
810
|
|
|
|
|
|
|
|
|
811
|
0
|
0
|
|
|
|
|
if ( $format=~/xml-dtd/i ) |
|
812
|
|
|
|
|
|
|
{ |
|
813
|
|
|
|
|
|
|
# we generate a DTD and XML schema, then the user can break them up as needed |
|
814
|
0
|
|
|
|
|
|
my $output; |
|
815
|
0
|
|
|
|
|
|
print $handle "
|
|
816
|
0
|
|
|
|
|
|
foreach my $field ( @{$fields} ) { $output.="$field,"; } chop($output); |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
817
|
0
|
|
|
|
|
|
print $handle $output; |
|
818
|
0
|
|
|
|
|
|
print $handle ")>\n"; |
|
819
|
0
|
|
|
|
|
|
print $handle "\n"; |
|
820
|
0
|
|
|
|
|
|
foreach my $field ( @{$fields} ) { print $handle " $field (#PCDATA)>\n"; } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
821
|
|
|
|
|
|
|
} |
|
822
|
|
|
|
|
|
|
|
|
823
|
0
|
0
|
|
|
|
|
if ( $format!~/xml-dtd/i ) |
|
824
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{STATUS}="Only xml-dtd supported at this time.";return 0;} |
|
|
0
|
|
|
|
|
|
|
|
825
|
|
|
|
|
|
|
|
|
826
|
0
|
|
|
|
|
|
return 1; |
|
827
|
|
|
|
|
|
|
} |
|
828
|
|
|
|
|
|
|
|
|
829
|
|
|
|
|
|
|
sub CPE_export_data_start |
|
830
|
|
|
|
|
|
|
{ |
|
831
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
832
|
0
|
|
|
|
|
|
$self->{_GLOBAL}{'EXPORT'}{'START'}=1; |
|
833
|
0
|
|
|
|
|
|
return 1; |
|
834
|
|
|
|
|
|
|
} |
|
835
|
|
|
|
|
|
|
|
|
836
|
|
|
|
|
|
|
sub CPE_export_data_end |
|
837
|
|
|
|
|
|
|
{ |
|
838
|
0
|
|
|
0
|
1
|
|
my $self; |
|
839
|
0
|
|
|
|
|
|
$self->{_GLOBAL}{'EXPORT'}{'START'}=0; |
|
840
|
0
|
|
|
|
|
|
return 1; |
|
841
|
|
|
|
|
|
|
} |
|
842
|
|
|
|
|
|
|
|
|
843
|
|
|
|
|
|
|
sub CPE_export_data |
|
844
|
|
|
|
|
|
|
{ |
|
845
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
846
|
0
|
|
|
|
|
|
my $ip_address = shift; |
|
847
|
0
|
|
|
|
|
|
my $cpe_data = shift; |
|
848
|
0
|
|
|
|
|
|
my $format = shift; |
|
849
|
0
|
|
|
|
|
|
my $handle = shift; |
|
850
|
|
|
|
|
|
|
|
|
851
|
0
|
0
|
|
|
|
|
if ( !${$cpe_data}{$ip_address} ) |
|
|
0
|
|
|
|
|
|
|
|
852
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{STATUS}="No CPE Data Found."; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
853
|
|
|
|
|
|
|
|
|
854
|
0
|
0
|
|
|
|
|
if ( !$format ) |
|
855
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{STATUS}="Format Not Specified."; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
856
|
|
|
|
|
|
|
|
|
857
|
0
|
0
|
|
|
|
|
if ( !$handle ) |
|
858
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{STATUS}="Output Handle Not Specified."; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
859
|
|
|
|
|
|
|
|
|
860
|
0
|
|
|
|
|
|
my $fields = $self->CPE_export_fields(); |
|
861
|
|
|
|
|
|
|
|
|
862
|
0
|
0
|
|
|
|
|
if ( !$fields ) |
|
863
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{STATUS}="Output Fields Not Specified."; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
864
|
|
|
|
|
|
|
|
|
865
|
0
|
0
|
0
|
|
|
|
if ( $self->{_GLOBAL}{'EXPORT'}{'START'}==1 && $format=~/xml/i ) |
|
866
|
|
|
|
|
|
|
{ |
|
867
|
0
|
|
|
|
|
|
print $handle "\n"; |
|
868
|
0
|
|
|
|
|
|
$self->{_GLOBAL}{'EXPORT'}{'START'}=0; |
|
869
|
|
|
|
|
|
|
} |
|
870
|
|
|
|
|
|
|
|
|
871
|
0
|
0
|
0
|
|
|
|
if ( $self->{_GLOBAL}{'EXPORT'}{'START'}==1 && $format=~/csv/i ) |
|
872
|
|
|
|
|
|
|
{ |
|
873
|
0
|
|
|
|
|
|
my $output=""; |
|
874
|
0
|
|
|
|
|
|
foreach my $field ( @{$fields} ){ $output.="\"".$field."\","; }; chop($output); |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
875
|
0
|
|
|
|
|
|
print $handle $output."\n"; |
|
876
|
0
|
|
|
|
|
|
$self->{_GLOBAL}{'EXPORT'}{'START'}=0; |
|
877
|
|
|
|
|
|
|
} |
|
878
|
|
|
|
|
|
|
|
|
879
|
0
|
0
|
|
|
|
|
if ( $format=~/xml/i ) |
|
880
|
|
|
|
|
|
|
{ |
|
881
|
0
|
|
|
|
|
|
print $handle "\n"; |
|
882
|
0
|
|
|
|
|
|
foreach my $field ( @{$fields} ) |
|
|
0
|
|
|
|
|
|
|
|
883
|
0
|
|
|
|
|
|
{ print $handle "<$field>".${$cpe_data}{$ip_address}{$field}."$field>\n"; |
|
|
0
|
|
|
|
|
|
|
|
884
|
|
|
|
|
|
|
} |
|
885
|
0
|
|
|
|
|
|
print $handle "\n"; |
|
886
|
|
|
|
|
|
|
} |
|
887
|
|
|
|
|
|
|
|
|
888
|
0
|
0
|
|
|
|
|
if ( $format=~/csv/i ) |
|
889
|
|
|
|
|
|
|
{ |
|
890
|
0
|
|
|
|
|
|
my $output; |
|
891
|
0
|
|
|
|
|
|
foreach my $field ( @{$fields} ) |
|
|
0
|
|
|
|
|
|
|
|
892
|
0
|
|
|
|
|
|
{ $output.="\"".${$cpe_data}{$ip_address}{$field}."\","; } |
|
|
0
|
|
|
|
|
|
|
|
893
|
0
|
|
|
|
|
|
chop($output); |
|
894
|
0
|
|
|
|
|
|
$output.="\n"; |
|
895
|
0
|
|
|
|
|
|
print $handle $output; |
|
896
|
|
|
|
|
|
|
} |
|
897
|
|
|
|
|
|
|
|
|
898
|
0
|
0
|
0
|
|
|
|
if ( $format!~/xml/i && $format!~/csv/i ) |
|
899
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{STATUS}="Format Specified is not supported, only 'xml or csv'."; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
900
|
|
|
|
|
|
|
|
|
901
|
0
|
|
|
|
|
|
return 1; |
|
902
|
|
|
|
|
|
|
} |
|
903
|
|
|
|
|
|
|
|
|
904
|
|
|
|
|
|
|
sub CPE_gather_all_data_walk |
|
905
|
|
|
|
|
|
|
{ |
|
906
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
907
|
0
|
|
|
|
|
|
my $data = shift; |
|
908
|
|
|
|
|
|
|
|
|
909
|
|
|
|
|
|
|
# Entry into the function is a point to a hash to store the data |
|
910
|
|
|
|
|
|
|
# the result is a hash with the following |
|
911
|
|
|
|
|
|
|
|
|
912
|
0
|
|
|
|
|
|
my $cpes=$self->CPE_Return_All(); |
|
913
|
|
|
|
|
|
|
|
|
914
|
0
|
0
|
|
|
|
|
if ( scalar ( keys %{$cpes}==0 ) ) |
|
|
0
|
|
|
|
|
|
|
|
915
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="No CPEs setup"; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
916
|
|
|
|
|
|
|
|
|
917
|
0
|
|
|
|
|
|
my $snmp_variables = Router::Statistics::OID->CPE_populate_oid(); |
|
918
|
|
|
|
|
|
|
|
|
919
|
0
|
|
|
|
|
|
foreach my $cpe ( keys %{$cpes} ) |
|
|
0
|
|
|
|
|
|
|
|
920
|
|
|
|
|
|
|
{ |
|
921
|
0
|
|
|
|
|
|
my ($interface_information)=${$cpes}{$cpe}{'SESSION'}-> |
|
|
0
|
|
|
|
|
|
|
|
922
|
|
|
|
|
|
|
get_table( |
|
923
|
|
|
|
|
|
|
-callback => [ \&validate_one_cpe, $data, $cpe, $snmp_variables ], |
|
924
|
0
|
|
|
|
|
|
-baseoid => ${$cpes}{$cpe}{'OID'} ); |
|
925
|
|
|
|
|
|
|
} |
|
926
|
|
|
|
|
|
|
|
|
927
|
0
|
|
|
|
|
|
snmp_dispatcher(); |
|
928
|
|
|
|
|
|
|
|
|
929
|
0
|
0
|
|
|
|
|
if ( scalar ( keys %{$data} ) == 0 ) |
|
|
0
|
|
|
|
|
|
|
|
930
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="No CPE Data Found.\n"; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
931
|
|
|
|
|
|
|
|
|
932
|
0
|
|
|
|
|
|
return 1; |
|
933
|
|
|
|
|
|
|
} |
|
934
|
|
|
|
|
|
|
|
|
935
|
|
|
|
|
|
|
sub CPE_gather_all_data |
|
936
|
|
|
|
|
|
|
{ |
|
937
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
938
|
0
|
|
|
|
|
|
my $data = shift; |
|
939
|
|
|
|
|
|
|
|
|
940
|
|
|
|
|
|
|
# Entry into the function is a point to a hash to store the data |
|
941
|
|
|
|
|
|
|
# the result is a hash with the following |
|
942
|
|
|
|
|
|
|
|
|
943
|
0
|
|
|
|
|
|
my $cpes=$self->CPE_Return_All(); |
|
944
|
|
|
|
|
|
|
|
|
945
|
0
|
0
|
|
|
|
|
if ( scalar ( keys %{$cpes}==0 ) ) |
|
|
0
|
|
|
|
|
|
|
|
946
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="No CPEs setup"; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
947
|
|
|
|
|
|
|
|
|
948
|
0
|
|
|
|
|
|
my $snmp_variables = Router::Statistics::OID->CPE_populate_oid(); |
|
949
|
|
|
|
|
|
|
|
|
950
|
0
|
|
|
|
|
|
foreach my $cpe ( keys %{$cpes} ) |
|
|
0
|
|
|
|
|
|
|
|
951
|
|
|
|
|
|
|
{ |
|
952
|
0
|
|
|
|
|
|
my ($interface_information)=${$cpes}{$cpe}{'SESSION'}-> |
|
|
0
|
|
|
|
|
|
|
|
953
|
|
|
|
|
|
|
get_request( |
|
954
|
|
|
|
|
|
|
-callback => [ \&get_cpe_information, $cpe, $data, $snmp_variables ], |
|
955
|
|
|
|
|
|
|
-varbindlist => |
|
956
|
0
|
|
|
|
|
|
${$cpes}{$cpe}{'OID'} ); |
|
957
|
|
|
|
|
|
|
} |
|
958
|
|
|
|
|
|
|
|
|
959
|
0
|
|
|
|
|
|
snmp_dispatcher(); |
|
960
|
|
|
|
|
|
|
|
|
961
|
0
|
|
|
|
|
|
foreach my $cpe ( keys %{$data} ) |
|
|
0
|
|
|
|
|
|
|
|
962
|
|
|
|
|
|
|
{ |
|
963
|
0
|
|
|
|
|
|
foreach my $attribute ( keys %{${$data}{$cpe}} ) |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
964
|
|
|
|
|
|
|
{ |
|
965
|
0
|
0
|
|
|
|
|
if ( $attribute=~/ifPhysAddress/) |
|
966
|
|
|
|
|
|
|
{ |
|
967
|
0
|
|
|
|
|
|
${$data}{$cpe}{$attribute}=_convert_mac_address( ${$data}{$cpe}{$attribute} ); |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
968
|
|
|
|
|
|
|
} |
|
969
|
|
|
|
|
|
|
} |
|
970
|
|
|
|
|
|
|
} |
|
971
|
|
|
|
|
|
|
|
|
972
|
0
|
0
|
|
|
|
|
if ( scalar ( keys %{$data} ) == 0 ) |
|
|
0
|
|
|
|
|
|
|
|
973
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="No CPE Data Found.\n"; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
974
|
|
|
|
|
|
|
|
|
975
|
0
|
|
|
|
|
|
return 1; |
|
976
|
|
|
|
|
|
|
} |
|
977
|
|
|
|
|
|
|
|
|
978
|
|
|
|
|
|
|
sub Router_get_networks |
|
979
|
|
|
|
|
|
|
{ |
|
980
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
981
|
0
|
|
|
|
|
|
my $data = shift; |
|
982
|
0
|
|
|
|
|
|
my $interface_data = shift; |
|
983
|
0
|
|
|
|
|
|
my $router_data = shift; |
|
984
|
|
|
|
|
|
|
|
|
985
|
0
|
|
|
|
|
|
my $output; |
|
986
|
|
|
|
|
|
|
|
|
987
|
0
|
|
|
|
|
|
my $current_ubrs=$self->Router_Return_All(); |
|
988
|
0
|
0
|
|
|
|
|
if ( scalar( keys %{$current_ubrs})==0 ) { return 0; } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
989
|
|
|
|
|
|
|
|
|
990
|
0
|
|
|
|
|
|
my $snmp_variables = Router::Statistics::OID->Router_Link_Map_oid(); |
|
991
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
992
|
|
|
|
|
|
|
{ |
|
993
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
994
|
0
|
|
|
|
|
|
my ($profile_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
995
|
|
|
|
|
|
|
get_table( |
|
996
|
|
|
|
|
|
|
-callback => [ \&validate_six_net, $data, $ip_address, $snmp_variables ], |
|
997
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'PRIVATE_atEnt'} ); |
|
998
|
|
|
|
|
|
|
} |
|
999
|
0
|
|
|
|
|
|
snmp_dispatcher(); |
|
1000
|
|
|
|
|
|
|
|
|
1001
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
1002
|
|
|
|
|
|
|
{ |
|
1003
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
1004
|
0
|
|
|
|
|
|
my ($profile_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
1005
|
|
|
|
|
|
|
get_table( |
|
1006
|
|
|
|
|
|
|
-callback => [ \&validate_four_net, $data, $ip_address, $snmp_variables ], |
|
1007
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'PRIVATE_ipEnt'} ); |
|
1008
|
|
|
|
|
|
|
} |
|
1009
|
0
|
|
|
|
|
|
snmp_dispatcher(); |
|
1010
|
|
|
|
|
|
|
|
|
1011
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$data} ) |
|
|
0
|
|
|
|
|
|
|
|
1012
|
|
|
|
|
|
|
{ |
|
1013
|
0
|
|
|
|
|
|
foreach my $interfaces ( keys %{${$data}{$ip_address}} ) |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
1014
|
|
|
|
|
|
|
{ |
|
1015
|
0
|
|
|
|
|
|
foreach my $ips ( keys %{${$data}{$ip_address}{$interfaces}{'address'}} ) |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
1016
|
|
|
|
|
|
|
{ |
|
1017
|
0
|
|
|
|
|
|
${$data}{$ip_address}{$interfaces}{'address'}{$ips}{'atPhysAddress'}= |
|
|
0
|
|
|
|
|
|
|
|
1018
|
0
|
|
|
|
|
|
_convert_mac_address(${$data}{$ip_address}{$interfaces}{'atPhysAddress'}); |
|
1019
|
|
|
|
|
|
|
} |
|
1020
|
|
|
|
|
|
|
} |
|
1021
|
|
|
|
|
|
|
} |
|
1022
|
|
|
|
|
|
|
|
|
1023
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$data} ) |
|
|
0
|
|
|
|
|
|
|
|
1024
|
|
|
|
|
|
|
{ |
|
1025
|
0
|
|
|
|
|
|
foreach my $interfaces ( keys %{${$data}{$ip_address}} ) |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
1026
|
|
|
|
|
|
|
{ |
|
1027
|
0
|
|
|
|
|
|
foreach my $ips ( keys %{${$data}{$ip_address}{$interfaces}{'address'}} ) |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
1028
|
|
|
|
|
|
|
{ |
|
1029
|
0
|
|
|
|
|
|
my $real_address = $self->_IpQuadToInt( $ips ); |
|
1030
|
0
|
|
|
|
|
|
my $real_netmask = $self->_IpQuadToInt( ${$data}{$ip_address}{$interfaces}{'address'}{$ips}{'ipAdEntNetMask'} ); |
|
|
0
|
|
|
|
|
|
|
|
1031
|
0
|
|
|
|
|
|
my $network_address = $real_address&$real_netmask ; |
|
1032
|
0
|
|
|
|
|
|
${$data}{$ip_address}{$interfaces}{'ipAdEntNetWork'} = $self->_IpIntToQuad( $network_address ); |
|
|
0
|
|
|
|
|
|
|
|
1033
|
0
|
|
|
|
|
|
${$data}{$ip_address}{$interfaces}{'ipAdEntNetMask'} = ${$data}{$ip_address}{$interfaces}{'address'}{$ips}{'ipAdEntNetMask'}; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
1034
|
|
|
|
|
|
|
} |
|
1035
|
|
|
|
|
|
|
} |
|
1036
|
|
|
|
|
|
|
} |
|
1037
|
|
|
|
|
|
|
|
|
1038
|
0
|
|
|
|
|
|
my %interface_remapper; |
|
1039
|
|
|
|
|
|
|
my %interface_map; |
|
1040
|
0
|
|
|
|
|
|
my %remote_map; |
|
1041
|
0
|
|
|
|
|
|
my %network_map; |
|
1042
|
0
|
|
|
|
|
|
my %router_owners; |
|
1043
|
|
|
|
|
|
|
|
|
1044
|
0
|
|
|
|
|
|
foreach my $router ( keys %{$data} ) |
|
|
0
|
|
|
|
|
|
|
|
1045
|
|
|
|
|
|
|
{ |
|
1046
|
0
|
|
|
|
|
|
foreach my $interface ( keys %{${$data}{$router}} ) |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
1047
|
|
|
|
|
|
|
{ |
|
1048
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{${$data}{$router}{$interface}{'address'}} ) |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
1049
|
|
|
|
|
|
|
{ |
|
1050
|
0
|
0
|
|
|
|
|
next unless ${$data}{$router}{$interface}{'address'}{$ip_address}{'ipAdEntNetMask'}; |
|
|
0
|
|
|
|
|
|
|
|
1051
|
0
|
|
|
|
|
|
$router_owners{$ip_address}=$router; |
|
1052
|
0
|
|
|
|
|
|
my $network_layer = $self->_IpQuadToInt( $ip_address ) |
|
1053
|
|
|
|
|
|
|
& |
|
1054
|
|
|
|
|
|
|
$self->_IpQuadToInt( |
|
1055
|
0
|
|
|
|
|
|
${$data}{$router}{$interface}{'address'}{$ip_address}{'ipAdEntNetMask'} |
|
1056
|
|
|
|
|
|
|
); |
|
1057
|
0
|
|
|
|
|
|
$network_map { $network_layer } {$ip_address}=$router; |
|
1058
|
0
|
0
|
|
|
|
|
if ( ${$data}{$router}{$interface}{'address'}{$ip_address}{'ipAdEntIfIndex'} ) |
|
|
0
|
|
|
|
|
|
|
|
1059
|
|
|
|
|
|
|
{ |
|
1060
|
0
|
|
|
|
|
|
$interface_map{${$data}{$router}{$interface}{'ipAdEntNetWork'}}{$router}=1; |
|
|
0
|
|
|
|
|
|
|
|
1061
|
|
|
|
|
|
|
} |
|
1062
|
|
|
|
|
|
|
else |
|
1063
|
|
|
|
|
|
|
{ |
|
1064
|
0
|
|
|
|
|
|
$remote_map{$router}{${$interface_data}{$router}{$interface}{'ifDescr'} } { $ip_address } =1; |
|
|
0
|
|
|
|
|
|
|
|
1065
|
|
|
|
|
|
|
} |
|
1066
|
|
|
|
|
|
|
} |
|
1067
|
|
|
|
|
|
|
} |
|
1068
|
|
|
|
|
|
|
} |
|
1069
|
|
|
|
|
|
|
|
|
1070
|
0
|
|
|
|
|
|
$output.="router_ip,router_name,link_ifDescr,local_ip,remote_ip,remote_router_ip,remote_router_name,netmask,link_ifAdminStatus,link_ifOperStatus,link_ifAlias\n"; |
|
1071
|
|
|
|
|
|
|
|
|
1072
|
0
|
|
|
|
|
|
foreach my $router ( keys %{$data} ) |
|
|
0
|
|
|
|
|
|
|
|
1073
|
|
|
|
|
|
|
{ |
|
1074
|
0
|
|
|
|
|
|
foreach my $interface ( keys %{${$data}{$router}} ) |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
1075
|
|
|
|
|
|
|
{ |
|
1076
|
0
|
|
|
|
|
|
my ($local,$remote,$remote_router,@remote_link, $netmask, $network, @network_link ); |
|
1077
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{${$data}{$router}{$interface}{'address'}} ) |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
1078
|
|
|
|
|
|
|
{ |
|
1079
|
0
|
0
|
|
|
|
|
next unless ${$data}{$router}{$interface}{'address'}{$ip_address}{'ipAdEntNetMask'}; |
|
|
0
|
|
|
|
|
|
|
|
1080
|
0
|
|
|
|
|
|
$netmask= ${$data}{$router}{$interface}{'address'}{$ip_address}{'ipAdEntNetMask'}; |
|
|
0
|
|
|
|
|
|
|
|
1081
|
0
|
|
|
|
|
|
$local=$ip_address; |
|
1082
|
0
|
|
|
|
|
|
@remote_link=keys %{ $remote_map{$router}{ ${$interface_data}{$router}{$interface}{'ifDescr'} }}; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
1083
|
0
|
0
|
|
|
|
|
if ( scalar(@remote_link) >1 ) { |
|
1084
|
0
|
|
|
|
|
|
$remote=""; } else { $remote=$remote_link[0]; } |
|
|
0
|
|
|
|
|
|
|
|
1085
|
0
|
0
|
|
|
|
|
if ( !$remote ) |
|
1086
|
|
|
|
|
|
|
{ |
|
1087
|
0
|
0
|
|
|
|
|
$remote=$ip_address if $interface_remapper{$ip_address}{$router}{'type'}=~/remote/i; |
|
1088
|
|
|
|
|
|
|
} |
|
1089
|
0
|
|
|
|
|
|
@remote_link=keys %{$interface_map{${$data}{$router}{$interface}{'ipAdEntNetWork'}}}; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
1090
|
0
|
|
|
|
|
|
$remote_router=""; |
|
1091
|
0
|
|
|
|
|
|
foreach my $not_local ( @remote_link ) |
|
1092
|
0
|
0
|
|
|
|
|
{ $remote_router = $not_local if $self->_IpQuadToInt($not_local)!=$self->_IpQuadToInt($ip_address); } |
|
1093
|
0
|
0
|
|
|
|
|
if ( $self->_IpQuadToInt($remote_router)==$self->_IpQuadToInt($router) ) |
|
1094
|
0
|
|
|
|
|
|
{ $remote_router=""; } |
|
1095
|
|
|
|
|
|
|
} |
|
1096
|
|
|
|
|
|
|
|
|
1097
|
0
|
0
|
|
|
|
|
if ( !$remote ) |
|
1098
|
|
|
|
|
|
|
{ |
|
1099
|
0
|
|
|
|
|
|
$network= $self->_IpQuadToInt($local)&$self->_IpQuadToInt($netmask); |
|
1100
|
0
|
|
|
|
|
|
@network_link = keys %{ $network_map{ $network } }; |
|
|
0
|
|
|
|
|
|
|
|
1101
|
0
|
0
|
|
|
|
|
if ( scalar(@network_link)>1 ) |
|
1102
|
|
|
|
|
|
|
{ |
|
1103
|
0
|
|
|
|
|
|
foreach my $not_local ( @network_link ) |
|
1104
|
|
|
|
|
|
|
{ |
|
1105
|
0
|
0
|
|
|
|
|
$remote = $not_local if $self->_IpQuadToInt($not_local)!=$self->_IpQuadToInt($local); |
|
1106
|
|
|
|
|
|
|
} |
|
1107
|
|
|
|
|
|
|
} |
|
1108
|
|
|
|
|
|
|
} |
|
1109
|
|
|
|
|
|
|
|
|
1110
|
0
|
|
|
|
|
|
$output .="$router,${$router_data}{$router}{'hostName'},$interface,${$interface_data}{$router}{$interface}{'ifDescr'},$local,$remote,$router_owners{$remote},${$router_data}{$router_owners{$remote}}{'hostName'},$netmask,${$interface_data}{$router}{$interface}{'ifAdminStatus'},${$interface_data}{$router}{$interface}{'ifOperStatus'},${$interface_data}{$router}{$interface}{'ifAlias'}\n"; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
1111
|
|
|
|
|
|
|
} |
|
1112
|
|
|
|
|
|
|
} |
|
1113
|
|
|
|
|
|
|
|
|
1114
|
0
|
|
|
|
|
|
return $output; |
|
1115
|
|
|
|
|
|
|
} |
|
1116
|
|
|
|
|
|
|
|
|
1117
|
|
|
|
|
|
|
sub CMTS_Motorola_get_config |
|
1118
|
|
|
|
|
|
|
{ |
|
1119
|
|
|
|
|
|
|
# This function is not going to have the extra STM information added |
|
1120
|
|
|
|
|
|
|
# as it should not really be run anyway and it would only be a repition |
|
1121
|
|
|
|
|
|
|
# of code. |
|
1122
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
1123
|
0
|
|
|
|
|
|
my $router_info = shift; |
|
1124
|
0
|
|
|
|
|
|
my $config_data = shift; |
|
1125
|
0
|
|
|
|
|
|
my $username = shift; |
|
1126
|
0
|
|
|
|
|
|
my $password = shift; |
|
1127
|
0
|
|
|
|
|
|
my $enable = shift; |
|
1128
|
|
|
|
|
|
|
|
|
1129
|
0
|
|
|
|
|
|
my ( %private_data ); |
|
1130
|
|
|
|
|
|
|
|
|
1131
|
0
|
|
|
|
|
|
my $current_ubrs=$self->Router_Return_All(); |
|
1132
|
0
|
0
|
|
|
|
|
if ( scalar( keys %{$current_ubrs})==0 ) |
|
|
0
|
|
|
|
|
|
|
|
1133
|
|
|
|
|
|
|
{ |
|
1134
|
0
|
0
|
|
|
|
|
print "Configuration no routers found.\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1135
|
0
|
|
|
|
|
|
return 0; } |
|
1136
|
|
|
|
|
|
|
|
|
1137
|
0
|
|
|
|
|
|
my $snmp_variables = Router::Statistics::OID->STM_populate_oid(); |
|
1138
|
0
|
|
|
|
|
|
my $telnet_commands = Router::Statistics::OID->telnet_commands(); |
|
1139
|
|
|
|
|
|
|
|
|
1140
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
1141
|
|
|
|
|
|
|
{ |
|
1142
|
0
|
0
|
|
|
|
|
print "CMTS Configuration Collection for '$ip_address'.\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1143
|
0
|
0
|
|
|
|
|
if ( $password ) |
|
1144
|
|
|
|
|
|
|
{ |
|
1145
|
0
|
|
|
|
|
|
my $router_name; |
|
1146
|
0
|
|
|
|
|
|
$router_name = ${$router_info}{$ip_address}{'hostName'}; |
|
|
0
|
|
|
|
|
|
|
|
1147
|
0
|
0
|
|
|
|
|
print "CMTS Hostname is '$router_name'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1148
|
0
|
0
|
|
|
|
|
if ( $router_name ) |
|
1149
|
|
|
|
|
|
|
{ |
|
1150
|
0
|
|
|
|
|
|
my $router_t = new Net::Telnet (Timeout => 20, |
|
1151
|
|
|
|
|
|
|
Telnetmode => 0, |
|
1152
|
|
|
|
|
|
|
Cmd_remove_mode => 1, |
|
1153
|
|
|
|
|
|
|
Prompt => "/^Username:|Password:|$router_name/" ); |
|
1154
|
0
|
|
|
|
|
|
my $error_change = $router_t->errmode("return"); |
|
1155
|
0
|
|
|
|
|
|
my $login_router = $router_t->open( $ip_address ); |
|
1156
|
0
|
|
|
|
|
|
my $line; |
|
1157
|
0
|
0
|
|
|
|
|
if ( $login_router ) |
|
1158
|
|
|
|
|
|
|
{ |
|
1159
|
0
|
0
|
|
|
|
|
if ( $username ) |
|
1160
|
|
|
|
|
|
|
{ |
|
1161
|
0
|
0
|
|
|
|
|
print "We have a username.\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1162
|
0
|
0
|
|
|
|
|
print "Username is '$username' password is '$password'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1163
|
0
|
|
|
|
|
|
$router_t->waitfor("/Username:/"); |
|
1164
|
0
|
|
|
|
|
|
$line = $router_t->print( $username ); |
|
1165
|
|
|
|
|
|
|
# $router_t->login($username,$password); |
|
1166
|
|
|
|
|
|
|
} |
|
1167
|
0
|
|
|
|
|
|
$router_t->waitfor("/Password:/"); |
|
1168
|
0
|
|
|
|
|
|
$line = $router_t->print( $password ); |
|
1169
|
0
|
0
|
|
|
|
|
if ( $enable ) |
|
1170
|
|
|
|
|
|
|
{ |
|
1171
|
0
|
0
|
|
|
|
|
print "We have enable\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1172
|
0
|
|
|
|
|
|
$line = $router_t->print("enable"); |
|
1173
|
0
|
|
|
|
|
|
$router_t->waitfor("/Password|$router_name\#/"); |
|
1174
|
0
|
|
|
|
|
|
$line = $router_t->print( $enable ); |
|
1175
|
|
|
|
|
|
|
} |
|
1176
|
0
|
|
|
|
|
|
$router_t->waitfor("/$router_name/"); |
|
1177
|
0
|
|
|
|
|
|
my $config_command = decode_base64(${$telnet_commands}{'show_running_config'}); |
|
|
0
|
|
|
|
|
|
|
|
1178
|
0
|
|
|
|
|
|
$line = $router_t->print( decode_base64(${$telnet_commands}{'page_off'}) ) ; |
|
|
0
|
|
|
|
|
|
|
|
1179
|
0
|
|
|
|
|
|
$router_t->waitfor("/$router_name\#/"); |
|
1180
|
0
|
|
|
|
|
|
my @lines = $router_t->cmd(String => $config_command ,Prompt => "/$router_name\#/"); |
|
1181
|
0
|
|
|
|
|
|
$lines[0]=""; |
|
1182
|
0
|
|
|
|
|
|
foreach my $line ( @lines ) |
|
1183
|
0
|
|
|
|
|
|
{ $line=~s/^\s*//; $line=~ s/\s*$//; $line.="\n"; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
1184
|
0
|
|
|
|
|
|
${$config_data}{$ip_address}{'config'}.=$line; } |
|
|
0
|
|
|
|
|
|
|
|
1185
|
0
|
|
|
|
|
|
$router_t->close(); |
|
1186
|
|
|
|
|
|
|
} |
|
1187
|
|
|
|
|
|
|
} |
|
1188
|
|
|
|
|
|
|
} |
|
1189
|
|
|
|
|
|
|
} |
|
1190
|
0
|
|
|
|
|
|
return 1; |
|
1191
|
|
|
|
|
|
|
} |
|
1192
|
|
|
|
|
|
|
|
|
1193
|
|
|
|
|
|
|
sub UBR_get_stm |
|
1194
|
|
|
|
|
|
|
{ |
|
1195
|
|
|
|
|
|
|
# This function is not going to have the extra STM information added |
|
1196
|
|
|
|
|
|
|
# as it should not really be run anyway and it would only be a repition |
|
1197
|
|
|
|
|
|
|
# of code. |
|
1198
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
1199
|
0
|
|
|
|
|
|
my $router_info = shift; |
|
1200
|
0
|
|
|
|
|
|
my $data = shift; |
|
1201
|
0
|
|
|
|
|
|
my $telnet_data = shift; |
|
1202
|
0
|
|
|
|
|
|
my $username = shift; |
|
1203
|
0
|
|
|
|
|
|
my $password = shift; |
|
1204
|
0
|
|
|
|
|
|
my $enable = shift; |
|
1205
|
0
|
|
|
|
|
|
my $safety_offset = shift; |
|
1206
|
|
|
|
|
|
|
|
|
1207
|
0
|
0
|
0
|
|
|
|
if ( $self->{_GLOBAL}{'STM_Safety_Limit'} && !$safety_offset ) |
|
1208
|
0
|
|
|
|
|
|
{ $safety_offset=$self->{_GLOBAL}{'STM_Safety_Limit'}; } |
|
1209
|
|
|
|
|
|
|
|
|
1210
|
0
|
0
|
|
|
|
|
if ( !$safety_offset ) |
|
1211
|
0
|
|
|
|
|
|
{ $safety_offset=15; } |
|
1212
|
|
|
|
|
|
|
|
|
1213
|
0
|
|
|
|
|
|
my ( %private_data ); |
|
1214
|
|
|
|
|
|
|
|
|
1215
|
0
|
|
|
|
|
|
my $current_ubrs=$self->Router_Return_All(); |
|
1216
|
0
|
0
|
|
|
|
|
if ( scalar( keys %{$current_ubrs})==0 ) { return 0; } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
1217
|
|
|
|
|
|
|
|
|
1218
|
0
|
|
|
|
|
|
my $snmp_variables = Router::Statistics::OID->STM_populate_oid(); |
|
1219
|
0
|
|
|
|
|
|
my $telnet_commands = Router::Statistics::OID->telnet_commands(); |
|
1220
|
0
|
|
|
|
|
|
my $time = Router::Statistics::OID->ntp_populate_oid(); |
|
1221
|
|
|
|
|
|
|
|
|
1222
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
1223
|
|
|
|
|
|
|
{ |
|
1224
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
1225
|
0
|
0
|
|
|
|
|
print "Doing STM MAP for '$ip_address'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1226
|
0
|
|
|
|
|
|
my ($profile_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
1227
|
|
|
|
|
|
|
get_table( |
|
1228
|
|
|
|
|
|
|
-callback => [ \&validate_rule_base, \%private_data, $ip_address, $snmp_variables ], |
|
1229
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'PRIVATE_stm_rule_base'} ); |
|
1230
|
|
|
|
|
|
|
} |
|
1231
|
0
|
|
|
|
|
|
snmp_dispatcher(); |
|
1232
|
|
|
|
|
|
|
|
|
1233
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
1234
|
|
|
|
|
|
|
{ |
|
1235
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
1236
|
0
|
0
|
|
|
|
|
print "Doing ntp for '$ip_address'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1237
|
0
|
|
|
|
|
|
my ($profile_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
1238
|
|
|
|
|
|
|
get_request ( |
|
1239
|
|
|
|
|
|
|
-callback => [ \&validate_callback, $ip_address, \%private_data, $time], |
|
1240
|
0
|
|
|
|
|
|
-varbindlist => [ ${$time}{'cntpSysClock'} ] ); |
|
1241
|
|
|
|
|
|
|
} |
|
1242
|
|
|
|
|
|
|
|
|
1243
|
0
|
|
|
|
|
|
snmp_dispatcher(); |
|
1244
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
1245
|
0
|
|
|
|
|
|
{ $self->convert_ntp_time_mask($private_data{$ip_address}{'cntpSysClock'}, \%private_data, $ip_address ); } |
|
1246
|
|
|
|
|
|
|
|
|
1247
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
1248
|
|
|
|
|
|
|
{ |
|
1249
|
0
|
0
|
|
|
|
|
print "UBR thinks it is Hour is '$private_data{$ip_address}{'time'}{'hour'}' min is '$private_data{$ip_address}{'time'}{'min'}'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1250
|
0
|
|
|
|
|
|
foreach my $stm_rules ( keys %{$private_data{$ip_address}{'stm_rule_set'}} ) |
|
|
0
|
|
|
|
|
|
|
|
1251
|
|
|
|
|
|
|
{ |
|
1252
|
0
|
|
|
|
|
|
my $high_start_time = ($private_data{$ip_address}{'stm_rule_set'}{$stm_rules}{'ccqmCmtsEnfRuleStartTime'}*60); |
|
1253
|
|
|
|
|
|
|
|
|
1254
|
0
|
|
|
|
|
|
my $high_end_time = ($private_data{$ip_address}{'stm_rule_set'}{$stm_rules}{'ccqmCmtsEnfRuleStartTime'}*60)+ |
|
1255
|
|
|
|
|
|
|
$private_data{$ip_address}{'stm_rule_set'}{$stm_rules}{'ccqmCmtsEnfRuleDuration'}; |
|
1256
|
0
|
|
|
|
|
|
$high_end_time=$high_end_time-$safety_offset; |
|
1257
|
|
|
|
|
|
|
|
|
1258
|
0
|
|
|
|
|
|
my $end_hour_time = sprintf("%d",( $private_data{$ip_address}{'stm_rule_set'}{$stm_rules}{'ccqmCmtsEnfRuleStartTime'} + |
|
1259
|
|
|
|
|
|
|
($private_data{$ip_address}{'stm_rule_set'}{$stm_rules}{'ccqmCmtsEnfRuleDuration'}/60))); |
|
1260
|
|
|
|
|
|
|
|
|
1261
|
0
|
0
|
|
|
|
|
if ( $high_start_time>$private_data{$ip_address}{'time'}{'total_minutes'} ) |
|
1262
|
|
|
|
|
|
|
{ |
|
1263
|
0
|
|
|
|
|
|
$private_data{$ip_address}{'stm_rule_not_allowed'}++; |
|
1264
|
0
|
0
|
|
|
|
|
print "We are removing '$stm_rules' not started\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1265
|
0
|
|
|
|
|
|
next; |
|
1266
|
|
|
|
|
|
|
} |
|
1267
|
|
|
|
|
|
|
|
|
1268
|
0
|
0
|
0
|
|
|
|
if ( ($private_data{$ip_address}{'time'}{'total_minutes'}>=$high_start_time) |
|
1269
|
|
|
|
|
|
|
&& |
|
1270
|
|
|
|
|
|
|
($private_data{$ip_address}{'time'}{'total_minutes'}<$high_end_time ) |
|
1271
|
|
|
|
|
|
|
) |
|
1272
|
|
|
|
|
|
|
{ |
|
1273
|
0
|
0
|
|
|
|
|
print "We are allowing '$stm_rules' end point success\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1274
|
|
|
|
|
|
|
} |
|
1275
|
|
|
|
|
|
|
else |
|
1276
|
|
|
|
|
|
|
{ |
|
1277
|
0
|
|
|
|
|
|
$private_data{$ip_address}{'stm_rule_not_allowed'}++; |
|
1278
|
0
|
0
|
|
|
|
|
print "We are removing '$stm_rules' end point failure\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1279
|
0
|
0
|
|
|
|
|
print "Time hour is '$private_data{$ip_address}{'time'}{'hour'}' start time is '$private_data{$ip_address}{'stm_rule_set'}{$stm_rules}{'ccqmCmtsEnfRuleStartTime'}'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1280
|
0
|
0
|
|
|
|
|
print "Time hour is '$private_data{$ip_address}{'time'}{'hour'}' end hour is '$end_hour_time'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1281
|
0
|
0
|
|
|
|
|
print "Time Min is '$private_data{$ip_address}{'time'}{'min'}' \n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1282
|
|
|
|
|
|
|
} |
|
1283
|
|
|
|
|
|
|
} |
|
1284
|
|
|
|
|
|
|
} |
|
1285
|
|
|
|
|
|
|
|
|
1286
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
1287
|
|
|
|
|
|
|
{ |
|
1288
|
0
|
0
|
|
|
|
|
print "IP address is as follows.\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1289
|
0
|
0
|
|
|
|
|
print "Profiles allowed is '".scalar(keys %{$private_data{$ip_address}{'stm_rule_set'}} )."'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
|
0
|
|
|
|
|
|
|
|
1290
|
0
|
0
|
|
|
|
|
print "Profiles banned is '".$private_data{$ip_address}{'stm_rule_not_allowed'}."'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1291
|
|
|
|
|
|
|
} |
|
1292
|
|
|
|
|
|
|
|
|
1293
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
1294
|
|
|
|
|
|
|
{ |
|
1295
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
1296
|
0
|
0
|
|
|
|
|
if ( $private_data{$ip_address}{'stm_rule_not_allowed'}!=scalar( keys %{$private_data{$ip_address}{'stm_rule_set'}} ) ) |
|
|
0
|
|
|
|
|
|
|
|
1297
|
|
|
|
|
|
|
{ |
|
1298
|
0
|
0
|
|
|
|
|
print "We match profiles so can snmp poll for STM '$ip_address'.\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1299
|
0
|
|
|
|
|
|
my ($profile_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
1300
|
|
|
|
|
|
|
get_table( |
|
1301
|
|
|
|
|
|
|
-callback=> [ \&validate_two_plain, $data, $ip_address, $snmp_variables ], |
|
1302
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'PRIVATE_stm_base'} ); |
|
1303
|
|
|
|
|
|
|
} |
|
1304
|
|
|
|
|
|
|
} |
|
1305
|
0
|
|
|
|
|
|
snmp_dispatcher(); |
|
1306
|
|
|
|
|
|
|
|
|
1307
|
0
|
0
|
|
|
|
|
if ( $self->{_GLOBAL}{'Telnet'}==1 ) |
|
1308
|
|
|
|
|
|
|
{ |
|
1309
|
|
|
|
|
|
|
|
|
1310
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
1311
|
|
|
|
|
|
|
{ |
|
1312
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
1313
|
0
|
0
|
|
|
|
|
if ( $private_data{$ip_address}{'stm_rule_not_allowed'}!=scalar( keys %{$private_data{$ip_address}{'stm_rule_set'}} ) ) |
|
|
0
|
|
|
|
|
|
|
|
1314
|
|
|
|
|
|
|
{ |
|
1315
|
0
|
0
|
|
|
|
|
print "We match profiles so can telnet poll for STM '$ip_address'.\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1316
|
0
|
0
|
0
|
|
|
|
if ( $username && $password ) |
|
1317
|
|
|
|
|
|
|
{ |
|
1318
|
0
|
|
|
|
|
|
my $router_name = ${$router_info}{$ip_address}{'hostName'}; |
|
|
0
|
|
|
|
|
|
|
|
1319
|
0
|
0
|
|
|
|
|
if ( $router_name ) |
|
1320
|
|
|
|
|
|
|
{ |
|
1321
|
0
|
|
|
|
|
|
my $safe_router_name=$router_name; |
|
1322
|
0
|
|
|
|
|
|
my $router_t = new Net::Telnet (Timeout => 20, |
|
1323
|
|
|
|
|
|
|
Telnetmode => 0, |
|
1324
|
|
|
|
|
|
|
Prompt => "/^Username :|Password :|$safe_router_name/" ); |
|
1325
|
0
|
|
|
|
|
|
my $error_change = $router_t->errmode("return"); |
|
1326
|
0
|
|
|
|
|
|
my $login_router = $router_t->open( $ip_address ); |
|
1327
|
0
|
0
|
|
|
|
|
if ( $login_router ) |
|
1328
|
|
|
|
|
|
|
{ |
|
1329
|
0
|
|
|
|
|
|
$router_t->login($username,$password); |
|
1330
|
0
|
0
|
|
|
|
|
if ( $enable ) |
|
1331
|
|
|
|
|
|
|
{ |
|
1332
|
0
|
|
|
|
|
|
my $line = $router_t->print("enable"); |
|
1333
|
0
|
|
|
|
|
|
$router_t->waitfor("/Password/"); |
|
1334
|
0
|
|
|
|
|
|
$line = $router_t->print( $enable ); |
|
1335
|
0
|
|
|
|
|
|
$router_t->waitfor("/$safe_router_name/"); |
|
1336
|
|
|
|
|
|
|
} |
|
1337
|
0
|
|
|
|
|
|
my $stm_command = decode_base64(${$telnet_commands}{'stm_command'}); |
|
|
0
|
|
|
|
|
|
|
|
1338
|
0
|
|
|
|
|
|
my $line = $router_t->print( decode_base64(${$telnet_commands}{'termline'}) ) ; |
|
|
0
|
|
|
|
|
|
|
|
1339
|
0
|
|
|
|
|
|
$router_t->waitfor("/$router_name\#/"); |
|
1340
|
0
|
|
|
|
|
|
my @lines = $router_t->cmd(String => $stm_command ,Prompt => "/$safe_router_name\#/"); |
|
1341
|
0
|
|
|
|
|
|
$router_t->close(); |
|
1342
|
|
|
|
|
|
|
# we need to make sure we handle the multiple domains within the output |
|
1343
|
|
|
|
|
|
|
# as Telnet commands are notorious for providing correct but repeating idents |
|
1344
|
|
|
|
|
|
|
# these need to be mapped into a unique handler. Lets face it though, using |
|
1345
|
|
|
|
|
|
|
# telnet is just a really bad idea. |
|
1346
|
0
|
|
|
|
|
|
$a=0; |
|
1347
|
0
|
|
|
|
|
|
foreach $line ( @lines ) |
|
1348
|
|
|
|
|
|
|
{ |
|
1349
|
0
|
0
|
|
|
|
|
next if $line=~/^$safe_router_name/; |
|
1350
|
0
|
0
|
|
|
|
|
next unless $line=~/^[0-9]/; |
|
1351
|
0
|
0
|
|
|
|
|
next unless length($line)>10; |
|
1352
|
0
|
|
|
|
|
|
chop($line); |
|
1353
|
0
|
|
|
|
|
|
my @fields = (split(/\W*\s+\W*/,$line)); |
|
1354
|
0
|
|
|
|
|
|
my $instance_telnet = "$a".$fields[0]; |
|
1355
|
0
|
|
|
|
|
|
${$telnet_data}{$ip_address}{$instance_telnet}{'ccqmEnfRuleViolateMacAddr'}=$fields[1]; |
|
|
0
|
|
|
|
|
|
|
|
1356
|
0
|
|
|
|
|
|
${$telnet_data}{$ip_address}{$instance_telnet}{'ccqmEnfRuleViolateRuleName'}=$fields[2]; |
|
|
0
|
|
|
|
|
|
|
|
1357
|
0
|
|
|
|
|
|
${$telnet_data}{$ip_address}{$instance_telnet}{'ccqmEnfRuleViolateLastDetectTime'}="$fields[4] $fields[5]"; |
|
|
0
|
|
|
|
|
|
|
|
1358
|
0
|
|
|
|
|
|
${$telnet_data}{$ip_address}{$instance_telnet}{'ccqmEnfRuleViolatePenaltyExpTime'}="$fields[6] $fields[7]"; |
|
|
0
|
|
|
|
|
|
|
|
1359
|
0
|
|
|
|
|
|
$a++; |
|
1360
|
|
|
|
|
|
|
} |
|
1361
|
|
|
|
|
|
|
} |
|
1362
|
|
|
|
|
|
|
} |
|
1363
|
|
|
|
|
|
|
} |
|
1364
|
|
|
|
|
|
|
} |
|
1365
|
|
|
|
|
|
|
} |
|
1366
|
|
|
|
|
|
|
|
|
1367
|
|
|
|
|
|
|
} |
|
1368
|
|
|
|
|
|
|
|
|
1369
|
|
|
|
|
|
|
|
|
1370
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
1371
|
|
|
|
|
|
|
{ |
|
1372
|
0
|
0
|
|
|
|
|
if ( $private_data{$ip_address}{'stm_rule_not_allowed'}!=scalar( keys %{$private_data{$ip_address}{'stm_rule_set'}} ) ) |
|
|
0
|
|
|
|
|
|
|
|
1373
|
|
|
|
|
|
|
{ |
|
1374
|
0
|
|
|
|
|
|
foreach my $instance ( keys %{${$data}{$ip_address}} ) |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
1375
|
|
|
|
|
|
|
{ |
|
1376
|
0
|
0
|
|
|
|
|
next if $instance=~/^cntpSysClock/ig; |
|
1377
|
0
|
|
|
|
|
|
${$data}{$ip_address}{$instance}{'ccqmEnfRuleViolateMacAddr'}= |
|
|
0
|
|
|
|
|
|
|
|
1378
|
0
|
|
|
|
|
|
$self->_convert_mac_address( ${$data}{$ip_address}{$instance}{'ccqmEnfRuleViolateMacAddr'} ); |
|
1379
|
0
|
|
|
|
|
|
${$data}{$ip_address}{$instance}{'ccqmEnfRuleViolateLastDetectTime'}= |
|
|
0
|
|
|
|
|
|
|
|
1380
|
0
|
|
|
|
|
|
$self->convert_time_mask( ${$data}{$ip_address}{$instance}{'ccqmEnfRuleViolateLastDetectTime'} ); |
|
1381
|
0
|
|
|
|
|
|
${$data}{$ip_address}{$instance}{'ccqmEnfRuleViolatePenaltyExpTime'}= |
|
|
0
|
|
|
|
|
|
|
|
1382
|
0
|
|
|
|
|
|
$self->convert_time_mask( ${$data}{$ip_address}{$instance}{'ccqmEnfRuleViolatePenaltyExpTime'} ); |
|
1383
|
|
|
|
|
|
|
} |
|
1384
|
|
|
|
|
|
|
} |
|
1385
|
|
|
|
|
|
|
} |
|
1386
|
0
|
|
|
|
|
|
return 1; |
|
1387
|
|
|
|
|
|
|
} |
|
1388
|
|
|
|
|
|
|
|
|
1389
|
|
|
|
|
|
|
sub UBR_get_stm_Blocking |
|
1390
|
|
|
|
|
|
|
{ |
|
1391
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
1392
|
0
|
|
|
|
|
|
my $router_info = shift; |
|
1393
|
0
|
|
|
|
|
|
my $data = shift; |
|
1394
|
0
|
|
|
|
|
|
my $telnet_data = shift; |
|
1395
|
0
|
|
|
|
|
|
my $username = shift; |
|
1396
|
0
|
|
|
|
|
|
my $password = shift; |
|
1397
|
0
|
|
|
|
|
|
my $enable = shift; |
|
1398
|
0
|
|
|
|
|
|
my $safety_offset = shift; |
|
1399
|
|
|
|
|
|
|
|
|
1400
|
0
|
0
|
0
|
|
|
|
if ( $self->{_GLOBAL}{'STM_Safety_Limit'} && !$safety_offset ) |
|
1401
|
0
|
|
|
|
|
|
{ $safety_offset=$self->{_GLOBAL}{'STM_Safety_Limit'}; } |
|
1402
|
|
|
|
|
|
|
|
|
1403
|
0
|
0
|
|
|
|
|
if ( !$safety_offset ) |
|
1404
|
0
|
|
|
|
|
|
{ $safety_offset=15; } |
|
1405
|
|
|
|
|
|
|
|
|
1406
|
0
|
|
|
|
|
|
my $current_ubrs=$self->Router_Return_All(); |
|
1407
|
0
|
0
|
|
|
|
|
if ( scalar( keys %{$current_ubrs})==0 ) { return 0; } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
1408
|
|
|
|
|
|
|
|
|
1409
|
0
|
|
|
|
|
|
my ( $foo, $bar ); |
|
1410
|
|
|
|
|
|
|
|
|
1411
|
0
|
|
|
|
|
|
my ( %private_data ); |
|
1412
|
|
|
|
|
|
|
|
|
1413
|
0
|
|
|
|
|
|
my $snmp_variables = Router::Statistics::OID->STM_populate_oid(); |
|
1414
|
0
|
|
|
|
|
|
my $telnet_commands = Router::Statistics::OID->telnet_commands(); |
|
1415
|
0
|
|
|
|
|
|
my $time = Router::Statistics::OID->ntp_populate_oid(); |
|
1416
|
|
|
|
|
|
|
|
|
1417
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
1418
|
|
|
|
|
|
|
{ |
|
1419
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
1420
|
0
|
0
|
|
|
|
|
print "Doing STM MAP for '$ip_address'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1421
|
0
|
|
|
|
|
|
my ($profile_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
1422
|
0
|
|
|
|
|
|
get_table( -baseoid => ${$snmp_variables}{'PRIVATE_stm_rule_base'} ); |
|
1423
|
0
|
|
|
|
|
|
while(($foo, $bar) = each(%{$profile_information})) |
|
|
0
|
|
|
|
|
|
|
|
1424
|
|
|
|
|
|
|
{ |
|
1425
|
0
|
|
|
|
|
|
my $instance; |
|
1426
|
0
|
|
|
|
|
|
foreach my $attribute ( keys %{$snmp_variables} ) |
|
|
0
|
|
|
|
|
|
|
|
1427
|
|
|
|
|
|
|
{ |
|
1428
|
0
|
0
|
|
|
|
|
if ( $attribute!~/^PRIVATE/ ) |
|
1429
|
|
|
|
|
|
|
{ |
|
1430
|
0
|
0
|
|
|
|
|
if ( $foo =~ /^${$snmp_variables}{$attribute}/) |
|
|
0
|
|
|
|
|
|
|
|
1431
|
|
|
|
|
|
|
{ |
|
1432
|
0
|
|
|
|
|
|
my $new_oid=$foo; |
|
1433
|
0
|
|
|
|
|
|
$new_oid=~s/${$snmp_variables}{$attribute}//g; |
|
|
0
|
|
|
|
|
|
|
|
1434
|
0
|
|
|
|
|
|
my $name; |
|
1435
|
0
|
|
|
|
|
|
foreach my $character ( split(/\./,$new_oid) ) |
|
1436
|
0
|
0
|
|
|
|
|
{ next if $character<15; $name.=chr($character); } |
|
|
0
|
|
|
|
|
|
|
|
1437
|
0
|
|
|
|
|
|
$name=~s/^\s*//; $name=~ s/\s*$//; |
|
|
0
|
|
|
|
|
|
|
|
1438
|
0
|
|
|
|
|
|
$private_data{$ip_address}{'stm_rule_set'}{$name}{$attribute}=$bar; |
|
1439
|
|
|
|
|
|
|
} |
|
1440
|
|
|
|
|
|
|
} |
|
1441
|
|
|
|
|
|
|
} |
|
1442
|
|
|
|
|
|
|
} |
|
1443
|
|
|
|
|
|
|
} |
|
1444
|
|
|
|
|
|
|
|
|
1445
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
1446
|
|
|
|
|
|
|
{ |
|
1447
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
1448
|
|
|
|
|
|
|
|
|
1449
|
0
|
|
|
|
|
|
my ($time_request)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
1450
|
|
|
|
|
|
|
get_request ( -varbindlist => [ |
|
1451
|
0
|
|
|
|
|
|
${$time}{'cntpSysClock'} |
|
1452
|
|
|
|
|
|
|
] ); |
|
1453
|
|
|
|
|
|
|
|
|
1454
|
0
|
|
|
|
|
|
$self->convert_ntp_time_mask( $time_request->{ ${$time}{'cntpSysClock'} }, \%private_data, $ip_address ); |
|
|
0
|
|
|
|
|
|
|
|
1455
|
0
|
0
|
|
|
|
|
print "UBR thinks its Hour is '$private_data{$ip_address}{'time'}{'hour'}' min is '$private_data{$ip_address}{'time'}{'min'}'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1456
|
|
|
|
|
|
|
|
|
1457
|
0
|
|
|
|
|
|
foreach my $stm_rules ( keys %{$private_data{$ip_address}{'stm_rule_set'}} ) |
|
|
0
|
|
|
|
|
|
|
|
1458
|
|
|
|
|
|
|
{ |
|
1459
|
|
|
|
|
|
|
|
|
1460
|
0
|
0
|
|
|
|
|
print "Rule name is '$stm_rules'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1461
|
0
|
0
|
|
|
|
|
print "Start time is '$private_data{$ip_address}{'stm_rule_set'}{$stm_rules}{'ccqmCmtsEnfRuleStartTime'}'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1462
|
|
|
|
|
|
|
|
|
1463
|
0
|
|
|
|
|
|
my $end_hour_time = sprintf("%d",( $private_data{$ip_address}{'stm_rule_set'}{$stm_rules}{'ccqmCmtsEnfRuleStartTime'} + |
|
1464
|
|
|
|
|
|
|
($private_data{$ip_address}{'stm_rule_set'}{$stm_rules}{'ccqmCmtsEnfRuleDuration'}/60))); |
|
1465
|
|
|
|
|
|
|
|
|
1466
|
0
|
|
|
|
|
|
my $high_start_time = ($private_data{$ip_address}{'stm_rule_set'}{$stm_rules}{'ccqmCmtsEnfRuleStartTime'}*60); |
|
1467
|
|
|
|
|
|
|
|
|
1468
|
0
|
|
|
|
|
|
my $high_end_time = ($private_data{$ip_address}{'stm_rule_set'}{$stm_rules}{'ccqmCmtsEnfRuleStartTime'}*60)+ |
|
1469
|
|
|
|
|
|
|
$private_data{$ip_address}{'stm_rule_set'}{$stm_rules}{'ccqmCmtsEnfRuleDuration'}; |
|
1470
|
0
|
|
|
|
|
|
$high_end_time=$high_end_time-$safety_offset; |
|
1471
|
|
|
|
|
|
|
|
|
1472
|
|
|
|
|
|
|
|
|
1473
|
|
|
|
|
|
|
#print "End time is '$end_hour_time'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1474
|
|
|
|
|
|
|
|
|
1475
|
0
|
0
|
|
|
|
|
if ( $high_start_time>$private_data{$ip_address}{'time'}{'total_minutes'} ) |
|
1476
|
|
|
|
|
|
|
{ |
|
1477
|
0
|
|
|
|
|
|
$private_data{$ip_address}{'stm_rule_not_allowed'}++; |
|
1478
|
0
|
0
|
|
|
|
|
print "We are removing '$stm_rules' not started\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1479
|
0
|
|
|
|
|
|
next; |
|
1480
|
|
|
|
|
|
|
} |
|
1481
|
|
|
|
|
|
|
|
|
1482
|
0
|
0
|
0
|
|
|
|
if ( ($private_data{$ip_address}{'time'}{'total_minutes'}>=$high_start_time) |
|
1483
|
|
|
|
|
|
|
&& |
|
1484
|
|
|
|
|
|
|
($private_data{$ip_address}{'time'}{'total_minutes'}<$high_end_time ) |
|
1485
|
|
|
|
|
|
|
) |
|
1486
|
|
|
|
|
|
|
{ |
|
1487
|
0
|
0
|
|
|
|
|
print "We are allowing '$stm_rules' end point success2\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1488
|
|
|
|
|
|
|
} |
|
1489
|
|
|
|
|
|
|
else |
|
1490
|
|
|
|
|
|
|
{ |
|
1491
|
0
|
|
|
|
|
|
$private_data{$ip_address}{'stm_rule_not_allowed'}++; |
|
1492
|
0
|
0
|
|
|
|
|
print "We are removing '$stm_rules' end point failure2\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1493
|
0
|
0
|
|
|
|
|
print "Time hour is '$private_data{$ip_address}{'time'}{'hour'}' start time is '$private_data{$ip_address}{'stm_rule_set'}{$stm_rules}{'ccqmCmtsEnfRuleStartTime'}'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1494
|
0
|
0
|
|
|
|
|
print "Time hour is '$private_data{$ip_address}{'time'}{'hour'}' end hour is '$end_hour_time'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1495
|
0
|
0
|
|
|
|
|
print "Time Min is '$private_data{$ip_address}{'time'}{'min'}' \n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1496
|
|
|
|
|
|
|
|
|
1497
|
|
|
|
|
|
|
|
|
1498
|
|
|
|
|
|
|
} |
|
1499
|
0
|
0
|
|
|
|
|
print "Now count is '".$private_data{$ip_address}{'stm_rule_not_allowed'}."' for '$stm_rules'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1500
|
|
|
|
|
|
|
} |
|
1501
|
|
|
|
|
|
|
|
|
1502
|
0
|
0
|
|
|
|
|
print "Profiles allowed is '".scalar(keys %{$private_data{$ip_address}{'stm_rule_set'}} )."'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
|
0
|
|
|
|
|
|
|
|
1503
|
0
|
0
|
|
|
|
|
print "Profiles banned is '".$private_data{$ip_address}{'stm_rule_not_allowed'}."'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1504
|
|
|
|
|
|
|
|
|
1505
|
0
|
0
|
|
|
|
|
if ( $private_data{$ip_address}{'stm_rule_not_allowed'}!=scalar( keys %{$private_data{$ip_address}{'stm_rule_set'}} ) ) |
|
|
0
|
|
|
|
|
|
|
|
1506
|
|
|
|
|
|
|
{ |
|
1507
|
0
|
0
|
|
|
|
|
print "We match profiles so can snmp and telnet poll for STM2 '$ip_address'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1508
|
0
|
|
|
|
|
|
my ($profile_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
1509
|
0
|
|
|
|
|
|
get_table( -baseoid => ${$snmp_variables}{'PRIVATE_stm_base'} ); |
|
1510
|
|
|
|
|
|
|
|
|
1511
|
0
|
|
|
|
|
|
while(($foo, $bar) = each(%{$profile_information})) |
|
|
0
|
|
|
|
|
|
|
|
1512
|
|
|
|
|
|
|
{ |
|
1513
|
0
|
|
|
|
|
|
my $instance; |
|
1514
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ccqmEnfRuleViolateMacAddr'}.(\d+).(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
1515
|
0
|
|
|
|
|
|
{ $instance="$1:$2"; ${$data}{$ip_address}{$instance}{'ccqmEnfRuleViolateMacAddr'}=_convert_mac_address($bar); } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
1516
|
|
|
|
|
|
|
|
|
1517
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ccqmEnfRuleViolateLastDetectTime'}.(\d+).(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
1518
|
0
|
|
|
|
|
|
{ $instance="$1:$2"; ${$data}{$ip_address}{$instance}{'ccqmEnfRuleViolateLastDetectTime'}=$self->convert_time_mask($bar); } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
1519
|
|
|
|
|
|
|
|
|
1520
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ccqmEnfRuleViolatePenaltyExpTime'}.(\d+).(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
1521
|
0
|
|
|
|
|
|
{ $instance="$1:$2"; ${$data}{$ip_address}{$instance}{'ccqmEnfRuleViolatePenaltyExpTime'}=$self->convert_time_mask($bar); } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
1522
|
|
|
|
|
|
|
|
|
1523
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ccqmEnfRuleViolateRuleName'}.(\d+).(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
1524
|
0
|
|
|
|
|
|
{ $instance="$1:$2"; ${$data}{$ip_address}{$instance}{'ccqmEnfRuleViolateRuleName'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
1525
|
|
|
|
|
|
|
|
|
1526
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ccqmEnfRuleViolateByteCount'}.(\d+).(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
1527
|
0
|
|
|
|
|
|
{ $instance="$1:$2"; ${$data}{$ip_address}{$instance}{'ccqmEnfRuleViolateByteCount'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
1528
|
|
|
|
|
|
|
|
|
1529
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ccqmEnfRuleViolateID'}.(\d+).(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
1530
|
0
|
|
|
|
|
|
{ $instance="$1:$2"; ${$data}{$ip_address}{$instance}{'ccqmEnfRuleViolateID'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
1531
|
0
|
|
|
|
|
|
delete ${$profile_information}{$foo}; |
|
|
0
|
|
|
|
|
|
|
|
1532
|
|
|
|
|
|
|
} |
|
1533
|
|
|
|
|
|
|
|
|
1534
|
0
|
0
|
|
|
|
|
if ( $self->{_GLOBAL}{'Telnet'}==1 ) |
|
1535
|
|
|
|
|
|
|
{ |
|
1536
|
|
|
|
|
|
|
|
|
1537
|
|
|
|
|
|
|
|
|
1538
|
0
|
0
|
0
|
|
|
|
if ( $username && $password ) |
|
1539
|
|
|
|
|
|
|
{ |
|
1540
|
|
|
|
|
|
|
|
|
1541
|
0
|
|
|
|
|
|
my $router_name = ${$router_info}{$ip_address}{'hostName'}; |
|
|
0
|
|
|
|
|
|
|
|
1542
|
0
|
0
|
|
|
|
|
if ( $router_name ) |
|
1543
|
|
|
|
|
|
|
{ |
|
1544
|
0
|
|
|
|
|
|
my $safe_router_name=$router_name; |
|
1545
|
0
|
|
|
|
|
|
my $router_t = new Net::Telnet (Timeout => 20, |
|
1546
|
|
|
|
|
|
|
Telnetmode => 0, |
|
1547
|
|
|
|
|
|
|
Prompt => "/^Username :|Password :|$safe_router_name/" ); |
|
1548
|
0
|
|
|
|
|
|
my $error_change = $router_t->errmode("return"); |
|
1549
|
0
|
|
|
|
|
|
my $login_router = $router_t->open( $ip_address ); |
|
1550
|
0
|
0
|
|
|
|
|
if ( $login_router ) |
|
1551
|
|
|
|
|
|
|
{ |
|
1552
|
0
|
|
|
|
|
|
$router_t->login($username,$password); |
|
1553
|
0
|
0
|
|
|
|
|
if ( $enable ) |
|
1554
|
|
|
|
|
|
|
{ |
|
1555
|
0
|
|
|
|
|
|
my $line = $router_t->print("enable"); |
|
1556
|
0
|
|
|
|
|
|
$router_t->waitfor("/Password/"); |
|
1557
|
0
|
|
|
|
|
|
$line = $router_t->print( $enable ); |
|
1558
|
0
|
|
|
|
|
|
$router_t->waitfor("/$safe_router_name/"); |
|
1559
|
|
|
|
|
|
|
} |
|
1560
|
0
|
|
|
|
|
|
my $stm_command = decode_base64(${$telnet_commands}{'stm_command'}); |
|
|
0
|
|
|
|
|
|
|
|
1561
|
0
|
|
|
|
|
|
my $line = $router_t->print( decode_base64(${$telnet_commands}{'termline'}) ) ; |
|
|
0
|
|
|
|
|
|
|
|
1562
|
0
|
|
|
|
|
|
$router_t->waitfor("/$router_name\#/"); |
|
1563
|
0
|
|
|
|
|
|
my @lines = $router_t->cmd(String => $stm_command ,Prompt => "/$safe_router_name\#/"); |
|
1564
|
0
|
|
|
|
|
|
$router_t->close(); |
|
1565
|
|
|
|
|
|
|
# we need to make sure we handle the multiple domains within the output |
|
1566
|
|
|
|
|
|
|
# as Telnet commands are notorious for providing correct but repeating idents |
|
1567
|
|
|
|
|
|
|
# these need to be mapped into a unique handler. Lets face it though, using |
|
1568
|
|
|
|
|
|
|
# telnet is just a really bad idea. |
|
1569
|
0
|
|
|
|
|
|
$a=0; |
|
1570
|
0
|
|
|
|
|
|
foreach $line ( @lines ) |
|
1571
|
|
|
|
|
|
|
{ |
|
1572
|
0
|
0
|
|
|
|
|
next if $line=~/^$safe_router_name/; |
|
1573
|
0
|
0
|
|
|
|
|
next unless $line=~/^[0-9]/; |
|
1574
|
0
|
0
|
|
|
|
|
next unless length($line)>10; |
|
1575
|
0
|
|
|
|
|
|
chop($line); |
|
1576
|
0
|
|
|
|
|
|
my @fields = (split(/\W*\s+\W*/,$line)); |
|
1577
|
0
|
|
|
|
|
|
my $instance_telnet = "$a".$fields[0]; |
|
1578
|
0
|
|
|
|
|
|
${$telnet_data}{$ip_address}{$instance_telnet}{'ccqmEnfRuleViolateMacAddr'}=$fields[1]; |
|
|
0
|
|
|
|
|
|
|
|
1579
|
0
|
|
|
|
|
|
${$telnet_data}{$ip_address}{$instance_telnet}{'ccqmEnfRuleViolateRuleName'}=$fields[2]; |
|
|
0
|
|
|
|
|
|
|
|
1580
|
0
|
|
|
|
|
|
${$telnet_data}{$ip_address}{$instance_telnet}{'ccqmEnfRuleViolateLastDetectTime'}="$fields[4] $fields[5]"; |
|
|
0
|
|
|
|
|
|
|
|
1581
|
0
|
|
|
|
|
|
${$telnet_data}{$ip_address}{$instance_telnet}{'ccqmEnfRuleViolatePenaltyExpTime'}="$fields[6] $fields[7]"; |
|
|
0
|
|
|
|
|
|
|
|
1582
|
0
|
|
|
|
|
|
$a++; |
|
1583
|
|
|
|
|
|
|
} |
|
1584
|
|
|
|
|
|
|
} |
|
1585
|
|
|
|
|
|
|
} |
|
1586
|
|
|
|
|
|
|
} |
|
1587
|
|
|
|
|
|
|
} |
|
1588
|
|
|
|
|
|
|
# recheck router is still up, after a poll ? |
|
1589
|
|
|
|
|
|
|
# we can not do this in non blocking mode, alas. |
|
1590
|
|
|
|
|
|
|
# |
|
1591
|
|
|
|
|
|
|
# Currently this section removed as it is not uptime we need to check all the time. |
|
1592
|
|
|
|
|
|
|
# The bug with STM is that if you poll outside the window, it can crash the router/line |
|
1593
|
|
|
|
|
|
|
# cards ( possibly one then the other ) |
|
1594
|
|
|
|
|
|
|
# This check as been taken out to allow checks to be done by a wrapper of some |
|
1595
|
|
|
|
|
|
|
# description call this code. |
|
1596
|
|
|
|
|
|
|
# |
|
1597
|
|
|
|
|
|
|
#my ($time_request)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
1598
|
|
|
|
|
|
|
# get_request ( -varbindlist => [ ${$time}{'cntpSysClock'} ] ); |
|
1599
|
|
|
|
|
|
|
#if ( $self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}->error ) |
|
1600
|
|
|
|
|
|
|
# { |
|
1601
|
|
|
|
|
|
|
# # We failed to get ntp time from the router we just polled. |
|
1602
|
|
|
|
|
|
|
# # we stop all polling and return out. |
|
1603
|
|
|
|
|
|
|
# print "Router failed to return after STM poll we are exiting.\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1604
|
|
|
|
|
|
|
# return 1; |
|
1605
|
|
|
|
|
|
|
# } |
|
1606
|
|
|
|
|
|
|
} |
|
1607
|
|
|
|
|
|
|
} |
|
1608
|
|
|
|
|
|
|
|
|
1609
|
0
|
|
|
|
|
|
return 1; |
|
1610
|
|
|
|
|
|
|
} |
|
1611
|
|
|
|
|
|
|
|
|
1612
|
|
|
|
|
|
|
|
|
1613
|
|
|
|
|
|
|
|
|
1614
|
|
|
|
|
|
|
sub Router_get_interfaces |
|
1615
|
|
|
|
|
|
|
{ |
|
1616
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
1617
|
0
|
|
|
|
|
|
my $data = shift; |
|
1618
|
0
|
|
|
|
|
|
my $type = shift; |
|
1619
|
|
|
|
|
|
|
|
|
1620
|
0
|
|
|
|
|
|
my $current_ubrs=$self->Router_Return_All(); |
|
1621
|
0
|
0
|
|
|
|
|
if ( scalar( keys %{$current_ubrs})==0 ) { return 0; } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
1622
|
|
|
|
|
|
|
|
|
1623
|
0
|
|
|
|
|
|
my $snmp_variables; |
|
1624
|
|
|
|
|
|
|
|
|
1625
|
0
|
0
|
0
|
|
|
|
if ( $self->{_GLOBAL}{'32Bit'}==1 || |
|
1626
|
|
|
|
|
|
|
$type=~/^32Bit$/i ) |
|
1627
|
0
|
|
|
|
|
|
{ $snmp_variables=Router::Statistics::OID->Router_interface_oid(); } |
|
1628
|
|
|
|
|
|
|
|
|
1629
|
0
|
0
|
0
|
|
|
|
if ( $self->{_GLOBAL}{'64Bit'}==1 || |
|
1630
|
|
|
|
|
|
|
$type=~/^64Bit$/i ) |
|
1631
|
0
|
|
|
|
|
|
{ $snmp_variables=Router::Statistics::OID->Router_interface_oid_hc(); } |
|
1632
|
|
|
|
|
|
|
|
|
1633
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
1634
|
|
|
|
|
|
|
{ |
|
1635
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
1636
|
0
|
|
|
|
|
|
my ($profile_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
1637
|
|
|
|
|
|
|
get_table( |
|
1638
|
|
|
|
|
|
|
-callback => [ \&validate_one, $data, $ip_address, $snmp_variables ], |
|
1639
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'PRIVATE_interface_base'} ); |
|
1640
|
|
|
|
|
|
|
} |
|
1641
|
0
|
|
|
|
|
|
snmp_dispatcher(); |
|
1642
|
|
|
|
|
|
|
|
|
1643
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
1644
|
|
|
|
|
|
|
{ |
|
1645
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
1646
|
0
|
|
|
|
|
|
my ($profile_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
1647
|
|
|
|
|
|
|
get_table( |
|
1648
|
|
|
|
|
|
|
-callback => [ \&validate_one, $data, $ip_address, $snmp_variables ], |
|
1649
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'ifAlias'} ); |
|
1650
|
|
|
|
|
|
|
} |
|
1651
|
0
|
|
|
|
|
|
snmp_dispatcher(); |
|
1652
|
|
|
|
|
|
|
|
|
1653
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$data} ) |
|
|
0
|
|
|
|
|
|
|
|
1654
|
|
|
|
|
|
|
{ |
|
1655
|
0
|
|
|
|
|
|
foreach my $interfaces ( keys %{${$data}{$ip_address}} ) |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
1656
|
|
|
|
|
|
|
{ |
|
1657
|
0
|
|
|
|
|
|
${$data}{$ip_address}{$interfaces}{'ifPhysAddress'}= |
|
|
0
|
|
|
|
|
|
|
|
1658
|
0
|
|
|
|
|
|
_convert_mac_address(${$data}{$ip_address}{$interfaces}{'ifPhysAddress'}); |
|
1659
|
0
|
|
|
|
|
|
${$data}{$ip_address}{$interfaces}{'ifAdminStatus'}= |
|
|
0
|
|
|
|
|
|
|
|
1660
|
0
|
|
|
|
|
|
('0_Unknown','1_Up','2_Down','3_Testing')[${$data}{$ip_address}{$interfaces}{'ifAdminStatus'}]; |
|
1661
|
0
|
|
|
|
|
|
${$data}{$ip_address}{$interfaces}{'ifOperStatus'}= |
|
|
0
|
|
|
|
|
|
|
|
1662
|
|
|
|
|
|
|
('0_Unknown','1_Up','2_Down','3_Testing','4_Unknown','5_Dormant','6_NotPresent','7_LowerLayerDown') |
|
1663
|
0
|
|
|
|
|
|
[${$data}{$ip_address}{$interfaces}{'ifOperStatus'}]; |
|
1664
|
|
|
|
|
|
|
} |
|
1665
|
|
|
|
|
|
|
} |
|
1666
|
0
|
|
|
|
|
|
return 1; |
|
1667
|
|
|
|
|
|
|
} |
|
1668
|
|
|
|
|
|
|
|
|
1669
|
|
|
|
|
|
|
sub Router_get_interfaces_description2_MPEG |
|
1670
|
|
|
|
|
|
|
{ |
|
1671
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
1672
|
0
|
|
|
|
|
|
my $data = shift; |
|
1673
|
0
|
|
|
|
|
|
my $type = shift; |
|
1674
|
|
|
|
|
|
|
|
|
1675
|
0
|
|
|
|
|
|
my $current_ubrs=$self->Router_Return_All(); |
|
1676
|
0
|
0
|
|
|
|
|
if ( scalar( keys %{$current_ubrs})==0 ) |
|
|
0
|
|
|
|
|
|
|
|
1677
|
|
|
|
|
|
|
{ |
|
1678
|
0
|
0
|
|
|
|
|
print "No Routers not running" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1679
|
0
|
|
|
|
|
|
return 0; } |
|
1680
|
|
|
|
|
|
|
|
|
1681
|
0
|
|
|
|
|
|
my $snmp_variables=Router::Statistics::OID->Router_inventory_oid(); |
|
1682
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
1683
|
|
|
|
|
|
|
{ |
|
1684
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
1685
|
0
|
0
|
|
|
|
|
print "Doing IP '$ip_address'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1686
|
0
|
|
|
|
|
|
my ( $foo, $bar ); |
|
1687
|
0
|
|
|
|
|
|
my ($profile_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
1688
|
|
|
|
|
|
|
get_table( |
|
1689
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'entPhysicalName'} ); |
|
1690
|
0
|
|
|
|
|
|
while(($foo, $bar) = each(%{$profile_information})) |
|
|
0
|
|
|
|
|
|
|
|
1691
|
|
|
|
|
|
|
{ |
|
1692
|
|
|
|
|
|
|
#print "Foo is '$foo' bar is '$bar'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1693
|
0
|
0
|
|
|
|
|
next unless($foo =~ /^${$snmp_variables}{'entPhysicalName'}.(\d+)/); |
|
|
0
|
|
|
|
|
|
|
|
1694
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'entPhysicalName'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
1695
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'entPhysicalName'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
1696
|
|
|
|
|
|
|
} |
|
1697
|
|
|
|
|
|
|
} |
|
1698
|
0
|
|
|
|
|
|
return 1; |
|
1699
|
|
|
|
|
|
|
} |
|
1700
|
|
|
|
|
|
|
|
|
1701
|
|
|
|
|
|
|
|
|
1702
|
|
|
|
|
|
|
sub Router_get_interfaces_description_MPEG |
|
1703
|
|
|
|
|
|
|
{ |
|
1704
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
1705
|
0
|
|
|
|
|
|
my $data = shift; |
|
1706
|
0
|
|
|
|
|
|
my $type = shift; |
|
1707
|
|
|
|
|
|
|
|
|
1708
|
0
|
|
|
|
|
|
my $current_ubrs=$self->Router_Return_All(); |
|
1709
|
0
|
0
|
|
|
|
|
if ( scalar( keys %{$current_ubrs})==0 ) |
|
|
0
|
|
|
|
|
|
|
|
1710
|
|
|
|
|
|
|
{ |
|
1711
|
0
|
0
|
|
|
|
|
print "No Routers not running" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1712
|
0
|
|
|
|
|
|
return 0; } |
|
1713
|
|
|
|
|
|
|
|
|
1714
|
0
|
|
|
|
|
|
my $snmp_variables=Router::Statistics::OID->Router_interface_oid(); |
|
1715
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
1716
|
|
|
|
|
|
|
{ |
|
1717
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
1718
|
0
|
0
|
|
|
|
|
print "Doing IP '$ip_address'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1719
|
0
|
|
|
|
|
|
my ( $foo, $bar ); |
|
1720
|
0
|
|
|
|
|
|
my ($profile_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
1721
|
|
|
|
|
|
|
get_table( |
|
1722
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'ifDescr'} ); |
|
1723
|
0
|
|
|
|
|
|
while(($foo, $bar) = each(%{$profile_information})) |
|
|
0
|
|
|
|
|
|
|
|
1724
|
|
|
|
|
|
|
{ |
|
1725
|
|
|
|
|
|
|
#print "Foo is '$foo' bar is '$bar'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1726
|
0
|
0
|
|
|
|
|
next unless($foo =~ /^${$snmp_variables}{'PRIVATE_interface_base'}.(\d+)/); |
|
|
0
|
|
|
|
|
|
|
|
1727
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ifDescr'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
1728
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'ifDescr'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
1729
|
|
|
|
|
|
|
} |
|
1730
|
|
|
|
|
|
|
} |
|
1731
|
0
|
|
|
|
|
|
return 1; |
|
1732
|
|
|
|
|
|
|
} |
|
1733
|
|
|
|
|
|
|
|
|
1734
|
|
|
|
|
|
|
sub WideBand_MPEG_Tester |
|
1735
|
|
|
|
|
|
|
{ |
|
1736
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
1737
|
0
|
|
|
|
|
|
my $data = shift; |
|
1738
|
0
|
|
|
|
|
|
my $type = shift; |
|
1739
|
|
|
|
|
|
|
|
|
1740
|
0
|
|
|
|
|
|
my $current_ubrs=$self->Router_Return_All(); |
|
1741
|
0
|
0
|
|
|
|
|
if ( scalar( keys %{$current_ubrs})==0 ) |
|
|
0
|
|
|
|
|
|
|
|
1742
|
|
|
|
|
|
|
{ |
|
1743
|
0
|
0
|
|
|
|
|
print "No Routers not running" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1744
|
0
|
|
|
|
|
|
return 0; |
|
1745
|
|
|
|
|
|
|
} |
|
1746
|
|
|
|
|
|
|
|
|
1747
|
0
|
|
|
|
|
|
my $snmp_variables=Router::Statistics::OID->WideBand_MPEG(); |
|
1748
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
1749
|
|
|
|
|
|
|
{ |
|
1750
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
1751
|
0
|
0
|
|
|
|
|
print "Doing IP '$ip_address'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1752
|
0
|
|
|
|
|
|
my ( $foo, $bar ); |
|
1753
|
0
|
|
|
|
|
|
my ($profile_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
1754
|
|
|
|
|
|
|
get_table( |
|
1755
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'ccwbRFChannelMpegPkts'} ); |
|
1756
|
0
|
|
|
|
|
|
while(($foo, $bar) = each(%{$profile_information})) |
|
|
0
|
|
|
|
|
|
|
|
1757
|
|
|
|
|
|
|
{ |
|
1758
|
|
|
|
|
|
|
#print "Foo is '$foo' bar is '$bar'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1759
|
0
|
0
|
|
|
|
|
next unless($foo =~ /^${$snmp_variables}{'ccwbRFChannelMpegPkts'}.(\d+)/); |
|
|
0
|
|
|
|
|
|
|
|
1760
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ccwbRFChannelMpegPkts'}.(\d+).(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
1761
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{$2}{'ccwbRFChannelMpegPkts'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
1762
|
|
|
|
|
|
|
} |
|
1763
|
|
|
|
|
|
|
} |
|
1764
|
0
|
|
|
|
|
|
return 1; |
|
1765
|
|
|
|
|
|
|
} |
|
1766
|
|
|
|
|
|
|
|
|
1767
|
|
|
|
|
|
|
sub WideBand_Motorola_Test |
|
1768
|
|
|
|
|
|
|
{ |
|
1769
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
1770
|
0
|
|
|
|
|
|
my $data = shift; |
|
1771
|
0
|
|
|
|
|
|
my $type = shift; |
|
1772
|
|
|
|
|
|
|
|
|
1773
|
0
|
|
|
|
|
|
my $current_ubrs=$self->Router_Return_All(); |
|
1774
|
0
|
0
|
|
|
|
|
if ( scalar( keys %{$current_ubrs})==0 ) |
|
|
0
|
|
|
|
|
|
|
|
1775
|
|
|
|
|
|
|
{ |
|
1776
|
0
|
0
|
|
|
|
|
print "No Routers not running" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1777
|
0
|
|
|
|
|
|
return 0; |
|
1778
|
|
|
|
|
|
|
} |
|
1779
|
|
|
|
|
|
|
|
|
1780
|
0
|
|
|
|
|
|
my $snmp_variables = Router::Statistics::OID->Router_interface_oid(); |
|
1781
|
0
|
|
|
|
|
|
my $int_snmp_variables = Router::Statistics::OID->WideBand_MPEG(); |
|
1782
|
0
|
|
|
|
|
|
my %temp; |
|
1783
|
0
|
|
|
|
|
|
my ($foo,$bar); |
|
1784
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
1785
|
|
|
|
|
|
|
{ |
|
1786
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
1787
|
0
|
|
|
|
|
|
my ($profile_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
1788
|
|
|
|
|
|
|
get_table( |
|
1789
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'PRIVATE_interface_base'} ); |
|
1790
|
|
|
|
|
|
|
|
|
1791
|
0
|
|
|
|
|
|
while(($foo, $bar) = each(%{$profile_information})) |
|
|
0
|
|
|
|
|
|
|
|
1792
|
0
|
|
|
|
|
|
{ foreach my $snmp_value ( keys %{$snmp_variables} ) |
|
|
0
|
|
|
|
|
|
|
|
1793
|
|
|
|
|
|
|
{ |
|
1794
|
|
|
|
|
|
|
#print "SNMP is '$snmp_value' foo is '$foo'\n"; |
|
1795
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{$snmp_value}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
1796
|
|
|
|
|
|
|
{ |
|
1797
|
|
|
|
|
|
|
#print "One is '$1' value is '$snmp_value' bar is '$bar'\n"; |
|
1798
|
0
|
|
|
|
|
|
$temp{$ip_address}{$1}{$snmp_value}=$bar; } |
|
1799
|
|
|
|
|
|
|
} |
|
1800
|
0
|
|
|
|
|
|
delete ${$profile_information}{$foo}; |
|
|
0
|
|
|
|
|
|
|
|
1801
|
|
|
|
|
|
|
} |
|
1802
|
|
|
|
|
|
|
|
|
1803
|
0
|
|
|
|
|
|
foreach my $key_id ( keys %{$temp{$ip_address}} ) |
|
|
0
|
|
|
|
|
|
|
|
1804
|
|
|
|
|
|
|
{ |
|
1805
|
0
|
0
|
|
|
|
|
print "Key is '$key_id'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1806
|
|
|
|
|
|
|
|
|
1807
|
0
|
0
|
|
|
|
|
next if !$temp{$ip_address}{$key_id}{'ifDescr'}; |
|
1808
|
|
|
|
|
|
|
|
|
1809
|
0
|
0
|
|
|
|
|
print "Description is '$temp{$ip_address}{$key_id}{'ifDescr'}'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1810
|
|
|
|
|
|
|
|
|
1811
|
0
|
|
|
|
|
|
my $moto1 = ${$int_snmp_variables}{'Moto1'}.".$key_id"; |
|
|
0
|
|
|
|
|
|
|
|
1812
|
0
|
|
|
|
|
|
my $moto2 = ${$int_snmp_variables}{'Moto2'}.".$key_id"; |
|
|
0
|
|
|
|
|
|
|
|
1813
|
0
|
|
|
|
|
|
my $moto3 = ${$int_snmp_variables}{'Moto3'}.".$key_id"; |
|
|
0
|
|
|
|
|
|
|
|
1814
|
0
|
|
|
|
|
|
my $moto4 = ${$int_snmp_variables}{'Moto4'}.".$key_id"; |
|
|
0
|
|
|
|
|
|
|
|
1815
|
0
|
|
|
|
|
|
my $moto5 = ${$int_snmp_variables}{'Moto5'}.".$key_id"; |
|
|
0
|
|
|
|
|
|
|
|
1816
|
0
|
|
|
|
|
|
my $moto6 = ${$int_snmp_variables}{'Moto6'}.".$key_id"; |
|
|
0
|
|
|
|
|
|
|
|
1817
|
0
|
|
|
|
|
|
my $moto7 = ${$int_snmp_variables}{'Moto7'}.".$key_id"; |
|
|
0
|
|
|
|
|
|
|
|
1818
|
|
|
|
|
|
|
|
|
1819
|
0
|
|
|
|
|
|
my ($profile_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
1820
|
|
|
|
|
|
|
get_request ( -varbindlist => [ |
|
1821
|
|
|
|
|
|
|
$moto1, $moto2, $moto3, |
|
1822
|
|
|
|
|
|
|
$moto4, $moto5, $moto6, |
|
1823
|
|
|
|
|
|
|
$moto7, |
|
1824
|
|
|
|
|
|
|
] ); |
|
1825
|
|
|
|
|
|
|
|
|
1826
|
0
|
0
|
|
|
|
|
print "router is '$ip_address'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1827
|
|
|
|
|
|
|
|
|
1828
|
0
|
0
|
|
|
|
|
print "result is '".$profile_information->{ $moto1 }."'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1829
|
|
|
|
|
|
|
|
|
1830
|
0
|
|
|
|
|
|
${$data}{$ip_address}{ $temp{$ip_address}{$key_id}{'ifDescr'} }{'Moto1'} = |
|
|
0
|
|
|
|
|
|
|
|
1831
|
|
|
|
|
|
|
$profile_information->{ $moto1 }; |
|
1832
|
|
|
|
|
|
|
|
|
1833
|
0
|
|
|
|
|
|
${$data}{$ip_address}{ $temp{$ip_address}{$key_id}{'ifDescr'} }{'Moto2'} = |
|
|
0
|
|
|
|
|
|
|
|
1834
|
|
|
|
|
|
|
$profile_information->{ $moto2 }; |
|
1835
|
|
|
|
|
|
|
|
|
1836
|
0
|
|
|
|
|
|
${$data}{$ip_address}{ $temp{$ip_address}{$key_id}{'ifDescr'} }{'Moto3'} = |
|
|
0
|
|
|
|
|
|
|
|
1837
|
|
|
|
|
|
|
$profile_information->{ $moto3 }; |
|
1838
|
|
|
|
|
|
|
|
|
1839
|
0
|
|
|
|
|
|
${$data}{$ip_address}{ $temp{$ip_address}{$key_id}{'ifDescr'} }{'Moto4'} = |
|
|
0
|
|
|
|
|
|
|
|
1840
|
|
|
|
|
|
|
$profile_information->{ $moto4 }; |
|
1841
|
|
|
|
|
|
|
|
|
1842
|
0
|
|
|
|
|
|
${$data}{$ip_address}{ $temp{$ip_address}{$key_id}{'ifDescr'} }{'Moto5'} = |
|
|
0
|
|
|
|
|
|
|
|
1843
|
|
|
|
|
|
|
$profile_information->{ $moto5 }; |
|
1844
|
|
|
|
|
|
|
|
|
1845
|
0
|
|
|
|
|
|
${$data}{$ip_address}{ $temp{$ip_address}{$key_id}{'ifDescr'} }{'Moto6'} = |
|
|
0
|
|
|
|
|
|
|
|
1846
|
|
|
|
|
|
|
$profile_information->{ $moto6 }; |
|
1847
|
|
|
|
|
|
|
|
|
1848
|
0
|
|
|
|
|
|
${$data}{$ip_address}{ $temp{$ip_address}{$key_id}{'ifDescr'} }{'Moto7'} = |
|
|
0
|
|
|
|
|
|
|
|
1849
|
|
|
|
|
|
|
$profile_information->{ $moto7 }; |
|
1850
|
|
|
|
|
|
|
|
|
1851
|
0
|
|
|
|
|
|
${$data}{$ip_address}{ $temp{$ip_address}{$key_id}{'ifDescr'} }{'ifInOctets'} = |
|
|
0
|
|
|
|
|
|
|
|
1852
|
|
|
|
|
|
|
$temp{$ip_address}{$key_id}{'ifInOctets'}; |
|
1853
|
|
|
|
|
|
|
|
|
1854
|
0
|
|
|
|
|
|
${$data}{$ip_address}{ $temp{$ip_address}{$key_id}{'ifDescr'} }{'ifOutOctets'} = |
|
|
0
|
|
|
|
|
|
|
|
1855
|
|
|
|
|
|
|
$temp{$ip_address}{$key_id}{'ifOutOctets'}; |
|
1856
|
|
|
|
|
|
|
|
|
1857
|
|
|
|
|
|
|
|
|
1858
|
|
|
|
|
|
|
} |
|
1859
|
|
|
|
|
|
|
} |
|
1860
|
0
|
|
|
|
|
|
return 1; |
|
1861
|
|
|
|
|
|
|
} |
|
1862
|
|
|
|
|
|
|
|
|
1863
|
|
|
|
|
|
|
|
|
1864
|
|
|
|
|
|
|
sub WideBand_Channels_To_Interface |
|
1865
|
|
|
|
|
|
|
{ |
|
1866
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
1867
|
0
|
|
|
|
|
|
my $data = shift; |
|
1868
|
|
|
|
|
|
|
|
|
1869
|
|
|
|
|
|
|
#ccwbWBtoRFBandwidth |
|
1870
|
|
|
|
|
|
|
#poller@test:~$ /usr/bin/snmpwalk -v 2c -c public 80.194.79.233 .1.3.6.1.4.1.9.9.479.1.3.1.1 |
|
1871
|
|
|
|
|
|
|
#SNMPv2-SMI::enterprises.9.9.479.1.3.1.1.14.48.0 = Gauge32: 1 |
|
1872
|
|
|
|
|
|
|
#SNMPv2-SMI::enterprises.9.9.479.1.3.1.1.14.48.1 = Gauge32: 1 |
|
1873
|
|
|
|
|
|
|
#SNMPv2-SMI::enterprises.9.9.479.1.3.1.1.14.48.2 = Gauge32: 1 |
|
1874
|
|
|
|
|
|
|
#SNMPv2-SMI::enterprises.9.9.479.1.3.1.1.15.48.3 = Gauge32: 1 |
|
1875
|
|
|
|
|
|
|
#SNMPv2-SMI::enterprises.9.9.479.1.3.1.1.15.48.4 = Gauge32: 1 |
|
1876
|
|
|
|
|
|
|
#SNMPv2-SMI::enterprises.9.9.479.1.3.1.1.15.48.5 = Gauge32: 1 |
|
1877
|
|
|
|
|
|
|
|
|
1878
|
0
|
|
|
|
|
|
my $current_ubrs=$self->Router_Return_All(); |
|
1879
|
0
|
0
|
|
|
|
|
if ( scalar( keys %{$current_ubrs})==0 ) |
|
|
0
|
|
|
|
|
|
|
|
1880
|
|
|
|
|
|
|
{ |
|
1881
|
0
|
0
|
|
|
|
|
print "No Routers not running" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1882
|
0
|
|
|
|
|
|
return 0; |
|
1883
|
|
|
|
|
|
|
} |
|
1884
|
|
|
|
|
|
|
|
|
1885
|
0
|
|
|
|
|
|
my $snmp_variables=Router::Statistics::OID->WideBand_MPEG(); |
|
1886
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
1887
|
|
|
|
|
|
|
{ |
|
1888
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
1889
|
0
|
0
|
|
|
|
|
print "Doing IP '$ip_address'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1890
|
0
|
|
|
|
|
|
my ( $foo, $bar ); |
|
1891
|
0
|
|
|
|
|
|
my ($profile_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
1892
|
|
|
|
|
|
|
get_table( |
|
1893
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'ccwbWBtoRFBandwidth'} ); |
|
1894
|
0
|
|
|
|
|
|
while(($foo, $bar) = each(%{$profile_information})) |
|
|
0
|
|
|
|
|
|
|
|
1895
|
|
|
|
|
|
|
{ |
|
1896
|
|
|
|
|
|
|
#print "Foo is '$foo' bar is '$bar'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1897
|
0
|
0
|
|
|
|
|
next unless($foo =~ /^${$snmp_variables}{'ccwbWBtoRFBandwidth'}/); |
|
|
0
|
|
|
|
|
|
|
|
1898
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ccwbWBtoRFBandwidth'}.(\d+).(\d+).(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
1899
|
|
|
|
|
|
|
{ |
|
1900
|
|
|
|
|
|
|
# print "One '$1' two '$2' three '$3'\n"; |
|
1901
|
0
|
|
|
|
|
|
my $temp="$2-$3"; |
|
1902
|
0
|
|
|
|
|
|
${$data}{$ip_address}{'interface'}{$temp}=$1; |
|
|
0
|
|
|
|
|
|
|
|
1903
|
|
|
|
|
|
|
#${$data}{$ip_address}{'spa'}{$3}=$2; |
|
1904
|
|
|
|
|
|
|
#${$data}{$ip_address}{'channel'}{$3}{'spa'}=$2; |
|
1905
|
|
|
|
|
|
|
#${$data}{$ip_address}{'channel'}{$3}{'interface'}=$1; |
|
1906
|
|
|
|
|
|
|
} |
|
1907
|
|
|
|
|
|
|
} |
|
1908
|
|
|
|
|
|
|
} |
|
1909
|
0
|
|
|
|
|
|
return 1; |
|
1910
|
|
|
|
|
|
|
} |
|
1911
|
|
|
|
|
|
|
|
|
1912
|
|
|
|
|
|
|
|
|
1913
|
|
|
|
|
|
|
|
|
1914
|
|
|
|
|
|
|
sub Router_get_interfaces_Blocking |
|
1915
|
|
|
|
|
|
|
{ |
|
1916
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
1917
|
0
|
|
|
|
|
|
my $data = shift; |
|
1918
|
0
|
|
|
|
|
|
my $type = shift; |
|
1919
|
|
|
|
|
|
|
|
|
1920
|
0
|
|
|
|
|
|
my $current_ubrs=$self->Router_Return_All(); |
|
1921
|
0
|
0
|
|
|
|
|
if ( scalar( keys %{$current_ubrs})==0 ) |
|
|
0
|
|
|
|
|
|
|
|
1922
|
|
|
|
|
|
|
{ |
|
1923
|
0
|
0
|
|
|
|
|
print "No Routers not running" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1924
|
0
|
|
|
|
|
|
return 0; } |
|
1925
|
|
|
|
|
|
|
|
|
1926
|
0
|
|
|
|
|
|
my $snmp_variables; |
|
1927
|
|
|
|
|
|
|
|
|
1928
|
0
|
0
|
0
|
|
|
|
if ( $self->{_GLOBAL}{'32Bit'}==1 || |
|
1929
|
|
|
|
|
|
|
$type=~/^32Bit$/i ) |
|
1930
|
0
|
|
|
|
|
|
{ $snmp_variables=Router::Statistics::OID->Router_interface_oid(); } |
|
1931
|
|
|
|
|
|
|
|
|
1932
|
0
|
0
|
0
|
|
|
|
if ( $self->{_GLOBAL}{'64Bit'}==1 || |
|
1933
|
|
|
|
|
|
|
$type=~/^64Bit$/i ) |
|
1934
|
0
|
|
|
|
|
|
{ $snmp_variables=Router::Statistics::OID->Router_interface_oid_hc(); } |
|
1935
|
|
|
|
|
|
|
|
|
1936
|
0
|
0
|
|
|
|
|
print "Type enabled is '$type' \n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1937
|
0
|
0
|
|
|
|
|
print "SNMP variables are \n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1938
|
0
|
0
|
|
|
|
|
if ( $self->{_GLOBAL}{'DEBUG'}==1 ) |
|
1939
|
|
|
|
|
|
|
{ |
|
1940
|
0
|
|
|
|
|
|
foreach my $attribute ( keys %{$snmp_variables} ) |
|
|
0
|
|
|
|
|
|
|
|
1941
|
|
|
|
|
|
|
{ |
|
1942
|
0
|
|
|
|
|
|
print "Attribute is '$attribute' value is '${$snmp_variables}{$attribute}'\n"; |
|
|
0
|
|
|
|
|
|
|
|
1943
|
|
|
|
|
|
|
} |
|
1944
|
|
|
|
|
|
|
} |
|
1945
|
|
|
|
|
|
|
|
|
1946
|
|
|
|
|
|
|
|
|
1947
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
1948
|
|
|
|
|
|
|
{ |
|
1949
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
1950
|
0
|
0
|
|
|
|
|
print "Doing IP '$ip_address'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1951
|
0
|
|
|
|
|
|
my ( $foo, $bar ); |
|
1952
|
0
|
|
|
|
|
|
my ($profile_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
1953
|
|
|
|
|
|
|
get_table( |
|
1954
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'PRIVATE_interface_base'} ); |
|
1955
|
0
|
|
|
|
|
|
while(($foo, $bar) = each(%{$profile_information})) |
|
|
0
|
|
|
|
|
|
|
|
1956
|
|
|
|
|
|
|
{ |
|
1957
|
|
|
|
|
|
|
#print "Foo is '$foo' bar is '$bar'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
1958
|
0
|
0
|
|
|
|
|
next unless($foo =~ /^${$snmp_variables}{'PRIVATE_interface_base'}.(\d+)/); |
|
|
0
|
|
|
|
|
|
|
|
1959
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ifDescr'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
1960
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'ifDescr'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
1961
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ifType'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
1962
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'ifType'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
1963
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ifMtu'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
1964
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'ifMtu'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
1965
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ifSpeed'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
1966
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'ifSpeed'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
1967
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ifPhysAddress'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
1968
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'ifPhysAddress'}=_convert_mac_address($bar); } |
|
|
0
|
|
|
|
|
|
|
|
1969
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ifAdminStatus'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
1970
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'ifAdminStatus'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
1971
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ifOperStatus'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
1972
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'ifOperStatus'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
1973
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ifLastChange'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
1974
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'ifLastChange'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
1975
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ifInOctets'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
1976
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'ifInOctets'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
1977
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ifInUcastPkts'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
1978
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'ifInUcastPkts'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
1979
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ifInNUcastPkts'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
1980
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'ifInNUcastPkts'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
1981
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ifInDiscards'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
1982
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'ifInDiscards'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
1983
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ifInErrors'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
1984
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'ifInErrors'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
1985
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ifInUnknownProtos'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
1986
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'ifInUnknownProtos'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
1987
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ifOutOctets'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
1988
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'ifOutOctets'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
1989
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ifOutUcastPkts'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
1990
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'ifOutUcastPkts'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
1991
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ifOutNUcastPkts'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
1992
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'ifOutNUcastPkts'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
1993
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ifOutDiscards'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
1994
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'ifOutDiscards'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
1995
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ifOutErrors'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
1996
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'ifOutErrors'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
1997
|
|
|
|
|
|
|
|
|
1998
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ifName'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
1999
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'ifName'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
2000
|
|
|
|
|
|
|
|
|
2001
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ifInMulticastPkts'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
2002
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'ifInMulticastPkts'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
2003
|
|
|
|
|
|
|
|
|
2004
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ifInBroadcastPkts'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
2005
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'ifInBroadcastPkts'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
2006
|
|
|
|
|
|
|
|
|
2007
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ifOutMulticastPkts'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
2008
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'ifOutMulticastPkts'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
2009
|
|
|
|
|
|
|
|
|
2010
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ifOutBroadcastPkts'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
2011
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'ifOutBroadcastPkts'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
2012
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ifHCInOctets'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
2013
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'ifHCInOctets'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
2014
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ifHCInUcastPkts'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
2015
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'ifHCInUcastPkts'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
2016
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ifHCInMulticastPkts'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
2017
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'ifHCInMulticastPkts'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
2018
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ifHCInBroadcastPkts'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
2019
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'ifHCInBroadcastPkts'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
2020
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ifHCOutOctets'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
2021
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'ifHCOutOctets'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
2022
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ifHCOutUcastPkts'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
2023
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'ifHCOutUcastPkts'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
2024
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ifHCOutMulticastPkts'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
2025
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'ifHCOutMulticastPkts'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
2026
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ifHCOutBroadcastPkts'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
2027
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'ifHCOutBroadcastPkts'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
2028
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ifLinkUpDownTrapEnable'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
2029
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'ifLinkUpDownTrapEnable'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
2030
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ifHighSpeed'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
2031
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'ifHighSpeed'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
2032
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ifPromiscuousMode'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
2033
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'ifPromiscuousMode'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
2034
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ifConnectorPresent'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
2035
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'ifConnectorPresent'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
2036
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ifAlias'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
2037
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'ifAlias'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
2038
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ifCounterDiscontinuityTime'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
2039
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'ifCounterDiscontinuityTime'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
2040
|
0
|
|
|
|
|
|
delete ${$profile_information}{$foo}; |
|
|
0
|
|
|
|
|
|
|
|
2041
|
|
|
|
|
|
|
} |
|
2042
|
|
|
|
|
|
|
|
|
2043
|
0
|
|
|
|
|
|
($profile_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
2044
|
|
|
|
|
|
|
get_table( |
|
2045
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'ifAlias'} ); |
|
2046
|
|
|
|
|
|
|
|
|
2047
|
0
|
|
|
|
|
|
while(($foo, $bar) = each(%{$profile_information})) |
|
|
0
|
|
|
|
|
|
|
|
2048
|
|
|
|
|
|
|
{ |
|
2049
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'ifAlias'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
2050
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'ifAlias'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
2051
|
0
|
|
|
|
|
|
delete ${$profile_information}{$foo}; |
|
|
0
|
|
|
|
|
|
|
|
2052
|
|
|
|
|
|
|
} |
|
2053
|
|
|
|
|
|
|
|
|
2054
|
|
|
|
|
|
|
} |
|
2055
|
|
|
|
|
|
|
|
|
2056
|
0
|
|
|
|
|
|
return 1; |
|
2057
|
|
|
|
|
|
|
} |
|
2058
|
|
|
|
|
|
|
|
|
2059
|
|
|
|
|
|
|
sub Get_7500_Inventory |
|
2060
|
|
|
|
|
|
|
{ |
|
2061
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
2062
|
0
|
|
|
|
|
|
my $data = shift; |
|
2063
|
0
|
|
|
|
|
|
my $current_ubrs=$self->Router_Return_All(); |
|
2064
|
0
|
0
|
|
|
|
|
if ( scalar( keys %{$current_ubrs})==0 ) { return 0; } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
2065
|
0
|
|
|
|
|
|
my $snmp_variables = Router::Statistics::OID->Router_inventory_oid(); |
|
2066
|
|
|
|
|
|
|
|
|
2067
|
0
|
|
|
|
|
|
my %temp; |
|
2068
|
|
|
|
|
|
|
|
|
2069
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
2070
|
|
|
|
|
|
|
{ |
|
2071
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
2072
|
0
|
|
|
|
|
|
my ($profile_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
2073
|
|
|
|
|
|
|
get_table( |
|
2074
|
|
|
|
|
|
|
-callback => [ \&validate_one, \%temp, $ip_address, $snmp_variables ], |
|
2075
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'PRIVATE_inventory'} ); |
|
2076
|
|
|
|
|
|
|
} |
|
2077
|
0
|
|
|
|
|
|
snmp_dispatcher(); |
|
2078
|
|
|
|
|
|
|
|
|
2079
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %temp ) |
|
2080
|
|
|
|
|
|
|
{ |
|
2081
|
0
|
|
|
|
|
|
foreach my $relative ( keys %{$temp{$ip_address}} ) |
|
|
0
|
|
|
|
|
|
|
|
2082
|
|
|
|
|
|
|
{ |
|
2083
|
0
|
0
|
|
|
|
|
if ( $temp{$ip_address}{$relative}{'entPhysicalName'}=~/^Line Card (\d+)/ ) |
|
2084
|
0
|
|
|
|
|
|
{ $temp{$ip_address}{'rev'}{ $1 }{'main'}=$relative; } |
|
2085
|
0
|
0
|
|
|
|
|
if ( $temp{$ip_address}{$relative}{'entPhysicalName'}=~/^RSP at Slot (\d+)/ ) |
|
2086
|
0
|
|
|
|
|
|
{ $temp{$ip_address}{'rev'}{ $1 }{'main'}=$relative; } |
|
2087
|
0
|
0
|
|
|
|
|
if ( $temp{$ip_address}{$relative}{'entPhysicalName'}=~/^Card Slot (\d+), Bay (\d+)/ ) |
|
2088
|
0
|
|
|
|
|
|
{ $temp{$ip_address}{'rev'}{ $1 }{'child'}{$2}=$relative; } |
|
2089
|
0
|
0
|
|
|
|
|
if ( $temp{$ip_address}{$relative}{'entPhysicalName'}=~/^PA at Slot (\d+), Bay (\d+)/ ) |
|
2090
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{'slot'}{$1}{'child'}{$2}{'name'}="Empty"; } |
|
|
0
|
|
|
|
|
|
|
|
2091
|
|
|
|
|
|
|
} |
|
2092
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$temp{$ip_address}{'rev'}} ) |
|
|
0
|
|
|
|
|
|
|
|
2093
|
|
|
|
|
|
|
{ |
|
2094
|
0
|
|
|
|
|
|
foreach my $child ( keys %{$temp{$ip_address}{'rev'}{$a}{'child'}} ) |
|
|
0
|
|
|
|
|
|
|
|
2095
|
|
|
|
|
|
|
{ |
|
2096
|
0
|
|
|
|
|
|
foreach my $attribute ( keys %{$snmp_variables} ) |
|
|
0
|
|
|
|
|
|
|
|
2097
|
|
|
|
|
|
|
{ |
|
2098
|
0
|
0
|
|
|
|
|
next if $attribute=~/PRIVATE/; |
|
2099
|
0
|
|
|
|
|
|
${$data}{$ip_address}{'slot'}{$a}{'child'}{$child}{$attribute}= |
|
|
0
|
|
|
|
|
|
|
|
2100
|
|
|
|
|
|
|
$temp{$ip_address}{ $temp{$ip_address}{'rev'}{$a}{'child'}{$child} } {$attribute}; |
|
2101
|
|
|
|
|
|
|
} |
|
2102
|
|
|
|
|
|
|
} |
|
2103
|
|
|
|
|
|
|
|
|
2104
|
0
|
|
|
|
|
|
foreach my $attribute ( keys %{$snmp_variables} ) |
|
|
0
|
|
|
|
|
|
|
|
2105
|
|
|
|
|
|
|
{ |
|
2106
|
0
|
0
|
|
|
|
|
next if $attribute=~/PRIVATE/; |
|
2107
|
0
|
|
|
|
|
|
${$data}{$ip_address}{'slot'}{$a}{'main'}{$attribute}= |
|
|
0
|
|
|
|
|
|
|
|
2108
|
|
|
|
|
|
|
$temp{$ip_address}{ $temp{$ip_address}{'rev'}{$a}{'main'} }{$attribute}; |
|
2109
|
|
|
|
|
|
|
} |
|
2110
|
|
|
|
|
|
|
#${$data}{$ip_address}{'slot'}{$a}{'main'}{'entPhysicalDescr'}=$temp{$ip_address}{ $temp{$ip_address}{'rev'}{$a}{'main'} }{'entPhysicalDescr'}; |
|
2111
|
|
|
|
|
|
|
} |
|
2112
|
0
|
|
|
|
|
|
$temp{$ip_address}{'1'}{'entPhysicalDescr'}=~/^(\d+)/; |
|
2113
|
0
|
|
|
|
|
|
${$data}{$ip_address}{'total_slots'}=substr($1,2,2); |
|
|
0
|
|
|
|
|
|
|
|
2114
|
|
|
|
|
|
|
} |
|
2115
|
0
|
|
|
|
|
|
undef %temp; |
|
2116
|
0
|
|
|
|
|
|
return 1; |
|
2117
|
|
|
|
|
|
|
} |
|
2118
|
|
|
|
|
|
|
|
|
2119
|
|
|
|
|
|
|
sub Export_7500_Slot_Inventory |
|
2120
|
|
|
|
|
|
|
{ |
|
2121
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
2122
|
0
|
|
|
|
|
|
my $data = shift; |
|
2123
|
0
|
|
|
|
|
|
my $router_list = shift; |
|
2124
|
0
|
|
|
|
|
|
my $handle = shift; |
|
2125
|
0
|
|
|
|
|
|
my $format = shift; |
|
2126
|
|
|
|
|
|
|
|
|
2127
|
0
|
0
|
|
|
|
|
if ( scalar ( keys %{$data} ) == 0 ) |
|
|
0
|
|
|
|
|
|
|
|
2128
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="No Router Data Available."; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
2129
|
|
|
|
|
|
|
|
|
2130
|
0
|
0
|
|
|
|
|
if ( scalar ( keys %{$router_list} ) == 0 ) |
|
|
0
|
|
|
|
|
|
|
|
2131
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="Router List Required."; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
2132
|
|
|
|
|
|
|
|
|
2133
|
0
|
0
|
|
|
|
|
if ( !$handle ) |
|
2134
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="File Handle Required."; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
2135
|
|
|
|
|
|
|
|
|
2136
|
0
|
0
|
|
|
|
|
if ( $format!~/csv/i ) |
|
2137
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="Only CSV Format Supported."; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
2138
|
|
|
|
|
|
|
|
|
2139
|
0
|
0
|
|
|
|
|
if ( $format=~/csv/i ) |
|
2140
|
0
|
|
|
|
|
|
{ print $handle "ip_address,hostname,slot,bay,description,serialnumber,partcode\n"; } |
|
2141
|
|
|
|
|
|
|
|
|
2142
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$data} ) |
|
|
0
|
|
|
|
|
|
|
|
2143
|
|
|
|
|
|
|
{ |
|
2144
|
0
|
0
|
|
|
|
|
if ( $format=~/csv/i ) |
|
2145
|
|
|
|
|
|
|
{ |
|
2146
|
0
|
|
|
|
|
|
for(my $slot=0;$slot<${$data}{$ip_address}{'total_slots'};$slot++) |
|
|
0
|
|
|
|
|
|
|
|
2147
|
|
|
|
|
|
|
{ |
|
2148
|
0
|
0
|
|
|
|
|
if ( !${$data}{$ip_address}{'slot'}{$slot}{'main'}{'entPhysicalDescr'} ) |
|
|
0
|
|
|
|
|
|
|
|
2149
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{'slot'}{$slot}{'main'}{'entPhysicalDescr'}="Empty"; } |
|
|
0
|
|
|
|
|
|
|
|
2150
|
0
|
|
|
|
|
|
print $handle "\"$ip_address\",\"${$router_list}{$ip_address}{'hostName'}\",\"$slot\","; |
|
|
0
|
|
|
|
|
|
|
|
2151
|
0
|
|
|
|
|
|
print $handle "\"Main\",\"".${$data}{$ip_address}{'slot'}{$slot}{'main'}{'entPhysicalDescr'}."\","; |
|
|
0
|
|
|
|
|
|
|
|
2152
|
0
|
|
|
|
|
|
print $handle "\"".${$data}{$ip_address}{'slot'}{$slot}{'main'}{'entPhysicalSerialNum'}."\","; |
|
|
0
|
|
|
|
|
|
|
|
2153
|
0
|
|
|
|
|
|
print $handle "\"".${$data}{$ip_address}{'slot'}{$slot}{'main'}{'entPhysicalModelName'}."\"\n"; |
|
|
0
|
|
|
|
|
|
|
|
2154
|
0
|
|
|
|
|
|
for (my $bay=0;$bay< keys ( %{${$data}{$ip_address}{'slot'}{$slot}{'child'}} ); $bay++ ) |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
2155
|
|
|
|
|
|
|
{ |
|
2156
|
0
|
0
|
|
|
|
|
if ( !${$data}{$ip_address}{'slot'}{$slot}{'child'}{$bay}{'entPhysicalDescr'} ) |
|
|
0
|
|
|
|
|
|
|
|
2157
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{'slot'}{$slot}{'child'}{$bay}{'entPhysicalDescr'}="Empty"; } |
|
|
0
|
|
|
|
|
|
|
|
2158
|
0
|
|
|
|
|
|
next unless ${$data}{$ip_address}{'slot'}{$slot}{'child'}{$bay}{'entPhysicalSerialNum'} || |
|
|
0
|
|
|
|
|
|
|
|
2159
|
0
|
0
|
0
|
|
|
|
${$data}{$ip_address}{'slot'}{$slot}{'child'}{$bay}{'entPhysicalDescr'}=~/^Empty/; |
|
2160
|
0
|
|
|
|
|
|
print $handle "\"$ip_address\",\"${$router_list}{$ip_address}{'hostName'}\",\"$slot\","; |
|
|
0
|
|
|
|
|
|
|
|
2161
|
0
|
|
|
|
|
|
print $handle "\"$bay\",\"".${$data}{$ip_address}{'slot'}{$slot}{'child'}{$bay}{'entPhysicalDescr'}."\","; |
|
|
0
|
|
|
|
|
|
|
|
2162
|
0
|
|
|
|
|
|
print $handle "\"".${$data}{$ip_address}{'slot'}{$slot}{'child'}{$bay}{'entPhysicalSerialNum'}."\","; |
|
|
0
|
|
|
|
|
|
|
|
2163
|
0
|
|
|
|
|
|
print $handle "\"".${$data}{$ip_address}{'slot'}{$slot}{'child'}{$bay}{'entPhysicalModelName'}."\"\n"; |
|
|
0
|
|
|
|
|
|
|
|
2164
|
|
|
|
|
|
|
} |
|
2165
|
|
|
|
|
|
|
} |
|
2166
|
|
|
|
|
|
|
} |
|
2167
|
|
|
|
|
|
|
} |
|
2168
|
|
|
|
|
|
|
|
|
2169
|
0
|
|
|
|
|
|
return 1; |
|
2170
|
|
|
|
|
|
|
} |
|
2171
|
|
|
|
|
|
|
|
|
2172
|
|
|
|
|
|
|
sub Export_7500_Port_Inventory |
|
2173
|
|
|
|
|
|
|
{ |
|
2174
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
2175
|
0
|
|
|
|
|
|
my $data = shift; |
|
2176
|
0
|
|
|
|
|
|
my $router_list = shift; |
|
2177
|
0
|
|
|
|
|
|
my $handle = shift; |
|
2178
|
0
|
|
|
|
|
|
my $format = shift; |
|
2179
|
|
|
|
|
|
|
|
|
2180
|
0
|
0
|
|
|
|
|
if ( scalar ( keys %{$data} ) == 0 ) |
|
|
0
|
|
|
|
|
|
|
|
2181
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="No Router Data Available."; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
2182
|
|
|
|
|
|
|
|
|
2183
|
0
|
0
|
|
|
|
|
if ( scalar ( keys %{$router_list} ) == 0 ) |
|
|
0
|
|
|
|
|
|
|
|
2184
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="Router List Required."; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
2185
|
|
|
|
|
|
|
|
|
2186
|
0
|
0
|
|
|
|
|
if ( !$handle ) |
|
2187
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="File Handle Required."; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
2188
|
|
|
|
|
|
|
|
|
2189
|
0
|
0
|
|
|
|
|
if ( $format!~/csv/i ) |
|
2190
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="Only CSV Format Supported."; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
2191
|
|
|
|
|
|
|
|
|
2192
|
0
|
0
|
|
|
|
|
if ( $format=~/csv/i ) |
|
2193
|
0
|
|
|
|
|
|
{ print $handle "ip_address,hostname,slot,port,bay,interface_name,operstatus,adminstatus\n"; } |
|
2194
|
|
|
|
|
|
|
|
|
2195
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$data} ) |
|
|
0
|
|
|
|
|
|
|
|
2196
|
|
|
|
|
|
|
{ |
|
2197
|
0
|
0
|
|
|
|
|
if ( $format=~/csv/i ) |
|
2198
|
|
|
|
|
|
|
{ |
|
2199
|
0
|
|
|
|
|
|
foreach my $interface ( keys %{${$data}{$ip_address}} ) |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
2200
|
|
|
|
|
|
|
{ |
|
2201
|
0
|
|
|
|
|
|
my ($slot,$port,$bay); |
|
2202
|
0
|
0
|
|
|
|
|
if ( ${$data}{$ip_address}{$interface}{'ifDescr'}=~/(\d+)$/ ) |
|
|
0
|
|
|
|
|
|
|
|
2203
|
0
|
|
|
|
|
|
{ $slot="$1"; $port="Main Controller"; $bay="None"; } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
2204
|
0
|
0
|
|
|
|
|
if ( ${$data}{$ip_address}{$interface}{'ifDescr'}=~/(\d+)\/(\d+)\/(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
2205
|
0
|
|
|
|
|
|
{ $slot=$1; $port=$2; $bay=$3; } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
2206
|
0
|
|
|
|
|
|
print $handle "\"$ip_address\",\"${$router_list}{$ip_address}{'hostName'}\","; |
|
|
0
|
|
|
|
|
|
|
|
2207
|
0
|
|
|
|
|
|
print $handle "\"$slot\",\"$port\",\"$bay\","; |
|
2208
|
0
|
|
|
|
|
|
print $handle "\"${$data}{$ip_address}{$interface}{'ifDescr'}\","; |
|
|
0
|
|
|
|
|
|
|
|
2209
|
0
|
|
|
|
|
|
print $handle "\"${$data}{$ip_address}{$interface}{'ifOperStatus'}\","; |
|
|
0
|
|
|
|
|
|
|
|
2210
|
0
|
|
|
|
|
|
print $handle "\"${$data}{$ip_address}{$interface}{'ifAdminStatus'}\","; |
|
|
0
|
|
|
|
|
|
|
|
2211
|
0
|
|
|
|
|
|
print $handle "\"${$data}{$ip_address}{$interface}{'ifAlias'}\""; |
|
|
0
|
|
|
|
|
|
|
|
2212
|
0
|
|
|
|
|
|
print $handle "\n"; |
|
2213
|
|
|
|
|
|
|
} |
|
2214
|
|
|
|
|
|
|
} |
|
2215
|
|
|
|
|
|
|
} |
|
2216
|
0
|
|
|
|
|
|
return 1; |
|
2217
|
|
|
|
|
|
|
} |
|
2218
|
|
|
|
|
|
|
|
|
2219
|
|
|
|
|
|
|
sub Get_GSR_Inventory |
|
2220
|
|
|
|
|
|
|
{ |
|
2221
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
2222
|
0
|
|
|
|
|
|
my $data = shift; |
|
2223
|
0
|
|
|
|
|
|
my $current_ubrs=$self->Router_Return_All(); |
|
2224
|
0
|
0
|
|
|
|
|
if ( scalar( keys %{$current_ubrs})==0 ) { return 0; } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
2225
|
0
|
|
|
|
|
|
my $snmp_variables = Router::Statistics::OID->Router_inventory_oid(); |
|
2226
|
|
|
|
|
|
|
|
|
2227
|
0
|
|
|
|
|
|
my %temp; |
|
2228
|
|
|
|
|
|
|
|
|
2229
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
2230
|
|
|
|
|
|
|
{ |
|
2231
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
2232
|
0
|
|
|
|
|
|
my ($profile_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
2233
|
|
|
|
|
|
|
get_table( |
|
2234
|
|
|
|
|
|
|
-callback => [ \&validate_one, \%temp, $ip_address, $snmp_variables ], |
|
2235
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'PRIVATE_inventory'} ); |
|
2236
|
|
|
|
|
|
|
} |
|
2237
|
0
|
|
|
|
|
|
snmp_dispatcher(); |
|
2238
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %temp ) |
|
2239
|
|
|
|
|
|
|
{ |
|
2240
|
0
|
|
|
|
|
|
foreach my $relative ( keys %{$temp{$ip_address}} ) |
|
|
0
|
|
|
|
|
|
|
|
2241
|
|
|
|
|
|
|
{ |
|
2242
|
0
|
0
|
|
|
|
|
next unless $temp{$ip_address}{$relative}{'entPhysicalName'}=~/^slot (\d+)/; |
|
2243
|
0
|
|
|
|
|
|
$temp{$ip_address}{'rev'}{ $1 }=$relative; |
|
2244
|
|
|
|
|
|
|
} |
|
2245
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$temp{$ip_address}{'rev'}} ) |
|
|
0
|
|
|
|
|
|
|
|
2246
|
|
|
|
|
|
|
{ |
|
2247
|
0
|
|
|
|
|
|
foreach my $attribute ( keys %{$snmp_variables} ) |
|
|
0
|
|
|
|
|
|
|
|
2248
|
|
|
|
|
|
|
{ |
|
2249
|
0
|
0
|
|
|
|
|
next if $attribute=~/PRIVATE/; |
|
2250
|
0
|
|
|
|
|
|
${$data}{$ip_address}{'slot'}{$a}{$attribute}= |
|
|
0
|
|
|
|
|
|
|
|
2251
|
|
|
|
|
|
|
$temp{$ip_address}{ $temp{$ip_address}{'rev'}{$a} }{$attribute}; |
|
2252
|
|
|
|
|
|
|
} |
|
2253
|
|
|
|
|
|
|
} |
|
2254
|
0
|
|
|
|
|
|
$temp{$ip_address}{'1'}{'entPhysicalDescr'}=~/^(\d+)\//; |
|
2255
|
0
|
|
|
|
|
|
${$data}{$ip_address}{'total_slots'}=substr($1,3,2); |
|
|
0
|
|
|
|
|
|
|
|
2256
|
|
|
|
|
|
|
} |
|
2257
|
0
|
|
|
|
|
|
undef %temp; |
|
2258
|
0
|
|
|
|
|
|
return 1; |
|
2259
|
|
|
|
|
|
|
} |
|
2260
|
|
|
|
|
|
|
|
|
2261
|
|
|
|
|
|
|
sub Export_GSR_Slot_Inventory |
|
2262
|
|
|
|
|
|
|
{ |
|
2263
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
2264
|
0
|
|
|
|
|
|
my $data = shift; |
|
2265
|
0
|
|
|
|
|
|
my $router_list = shift; |
|
2266
|
0
|
|
|
|
|
|
my $handle = shift; |
|
2267
|
0
|
|
|
|
|
|
my $format = shift; |
|
2268
|
|
|
|
|
|
|
|
|
2269
|
0
|
0
|
|
|
|
|
if ( scalar ( keys %{$data} ) == 0 ) |
|
|
0
|
|
|
|
|
|
|
|
2270
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="No Router Data Available."; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
2271
|
|
|
|
|
|
|
|
|
2272
|
0
|
0
|
|
|
|
|
if ( scalar ( keys %{$router_list} ) == 0 ) |
|
|
0
|
|
|
|
|
|
|
|
2273
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="Router List Required."; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
2274
|
|
|
|
|
|
|
|
|
2275
|
0
|
0
|
|
|
|
|
if ( !$handle ) |
|
2276
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="File Handle Required."; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
2277
|
|
|
|
|
|
|
|
|
2278
|
0
|
0
|
|
|
|
|
if ( $format!~/csv/i ) |
|
2279
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="Only CSV Format Supported."; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
2280
|
|
|
|
|
|
|
|
|
2281
|
0
|
0
|
|
|
|
|
if ( $format=~/csv/i ) |
|
2282
|
0
|
|
|
|
|
|
{ print $handle "ip_address,hostname,slot,description,serialnumber,partcode\n"; } |
|
2283
|
|
|
|
|
|
|
|
|
2284
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$data} ) |
|
|
0
|
|
|
|
|
|
|
|
2285
|
|
|
|
|
|
|
{ |
|
2286
|
0
|
0
|
|
|
|
|
if ( $format=~/csv/i ) |
|
2287
|
|
|
|
|
|
|
{ |
|
2288
|
0
|
|
|
|
|
|
for(my $slot=0;$slot<${$data}{$ip_address}{'total_slots'};$slot++) |
|
|
0
|
|
|
|
|
|
|
|
2289
|
|
|
|
|
|
|
{ |
|
2290
|
0
|
0
|
|
|
|
|
if ( !${$data}{$ip_address}{'slot'}{$slot}{'entPhysicalDescr'} ) |
|
|
0
|
|
|
|
|
|
|
|
2291
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{'slot'}{$slot}{'entPhysicalDescr'}="Empty"; } |
|
|
0
|
|
|
|
|
|
|
|
2292
|
0
|
|
|
|
|
|
print $handle "\"$ip_address\",\"${$router_list}{$ip_address}{'hostName'}\",\"$slot\","; |
|
|
0
|
|
|
|
|
|
|
|
2293
|
0
|
|
|
|
|
|
print $handle "\"".${$data}{$ip_address}{'slot'}{$slot}{'entPhysicalDescr'}."\","; |
|
|
0
|
|
|
|
|
|
|
|
2294
|
0
|
|
|
|
|
|
print $handle "\"".${$data}{$ip_address}{'slot'}{$slot}{'entPhysicalSerialNum'}."\","; |
|
|
0
|
|
|
|
|
|
|
|
2295
|
0
|
|
|
|
|
|
print $handle "\"".${$data}{$ip_address}{'slot'}{$slot}{'entPhysicalModelName'}."\"\n"; |
|
|
0
|
|
|
|
|
|
|
|
2296
|
|
|
|
|
|
|
} |
|
2297
|
|
|
|
|
|
|
} |
|
2298
|
|
|
|
|
|
|
} |
|
2299
|
0
|
|
|
|
|
|
return 1; |
|
2300
|
|
|
|
|
|
|
} |
|
2301
|
|
|
|
|
|
|
|
|
2302
|
|
|
|
|
|
|
sub Export_GSR_Port_Inventory |
|
2303
|
|
|
|
|
|
|
{ |
|
2304
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
2305
|
0
|
|
|
|
|
|
my $data = shift; |
|
2306
|
0
|
|
|
|
|
|
my $router_list = shift; |
|
2307
|
0
|
|
|
|
|
|
my $handle = shift; |
|
2308
|
0
|
|
|
|
|
|
my $format = shift; |
|
2309
|
|
|
|
|
|
|
|
|
2310
|
0
|
0
|
|
|
|
|
if ( scalar ( keys %{$data} ) == 0 ) |
|
|
0
|
|
|
|
|
|
|
|
2311
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="No Router Data Available."; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
2312
|
|
|
|
|
|
|
|
|
2313
|
0
|
0
|
|
|
|
|
if ( scalar ( keys %{$router_list} ) == 0 ) |
|
|
0
|
|
|
|
|
|
|
|
2314
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="Router List Required."; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
2315
|
|
|
|
|
|
|
|
|
2316
|
0
|
0
|
|
|
|
|
if ( !$handle ) |
|
2317
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="File Handle Required."; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
2318
|
|
|
|
|
|
|
|
|
2319
|
0
|
0
|
|
|
|
|
if ( $format!~/csv/i ) |
|
2320
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="Only CSV Format Supported."; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
2321
|
|
|
|
|
|
|
|
|
2322
|
0
|
0
|
|
|
|
|
if ( $format=~/csv/i ) |
|
2323
|
0
|
|
|
|
|
|
{ print $handle "ip_address,hostname,slot,port,interface_name,operstatus,adminstatus\n"; } |
|
2324
|
|
|
|
|
|
|
|
|
2325
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$data} ) |
|
|
0
|
|
|
|
|
|
|
|
2326
|
|
|
|
|
|
|
{ |
|
2327
|
0
|
0
|
|
|
|
|
if ( $format=~/csv/i ) |
|
2328
|
|
|
|
|
|
|
{ |
|
2329
|
0
|
|
|
|
|
|
foreach my $interface ( keys %{${$data}{$ip_address}} ) |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
2330
|
|
|
|
|
|
|
{ |
|
2331
|
0
|
|
|
|
|
|
my ($slot,$port); |
|
2332
|
0
|
0
|
|
|
|
|
if ( ${$data}{$ip_address}{$interface}{'ifDescr'}=~/(\d+)$/ ) |
|
|
0
|
|
|
|
|
|
|
|
2333
|
0
|
|
|
|
|
|
{ $slot="$1"; $port="Main Controller"; } |
|
|
0
|
|
|
|
|
|
|
|
2334
|
0
|
0
|
|
|
|
|
if ( ${$data}{$ip_address}{$interface}{'ifDescr'}=~/(\d+)\/(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
2335
|
0
|
|
|
|
|
|
{ $slot=$1; $port=$2; } |
|
|
0
|
|
|
|
|
|
|
|
2336
|
0
|
|
|
|
|
|
print $handle "\"$ip_address\",\"${$router_list}{$ip_address}{'hostName'}\","; |
|
|
0
|
|
|
|
|
|
|
|
2337
|
0
|
|
|
|
|
|
print $handle "\"$slot\",\"$port\","; |
|
2338
|
0
|
|
|
|
|
|
print $handle "\"${$data}{$ip_address}{$interface}{'ifDescr'}\","; |
|
|
0
|
|
|
|
|
|
|
|
2339
|
0
|
|
|
|
|
|
print $handle "\"${$data}{$ip_address}{$interface}{'ifOperStatus'}\","; |
|
|
0
|
|
|
|
|
|
|
|
2340
|
0
|
|
|
|
|
|
print $handle "\"${$data}{$ip_address}{$interface}{'ifAdminStatus'}\","; |
|
|
0
|
|
|
|
|
|
|
|
2341
|
0
|
|
|
|
|
|
print $handle "\"${$data}{$ip_address}{$interface}{'ifAlias'}\""; |
|
|
0
|
|
|
|
|
|
|
|
2342
|
0
|
|
|
|
|
|
print $handle "\n"; |
|
2343
|
|
|
|
|
|
|
} |
|
2344
|
|
|
|
|
|
|
} |
|
2345
|
|
|
|
|
|
|
} |
|
2346
|
0
|
|
|
|
|
|
return 1; |
|
2347
|
|
|
|
|
|
|
} |
|
2348
|
|
|
|
|
|
|
|
|
2349
|
|
|
|
|
|
|
sub Export_7600_Slot_Inventory |
|
2350
|
|
|
|
|
|
|
{ |
|
2351
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
2352
|
0
|
|
|
|
|
|
my $data = shift; |
|
2353
|
0
|
|
|
|
|
|
my $router_list = shift; |
|
2354
|
0
|
|
|
|
|
|
my $handle = shift; |
|
2355
|
0
|
|
|
|
|
|
my $format = shift; |
|
2356
|
|
|
|
|
|
|
|
|
2357
|
0
|
0
|
|
|
|
|
if ( scalar ( keys %{$data} ) == 0 ) |
|
|
0
|
|
|
|
|
|
|
|
2358
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="No Router Data Available."; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
2359
|
|
|
|
|
|
|
|
|
2360
|
0
|
0
|
|
|
|
|
if ( scalar ( keys %{$router_list} ) == 0 ) |
|
|
0
|
|
|
|
|
|
|
|
2361
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="Router List Required."; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
2362
|
|
|
|
|
|
|
|
|
2363
|
0
|
0
|
|
|
|
|
if ( !$handle ) |
|
2364
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="File Handle Required."; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
2365
|
|
|
|
|
|
|
|
|
2366
|
0
|
0
|
|
|
|
|
if ( $format!~/csv/i ) |
|
2367
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="Only CSV Format Supported."; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
2368
|
|
|
|
|
|
|
|
|
2369
|
0
|
0
|
|
|
|
|
if ( $format=~/csv/i ) |
|
2370
|
0
|
|
|
|
|
|
{ print $handle "ip_address,hostname,slot,port,description,serialnumber,partcode\n"; } |
|
2371
|
|
|
|
|
|
|
|
|
2372
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$data} ) |
|
|
0
|
|
|
|
|
|
|
|
2373
|
|
|
|
|
|
|
{ |
|
2374
|
0
|
0
|
|
|
|
|
if ( $format=~/csv/i ) |
|
2375
|
|
|
|
|
|
|
{ |
|
2376
|
0
|
|
|
|
|
|
for(my $slot=0;$slot<${$data}{$ip_address}{'total_slots'};$slot++) |
|
|
0
|
|
|
|
|
|
|
|
2377
|
|
|
|
|
|
|
{ |
|
2378
|
0
|
0
|
|
|
|
|
if ( !${$data}{$ip_address}{'slot'}{$slot}{'main'}{'entPhysicalDescr'} ) |
|
|
0
|
|
|
|
|
|
|
|
2379
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{'slot'}{$slot}{'main'}{'entPhysicalDescr'}="Empty"; } |
|
|
0
|
|
|
|
|
|
|
|
2380
|
0
|
|
|
|
|
|
print $handle "\"$ip_address\",\"${$router_list}{$ip_address}{'hostName'}\",\"$slot\","; |
|
|
0
|
|
|
|
|
|
|
|
2381
|
0
|
|
|
|
|
|
print $handle "\"Main\",\"".${$data}{$ip_address}{'slot'}{$slot}{'main'}{'entPhysicalDescr'}."\","; |
|
|
0
|
|
|
|
|
|
|
|
2382
|
0
|
|
|
|
|
|
print $handle "\"".${$data}{$ip_address}{'slot'}{$slot}{'main'}{'entPhysicalSerialNum'}."\","; |
|
|
0
|
|
|
|
|
|
|
|
2383
|
0
|
|
|
|
|
|
print $handle "\"".${$data}{$ip_address}{'slot'}{$slot}{'main'}{'entPhysicalModelName'}."\"\n"; |
|
|
0
|
|
|
|
|
|
|
|
2384
|
0
|
|
|
|
|
|
for (my $bay=1;$bay< keys ( %{${$data}{$ip_address}{'slot'}{$slot}{'child'}} )+1; $bay++ ) |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
2385
|
|
|
|
|
|
|
{ |
|
2386
|
0
|
0
|
|
|
|
|
if ( !${$data}{$ip_address}{'slot'}{$slot}{'child'}{$bay}{'entPhysicalDescr'} ) |
|
|
0
|
|
|
|
|
|
|
|
2387
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{'slot'}{$slot}{'child'}{$bay}{'entPhysicalDescr'}="Empty"; } |
|
|
0
|
|
|
|
|
|
|
|
2388
|
0
|
|
|
|
|
|
print $handle "\"$ip_address\",\"${$router_list}{$ip_address}{'hostName'}\",\"$slot\","; |
|
|
0
|
|
|
|
|
|
|
|
2389
|
0
|
|
|
|
|
|
print $handle "\"$bay\",\"".${$data}{$ip_address}{'slot'}{$slot}{'child'}{$bay}{'entPhysicalDescr'}."\","; |
|
|
0
|
|
|
|
|
|
|
|
2390
|
0
|
|
|
|
|
|
print $handle "\"".${$data}{$ip_address}{'slot'}{$slot}{'child'}{$bay}{'entPhysicalSerialNum'}."\","; |
|
|
0
|
|
|
|
|
|
|
|
2391
|
0
|
|
|
|
|
|
print $handle "\"".${$data}{$ip_address}{'slot'}{$slot}{'child'}{$bay}{'entPhysicalModelName'}."\"\n"; |
|
|
0
|
|
|
|
|
|
|
|
2392
|
|
|
|
|
|
|
} |
|
2393
|
|
|
|
|
|
|
} |
|
2394
|
|
|
|
|
|
|
} |
|
2395
|
|
|
|
|
|
|
} |
|
2396
|
0
|
|
|
|
|
|
return 1; |
|
2397
|
|
|
|
|
|
|
} |
|
2398
|
|
|
|
|
|
|
|
|
2399
|
|
|
|
|
|
|
sub Export_7600_Port_Inventory |
|
2400
|
|
|
|
|
|
|
{ |
|
2401
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
2402
|
0
|
|
|
|
|
|
my $data = shift; |
|
2403
|
0
|
|
|
|
|
|
my $router_list = shift; |
|
2404
|
0
|
|
|
|
|
|
my $handle = shift; |
|
2405
|
0
|
|
|
|
|
|
my $format = shift; |
|
2406
|
|
|
|
|
|
|
|
|
2407
|
0
|
0
|
|
|
|
|
if ( scalar ( keys %{$data} ) == 0 ) |
|
|
0
|
|
|
|
|
|
|
|
2408
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="No Router Data Available."; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
2409
|
|
|
|
|
|
|
|
|
2410
|
0
|
0
|
|
|
|
|
if ( scalar ( keys %{$router_list} ) == 0 ) |
|
|
0
|
|
|
|
|
|
|
|
2411
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="Router List Required."; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
2412
|
|
|
|
|
|
|
|
|
2413
|
0
|
0
|
|
|
|
|
if ( !$handle ) |
|
2414
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="File Handle Required."; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
2415
|
|
|
|
|
|
|
|
|
2416
|
0
|
0
|
|
|
|
|
if ( $format!~/csv/i ) |
|
2417
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="Only CSV Format Supported."; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
2418
|
|
|
|
|
|
|
|
|
2419
|
0
|
0
|
|
|
|
|
if ( $format=~/csv/i ) |
|
2420
|
0
|
|
|
|
|
|
{ print $handle "ip_address,hostname,slot,port,description,operstatus,adminstatus\n"; } |
|
2421
|
|
|
|
|
|
|
|
|
2422
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$data} ) |
|
|
0
|
|
|
|
|
|
|
|
2423
|
|
|
|
|
|
|
{ |
|
2424
|
0
|
0
|
|
|
|
|
if ( $format=~/csv/i ) |
|
2425
|
|
|
|
|
|
|
{ |
|
2426
|
0
|
|
|
|
|
|
foreach my $interface ( keys %{${$data}{$ip_address}} ) |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
2427
|
|
|
|
|
|
|
{ |
|
2428
|
0
|
|
|
|
|
|
my ($slot,$port); |
|
2429
|
0
|
0
|
|
|
|
|
if ( ${$data}{$ip_address}{$interface}{'ifDescr'}=~/(\d+)$/ ) |
|
|
0
|
|
|
|
|
|
|
|
2430
|
0
|
|
|
|
|
|
{ $slot="$1"; $port="Main Controller"; } |
|
|
0
|
|
|
|
|
|
|
|
2431
|
0
|
0
|
|
|
|
|
if ( ${$data}{$ip_address}{$interface}{'ifDescr'}=~/(\d+)\/(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
2432
|
0
|
|
|
|
|
|
{ $slot=$1; $port=$2; } |
|
|
0
|
|
|
|
|
|
|
|
2433
|
0
|
|
|
|
|
|
print $handle "\"$ip_address\",\"${$router_list}{$ip_address}{'hostName'}\","; |
|
|
0
|
|
|
|
|
|
|
|
2434
|
0
|
|
|
|
|
|
print $handle "\"$slot\",\"$port\","; |
|
2435
|
0
|
|
|
|
|
|
print $handle "\"${$data}{$ip_address}{$interface}{'ifDescr'}\","; |
|
|
0
|
|
|
|
|
|
|
|
2436
|
0
|
|
|
|
|
|
print $handle "\"${$data}{$ip_address}{$interface}{'ifOperStatus'}\","; |
|
|
0
|
|
|
|
|
|
|
|
2437
|
0
|
|
|
|
|
|
print $handle "\"${$data}{$ip_address}{$interface}{'ifAdminStatus'}\","; |
|
|
0
|
|
|
|
|
|
|
|
2438
|
0
|
|
|
|
|
|
print $handle "\"${$data}{$ip_address}{$interface}{'ifAlias'}\""; |
|
|
0
|
|
|
|
|
|
|
|
2439
|
0
|
|
|
|
|
|
print $handle "\n"; |
|
2440
|
|
|
|
|
|
|
} |
|
2441
|
|
|
|
|
|
|
} |
|
2442
|
|
|
|
|
|
|
} |
|
2443
|
|
|
|
|
|
|
|
|
2444
|
0
|
|
|
|
|
|
return 1; |
|
2445
|
|
|
|
|
|
|
} |
|
2446
|
|
|
|
|
|
|
|
|
2447
|
|
|
|
|
|
|
|
|
2448
|
|
|
|
|
|
|
sub Get_UBR_Inventory |
|
2449
|
|
|
|
|
|
|
{ |
|
2450
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
2451
|
0
|
|
|
|
|
|
my $data = shift; |
|
2452
|
0
|
|
|
|
|
|
$self->UBR_7200_get_Inventory ( $data ); |
|
2453
|
|
|
|
|
|
|
} |
|
2454
|
|
|
|
|
|
|
|
|
2455
|
|
|
|
|
|
|
sub Get_UBR_Inventory_Blocking |
|
2456
|
|
|
|
|
|
|
{ |
|
2457
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
2458
|
0
|
|
|
|
|
|
my $data = shift; |
|
2459
|
0
|
|
|
|
|
|
$self->UBR_7200_get_Inventory_Blocking ( $data ); |
|
2460
|
|
|
|
|
|
|
} |
|
2461
|
|
|
|
|
|
|
|
|
2462
|
|
|
|
|
|
|
sub UBR_7200_get_Inventory |
|
2463
|
|
|
|
|
|
|
{ |
|
2464
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
2465
|
0
|
|
|
|
|
|
my $data = shift; |
|
2466
|
0
|
|
|
|
|
|
my $current_ubrs=$self->Router_Return_All(); |
|
2467
|
0
|
0
|
|
|
|
|
if ( scalar( keys %{$current_ubrs})==0 ) { return 0; } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
2468
|
0
|
|
|
|
|
|
my $snmp_variables = Router::Statistics::OID->Router_inventory_oid(); |
|
2469
|
0
|
|
|
|
|
|
my %temp; |
|
2470
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
2471
|
|
|
|
|
|
|
{ |
|
2472
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
2473
|
0
|
|
|
|
|
|
my ($profile_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
2474
|
|
|
|
|
|
|
get_table( |
|
2475
|
|
|
|
|
|
|
-callback => [ \&validate_one, \%temp, $ip_address, $snmp_variables ], |
|
2476
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'PRIVATE_inventory'} ); |
|
2477
|
|
|
|
|
|
|
} |
|
2478
|
0
|
|
|
|
|
|
snmp_dispatcher(); |
|
2479
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %temp ) |
|
2480
|
|
|
|
|
|
|
{ |
|
2481
|
0
|
|
|
|
|
|
foreach my $relative ( keys %{$temp{$ip_address}} ) |
|
|
0
|
|
|
|
|
|
|
|
2482
|
|
|
|
|
|
|
{ |
|
2483
|
0
|
0
|
0
|
|
|
|
next unless $temp{$ip_address}{$relative}{'entPhysicalDescr'}=~/mc/i || |
|
2484
|
|
|
|
|
|
|
$temp{$ip_address}{$relative}{'entPhysicalDescr'}=~/ether/i; |
|
2485
|
0
|
|
|
|
|
|
$temp{$ip_address}{'rev'}{ $temp{$ip_address}{$relative}{'entPhysicalParentRelPos'} }= |
|
2486
|
|
|
|
|
|
|
$relative; |
|
2487
|
|
|
|
|
|
|
} |
|
2488
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$temp{$ip_address}{'rev'}} ) |
|
|
0
|
|
|
|
|
|
|
|
2489
|
|
|
|
|
|
|
{ |
|
2490
|
0
|
|
|
|
|
|
foreach my $attribute ( keys %{$snmp_variables} ) |
|
|
0
|
|
|
|
|
|
|
|
2491
|
|
|
|
|
|
|
{ |
|
2492
|
0
|
0
|
|
|
|
|
next if $attribute=~/PRIVATE/; |
|
2493
|
0
|
|
|
|
|
|
${$data}{$ip_address}{$a}{$attribute}= |
|
|
0
|
|
|
|
|
|
|
|
2494
|
|
|
|
|
|
|
$temp{$ip_address}{ $temp{$ip_address}{'rev'}{$a} }{$attribute}; |
|
2495
|
|
|
|
|
|
|
} |
|
2496
|
|
|
|
|
|
|
} |
|
2497
|
0
|
|
|
|
|
|
${$data}{$ip_address}{'total_slots'}=6; |
|
|
0
|
|
|
|
|
|
|
|
2498
|
|
|
|
|
|
|
} |
|
2499
|
0
|
|
|
|
|
|
undef %temp; |
|
2500
|
0
|
|
|
|
|
|
return 1; |
|
2501
|
|
|
|
|
|
|
} |
|
2502
|
|
|
|
|
|
|
|
|
2503
|
|
|
|
|
|
|
sub UBR_7200_get_Inventory_Blocking |
|
2504
|
|
|
|
|
|
|
{ |
|
2505
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
2506
|
0
|
|
|
|
|
|
my $data = shift; |
|
2507
|
0
|
|
|
|
|
|
my $current_ubrs=$self->Router_Return_All(); |
|
2508
|
0
|
0
|
|
|
|
|
if ( scalar( keys %{$current_ubrs})==0 ) { return 0; } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
2509
|
0
|
|
|
|
|
|
my $snmp_variables = Router::Statistics::OID->Router_inventory_oid(); |
|
2510
|
0
|
|
|
|
|
|
my $int_snmp_variables = Router::Statistics::OID->Host_populate_oid(); |
|
2511
|
0
|
|
|
|
|
|
my %temp; |
|
2512
|
0
|
|
|
|
|
|
my ($foo,$bar); |
|
2513
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
2514
|
|
|
|
|
|
|
{ |
|
2515
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
2516
|
0
|
|
|
|
|
|
my ($profile_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
2517
|
|
|
|
|
|
|
get_table( |
|
2518
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'PRIVATE_inventory'} ); |
|
2519
|
|
|
|
|
|
|
|
|
2520
|
0
|
|
|
|
|
|
while(($foo, $bar) = each(%{$profile_information})) |
|
|
0
|
|
|
|
|
|
|
|
2521
|
0
|
|
|
|
|
|
{ foreach my $snmp_value ( keys %{$snmp_variables} ) |
|
|
0
|
|
|
|
|
|
|
|
2522
|
0
|
0
|
|
|
|
|
{ if ( $foo=~/^${$snmp_variables}{$snmp_value}.(\d+)/ ) { $temp{$ip_address}{$1}{$snmp_value}=$bar; } } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
2523
|
0
|
|
|
|
|
|
delete ${$profile_information}{$foo}; |
|
|
0
|
|
|
|
|
|
|
|
2524
|
|
|
|
|
|
|
} |
|
2525
|
|
|
|
|
|
|
|
|
2526
|
0
|
|
|
|
|
|
($profile_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
2527
|
|
|
|
|
|
|
get_request ( -varbindlist => [ |
|
2528
|
0
|
|
|
|
|
|
${$int_snmp_variables}{'sysDescr'}, |
|
2529
|
0
|
|
|
|
|
|
${$int_snmp_variables}{'entPhysicalDescr.1'}, |
|
2530
|
0
|
|
|
|
|
|
${$int_snmp_variables}{'entPhysicalDescr.2'}, |
|
2531
|
|
|
|
|
|
|
] ); |
|
2532
|
|
|
|
|
|
|
|
|
2533
|
0
|
|
|
|
|
|
${$data}{$ip_address}{'ios_version'} = |
|
|
0
|
|
|
|
|
|
|
|
2534
|
0
|
|
|
|
|
|
(split(/,/,$profile_information->{ ${$int_snmp_variables}{'sysDescr'} }))[1]; |
|
2535
|
0
|
|
|
|
|
|
${$data}{$ip_address}{'chassis'} = |
|
|
0
|
|
|
|
|
|
|
|
2536
|
0
|
|
|
|
|
|
$profile_information->{ ${$int_snmp_variables}{'entPhysicalDescr.1'} }; |
|
2537
|
0
|
|
|
|
|
|
${$data}{$ip_address}{'cpu_type'} = |
|
|
0
|
|
|
|
|
|
|
|
2538
|
0
|
|
|
|
|
|
$profile_information->{ ${$int_snmp_variables}{'entPhysicalDescr.2'} }; |
|
2539
|
|
|
|
|
|
|
|
|
2540
|
|
|
|
|
|
|
} |
|
2541
|
|
|
|
|
|
|
|
|
2542
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %temp ) |
|
2543
|
|
|
|
|
|
|
{ |
|
2544
|
0
|
|
|
|
|
|
foreach my $relative ( keys %{$temp{$ip_address}} ) |
|
|
0
|
|
|
|
|
|
|
|
2545
|
|
|
|
|
|
|
{ |
|
2546
|
0
|
0
|
0
|
|
|
|
next unless $temp{$ip_address}{$relative}{'entPhysicalDescr'}=~/mc/i || |
|
2547
|
|
|
|
|
|
|
$temp{$ip_address}{$relative}{'entPhysicalDescr'}=~/ether/i; |
|
2548
|
0
|
|
|
|
|
|
$temp{$ip_address}{'rev'}{ $temp{$ip_address}{$relative}{'entPhysicalParentRelPos'} }= |
|
2549
|
|
|
|
|
|
|
$relative; |
|
2550
|
|
|
|
|
|
|
} |
|
2551
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$temp{$ip_address}{'rev'}} ) |
|
|
0
|
|
|
|
|
|
|
|
2552
|
|
|
|
|
|
|
{ |
|
2553
|
0
|
|
|
|
|
|
foreach my $attribute ( keys %{$snmp_variables} ) |
|
|
0
|
|
|
|
|
|
|
|
2554
|
|
|
|
|
|
|
{ |
|
2555
|
0
|
0
|
|
|
|
|
next if $attribute=~/PRIVATE/; |
|
2556
|
0
|
|
|
|
|
|
${$data}{$ip_address}{$a}{$attribute}= |
|
|
0
|
|
|
|
|
|
|
|
2557
|
|
|
|
|
|
|
$temp{$ip_address}{ $temp{$ip_address}{'rev'}{$a} }{$attribute}; |
|
2558
|
|
|
|
|
|
|
} |
|
2559
|
|
|
|
|
|
|
} |
|
2560
|
0
|
|
|
|
|
|
${$data}{$ip_address}{'total_slots'}=6; |
|
|
0
|
|
|
|
|
|
|
|
2561
|
|
|
|
|
|
|
} |
|
2562
|
0
|
|
|
|
|
|
undef %temp; |
|
2563
|
0
|
|
|
|
|
|
return 1; |
|
2564
|
|
|
|
|
|
|
} |
|
2565
|
|
|
|
|
|
|
|
|
2566
|
|
|
|
|
|
|
|
|
2567
|
|
|
|
|
|
|
sub Export_UBR_Slot_Inventory |
|
2568
|
|
|
|
|
|
|
{ |
|
2569
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
2570
|
0
|
|
|
|
|
|
my $data = shift; |
|
2571
|
0
|
|
|
|
|
|
my $router_list = shift; |
|
2572
|
0
|
|
|
|
|
|
my $handle = shift; |
|
2573
|
0
|
|
|
|
|
|
my $format = shift; |
|
2574
|
|
|
|
|
|
|
|
|
2575
|
0
|
0
|
|
|
|
|
if ( scalar ( keys %{$data} ) == 0 ) |
|
|
0
|
|
|
|
|
|
|
|
2576
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="No Router Data Available."; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
2577
|
|
|
|
|
|
|
|
|
2578
|
0
|
0
|
|
|
|
|
if ( scalar ( keys %{$router_list} ) == 0 ) |
|
|
0
|
|
|
|
|
|
|
|
2579
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="Router List Required."; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
2580
|
|
|
|
|
|
|
|
|
2581
|
0
|
0
|
|
|
|
|
if ( !$handle ) |
|
2582
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="File Handle Required."; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
2583
|
|
|
|
|
|
|
|
|
2584
|
0
|
0
|
|
|
|
|
if ( $format!~/csv/i ) |
|
2585
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="Only CSV Format Supported."; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
2586
|
|
|
|
|
|
|
|
|
2587
|
0
|
0
|
|
|
|
|
if ( $format=~/csv/i ) |
|
2588
|
0
|
|
|
|
|
|
{ print $handle "ip_address,hostname,slot,description,serialnum,partcode\n"; } |
|
2589
|
|
|
|
|
|
|
|
|
2590
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$data} ) |
|
|
0
|
|
|
|
|
|
|
|
2591
|
|
|
|
|
|
|
{ |
|
2592
|
0
|
0
|
|
|
|
|
if ( $format=~/csv/i ) |
|
2593
|
|
|
|
|
|
|
{ |
|
2594
|
0
|
|
|
|
|
|
for(my $slot=0;$slot<${$data}{$ip_address}{'total_slots'}+1;$slot++) |
|
|
0
|
|
|
|
|
|
|
|
2595
|
|
|
|
|
|
|
{ |
|
2596
|
0
|
0
|
|
|
|
|
if ( !${$data}{$ip_address}{$slot}{'entPhysicalDescr'} ) |
|
|
0
|
|
|
|
|
|
|
|
2597
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$slot}{'entPhysicalDescr'}="Empty"; } |
|
|
0
|
|
|
|
|
|
|
|
2598
|
0
|
|
|
|
|
|
print $handle "\"$ip_address\",\"${$router_list}{$ip_address}{'hostName'}\",\"$slot\","; |
|
|
0
|
|
|
|
|
|
|
|
2599
|
0
|
|
|
|
|
|
print $handle "\"${$data}{$ip_address}{$slot}{'entPhysicalDescr'}\","; |
|
|
0
|
|
|
|
|
|
|
|
2600
|
0
|
|
|
|
|
|
print $handle "\"${$data}{$ip_address}{$slot}{'entPhysicalSerialNum'}\","; |
|
|
0
|
|
|
|
|
|
|
|
2601
|
0
|
|
|
|
|
|
print $handle "\"${$data}{$ip_address}{$slot}{'entPhysicalModelName'}\""; |
|
|
0
|
|
|
|
|
|
|
|
2602
|
0
|
|
|
|
|
|
print $handle "\n"; |
|
2603
|
|
|
|
|
|
|
} |
|
2604
|
|
|
|
|
|
|
} |
|
2605
|
|
|
|
|
|
|
} |
|
2606
|
0
|
|
|
|
|
|
return 1; |
|
2607
|
|
|
|
|
|
|
} |
|
2608
|
|
|
|
|
|
|
|
|
2609
|
|
|
|
|
|
|
sub Export_UBR_Port_Inventory |
|
2610
|
|
|
|
|
|
|
{ |
|
2611
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
2612
|
0
|
|
|
|
|
|
my $data = shift; |
|
2613
|
0
|
|
|
|
|
|
my $router_list = shift; |
|
2614
|
0
|
|
|
|
|
|
my $handle = shift; |
|
2615
|
0
|
|
|
|
|
|
my $format = shift; |
|
2616
|
|
|
|
|
|
|
|
|
2617
|
0
|
0
|
|
|
|
|
if ( scalar ( keys %{$data} ) == 0 ) |
|
|
0
|
|
|
|
|
|
|
|
2618
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="No Router Data Available."; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
2619
|
|
|
|
|
|
|
|
|
2620
|
0
|
0
|
|
|
|
|
if ( scalar ( keys %{$router_list} ) == 0 ) |
|
|
0
|
|
|
|
|
|
|
|
2621
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="Router List Required."; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
2622
|
|
|
|
|
|
|
|
|
2623
|
0
|
0
|
|
|
|
|
if ( !$handle ) |
|
2624
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="File Handle Required."; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
2625
|
|
|
|
|
|
|
|
|
2626
|
0
|
0
|
|
|
|
|
if ( $format!~/csv/i ) |
|
2627
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="Only CSV Format Supported."; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
2628
|
|
|
|
|
|
|
|
|
2629
|
0
|
0
|
|
|
|
|
if ( $format=~/csv/i ) |
|
2630
|
0
|
|
|
|
|
|
{ print $handle "ip_address,hostname,slot,port,interface_name,operstatus,adminstatus\n"; } |
|
2631
|
|
|
|
|
|
|
|
|
2632
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$data} ) |
|
|
0
|
|
|
|
|
|
|
|
2633
|
|
|
|
|
|
|
{ |
|
2634
|
0
|
0
|
|
|
|
|
if ( $format=~/csv/i ) |
|
2635
|
|
|
|
|
|
|
{ |
|
2636
|
0
|
|
|
|
|
|
foreach my $interface ( keys %{${$data}{$ip_address}} ) |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
2637
|
|
|
|
|
|
|
{ |
|
2638
|
0
|
|
|
|
|
|
my ($slot,$port); |
|
2639
|
0
|
0
|
|
|
|
|
if ( ${$data}{$ip_address}{$interface}{'ifDescr'}=~/(\d+)$/ ) |
|
|
0
|
|
|
|
|
|
|
|
2640
|
0
|
|
|
|
|
|
{ $slot="$1"; $port="Main Controller"; } |
|
|
0
|
|
|
|
|
|
|
|
2641
|
0
|
0
|
|
|
|
|
if ( ${$data}{$ip_address}{$interface}{'ifDescr'}=~/(\d+)\/(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
2642
|
0
|
|
|
|
|
|
{ $slot=$1; $port=$2; } |
|
|
0
|
|
|
|
|
|
|
|
2643
|
0
|
|
|
|
|
|
print $handle "\"$ip_address\",\"${$router_list}{$ip_address}{'hostName'}\","; |
|
|
0
|
|
|
|
|
|
|
|
2644
|
0
|
|
|
|
|
|
print $handle "\"$slot\",\"$port\","; |
|
2645
|
0
|
|
|
|
|
|
print $handle "\"${$data}{$ip_address}{$interface}{'ifDescr'}\","; |
|
|
0
|
|
|
|
|
|
|
|
2646
|
0
|
|
|
|
|
|
print $handle "\"${$data}{$ip_address}{$interface}{'ifOperStatus'}\","; |
|
|
0
|
|
|
|
|
|
|
|
2647
|
0
|
|
|
|
|
|
print $handle "\"${$data}{$ip_address}{$interface}{'ifAdminStatus'}\","; |
|
|
0
|
|
|
|
|
|
|
|
2648
|
0
|
|
|
|
|
|
print $handle "\"${$data}{$ip_address}{$interface}{'ifAlias'}\""; |
|
|
0
|
|
|
|
|
|
|
|
2649
|
0
|
|
|
|
|
|
print $handle "\n"; |
|
2650
|
|
|
|
|
|
|
} |
|
2651
|
|
|
|
|
|
|
} |
|
2652
|
|
|
|
|
|
|
} |
|
2653
|
0
|
|
|
|
|
|
return 1; |
|
2654
|
|
|
|
|
|
|
} |
|
2655
|
|
|
|
|
|
|
|
|
2656
|
|
|
|
|
|
|
sub Get_7600_Inventory |
|
2657
|
|
|
|
|
|
|
{ |
|
2658
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
2659
|
0
|
|
|
|
|
|
my $data = shift; |
|
2660
|
0
|
|
|
|
|
|
my $current_ubrs=$self->Router_Return_All(); |
|
2661
|
0
|
0
|
|
|
|
|
if ( scalar( keys %{$current_ubrs})==0 ) { return 0; } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
2662
|
0
|
|
|
|
|
|
my $snmp_variables = Router::Statistics::OID->Router_inventory_oid(); |
|
2663
|
|
|
|
|
|
|
|
|
2664
|
0
|
|
|
|
|
|
my %temp; |
|
2665
|
|
|
|
|
|
|
|
|
2666
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
2667
|
|
|
|
|
|
|
{ |
|
2668
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
2669
|
0
|
|
|
|
|
|
my ($profile_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
2670
|
|
|
|
|
|
|
get_table( |
|
2671
|
|
|
|
|
|
|
-callback => [ \&validate_one, \%temp, $ip_address, $snmp_variables ], |
|
2672
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'PRIVATE_inventory'} ); |
|
2673
|
|
|
|
|
|
|
} |
|
2674
|
0
|
|
|
|
|
|
snmp_dispatcher(); |
|
2675
|
|
|
|
|
|
|
|
|
2676
|
|
|
|
|
|
|
|
|
2677
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %temp ) |
|
2678
|
|
|
|
|
|
|
{ |
|
2679
|
0
|
|
|
|
|
|
foreach my $relative ( keys %{$temp{$ip_address}} ) |
|
|
0
|
|
|
|
|
|
|
|
2680
|
|
|
|
|
|
|
{ |
|
2681
|
0
|
0
|
|
|
|
|
if ( $temp{$ip_address}{$relative}{'entPhysicalName'}=~/^(\d+)$/ ) |
|
2682
|
0
|
|
|
|
|
|
{ $temp{$ip_address}{'rev'}{ $1 }{'main'}=$relative; } |
|
2683
|
0
|
0
|
|
|
|
|
if ( $temp{$ip_address}{$relative}{'entPhysicalName'}=~/(\d+)\/(\d+)$/ ) |
|
2684
|
0
|
|
|
|
|
|
{ $temp{$ip_address}{'rev'}{ $1 }{'child'}{$2}=$relative; } |
|
2685
|
|
|
|
|
|
|
} |
|
2686
|
0
|
|
|
|
|
|
foreach my $a ( keys %{$temp{$ip_address}{'rev'}} ) |
|
|
0
|
|
|
|
|
|
|
|
2687
|
|
|
|
|
|
|
{ |
|
2688
|
0
|
|
|
|
|
|
foreach my $child ( keys %{$temp{$ip_address}{'rev'}{$a}{'child'}} ) |
|
|
0
|
|
|
|
|
|
|
|
2689
|
|
|
|
|
|
|
{ |
|
2690
|
0
|
|
|
|
|
|
foreach my $attribute ( keys %{$snmp_variables} ) |
|
|
0
|
|
|
|
|
|
|
|
2691
|
|
|
|
|
|
|
{ |
|
2692
|
0
|
0
|
|
|
|
|
next if $attribute=~/PRIVATE/; |
|
2693
|
0
|
|
|
|
|
|
${$data}{$ip_address}{'slot'}{$a}{'child'}{$child}{$attribute}= |
|
|
0
|
|
|
|
|
|
|
|
2694
|
|
|
|
|
|
|
$temp{$ip_address}{ $temp{$ip_address}{'rev'}{$a}{'child'}{$child} } {$attribute}; |
|
2695
|
|
|
|
|
|
|
} |
|
2696
|
|
|
|
|
|
|
} |
|
2697
|
0
|
|
|
|
|
|
foreach my $attribute ( keys %{$snmp_variables} ) |
|
|
0
|
|
|
|
|
|
|
|
2698
|
|
|
|
|
|
|
{ |
|
2699
|
0
|
0
|
|
|
|
|
next if $attribute=~/PRIVATE/; |
|
2700
|
0
|
|
|
|
|
|
${$data}{$ip_address}{'slot'}{$a}{'main'}{$attribute}= |
|
|
0
|
|
|
|
|
|
|
|
2701
|
|
|
|
|
|
|
$temp{$ip_address}{ $temp{$ip_address}{'rev'}{$a}{'main'} }{$attribute}; |
|
2702
|
|
|
|
|
|
|
} |
|
2703
|
|
|
|
|
|
|
} |
|
2704
|
0
|
|
|
|
|
|
$temp{$ip_address}{'1'}{'entPhysicalDescr'}=~/Cisco (\d+) (\d+)-slot/; |
|
2705
|
0
|
|
|
|
|
|
${$data}{$ip_address}{'total_slots'}=$2; |
|
|
0
|
|
|
|
|
|
|
|
2706
|
|
|
|
|
|
|
} |
|
2707
|
0
|
|
|
|
|
|
undef %temp; |
|
2708
|
0
|
|
|
|
|
|
return 1; |
|
2709
|
|
|
|
|
|
|
} |
|
2710
|
|
|
|
|
|
|
|
|
2711
|
|
|
|
|
|
|
sub CMTS_get_DOCSIS_profiles |
|
2712
|
|
|
|
|
|
|
{ |
|
2713
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
2714
|
0
|
|
|
|
|
|
my $data = shift; |
|
2715
|
0
|
|
|
|
|
|
my $current_ubrs=$self->Router_Return_All(); |
|
2716
|
0
|
0
|
|
|
|
|
if ( scalar( keys %{$current_ubrs})==0 ) { return 0; } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
2717
|
0
|
|
|
|
|
|
my $snmp_variables = Router::Statistics::OID->DOCSIS_Modulation(); |
|
2718
|
|
|
|
|
|
|
|
|
2719
|
0
|
|
|
|
|
|
my %temp; |
|
2720
|
|
|
|
|
|
|
|
|
2721
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
2722
|
|
|
|
|
|
|
{ |
|
2723
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
2724
|
0
|
|
|
|
|
|
my ($profile_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
2725
|
|
|
|
|
|
|
get_table( |
|
2726
|
|
|
|
|
|
|
-callback => [ \&validate_two, $data, $ip_address, $snmp_variables ], |
|
2727
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'PRIVATE_docsIfCmtsMod_base'} ); |
|
2728
|
|
|
|
|
|
|
} |
|
2729
|
|
|
|
|
|
|
|
|
2730
|
0
|
|
|
|
|
|
foreach my $ip ( keys %{$data} ) |
|
|
0
|
|
|
|
|
|
|
|
2731
|
|
|
|
|
|
|
{ |
|
2732
|
0
|
|
|
|
|
|
foreach my $profile_id ( keys %{${$data}{$ip}} ) |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
2733
|
|
|
|
|
|
|
{ |
|
2734
|
0
|
|
|
|
|
|
foreach my $attribute ( keys %{${$data}{$ip}{$profile_id}} ) |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
2735
|
|
|
|
|
|
|
{ |
|
2736
|
0
|
0
|
|
|
|
|
if ( $attribute=~/docsIfCmtsModType/i ) |
|
2737
|
|
|
|
|
|
|
{ |
|
2738
|
0
|
|
|
|
|
|
${$data}{$ip}{$profile_id}{$attribute}= |
|
|
0
|
|
|
|
|
|
|
|
2739
|
|
|
|
|
|
|
( '0_unknown' , '1_other', '2_qpsk', '3_qam16', |
|
2740
|
|
|
|
|
|
|
'4_qam8', '5_qam32', '6_qam64', '7_qam128' ) |
|
2741
|
0
|
|
|
|
|
|
[${$data}{$ip}{$profile_id}{$attribute}]; |
|
2742
|
|
|
|
|
|
|
} |
|
2743
|
0
|
0
|
|
|
|
|
if ( $attribute=~/docsIfCmtsModDifferentialEncoding/i ) |
|
2744
|
|
|
|
|
|
|
{ |
|
2745
|
0
|
|
|
|
|
|
${$data}{$ip}{$profile_id}{$attribute}= |
|
|
0
|
|
|
|
|
|
|
|
2746
|
|
|
|
|
|
|
( '0_unknown', '1_true', '2_false' ) |
|
2747
|
0
|
|
|
|
|
|
[${$data}{$ip}{$profile_id}{$attribute}]; |
|
2748
|
|
|
|
|
|
|
} |
|
2749
|
0
|
0
|
|
|
|
|
if ( $attribute=~/docsIfCmtsModLastCodewordShortened/i ) |
|
2750
|
|
|
|
|
|
|
{ |
|
2751
|
0
|
|
|
|
|
|
${$data}{$ip}{$profile_id}{$attribute}= |
|
|
0
|
|
|
|
|
|
|
|
2752
|
|
|
|
|
|
|
( '0_unknown', '1_true', '2_false' ) |
|
2753
|
0
|
|
|
|
|
|
[${$data}{$ip}{$profile_id}{$attribute}]; |
|
2754
|
|
|
|
|
|
|
} |
|
2755
|
0
|
0
|
|
|
|
|
if ( $attribute=~/docsIfCmtsModScrambler/i ) |
|
2756
|
|
|
|
|
|
|
{ |
|
2757
|
0
|
|
|
|
|
|
${$data}{$ip}{$profile_id}{$attribute}= |
|
|
0
|
|
|
|
|
|
|
|
2758
|
|
|
|
|
|
|
( '0_unknown', '1_true', '2_false' ) |
|
2759
|
0
|
|
|
|
|
|
[${$data}{$ip}{$profile_id}{$attribute}]; |
|
2760
|
|
|
|
|
|
|
} |
|
2761
|
0
|
0
|
|
|
|
|
if ( $attribute=~/docsIfCmtsModPreambleType/i ) |
|
2762
|
|
|
|
|
|
|
{ |
|
2763
|
0
|
|
|
|
|
|
${$data}{$ip}{$profile_id}{$attribute}= |
|
|
0
|
|
|
|
|
|
|
|
2764
|
|
|
|
|
|
|
( '0_unknown', '1_qpsk0', '2_qpsk1' ) |
|
2765
|
0
|
|
|
|
|
|
[${$data}{$ip}{$profile_id}{$attribute}]; |
|
2766
|
|
|
|
|
|
|
} |
|
2767
|
0
|
0
|
|
|
|
|
if ( $attribute=~/docsIfCmtsModTcmErrorCorrectionOn/i ) |
|
2768
|
|
|
|
|
|
|
{ |
|
2769
|
0
|
|
|
|
|
|
${$data}{$ip}{$profile_id}{$attribute}= |
|
|
0
|
|
|
|
|
|
|
|
2770
|
|
|
|
|
|
|
( '0_unknown', '1_true', '2_false' ) |
|
2771
|
0
|
|
|
|
|
|
[${$data}{$ip}{$profile_id}{$attribute}]; |
|
2772
|
|
|
|
|
|
|
} |
|
2773
|
0
|
0
|
|
|
|
|
if ( $attribute=~/docsIfCmtsModScdmaSpreaderEnable/i ) |
|
2774
|
|
|
|
|
|
|
{ |
|
2775
|
0
|
|
|
|
|
|
${$data}{$ip}{$profile_id}{$attribute}= |
|
|
0
|
|
|
|
|
|
|
|
2776
|
|
|
|
|
|
|
( '0_unknown', '1_true', '2_false' ) |
|
2777
|
0
|
|
|
|
|
|
[${$data}{$ip}{$profile_id}{$attribute}]; |
|
2778
|
|
|
|
|
|
|
} |
|
2779
|
0
|
0
|
|
|
|
|
if ( $attribute=~/docsIfCmtsModChannelType/i ) |
|
2780
|
|
|
|
|
|
|
{ |
|
2781
|
0
|
|
|
|
|
|
${$data}{$ip}{$profile_id}{$attribute}= |
|
|
0
|
|
|
|
|
|
|
|
2782
|
|
|
|
|
|
|
( '0_unknown', '1_tdma', '2_atdma', '3_scdma','4_tdmaAndAtdma' ) |
|
2783
|
0
|
|
|
|
|
|
[${$data}{$ip}{$profile_id}{$attribute}]; |
|
2784
|
|
|
|
|
|
|
} |
|
2785
|
|
|
|
|
|
|
} |
|
2786
|
|
|
|
|
|
|
} |
|
2787
|
|
|
|
|
|
|
} |
|
2788
|
|
|
|
|
|
|
|
|
2789
|
0
|
|
|
|
|
|
snmp_dispatcher(); |
|
2790
|
0
|
|
|
|
|
|
return 1; |
|
2791
|
|
|
|
|
|
|
} |
|
2792
|
|
|
|
|
|
|
|
|
2793
|
|
|
|
|
|
|
|
|
2794
|
|
|
|
|
|
|
sub UBR_get_DOCSIS_upstream_interfaces |
|
2795
|
|
|
|
|
|
|
{ |
|
2796
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
2797
|
0
|
|
|
|
|
|
my $data = shift; |
|
2798
|
|
|
|
|
|
|
# ie |
|
2799
|
|
|
|
|
|
|
# |
|
2800
|
|
|
|
|
|
|
# $result = $Object -> get_DOCSIS_upstream_interfaces ( \%upstream_interfaces ); |
|
2801
|
|
|
|
|
|
|
# |
|
2802
|
|
|
|
|
|
|
# $result contains 1 or 0 for 1 = success, 0 = failure. |
|
2803
|
|
|
|
|
|
|
|
|
2804
|
0
|
|
|
|
|
|
my $current_ubrs=$self->Router_Return_All(); |
|
2805
|
0
|
0
|
|
|
|
|
if ( scalar( keys %{$current_ubrs})==0 ) { return 0; } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
2806
|
|
|
|
|
|
|
|
|
2807
|
0
|
|
|
|
|
|
my $snmp_variables = Router::Statistics::OID->DOCSIS_populate_oid(); |
|
2808
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
2809
|
|
|
|
|
|
|
{ |
|
2810
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
2811
|
0
|
|
|
|
|
|
my ($profile_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
2812
|
|
|
|
|
|
|
get_table( |
|
2813
|
|
|
|
|
|
|
-callback => [ \&validate_one, $data, $ip_address, $snmp_variables ], |
|
2814
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'PRIVATE_cable_channel_information'} ); |
|
2815
|
|
|
|
|
|
|
} |
|
2816
|
|
|
|
|
|
|
|
|
2817
|
0
|
|
|
|
|
|
snmp_dispatcher(); |
|
2818
|
|
|
|
|
|
|
|
|
2819
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
2820
|
|
|
|
|
|
|
{ |
|
2821
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
2822
|
0
|
|
|
|
|
|
my ($profile_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
2823
|
|
|
|
|
|
|
get_table( |
|
2824
|
|
|
|
|
|
|
-callback => [ \&validate_one, $data, $ip_address, $snmp_variables ], |
|
2825
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'PRIVATE_cable_channel_parameters'} ); |
|
2826
|
|
|
|
|
|
|
} |
|
2827
|
0
|
|
|
|
|
|
snmp_dispatcher(); |
|
2828
|
|
|
|
|
|
|
|
|
2829
|
0
|
|
|
|
|
|
return 1; |
|
2830
|
|
|
|
|
|
|
} |
|
2831
|
|
|
|
|
|
|
|
|
2832
|
|
|
|
|
|
|
sub UBR_get_DOCSIS_upstream_interfaces_Blocking |
|
2833
|
|
|
|
|
|
|
{ |
|
2834
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
2835
|
0
|
|
|
|
|
|
my $data = shift; |
|
2836
|
|
|
|
|
|
|
|
|
2837
|
0
|
|
|
|
|
|
my ( $foo, $bar ); |
|
2838
|
|
|
|
|
|
|
|
|
2839
|
0
|
|
|
|
|
|
my $current_ubrs=$self->Router_Return_All(); |
|
2840
|
0
|
0
|
|
|
|
|
if ( scalar( keys %{$current_ubrs})==0 ) { return 0; } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
2841
|
|
|
|
|
|
|
|
|
2842
|
0
|
|
|
|
|
|
my $snmp_variables = Router::Statistics::OID->DOCSIS_populate_oid(); |
|
2843
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
2844
|
|
|
|
|
|
|
{ |
|
2845
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
2846
|
0
|
|
|
|
|
|
my ($profile_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
2847
|
|
|
|
|
|
|
get_table( |
|
2848
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'PRIVATE_cable_channel_information'} ); |
|
2849
|
0
|
|
|
|
|
|
while(($foo, $bar) = each(%{$profile_information})) |
|
|
0
|
|
|
|
|
|
|
|
2850
|
0
|
|
|
|
|
|
{ foreach my $snmp_value ( keys %{$snmp_variables} ) |
|
|
0
|
|
|
|
|
|
|
|
2851
|
0
|
0
|
|
|
|
|
{ if ( $foo=~/^${$snmp_variables}{$snmp_value}.(\d+)/ ) { ${$data}{$ip_address}{$1}{$snmp_value}=$bar; } } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
2852
|
0
|
|
|
|
|
|
delete ${$profile_information}{$foo}; |
|
|
0
|
|
|
|
|
|
|
|
2853
|
|
|
|
|
|
|
} |
|
2854
|
|
|
|
|
|
|
|
|
2855
|
0
|
|
|
|
|
|
($profile_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
2856
|
|
|
|
|
|
|
get_table( |
|
2857
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'PRIVATE_cable_channel_parameters'} ); |
|
2858
|
0
|
|
|
|
|
|
while(($foo, $bar) = each(%{$profile_information})) |
|
|
0
|
|
|
|
|
|
|
|
2859
|
0
|
|
|
|
|
|
{ foreach my $snmp_value ( keys %{$snmp_variables} ) |
|
|
0
|
|
|
|
|
|
|
|
2860
|
0
|
0
|
|
|
|
|
{ if ( $foo=~/^${$snmp_variables}{$snmp_value}.(\d+)/ ) { ${$data}{$ip_address}{$1}{$snmp_value}=$bar; } } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
2861
|
0
|
|
|
|
|
|
delete ${$profile_information}{$foo}; |
|
|
0
|
|
|
|
|
|
|
|
2862
|
|
|
|
|
|
|
} |
|
2863
|
|
|
|
|
|
|
|
|
2864
|
|
|
|
|
|
|
} |
|
2865
|
0
|
|
|
|
|
|
return 1; |
|
2866
|
|
|
|
|
|
|
} |
|
2867
|
|
|
|
|
|
|
|
|
2868
|
|
|
|
|
|
|
|
|
2869
|
|
|
|
|
|
|
|
|
2870
|
|
|
|
|
|
|
sub UBR_get_DOCSIS_interface_information |
|
2871
|
|
|
|
|
|
|
{ |
|
2872
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
2873
|
0
|
|
|
|
|
|
my $data = shift; |
|
2874
|
|
|
|
|
|
|
|
|
2875
|
0
|
|
|
|
|
|
my $current_ubrs=$self->Router_Return_All(); |
|
2876
|
0
|
0
|
|
|
|
|
if ( scalar( keys %{$current_ubrs})==0 ) { return 0; } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
2877
|
|
|
|
|
|
|
|
|
2878
|
0
|
|
|
|
|
|
my $snmp_variables = Router::Statistics::OID->DOCSIS_populate_oid(); |
|
2879
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
2880
|
|
|
|
|
|
|
{ |
|
2881
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
2882
|
0
|
|
|
|
|
|
my ($profile_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
2883
|
|
|
|
|
|
|
get_table( |
|
2884
|
|
|
|
|
|
|
-callback => [ \&validate_one, $data, $ip_address, $snmp_variables ], |
|
2885
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'PRIVATE_cable_signal_base'} ); |
|
2886
|
|
|
|
|
|
|
} |
|
2887
|
0
|
|
|
|
|
|
snmp_dispatcher(); |
|
2888
|
|
|
|
|
|
|
|
|
2889
|
0
|
|
|
|
|
|
return 1; |
|
2890
|
|
|
|
|
|
|
} |
|
2891
|
|
|
|
|
|
|
|
|
2892
|
|
|
|
|
|
|
sub UBR_get_DOCSIS_interface_information_Blocking |
|
2893
|
|
|
|
|
|
|
{ |
|
2894
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
2895
|
0
|
|
|
|
|
|
my $data = shift; |
|
2896
|
|
|
|
|
|
|
|
|
2897
|
0
|
|
|
|
|
|
my ( $foo, $bar ); |
|
2898
|
|
|
|
|
|
|
|
|
2899
|
0
|
|
|
|
|
|
my $current_ubrs=$self->Router_Return_All(); |
|
2900
|
0
|
0
|
|
|
|
|
if ( scalar( keys %{$current_ubrs})==0 ) { return 0; } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
2901
|
|
|
|
|
|
|
|
|
2902
|
0
|
|
|
|
|
|
my $snmp_variables = Router::Statistics::OID->DOCSIS_populate_oid(); |
|
2903
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
2904
|
|
|
|
|
|
|
{ |
|
2905
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
2906
|
0
|
|
|
|
|
|
my ($profile_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
2907
|
|
|
|
|
|
|
get_table( |
|
2908
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'PRIVATE_cable_signal_base'} ); |
|
2909
|
0
|
|
|
|
|
|
while(($foo, $bar) = each(%{$profile_information})) |
|
|
0
|
|
|
|
|
|
|
|
2910
|
0
|
|
|
|
|
|
{ foreach my $snmp_value ( keys %{$snmp_variables} ) |
|
|
0
|
|
|
|
|
|
|
|
2911
|
0
|
0
|
|
|
|
|
{ if ( $foo=~/^${$snmp_variables}{$snmp_value}.(\d+)/ ) { ${$data}{$ip_address}{$1}{$snmp_value}=$bar; } } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
2912
|
0
|
|
|
|
|
|
delete ${$profile_information}{$foo}; |
|
|
0
|
|
|
|
|
|
|
|
2913
|
|
|
|
|
|
|
} |
|
2914
|
|
|
|
|
|
|
} |
|
2915
|
|
|
|
|
|
|
|
|
2916
|
0
|
|
|
|
|
|
return 1; |
|
2917
|
|
|
|
|
|
|
} |
|
2918
|
|
|
|
|
|
|
|
|
2919
|
|
|
|
|
|
|
|
|
2920
|
|
|
|
|
|
|
sub UBR_get_DOCSIS_downstream_interfaces |
|
2921
|
|
|
|
|
|
|
{ |
|
2922
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
2923
|
0
|
|
|
|
|
|
my $data = shift; |
|
2924
|
|
|
|
|
|
|
|
|
2925
|
|
|
|
|
|
|
|
|
2926
|
0
|
|
|
|
|
|
my $current_ubrs=$self->Router_Return_All(); |
|
2927
|
0
|
0
|
|
|
|
|
if ( scalar( keys %{$current_ubrs})==0 ) { return 0; } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
2928
|
|
|
|
|
|
|
|
|
2929
|
0
|
|
|
|
|
|
my $snmp_variables = Router::Statistics::OID->DOCSIS_populate_oid(); |
|
2930
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
2931
|
|
|
|
|
|
|
{ |
|
2932
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
2933
|
0
|
|
|
|
|
|
my ($profile_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
2934
|
|
|
|
|
|
|
get_table( |
|
2935
|
|
|
|
|
|
|
-callback => [ \&validate_one, $data, $ip_address, $snmp_variables ], |
|
2936
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'PRIVATE_downstream_interface'} ); |
|
2937
|
|
|
|
|
|
|
} |
|
2938
|
|
|
|
|
|
|
|
|
2939
|
0
|
|
|
|
|
|
snmp_dispatcher(); |
|
2940
|
|
|
|
|
|
|
|
|
2941
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
2942
|
|
|
|
|
|
|
{ |
|
2943
|
0
|
|
|
|
|
|
foreach my $interface ( keys %{${$data}{$ip_address}} ) |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
2944
|
|
|
|
|
|
|
{ |
|
2945
|
0
|
|
|
|
|
|
${$data}{$ip_address}{$interface}{'docsIfDownChannelModulation'}= |
|
|
0
|
|
|
|
|
|
|
|
2946
|
|
|
|
|
|
|
( '0_Down' , '1_Unknown', '2_other', '3_qam64', '4_qam256' ) |
|
2947
|
0
|
|
|
|
|
|
[${$data}{$ip_address}{$interface}{'docsIfDownChannelModulation'}]; |
|
2948
|
|
|
|
|
|
|
} |
|
2949
|
|
|
|
|
|
|
} |
|
2950
|
0
|
|
|
|
|
|
return 1; |
|
2951
|
|
|
|
|
|
|
} |
|
2952
|
|
|
|
|
|
|
|
|
2953
|
|
|
|
|
|
|
sub UBR_get_DOCSIS_downstream_interfaces_Blocking |
|
2954
|
|
|
|
|
|
|
{ |
|
2955
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
2956
|
0
|
|
|
|
|
|
my $data = shift; |
|
2957
|
|
|
|
|
|
|
|
|
2958
|
0
|
|
|
|
|
|
my ( $foo, $bar ); |
|
2959
|
|
|
|
|
|
|
|
|
2960
|
0
|
|
|
|
|
|
my $current_ubrs=$self->Router_Return_All(); |
|
2961
|
0
|
0
|
|
|
|
|
if ( scalar( keys %{$current_ubrs})==0 ) { return 0; } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
2962
|
|
|
|
|
|
|
|
|
2963
|
0
|
|
|
|
|
|
my $snmp_variables = Router::Statistics::OID->DOCSIS_populate_oid(); |
|
2964
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
2965
|
|
|
|
|
|
|
{ |
|
2966
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
2967
|
0
|
|
|
|
|
|
my ($profile_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
2968
|
|
|
|
|
|
|
get_table( |
|
2969
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'PRIVATE_downstream_interface'} ); |
|
2970
|
0
|
|
|
|
|
|
while(($foo, $bar) = each(%{$profile_information})) |
|
|
0
|
|
|
|
|
|
|
|
2971
|
0
|
|
|
|
|
|
{ foreach my $snmp_value ( keys %{$snmp_variables} ) |
|
|
0
|
|
|
|
|
|
|
|
2972
|
0
|
0
|
|
|
|
|
{ if ( $foo=~/^${$snmp_variables}{$snmp_value}.(\d+)/ ) { ${$data}{$ip_address}{$1}{$snmp_value}=$bar; } } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
2973
|
0
|
|
|
|
|
|
delete ${$profile_information}{$foo}; |
|
|
0
|
|
|
|
|
|
|
|
2974
|
|
|
|
|
|
|
} |
|
2975
|
|
|
|
|
|
|
} |
|
2976
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
2977
|
|
|
|
|
|
|
{ |
|
2978
|
0
|
|
|
|
|
|
foreach my $interface ( keys %{${$data}{$ip_address}} ) |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
2979
|
|
|
|
|
|
|
{ |
|
2980
|
0
|
|
|
|
|
|
${$data}{$ip_address}{$interface}{'docsIfDownChannelModulation'}= |
|
|
0
|
|
|
|
|
|
|
|
2981
|
|
|
|
|
|
|
( '0_Down', '1_Unknown', '2_other', '3_qam64', '4_qam256' ) |
|
2982
|
0
|
|
|
|
|
|
[${$data}{$ip_address}{$interface}{'docsIfDownChannelModulation'}]; |
|
2983
|
|
|
|
|
|
|
} |
|
2984
|
|
|
|
|
|
|
} |
|
2985
|
0
|
|
|
|
|
|
return 1; |
|
2986
|
|
|
|
|
|
|
} |
|
2987
|
|
|
|
|
|
|
|
|
2988
|
|
|
|
|
|
|
|
|
2989
|
|
|
|
|
|
|
sub UBR_get_active_upstream_profiles |
|
2990
|
|
|
|
|
|
|
{ |
|
2991
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
2992
|
0
|
|
|
|
|
|
my $data = shift; |
|
2993
|
|
|
|
|
|
|
|
|
2994
|
0
|
|
|
|
|
|
my $current_ubrs=$self->Router_Return_All(); |
|
2995
|
0
|
0
|
|
|
|
|
if ( scalar( keys %{$current_ubrs})==0 ) { return 0; } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
2996
|
|
|
|
|
|
|
|
|
2997
|
0
|
|
|
|
|
|
my $snmp_variables = Router::Statistics::OID->DOCSIS_populate_oid(); |
|
2998
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
2999
|
|
|
|
|
|
|
{ |
|
3000
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
3001
|
0
|
|
|
|
|
|
my ($profile_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
3002
|
|
|
|
|
|
|
get_table( |
|
3003
|
|
|
|
|
|
|
-callback => [ \&validate_one, $data, $ip_address, $snmp_variables ], |
|
3004
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'PRIVATE_docsIfCmtsModulationEntry'} ); |
|
3005
|
|
|
|
|
|
|
} |
|
3006
|
0
|
|
|
|
|
|
snmp_dispatcher(); |
|
3007
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
3008
|
|
|
|
|
|
|
{ |
|
3009
|
0
|
|
|
|
|
|
foreach my $profile ( keys %{${$data}{$ip_address}} ) |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
3010
|
|
|
|
|
|
|
{ |
|
3011
|
0
|
|
|
|
|
|
foreach my $attribute ( keys %{${$data}{$ip_address}{$profile}} ) |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
3012
|
|
|
|
|
|
|
{ |
|
3013
|
0
|
0
|
|
|
|
|
if ( $attribute=~/docsIfCmtsModType/ ) |
|
3014
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$profile}{'docsIfCmtsModType'}= |
|
|
0
|
|
|
|
|
|
|
|
3015
|
|
|
|
|
|
|
( |
|
3016
|
|
|
|
|
|
|
'Unknown', |
|
3017
|
|
|
|
|
|
|
'other', |
|
3018
|
|
|
|
|
|
|
'qpsk', |
|
3019
|
|
|
|
|
|
|
'qam16', |
|
3020
|
|
|
|
|
|
|
'qam8', |
|
3021
|
|
|
|
|
|
|
'qam32', |
|
3022
|
|
|
|
|
|
|
'qam64', |
|
3023
|
|
|
|
|
|
|
'qam128' |
|
3024
|
|
|
|
|
|
|
) |
|
3025
|
0
|
|
|
|
|
|
[${$data}{$ip_address}{$profile}{'docsIfCmtsModType'}]; |
|
3026
|
|
|
|
|
|
|
} |
|
3027
|
|
|
|
|
|
|
} |
|
3028
|
|
|
|
|
|
|
} |
|
3029
|
|
|
|
|
|
|
} |
|
3030
|
0
|
|
|
|
|
|
return 1; |
|
3031
|
|
|
|
|
|
|
} |
|
3032
|
|
|
|
|
|
|
|
|
3033
|
|
|
|
|
|
|
sub UBR_get_active_upstream_profiles_Blocking |
|
3034
|
|
|
|
|
|
|
{ |
|
3035
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
3036
|
0
|
|
|
|
|
|
my $data = shift; |
|
3037
|
|
|
|
|
|
|
|
|
3038
|
0
|
|
|
|
|
|
my ( $foo, $bar ); |
|
3039
|
|
|
|
|
|
|
|
|
3040
|
0
|
|
|
|
|
|
my $current_ubrs=$self->Router_Return_All(); |
|
3041
|
0
|
0
|
|
|
|
|
if ( scalar( keys %{$current_ubrs})==0 ) { return 0; } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
3042
|
|
|
|
|
|
|
|
|
3043
|
0
|
|
|
|
|
|
my $snmp_variables = Router::Statistics::OID->DOCSIS_populate_oid(); |
|
3044
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
3045
|
|
|
|
|
|
|
{ |
|
3046
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
3047
|
0
|
|
|
|
|
|
my ($profile_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
3048
|
|
|
|
|
|
|
get_table( |
|
3049
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'PRIVATE_docsIfCmtsModulationEntry'} ); |
|
3050
|
|
|
|
|
|
|
|
|
3051
|
0
|
|
|
|
|
|
while(($foo, $bar) = each(%{$profile_information})) |
|
|
0
|
|
|
|
|
|
|
|
3052
|
0
|
|
|
|
|
|
{ foreach my $snmp_value ( keys %{$snmp_variables} ) |
|
|
0
|
|
|
|
|
|
|
|
3053
|
0
|
0
|
|
|
|
|
{ if ( $foo=~/^${$snmp_variables}{$snmp_value}.(\d+)/ ) { ${$data}{$ip_address}{$1}{$snmp_value}=$bar; } } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
3054
|
0
|
|
|
|
|
|
delete ${$profile_information}{$foo}; |
|
|
0
|
|
|
|
|
|
|
|
3055
|
|
|
|
|
|
|
} |
|
3056
|
|
|
|
|
|
|
} |
|
3057
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
3058
|
|
|
|
|
|
|
{ |
|
3059
|
0
|
|
|
|
|
|
foreach my $profile ( keys %{${$data}{$ip_address}} ) |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
3060
|
|
|
|
|
|
|
{ |
|
3061
|
0
|
|
|
|
|
|
${$data}{$ip_address}{$profile}{'docsIfCmtsModType'}= |
|
|
0
|
|
|
|
|
|
|
|
3062
|
|
|
|
|
|
|
( |
|
3063
|
|
|
|
|
|
|
'Unknown', |
|
3064
|
|
|
|
|
|
|
'other', |
|
3065
|
|
|
|
|
|
|
'qpsk', |
|
3066
|
|
|
|
|
|
|
'qam16', |
|
3067
|
|
|
|
|
|
|
'qam8', |
|
3068
|
|
|
|
|
|
|
'qam32', |
|
3069
|
|
|
|
|
|
|
'qam64', |
|
3070
|
|
|
|
|
|
|
'qam128' |
|
3071
|
0
|
|
|
|
|
|
) [${$data}{$ip_address}{$profile}{'docsIfCmtsModType'}]; |
|
3072
|
|
|
|
|
|
|
} |
|
3073
|
|
|
|
|
|
|
} |
|
3074
|
0
|
|
|
|
|
|
return 1; |
|
3075
|
|
|
|
|
|
|
} |
|
3076
|
|
|
|
|
|
|
|
|
3077
|
|
|
|
|
|
|
sub UBR_get_CPE_DOCS12_Blocking |
|
3078
|
|
|
|
|
|
|
{ |
|
3079
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
3080
|
0
|
|
|
|
|
|
my $data = shift; |
|
3081
|
0
|
|
|
|
|
|
my $data_selector = shift; |
|
3082
|
|
|
|
|
|
|
|
|
3083
|
0
|
|
|
|
|
|
my ( $foo, $bar ); |
|
3084
|
|
|
|
|
|
|
|
|
3085
|
0
|
|
|
|
|
|
my $current_ubrs=$self->Router_Return_All(); |
|
3086
|
0
|
0
|
|
|
|
|
if ( scalar( keys %{$current_ubrs})==0 ) { return 0; } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
3087
|
|
|
|
|
|
|
|
|
3088
|
0
|
|
|
|
|
|
my $snmp_variables = Router::Statistics::OID->DOCSIS_populate_oid(); |
|
3089
|
0
|
0
|
0
|
|
|
|
if ( $data_selector=~/QOSPROFILE/i || $data_selector=~/ALL/i ) |
|
3090
|
|
|
|
|
|
|
{ |
|
3091
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
3092
|
|
|
|
|
|
|
{ |
|
3093
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
3094
|
0
|
|
|
|
|
|
my $sider=${$snmp_variables}{'cdxCmtsCmCurrQoSPro'}; |
|
|
0
|
|
|
|
|
|
|
|
3095
|
0
|
|
|
|
|
|
my ($status_information) = $self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
3096
|
|
|
|
|
|
|
get_table( |
|
3097
|
|
|
|
|
|
|
-baseoid => $sider ); |
|
3098
|
0
|
|
|
|
|
|
while(($foo, $bar) = each(%{$status_information})) |
|
|
0
|
|
|
|
|
|
|
|
3099
|
|
|
|
|
|
|
{ |
|
3100
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'cdxCmtsCmCurrQoSPro'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
3101
|
|
|
|
|
|
|
{ |
|
3102
|
0
|
|
|
|
|
|
${$data}{$ip_address}{$1}{'cdxCmtsCmCurrQoSPro'}=$bar; |
|
|
0
|
|
|
|
|
|
|
|
3103
|
|
|
|
|
|
|
} |
|
3104
|
0
|
|
|
|
|
|
delete ${$status_information}{$foo}; |
|
|
0
|
|
|
|
|
|
|
|
3105
|
|
|
|
|
|
|
} |
|
3106
|
|
|
|
|
|
|
} |
|
3107
|
|
|
|
|
|
|
} |
|
3108
|
0
|
0
|
0
|
|
|
|
if ( $data_selector=~/CPEMAC/i || $data_selector=~/ALL/i ) |
|
3109
|
|
|
|
|
|
|
{ |
|
3110
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
3111
|
|
|
|
|
|
|
{ |
|
3112
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
3113
|
0
|
|
|
|
|
|
my ($status_information) = $self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
3114
|
|
|
|
|
|
|
get_table( |
|
3115
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'docsIfCmtsCmStatusMacAddress'} ); |
|
3116
|
0
|
|
|
|
|
|
while(($foo, $bar) = each(%{$status_information})) |
|
|
0
|
|
|
|
|
|
|
|
3117
|
|
|
|
|
|
|
{ |
|
3118
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'docsIfCmtsCmStatusMacAddress'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
3119
|
|
|
|
|
|
|
{ |
|
3120
|
0
|
|
|
|
|
|
${$data}{$ip_address}{$1}{'docsIfCmtsCmStatusMacAddress'}=_convert_mac_address($bar); |
|
|
0
|
|
|
|
|
|
|
|
3121
|
|
|
|
|
|
|
} |
|
3122
|
0
|
|
|
|
|
|
delete ${$status_information}{$foo}; |
|
|
0
|
|
|
|
|
|
|
|
3123
|
|
|
|
|
|
|
} |
|
3124
|
|
|
|
|
|
|
} |
|
3125
|
|
|
|
|
|
|
} |
|
3126
|
|
|
|
|
|
|
|
|
3127
|
0
|
|
|
|
|
|
return 1; |
|
3128
|
|
|
|
|
|
|
} |
|
3129
|
|
|
|
|
|
|
|
|
3130
|
|
|
|
|
|
|
sub UBR_get_CPE_DOCS3_Blocking |
|
3131
|
|
|
|
|
|
|
{ |
|
3132
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
3133
|
0
|
|
|
|
|
|
my $data = shift; |
|
3134
|
0
|
|
|
|
|
|
my $data_selector = shift; |
|
3135
|
|
|
|
|
|
|
|
|
3136
|
0
|
|
|
|
|
|
my ( $foo, $bar ); |
|
3137
|
0
|
|
|
|
|
|
my ( %service_flows ); |
|
3138
|
0
|
|
|
|
|
|
my ( %data_set ); |
|
3139
|
0
|
|
|
|
|
|
my ( %mac_flows ); |
|
3140
|
0
|
|
|
|
|
|
my @directions = qw [ unknown Downstream Upstream ]; |
|
3141
|
|
|
|
|
|
|
|
|
3142
|
0
|
|
|
|
|
|
my $current_ubrs=$self->Router_Return_All(); |
|
3143
|
0
|
0
|
|
|
|
|
if ( scalar( keys %{$current_ubrs})==0 ) { return 0; } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
3144
|
|
|
|
|
|
|
|
|
3145
|
0
|
|
|
|
|
|
my $snmp_variables = Router::Statistics::OID->DOCSIS_packet_cable(); |
|
3146
|
|
|
|
|
|
|
|
|
3147
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
3148
|
|
|
|
|
|
|
{ |
|
3149
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
3150
|
0
|
|
|
|
|
|
my ($status_information) = $self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
3151
|
|
|
|
|
|
|
get_table( |
|
3152
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'docsQosParamSetServiceClassName'} ); |
|
3153
|
0
|
|
|
|
|
|
while(($foo, $bar) = each(%{$status_information})) |
|
|
0
|
|
|
|
|
|
|
|
3154
|
|
|
|
|
|
|
{ |
|
3155
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'docsQosParamSetServiceClassName'}.(\d+).(\d+).(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
3156
|
|
|
|
|
|
|
{ |
|
3157
|
0
|
|
|
|
|
|
$service_flows{'flow_name'}{$1}{$2}{$3}="$bar"; |
|
3158
|
|
|
|
|
|
|
} |
|
3159
|
0
|
|
|
|
|
|
delete ${$status_information}{$foo}; |
|
|
0
|
|
|
|
|
|
|
|
3160
|
|
|
|
|
|
|
} |
|
3161
|
|
|
|
|
|
|
} |
|
3162
|
|
|
|
|
|
|
|
|
3163
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
3164
|
|
|
|
|
|
|
{ |
|
3165
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
3166
|
0
|
|
|
|
|
|
my ($status_information) = $self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
3167
|
|
|
|
|
|
|
get_table( |
|
3168
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'docsQosParamSetMaxTrafficRate'} ); |
|
3169
|
0
|
|
|
|
|
|
while(($foo, $bar) = each(%{$status_information})) |
|
|
0
|
|
|
|
|
|
|
|
3170
|
|
|
|
|
|
|
{ |
|
3171
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'docsQosParamSetMaxTrafficRate'}.(\d+).(\d+).(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
3172
|
|
|
|
|
|
|
{ |
|
3173
|
0
|
|
|
|
|
|
$service_flows{'flow_speed'}{$1}{$2}{$3}="$bar"; |
|
3174
|
|
|
|
|
|
|
} |
|
3175
|
0
|
|
|
|
|
|
delete ${$status_information}{$foo}; |
|
|
0
|
|
|
|
|
|
|
|
3176
|
|
|
|
|
|
|
} |
|
3177
|
|
|
|
|
|
|
} |
|
3178
|
|
|
|
|
|
|
|
|
3179
|
|
|
|
|
|
|
|
|
3180
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
3181
|
|
|
|
|
|
|
{ |
|
3182
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
3183
|
0
|
|
|
|
|
|
my ($status_information) = $self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
3184
|
|
|
|
|
|
|
get_table( |
|
3185
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'docsQosParamSetSchedulingType'} ); |
|
3186
|
0
|
|
|
|
|
|
while(($foo, $bar) = each(%{$status_information})) |
|
|
0
|
|
|
|
|
|
|
|
3187
|
|
|
|
|
|
|
{ |
|
3188
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'docsQosParamSetSchedulingType'}.(\d+).(\d+).(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
3189
|
|
|
|
|
|
|
{ |
|
3190
|
0
|
|
|
|
|
|
$service_flows{'flow_direction'}{$1}{$2}{$3}="$bar"; |
|
3191
|
|
|
|
|
|
|
} |
|
3192
|
0
|
|
|
|
|
|
delete ${$status_information}{$foo}; |
|
|
0
|
|
|
|
|
|
|
|
3193
|
|
|
|
|
|
|
} |
|
3194
|
|
|
|
|
|
|
} |
|
3195
|
|
|
|
|
|
|
|
|
3196
|
|
|
|
|
|
|
|
|
3197
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
3198
|
|
|
|
|
|
|
{ |
|
3199
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
3200
|
0
|
|
|
|
|
|
my ($status_information) = $self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
3201
|
|
|
|
|
|
|
get_table( |
|
3202
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'docsIfCmtsCmStatusMacAddress'} ); |
|
3203
|
0
|
|
|
|
|
|
while(($foo, $bar) = each(%{$status_information})) |
|
|
0
|
|
|
|
|
|
|
|
3204
|
|
|
|
|
|
|
{ |
|
3205
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'docsIfCmtsCmStatusMacAddress'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
3206
|
|
|
|
|
|
|
{ |
|
3207
|
0
|
|
|
|
|
|
$data_set{$1}="$bar"; |
|
3208
|
|
|
|
|
|
|
} |
|
3209
|
0
|
|
|
|
|
|
delete ${$status_information}{$foo}; |
|
|
0
|
|
|
|
|
|
|
|
3210
|
|
|
|
|
|
|
} |
|
3211
|
|
|
|
|
|
|
} |
|
3212
|
|
|
|
|
|
|
|
|
3213
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
3214
|
|
|
|
|
|
|
{ |
|
3215
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
3216
|
0
|
|
|
|
|
|
my ($status_information) = $self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
3217
|
|
|
|
|
|
|
get_table( |
|
3218
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'docsQosCmtsIfIndex'} ); |
|
3219
|
0
|
|
|
|
|
|
while(($foo, $bar) = each(%{$status_information})) |
|
|
0
|
|
|
|
|
|
|
|
3220
|
|
|
|
|
|
|
{ |
|
3221
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'docsQosCmtsIfIndex'}.(\d+).(\d+).(\d+).(\d+).(\d+).(\d+).(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
3222
|
|
|
|
|
|
|
{ |
|
3223
|
0
|
|
|
|
|
|
my $mac=sprintf("%.2x-%.2x-%.2x-%.2x-%.2x-%.2x",$1,$2,$3,$4,$5,$6); |
|
3224
|
0
|
|
|
|
|
|
$mac=~tr/[a-z]/[A-Z]/; $mac_flows{$mac}{$7}=$bar; |
|
|
0
|
|
|
|
|
|
|
|
3225
|
|
|
|
|
|
|
} |
|
3226
|
0
|
|
|
|
|
|
delete ${$status_information}{$foo}; |
|
|
0
|
|
|
|
|
|
|
|
3227
|
|
|
|
|
|
|
} |
|
3228
|
|
|
|
|
|
|
} |
|
3229
|
|
|
|
|
|
|
|
|
3230
|
0
|
|
|
|
|
|
foreach my $real_mac ( keys %mac_flows ) |
|
3231
|
|
|
|
|
|
|
{ |
|
3232
|
0
|
|
|
|
|
|
foreach my $flows ( keys %{$mac_flows{$real_mac}} ) |
|
|
0
|
|
|
|
|
|
|
|
3233
|
|
|
|
|
|
|
{ |
|
3234
|
0
|
0
|
|
|
|
|
next if $service_flows{'flow_speed'}{ $mac_flows{$real_mac}{$flows} }{ $flows}{'1'}==0; |
|
3235
|
0
|
|
|
|
|
|
my $direction_d = $directions[ $service_flows{'flow_direction'}{ $mac_flows{$real_mac}{$flows} }{ $flows}{'1'}]; |
|
3236
|
0
|
|
|
|
|
|
my $direction = $service_flows{'flow_direction'}{ $mac_flows{$real_mac}{$flows} }{ $flows}{'1'}; |
|
3237
|
0
|
|
|
|
|
|
${$data}{$real_mac}{'direction'}{$direction_d} = $service_flows{'flow_speed'}{ $mac_flows{$real_mac}{$flows} }{ $flows}{$direction}; |
|
|
0
|
|
|
|
|
|
|
|
3238
|
0
|
|
|
|
|
|
${$data}{$real_mac}{'interface_index'} = $mac_flows{$real_mac}{$flows}; |
|
|
0
|
|
|
|
|
|
|
|
3239
|
0
|
|
|
|
|
|
${$data}{$real_mac}{'service_name'} = $service_flows{'flow_name'}{ $mac_flows{$real_mac}{$flows} }{ $flows} {'1'}; |
|
|
0
|
|
|
|
|
|
|
|
3240
|
0
|
|
|
|
|
|
delete $mac_flows{$real_mac}{$flows}; |
|
3241
|
|
|
|
|
|
|
} |
|
3242
|
|
|
|
|
|
|
} |
|
3243
|
|
|
|
|
|
|
|
|
3244
|
0
|
|
|
|
|
|
foreach my $real_mac ( keys %mac_flows ) |
|
3245
|
|
|
|
|
|
|
{ |
|
3246
|
0
|
0
|
|
|
|
|
if ( !${$data}{$real_mac}{'direction'}{'Upstream'} ) { ${$data}{$real_mac}{'direction'}{'Upstream'}=0; } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
3247
|
0
|
0
|
|
|
|
|
if ( !${$data}{$real_mac}{'direction'}{'Downstream'} ) { ${$data}{$real_mac}{'direction'}{'Downstream'}=0; } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
3248
|
|
|
|
|
|
|
} |
|
3249
|
|
|
|
|
|
|
|
|
3250
|
0
|
|
|
|
|
|
return 1; |
|
3251
|
|
|
|
|
|
|
} |
|
3252
|
|
|
|
|
|
|
|
|
3253
|
|
|
|
|
|
|
|
|
3254
|
|
|
|
|
|
|
sub UBR_get_CPE_information_Blocking |
|
3255
|
|
|
|
|
|
|
{ |
|
3256
|
|
|
|
|
|
|
|
|
3257
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
3258
|
0
|
|
|
|
|
|
my $data = shift; |
|
3259
|
0
|
|
|
|
|
|
my $data_selector = shift; |
|
3260
|
|
|
|
|
|
|
|
|
3261
|
0
|
|
|
|
|
|
my ( $foo, $bar ); |
|
3262
|
|
|
|
|
|
|
|
|
3263
|
|
|
|
|
|
|
#print "Data selector is '$data_selector'\n"; |
|
3264
|
|
|
|
|
|
|
|
|
3265
|
|
|
|
|
|
|
# Entry into the function is a point to a hash to store the data |
|
3266
|
|
|
|
|
|
|
# the result is a hash with the following |
|
3267
|
|
|
|
|
|
|
|
|
3268
|
0
|
|
|
|
|
|
my (%rev_data_pack); |
|
3269
|
0
|
|
|
|
|
|
my (%other_addresses); |
|
3270
|
|
|
|
|
|
|
|
|
3271
|
|
|
|
|
|
|
# This is where we get some information from the UBR about the CPEs connected |
|
3272
|
|
|
|
|
|
|
# This function should be modified so only the information needed is collected |
|
3273
|
|
|
|
|
|
|
# as you may not need it all, and on a busy UBR can take a while to return. |
|
3274
|
|
|
|
|
|
|
|
|
3275
|
|
|
|
|
|
|
# Cisco Bug 1 |
|
3276
|
|
|
|
|
|
|
|
|
3277
|
|
|
|
|
|
|
# When snmp ifIndexPersist is configured, changing out MC16Cs, with MC28Us ( |
|
3278
|
|
|
|
|
|
|
# or more than likely any other card ) causes some information to be |
|
3279
|
|
|
|
|
|
|
# inaccessable using a standard get_table, so you have to fudge your way |
|
3280
|
|
|
|
|
|
|
# around the MIB tree |
|
3281
|
|
|
|
|
|
|
|
|
3282
|
0
|
|
|
|
|
|
my ($check_loop); |
|
3283
|
|
|
|
|
|
|
|
|
3284
|
0
|
|
|
|
|
|
my $current_ubrs=$self->Router_Return_All(); |
|
3285
|
0
|
0
|
|
|
|
|
if ( scalar( keys %{$current_ubrs})==0 ) { return 0; } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
3286
|
|
|
|
|
|
|
|
|
3287
|
0
|
|
|
|
|
|
my $snmp_variables = Router::Statistics::OID->DOCSIS_populate_oid(); |
|
3288
|
|
|
|
|
|
|
|
|
3289
|
|
|
|
|
|
|
|
|
3290
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
3291
|
|
|
|
|
|
|
{ |
|
3292
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
3293
|
|
|
|
|
|
|
# for ($check_loop=0;$check_loop<2048;$check_loop++) |
|
3294
|
|
|
|
|
|
|
# { |
|
3295
|
|
|
|
|
|
|
# my $sider=${$snmp_variables}{'docsIfCmtsServiceCmStatusIndex'}.".".$check_loop; |
|
3296
|
0
|
|
|
|
|
|
my $sider=${$snmp_variables}{'docsIfCmtsServiceCmStatusIndex'}; |
|
|
0
|
|
|
|
|
|
|
|
3297
|
0
|
|
|
|
|
|
my ($status_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
3298
|
|
|
|
|
|
|
get_table( |
|
3299
|
|
|
|
|
|
|
-baseoid => $sider ); |
|
3300
|
0
|
|
|
|
|
|
while(($foo, $bar) = each(%{$status_information})) |
|
|
0
|
|
|
|
|
|
|
|
3301
|
|
|
|
|
|
|
{ |
|
3302
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'docsIfCmtsServiceCmStatusIndex'}.(\d+).(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
3303
|
|
|
|
|
|
|
{ |
|
3304
|
0
|
|
|
|
|
|
my $cmindexcode="$1:$2"; |
|
3305
|
0
|
|
|
|
|
|
$rev_data_pack{$ip_address}{$cmindexcode}=$bar; |
|
3306
|
0
|
|
|
|
|
|
delete ${$status_information}{$foo}; |
|
|
0
|
|
|
|
|
|
|
|
3307
|
|
|
|
|
|
|
} |
|
3308
|
|
|
|
|
|
|
} |
|
3309
|
|
|
|
|
|
|
# } |
|
3310
|
|
|
|
|
|
|
} |
|
3311
|
|
|
|
|
|
|
|
|
3312
|
|
|
|
|
|
|
|
|
3313
|
0
|
0
|
0
|
|
|
|
if ( $data_selector=~/CPEIP/i || $data_selector=~/ALL/i ) |
|
3314
|
|
|
|
|
|
|
{ |
|
3315
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
3316
|
|
|
|
|
|
|
{ |
|
3317
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
3318
|
0
|
|
|
|
|
|
my ($status_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
3319
|
|
|
|
|
|
|
get_table( |
|
3320
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'docsIfCmtsCmStatusIpAddress'} ); |
|
3321
|
0
|
|
|
|
|
|
while(($foo, $bar) = each(%{$status_information})) |
|
|
0
|
|
|
|
|
|
|
|
3322
|
|
|
|
|
|
|
{ |
|
3323
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'docsIfCmtsCmStatusIpAddress'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
3324
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'docsIfCmtsCmStatusIpAddress'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
3325
|
0
|
|
|
|
|
|
delete ${$status_information}{$foo}; |
|
|
0
|
|
|
|
|
|
|
|
3326
|
|
|
|
|
|
|
} |
|
3327
|
|
|
|
|
|
|
|
|
3328
|
|
|
|
|
|
|
} |
|
3329
|
|
|
|
|
|
|
} |
|
3330
|
|
|
|
|
|
|
|
|
3331
|
0
|
0
|
0
|
|
|
|
if ( $data_selector=~/USERIP/i || $data_selector=~/ALL/i ) |
|
3332
|
|
|
|
|
|
|
{ |
|
3333
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
3334
|
|
|
|
|
|
|
{ |
|
3335
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
3336
|
0
|
|
|
|
|
|
my ($status_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
3337
|
|
|
|
|
|
|
get_table( |
|
3338
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'cdxCmCpeIpAddress'} ); |
|
3339
|
0
|
|
|
|
|
|
while(($foo, $bar) = each(%{$status_information})) |
|
|
0
|
|
|
|
|
|
|
|
3340
|
|
|
|
|
|
|
{ |
|
3341
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'cdxCmCpeIpAddress'}.(\d+).(\d+).(\d+).(\d+).(\d+).(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
3342
|
|
|
|
|
|
|
{ |
|
3343
|
0
|
|
|
|
|
|
my $cmindexcode="$1:$2:$3:$4:$5:$6"; |
|
3344
|
0
|
|
|
|
|
|
$other_addresses{$cmindexcode}=$bar; |
|
3345
|
|
|
|
|
|
|
} |
|
3346
|
0
|
|
|
|
|
|
delete ${$status_information}{$foo}; |
|
|
0
|
|
|
|
|
|
|
|
3347
|
|
|
|
|
|
|
} |
|
3348
|
|
|
|
|
|
|
} |
|
3349
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
3350
|
|
|
|
|
|
|
{ |
|
3351
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
3352
|
0
|
|
|
|
|
|
my ($status_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
3353
|
|
|
|
|
|
|
get_table( |
|
3354
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'cdxCmCpeCmStatusIndex'} ); |
|
3355
|
0
|
|
|
|
|
|
while(($foo, $bar) = each(%{$status_information})) |
|
|
0
|
|
|
|
|
|
|
|
3356
|
|
|
|
|
|
|
{ |
|
3357
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'cdxCmCpeCmStatusIndex'}.(\d+).(\d+).(\d+).(\d+).(\d+).(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
3358
|
|
|
|
|
|
|
{ |
|
3359
|
0
|
|
|
|
|
|
my $cmindexcode="$1:$2:$3:$4:$5:$6"; |
|
3360
|
0
|
|
|
|
|
|
${$data}{$ip_address}{$bar}{'cdxCmCpeCmStatusIndex'}=$cmindexcode; |
|
|
0
|
|
|
|
|
|
|
|
3361
|
|
|
|
|
|
|
} |
|
3362
|
0
|
|
|
|
|
|
delete ${$status_information}{$foo}; |
|
|
0
|
|
|
|
|
|
|
|
3363
|
|
|
|
|
|
|
} |
|
3364
|
|
|
|
|
|
|
} |
|
3365
|
|
|
|
|
|
|
} |
|
3366
|
|
|
|
|
|
|
|
|
3367
|
|
|
|
|
|
|
|
|
3368
|
0
|
0
|
0
|
|
|
|
if ( $data_selector=~/IFINDEX/i || $data_selector=~/ALL/i ) |
|
3369
|
|
|
|
|
|
|
{ |
|
3370
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
3371
|
|
|
|
|
|
|
{ |
|
3372
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
3373
|
0
|
|
|
|
|
|
my ($status_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
3374
|
0
|
|
|
|
|
|
get_table( -baseoid => ${$snmp_variables}{'docsIfCmtsCmStatusUpChannelIfIndex'} ); |
|
3375
|
0
|
|
|
|
|
|
while(($foo, $bar) = each(%{$status_information})) |
|
|
0
|
|
|
|
|
|
|
|
3376
|
|
|
|
|
|
|
{ |
|
3377
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'docsIfCmtsCmStatusUpChannelIfIndex'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
3378
|
|
|
|
|
|
|
{ |
|
3379
|
0
|
|
|
|
|
|
${$data}{$ip_address}{$1}{'docsIfCmtsCmStatusUpChannelIfIndex'}=$bar; |
|
|
0
|
|
|
|
|
|
|
|
3380
|
|
|
|
|
|
|
} |
|
3381
|
0
|
|
|
|
|
|
delete ${$status_information}{$foo}; |
|
|
0
|
|
|
|
|
|
|
|
3382
|
|
|
|
|
|
|
} |
|
3383
|
|
|
|
|
|
|
} |
|
3384
|
|
|
|
|
|
|
} |
|
3385
|
|
|
|
|
|
|
|
|
3386
|
0
|
0
|
0
|
|
|
|
if ( $data_selector=~/QOSPROFILE/i || $data_selector=~/ALL/i ) |
|
3387
|
|
|
|
|
|
|
{ |
|
3388
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
3389
|
|
|
|
|
|
|
{ |
|
3390
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
3391
|
|
|
|
|
|
|
# for ($check_loop=0;$check_loop<2048;$check_loop++) |
|
3392
|
|
|
|
|
|
|
# { |
|
3393
|
|
|
|
|
|
|
# my $sider=${$snmp_variables}{'docsIfCmtsServiceQosProfile'}.".".$check_loop; |
|
3394
|
0
|
|
|
|
|
|
my $sider=${$snmp_variables}{'docsIfCmtsServiceQosProfile'}; |
|
|
0
|
|
|
|
|
|
|
|
3395
|
0
|
|
|
|
|
|
my ($status_information) = $self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
3396
|
|
|
|
|
|
|
get_table( |
|
3397
|
|
|
|
|
|
|
-baseoid => $sider ); |
|
3398
|
0
|
|
|
|
|
|
while(($foo, $bar) = each(%{$status_information})) |
|
|
0
|
|
|
|
|
|
|
|
3399
|
|
|
|
|
|
|
{ |
|
3400
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'docsIfCmtsServiceQosProfile'}.(\d+).(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
3401
|
|
|
|
|
|
|
{ |
|
3402
|
0
|
|
|
|
|
|
my $cmindexcode="$1:$2"; |
|
3403
|
0
|
|
|
|
|
|
$cmindexcode=$rev_data_pack{$ip_address}{$cmindexcode}; |
|
3404
|
0
|
|
|
|
|
|
${$data}{$ip_address}{$cmindexcode}{'docsIfCmtsServiceQosProfile'}=$bar; |
|
|
0
|
|
|
|
|
|
|
|
3405
|
|
|
|
|
|
|
} |
|
3406
|
0
|
|
|
|
|
|
delete ${$status_information}{$foo}; |
|
|
0
|
|
|
|
|
|
|
|
3407
|
|
|
|
|
|
|
} |
|
3408
|
|
|
|
|
|
|
# } |
|
3409
|
|
|
|
|
|
|
} |
|
3410
|
|
|
|
|
|
|
} |
|
3411
|
|
|
|
|
|
|
|
|
3412
|
0
|
0
|
0
|
|
|
|
if ( $data_selector=~/INOCTETS/i || $data_selector=~/ALL/i ) |
|
3413
|
|
|
|
|
|
|
{ |
|
3414
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
3415
|
|
|
|
|
|
|
{ |
|
3416
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
3417
|
|
|
|
|
|
|
# for ($check_loop=0;$check_loop<100;$check_loop++) |
|
3418
|
|
|
|
|
|
|
# { |
|
3419
|
|
|
|
|
|
|
# my $sider=${$snmp_variables}{'docsIfCmtsServiceInOctets'}.".".$check_loop; |
|
3420
|
0
|
|
|
|
|
|
my $sider=${$snmp_variables}{'docsIfCmtsServiceInOctets'}; |
|
|
0
|
|
|
|
|
|
|
|
3421
|
0
|
|
|
|
|
|
my ($status_information) = $self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
3422
|
|
|
|
|
|
|
get_table( |
|
3423
|
|
|
|
|
|
|
-baseoid => $sider ); |
|
3424
|
0
|
|
|
|
|
|
while(($foo, $bar) = each(%{$status_information})) |
|
|
0
|
|
|
|
|
|
|
|
3425
|
|
|
|
|
|
|
{ |
|
3426
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'docsIfCmtsServiceInOctets'}.(\d+).(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
3427
|
|
|
|
|
|
|
{ |
|
3428
|
0
|
|
|
|
|
|
my $cmindexcode="$1:$2"; |
|
3429
|
0
|
|
|
|
|
|
$cmindexcode=$rev_data_pack{$ip_address}{$cmindexcode}; |
|
3430
|
0
|
|
|
|
|
|
${$data}{$ip_address}{$cmindexcode}{'docsIfCmtsServiceInOctets'}=$bar; |
|
|
0
|
|
|
|
|
|
|
|
3431
|
|
|
|
|
|
|
} |
|
3432
|
0
|
|
|
|
|
|
delete ${$status_information}{$foo}; |
|
|
0
|
|
|
|
|
|
|
|
3433
|
|
|
|
|
|
|
} |
|
3434
|
|
|
|
|
|
|
# } |
|
3435
|
|
|
|
|
|
|
} |
|
3436
|
|
|
|
|
|
|
} |
|
3437
|
|
|
|
|
|
|
|
|
3438
|
0
|
0
|
0
|
|
|
|
if ( $data_selector=~/INPACKETS/i || $data_selector=~/ALL/i ) |
|
3439
|
|
|
|
|
|
|
{ |
|
3440
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
3441
|
|
|
|
|
|
|
{ |
|
3442
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
3443
|
|
|
|
|
|
|
# for ($check_loop=0;$check_loop<100;$check_loop++) |
|
3444
|
|
|
|
|
|
|
# { |
|
3445
|
|
|
|
|
|
|
# my $sider=${$snmp_variables}{'docsIfCmtsServiceInPackets'}.".".$check_loop; |
|
3446
|
0
|
|
|
|
|
|
my $sider=${$snmp_variables}{'docsIfCmtsServiceInPackets'}; |
|
|
0
|
|
|
|
|
|
|
|
3447
|
0
|
|
|
|
|
|
my ($status_information) = $self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
3448
|
|
|
|
|
|
|
get_table( |
|
3449
|
|
|
|
|
|
|
-baseoid => $sider ); |
|
3450
|
0
|
|
|
|
|
|
while(($foo, $bar) = each(%{$status_information})) |
|
|
0
|
|
|
|
|
|
|
|
3451
|
|
|
|
|
|
|
{ |
|
3452
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'docsIfCmtsServiceInPackets'}.(\d+).(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
3453
|
|
|
|
|
|
|
{ |
|
3454
|
0
|
|
|
|
|
|
my $cmindexcode="$1:$2"; |
|
3455
|
0
|
|
|
|
|
|
$cmindexcode=$rev_data_pack{$ip_address}{$cmindexcode}; |
|
3456
|
0
|
|
|
|
|
|
${$data}{$ip_address}{$cmindexcode}{'docsIfCmtsServiceInPackets'}=$bar; |
|
|
0
|
|
|
|
|
|
|
|
3457
|
|
|
|
|
|
|
} |
|
3458
|
0
|
|
|
|
|
|
delete ${$status_information}{$foo}; |
|
|
0
|
|
|
|
|
|
|
|
3459
|
|
|
|
|
|
|
} |
|
3460
|
|
|
|
|
|
|
# } |
|
3461
|
|
|
|
|
|
|
} |
|
3462
|
|
|
|
|
|
|
} |
|
3463
|
|
|
|
|
|
|
|
|
3464
|
|
|
|
|
|
|
|
|
3465
|
0
|
0
|
0
|
|
|
|
if ( $data_selector=~/OUTOCTETS/i || $data_selector=~/ALL/i ) |
|
3466
|
|
|
|
|
|
|
{ |
|
3467
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
3468
|
|
|
|
|
|
|
{ |
|
3469
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
3470
|
|
|
|
|
|
|
# for ($check_loop=0;$check_loop<100;$check_loop++) |
|
3471
|
|
|
|
|
|
|
# { |
|
3472
|
|
|
|
|
|
|
# my $sider=${$snmp_variables}{'cdxIfCmtsServiceOutOctets'}.".".$check_loop; |
|
3473
|
0
|
|
|
|
|
|
my $sider=${$snmp_variables}{'cdxIfCmtsServiceOutOctets'}; |
|
|
0
|
|
|
|
|
|
|
|
3474
|
0
|
|
|
|
|
|
my ($status_information) = $self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
3475
|
|
|
|
|
|
|
get_table( |
|
3476
|
|
|
|
|
|
|
-baseoid => $sider ); |
|
3477
|
0
|
|
|
|
|
|
while(($foo, $bar) = each(%{$status_information})) |
|
|
0
|
|
|
|
|
|
|
|
3478
|
|
|
|
|
|
|
{ |
|
3479
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'cdxIfCmtsServiceOutOctets'}.(\d+).(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
3480
|
|
|
|
|
|
|
{ |
|
3481
|
0
|
|
|
|
|
|
my $cmindexcode="$1:$2"; |
|
3482
|
0
|
|
|
|
|
|
$cmindexcode=$rev_data_pack{$ip_address}{$cmindexcode}; |
|
3483
|
0
|
|
|
|
|
|
${$data}{$ip_address}{$cmindexcode}{'cdxIfCmtsServiceOutOctets'}=$bar; |
|
|
0
|
|
|
|
|
|
|
|
3484
|
|
|
|
|
|
|
} |
|
3485
|
0
|
|
|
|
|
|
delete ${$status_information}{$foo}; |
|
|
0
|
|
|
|
|
|
|
|
3486
|
|
|
|
|
|
|
} |
|
3487
|
|
|
|
|
|
|
# } |
|
3488
|
|
|
|
|
|
|
} |
|
3489
|
|
|
|
|
|
|
} |
|
3490
|
|
|
|
|
|
|
|
|
3491
|
0
|
0
|
0
|
|
|
|
if ( $data_selector=~/OUTPACKETS/i || $data_selector=~/ALL/i ) |
|
3492
|
|
|
|
|
|
|
{ |
|
3493
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
3494
|
|
|
|
|
|
|
{ |
|
3495
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
3496
|
|
|
|
|
|
|
# for ($check_loop=0;$check_loop<100;$check_loop++) |
|
3497
|
|
|
|
|
|
|
# { |
|
3498
|
|
|
|
|
|
|
# my $sider=${$snmp_variables}{'cdxIfCmtsServiceOutPackets'}.".".$check_loop; |
|
3499
|
0
|
|
|
|
|
|
my $sider=${$snmp_variables}{'cdxIfCmtsServiceOutPackets'}; |
|
|
0
|
|
|
|
|
|
|
|
3500
|
0
|
|
|
|
|
|
my ($status_information) = $self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
3501
|
|
|
|
|
|
|
get_table( |
|
3502
|
|
|
|
|
|
|
-baseoid => $sider ); |
|
3503
|
0
|
|
|
|
|
|
while(($foo, $bar) = each(%{$status_information})) |
|
|
0
|
|
|
|
|
|
|
|
3504
|
|
|
|
|
|
|
{ |
|
3505
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'cdxIfCmtsServiceOutPackets'}.(\d+).(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
3506
|
|
|
|
|
|
|
{ |
|
3507
|
0
|
|
|
|
|
|
my $cmindexcode="$1:$2"; |
|
3508
|
0
|
|
|
|
|
|
$cmindexcode=$rev_data_pack{$ip_address}{$cmindexcode}; |
|
3509
|
0
|
|
|
|
|
|
${$data}{$ip_address}{$cmindexcode}{'cdxIfCmtsServiceOutPackets'}=$bar; |
|
|
0
|
|
|
|
|
|
|
|
3510
|
|
|
|
|
|
|
} |
|
3511
|
0
|
|
|
|
|
|
delete ${$status_information}{$foo}; |
|
|
0
|
|
|
|
|
|
|
|
3512
|
|
|
|
|
|
|
} |
|
3513
|
|
|
|
|
|
|
# } |
|
3514
|
|
|
|
|
|
|
} |
|
3515
|
|
|
|
|
|
|
} |
|
3516
|
|
|
|
|
|
|
|
|
3517
|
0
|
0
|
0
|
|
|
|
if ( $data_selector=~/CPEMAC/i || $data_selector=~/ALL/i ) |
|
3518
|
|
|
|
|
|
|
{ |
|
3519
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
3520
|
|
|
|
|
|
|
{ |
|
3521
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
3522
|
0
|
|
|
|
|
|
my ($status_information) = $self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
3523
|
|
|
|
|
|
|
get_table( |
|
3524
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'docsIfCmtsCmStatusMacAddress'} ); |
|
3525
|
0
|
|
|
|
|
|
while(($foo, $bar) = each(%{$status_information})) |
|
|
0
|
|
|
|
|
|
|
|
3526
|
|
|
|
|
|
|
{ |
|
3527
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'docsIfCmtsCmStatusMacAddress'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
3528
|
|
|
|
|
|
|
{ |
|
3529
|
0
|
|
|
|
|
|
${$data}{$ip_address}{$1}{'docsIfCmtsCmStatusMacAddress'}=_convert_mac_address($bar); |
|
|
0
|
|
|
|
|
|
|
|
3530
|
|
|
|
|
|
|
} |
|
3531
|
0
|
|
|
|
|
|
delete ${$status_information}{$foo}; |
|
|
0
|
|
|
|
|
|
|
|
3532
|
|
|
|
|
|
|
} |
|
3533
|
|
|
|
|
|
|
} |
|
3534
|
|
|
|
|
|
|
} |
|
3535
|
|
|
|
|
|
|
|
|
3536
|
0
|
0
|
0
|
|
|
|
if ( $data_selector=~/STATUS/i || $data_selector=~/ALL/i ) |
|
3537
|
|
|
|
|
|
|
{ |
|
3538
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
3539
|
|
|
|
|
|
|
{ |
|
3540
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
3541
|
0
|
|
|
|
|
|
my ($status_information) = $self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
3542
|
|
|
|
|
|
|
get_table( |
|
3543
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'docsIfCmtsCmStatusValue'} ); |
|
3544
|
0
|
|
|
|
|
|
while(($foo, $bar) = each(%{$status_information})) |
|
|
0
|
|
|
|
|
|
|
|
3545
|
|
|
|
|
|
|
{ |
|
3546
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'docsIfCmtsCmStatusValue'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
3547
|
|
|
|
|
|
|
{ |
|
3548
|
0
|
|
|
|
|
|
${$data}{$ip_address}{$1}{'docsIfCmtsCmStatusValue'}= |
|
|
0
|
|
|
|
|
|
|
|
3549
|
|
|
|
|
|
|
( |
|
3550
|
|
|
|
|
|
|
'0_Unknown', |
|
3551
|
|
|
|
|
|
|
'1_other', |
|
3552
|
|
|
|
|
|
|
'2_ranging', |
|
3553
|
|
|
|
|
|
|
'3_rangingAborted', |
|
3554
|
|
|
|
|
|
|
'4_rangingComplete', |
|
3555
|
|
|
|
|
|
|
'5_ipComplete', |
|
3556
|
|
|
|
|
|
|
'6_registrationComplete', |
|
3557
|
|
|
|
|
|
|
'7_accessDenied', |
|
3558
|
|
|
|
|
|
|
'8_operational (older IOS)', |
|
3559
|
|
|
|
|
|
|
'9_registeredBPIInitializing') |
|
3560
|
|
|
|
|
|
|
[$bar]; |
|
3561
|
|
|
|
|
|
|
} |
|
3562
|
0
|
|
|
|
|
|
delete ${$status_information}{$foo}; |
|
|
0
|
|
|
|
|
|
|
|
3563
|
|
|
|
|
|
|
} |
|
3564
|
|
|
|
|
|
|
} |
|
3565
|
|
|
|
|
|
|
} |
|
3566
|
0
|
|
|
|
|
|
return 1; |
|
3567
|
|
|
|
|
|
|
} |
|
3568
|
|
|
|
|
|
|
|
|
3569
|
|
|
|
|
|
|
|
|
3570
|
|
|
|
|
|
|
sub UBR_get_CPE_information |
|
3571
|
|
|
|
|
|
|
{ |
|
3572
|
|
|
|
|
|
|
|
|
3573
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
3574
|
0
|
|
|
|
|
|
my $data = shift; |
|
3575
|
0
|
|
|
|
|
|
my $data_selector = shift; |
|
3576
|
|
|
|
|
|
|
|
|
3577
|
|
|
|
|
|
|
# Entry into the function is a point to a hash to store the data |
|
3578
|
|
|
|
|
|
|
# the result is a hash with the following |
|
3579
|
|
|
|
|
|
|
|
|
3580
|
0
|
|
|
|
|
|
my ($foo, $bar ); |
|
3581
|
0
|
|
|
|
|
|
my (%rev_data_pack); |
|
3582
|
0
|
|
|
|
|
|
my (%other_addresses); |
|
3583
|
|
|
|
|
|
|
|
|
3584
|
|
|
|
|
|
|
# This is where we get some information from the UBR about the CPEs connected |
|
3585
|
|
|
|
|
|
|
# This function should be modified so only the information needed is collected |
|
3586
|
|
|
|
|
|
|
# as you may not need it all, and on a busy UBR can take a while to return. |
|
3587
|
|
|
|
|
|
|
|
|
3588
|
|
|
|
|
|
|
# Cisco Bug 1 |
|
3589
|
|
|
|
|
|
|
|
|
3590
|
|
|
|
|
|
|
# When snmp ifIndexPersist is configured, changing out MC16Cs, with MC28Us ( |
|
3591
|
|
|
|
|
|
|
# or more than likely any other card ) causes some information to be |
|
3592
|
|
|
|
|
|
|
# inaccessable using a standard get_table, so you have to fudge your way |
|
3593
|
|
|
|
|
|
|
# around the MIB tree |
|
3594
|
|
|
|
|
|
|
|
|
3595
|
0
|
|
|
|
|
|
my ($check_loop); |
|
3596
|
|
|
|
|
|
|
|
|
3597
|
0
|
|
|
|
|
|
my $current_ubrs=$self->Router_Return_All(); |
|
3598
|
0
|
0
|
|
|
|
|
if ( scalar( keys %{$current_ubrs})==0 ) { return 0; } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
3599
|
|
|
|
|
|
|
|
|
3600
|
0
|
|
|
|
|
|
my $snmp_variables = Router::Statistics::OID->DOCSIS_populate_oid(); |
|
3601
|
|
|
|
|
|
|
|
|
3602
|
|
|
|
|
|
|
|
|
3603
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
3604
|
|
|
|
|
|
|
{ |
|
3605
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
3606
|
|
|
|
|
|
|
# for ($check_loop=0;$check_loop<100;$check_loop++) |
|
3607
|
|
|
|
|
|
|
# { |
|
3608
|
|
|
|
|
|
|
# my $sider=${$snmp_variables}{'docsIfCmtsServiceCmStatusIndex'}.".".$check_loop; |
|
3609
|
0
|
|
|
|
|
|
my $sider=${$snmp_variables}{'docsIfCmtsServiceCmStatusIndex'}; |
|
|
0
|
|
|
|
|
|
|
|
3610
|
0
|
|
|
|
|
|
my ($status_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
3611
|
|
|
|
|
|
|
get_table( |
|
3612
|
|
|
|
|
|
|
-callback => [ \&validate_two_rev, \%rev_data_pack, $ip_address, $snmp_variables ], |
|
3613
|
|
|
|
|
|
|
-baseoid => $sider ); |
|
3614
|
|
|
|
|
|
|
# } |
|
3615
|
|
|
|
|
|
|
} |
|
3616
|
0
|
|
|
|
|
|
snmp_dispatcher(); |
|
3617
|
|
|
|
|
|
|
|
|
3618
|
0
|
0
|
0
|
|
|
|
if ( $data_selector=~/CPEIP/i || $data_selector=~/ALL/i ) |
|
3619
|
|
|
|
|
|
|
{ |
|
3620
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
3621
|
|
|
|
|
|
|
{ |
|
3622
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
3623
|
0
|
|
|
|
|
|
my ($status_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
3624
|
|
|
|
|
|
|
get_table( |
|
3625
|
|
|
|
|
|
|
-callback => [ \&validate_one, $data, $ip_address, $snmp_variables ], |
|
3626
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'docsIfCmtsCmStatusIpAddress'} ); |
|
3627
|
|
|
|
|
|
|
} |
|
3628
|
0
|
|
|
|
|
|
snmp_dispatcher(); |
|
3629
|
|
|
|
|
|
|
} |
|
3630
|
|
|
|
|
|
|
|
|
3631
|
0
|
0
|
0
|
|
|
|
if ( $data_selector=~/USERIP/i || $data_selector=~/ALL/i ) |
|
3632
|
|
|
|
|
|
|
{ |
|
3633
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
3634
|
|
|
|
|
|
|
{ |
|
3635
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
3636
|
0
|
|
|
|
|
|
my ($status_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
3637
|
|
|
|
|
|
|
get_table( |
|
3638
|
|
|
|
|
|
|
-callback => [ \&validate_two, \%other_addresses, $ip_address, $snmp_variables ], |
|
3639
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'cdxCmCpeIpAddress'} ); |
|
3640
|
|
|
|
|
|
|
} |
|
3641
|
0
|
|
|
|
|
|
snmp_dispatcher(); |
|
3642
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
3643
|
|
|
|
|
|
|
{ |
|
3644
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
3645
|
0
|
|
|
|
|
|
my ($status_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
3646
|
|
|
|
|
|
|
get_table( |
|
3647
|
|
|
|
|
|
|
-callback => [ \&validate_two, $data, $ip_address,$snmp_variables ], |
|
3648
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'cdxCmCpeCmStatusIndex'} ); |
|
3649
|
|
|
|
|
|
|
} |
|
3650
|
0
|
|
|
|
|
|
snmp_dispatcher(); |
|
3651
|
0
|
|
|
|
|
|
foreach my $cpe ( keys %{$data} ) { chop ( ${$data}{$cpe}->{'cdxCmCpeIpAddress'} ); } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
3652
|
|
|
|
|
|
|
} |
|
3653
|
|
|
|
|
|
|
|
|
3654
|
0
|
0
|
0
|
|
|
|
if ( $data_selector=~/IFINDEX/i || $data_selector=~/ALL/i ) |
|
3655
|
|
|
|
|
|
|
{ |
|
3656
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
3657
|
|
|
|
|
|
|
{ |
|
3658
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
3659
|
0
|
|
|
|
|
|
my ($status_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
3660
|
|
|
|
|
|
|
get_table( |
|
3661
|
|
|
|
|
|
|
-callback => [ \&validate_one, $data, $ip_address, $snmp_variables ], |
|
3662
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'docsIfCmtsCmStatusUpChannelIfIndex'} ); |
|
3663
|
|
|
|
|
|
|
} |
|
3664
|
0
|
|
|
|
|
|
snmp_dispatcher(); |
|
3665
|
|
|
|
|
|
|
} |
|
3666
|
|
|
|
|
|
|
|
|
3667
|
0
|
0
|
0
|
|
|
|
if ( $data_selector=~/QOSPROFILE/i || $data_selector=~/ALL/i ) |
|
3668
|
|
|
|
|
|
|
{ |
|
3669
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
3670
|
|
|
|
|
|
|
{ |
|
3671
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
3672
|
|
|
|
|
|
|
# for ($check_loop=0;$check_loop<50;$check_loop++) |
|
3673
|
|
|
|
|
|
|
# { |
|
3674
|
|
|
|
|
|
|
# my $sider=${$snmp_variables}{'docsIfCmtsServiceQosProfile'}.".".$check_loop; |
|
3675
|
0
|
|
|
|
|
|
my $sider=${$snmp_variables}{'docsIfCmtsServiceQosProfile'}; |
|
|
0
|
|
|
|
|
|
|
|
3676
|
0
|
|
|
|
|
|
my ($status_information) = $self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
3677
|
|
|
|
|
|
|
get_table( |
|
3678
|
|
|
|
|
|
|
-callback => [ \&validate_two_special, $data, $ip_address, $snmp_variables, \%rev_data_pack ], |
|
3679
|
|
|
|
|
|
|
-baseoid => $sider ); |
|
3680
|
|
|
|
|
|
|
# } |
|
3681
|
|
|
|
|
|
|
} |
|
3682
|
0
|
|
|
|
|
|
snmp_dispatcher(); |
|
3683
|
|
|
|
|
|
|
} |
|
3684
|
|
|
|
|
|
|
|
|
3685
|
0
|
0
|
0
|
|
|
|
if ( $data_selector=~/INOCTETS/i || $data_selector=~/ALL/i ) |
|
3686
|
|
|
|
|
|
|
{ |
|
3687
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
3688
|
|
|
|
|
|
|
{ |
|
3689
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
3690
|
|
|
|
|
|
|
# for ($check_loop=0;$check_loop<100;$check_loop++) |
|
3691
|
|
|
|
|
|
|
# { |
|
3692
|
|
|
|
|
|
|
# my $sider=${$snmp_variables}{'docsIfCmtsServiceInOctets'}.".".$check_loop; |
|
3693
|
0
|
|
|
|
|
|
my $sider=${$snmp_variables}{'docsIfCmtsServiceInOctets'}; |
|
|
0
|
|
|
|
|
|
|
|
3694
|
0
|
|
|
|
|
|
my ($status_information) = $self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
3695
|
|
|
|
|
|
|
get_table( |
|
3696
|
|
|
|
|
|
|
-callback => [ \&validate_two_special, $data, $ip_address, $snmp_variables, \%rev_data_pack ], |
|
3697
|
|
|
|
|
|
|
-baseoid => $sider ); |
|
3698
|
|
|
|
|
|
|
# } |
|
3699
|
|
|
|
|
|
|
} |
|
3700
|
0
|
|
|
|
|
|
snmp_dispatcher(); |
|
3701
|
|
|
|
|
|
|
} |
|
3702
|
|
|
|
|
|
|
|
|
3703
|
0
|
0
|
0
|
|
|
|
if ( $data_selector=~/INPACKETS/i || $data_selector=~/ALL/i ) |
|
3704
|
|
|
|
|
|
|
{ |
|
3705
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
3706
|
|
|
|
|
|
|
{ |
|
3707
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
3708
|
|
|
|
|
|
|
# for ($check_loop=0;$check_loop<100;$check_loop++) |
|
3709
|
|
|
|
|
|
|
# { |
|
3710
|
|
|
|
|
|
|
# my $sider=${$snmp_variables}{'docsIfCmtsServiceInPackets'}.".".$check_loop; |
|
3711
|
0
|
|
|
|
|
|
my $sider=${$snmp_variables}{'docsIfCmtsServiceInPackets'}; |
|
|
0
|
|
|
|
|
|
|
|
3712
|
0
|
|
|
|
|
|
my ($status_information) = $self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
3713
|
|
|
|
|
|
|
get_table( |
|
3714
|
|
|
|
|
|
|
-callback => [ \&validate_two_special, $data, $ip_address, $snmp_variables, \%rev_data_pack ], |
|
3715
|
|
|
|
|
|
|
-baseoid => $sider ); |
|
3716
|
|
|
|
|
|
|
# } |
|
3717
|
|
|
|
|
|
|
} |
|
3718
|
0
|
|
|
|
|
|
snmp_dispatcher(); |
|
3719
|
|
|
|
|
|
|
} |
|
3720
|
|
|
|
|
|
|
|
|
3721
|
0
|
0
|
0
|
|
|
|
if ( $data_selector=~/OUTOCTETS/i || $data_selector=~/ALL/i ) |
|
3722
|
|
|
|
|
|
|
{ |
|
3723
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
3724
|
|
|
|
|
|
|
{ |
|
3725
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
3726
|
|
|
|
|
|
|
# for ($check_loop=0;$check_loop<100;$check_loop++) |
|
3727
|
|
|
|
|
|
|
# { |
|
3728
|
|
|
|
|
|
|
# my $sider=${$snmp_variables}{'cdxIfCmtsServiceOutOctets'}.".".$check_loop; |
|
3729
|
0
|
|
|
|
|
|
my $sider=${$snmp_variables}{'cdxIfCmtsServiceOutOctets'}; |
|
|
0
|
|
|
|
|
|
|
|
3730
|
0
|
|
|
|
|
|
my ($status_information) = $self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
3731
|
|
|
|
|
|
|
get_table( |
|
3732
|
|
|
|
|
|
|
-callback => [ \&validate_two_special, $data, $ip_address, $snmp_variables, \%rev_data_pack ], |
|
3733
|
|
|
|
|
|
|
-baseoid => $sider ); |
|
3734
|
|
|
|
|
|
|
# } |
|
3735
|
|
|
|
|
|
|
} |
|
3736
|
0
|
|
|
|
|
|
snmp_dispatcher(); |
|
3737
|
|
|
|
|
|
|
} |
|
3738
|
|
|
|
|
|
|
|
|
3739
|
0
|
0
|
0
|
|
|
|
if ( $data_selector=~/OUTPACKETS/i || $data_selector=~/ALL/i ) |
|
3740
|
|
|
|
|
|
|
{ |
|
3741
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
3742
|
|
|
|
|
|
|
{ |
|
3743
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
3744
|
|
|
|
|
|
|
# for ($check_loop=0;$check_loop<100;$check_loop++) |
|
3745
|
|
|
|
|
|
|
# { |
|
3746
|
|
|
|
|
|
|
# my $sider=${$snmp_variables}{'cdxIfCmtsServiceOutPackets'}.".".$check_loop; |
|
3747
|
0
|
|
|
|
|
|
my $sider=${$snmp_variables}{'cdxIfCmtsServiceOutPackets'}; |
|
|
0
|
|
|
|
|
|
|
|
3748
|
0
|
|
|
|
|
|
my ($status_information) = $self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
3749
|
|
|
|
|
|
|
get_table( |
|
3750
|
|
|
|
|
|
|
-callback => [ \&validate_two_special, $data, $ip_address, $snmp_variables, \%rev_data_pack ], |
|
3751
|
|
|
|
|
|
|
-baseoid => $sider ); |
|
3752
|
|
|
|
|
|
|
# } |
|
3753
|
|
|
|
|
|
|
} |
|
3754
|
0
|
|
|
|
|
|
snmp_dispatcher(); |
|
3755
|
|
|
|
|
|
|
} |
|
3756
|
|
|
|
|
|
|
|
|
3757
|
0
|
0
|
0
|
|
|
|
if ( $data_selector=~/CPEMAC/i || $data_selector=~/ALL/i ) |
|
3758
|
|
|
|
|
|
|
{ |
|
3759
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
3760
|
|
|
|
|
|
|
{ |
|
3761
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
3762
|
0
|
|
|
|
|
|
my ($status_information) = $self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
3763
|
|
|
|
|
|
|
get_table( |
|
3764
|
|
|
|
|
|
|
-callback => [ \&validate_one, $data, $ip_address, $snmp_variables ], |
|
3765
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'docsIfCmtsCmStatusMacAddress'} ); |
|
3766
|
|
|
|
|
|
|
} |
|
3767
|
0
|
|
|
|
|
|
snmp_dispatcher(); |
|
3768
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
3769
|
|
|
|
|
|
|
{ |
|
3770
|
0
|
|
|
|
|
|
foreach my $cpe ( keys %{${$data}{$ip_address}} ) |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
3771
|
|
|
|
|
|
|
{ |
|
3772
|
0
|
|
|
|
|
|
${$data}{$ip_address}{$cpe}{'docsIfCmtsCmStatusMacAddress'}= |
|
|
0
|
|
|
|
|
|
|
|
3773
|
0
|
|
|
|
|
|
_convert_mac_address( ${$data}{$ip_address}{$cpe}{'docsIfCmtsCmStatusMacAddress'} ); |
|
3774
|
|
|
|
|
|
|
} |
|
3775
|
|
|
|
|
|
|
} |
|
3776
|
|
|
|
|
|
|
} |
|
3777
|
|
|
|
|
|
|
|
|
3778
|
0
|
0
|
0
|
|
|
|
if ( $data_selector=~/STATUS/i || $data_selector=~/ALL/i ) |
|
3779
|
|
|
|
|
|
|
{ |
|
3780
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
3781
|
|
|
|
|
|
|
{ |
|
3782
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
3783
|
0
|
|
|
|
|
|
my ($status_information) = $self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
3784
|
|
|
|
|
|
|
get_table( |
|
3785
|
|
|
|
|
|
|
-callback => [ \&validate_one, $data, $ip_address, $snmp_variables ], |
|
3786
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'docsIfCmtsCmStatusValue'} ); |
|
3787
|
|
|
|
|
|
|
} |
|
3788
|
0
|
|
|
|
|
|
snmp_dispatcher(); |
|
3789
|
|
|
|
|
|
|
|
|
3790
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
3791
|
|
|
|
|
|
|
{ |
|
3792
|
0
|
|
|
|
|
|
foreach my $cpe ( keys %{${$data}{$ip_address}} ) |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
3793
|
|
|
|
|
|
|
{ |
|
3794
|
0
|
|
|
|
|
|
${$data}{$ip_address}{$cpe}{'docsIfCmtsCmStatusValue'}= |
|
|
0
|
|
|
|
|
|
|
|
3795
|
|
|
|
|
|
|
( |
|
3796
|
|
|
|
|
|
|
'0_Unknown', |
|
3797
|
|
|
|
|
|
|
'1_other', |
|
3798
|
|
|
|
|
|
|
'2_ranging', |
|
3799
|
|
|
|
|
|
|
'3_rangingAborted', |
|
3800
|
|
|
|
|
|
|
'4_rangingComplete', |
|
3801
|
|
|
|
|
|
|
'5_ipComplete', |
|
3802
|
|
|
|
|
|
|
'6_registrationComplete', |
|
3803
|
|
|
|
|
|
|
'7_accessDenied', |
|
3804
|
|
|
|
|
|
|
'8_operational (older IOS)', |
|
3805
|
|
|
|
|
|
|
'9_registeredBPIInitializing') |
|
3806
|
0
|
|
|
|
|
|
[${$data}{$ip_address}{$cpe}{'docsIfCmtsCmStatusValue'}]; |
|
3807
|
|
|
|
|
|
|
} |
|
3808
|
|
|
|
|
|
|
} |
|
3809
|
|
|
|
|
|
|
} |
|
3810
|
|
|
|
|
|
|
|
|
3811
|
0
|
|
|
|
|
|
undef %other_addresses; |
|
3812
|
0
|
|
|
|
|
|
undef %rev_data_pack; |
|
3813
|
|
|
|
|
|
|
|
|
3814
|
0
|
0
|
|
|
|
|
if ( scalar ( keys %{$data} ) == 0 ) |
|
|
0
|
|
|
|
|
|
|
|
3815
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="No UBR CPE Information Data Found.\n"; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
3816
|
|
|
|
|
|
|
|
|
3817
|
0
|
|
|
|
|
|
return 1; |
|
3818
|
|
|
|
|
|
|
} |
|
3819
|
|
|
|
|
|
|
|
|
3820
|
|
|
|
|
|
|
sub UBR_modify_cpe_DOCSIS_profile |
|
3821
|
|
|
|
|
|
|
{ |
|
3822
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
3823
|
0
|
|
|
|
|
|
my $ip_address = shift; |
|
3824
|
0
|
|
|
|
|
|
my $profiles = shift; |
|
3825
|
0
|
|
|
|
|
|
my $profile_change = shift; |
|
3826
|
0
|
|
|
|
|
|
my $cpe_information = shift; |
|
3827
|
0
|
|
|
|
|
|
my $mac_to_change = shift; |
|
3828
|
|
|
|
|
|
|
|
|
3829
|
0
|
0
|
|
|
|
|
if (!$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}) |
|
3830
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="UBR Not Ready"; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
3831
|
|
|
|
|
|
|
|
|
3832
|
0
|
0
|
|
|
|
|
if ( !$profiles ) |
|
3833
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="No Profiles Found"; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
3834
|
|
|
|
|
|
|
|
|
3835
|
0
|
0
|
|
|
|
|
if ( !$cpe_information ) |
|
3836
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="No CPE Device Information Found"; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
3837
|
|
|
|
|
|
|
|
|
3838
|
0
|
0
|
|
|
|
|
if ( !$mac_to_change ) |
|
3839
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="No MAC Address Specified"; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
3840
|
|
|
|
|
|
|
|
|
3841
|
0
|
0
|
|
|
|
|
if ( !$profile_change ) |
|
3842
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="No Profile Specified"; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
3843
|
|
|
|
|
|
|
|
|
3844
|
0
|
|
|
|
|
|
my (@profile_definition) = split(/\//,$profile_change); |
|
3845
|
|
|
|
|
|
|
|
|
3846
|
0
|
0
|
|
|
|
|
if ( scalar ( @profile_definition ) !=2 ) |
|
3847
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="Profile Incorrect format ( upstream/downstream )"; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
3848
|
|
|
|
|
|
|
|
|
3849
|
0
|
|
|
|
|
|
my ($lock_profile)=0; |
|
3850
|
0
|
|
|
|
|
|
foreach my $profile ( %{${$profiles}{$ip_address}} ) |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
3851
|
|
|
|
|
|
|
{ |
|
3852
|
0
|
|
|
|
|
|
my $merge = ${$profiles}{$ip_address}{$profile}{'docsIfQosProfMaxUpBandwidth'}."/".${$profiles}{$ip_address}{$profile}{'docsIfQosProfMaxDownBandwidth'}; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
3853
|
0
|
0
|
|
|
|
|
if ( $merge=~/^$profile_change$/ ) |
|
3854
|
0
|
|
|
|
|
|
{ $lock_profile=1; $profile_change=$profile; } |
|
|
0
|
|
|
|
|
|
|
|
3855
|
|
|
|
|
|
|
} |
|
3856
|
|
|
|
|
|
|
|
|
3857
|
0
|
0
|
|
|
|
|
if ( !$lock_profile ) |
|
3858
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="Profile Specified Is Not Currently Configured"; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
3859
|
|
|
|
|
|
|
|
|
3860
|
0
|
|
|
|
|
|
($lock_profile)=0; |
|
3861
|
0
|
|
|
|
|
|
foreach my $mac_find ( keys %{${$cpe_information}{$ip_address}} ) |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
3862
|
|
|
|
|
|
|
{ |
|
3863
|
0
|
0
|
|
|
|
|
if ( ${$cpe_information}{$ip_address}{$mac_find}{'docsIfCmtsCmStatusMacAddress'}=~/^$mac_to_change$/i ) |
|
|
0
|
|
|
|
|
|
|
|
3864
|
|
|
|
|
|
|
{ |
|
3865
|
0
|
|
|
|
|
|
$lock_profile=1; |
|
3866
|
0
|
|
|
|
|
|
$mac_to_change=$mac_find; |
|
3867
|
|
|
|
|
|
|
} |
|
3868
|
|
|
|
|
|
|
} |
|
3869
|
0
|
0
|
|
|
|
|
if ( !$lock_profile ) |
|
3870
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}="MAC Specified Is Not Currently Online"; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
3871
|
|
|
|
|
|
|
|
|
3872
|
0
|
|
|
|
|
|
my @snmp_array; |
|
3873
|
0
|
|
|
|
|
|
my $snmp_variables = Router::Statistics::OID->DOCSIS_populate_oid(); |
|
3874
|
|
|
|
|
|
|
|
|
3875
|
0
|
|
|
|
|
|
push @snmp_array, ( ${$snmp_variables}{'cdxCmtsCmCurrQoSPro'}.".$mac_to_change" , INTEGER, $profile_change ); |
|
|
0
|
|
|
|
|
|
|
|
3876
|
0
|
|
|
|
|
|
my ($reset)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
3877
|
|
|
|
|
|
|
set_request( |
|
3878
|
|
|
|
|
|
|
-callback => [ \&validate_one, {} , {} ], |
|
3879
|
|
|
|
|
|
|
-varbindlist => [@snmp_array] ); |
|
3880
|
0
|
|
|
|
|
|
snmp_dispatcher(); |
|
3881
|
|
|
|
|
|
|
|
|
3882
|
0
|
|
|
|
|
|
undef $snmp_variables; |
|
3883
|
0
|
|
|
|
|
|
undef @snmp_array; |
|
3884
|
0
|
|
|
|
|
|
undef $mac_to_change; |
|
3885
|
0
|
|
|
|
|
|
undef $profile_change; |
|
3886
|
0
|
|
|
|
|
|
undef $reset; |
|
3887
|
|
|
|
|
|
|
|
|
3888
|
0
|
0
|
|
|
|
|
if ( $self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}->error ) |
|
3889
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}->error; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
3890
|
|
|
|
|
|
|
|
|
3891
|
0
|
|
|
|
|
|
return 1; |
|
3892
|
|
|
|
|
|
|
} |
|
3893
|
|
|
|
|
|
|
|
|
3894
|
|
|
|
|
|
|
sub UBR_reset_cpe_device |
|
3895
|
|
|
|
|
|
|
{ |
|
3896
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
3897
|
0
|
|
|
|
|
|
my $ip_address = shift; |
|
3898
|
0
|
|
|
|
|
|
my $mac_address = shift; |
|
3899
|
|
|
|
|
|
|
|
|
3900
|
0
|
0
|
|
|
|
|
if (!$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}) |
|
3901
|
|
|
|
|
|
|
{ |
|
3902
|
0
|
|
|
|
|
|
$self->{_GLOBAL}{'STATUS'}="UBR Not Ready"; return 0; |
|
|
0
|
|
|
|
|
|
|
|
3903
|
|
|
|
|
|
|
} |
|
3904
|
|
|
|
|
|
|
|
|
3905
|
0
|
|
|
|
|
|
my @mac_split=split(/\./,$mac_address); |
|
3906
|
0
|
|
|
|
|
|
my $index; |
|
3907
|
0
|
0
|
|
|
|
|
if ( scalar(@mac_split)==6 ) |
|
3908
|
0
|
|
|
|
|
|
{ foreach my $octet (@mac_split) { $index.=oct("0x$octet")."."; } chop($index); } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
3909
|
|
|
|
|
|
|
|
|
3910
|
0
|
0
|
|
|
|
|
if ( scalar(@mac_split)==3 ) |
|
3911
|
0
|
|
|
|
|
|
{ foreach my $octet (@mac_split) |
|
3912
|
0
|
|
|
|
|
|
{ my $first=substr($octet,0,2); my $second=substr($octet,2,2); |
|
|
0
|
|
|
|
|
|
|
|
3913
|
0
|
|
|
|
|
|
$index.=oct("0x$first")."."; $index.=oct("0x$second")."."; |
|
|
0
|
|
|
|
|
|
|
|
3914
|
0
|
|
|
|
|
|
} chop($index); |
|
3915
|
|
|
|
|
|
|
} |
|
3916
|
0
|
|
|
|
|
|
undef @mac_split; |
|
3917
|
|
|
|
|
|
|
|
|
3918
|
0
|
0
|
|
|
|
|
if ( !$index ) |
|
3919
|
0
|
|
|
|
|
|
{ undef $index; $self->{_GLOBAL}{'STATUS'}="Incorrect MAC address format"; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
3920
|
|
|
|
|
|
|
|
|
3921
|
0
|
|
|
|
|
|
my $snmp_variables = Router::Statistics::OID->DOCSIS_populate_oid(); |
|
3922
|
0
|
|
|
|
|
|
my @snmp_array; |
|
3923
|
0
|
|
|
|
|
|
push @snmp_array, ( ${$snmp_variables}{'cdxCmCpeResetNow'}.".$index" , INTEGER, 1 ); |
|
|
0
|
|
|
|
|
|
|
|
3924
|
0
|
|
|
|
|
|
my ($reset)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
3925
|
|
|
|
|
|
|
set_request( |
|
3926
|
|
|
|
|
|
|
-callback => [ \&validate_one, {} , {} ], |
|
3927
|
|
|
|
|
|
|
-varbindlist => [@snmp_array] ); |
|
3928
|
0
|
|
|
|
|
|
snmp_dispatcher(); |
|
3929
|
0
|
|
|
|
|
|
undef @snmp_array; |
|
3930
|
0
|
|
|
|
|
|
undef $index; |
|
3931
|
|
|
|
|
|
|
|
|
3932
|
0
|
0
|
|
|
|
|
if ( $self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}->error ) |
|
3933
|
0
|
|
|
|
|
|
{ $self->{_GLOBAL}{'STATUS'}=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}->error; return 0; } |
|
|
0
|
|
|
|
|
|
|
|
3934
|
0
|
|
|
|
|
|
return 1; |
|
3935
|
|
|
|
|
|
|
} |
|
3936
|
|
|
|
|
|
|
|
|
3937
|
|
|
|
|
|
|
|
|
3938
|
|
|
|
|
|
|
|
|
3939
|
|
|
|
|
|
|
sub UBR_get_active_cpe_profiles |
|
3940
|
|
|
|
|
|
|
{ |
|
3941
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
3942
|
0
|
|
|
|
|
|
my $data = shift; |
|
3943
|
|
|
|
|
|
|
|
|
3944
|
0
|
|
|
|
|
|
my $current_ubrs=$self->Router_Return_All(); |
|
3945
|
0
|
0
|
|
|
|
|
if ( scalar( keys %{$current_ubrs})==0 ) { return 0; } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
3946
|
|
|
|
|
|
|
|
|
3947
|
0
|
|
|
|
|
|
my $snmp_variables = Router::Statistics::OID->DOCSIS_populate_oid(); |
|
3948
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
3949
|
|
|
|
|
|
|
{ |
|
3950
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
3951
|
0
|
|
|
|
|
|
my ($profile_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
3952
|
|
|
|
|
|
|
get_table( |
|
3953
|
|
|
|
|
|
|
-callback => [ \&validate_one, $data, $ip_address, $snmp_variables ], |
|
3954
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'PRIVATE_docs_profile_main'} ); |
|
3955
|
|
|
|
|
|
|
} |
|
3956
|
0
|
|
|
|
|
|
snmp_dispatcher(); |
|
3957
|
0
|
|
|
|
|
|
return 1; |
|
3958
|
|
|
|
|
|
|
} |
|
3959
|
|
|
|
|
|
|
|
|
3960
|
|
|
|
|
|
|
sub UBR_get_active_cpe_profiles_Blocking |
|
3961
|
|
|
|
|
|
|
{ |
|
3962
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
3963
|
0
|
|
|
|
|
|
my $data = shift; |
|
3964
|
|
|
|
|
|
|
|
|
3965
|
0
|
|
|
|
|
|
my ( $foo, $bar ); |
|
3966
|
|
|
|
|
|
|
|
|
3967
|
0
|
|
|
|
|
|
my $current_ubrs=$self->Router_Return_All(); |
|
3968
|
0
|
0
|
|
|
|
|
if ( scalar( keys %{$current_ubrs})==0 ) { return 0; } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
3969
|
|
|
|
|
|
|
|
|
3970
|
0
|
|
|
|
|
|
my $snmp_variables = Router::Statistics::OID->DOCSIS_populate_oid(); |
|
3971
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
3972
|
|
|
|
|
|
|
{ |
|
3973
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
3974
|
0
|
|
|
|
|
|
my ($profile_information)=$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
3975
|
|
|
|
|
|
|
get_table( |
|
3976
|
0
|
|
|
|
|
|
-baseoid => ${$snmp_variables}{'PRIVATE_docs_profile_main'} ); |
|
3977
|
0
|
|
|
|
|
|
while(($foo, $bar) = each(%{$profile_information})) |
|
|
0
|
|
|
|
|
|
|
|
3978
|
|
|
|
|
|
|
{ |
|
3979
|
|
|
|
|
|
|
#next unless($foo =~ /^${$snmp_variables}{'PRIVATE_docs_profile_main'}.(\d+).(\d+)/); |
|
3980
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'docsIfQosProfPriority'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
3981
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'docsIfQosProfPriority'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
3982
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'docsIfQosProfMaxDownBandwidth'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
3983
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'docsIfQosProfMaxDownBandwidth'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
3984
|
0
|
0
|
|
|
|
|
if ( $foo=~/^${$snmp_variables}{'docsIfQosProfMaxUpBandwidth'}.(\d+)/ ) |
|
|
0
|
|
|
|
|
|
|
|
3985
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{$1}{'docsIfQosProfMaxUpBandwidth'}=$bar; } |
|
|
0
|
|
|
|
|
|
|
|
3986
|
0
|
|
|
|
|
|
delete ${$profile_information}{$foo}; |
|
|
0
|
|
|
|
|
|
|
|
3987
|
|
|
|
|
|
|
} |
|
3988
|
|
|
|
|
|
|
} |
|
3989
|
0
|
|
|
|
|
|
return 1; |
|
3990
|
|
|
|
|
|
|
} |
|
3991
|
|
|
|
|
|
|
|
|
3992
|
|
|
|
|
|
|
sub get_CPE_info_dead |
|
3993
|
|
|
|
|
|
|
{ |
|
3994
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
3995
|
0
|
|
|
|
|
|
my $ip_address = shift; |
|
3996
|
|
|
|
|
|
|
|
|
3997
|
0
|
|
|
|
|
|
my $snmp_variables = Router::Statistics::OID->CPE_populate_oid(); |
|
3998
|
|
|
|
|
|
|
|
|
3999
|
0
|
0
|
|
|
|
|
if (!$self->{_GLOBAL}{'CPE'}{$ip_address}{'SESSION'}) |
|
4000
|
0
|
|
|
|
|
|
{ return 1; } |
|
4001
|
|
|
|
|
|
|
|
|
4002
|
0
|
|
|
|
|
|
my $get_info = $self->{_GLOBAL}{'CPE'}{$ip_address}{'SESSION'} |
|
4003
|
|
|
|
|
|
|
->get_request |
|
4004
|
|
|
|
|
|
|
( |
|
4005
|
0
|
|
|
|
|
|
-varbindlist => [ ${$snmp_variables}{'sysDescr'} ] ); |
|
4006
|
0
|
|
|
|
|
|
undef $snmp_variables; |
|
4007
|
0
|
|
|
|
|
|
return 1; |
|
4008
|
|
|
|
|
|
|
} |
|
4009
|
|
|
|
|
|
|
|
|
4010
|
|
|
|
|
|
|
sub Router_Test_Connection |
|
4011
|
|
|
|
|
|
|
{ |
|
4012
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
4013
|
0
|
|
|
|
|
|
my $data = shift; |
|
4014
|
|
|
|
|
|
|
|
|
4015
|
0
|
|
|
|
|
|
my $current_ubrs=$self->Router_Return_All(); |
|
4016
|
|
|
|
|
|
|
|
|
4017
|
0
|
|
|
|
|
|
my $snmp_variables = Router::Statistics::OID->Host_populate_oid(); |
|
4018
|
|
|
|
|
|
|
|
|
4019
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
4020
|
|
|
|
|
|
|
{ |
|
4021
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
4022
|
0
|
|
|
|
|
|
my $result = |
|
4023
|
|
|
|
|
|
|
$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
4024
|
|
|
|
|
|
|
get_request( |
|
4025
|
|
|
|
|
|
|
-callback => [ \&validate_callback, $ip_address, $data, $snmp_variables ], |
|
4026
|
|
|
|
|
|
|
-varbindlist => [ |
|
4027
|
0
|
|
|
|
|
|
${$snmp_variables}{'sysName'}, |
|
4028
|
0
|
|
|
|
|
|
${$snmp_variables}{'sysUpTime'}, |
|
4029
|
0
|
|
|
|
|
|
${$snmp_variables}{'hostName'}, |
|
4030
|
0
|
|
|
|
|
|
${$snmp_variables}{'sysDescr'} ]); |
|
4031
|
|
|
|
|
|
|
} |
|
4032
|
0
|
|
|
|
|
|
snmp_dispatcher(); |
|
4033
|
|
|
|
|
|
|
|
|
4034
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
4035
|
|
|
|
|
|
|
{ |
|
4036
|
0
|
0
|
|
|
|
|
if ( !${$data}{$ip_address}{'sysUpTime'} ) |
|
|
0
|
|
|
|
|
|
|
|
4037
|
|
|
|
|
|
|
{ |
|
4038
|
0
|
|
|
|
|
|
$self->Router_Remove($ip_address); |
|
4039
|
|
|
|
|
|
|
} |
|
4040
|
0
|
0
|
0
|
|
|
|
if ( !${$data}{$ip_address}{'hostName'} || ${$data}{$ip_address}{'hostName'}=~/^noSuchObject/i ) |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
4041
|
|
|
|
|
|
|
{ |
|
4042
|
0
|
|
|
|
|
|
${$data}{$ip_address}{'hostName'}=${$data}{$ip_address}{'sysName'}; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
4043
|
|
|
|
|
|
|
} |
|
4044
|
|
|
|
|
|
|
} |
|
4045
|
|
|
|
|
|
|
|
|
4046
|
0
|
|
|
|
|
|
return 1; |
|
4047
|
|
|
|
|
|
|
} |
|
4048
|
|
|
|
|
|
|
|
|
4049
|
|
|
|
|
|
|
sub Router_Test_Connection_Blocking |
|
4050
|
|
|
|
|
|
|
{ |
|
4051
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
4052
|
0
|
|
|
|
|
|
my $data = shift; |
|
4053
|
|
|
|
|
|
|
|
|
4054
|
0
|
|
|
|
|
|
my $current_ubrs=$self->Router_Return_All(); |
|
4055
|
|
|
|
|
|
|
|
|
4056
|
0
|
|
|
|
|
|
my $snmp_variables = Router::Statistics::OID->Host_populate_oid(); |
|
4057
|
|
|
|
|
|
|
|
|
4058
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_ubrs} ) |
|
|
0
|
|
|
|
|
|
|
|
4059
|
|
|
|
|
|
|
{ |
|
4060
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}; |
|
4061
|
0
|
|
|
|
|
|
my $result = |
|
4062
|
|
|
|
|
|
|
$self->{_GLOBAL}{'Router'}{$ip_address}{'SESSION'}-> |
|
4063
|
|
|
|
|
|
|
get_request( |
|
4064
|
|
|
|
|
|
|
-varbindlist => [ |
|
4065
|
0
|
|
|
|
|
|
${$snmp_variables}{'sysName'}, |
|
4066
|
0
|
|
|
|
|
|
${$snmp_variables}{'sysUpTime'}, |
|
4067
|
0
|
|
|
|
|
|
${$snmp_variables}{'hostName'}, |
|
4068
|
0
|
|
|
|
|
|
${$snmp_variables}{'sysDescr'} ]); |
|
4069
|
|
|
|
|
|
|
|
|
4070
|
0
|
0
|
|
|
|
|
if ( $result->{${$snmp_variables}{'sysUpTime'}} ) |
|
|
0
|
|
|
|
|
|
|
|
4071
|
|
|
|
|
|
|
{ |
|
4072
|
0
|
|
|
|
|
|
${$data}{$ip_address}{'sysName'}=$result->{${$snmp_variables}{'sysName'}}; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
4073
|
0
|
|
|
|
|
|
${$data}{$ip_address}{'sysUpTime'}=$result->{${$snmp_variables}{'sysUpTime'}}; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
4074
|
0
|
|
|
|
|
|
${$data}{$ip_address}{'hostName'}=$result->{${$snmp_variables}{'hostName'}}; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
4075
|
0
|
|
|
|
|
|
${$data}{$ip_address}{'sysDescr'}=$result->{${$snmp_variables}{'sysDescr'}}; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
4076
|
0
|
0
|
0
|
|
|
|
if ( !${$data}{$ip_address}{'hostName'} || ${$data}{$ip_address}{'hostName'}=~/^noSuchObject/i ) |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
4077
|
0
|
|
|
|
|
|
{ ${$data}{$ip_address}{'hostName'}=${$data}{$ip_address}{'sysName'}; } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
4078
|
|
|
|
|
|
|
} |
|
4079
|
|
|
|
|
|
|
else |
|
4080
|
|
|
|
|
|
|
{ |
|
4081
|
0
|
|
|
|
|
|
$self->Router_Remove($ip_address); |
|
4082
|
|
|
|
|
|
|
} |
|
4083
|
|
|
|
|
|
|
} |
|
4084
|
0
|
|
|
|
|
|
return 1; |
|
4085
|
|
|
|
|
|
|
} |
|
4086
|
|
|
|
|
|
|
|
|
4087
|
|
|
|
|
|
|
sub CPE_Test_Connection |
|
4088
|
|
|
|
|
|
|
{ |
|
4089
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
4090
|
0
|
|
|
|
|
|
my $data = shift; |
|
4091
|
0
|
|
|
|
|
|
my $current_cpes = $self->CPE_Return_All(); |
|
4092
|
|
|
|
|
|
|
|
|
4093
|
0
|
|
|
|
|
|
my $snmp_variables = Router::Statistics::OID->Host_populate_oid(); |
|
4094
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_cpes} ) |
|
|
0
|
|
|
|
|
|
|
|
4095
|
|
|
|
|
|
|
{ |
|
4096
|
0
|
0
|
|
|
|
|
print "IP is '$ip_address' session is '".$self->{_GLOBAL}{'CPE'}{$ip_address}{'SESSION'}."'\n" |
|
4097
|
|
|
|
|
|
|
if $self->{_GLOBAL}{'DEBUG'}==1; |
|
4098
|
0
|
0
|
|
|
|
|
next if !$self->{_GLOBAL}{'CPE'}{$ip_address}{'SESSION'}; |
|
4099
|
0
|
0
|
|
|
|
|
print "First pass of '$ip_address'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
4100
|
0
|
|
|
|
|
|
$self->{_GLOBAL}{'CPE'}{$ip_address}{'SESSION'}-> |
|
4101
|
|
|
|
|
|
|
get_request( |
|
4102
|
|
|
|
|
|
|
-callback => [ \&validate_callback, $ip_address, $data, $snmp_variables ], |
|
4103
|
0
|
|
|
|
|
|
-varbindlist => [ ${$snmp_variables}{'sysUpTime'} ]); |
|
4104
|
0
|
0
|
|
|
|
|
if ( $self->{_GLOBAL}{'CPE'}{$ip_address}{'SESSION'}->error ) |
|
4105
|
|
|
|
|
|
|
{ |
|
4106
|
0
|
0
|
|
|
|
|
print "Error was '".$self->{_GLOBAL}{'CPE'}{$ip_address}{'SESSION'}->error."'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
4107
|
|
|
|
|
|
|
} |
|
4108
|
|
|
|
|
|
|
} |
|
4109
|
0
|
|
|
|
|
|
snmp_dispatcher(); |
|
4110
|
|
|
|
|
|
|
# We have done all the first keys in one go, so we should be left with devices that either have |
|
4111
|
|
|
|
|
|
|
# had two (or more) keys specified or none left. |
|
4112
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_cpes} ) |
|
|
0
|
|
|
|
|
|
|
|
4113
|
|
|
|
|
|
|
{ |
|
4114
|
0
|
0
|
|
|
|
|
print "Now we are here , so '$ip_address' uptime '${$data}{$ip_address}{'sysUpTime'}' keys '".$self->{_GLOBAL}{'CPE'}{$ip_address}{'keys_to_test'}."'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
|
0
|
|
|
|
|
|
|
|
4115
|
0
|
|
0
|
|
|
|
while ( !${$data}{$ip_address}{'sysUpTime'} && $self->{_GLOBAL}{'CPE'}{$ip_address}{'keys_to_test'} ) |
|
|
0
|
|
|
|
|
|
|
|
4116
|
|
|
|
|
|
|
{ |
|
4117
|
0
|
0
|
|
|
|
|
print "No uptime for '$ip_address' but we appear to have keys '".$self->{_GLOBAL}{'CPE'}{$ip_address}{'keys'}."'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
4118
|
0
|
|
|
|
|
|
$self->{_GLOBAL}{'CPE'}{$ip_address}{'key'}= |
|
4119
|
|
|
|
|
|
|
(split(/,/,$self->{_GLOBAL}{'CPE'}{$ip_address}{'keys_to_test'}))[0]; |
|
4120
|
0
|
|
|
|
|
|
$self->{_GLOBAL}{'CPE'}{$ip_address}{'keys_to_test'}=join(',', |
|
4121
|
|
|
|
|
|
|
(split(/,/,$self->{_GLOBAL}{'CPE'}{$ip_address}{'keys_to_test'}))[1,2,3,4,5,6,7,8,9,10]); |
|
4122
|
|
|
|
|
|
|
|
|
4123
|
0
|
0
|
|
|
|
|
print "Next key is '".$self->{_GLOBAL}{'CPE'}{$ip_address}{'key'}."'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
4124
|
0
|
0
|
|
|
|
|
print "Left key is '".$self->{_GLOBAL}{'CPE'}{$ip_address}{'keys_to_test'}."'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
4125
|
|
|
|
|
|
|
|
|
4126
|
0
|
|
|
|
|
|
$self->{_GLOBAL}{'CPE'}{$ip_address}{'SESSION'}->close(); |
|
4127
|
0
|
|
|
|
|
|
$self->CPE_Ready ( $ip_address ); |
|
4128
|
0
|
0
|
|
|
|
|
if ( $self->{_GLOBAL}{'CPE'}{$ip_address}{'SESSION'} ) |
|
4129
|
|
|
|
|
|
|
{ |
|
4130
|
0
|
0
|
|
|
|
|
print "Attempting check again for '$ip_address'\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
4131
|
0
|
|
|
|
|
|
$self->{_GLOBAL}{'CPE'}{$ip_address}{'SESSION'}-> |
|
4132
|
|
|
|
|
|
|
get_request( |
|
4133
|
|
|
|
|
|
|
-callback => [ \&validate_callback, $ip_address, $data, $snmp_variables ], |
|
4134
|
0
|
|
|
|
|
|
-varbindlist => [ ${$snmp_variables}{'sysUpTime'} ] ); |
|
4135
|
0
|
|
|
|
|
|
snmp_dispatcher(); |
|
4136
|
|
|
|
|
|
|
} |
|
4137
|
|
|
|
|
|
|
} |
|
4138
|
|
|
|
|
|
|
} |
|
4139
|
0
|
|
|
|
|
|
snmp_dispatcher(); |
|
4140
|
0
|
|
|
|
|
|
foreach my $ip_address ( keys %{$current_cpes} ) |
|
|
0
|
|
|
|
|
|
|
|
4141
|
|
|
|
|
|
|
{ |
|
4142
|
0
|
0
|
|
|
|
|
if ( !${$data}{$ip_address}{'sysUpTime'} ) |
|
|
0
|
|
|
|
|
|
|
|
4143
|
|
|
|
|
|
|
{ |
|
4144
|
0
|
0
|
|
|
|
|
print "Removing the CPE '$ip_address' no valid key found\n" if $self->{_GLOBAL}{'DEBUG'}==1; |
|
4145
|
0
|
|
|
|
|
|
$self->CPE_Remove($ip_address); |
|
4146
|
|
|
|
|
|
|
} |
|
4147
|
|
|
|
|
|
|
} |
|
4148
|
|
|
|
|
|
|
|
|
4149
|
0
|
|
|
|
|
|
return 1; |
|
4150
|
|
|
|
|
|
|
} |
|
4151
|
|
|
|
|
|
|
|
|
4152
|
|
|
|
|
|
|
sub set_format |
|
4153
|
|
|
|
|
|
|
{ |
|
4154
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
4155
|
0
|
|
|
|
|
|
my $data = shift; |
|
4156
|
0
|
0
|
|
|
|
|
if ( !$data ) |
|
4157
|
0
|
|
|
|
|
|
{ $data=" ::"; } |
|
4158
|
0
|
|
|
|
|
|
$self->{_GLOBAL}{'DATETIME_FORMAT'}=$data; |
|
4159
|
0
|
|
|
|
|
|
return 1; |
|
4160
|
|
|
|
|
|
|
} |
|
4161
|
|
|
|
|
|
|
|
|
4162
|
|
|
|
|
|
|
sub get_format |
|
4163
|
|
|
|
|
|
|
{ |
|
4164
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
4165
|
0
|
|
|
|
|
|
return $self->{_GLOBAL}{'DATETIME_FORMAT'}; |
|
4166
|
|
|
|
|
|
|
} |
|
4167
|
|
|
|
|
|
|
|
|
4168
|
|
|
|
|
|
|
sub convert_ntp_time_mask |
|
4169
|
|
|
|
|
|
|
{ |
|
4170
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
4171
|
0
|
|
|
|
|
|
my $raw_input = shift; |
|
4172
|
0
|
|
|
|
|
|
my $data = shift; |
|
4173
|
0
|
|
|
|
|
|
my $ip_address = shift; |
|
4174
|
0
|
|
|
|
|
|
my ( $time_ticks, $resolution ) = unpack ('NN', $raw_input ); |
|
4175
|
0
|
|
|
|
|
|
$time_ticks -= 2208988800; |
|
4176
|
0
|
|
|
|
|
|
my $gm = localtime($time_ticks); |
|
4177
|
0
|
|
|
|
|
|
my $time = sprintf("%.2d:%.2d",$gm->hour(),$gm->min()); |
|
4178
|
0
|
|
|
|
|
|
${$data}{$ip_address}{'time'}{'hour'}=sprintf("%.2d",$gm->hour()); |
|
|
0
|
|
|
|
|
|
|
|
4179
|
0
|
|
|
|
|
|
${$data}{$ip_address}{'time'}{'min'}=sprintf("%.2d",$gm->min()); |
|
|
0
|
|
|
|
|
|
|
|
4180
|
0
|
|
|
|
|
|
${$data}{$ip_address}{'time'}{'total_minutes'}=(${$data}{$ip_address}{'time'}{'hour'}*60)+${$data}{$ip_address}{'time'}{'min'}; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
4181
|
0
|
|
|
|
|
|
${$data}{$ip_address}{'time'}{'epoch'}=$time_ticks; |
|
|
0
|
|
|
|
|
|
|
|
4182
|
0
|
|
|
|
|
|
${$data}{$ip_address}{'time'}{'full_time'}=$time; |
|
|
0
|
|
|
|
|
|
|
|
4183
|
0
|
|
|
|
|
|
return 1; |
|
4184
|
|
|
|
|
|
|
} |
|
4185
|
|
|
|
|
|
|
|
|
4186
|
|
|
|
|
|
|
sub convert_time_mask |
|
4187
|
|
|
|
|
|
|
{ |
|
4188
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
4189
|
0
|
|
|
|
|
|
my $raw_input = shift; |
|
4190
|
0
|
|
|
|
|
|
my $format = $self->get_format(); |
|
4191
|
0
|
|
|
|
|
|
my ( $char1, $char2, $char3, $char4, $char5, $char6, $char7, $char8, $char9, $char10) = unpack ('nCCCCCCCCC', $raw_input); |
|
4192
|
0
|
|
|
|
|
|
my $month_name = ( 'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec')[ $char2-1 ]; |
|
4193
|
|
|
|
|
|
|
|
|
4194
|
0
|
|
|
|
|
|
my $month = sprintf("%.2d",$char2); |
|
4195
|
0
|
|
|
|
|
|
my $year = sprintf("%.4d",$char1); |
|
4196
|
0
|
|
|
|
|
|
my $day = sprintf("%.2d",$char3); |
|
4197
|
0
|
|
|
|
|
|
my $hour = sprintf("%.2d",$char4); |
|
4198
|
0
|
|
|
|
|
|
my $minute = sprintf("%.2d",$char5); |
|
4199
|
0
|
|
|
|
|
|
my $second = sprintf("%.2d",$char6); |
|
4200
|
|
|
|
|
|
|
|
|
4201
|
0
|
|
|
|
|
|
$format =~s/\/$year/ig; |
|
4202
|
0
|
|
|
|
|
|
$format =~s/\/$month_name/ig; |
|
4203
|
0
|
|
|
|
|
|
$format =~s/\/$month/ig; |
|
4204
|
0
|
|
|
|
|
|
$format =~s/\/$day/ig; |
|
4205
|
|
|
|
|
|
|
|
|
4206
|
0
|
|
|
|
|
|
$format =~s/\/$hour/ig; |
|
4207
|
0
|
|
|
|
|
|
$format =~s/\/$minute/ig; |
|
4208
|
0
|
|
|
|
|
|
$format =~s/\/$second/ig; |
|
4209
|
|
|
|
|
|
|
|
|
4210
|
0
|
|
|
|
|
|
return ( $format ); |
|
4211
|
|
|
|
|
|
|
} |
|
4212
|
|
|
|
|
|
|
|
|
4213
|
|
|
|
|
|
|
|
|
4214
|
|
|
|
|
|
|
sub _convert_mac_address |
|
4215
|
|
|
|
|
|
|
{ |
|
4216
|
0
|
|
|
0
|
|
|
my ($raw_input)=@_; |
|
4217
|
0
|
|
|
|
|
|
my ( $char1, $char2, $char3, $char4, $char5, $char6) = unpack ('CCCCCC', $raw_input); |
|
4218
|
0
|
0
|
|
|
|
|
$char1=sprintf ("%#.2x",$char1); $char1=(split(/0x/,$char1))[1] if $char1=~/x/g; |
|
|
0
|
|
|
|
|
|
|
|
4219
|
0
|
0
|
|
|
|
|
$char2=sprintf ("%#.2x",$char2); $char2=(split(/0x/,$char2))[1] if $char2=~/x/g; |
|
|
0
|
|
|
|
|
|
|
|
4220
|
0
|
0
|
|
|
|
|
$char3=sprintf ("%#.2x",$char3); $char3=(split(/0x/,$char3))[1] if $char3=~/x/g; |
|
|
0
|
|
|
|
|
|
|
|
4221
|
0
|
0
|
|
|
|
|
$char4=sprintf ("%#.2x",$char4); $char4=(split(/0x/,$char4))[1] if $char4=~/x/g; |
|
|
0
|
|
|
|
|
|
|
|
4222
|
0
|
0
|
|
|
|
|
$char5=sprintf ("%#.2x",$char5); $char5=(split(/0x/,$char5))[1] if $char5=~/x/g; |
|
|
0
|
|
|
|
|
|
|
|
4223
|
0
|
0
|
|
|
|
|
$char6=sprintf ("%#.2x",$char6); $char6=(split(/0x/,$char6))[1] if $char6=~/x/g; |
|
|
0
|
|
|
|
|
|
|
|
4224
|
0
|
|
|
|
|
|
return ("$char1$char2.$char3$char4.$char5$char6"); |
|
4225
|
|
|
|
|
|
|
} |
|
4226
|
|
|
|
|
|
|
|
|
4227
|
|
|
|
|
|
|
sub validate_callback |
|
4228
|
|
|
|
|
|
|
{ |
|
4229
|
0
|
|
|
0
|
0
|
|
my ($session, $ip_address, $table, $snmp_variables ) = @_; |
|
4230
|
0
|
|
|
|
|
|
foreach my $oid (oid_lex_sort(keys(%{$session->var_bind_list}))) |
|
|
0
|
|
|
|
|
|
|
|
4231
|
|
|
|
|
|
|
{ |
|
4232
|
0
|
|
|
|
|
|
foreach my $attribute ( keys %{$snmp_variables} ) |
|
|
0
|
|
|
|
|
|
|
|
4233
|
|
|
|
|
|
|
{ |
|
4234
|
0
|
0
|
|
|
|
|
next if $attribute=~/^PRIVATE/; |
|
4235
|
0
|
0
|
|
|
|
|
if ( $oid =~ /^${$snmp_variables}{$attribute}/) |
|
|
0
|
|
|
|
|
|
|
|
4236
|
|
|
|
|
|
|
{ |
|
4237
|
0
|
|
|
|
|
|
${$table}{$ip_address}{$attribute}=$session->var_bind_list->{$oid}; } |
|
|
0
|
|
|
|
|
|
|
|
4238
|
|
|
|
|
|
|
} |
|
4239
|
0
|
|
|
|
|
|
delete ( $session->var_bind_list->{$oid} ); |
|
4240
|
|
|
|
|
|
|
} |
|
4241
|
0
|
|
|
|
|
|
return 1; |
|
4242
|
|
|
|
|
|
|
} |
|
4243
|
|
|
|
|
|
|
|
|
4244
|
|
|
|
|
|
|
sub validate_one |
|
4245
|
|
|
|
|
|
|
{ |
|
4246
|
|
|
|
|
|
|
|
|
4247
|
0
|
|
|
0
|
0
|
|
my ($session, $table, $ip_address, $snmp_variables ) = @_; |
|
4248
|
0
|
|
|
|
|
|
foreach my $oid (oid_lex_sort(keys(%{$session->var_bind_list}))) |
|
|
0
|
|
|
|
|
|
|
|
4249
|
|
|
|
|
|
|
{ |
|
4250
|
0
|
|
|
|
|
|
foreach my $attribute ( keys %{$snmp_variables} ) |
|
|
0
|
|
|
|
|
|
|
|
4251
|
|
|
|
|
|
|
{ |
|
4252
|
0
|
0
|
|
|
|
|
next if $attribute=~/^PRIVATE/; |
|
4253
|
0
|
0
|
|
|
|
|
if ( $oid =~ /^${$snmp_variables}{$attribute}.(\d+)/) |
|
|
0
|
|
|
|
|
|
|
|
4254
|
|
|
|
|
|
|
{ |
|
4255
|
0
|
|
|
|
|
|
${$table}{$ip_address}{$1}{$attribute}=$session->var_bind_list->{$oid}; |
|
|
0
|
|
|
|
|
|
|
|
4256
|
|
|
|
|
|
|
} |
|
4257
|
|
|
|
|
|
|
} |
|
4258
|
0
|
|
|
|
|
|
delete ( $session->var_bind_list->{$oid} ); |
|
4259
|
|
|
|
|
|
|
} |
|
4260
|
|
|
|
|
|
|
|
|
4261
|
0
|
|
|
|
|
|
return 1; |
|
4262
|
|
|
|
|
|
|
} |
|
4263
|
|
|
|
|
|
|
|
|
4264
|
|
|
|
|
|
|
sub validate_one_cpe |
|
4265
|
|
|
|
|
|
|
{ |
|
4266
|
|
|
|
|
|
|
|
|
4267
|
0
|
|
|
0
|
0
|
|
my ($session, $table, $ip_address, $snmp_variables ) = @_; |
|
4268
|
0
|
|
|
|
|
|
foreach my $oid (oid_lex_sort(keys(%{$session->var_bind_list}))) |
|
|
0
|
|
|
|
|
|
|
|
4269
|
|
|
|
|
|
|
{ |
|
4270
|
0
|
|
|
|
|
|
foreach my $attribute ( keys %{$snmp_variables} ) |
|
|
0
|
|
|
|
|
|
|
|
4271
|
|
|
|
|
|
|
{ |
|
4272
|
0
|
0
|
|
|
|
|
next if $attribute=~/^PRIVATE/; |
|
4273
|
0
|
0
|
|
|
|
|
if ( $oid =~ /^${$snmp_variables}{$attribute}.(\d+)/) |
|
|
0
|
|
|
|
|
|
|
|
4274
|
|
|
|
|
|
|
{ |
|
4275
|
0
|
|
|
|
|
|
${$table}{$ip_address}{$attribute}=$session->var_bind_list->{$oid}; |
|
|
0
|
|
|
|
|
|
|
|
4276
|
|
|
|
|
|
|
} |
|
4277
|
|
|
|
|
|
|
} |
|
4278
|
0
|
|
|
|
|
|
delete ( $session->var_bind_list->{$oid} ); |
|
4279
|
|
|
|
|
|
|
} |
|
4280
|
|
|
|
|
|
|
|
|
4281
|
0
|
|
|
|
|
|
return 1; |
|
4282
|
|
|
|
|
|
|
} |
|
4283
|
|
|
|
|
|
|
|
|
4284
|
|
|
|
|
|
|
sub validate_two |
|
4285
|
|
|
|
|
|
|
{ |
|
4286
|
|
|
|
|
|
|
|
|
4287
|
0
|
|
|
0
|
0
|
|
my ($session, $table, $snmp_variables, $rev_data_pack ) = @_; |
|
4288
|
0
|
|
|
|
|
|
foreach my $oid (oid_lex_sort(keys(%{$session->var_bind_list}))) |
|
|
0
|
|
|
|
|
|
|
|
4289
|
|
|
|
|
|
|
{ |
|
4290
|
0
|
|
|
|
|
|
foreach my $attribute ( keys %{$snmp_variables} ) |
|
|
0
|
|
|
|
|
|
|
|
4291
|
|
|
|
|
|
|
{ |
|
4292
|
0
|
0
|
|
|
|
|
next if $attribute=~/^PRIVATE/; |
|
4293
|
0
|
0
|
|
|
|
|
if ( $oid =~ /^${$snmp_variables}{$attribute}.(\d+).(\d+)/) |
|
|
0
|
|
|
|
|
|
|
|
4294
|
|
|
|
|
|
|
{ |
|
4295
|
0
|
|
|
|
|
|
my $cmindexcode="$1:$2"; |
|
4296
|
0
|
|
|
|
|
|
${$table}{$cmindexcode}{$attribute}=$session->var_bind_list->{$oid}; |
|
|
0
|
|
|
|
|
|
|
|
4297
|
|
|
|
|
|
|
} |
|
4298
|
|
|
|
|
|
|
} |
|
4299
|
0
|
|
|
|
|
|
delete ( $session->var_bind_list->{$oid} ); |
|
4300
|
|
|
|
|
|
|
} |
|
4301
|
|
|
|
|
|
|
|
|
4302
|
0
|
|
|
|
|
|
return 1; |
|
4303
|
|
|
|
|
|
|
} |
|
4304
|
|
|
|
|
|
|
|
|
4305
|
|
|
|
|
|
|
sub validate_two_rev |
|
4306
|
|
|
|
|
|
|
{ |
|
4307
|
|
|
|
|
|
|
|
|
4308
|
0
|
|
|
0
|
0
|
|
my ($session, $table, $ip_address, $snmp_variables ) = @_; |
|
4309
|
0
|
|
|
|
|
|
foreach my $oid (oid_lex_sort(keys(%{$session->var_bind_list}))) |
|
|
0
|
|
|
|
|
|
|
|
4310
|
|
|
|
|
|
|
{ |
|
4311
|
0
|
0
|
|
|
|
|
if ( $oid =~ /^${$snmp_variables}{'docsIfCmtsServiceCmStatusIndex'}.(\d+).(\d+)/) |
|
|
0
|
|
|
|
|
|
|
|
4312
|
|
|
|
|
|
|
{ |
|
4313
|
0
|
|
|
|
|
|
my $cmindexcode="$1:$2"; |
|
4314
|
0
|
|
|
|
|
|
${$table}{$ip_address}{$cmindexcode}=$session->var_bind_list->{$oid}; |
|
|
0
|
|
|
|
|
|
|
|
4315
|
|
|
|
|
|
|
} |
|
4316
|
0
|
|
|
|
|
|
delete ( $session->var_bind_list->{$oid} ); |
|
4317
|
|
|
|
|
|
|
} |
|
4318
|
|
|
|
|
|
|
|
|
4319
|
0
|
|
|
|
|
|
return 1; |
|
4320
|
|
|
|
|
|
|
} |
|
4321
|
|
|
|
|
|
|
|
|
4322
|
|
|
|
|
|
|
sub validate_two_special |
|
4323
|
|
|
|
|
|
|
{ |
|
4324
|
|
|
|
|
|
|
|
|
4325
|
0
|
|
|
0
|
0
|
|
my ($session, $table, $ip_address, $snmp_variables, $rev_data_pack ) = @_; |
|
4326
|
0
|
|
|
|
|
|
foreach my $oid (oid_lex_sort(keys(%{$session->var_bind_list}))) |
|
|
0
|
|
|
|
|
|
|
|
4327
|
|
|
|
|
|
|
{ |
|
4328
|
0
|
|
|
|
|
|
foreach my $attribute ( keys %{$snmp_variables} ) |
|
|
0
|
|
|
|
|
|
|
|
4329
|
|
|
|
|
|
|
{ |
|
4330
|
0
|
0
|
|
|
|
|
next if $attribute=~/^PRIVATE/; |
|
4331
|
0
|
0
|
|
|
|
|
if ( $oid =~ /^${$snmp_variables}{$attribute}.(\d+).(\d+)/) |
|
|
0
|
|
|
|
|
|
|
|
4332
|
|
|
|
|
|
|
{ |
|
4333
|
0
|
|
|
|
|
|
my $cmindexcode="$1:$2"; |
|
4334
|
0
|
|
|
|
|
|
$cmindexcode=${$rev_data_pack}{$ip_address}{$cmindexcode}; |
|
|
0
|
|
|
|
|
|
|
|
4335
|
0
|
|
|
|
|
|
${$table}{$ip_address}{$cmindexcode}{$attribute}=$session->var_bind_list->{$oid}; |
|
|
0
|
|
|
|
|
|
|
|
4336
|
|
|
|
|
|
|
} |
|
4337
|
|
|
|
|
|
|
} |
|
4338
|
0
|
|
|
|
|
|
delete ( $session->var_bind_list->{$oid} ); |
|
4339
|
|
|
|
|
|
|
} |
|
4340
|
|
|
|
|
|
|
|
|
4341
|
0
|
|
|
|
|
|
return 1; |
|
4342
|
|
|
|
|
|
|
} |
|
4343
|
|
|
|
|
|
|
|
|
4344
|
|
|
|
|
|
|
sub validate_rule_base |
|
4345
|
|
|
|
|
|
|
{ |
|
4346
|
0
|
|
|
0
|
0
|
|
my ($session, $table, $ip_address, $snmp_variables ) = @_; |
|
4347
|
0
|
|
|
|
|
|
foreach my $oid (oid_lex_sort(keys(%{$session->var_bind_list}))) |
|
|
0
|
|
|
|
|
|
|
|
4348
|
|
|
|
|
|
|
{ |
|
4349
|
0
|
|
|
|
|
|
foreach my $attribute ( keys %{$snmp_variables} ) |
|
|
0
|
|
|
|
|
|
|
|
4350
|
|
|
|
|
|
|
{ |
|
4351
|
0
|
0
|
|
|
|
|
next if $attribute=~/^PRIVATE/; |
|
4352
|
0
|
0
|
|
|
|
|
if ( $oid =~ /^${$snmp_variables}{$attribute}\./) |
|
|
0
|
|
|
|
|
|
|
|
4353
|
|
|
|
|
|
|
{ |
|
4354
|
0
|
|
|
|
|
|
my $new_oid=$oid; |
|
4355
|
0
|
|
|
|
|
|
$new_oid=~s/${$snmp_variables}{$attribute}//g; |
|
|
0
|
|
|
|
|
|
|
|
4356
|
|
|
|
|
|
|
#print "New oid is '$new_oid'\n"; |
|
4357
|
|
|
|
|
|
|
#print "New oid is '$new_oid' value is '".$session->var_bind_list->{$oid}."'\n"; |
|
4358
|
0
|
|
|
|
|
|
my $name; |
|
4359
|
0
|
|
|
|
|
|
foreach my $character ( split(/\./,$new_oid) ) |
|
4360
|
0
|
0
|
|
|
|
|
{ next if $character<15; $name.=chr($character); } |
|
|
0
|
|
|
|
|
|
|
|
4361
|
0
|
|
|
|
|
|
$name=~s/^\s*//; $name=~ s/\s*$//; |
|
|
0
|
|
|
|
|
|
|
|
4362
|
|
|
|
|
|
|
#print "Name is '$name'\n"; |
|
4363
|
0
|
|
|
|
|
|
${$table}{$ip_address}{'stm_rule_set'}{$name}{$attribute}=$session->var_bind_list->{$oid}; |
|
|
0
|
|
|
|
|
|
|
|
4364
|
|
|
|
|
|
|
# ${$table}{$ip_address}{'name'}=$name; |
|
4365
|
|
|
|
|
|
|
} |
|
4366
|
|
|
|
|
|
|
} |
|
4367
|
0
|
|
|
|
|
|
delete ( $session->var_bind_list->{$oid} ); |
|
4368
|
|
|
|
|
|
|
} |
|
4369
|
0
|
|
|
|
|
|
return 1; |
|
4370
|
|
|
|
|
|
|
} |
|
4371
|
|
|
|
|
|
|
|
|
4372
|
|
|
|
|
|
|
|
|
4373
|
|
|
|
|
|
|
sub validate_two_plain |
|
4374
|
|
|
|
|
|
|
{ |
|
4375
|
|
|
|
|
|
|
|
|
4376
|
0
|
|
|
0
|
0
|
|
my ($session, $table, $ip_address, $snmp_variables, $rev_data_pack ) = @_; |
|
4377
|
0
|
|
|
|
|
|
foreach my $oid (oid_lex_sort(keys(%{$session->var_bind_list}))) |
|
|
0
|
|
|
|
|
|
|
|
4378
|
|
|
|
|
|
|
{ |
|
4379
|
0
|
|
|
|
|
|
foreach my $attribute ( keys %{$snmp_variables} ) |
|
|
0
|
|
|
|
|
|
|
|
4380
|
|
|
|
|
|
|
{ |
|
4381
|
0
|
0
|
|
|
|
|
next if $attribute=~/^PRIVATE/; |
|
4382
|
0
|
0
|
|
|
|
|
if ( $oid =~ /^${$snmp_variables}{$attribute}.(\d+).(\d+)/) |
|
|
0
|
|
|
|
|
|
|
|
4383
|
|
|
|
|
|
|
{ |
|
4384
|
0
|
|
|
|
|
|
my $cmindexcode="$1:$2"; |
|
4385
|
0
|
|
|
|
|
|
${$table}{$ip_address}{$cmindexcode}{$attribute}=$session->var_bind_list->{$oid}; |
|
|
0
|
|
|
|
|
|
|
|
4386
|
|
|
|
|
|
|
} |
|
4387
|
|
|
|
|
|
|
} |
|
4388
|
0
|
|
|
|
|
|
delete ( $session->var_bind_list->{$oid} ); |
|
4389
|
|
|
|
|
|
|
} |
|
4390
|
0
|
|
|
|
|
|
return 1; |
|
4391
|
|
|
|
|
|
|
} |
|
4392
|
|
|
|
|
|
|
|
|
4393
|
|
|
|
|
|
|
|
|
4394
|
|
|
|
|
|
|
sub validate_six |
|
4395
|
|
|
|
|
|
|
{ |
|
4396
|
0
|
|
|
0
|
0
|
|
my ($session, $table, $snmp_variables ) = @_; |
|
4397
|
0
|
|
|
|
|
|
foreach my $oid (oid_lex_sort(keys(%{$session->var_bind_list}))) |
|
|
0
|
|
|
|
|
|
|
|
4398
|
|
|
|
|
|
|
{ |
|
4399
|
0
|
|
|
|
|
|
foreach my $attribute ( keys %{$snmp_variables} ) |
|
|
0
|
|
|
|
|
|
|
|
4400
|
|
|
|
|
|
|
{ |
|
4401
|
0
|
0
|
|
|
|
|
next if $attribute=~/^PRIVATE/; |
|
4402
|
0
|
0
|
|
|
|
|
if ( $oid =~ /^${$snmp_variables}{$attribute}.(\d+).(\d+).(\d+).(\d+).(\d+).(\d+)/) |
|
|
0
|
|
|
|
|
|
|
|
4403
|
|
|
|
|
|
|
{ |
|
4404
|
0
|
|
|
|
|
|
my $cmindexcode="$1.$2.$3.$4.$5.$6"; |
|
4405
|
0
|
|
|
|
|
|
${$table}{$cmindexcode}{$attribute}=$session->var_bind_list->{$oid}; |
|
|
0
|
|
|
|
|
|
|
|
4406
|
|
|
|
|
|
|
} |
|
4407
|
|
|
|
|
|
|
} |
|
4408
|
0
|
|
|
|
|
|
delete ( $session->var_bind_list->{$oid} ); |
|
4409
|
|
|
|
|
|
|
} |
|
4410
|
|
|
|
|
|
|
|
|
4411
|
0
|
|
|
|
|
|
return 1; |
|
4412
|
|
|
|
|
|
|
} |
|
4413
|
|
|
|
|
|
|
|
|
4414
|
|
|
|
|
|
|
sub validate_six_net |
|
4415
|
|
|
|
|
|
|
{ |
|
4416
|
0
|
|
|
0
|
0
|
|
my ($session, $table, $router, $snmp_variables ) = @_; |
|
4417
|
0
|
|
|
|
|
|
foreach my $oid (oid_lex_sort(keys(%{$session->var_bind_list}))) |
|
|
0
|
|
|
|
|
|
|
|
4418
|
|
|
|
|
|
|
{ |
|
4419
|
0
|
|
|
|
|
|
foreach my $attribute ( keys %{$snmp_variables} ) |
|
|
0
|
|
|
|
|
|
|
|
4420
|
|
|
|
|
|
|
{ |
|
4421
|
0
|
0
|
|
|
|
|
next if $attribute=~/^PRIVATE/; |
|
4422
|
0
|
0
|
|
|
|
|
if ( $oid =~ /^${$snmp_variables}{$attribute}.(\d+).(\d+).(\d+).(\d+).(\d+).(\d+)/) |
|
|
0
|
|
|
|
|
|
|
|
4423
|
|
|
|
|
|
|
{ |
|
4424
|
0
|
|
|
|
|
|
my $index="$3.$4.$5.$6"; |
|
4425
|
0
|
|
|
|
|
|
my $int_index=$1; |
|
4426
|
0
|
|
|
|
|
|
${$table}{$router}{$int_index}{'address'}{$index}{$attribute}=$session->var_bind_list->{$oid}; |
|
|
0
|
|
|
|
|
|
|
|
4427
|
|
|
|
|
|
|
} |
|
4428
|
|
|
|
|
|
|
} |
|
4429
|
0
|
|
|
|
|
|
delete ( $session->var_bind_list->{$oid} ); |
|
4430
|
|
|
|
|
|
|
} |
|
4431
|
|
|
|
|
|
|
|
|
4432
|
0
|
|
|
|
|
|
return 1; |
|
4433
|
|
|
|
|
|
|
} |
|
4434
|
|
|
|
|
|
|
|
|
4435
|
|
|
|
|
|
|
sub validate_four_net |
|
4436
|
|
|
|
|
|
|
{ |
|
4437
|
0
|
|
|
0
|
0
|
|
my ($session, $table, $router, $snmp_variables ) = @_; |
|
4438
|
0
|
|
|
|
|
|
my (%temp); |
|
4439
|
|
|
|
|
|
|
|
|
4440
|
0
|
|
|
|
|
|
foreach my $oid (oid_lex_sort(keys(%{$session->var_bind_list}))) |
|
|
0
|
|
|
|
|
|
|
|
4441
|
|
|
|
|
|
|
{ |
|
4442
|
0
|
|
|
|
|
|
foreach my $attribute ( keys %{$snmp_variables} ) |
|
|
0
|
|
|
|
|
|
|
|
4443
|
|
|
|
|
|
|
{ |
|
4444
|
0
|
0
|
|
|
|
|
if ( $attribute=~/ipAdEntIfIndex/i ) |
|
4445
|
|
|
|
|
|
|
{ |
|
4446
|
0
|
0
|
|
|
|
|
if ( $oid =~ /^${$snmp_variables}{$attribute}.(\d+).(\d+).(\d+).(\d+)/) |
|
|
0
|
|
|
|
|
|
|
|
4447
|
|
|
|
|
|
|
{ |
|
4448
|
0
|
|
|
|
|
|
my $index="$1.$2.$3.$4"; |
|
4449
|
0
|
|
|
|
|
|
$temp{$index}=$session->var_bind_list->{$oid}; |
|
4450
|
|
|
|
|
|
|
} |
|
4451
|
|
|
|
|
|
|
} |
|
4452
|
|
|
|
|
|
|
} |
|
4453
|
|
|
|
|
|
|
} |
|
4454
|
|
|
|
|
|
|
|
|
4455
|
0
|
|
|
|
|
|
foreach my $oid (oid_lex_sort(keys(%{$session->var_bind_list}))) |
|
|
0
|
|
|
|
|
|
|
|
4456
|
|
|
|
|
|
|
{ |
|
4457
|
0
|
|
|
|
|
|
foreach my $attribute ( keys %{$snmp_variables} ) |
|
|
0
|
|
|
|
|
|
|
|
4458
|
|
|
|
|
|
|
{ |
|
4459
|
0
|
0
|
|
|
|
|
next if $attribute=~/^PRIVATE/; |
|
4460
|
0
|
0
|
|
|
|
|
if ( $oid =~ /^${$snmp_variables}{$attribute}.(\d+).(\d+).(\d+).(\d+)/) |
|
|
0
|
|
|
|
|
|
|
|
4461
|
|
|
|
|
|
|
{ |
|
4462
|
0
|
|
|
|
|
|
my $index="$1.$2.$3.$4"; |
|
4463
|
0
|
|
|
|
|
|
my $int_index=$temp{$index}; |
|
4464
|
0
|
|
|
|
|
|
${$table}{$router}{$int_index}{'address'}{$index}{$attribute}=$session->var_bind_list->{$oid}; |
|
|
0
|
|
|
|
|
|
|
|
4465
|
|
|
|
|
|
|
} |
|
4466
|
|
|
|
|
|
|
} |
|
4467
|
0
|
|
|
|
|
|
delete ( $session->var_bind_list->{$oid} ); |
|
4468
|
|
|
|
|
|
|
} |
|
4469
|
0
|
|
|
|
|
|
return 1; |
|
4470
|
|
|
|
|
|
|
} |
|
4471
|
|
|
|
|
|
|
|
|
4472
|
|
|
|
|
|
|
sub get_cpe_information |
|
4473
|
|
|
|
|
|
|
{ |
|
4474
|
0
|
|
|
0
|
0
|
|
my ($session, $ip, $table, $snmp_variables ) = @_; |
|
4475
|
0
|
|
|
|
|
|
foreach my $oid (oid_lex_sort(keys(%{$session->var_bind_list}))) |
|
|
0
|
|
|
|
|
|
|
|
4476
|
|
|
|
|
|
|
{ |
|
4477
|
0
|
|
|
|
|
|
foreach my $attribute ( keys %{$snmp_variables} ) |
|
|
0
|
|
|
|
|
|
|
|
4478
|
|
|
|
|
|
|
{ |
|
4479
|
0
|
0
|
|
|
|
|
next if $attribute=~/^PRIVATE/; |
|
4480
|
0
|
0
|
|
|
|
|
if ( $oid =~ /^${$snmp_variables}{$attribute}/) |
|
|
0
|
|
|
|
|
|
|
|
4481
|
|
|
|
|
|
|
{ |
|
4482
|
0
|
|
|
|
|
|
${$table}{$ip}{$attribute}=$session->var_bind_list->{$oid}; |
|
|
0
|
|
|
|
|
|
|
|
4483
|
|
|
|
|
|
|
} |
|
4484
|
|
|
|
|
|
|
} |
|
4485
|
0
|
|
|
|
|
|
delete ( $session->var_bind_list->{$oid} ); |
|
4486
|
|
|
|
|
|
|
} |
|
4487
|
0
|
|
|
|
|
|
return 1; |
|
4488
|
|
|
|
|
|
|
} |
|
4489
|
|
|
|
|
|
|
|
|
4490
|
|
|
|
|
|
|
sub _IpQuadToInt { |
|
4491
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
4492
|
0
|
|
|
|
|
|
my($Quad) = @_; my($Ip1, $Ip2, $Ip3, $Ip4) = split(/\./, $Quad); |
|
|
0
|
|
|
|
|
|
|
|
4493
|
0
|
|
|
|
|
|
my($IpInt) = (($Ip1 << 24) | ($Ip2 << 16) | ($Ip3 << 8) | $Ip4); |
|
4494
|
0
|
|
|
|
|
|
return($IpInt); |
|
4495
|
|
|
|
|
|
|
} |
|
4496
|
|
|
|
|
|
|
|
|
4497
|
0
|
|
|
0
|
|
|
sub _IpIntToQuad { my $self= shift; my($Int) = @_; |
|
|
0
|
|
|
|
|
|
|
|
4498
|
0
|
|
|
|
|
|
my($Ip1) = $Int & 0xFF; $Int >>= 8; |
|
|
0
|
|
|
|
|
|
|
|
4499
|
0
|
|
|
|
|
|
my($Ip2) = $Int & 0xFF; $Int >>= 8; |
|
|
0
|
|
|
|
|
|
|
|
4500
|
0
|
|
|
|
|
|
my($Ip3) = $Int & 0xFF; $Int >>= 8; |
|
|
0
|
|
|
|
|
|
|
|
4501
|
0
|
|
|
|
|
|
my($Ip4) = $Int & 0xFF; return("$Ip4.$Ip3.$Ip2.$Ip1"); |
|
|
0
|
|
|
|
|
|
|
|
4502
|
|
|
|
|
|
|
} |
|
4503
|
|
|
|
|
|
|
|
|
4504
|
|
|
|
|
|
|
=head1 BUGS |
|
4505
|
|
|
|
|
|
|
|
|
4506
|
|
|
|
|
|
|
It is has been discovered using Non blocking functions on Cisco routers does |
|
4507
|
|
|
|
|
|
|
not always return the same consistent information compared to Blocking. It is |
|
4508
|
|
|
|
|
|
|
the opinion of the author to only use Blocking unless you know what you are doing, |
|
4509
|
|
|
|
|
|
|
and all functions will have Blocking mirrors in the first public release. |
|
4510
|
|
|
|
|
|
|
|
|
4511
|
|
|
|
|
|
|
Module now semi supports blocking and non blocking mode. |
|
4512
|
|
|
|
|
|
|
It has been discovered that non-blocking is significantly longer to |
|
4513
|
|
|
|
|
|
|
execute. Not entirely sure why, however to speed things up |
|
4514
|
|
|
|
|
|
|
some functions now have _Blocking mirrors so they can be called |
|
4515
|
|
|
|
|
|
|
instead. |
|
4516
|
|
|
|
|
|
|
|
|
4517
|
|
|
|
|
|
|
Added support to retrieve the STM information very simple implementation |
|
4518
|
|
|
|
|
|
|
to poll the STM mib provided on Cisco equipment. |
|
4519
|
|
|
|
|
|
|
Added support to ONLY poll STM information when within all STM windows. |
|
4520
|
|
|
|
|
|
|
|
|
4521
|
|
|
|
|
|
|
Added Network Link Map Generator |
|
4522
|
|
|
|
|
|
|
Added CPE snmp read key cycler ( not finished ). |
|
4523
|
|
|
|
|
|
|
|
|
4524
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
|
4525
|
|
|
|
|
|
|
C, or through the web interface at |
|
4526
|
|
|
|
|
|
|
L. |
|
4527
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on |
|
4528
|
|
|
|
|
|
|
your bug as I make changes. |
|
4529
|
|
|
|
|
|
|
|
|
4530
|
|
|
|
|
|
|
=head1 SUPPORT |
|
4531
|
|
|
|
|
|
|
|
|
4532
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
|
4533
|
|
|
|
|
|
|
|
|
4534
|
|
|
|
|
|
|
perldoc Router::Statistics |
|
4535
|
|
|
|
|
|
|
|
|
4536
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
|
4537
|
|
|
|
|
|
|
|
|
4538
|
|
|
|
|
|
|
Cisco I suppose for making their products such a nightmare to manage using |
|
4539
|
|
|
|
|
|
|
SNMP. |
|
4540
|
|
|
|
|
|
|
|
|
4541
|
|
|
|
|
|
|
Joshua Keroes for pointing out some of the make test issues ( thanks!! ) |
|
4542
|
|
|
|
|
|
|
Joshua Keroes for requesting HC (64bit) for interfaces |
|
4543
|
|
|
|
|
|
|
|
|
4544
|
|
|
|
|
|
|
Motorola for some pointers with their CMTS ( still waiting on some info ) |
|
4545
|
|
|
|
|
|
|
|
|
4546
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
|
4547
|
|
|
|
|
|
|
|
|
4548
|
|
|
|
|
|
|
Copyright 2007 Andrew S. Kennedy, all rights reserved. |
|
4549
|
|
|
|
|
|
|
|
|
4550
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
4551
|
|
|
|
|
|
|
under the same terms as Perl itself. |
|
4552
|
|
|
|
|
|
|
|
|
4553
|
|
|
|
|
|
|
=cut |
|
4554
|
|
|
|
|
|
|
|
|
4555
|
|
|
|
|
|
|
1; # End of Router::Statistics |
|
4556
|
|
|
|
|
|
|
|