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