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