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