r4789 authorize8021QChangeRequests: respect $script_mode variable
[racktables] / wwwroot / inc / snmp.php
1 <?php
2
3 global $iftable_processors;
4 $iftable_processors = array();
5
6 $iftable_processors['catalyst-chassis-mgmt'] = array
7 (
8 'pattern' => '@^FastEthernet([[:digit:]])$@',
9 'replacement' => 'fa\\1',
10 'dict_key' => '1-19',
11 'label' => 'mgmt',
12 'try_next_proc' => FALSE,
13 );
14
15 $iftable_processors['catalyst-chassis-any-100TX'] = array
16 (
17 'pattern' => '@^FastEthernet([[:digit:]]+/)?([[:digit:]]+)$@',
18 'replacement' => 'fa\\1\\2',
19 'dict_key' => 19,
20 'label' => '\\2X',
21 'try_next_proc' => FALSE,
22 );
23
24 $iftable_processors['catalyst-chassis-25-to-26-100FX/MT-RJ'] = array
25 (
26 'pattern' => '@^FastEthernet([[:digit:]]+/)?(25|26)$@',
27 'replacement' => 'fa\\1\\2',
28 'dict_key' => 1195,
29 'label' => '\\2',
30 'try_next_proc' => FALSE,
31 );
32
33 $iftable_processors['catalyst-chassis-any-1000T'] = array
34 (
35 'pattern' => '@^GigabitEthernet([[:digit:]]+/)?([[:digit:]]+)$@',
36 'replacement' => 'gi\\1\\2',
37 'dict_key' => 24,
38 'label' => '\\2X',
39 'try_next_proc' => FALSE,
40 );
41
42 $iftable_processors['catalyst-chassis-uplinks-1000T'] = array
43 (
44 'pattern' => '@^GigabitEthernet([[:digit:]]+/)?([[:digit:]]+)$@',
45 'replacement' => 'gi\\1\\2',
46 'dict_key' => 24,
47 'label' => '\\2',
48 'try_next_proc' => FALSE,
49 );
50
51 $iftable_processors['catalyst-chassis-uplinks-1000SX'] = array
52 (
53 'pattern' => '@^GigabitEthernet([[:digit:]]+/)?([[:digit:]]+)$@',
54 'replacement' => 'gi\\1\\2',
55 'dict_key' => '1-1202', // Gig-SX hardwired
56 'label' => '\\2',
57 'try_next_proc' => FALSE,
58 );
59
60 $iftable_processors['catalyst-chassis-any-1000SFP'] = array
61 (
62 'pattern' => '@^GigabitEthernet([[:digit:]]+/)?([[:digit:]]+)$@',
63 'replacement' => 'gi\\1\\2',
64 'dict_key' => '4-1077',
65 'label' => '\\2',
66 'try_next_proc' => FALSE,
67 );
68
69 $iftable_processors['catalyst-chassis-any-1000GBIC'] = array
70 (
71 'pattern' => '@^GigabitEthernet([[:digit:]]+/)?([[:digit:]]+)$@',
72 'replacement' => 'gi\\1\\2',
73 'dict_key' => '3-1078',
74 'label' => '\\2',
75 'try_next_proc' => FALSE,
76 );
77
78 $iftable_processors['catalyst-chassis-1-to-2-combo-1000SFP'] = array
79 (
80 'pattern' => '@^GigabitEthernet([[:digit:]]+/)?(1|2)$@',
81 'replacement' => 'gi\\1\\2',
82 'dict_key' => '4-1077',
83 'label' => '\\2',
84 'try_next_proc' => TRUE,
85 );
86
87 $iftable_processors['catalyst-chassis-1-to-2-1000SFP'] = array
88 (
89 'pattern' => '@^GigabitEthernet([[:digit:]]+/)?(1|2)$@',
90 'replacement' => 'gi\\1\\2',
91 'dict_key' => '4-1077',
92 'label' => '\\2',
93 'try_next_proc' => FALSE,
94 );
95
96 $iftable_processors['catalyst-chassis-8-combo-1000SFP'] = array
97 (
98 'pattern' => '@^GigabitEthernet([[:digit:]]+/)?(8)$@',
99 'replacement' => 'gi\\1\\2',
100 'dict_key' => '4-1077',
101 'label' => '\\2',
102 'try_next_proc' => TRUE,
103 );
104
105 $iftable_processors['catalyst-chassis-21-to-24-combo-1000SFP'] = array
106 (
107 'pattern' => '@^GigabitEthernet([[:digit:]]+/)?(21|22|23|24)$@',
108 'replacement' => 'gi\\1\\2',
109 'dict_key' => '4-1077',
110 'label' => '\\2',
111 'try_next_proc' => TRUE,
112 );
113
114 $iftable_processors['catalyst-chassis-45-to-48-combo-1000SFP'] = array
115 (
116 'pattern' => '@^GigabitEthernet([[:digit:]]+/)?(45|46|47|48)$@',
117 'replacement' => 'gi\\1\\2',
118 'dict_key' => '4-1077',
119 'label' => '\\2',
120 'try_next_proc' => TRUE,
121 );
122
123 $iftable_processors['catalyst-chassis-uplinks-10000X2'] = array
124 (
125 'pattern' => '@^TenGigabitEthernet([[:digit:]]+/)?([[:digit:]]+)$@',
126 'replacement' => 'te\\1\\2',
127 'dict_key' => '6-1080',
128 'label' => '\\2',
129 'try_next_proc' => FALSE,
130 );
131
132 $iftable_processors['catalyst-chassis-25-to-28-1000SFP'] = array
133 (
134 'pattern' => '@^GigabitEthernet([[:digit:]]+/)?(25|26|27|28)$@',
135 'replacement' => 'gi\\1\\2',
136 'dict_key' => '4-1077',
137 'label' => '\\2',
138 'try_next_proc' => FALSE,
139 );
140
141 $iftable_processors['catalyst-chassis-49-to-52-1000SFP'] = array
142 (
143 'pattern' => '@^GigabitEthernet([[:digit:]]+/)?(49|50|51|52)$@',
144 'replacement' => 'gi\\1\\2',
145 'dict_key' => '4-1077',
146 'label' => '\\2',
147 'try_next_proc' => FALSE,
148 );
149
150 $iftable_processors['catalyst-blade-13-to-16-1000SFP'] = array
151 (
152 'pattern' => '@^GigabitEthernet([[:digit:]]+/)?(13|14|15|16)$@',
153 'replacement' => 'gi\\1\\2',
154 'dict_key' => '4-1077',
155 'label' => '\\2',
156 'try_next_proc' => FALSE,
157 );
158
159 $iftable_processors['catalyst-blade-21-to-24-1000SFP'] = array
160 (
161 'pattern' => '@^GigabitEthernet([[:digit:]]+/)?(21|22|23|24)$@',
162 'replacement' => 'gi\\1\\2',
163 'dict_key' => '4-1077',
164 'label' => '\\2',
165 'try_next_proc' => FALSE,
166 );
167
168 $iftable_processors['catalyst-blade-11-to-12-1000T'] = array
169 (
170 'pattern' => '@^GigabitEthernet([[:digit:]]+/)?(11|12)$@',
171 'replacement' => 'gi\\1\\2',
172 'dict_key' => '1-24',
173 'label' => '\\2',
174 'try_next_proc' => FALSE,
175 );
176
177 $iftable_processors['catalyst-blade-17-to-20-1000T'] = array
178 (
179 'pattern' => '@^GigabitEthernet([[:digit:]]+/)?(17|18|19|20)$@',
180 'replacement' => 'gi\\1\\2',
181 'dict_key' => '1-24',
182 'label' => '\\2',
183 'try_next_proc' => FALSE,
184 );
185
186 $iftable_processors['catalyst-blade-any-bp/1000T'] = array
187 (
188 'pattern' => '@^GigabitEthernet([[:digit:]]+/)?([[:digit:]]+)$@',
189 'replacement' => 'gi\\1\\2',
190 'dict_key' => '1-1087',
191 'label' => '',
192 'try_next_proc' => FALSE,
193 );
194
195 $iftable_processors['catalyst-11-to-12-1000T'] = array
196 (
197 'pattern' => '@^GigabitEthernet([[:digit:]]+/)?(11|12)$@',
198 'replacement' => 'gi\\1\\2',
199 'dict_key' => '1-24',
200 'label' => '\\2',
201 'try_next_proc' => FALSE,
202 );
203
204 $iftable_processors['catalyst-1-to-10-1000T'] = array
205 (
206 'pattern' => '@^GigabitEthernet([[:digit:]]+/)?(1|2|3|4|5|6|7|8|9|10)$@',
207 'replacement' => 'gi\\1\\2',
208 'dict_key' => '1-24',
209 'label' => '\\2',
210 'try_next_proc' => FALSE,
211 );
212
213 $iftable_processors['catalyst-11-to-12-GBIC'] = array
214 (
215 'pattern' => '@^GigabitEthernet([[:digit:]]+/)?(11|12)$@',
216 'replacement' => 'gi\\1\\2',
217 'dict_key' => '3-1078',
218 'label' => '\\2',
219 'try_next_proc' => FALSE,
220 );
221
222 $iftable_processors['nexus-any-10000SFP+'] = array
223 (
224 'pattern' => '@^Ethernet([[:digit:]]/[[:digit:]]+)$@',
225 'replacement' => 'e\\1',
226 'dict_key' => '9-1084',
227 'label' => '\\1',
228 'try_next_proc' => FALSE,
229 );
230
231 $iftable_processors['ftos-any-1000T'] = array
232 (
233 'pattern' => '@^GigabitEthernet 0/(\d+)$@',
234 'replacement' => 'gi0/\\1',
235 'dict_key' => '1-24',
236 'label' => '\\1',
237 'try_next_proc' => FALSE,
238 );
239
240 $iftable_processors['ftos-44-to-47-1000SFP'] = array
241 (
242 'pattern' => '@^GigabitEthernet 0/(44|45|46|47)$@',
243 'replacement' => 'gi0/\\1',
244 'dict_key' => '4-1077',
245 'label' => '\\1',
246 'try_next_proc' => FALSE,
247 );
248
249 $iftable_processors['ftos-any-10000SFP+'] = array
250 (
251 'pattern' => '@^TenGigabitEthernet 0/(\d+)$@',
252 'replacement' => 'te0/\\1',
253 'dict_key' => '9-1084',
254 'label' => '\\1',
255 'try_next_proc' => FALSE,
256 );
257
258 $iftable_processors['ftos-any-QSFP+'] = array
259 (
260 'pattern' => '@^fortyGigE 0/(\d+)$@',
261 'replacement' => 'fo0/\\1',
262 'dict_key' => '10-1588',
263 'label' => '\\1',
264 'try_next_proc' => FALSE,
265 );
266
267 $iftable_processors['ftos-mgmt'] = array
268 (
269 'pattern' => '@^ManagementEthernet 0/0$@',
270 'replacement' => 'ma0/0',
271 'dict_key' => '1-19',
272 'label' => 'ethernet',
273 'try_next_proc' => FALSE,
274 );
275
276 $iftable_processors['nexus-mgmt'] = array
277 (
278 'pattern' => '@^(mgmt[[:digit:]]+)$@',
279 'replacement' => '\\1',
280 'dict_key' => '1-24',
281 'label' => '\\1',
282 'try_next_proc' => FALSE,
283 );
284
285 $iftable_processors['procurve-chassis-100TX'] = array
286 (
287 'pattern' => '@^([[:digit:]]+)$@',
288 'replacement' => '\\1',
289 'dict_key' => 19,
290 'label' => '\\1',
291 'try_next_proc' => FALSE,
292 );
293
294 $iftable_processors['procurve-chassis-1000T'] = array
295 (
296 'pattern' => '@^([[:digit:]]+)$@',
297 'replacement' => '\\1',
298 'dict_key' => 24,
299 'label' => '\\1',
300 'try_next_proc' => FALSE,
301 );
302
303 $iftable_processors['procurve-45-to-48-combo-1000SFP'] = array
304 (
305 'pattern' => '@^(45|46|47|48)$@',
306 'replacement' => '\\1',
307 'dict_key' => '4-1077',
308 'label' => '\\1',
309 'try_next_proc' => TRUE,
310 );
311
312 $iftable_processors['procurve-21-to-24-combo-1000SFP'] = array
313 (
314 'pattern' => '@^(21|22|23|24)$@',
315 'replacement' => '\\1',
316 'dict_key' => '4-1077',
317 'label' => '\\1',
318 'try_next_proc' => TRUE,
319 );
320
321 $iftable_processors['procurve-modular-100TX'] = array
322 (
323 'pattern' => '@^([A-Z][[:digit:]]+)$@',
324 'replacement' => '\\1',
325 'dict_key' => 19,
326 'label' => '\\1',
327 'try_next_proc' => FALSE,
328 );
329
330 $iftable_processors['procurve-25-to-26-1000T'] = array
331 (
332 'pattern' => '@^(25|26)$@',
333 'replacement' => '\\1',
334 'dict_key' => 24,
335 'label' => '\\1',
336 'try_next_proc' => FALSE,
337 );
338
339 $iftable_processors['procurve-49-to-50-1000T'] = array
340 (
341 'pattern' => '@^(49|50)$@',
342 'replacement' => '\\1',
343 'dict_key' => 24,
344 'label' => '\\1',
345 'try_next_proc' => FALSE,
346 );
347
348 $iftable_processors['procurve-51-to-52-1000SFP'] = array
349 (
350 'pattern' => '@^(51|52)$@',
351 'replacement' => '\\1',
352 'dict_key' => '4-1077',
353 'label' => '\\1',
354 'try_next_proc' => FALSE,
355 );
356
357 $iftable_processors['netgear-chassis-any-1000T'] = array
358 (
359 'pattern' => '@^Unit: 1 Slot: 0 Port: ([[:digit:]]+) Gigabit - Level$@',
360 'replacement' => '\\1',
361 'dict_key' => 24,
362 'label' => '\\1',
363 'try_next_proc' => FALSE,
364 );
365
366 $iftable_processors['netgear-chassis-21-to-24-1000Tcombo'] = array
367 (
368 'pattern' => '@^Unit: 1 Slot: 0 Port: ([[:digit:]]+) Gigabit - Level$@',
369 'replacement' => '\\1',
370 'dict_key' => 24,
371 'label' => '\\1T',
372 'try_next_proc' => FALSE,
373 );
374
375 $iftable_processors['netgear-chassis-21-to-24-1000SFP'] = array
376 (
377 'pattern' => '@^Unit: 1 Slot: 0 Port: ([[:digit:]]+) Gigabit - Level$@',
378 'replacement' => '\\1',
379 'dict_key' => '4-1077',
380 'label' => '\\1F',
381 'try_next_proc' => TRUE,
382 );
383
384 $iftable_processors['nortel-any-1000T'] = array
385 (
386 'pattern' => '@^Ethernet Port on unit 1, port ([[:digit:]]+)$@',
387 'replacement' => '\\1',
388 'dict_key' => 24,
389 'label' => '\\1',
390 'try_next_proc' => FALSE,
391 );
392
393 $iftable_processors['smc-combo-45-to-48'] = array
394 (
395 'pattern' => '@^Ethernet Port on unit 1, port (45|46|47|48)$@',
396 'replacement' => '\\1',
397 'dict_key' => '4-1077',
398 'label' => '\\1',
399 'try_next_proc' => TRUE,
400 );
401
402 $iftable_processors['smc2-combo-21-to-24'] = array
403 (
404 'pattern' => '@^Port #(21|22|23|24)$@',
405 'replacement' => '\\1',
406 'dict_key' => '4-1077',
407 'label' => '\\1',
408 'try_next_proc' => TRUE,
409 );
410
411 $iftable_processors['smc2-combo-23-to-24'] = array
412 (
413 'pattern' => '@^Port #(23|24)$@',
414 'replacement' => '\\1',
415 'dict_key' => '4-1077',
416 'label' => '\\1',
417 'try_next_proc' => TRUE,
418 );
419
420 $iftable_processors['smc2-combo-25-to-28'] = array
421 (
422 'pattern' => '@^Port #(25|26|27|28)$@',
423 'replacement' => '\\1',
424 'dict_key' => '4-1077',
425 'label' => '\\1',
426 'try_next_proc' => TRUE,
427 );
428
429 $iftable_processors['smc2-1000T-25-to-28'] = array
430 (
431 'pattern' => '@^Port #(25|26|27|28)$@',
432 'replacement' => '\\1',
433 'dict_key' => '1-24',
434 'label' => '\\1',
435 'try_next_proc' => FALSE,
436 );
437
438 $iftable_processors['smc2-any-1000T'] = array
439 (
440 'pattern' => '@^Port #(\d+)$@',
441 'replacement' => '\\1',
442 'dict_key' => '1-24',
443 'label' => '\\1',
444 'try_next_proc' => FALSE,
445 );
446
447 $iftable_processors['smc2-any-100TX'] = array
448 (
449 'pattern' => '@^Port #(\d+)$@',
450 'replacement' => '\\1',
451 'dict_key' => '1-19',
452 'label' => '\\1',
453 'try_next_proc' => FALSE,
454 );
455
456 $iftable_processors['juniper-DPCE-R-4XGE-XFP'] = array
457 (
458 'pattern' => '@^xe-([[:digit:]]+)/([[:digit:]]+/[[:digit:]]+)$@',
459 'replacement' => '\\0',
460 'dict_key' => '8-1082', // XFP/empty
461 'label' => 'slot \\1 port \\2',
462 'try_next_proc' => FALSE,
463 );
464
465 $iftable_processors['juniper-ex-pic0-1000T'] = array
466 (
467 'pattern' => '@^ge-([[:digit:]]+)/0/([[:digit:]]+)$@',
468 'replacement' => '\\0',
469 'dict_key' => '1-24',
470 'label' => 'unit \\1 port \\2',
471 'try_next_proc' => FALSE,
472 );
473
474 $iftable_processors['juniper-ex-mgmt'] = array
475 (
476 'pattern' => '/^me0$/',
477 'replacement' => 'me0',
478 'dict_key' => '1-24',
479 'label' => 'MGMT',
480 'try_next_proc' => FALSE,
481 );
482
483 $iftable_processors['quidway-21-to-24-comboT'] = array
484 (
485 'pattern' => '@^GigabitEthernet([[:digit:]]+/[[:digit:]]+/)(21|22|23|24)$@',
486 'replacement' => 'gi\\1\\2',
487 'dict_key' => '1-24',
488 'label' => '\\2',
489 'try_next_proc' => TRUE,
490 );
491
492 $iftable_processors['quidway-21-to-24-comboSFP'] = array
493 (
494 'pattern' => '@^GigabitEthernet([[:digit:]]+/[[:digit:]]+/)(21|22|23|24)$@',
495 'replacement' => 'gi\\1\\2',
496 'dict_key' => '4-1077',
497 'label' => '\\2',
498 'try_next_proc' => TRUE,
499 );
500
501 $iftable_processors['quidway-slot1-SFP'] = array
502 (
503 'pattern' => '@^GigabitEthernet0/1/([[:digit:]]+)$@',
504 'replacement' => 'gi0/1/\\1',
505 'dict_key' => '4-1077',
506 'label' => 'SFP\\1',
507 'try_next_proc' => FALSE,
508 );
509
510 $iftable_processors['quidway-any-1000SFP'] = array
511 (
512 'pattern' => '@^GigabitEthernet([[:digit:]]+/[[:digit:]]+/)([[:digit:]]+)$@',
513 'replacement' => 'gi\\1\\2',
514 'dict_key' => '4-1077', // empty SFP-1000
515 'label' => '\\2',
516 'try_next_proc' => FALSE,
517 );
518
519 $iftable_processors['quidway-any-1000T'] = array
520 (
521 'pattern' => '@^GigabitEthernet([[:digit:]]+/[[:digit:]]+/)([[:digit:]]+)$@',
522 'replacement' => 'gi\\1\\2',
523 'dict_key' => '1-24',
524 'label' => '\\2',
525 'try_next_proc' => FALSE,
526 );
527
528 $iftable_processors['quidway-XFP'] = array
529 (
530 'pattern' => '@^XGigabitEthernet([[:digit:]]+/[[:digit:]]+/)([[:digit:]]+)$@',
531 'replacement' => 'xg\\1\\2',
532 'dict_key' => '8-1082',
533 'label' => '\\2',
534 'try_next_proc' => FALSE,
535 );
536
537 $iftable_processors['quidway-mgmt'] = array
538 (
539 'pattern' => '@^MEth([[:digit:]]+/[[:digit:]]+/)([[:digit:]]+)$@',
540 'replacement' => 'me\\1\\2',
541 'dict_key' => '1-19',
542 'label' => 'eth',
543 'try_next_proc' => FALSE,
544 );
545
546 $iftable_processors['fgs-1-to-4-comboSFP'] = array
547 (
548 # only 4 first copper ports of 1st unit of a stack
549 'pattern' => '@^GigabitEthernet1/1/(1|2|3|4)$@',
550 'replacement' => 'e1/1/\\1',
551 'dict_key' => '4-1077',
552 'label' => '\\1F',
553 'try_next_proc' => TRUE,
554 );
555
556 $iftable_processors['fgs-any-1000T'] = array
557 (
558 'pattern' => '@^GigabitEthernet(0|1)/1/([[:digit:]]+)$@',
559 'replacement' => 'e\\1/1/\\2',
560 'dict_key' => '1-24',
561 'label' => '\\2',
562 'try_next_proc' => FALSE,
563 );
564
565 $iftable_processors['fls624-combo'] = array
566 (
567 'pattern' => '@^GigabitEthernet0/1/(21|22|23|24)$@',
568 'replacement' => 'e0/1/\\1',
569 'dict_key' => '4-1077',
570 'label' => '\\1',
571 'try_next_proc' => TRUE,
572 );
573
574 $iftable_processors['fls648-combo'] = array
575 (
576 'pattern' => '@^GigabitEthernet0/1/(45|46|47|48)$@',
577 'replacement' => 'e0/1/\\1',
578 'dict_key' => '4-1077',
579 'label' => '\\1',
580 'try_next_proc' => TRUE,
581 );
582
583 # These can be CX4, but that is not handled here.
584 $iftable_processors['fls-uplinks'] = array
585 (
586 'pattern' => '@^10GigabitEthernet0/([234])/1$@',
587 'replacement' => 'e0/\\1/1',
588 'dict_key' => '8-1082',
589 'label' => 'Slot \\1',
590 'try_next_proc' => FALSE,
591 );
592
593 $iftable_processors['fgs-uplinks'] = array
594 (
595 'pattern' => '@^10GigabitEthernet1/2/([[:digit:]]+)$@',
596 'replacement' => 'e1/2/\\1',
597 'dict_key' => '8-1082', // default is XFP, but may be overridden to CX4
598 'label' => 'Slot2 \\1',
599 'try_next_proc' => FALSE,
600 );
601
602 $iftable_processors['fcx-uplinks'] = array
603 (
604 'pattern' => '@^10GigabitEthernet1/2/([[:digit:]]+)$@',
605 'replacement' => 'e1/2/\\1',
606 'dict_key' => '9-1084',
607 'label' => 'X\\1',
608 'try_next_proc' => FALSE,
609 );
610
611 $iftable_processors['fcx-management'] = array
612 (
613 'pattern' => '@^Management$@',
614 'replacement' => 'management1',
615 'dict_key' => '1-24',
616 'label' => 'Management',
617 'try_next_proc' => FALSE,
618 );
619
620 $iftable_processors['summit-25-to-26-XFP-uplinks'] = array
621 (
622 'pattern' => '@^.+ Port (25|26)$@',
623 'replacement' => '\\1',
624 'dict_key' => '8-1082',
625 'label' => '\\1',
626 'try_next_proc' => FALSE,
627 );
628
629 $iftable_processors['summit-27-to-30-XFP-uplinks'] = array
630 (
631 'pattern' => '@^.+ Port (27|28|29|30)$@',
632 'replacement' => '\\1',
633 'dict_key' => '8-1082',
634 'label' => '\\1',
635 'try_next_proc' => FALSE,
636 );
637
638 $iftable_processors['summit-21-to-24-comboSFP'] = array
639 (
640 'pattern' => '@^.+ Port (21|22|23|24)$@',
641 'replacement' => '\\1',
642 'dict_key' => '4-1077',
643 'label' => '\\1',
644 'try_next_proc' => TRUE,
645 );
646
647 $iftable_processors['summit-13-to-24-comboT'] = array
648 (
649 'pattern' => '@^.+ Port (1[3456789]|2[01234])$@',
650 'replacement' => '\\1',
651 'dict_key' => '1-24',
652 'label' => '\\1',
653 'try_next_proc' => TRUE,
654 );
655
656 $iftable_processors['summit-any-1000T'] = array
657 (
658 'pattern' => '@^.+ Port ([[:digit:]]+)$@',
659 'replacement' => '\\1',
660 'dict_key' => '1-24',
661 'label' => '\\1',
662 'try_next_proc' => FALSE,
663 );
664
665 $iftable_processors['summit-any-SFP'] = array
666 (
667 'pattern' => '@^.+ Port ([[:digit:]]+)$@',
668 'replacement' => '\\1',
669 'dict_key' => '4-1077',
670 'label' => '\\1',
671 'try_next_proc' => FALSE,
672 );
673
674 $iftable_processors['summit-management'] = array
675 (
676 'pattern' => '@^Management Port$@',
677 'replacement' => 'mgmt',
678 'dict_key' => '1-19',
679 'label' => 'management',
680 'try_next_proc' => FALSE,
681 );
682
683 $iftable_processors['C3KX-NM-10000'] = array
684 (
685 'pattern' => '@^TenGigabitEthernet1/(\d+)$@',
686 'replacement' => 'te1/\\1',
687 'dict_key' => '9-1084',
688 'label' => 'NM TE\\1',
689 'try_next_proc' => FALSE,
690 );
691
692 $iftable_processors['C3KX-NM-1000'] = array
693 (
694 'pattern' => '@^GigabitEthernet1/(\d+)$@',
695 'replacement' => 'gi1/\\1',
696 'dict_key' => '4-1077',
697 'label' => 'NM G\\1',
698 'try_next_proc' => FALSE,
699 );
700
701 global $known_switches;
702 $known_switches = array // key is system OID w/o "enterprises" prefix
703 (
704 '9.1.248' => array
705 (
706 'dict_key' => 393,
707 'text' => 'WS-C3524-XL: 24 RJ-45/10-100TX + 2 GBIC/1000',
708 'processors' => array ('catalyst-chassis-any-1000GBIC', 'catalyst-chassis-any-100TX'),
709 ),
710 '9.1.324' => array
711 (
712 'dict_key' => 380,
713 'text' => 'WS-C2950-24: 24 RJ-45/10-100TX',
714 'processors' => array ('catalyst-chassis-any-100TX'),
715 ),
716 '9.1.325' => array
717 (
718 'dict_key' => 382,
719 'text' => 'WS-C2950C-24: 24 RJ-45/10-100TX + 2 MT-RJ/100FX fiber',
720 'processors' => array ('catalyst-chassis-25-to-26-100FX/MT-RJ', 'catalyst-chassis-any-100TX'),
721 ),
722 '9.1.559' => array
723 (
724 'dict_key' => 387,
725 'text' => 'WS-C2950T-48: 48 RJ-45/10-100TX + 2 1000T uplinks',
726 'processors' => array ('catalyst-chassis-uplinks-1000T', 'catalyst-chassis-any-100TX'),
727 ),
728 '9.1.695' => array
729 (
730 'dict_key' => 1590,
731 'text' => 'WS-C2960-48TC-L: 48 RJ-45/10-100TX + 2 combo-gig',
732 'processors' => array ('catalyst-chassis-1-to-2-combo-1000SFP', 'catalyst-chassis-any-1000T', 'catalyst-chassis-any-100TX'),
733 ),
734 '9.1.793' => array
735 (
736 'dict_key' => 1575,
737 'text' => 'WS-C3560E-24TD: 24 RJ-45/10-100-1000T(X) + 2 X2/10000 w/TwinGig + OOBM',
738 'processors' => array
739 (
740 'catalyst-chassis-25-to-28-1000SFP', // TwinGig
741 'catalyst-chassis-any-1000T',
742 'catalyst-chassis-uplinks-10000X2',
743 'catalyst-chassis-mgmt',
744 ),
745 ),
746 '9.1.794' => array
747 (
748 'dict_key' => 1574,
749 'text' => 'WS-C3560E-48TD: 48 RJ-45/10-100-1000T(X) + 2 X2/10000 w/TwinGig + OOBM',
750 'processors' => array
751 (
752 'catalyst-chassis-49-to-52-1000SFP', // TwinGig
753 'catalyst-chassis-any-1000T',
754 'catalyst-chassis-uplinks-10000X2',
755 'catalyst-chassis-mgmt',
756 ),
757 ),
758 '9.1.799' => array
759 (
760 'dict_key' => 168,
761 'text' => 'WS-C2960G-8TC-L: 7 RJ-45/10-100-1000T(X) + 1 combo-gig',
762 'processors' => array ('catalyst-chassis-8-combo-1000SFP', 'catalyst-chassis-any-1000T'),
763 ),
764 '9.1.696' => array
765 (
766 'dict_key' => 167,
767 'text' => 'WS-C2960G-24TC-L: 20 RJ-45/10-100-1000T(X) + 4 combo-gig',
768 'processors' => array ('catalyst-chassis-21-to-24-combo-1000SFP', 'catalyst-chassis-any-1000T'),
769 ),
770 '9.1.697' => array
771 (
772 'dict_key' => 166,
773 'text' => 'WS-C2960G-48TC-L: 44 RJ-45/10-100-1000T(X) + 4 combo-gig',
774 'processors' => array ('catalyst-chassis-45-to-48-combo-1000SFP', 'catalyst-chassis-any-1000T'),
775 ),
776 '9.1.716' => array
777 (
778 'dict_key' => 164,
779 'text' => 'WS-C2960-24TT-L: 24 RJ-45/10-100TX + 2 RJ-45/10-100-1000T(X)',
780 'processors' => array ('catalyst-chassis-any-100TX', 'catalyst-chassis-any-1000T'),
781 ),
782 '9.1.717' => array
783 (
784 'dict_key' => 1572,
785 'text' => 'WS-C2960-48TT-L: 48 RJ-45/10-100TX + 2 RJ-45/10-100-1000T(X)',
786 'processors' => array ('catalyst-chassis-any-100TX', 'catalyst-chassis-any-1000T'),
787 ),
788 '9.1.950' => array
789 (
790 'dict_key' => 1347,
791 'text' => 'WS-C2960-24PC: 44 RJ-45/10-100TX + 2 combo-gig',
792 'processors' => array ('catalyst-chassis-1-to-2-combo-1000SFP', 'catalyst-chassis-any-1000T', 'catalyst-chassis-any-100TX'),
793 ),
794 '9.1.927' => array
795 (
796 'dict_key' => 140,
797 'text' => 'WS-C2960-48TC-S: 48 RJ-45/10-100TX + 2 combo-gig',
798 'processors' => array ('catalyst-chassis-1-to-2-combo-1000SFP', 'catalyst-chassis-any-1000T', 'catalyst-chassis-any-100TX'),
799 ),
800 '9.1.1005' => array
801 (
802 'dict_key' => 1573,
803 'text' => 'WS-C2960-48TT-S: 48 RJ-45/10-100TX + 2 RJ-45/10-100-1000T(X)',
804 'processors' => array ('catalyst-chassis-any-100TX', 'catalyst-chassis-any-1000T'),
805 ),
806 '9.1.527' => array
807 (
808 'dict_key' => 210,
809 'text' => 'WS-C2970G-24T: 24 RJ-45/10-100-1000T(X)',
810 'processors' => array ('catalyst-chassis-any-1000T'),
811 ),
812 '9.1.561' => array
813 (
814 'dict_key' => 115,
815 'text' => 'WS-C2970G-24TS: 24 RJ-45/10-100-1000T(X) + 4 SFP/1000',
816 'processors' => array ('catalyst-chassis-25-to-28-1000SFP', 'catalyst-chassis-any-1000T'),
817 ),
818 '9.1.633' => array
819 (
820 'dict_key' => 169,
821 'text' => 'WS-C3560-24TS: 24 RJ-45/10-100TX + 2 SFP/1000',
822 'processors' => array ('catalyst-chassis-any-1000SFP', 'catalyst-chassis-any-100TX'),
823 ),
824 '9.1.634' => array
825 (
826 'dict_key' => 170,
827 'text' => 'WS-C3560-48TS: 48 RJ-45/10-100TX + 4 SFP/1000',
828 'processors' => array ('catalyst-chassis-any-1000SFP', 'catalyst-chassis-any-100TX'),
829 ),
830 '9.1.563' => array
831 (
832 'dict_key' => 171,
833 'text' => 'WS-C3560-24PS: 24 RJ-45/10-100TX + 2 SFP/1000',
834 'processors' => array ('catalyst-chassis-any-1000SFP', 'catalyst-chassis-any-100TX'),
835 ),
836 '9.1.564' => array
837 (
838 'dict_key' => 172,
839 'text' => 'WS-C3560-48PS: 48 RJ-45/10-100TX + 4 SFP/1000',
840 'processors' => array ('catalyst-chassis-any-1000SFP', 'catalyst-chassis-any-100TX'),
841 ),
842 '9.1.614' => array
843 (
844 'dict_key' => 175,
845 'text' => 'WS-C3560G-24PS: 24 RJ-45/10-100-1000T(X) + 4 SFP/1000',
846 'processors' => array ('catalyst-chassis-25-to-28-1000SFP', 'catalyst-chassis-any-1000T'),
847 ),
848 '9.1.615' => array
849 (
850 'dict_key' => 173,
851 'text' => 'WS-C3560G-24TS: 24 RJ-45/10-100-1000T(X) + 4 SFP/1000',
852 'processors' => array ('catalyst-chassis-25-to-28-1000SFP', 'catalyst-chassis-any-1000T'),
853 ),
854 '9.1.616' => array
855 (
856 'dict_key' => 176,
857 'text' => 'WS-C3560G-48PS: 48 RJ-45/10-100-1000T(X) + 4 SFP/1000',
858 'processors' => array ('catalyst-chassis-49-to-52-1000SFP', 'catalyst-chassis-any-1000T'),
859 ),
860 '9.1.617' => array
861 (
862 'dict_key' => 174,
863 'text' => 'WS-C3560G-48TS: 48 RJ-45/10-100-1000T(X) + 4 SFP/1000',
864 'processors' => array ('catalyst-chassis-49-to-52-1000SFP', 'catalyst-chassis-any-1000T'),
865 ),
866 '9.1.626' => array
867 (
868 'dict_key' => 147,
869 'text' => 'WS-C4948: 48 RJ-45/10-100-1000T(X) + 4 SFP/1000 + 1 RJ-45/100TX (OOB mgmt)',
870 'processors' => array ('catalyst-chassis-49-to-52-1000SFP', 'catalyst-chassis-uplinks-1000T', 'catalyst-chassis-mgmt'),
871 ),
872 '9.1.659' => array
873 (
874 'dict_key' => 377,
875 'text' => 'WS-C4948-10GE: 48 RJ-45/10-100-1000T(X) + 2 X2/10000 + 1 RJ-45/100TX (OOB mgmt)',
876 'processors' => array ('catalyst-chassis-uplinks-10000X2', 'catalyst-chassis-uplinks-1000T', 'catalyst-chassis-mgmt'),
877 ),
878 '9.1.428' => array
879 (
880 'dict_key' => 389,
881 'text' => 'WS-C2950G-24: 24 RJ-45/10-100TX + 2 GBIC/1000',
882 'processors' => array ('catalyst-chassis-any-1000GBIC', 'catalyst-chassis-any-100TX'),
883 ),
884 '9.1.429' => array
885 (
886 'dict_key' => 390,
887 'text' => 'WS-C2950G-48: 48 RJ-45/10-100TX + 2 GBIC/1000',
888 'processors' => array ('catalyst-chassis-any-1000GBIC', 'catalyst-chassis-any-100TX'),
889 ),
890 '9.1.559' => array
891 (
892 'dict_key' => 387,
893 'text' => 'WS-C2950T-48: 48 RJ-45/10-100TX + 2 RJ-45/10-100-1000T(X)',
894 'processors' => array ('catalyst-chassis-uplinks-1000T', 'catalyst-chassis-any-100TX'),
895 ),
896 '9.1.560' => array
897 (
898 'dict_key' => 384,
899 'text' => 'WS-C2950SX-48: 48 RJ-45/10-100TX + 2 1000Base-SX',
900 'processors' => array ('catalyst-chassis-uplinks-1000SX', 'catalyst-chassis-any-100TX'),
901 ),
902 '9.1.749' => array
903 (
904 'dict_key' => 989,
905 'text' => 'WS-CBS3030-DEL: 10 internal/10-100-1000T(X) + 2 RJ-45/10-100-1000T(X) + 4 SFP/1000',
906 'processors' => array ('catalyst-blade-11-to-12-1000T', 'catalyst-blade-13-to-16-1000SFP', 'catalyst-blade-any-bp/1000T'),
907 ),
908 '9.1.920' => array
909 (
910 'dict_key' => 795,
911 'text' => 'WS-CBS3032-DEL: 16 internal/10-100-1000T(X) + 4 RJ-45/10-100-1000T(X) + 4 SFP/1000',
912 'processors' => array ('catalyst-blade-17-to-20-1000T', 'catalyst-blade-21-to-24-1000SFP', 'catalyst-blade-any-bp/1000T'),
913 ),
914 '9.1.367' => array
915 (
916 'dict_key' => 404,
917 'text' => 'WS-C3550-48: 48 RJ-45/10-100TX + 2 GBIC/1000',
918 'processors' => array ('catalyst-chassis-any-100TX', 'catalyst-chassis-any-1000GBIC'),
919 ),
920 '9.1.368' => array
921 (
922 'dict_key' => 398,
923 'text' => 'WS-C3550-12T: 10 RJ-45/10-100-1000T(X) + 2 GBIC/1000',
924 'processors' => array ('catalyst-1-to-10-1000T', 'catalyst-11-to-12-GBIC'),
925 ),
926 '9.1.431' => array
927 (
928 'dict_key' => 399,
929 'text' => 'WS-C3550-12G: 10 GBIC/1000 + 2 RJ-45/10-100-1000T(X)',
930 'processors' => array ('catalyst-11-to-12-1000T', 'catalyst-chassis-any-1000GBIC'),
931 ),
932 '9.1.282' => array
933 (
934 'dict_key' => 154,
935 'text' => 'WS-C6506: modular device (INCOMPLETE!)',
936 'processors' => array ('catalyst-chassis-any-1000T'),
937 ),
938 '9.1.1104' => array
939 (
940 'dict_key' => 1348,
941 'text' => 'WS-C2350-48TD: 48 RJ-45/10-100-1000T(X) + 2 X2/10000 w/TwinGig option',
942 'processors' => array
943 (
944 'catalyst-chassis-49-to-52-1000SFP', // TwinGig actually
945 'catalyst-chassis-any-1000T',
946 'catalyst-chassis-uplinks-10000X2',
947 'catalyst-chassis-mgmt',
948 ),
949 ),
950 '9.1.1016' => array
951 (
952 'dict_key' => 1370,
953 'text' => 'WS-C2960-48PST-L: 48 RJ-45/10-100TX PoE + 2 SFP/1000 + 2 RJ-45/10-100-1000T(X)',
954 'processors' => array
955 (
956 'catalyst-chassis-any-100TX',
957 'catalyst-chassis-1-to-2-1000SFP',
958 'catalyst-chassis-uplinks-1000T',
959 ),
960 ),
961 '9.1.1227' => array
962 (
963 'dict_key' => 1577,
964 'text' => 'WS-C3560X-48T: 48 RJ-45/10-100-1000T(X) + network module + OOBM',
965 'processors' => array
966 (
967 'C3KX-NM-10000',
968 'C3KX-NM-1000',
969 'catalyst-chassis-any-1000T',
970 'catalyst-chassis-mgmt',
971 ),
972 ),
973 '9.12.3.1.3.719' => array
974 (
975 'dict_key' => 960,
976 'text' => 'N5K-C5020: 40 SFP+/10000',
977 'processors' => array ('nexus-any-10000SFP+', 'nexus-mgmt'),
978 ),
979 '9.12.3.1.3.798' => array
980 (
981 'dict_key' => 959,
982 'text' => 'N5K-C5010: 20 SFP+/10000',
983 'processors' => array ('nexus-any-10000SFP+', 'nexus-mgmt'),
984 ),
985 '9.12.3.1.3.1008' => array
986 (
987 'dict_key' => 1412,
988 'text' => 'N5K-C5548P: 32 SFP+/10000',
989 'processors' => array ('nexus-any-10000SFP+', 'nexus-mgmt'),
990 ),
991 '11.2.3.7.11.19' => array
992 (
993 'dict_key' => 859,
994 'text' => 'J4813A: 24 RJ-45/10-100TX + 2 modules of varying type',
995 'processors' => array ('procurve-chassis-100TX'),
996 ),
997 '11.2.3.7.11.32' => array
998 (
999 'dict_key' => 871,
1000 'text' => 'J4904A: 48 RJ-45/10-100-1000T(X)',
1001 'processors' => array ('procurve-chassis-1000T'),
1002 ),
1003 '11.2.3.7.11.36' => array
1004 (
1005 'dict_key' => 865,
1006 'text' => 'J8164A: 24 RJ-45/10-100TX + 2 RJ-45/10-100-1000T(X)',
1007 'processors' => array ('procurve-25-to-26-1000T', 'procurve-chassis-100TX'),
1008 ),
1009 '11.2.3.7.11.35' => array
1010 (
1011 'dict_key' => 867,
1012 'text' => 'J8165A: 48 RJ-45/10-100TX + 2 RJ-45/10-100-1000T(X)',
1013 'processors' => array ('procurve-49-to-50-1000T', 'procurve-chassis-100TX'),
1014 ),
1015 '11.2.3.7.11.9' => array
1016 (
1017 'dict_key' => 1086,
1018 'text' => 'J4121A: modular system',
1019 'processors' => array ('procurve-modular-100TX'),
1020 ),
1021 '11.2.3.7.11.63' => array
1022 (
1023 'dict_key' => 868,
1024 'text' => 'J9021A: 20 RJ-45/10-100-1000T(X) + 4 combo-gig',
1025 'processors' => array ('procurve-21-to-24-combo-1000SFP', 'procurve-chassis-1000T'),
1026 ),
1027 '11.2.3.7.11.65' => array
1028 (
1029 'dict_key' => 850,
1030 'text' => 'J9028A: 22 RJ-45/10-100-1000T(X) + 2 combo-gig',
1031 'processors' => array ('smc2-combo-23-to-24', 'smc2-any-1000T'),
1032 ),
1033 '11.2.3.7.11.86' => array
1034 (
1035 'dict_key' => 1571,
1036 'text' => 'J9145A: 20 RJ-45/10-100-1000T(X) + 4 combo-gig + varying uplinks',
1037 'processors' => array ('procurve-21-to-24-combo-1000SFP', 'procurve-chassis-1000T'),
1038 ),
1039 '11.2.3.7.11.87' => array
1040 (
1041 'dict_key' => 1349,
1042 'text' => 'J9147A: 44 RJ-45/10-100-1000T(X) + 4 combo-gig + varying uplinks',
1043 'processors' => array ('procurve-45-to-48-combo-1000SFP', 'procurve-chassis-1000T'),
1044 ),
1045 '11.2.3.7.11.79' => array
1046 (
1047 'dict_key' => 863,
1048 'text' => 'J9089A: 48 RJ-45/10-100TX PoE + 2 1000T + 2 SFP-1000',
1049 'processors' => array ('procurve-49-to-50-1000T', 'procurve-51-to-52-1000SFP', 'procurve-chassis-100TX'),
1050 ),
1051 '4526.100.2.2' => array
1052 (
1053 'dict_key' => 562,
1054 'text' => 'GSM7224: 20 RJ-45/10-100-1000T(X) + 4 combo-gig',
1055 'processors' => array ('netgear-chassis-21-to-24-1000SFP', 'netgear-chassis-21-to-24-1000Tcombo', 'netgear-chassis-any-1000T'),
1056 ),
1057 '45.3.68.5' => array
1058 (
1059 'dict_key' => 1085,
1060 'text' => 'BES50GE-12T PWR: 12 RJ-45/10-100-1000T(X)',
1061 'processors' => array ('nortel-any-1000T'),
1062 ),
1063 '2636.1.1.1.2.29' => array
1064 (
1065 'dict_key' => 925,
1066 'text' => 'MX240 modular router',
1067 'processors' => array ('juniper-DPCE-R-4XGE-XFP'),
1068 ),
1069 // Juniper Networks assigns single SNMP OID per series:
1070 // EX2200 2636.1.1.1.1.43
1071 // EX3200 2636.1.1.1.2.30
1072 // EX4200 2636.1.1.1.2.31
1073 // EX4500 2636.1.1.1.1.44
1074 // There is a special workaround in code below to derive specific
1075 // product number from sysDescr string.
1076 '2636.1.1.1.2.31' => array
1077 (
1078 'dict_key' => 905,
1079 'text' => 'Juniper EX4200 series',
1080 'processors' => array ('juniper-ex-pic0-1000T', 'juniper-ex-mgmt'),
1081 ),
1082 '2011.2.23.96' => array
1083 (
1084 'dict_key' => 1321,
1085 'text' => 'S5328C-EI-24S: 20 SFP-1000 + 4 combo-gig + 2 XFP slots',
1086 'processors' => array ('quidway-21-to-24-comboT', 'quidway-any-1000SFP', 'quidway-XFP', 'quidway-mgmt'),
1087 ),
1088 '2011.2.23.103' => array
1089 (
1090 'dict_key' => 1341,
1091 'text' => 'S5352C-SI: 48 RJ-45/10-100-1000T(X) + optional 2xXFP/4xSFP slots',
1092 'processors' => array ('quidway-slot1-SFP', 'quidway-any-1000T', 'quidway-XFP', 'quidway-mgmt'),
1093 ),
1094 '2011.2.23.102' => array
1095 (
1096 'dict_key' => 1339,
1097 'text' => 'S5328C-SI: 20 RJ-45/10-100-1000T(X) + 4 combo-gig + 2 XFP slots',
1098 'processors' => array ('quidway-21-to-24-comboSFP', 'quidway-any-1000T', 'quidway-XFP', 'quidway-mgmt'),
1099 ),
1100 '1991.1.3.45.2.1.1.1' => array
1101 (
1102 'dict_key' => 127,
1103 'text' => 'FGS648P: 48 RJ-45/10-100-1000T(X) + 4 combo-gig + uplink slot',
1104 'processors' => array ('fgs-1-to-4-comboSFP', 'fgs-any-1000T', 'fgs-uplinks'),
1105 ),
1106 '1991.1.3.45.2.2.1.1' => array
1107 (
1108 'dict_key' => 131,
1109 'text' => 'FGS648P-POE: 48 RJ-45/10-100-1000T(X) + 4 combo-gig + uplink slot',
1110 'processors' => array ('fgs-1-to-4-comboSFP', 'fgs-any-1000T', 'fgs-uplinks'),
1111 ),
1112 '1991.1.3.54.2.4.1.1' => array
1113 (
1114 'dict_key' => 1362,
1115 'text' => 'FCX 648: 48 RJ-45/10-100-1000T(X) + uplink slot with 4 SFP+',
1116 'processors' => array ('fgs-any-1000T', 'fcx-uplinks', 'fcx-management'),
1117 ),
1118 '1991.1.3.46.1.1.1.1' => array
1119 (
1120 'dict_key' => 413,
1121 'text' => 'FLS 624: 20 RJ-45/10-100-1000T(X) + 4 combo-gig + 3 optional 10G modules',
1122 'processors' => array ('fls624-combo', 'fgs-any-1000T', 'fls-uplinks'),
1123 ),
1124 '1991.1.3.46.2.1.1.1' => array
1125 (
1126 'dict_key' => 414,
1127 'text' => 'FLS 648: 44 RJ-45/10-100-1000T(X) + 4 combo-gig + 2 optional 10G modules',
1128 'processors' => array ('fls648-combo', 'fgs-any-1000T', 'fls-uplinks'),
1129 ),
1130 '1991.1.3.52.2.2.1.1' => array
1131 (
1132 'dict_key' => 1032,
1133 'text' => 'FWS648G: 4 combo-gig + 44 RJ-45/10-100-1000T(X)',
1134 'processors' => array ('fgs-1-to-4-comboSFP', 'fgs-any-1000T'),
1135 ),
1136 '1916.2.71' => array
1137 (
1138 'dict_key' => 694,
1139 'text' => 'X450a-24t: 20 RJ-45/10-100-1000T(X) + 4 combo-gig + XFP uplinks slot',
1140 'processors' => array ('summit-25-to-26-XFP-uplinks', 'summit-21-to-24-comboSFP', 'summit-any-1000T', 'summit-management'),
1141 ),
1142 '1916.2.139' => array
1143 (
1144 'dict_key' => 1353,
1145 'text' => 'X480-24x: 12 SFP-1000 + 12 combo-gig + 2 XFP + VIM slot',
1146 'processors' => array
1147 (
1148 'summit-27-to-30-XFP-uplinks',
1149 'summit-25-to-26-XFP-uplinks',
1150 'summit-13-to-24-comboT',
1151 'summit-any-SFP',
1152 'summit-management'
1153 ),
1154 ),
1155 '202.20.68' => array
1156 (
1157 'dict_key' => 1374,
1158 'text' => 'SMC8150L2: 46 RJ-45/10-100-1000T(X) + 4 combo ports',
1159 'processors' => array ('smc-combo-45-to-48', 'nortel-any-1000T'),
1160 ),
1161 '6027.1.3.12' => array
1162 (
1163 'dict_key' => 1471,
1164 'text' => 'Force10 S60: 44 RJ-45/10-100-1000T(X) + 4 SFP-1000 ports + 0/2/4 SFP+ ports',
1165 'processors' => array ('ftos-44-to-47-1000SFP', 'ftos-any-1000T', 'ftos-any-10000SFP+', 'ftos-mgmt'),
1166 ),
1167 '6027.1.3.13' => array
1168 (
1169 'dict_key' => 1470,
1170 'text' => 'Force10 S55: 44 RJ-45/10-100-1000T(X) + 4 SFP-1000 ports + 0/2/4 SFP+ ports',
1171 'processors' => array ('ftos-44-to-47-1000SFP', 'ftos-any-1000T', 'ftos-any-10000SFP+', 'ftos-mgmt'),
1172 ),
1173 '6027.1.3.14' => array
1174 (
1175 'dict_key' => 1472,
1176 'text' => 'Force10 S4810: 48 SFP+-1000/10000 + 4 QSFP-40000 ports',
1177 'processors' => array ('ftos-any-10000SFP+', 'ftos-any-QSFP+', 'ftos-mgmt'),
1178 ),
1179 '202.20.59' => array
1180 (
1181 'dict_key' => 1371,
1182 'text' => 'SMC8124L2: 20 RJ-45/10-100-1000T(X) + 4 combo ports',
1183 'processors' => array ('smc2-combo-21-to-24', 'smc2-any-1000T'),
1184 ),
1185 '202.20.66' => array
1186 (
1187 'dict_key' => 1567,
1188 'text' => 'SMC6128L2: 24 RJ-45/10-100TX + 4 combo-gig ports',
1189 'processors' => array ('smc2-combo-25-to-28', 'smc2-1000T-25-to-28', 'smc2-any-100TX'),
1190 ),
1191 );
1192
1193 global $swtype_pcre;
1194 $swtype_pcre = array
1195 (
1196 '/Huawei Versatile Routing Platform Software.+VRP.+Software, Version 5.30 /s' => 1360,
1197 '/Huawei Versatile Routing Platform Software.+VRP.+Software, Version 5.50 /s' => 1361,
1198 '/Huawei Versatile Routing Platform Software.+VRP.+Software,\s*Version 5.70 /is' => 1369,
1199 // FIXME: get sysDescr for IronWare 5 and add a pattern
1200 '/^Brocade Communications Systems.+, IronWare Version 07\./' => 1364,
1201 '/^Juniper Networks,.+JUNOS 9\./' => 1366,
1202 '/^Juniper Networks,.+JUNOS 10\./' => 1367,
1203 );
1204
1205 function updateStickerForCell ($cell, $attr_id, $new_value)
1206 {
1207 if (!strlen ($cell['attrs'][$attr_id]['value']) && strlen ($new_value))
1208 commitUpdateAttrValue ($cell['id'], $attr_id, $new_value);
1209 }
1210
1211 // Accept "X-Y" on input and make sure, that PortInterfaceCompat contains
1212 // a record with IIF id = X and OIF id = Y.
1213 function checkPIC ($port_type_id)
1214 {
1215 $matches = array();
1216 switch (1)
1217 {
1218 case preg_match ('/^([[:digit:]]+)-([[:digit:]]+)$/', $port_type_id, $matches):
1219 $iif_id = $matches[1];
1220 $oif_id = $matches[2];
1221 break;
1222 case preg_match ('/^([[:digit:]]+)$/', $port_type_id, $matches):
1223 $iif_id = 1;
1224 $oif_id = $matches[1];
1225 break;
1226 default:
1227 return;
1228 }
1229 foreach (getPortInterfaceCompat() as $record)
1230 if ($record['iif_id'] == $iif_id and $record['oif_id'] == $oif_id)
1231 return;
1232 commitSupplementPIC ($iif_id, $oif_id);
1233 }
1234
1235 $msgcode['doSNMPmining']['ERR1'] = 161;
1236 $msgcode['doSNMPmining']['ERR2'] = 162;
1237 function doSNMPmining ($object_id, $snmpsetup)
1238 {
1239 $objectInfo = spotEntity ('object', $object_id);
1240 $objectInfo['attrs'] = getAttrValues ($object_id);
1241 $endpoints = findAllEndpoints ($object_id, $objectInfo['name']);
1242 if (count ($endpoints) == 0)
1243 return showFuncMessage (__FUNCTION__, 'ERR1'); // endpoint not found
1244 if (count ($endpoints) > 1)
1245 return showFuncMessage (__FUNCTION__, 'ERR2'); // can't pick an address
1246
1247 switch ($objectInfo['objtype_id'])
1248 {
1249 case 7:
1250 case 8:
1251 $device = new RTSNMPDevice ($endpoints[0], $snmpsetup);
1252 return doSwitchSNMPmining ($objectInfo, $device);
1253 case 2:
1254 $device = new APCPowerSwitch ($endpoints[0], $snmpsetup);
1255 return doPDUSNMPmining ($objectInfo, $device);
1256 }
1257 }
1258
1259 $msgcode['doSwitchSNMPmining']['ERR3'] = 188;
1260 $msgcode['doSwitchSNMPmining']['ERR4'] = 189;
1261 function doSwitchSNMPmining ($objectInfo, $device)
1262 {
1263 global $known_switches, $iftable_processors;
1264
1265 if (FALSE === ($sysObjectID = $device->snmpget ('sysObjectID.0')))
1266 return showFuncMessage (__FUNCTION__, 'ERR3'); // // fatal SNMP failure
1267 $sysObjectID = preg_replace ('/^.*(enterprises\.)([\.[:digit:]]+)$/', '\\2', $sysObjectID);
1268 $sysName = substr ($device->snmpget ('sysName.0'), strlen ('STRING: '));
1269 $sysDescr = substr ($device->snmpget ('sysDescr.0'), strlen ('STRING: '));
1270 $sysDescr = str_replace (array ("\n", "\r"), " ", $sysDescr); // Make it one line
1271 if (!isset ($known_switches[$sysObjectID]))
1272 return showFuncMessage (__FUNCTION__, 'ERR4', array ($sysObjectID)); // unknown OID
1273 showSuccess ($known_switches[$sysObjectID]['text']);
1274 foreach (array_keys ($known_switches[$sysObjectID]['processors']) as $pkey)
1275 if (!array_key_exists ($known_switches[$sysObjectID]['processors'][$pkey], $iftable_processors))
1276 {
1277 showWarning ('processor "' . $known_switches[$sysObjectID]['processors'][$pkey] . '" not found');
1278 unset ($known_switches[$sysObjectID]['processors'][$pkey]);
1279 }
1280 updateStickerForCell ($objectInfo, 2, $known_switches[$sysObjectID]['dict_key']);
1281 updateStickerForCell ($objectInfo, 3, $sysName);
1282 switch (1)
1283 {
1284 case preg_match ('/^9\.1\./', $sysObjectID): // Catalyst
1285 $exact_release = preg_replace ('/^.*, Version ([^ ]+), .*$/', '\\1', $sysDescr);
1286 $major_line = preg_replace ('/^([[:digit:]]+\.[[:digit:]]+)[^[:digit:]].*/', '\\1', $exact_release);
1287 $ios_codes = array
1288 (
1289 '12.0' => 244,
1290 '12.1' => 251,
1291 '12.2' => 252,
1292 );
1293 updateStickerForCell ($objectInfo, 5, $exact_release);
1294 if (array_key_exists ($major_line, $ios_codes))
1295 updateStickerForCell ($objectInfo, 4, $ios_codes[$major_line]);
1296 $sysChassi = $device->snmpget ('1.3.6.1.4.1.9.3.6.3.0');
1297 if ($sysChassi !== FALSE or $sysChassi !== NULL)
1298 updateStickerForCell ($objectInfo, 1, str_replace ('"', '', substr ($sysChassi, strlen ('STRING: '))));
1299 checkPIC ('1-29');
1300 commitAddPort ($objectInfo['id'], 'con0', '1-29', 'console', ''); // RJ-45 RS-232 console
1301 // blade devices are powered through internal circuitry of chassis
1302 if ($sysObjectID != '9.1.749' and $sysObjectID != '9.1.920')
1303 {
1304 checkPIC ('1-16'); // AC input
1305 commitAddPort ($objectInfo['id'], 'AC-in', '1-16', '', '');
1306 }
1307 break;
1308 case preg_match ('/^9\.12\.3\.1\.3\./', $sysObjectID): // Nexus
1309 $exact_release = preg_replace ('/^.*, Version ([^ ]+), .*$/', '\\1', $sysDescr);
1310 $major_line = preg_replace ('/^([[:digit:]]+\.[[:digit:]]+)[^[:digit:]].*/', '\\1', $exact_release);
1311 $nxos_codes = array
1312 (
1313 '4.0' => 963,
1314 '4.1' => 964,
1315 );
1316 if (array_key_exists ($major_line, $nxos_codes))
1317 updateStickerForCell ($objectInfo, 4, $nxos_codes[$major_line]);
1318 updateStickerForCell ($objectInfo, 5, $exact_release);
1319 $sysChassi = $device->snmpget ('1.3.6.1.2.1.47.1.1.1.1.11.149');
1320 if ($sysChassi !== FALSE or $sysChassi !== NULL)
1321 updateStickerForCell ($objectInfo, 1, str_replace ('"', '', substr ($sysChassi, strlen ('STRING: '))));
1322 checkPIC ('1-29');
1323 commitAddPort ($objectInfo['id'], 'con0', '1-29', 'console', ''); // RJ-45 RS-232 console
1324 checkPIC ('1-16'); // AC input
1325 commitAddPort ($objectInfo['id'], 'AC-in-1', '1-16', 'AC1', '');
1326 commitAddPort ($objectInfo['id'], 'AC-in-2', '1-16', 'AC2', '');
1327 break;
1328 case preg_match ('/^11\.2\.3\.7\.11\.(\d+)$/', $sysObjectID, $matches): // ProCurve
1329 $console_per_product = array
1330 (
1331 79 => '1-29', # RJ-45 RS-232
1332 86 => '1-29',
1333 87 => '1-29',
1334 63 => '1-29',
1335 19 => '1-681', # DB-9 RS-232
1336 );
1337 if (array_key_exists ($matches[1], $console_per_product))
1338 {
1339 checkPIC ($console_per_product[$matches[1]]);
1340 commitAddPort ($objectInfo['id'], '', $console_per_product[$matches[1]], 'Console', '');
1341 }
1342 $exact_release = preg_replace ('/^.* revision ([^ ]+), .*$/', '\\1', $sysDescr);
1343 updateStickerForCell ($objectInfo, 5, $exact_release);
1344 break;
1345 case preg_match ('/^4526\.100\.2\./', $sysObjectID): // NETGEAR
1346 checkPIC ('1-681');
1347 commitAddPort ($objectInfo['id'], 'console', '1-681', 'console', ''); // DB-9 RS-232 console
1348 break;
1349 case preg_match ('/^2011\.2\.23\./', $sysObjectID): // Huawei
1350 detectSoftwareType ($objectInfo, $sysDescr);
1351 checkPIC ('1-681');
1352 commitAddPort ($objectInfo['id'], 'con0', '1-681', 'console', ''); // DB-9 RS-232 console
1353 break;
1354 case '2636.1.1.1.2.31' == $sysObjectID: // Juniper EX4200
1355 detectSoftwareType ($objectInfo, $sysDescr);
1356 checkPIC ('1-29');
1357 commitAddPort ($objectInfo['id'], 'con', '1-29', 'CON', ''); // RJ-45 RS-232 console
1358 // EX4200-24T is already in DB
1359 if (preg_match ('/^Juniper Networks, Inc. ex4200-48t internet router/', $sysDescr))
1360 updateStickerForCell ($objectInfo, 2, 907);
1361 break;
1362 case preg_match ('/^2636\.1\.1\.1\.2\./', $sysObjectID): // Juniper
1363 detectSoftwareType ($objectInfo, $sysDescr);
1364 checkPIC ('1-681');
1365 commitAddPort ($objectInfo['id'], 'console', '1-681', 'console', ''); // DB-9 RS-232 console
1366 break;
1367 case preg_match ('/^1991\.1\.3\.45\./', $sysObjectID): // snFGSFamily
1368 case preg_match ('/^1991\.1\.3\.46\./', $sysObjectID): // snFLSFamily
1369 case preg_match ('/^1991\.1\.3\.54\.2\.4\.1\.1$/', $sysObjectID): // FCX 648
1370 detectSoftwareType ($objectInfo, $sysDescr);
1371 $exact_release = preg_replace ('/^.*, IronWare Version ([^ ]+) .*$/', '\\1', $sysDescr);
1372 updateStickerForCell ($objectInfo, 5, $exact_release);
1373 # FOUNDRY-SN-AGENT-MIB::snChasSerNum.0
1374 $sysChassi = $device->snmpget ('enterprises.1991.1.1.1.1.2.0');
1375 if ($sysChassi !== FALSE or $sysChassi !== NULL)
1376 updateStickerForCell ($objectInfo, 1, str_replace ('"', '', substr ($sysChassi, strlen ('STRING: '))));
1377
1378 # Type of uplink module installed.
1379 # table: FOUNDRY-SN-AGENT-MIB::snAgentBrdMainBrdDescription
1380 # Possible part numbers are:
1381 # FGS-1XG1XGC (one fixed CX4 port)
1382 # FGS-2XGC (two fixed CX4 ports)
1383 # FGS-2XG (two XFP slots)
1384 # And for FLS result (which is not handled here) would be:
1385 # 1991.1.1.2.2.1.1.2.1 = STRING: "FLS-24G 24-port Management Module"
1386 # 1991.1.1.2.2.1.1.2.3 = STRING: "FLS-1XG 1-port 10G Module (1-XFP)"
1387 # 1991.1.1.2.2.1.1.2.4 = STRING: "FLS-1XG 1-port 10G Module (1-XFP)"
1388 # (assuming, that the device has 2 XFP modules in slots 3 and 4).
1389
1390 foreach ($device->snmpwalkoid ('enterprises.1991.1.1.2.2.1.1.2') as $module_raw)
1391 if (preg_match ('/^STRING: "(FGS-1XG1XGC|FGS-2XGC) /i', $module_raw))
1392 {
1393 $iftable_processors['fgs-uplinks']['dict_key'] = '1-40'; // CX4
1394 break;
1395 }
1396
1397 # AC inputs
1398 # table: FOUNDRY-SN-AGENT-MIB::snChasPwrSupplyDescription
1399 # "Power supply 1 "
1400 # "Power supply 2 "
1401 foreach ($device->snmpwalkoid ('enterprises.1991.1.1.1.2.1.1.2') as $PSU_raw)
1402 {
1403 $count = 0;
1404 $PSU_cooked = trim (preg_replace ('/^string: "(.+)"$/i', '\\1', $PSU_raw, 1, $count));
1405 if ($count)
1406 {
1407 checkPIC ('1-16');
1408 commitAddPort ($objectInfo['id'], $PSU_cooked, '1-16', '', '');
1409 }
1410 }
1411 # fixed console port
1412 checkPIC ('1-681');
1413 commitAddPort ($objectInfo['id'], 'console', '1-681', 'console', ''); // DB-9 RS-232 console
1414 break;
1415 case preg_match ('/^1916\.2\./', $sysObjectID): // Extreme Networks Summit
1416 $xos_release = preg_replace ('/^ExtremeXOS version ([[:digit:]]+)\..*$/', '\\1', $sysDescr);
1417 $xos_codes = array
1418 (
1419 '10' => 1350,
1420 '11' => 1351,
1421 '12' => 1352,
1422 );
1423 if (array_key_exists ($xos_release, $xos_codes))
1424 updateStickerForCell ($objectInfo, 4, $xos_codes[$xos_release]);
1425 checkPIC ('1-681');
1426 commitAddPort ($objectInfo['id'], 'console', '1-681', 'console', ''); // DB-9 RS-232
1427 checkPIC ('1-16');
1428 commitAddPort ($objectInfo['id'], 'AC-in', '1-16', '', '');
1429 break;
1430 case preg_match ('/^6027\.1\./', $sysObjectID): # Force10
1431 commitAddPort ($objectInfo['id'], 'aux0', '1-29', 'RS-232', ''); // RJ-45 RS-232 console
1432 $m = array();
1433 if (preg_match ('/Force10 Application Software Version: ([\d\.]+)/', $sysDescr, $m))
1434 {
1435 updateStickerForCell ($objectInfo, 5, $m[1]);
1436 $ftos_release = preg_replace ('/^([678])\..+$/', '\\1', $m[1]);
1437 $ftos_codes = array
1438 (
1439 '6' => 1592,
1440 '7' => 1593,
1441 '8' => 1594,
1442 );
1443 if (array_key_exists ($ftos_release, $ftos_codes))
1444 updateStickerForCell ($objectInfo, 4, $ftos_codes[$ftos_release]);
1445 }
1446 # F10-S-SERIES-CHASSIS-MIB::chStackUnitSerialNumber.1
1447 $serialNo = $device->snmpget ('enterprises.6027.3.10.1.2.2.1.12.1');
1448 # F10-S-SERIES-CHASSIS-MIB::chSysPowerSupplyType.1.1
1449 if ($device->snmpget ('enterprises.6027.3.10.1.2.3.1.3.1.1') == 'INTEGER: 1')
1450 {
1451 checkPIC ('1-16');
1452 commitAddPort ($objectInfo['id'], 'PSU0', '1-16', 'PSU0', '');
1453 }
1454 # F10-S-SERIES-CHASSIS-MIB::chSysPowerSupplyType.1.2
1455 if ($device->snmpget ('enterprises.6027.3.10.1.2.3.1.3.1.2') == 'INTEGER: 1')
1456 {
1457 checkPIC ('1-16');
1458 commitAddPort ($objectInfo['id'], 'PSU1', '1-16', 'PSU1', '');
1459 }
1460 if (strlen ($serialNo))
1461 updateStickerForCell ($objectInfo, 1, str_replace ('"', '', substr ($serialNo, strlen ('STRING: '))));
1462 break;
1463 case preg_match ('/^202\.20\./', $sysObjectID): // SMC TigerSwitch
1464 checkPIC ('1-681');
1465 commitAddPort ($objectInfo['id'], 'console', '1-681', '', ''); // DB-9 RS-232
1466 checkPIC ('1-16');
1467 commitAddPort ($objectInfo['id'], 'AC-in', '1-16', '', '');
1468 break;
1469 default: // Nortel...
1470 break;
1471 }
1472 $ifInfo = array();
1473 $tablename = 'ifDescr';
1474 foreach ($device->snmpwalkoid ($tablename) as $oid => $value)
1475 {
1476 $randomindex = preg_replace ("/^.*${tablename}\.(.+)\$/", '\\1', $oid);
1477 $value = trim (preg_replace ('/^.+: (.+)$/', '\\1', $value), '"');
1478 $ifInfo[$randomindex][$tablename] = $value;
1479 }
1480 $tablename = 'ifPhysAddress';
1481 foreach ($device->snmpwalkoid ($tablename) as $oid => $value)
1482 {
1483 $randomindex = preg_replace ("/^.*${tablename}\.(.+)\$/", '\\1', $oid);
1484 $value = trim ($value);
1485 // NET-SNMP may return MAC addresses in one of two (?) formats depending on
1486 // DISPLAY-HINT internal database. The best we can do about it is to accept both.
1487 // Bug originally reported by Walery Wysotsky against openSUSE 11.0.
1488 if (preg_match ('/^string: [0-9a-f]{1,2}(:[0-9a-f]{1,2}){5}/i', $value)) // STRING: x:yy:z:xx:y:zz
1489 {
1490 list ($dummy, $value) = explode (' ', $value);
1491 $addrbytes = explode (':', $value);
1492 foreach ($addrbytes as $bidx => $bytestr)
1493 if (strlen ($bytestr) == 1)
1494 $addrbytes[$bidx] = '0' . $bytestr;
1495 }
1496 elseif (preg_match ('/^hex-string:( [0-9a-f]{2}){6}/i', $value)) // Hex-STRING: xx yy zz xx yy zz
1497 $addrbytes = explode (' ', substr ($value, -17));
1498 elseif (preg_match ('/22[0-9a-f]{12}22$/', bin2hex ($value))) // STRING: "??????"
1499 $addrbytes = array (substr (bin2hex ($value), -14, 12));
1500 else
1501 continue; // martian format
1502 $ifInfo[$randomindex][$tablename] = implode ('', $addrbytes);
1503 }
1504 // process each interface only once regardless of how many processors we have to run
1505 foreach ($ifInfo as $iface)
1506 foreach ($known_switches[$sysObjectID]['processors'] as $processor_name)
1507 {
1508 $newname = preg_replace ($iftable_processors[$processor_name]['pattern'], $iftable_processors[$processor_name]['replacement'], $iface['ifDescr'], 1, $count);
1509 if ($newname === NULL)
1510 {
1511 showError ('PCRE pattern error, terminating');
1512 break 2;
1513 }
1514 if (!$count)
1515 continue; // try next processor on current port
1516 $newlabel = preg_replace ($iftable_processors[$processor_name]['pattern'], $iftable_processors[$processor_name]['label'], $iface['ifDescr'], 1, $count);
1517 checkPIC ($iftable_processors[$processor_name]['dict_key']);
1518 commitAddPort ($objectInfo['id'], $newname, $iftable_processors[$processor_name]['dict_key'], $newlabel, $iface['ifPhysAddress']);
1519 if (!$iftable_processors[$processor_name]['try_next_proc']) // done with this port
1520 continue 2;
1521 }
1522 // No failure up to this point, thus leave current tab for the "Ports" one.
1523 return buildRedirectURL (NULL, 'ports');
1524 }
1525
1526 function doPDUSNMPmining ($objectInfo, $switch)
1527 {
1528 global $known_APC_SKUs;
1529 if (FALSE !== ($dict_key = array_search ($switch->getHWModel(), $known_APC_SKUs)))
1530 updateStickerForCell ($objectInfo, 2, $dict_key);
1531 updateStickerForCell ($objectInfo, 1, $switch->getHWSerial());
1532 updateStickerForCell ($objectInfo, 3, $switch->getName());
1533 updateStickerForCell ($objectInfo, 5, $switch->getFWRev());
1534 checkPIC ('1-16');
1535 commitAddPort ($objectInfo['id'], 'input', '1-16', 'input', '');
1536 $portno = 1;
1537 foreach ($switch->getPorts() as $name => $port)
1538 {
1539 $label = mb_strlen ($port[0]) ? $port[0] : $portno;
1540 checkPIC ('1-1322');
1541 commitAddPort ($objectInfo['id'], $portno, '1-1322', $port[0], '');
1542 $portno++;
1543 }
1544 showSuccess ("Added ${portno} port(s)");
1545 return buildRedirectURL (NULL, 'ports');
1546 }
1547
1548 // APC SNMP code by Russ Garrett
1549 define('APC_STATUS_ON', 1);
1550 define('APC_STATUS_OFF', 2);
1551 define('APC_STATUS_REBOOT', 3);
1552
1553 class RTSNMPDevice {
1554 protected $snmp;
1555
1556 function __construct($hostname, $snmpsetup) {
1557 if( isset($snmpsetup['community']) ) {
1558 $this->snmp = new RTSNMPv2($hostname, $snmpsetup);
1559 }
1560 else {
1561 $this->snmp = new RTSNMPv3($hostname, $snmpsetup);
1562 }
1563
1564 }
1565
1566 function getName() {
1567 return $this->getString('sysName.0');
1568 }
1569
1570 function getDescription() {
1571 return $this->getString('sysDescr.0');
1572 }
1573
1574 function snmpget($oid) {
1575 return $this->snmp->snmpget($oid);
1576 }
1577
1578 function snmpwalkoid($oid) {
1579 return $this->snmp->snmpwalkoid($oid);
1580 }
1581
1582 protected function snmpSet($oid, $type, $value) {
1583 return $this->snmp->snmpset($oid, $type, $value);
1584 }
1585
1586 protected function getString($oid) {
1587 return trim(str_replace('STRING: ', '', $this->snmp->snmpget($oid)), '"');
1588 }
1589 }
1590
1591 abstract class RTSNMP {
1592 protected $hostname;
1593 protected $snmpsetup;
1594
1595 function __construct($hostname, $snmpsetup) {
1596 $this->hostname = $hostname;
1597 $this->snmpsetup = $snmpsetup;
1598 }
1599
1600 abstract function snmpget($oid);
1601 abstract function snmpset($oid, $type, $value);
1602 abstract function snmpwalkoid($oid);
1603 }
1604
1605 class RTSNMPv2 extends RTSNMP {
1606 function snmpget($oid) {
1607 return snmpget($this->hostname, $this->snmpsetup['community'], $oid);
1608 }
1609
1610 function snmpset($oid, $type, $value) {
1611 return snmpset($this->hostname, $this->snmpsetup['community'], $oid, $type, $value);
1612 }
1613
1614 function snmpwalkoid($oid) {
1615 return snmpwalkoid($this->hostname, $this->snmpsetup['community'], $oid);
1616 }
1617 }
1618
1619 class RTSNMPv3 extends RTSNMP {
1620 function snmpget($oid) {
1621 return snmp3_get($this->hostname, $this->snmpsetup['sec_name'], $this->snmpsetup['sec_level'], $this->snmpsetup['auth_protocol'], $this->snmpsetup['auth_passphrase'], $this->snmpsetup['priv_protocol'], $this->snmpsetup['priv_passphrase'], $oid);
1622 }
1623
1624 function snmpset($oid, $type, $value) {
1625 return snmp3_set($this->hostname, $this->snmpsetup['sec_name'], $this->snmpsetup['sec_level'], $this->snmpsetup['auth_protocol'], $this->snmpsetup['auth_passphrase'], $this->snmpsetup['priv_protocol'], $this->snmpsetup['priv_passphrase'], $oid, $type, $value);
1626 }
1627
1628 function snmpwalkoid($oid) {
1629 return snmp3_real_walk($this->hostname, $this->snmpsetup['sec_name'], $this->snmpsetup['sec_level'], $this->snmpsetup['auth_protocol'], $this->snmpsetup['auth_passphrase'], $this->snmpsetup['priv_protocol'], $this->snmpsetup['priv_passphrase'], $oid);
1630 }
1631 }
1632
1633 class APCPowerSwitch extends RTSNMPDevice {
1634 protected $snmpMib = 'SNMPv2-SMI::enterprises.318';
1635
1636 function getPorts() {
1637 $data = $this->snmpwalk("{$this->snmpMib}.1.1.12.3.3.1.1.2");
1638 $status = $this->snmpwalk("{$this->snmpMib}.1.1.12.3.3.1.1.4");
1639 $out = array();
1640 foreach ($data as $id => $d) {
1641 $out[$id + 1] = array(trim(str_replace('STRING: ', '', $d), '"'), str_replace('INTEGER: ', '', $status[$id]));
1642 }
1643 return $out;
1644 }
1645
1646 function getPortStatus($id) {
1647 return trim($this->snmpget("{$this->snmpMib}.1.1.12.3.3.1.1.4.$id"), 'INTEGER: ');
1648 }
1649
1650 function getPortName($id) {
1651 return trim(str_replace('STRING: ', '', $this->snmpget("{$this->snmpMib}.1.1.12.3.3.1.1.2.$id")), '"');
1652 }
1653
1654 function setPortName($id, $name) {
1655 return $this->snmpset("{$this->snmpMib}.1.1.4.5.2.1.3.$id", 's', $name);
1656 }
1657
1658 function portOff($id) {
1659 return $this->snmpSet("{$this->snmpMib}.1.1.12.3.3.1.1.4.$id", 'i', APC_STATUS_OFF);
1660 }
1661
1662 function portOn($id) {
1663 return $this->snmpSet("{$this->snmpMib}.1.1.12.3.3.1.1.4.$id", 'i', APC_STATUS_ON);
1664 }
1665
1666 function portReboot($id) {
1667 return $this->snmpSet("{$this->snmpMib}.1.1.12.3.3.1.1.4.$id", 'i', APC_STATUS_REBOOT);
1668 }
1669 // rPDUIdentFirmwareRev.0 == .1.3.6.1.4.1.318.1.1.12.1.3.0 = STRING: "vN.N.N"
1670 function getFWRev()
1671 {
1672 return preg_replace ('/^STRING: "(.+)"$/', '\\1', $this->snmpget ("{$this->snmpMib}.1.1.12.1.3.0"));
1673 }
1674 // rPDUIdentSerialNumber.0 == .1.3.6.1.4.1.318.1.1.12.1.6.0 = STRING: "XXXXXXXXXXX"
1675 function getHWSerial()
1676 {
1677 return preg_replace ('/^STRING: "(.+)"$/', '\\1', $this->snmpget ("{$this->snmpMib}.1.1.12.1.6.0"));
1678 }
1679 // rPDUIdentModelNumber.0 == .1.3.6.1.4.1.318.1.1.12.1.5.0 = STRING: "APnnnn"
1680 function getHWModel()
1681 {
1682 return preg_replace ('/^STRING: "(.*)"$/', '\\1', $this->snmpget ("{$this->snmpMib}.1.1.12.1.5.0"));
1683 }
1684 }
1685
1686 // Take address in the form XX:XX:XX:XX:XX:XX and return the next
1687 // address in the same form.
1688 function nextMACAddress ($addr)
1689 {
1690 if ($addr == '')
1691 return '';
1692 $bytes = array();
1693 foreach (explode (':', $addr) as $hex)
1694 $bytes[] = hexdec ($hex);
1695 for ($i = 5; $i >= 0; $i--)
1696 {
1697 $bytes[$i] += 1;
1698 if ($bytes[$i] <= 255) // FF
1699 break; // no roll over
1700 $bytes[$i] = 0;
1701 }
1702 foreach (array_keys ($bytes) as $key)
1703 $bytes[$key] = sprintf ('%02X', $bytes[$key]);
1704 return implode (':', $bytes);
1705 }
1706
1707 function generatePortsForCatModule ($object_id, $slotno = 1, $mtype = 'X6748', $mac_address = '')
1708 {
1709 global $dbxlink;
1710 $mac_address = l2addressFromDatabase (l2addressForDatabase ($mac_address));
1711 switch ($mtype)
1712 {
1713 case 'WS-X6748-GE-TX':
1714 $dbxlink->beginTransaction();
1715 for ($i = 1; $i <= 48; $i++)
1716 {
1717 commitAddPort ($object_id, "gi${slotno}/${i}", '1-24', "slot ${slotno} port ${i}", $mac_address);
1718 $mac_address = nextMACAddress ($mac_address);
1719 }
1720 $dbxlink->commit();
1721 break;
1722 case 'WS-X6708-10GE':
1723 for ($i = 1; $i <= 8; $i++)
1724 {
1725 commitAddPort ($object_id, "te${slotno}/${i}", '6-1080', "slot ${slotno} port ${i}", $mac_address);
1726 $mac_address = nextMACAddress ($mac_address);
1727 }
1728 break;
1729 case 'WS-X6704-10GE':
1730 for ($i = 1; $i <= 4; $i++)
1731 {
1732 commitAddPort ($object_id, "te${slotno}/${i}", '5-1079', "slot ${slotno} port ${i}", $mac_address);
1733 $mac_address = nextMACAddress ($mac_address);
1734 }
1735 break;
1736 case 'VS-S720-10G':
1737 commitAddPort ($object_id, "gi${slotno}/1", '4-1077', "slot ${slotno} port 1", $mac_address);
1738 $mac_address = nextMACAddress ($mac_address);
1739 commitAddPort ($object_id, "gi${slotno}/2", '4-1077', "slot ${slotno} port 2", $mac_address);
1740 $mac_address = nextMACAddress ($mac_address);
1741 commitAddPort ($object_id, "gi${slotno}/3", '1-24', "slot ${slotno} port 3", $mac_address);
1742 $mac_address = nextMACAddress ($mac_address);
1743 commitAddPort ($object_id, "te${slotno}/4", '6-1080', "slot ${slotno} port 4", $mac_address);
1744 $mac_address = nextMACAddress ($mac_address);
1745 commitAddPort ($object_id, "te${slotno}/5", '6-1080', "slot ${slotno} port 5", $mac_address);
1746 break;
1747 case '3750G-24TS':
1748 // MAC address of 1st port is the next one after switch's address
1749 $mac_address = nextMACAddress ($mac_address);
1750 for ($i = 1; $i <= 24; $i++)
1751 {
1752 commitAddPort ($object_id, "gi${slotno}/0/${i}", '1-24', "unit ${slotno} port ${i}", $mac_address);
1753 $mac_address = nextMACAddress ($mac_address);
1754 }
1755 for ($i = 25; $i <= 28; $i++)
1756 {
1757 commitAddPort ($object_id, "gi${slotno}/0/${i}", '4-1077', "unit ${slotno} port ${i}", $mac_address);
1758 $mac_address = nextMACAddress ($mac_address);
1759 }
1760 break;
1761 case '3750G-24T':
1762 $mac_address = nextMACAddress ($mac_address);
1763 for ($i = 1; $i <= 24; $i++)
1764 {
1765 commitAddPort ($object_id, "gi${slotno}/0/${i}", '1-24', "unit ${slotno} port ${i}", $mac_address);
1766 $mac_address = nextMACAddress ($mac_address);
1767 }
1768 break;
1769 case '3750G-16TD':
1770 $mac_address = nextMACAddress ($mac_address);
1771 for ($i = 1; $i <= 16; $i++)
1772 {
1773 commitAddPort ($object_id, "gi${slotno}/0/${i}", '1-24', "unit ${slotno} port ${i}", $mac_address);
1774 $mac_address = nextMACAddress ($mac_address);
1775 }
1776 commitAddPort ($object_id, "te${slotno}/0/1", '5-1079', "unit ${slotno} port ${i}", $mac_address);
1777 break;
1778 case 'LE02G48TA':
1779 for ($i = 0; $i <= 47; $i++)
1780 commitAddPort ($object_id, "gi${slotno}/0/${i}", '1-24', "slot ${slotno} port ${i}", $mac_address);
1781 break;
1782 case 'LE02X12SA':
1783 for ($i = 0; $i <= 11; $i++)
1784 commitAddPort ($object_id, "gi${slotno}/0/${i}", '9-1084', "slot ${slotno} port ${i}", $mac_address);
1785 break;
1786 }
1787 }
1788
1789 function detectSoftwareType ($objectInfo, $sysDescr)
1790 {
1791 global $swtype_pcre;
1792 foreach ($swtype_pcre as $pattern => $dict_key)
1793 if (preg_match ($pattern, $sysDescr))
1794 {
1795 updateStickerForCell ($objectInfo, 4, $dict_key);
1796 return;
1797 }
1798 }
1799 ?>