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