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