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