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