r4631 maintenance pre-release changes
[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(
f0255d01 35 'pattern' => '@^GigabitEthernet([[:digit:]]+/)?([[:digit:]]+)$@',
6be06cbb
DO
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)
8ab645cf 974 return showFuncMessage (__FUNCTION__, 'ERR1'); // endpoint not found
74aee2dc 975 if (count ($endpoints) > 1)
8ab645cf 976 return showFuncMessage (__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 993{
4848a7e3 994 global $known_switches, $iftable_processors;
74aee2dc 995
8228bdb4 996 if (FALSE === ($sysObjectID = $device->snmpget ('sysObjectID.0')))
8ab645cf 997 return showFuncMessage (__FUNCTION__, 'ERR3'); // // fatal SNMP failure
84986395 998 $sysObjectID = preg_replace ('/^.*(enterprises\.)([\.[:digit:]]+)$/', '\\2', $sysObjectID);
8228bdb4
DO
999 $sysName = substr ($device->snmpget ('sysName.0'), strlen ('STRING: '));
1000 $sysDescr = substr ($device->snmpget ('sysDescr.0'), strlen ('STRING: '));
74aee2dc
DO
1001 $sysDescr = str_replace (array ("\n", "\r"), " ", $sysDescr); // Make it one line
1002 if (!isset ($known_switches[$sysObjectID]))
8ab645cf 1003 return showFuncMessage (__FUNCTION__, 'ERR4', array ($sysObjectID)); // unknown OID
5e193b67
DO
1004 foreach (array_keys ($known_switches[$sysObjectID]['processors']) as $pkey)
1005 if (!array_key_exists ($known_switches[$sysObjectID]['processors'][$pkey], $iftable_processors))
1006 {
8ab645cf 1007 showWarning ('processor "' . $known_switches[$sysObjectID]['processors'][$pkey] . '" not found');
5e193b67
DO
1008 unset ($known_switches[$sysObjectID]['processors'][$pkey]);
1009 }
56a797ef 1010 updateStickerForCell ($objectInfo, 2, $known_switches[$sysObjectID]['dict_key']);
74aee2dc 1011 updateStickerForCell ($objectInfo, 3, $sysName);
8ab645cf 1012 showOneLiner (81, array ('generic'));
74aee2dc
DO
1013 switch (1)
1014 {
56a797ef 1015 case preg_match ('/^9\.1\./', $sysObjectID): // Catalyst
84986395
DO
1016 $exact_release = preg_replace ('/^.*, Version ([^ ]+), .*$/', '\\1', $sysDescr);
1017 $major_line = preg_replace ('/^([[:digit:]]+\.[[:digit:]]+)[^[:digit:]].*/', '\\1', $exact_release);
74aee2dc
DO
1018 $ios_codes = array
1019 (
1020 '12.0' => 244,
1021 '12.1' => 251,
1022 '12.2' => 252,
1023 );
1024 updateStickerForCell ($objectInfo, 5, $exact_release);
6be06cbb
DO
1025 if (array_key_exists ($major_line, $ios_codes))
1026 updateStickerForCell ($objectInfo, 4, $ios_codes[$major_line]);
8228bdb4 1027 $sysChassi = $device->snmpget ('1.3.6.1.4.1.9.3.6.3.0');
74aee2dc
DO
1028 if ($sysChassi !== FALSE or $sysChassi !== NULL)
1029 updateStickerForCell ($objectInfo, 1, str_replace ('"', '', substr ($sysChassi, strlen ('STRING: '))));
bdc91a5c
DO
1030 checkPIC ('1-29');
1031 commitAddPort ($objectInfo['id'], 'con0', '1-29', 'console', ''); // RJ-45 RS-232 console
facd0235
DO
1032 // blade devices are powered through internal circuitry of chassis
1033 if ($sysObjectID != '9.1.749' and $sysObjectID != '9.1.920')
1034 {
1035 checkPIC ('1-16'); // AC input
1036 commitAddPort ($objectInfo['id'], 'AC-in', '1-16', '', '');
1037 }
8ab645cf 1038 showOneLiner (81, array ('catalyst-generic'));
74aee2dc 1039 break;
56a797ef 1040 case preg_match ('/^9\.12\.3\.1\.3\./', $sysObjectID): // Nexus
84986395
DO
1041 $exact_release = preg_replace ('/^.*, Version ([^ ]+), .*$/', '\\1', $sysDescr);
1042 $major_line = preg_replace ('/^([[:digit:]]+\.[[:digit:]]+)[^[:digit:]].*/', '\\1', $exact_release);
74aee2dc
DO
1043 $nxos_codes = array
1044 (
1045 '4.0' => 963,
1046 '4.1' => 964,
1047 );
6be06cbb
DO
1048 if (array_key_exists ($major_line, $nxos_codes))
1049 updateStickerForCell ($objectInfo, 4, $nxos_codes[$major_line]);
74aee2dc 1050 updateStickerForCell ($objectInfo, 5, $exact_release);
bdc91a5c 1051 checkPIC ('1-29');
24a6e3a2 1052 commitAddPort ($objectInfo['id'], 'con0', '1-29', 'console', ''); // RJ-45 RS-232 console
dcfa87d7
DO
1053 checkPIC ('1-16'); // AC input
1054 commitAddPort ($objectInfo['id'], 'AC-in-1', '1-16', 'AC1', '');
1055 commitAddPort ($objectInfo['id'], 'AC-in-2', '1-16', 'AC2', '');
8ab645cf 1056 showOneLiner (81, array ('nexus-generic'));
74aee2dc 1057 break;
56a797ef 1058 case preg_match ('/^11\.2\.3\.7\.11\./', $sysObjectID): // ProCurve
84986395 1059 $exact_release = preg_replace ('/^.* revision ([^ ]+), .*$/', '\\1', $sysDescr);
74aee2dc 1060 updateStickerForCell ($objectInfo, 5, $exact_release);
8ab645cf 1061 showOneLiner (81, array ('procurve-generic'));
74aee2dc 1062 break;
6be06cbb 1063 case preg_match ('/^4526\.100\.2\./', $sysObjectID): // NETGEAR
bdc91a5c
DO
1064 checkPIC ('1-681');
1065 commitAddPort ($objectInfo['id'], 'console', '1-681', 'console', ''); // DB-9 RS-232 console
8ab645cf 1066 showOneLiner (81, array ('netgear-generic'));
6be06cbb 1067 break;
7d69a266 1068 case preg_match ('/^2011\.2\.23\./', $sysObjectID): // Huawei
1f54e1ba 1069 detectSoftwareType ($objectInfo, $sysDescr);
bdc91a5c 1070 checkPIC ('1-681');
b55f8de3 1071 commitAddPort ($objectInfo['id'], 'con0', '1-681', 'console', ''); // DB-9 RS-232 console
8ab645cf 1072 showOneLiner (81, array ('huawei-generic'));
7d69a266 1073 break;
1f54e1ba
DO
1074 case '2636.1.1.1.2.31' == $sysObjectID: // Juniper EX4200
1075 detectSoftwareType ($objectInfo, $sysDescr);
1076 checkPIC ('1-29');
1077 commitAddPort ($objectInfo['id'], 'con', '1-29', 'CON', ''); // RJ-45 RS-232 console
1078 // EX4200-24T is already in DB
1079 if (preg_match ('/^Juniper Networks, Inc. ex4200-48t internet router/', $sysDescr))
1080 updateStickerForCell ($objectInfo, 2, 907);
8ab645cf 1081 showOneLiner (81, array ('juniper-ex'));
1f54e1ba 1082 break;
7d69a266 1083 case preg_match ('/^2636\.1\.1\.1\.2\./', $sysObjectID): // Juniper
1f54e1ba 1084 detectSoftwareType ($objectInfo, $sysDescr);
bdc91a5c
DO
1085 checkPIC ('1-681');
1086 commitAddPort ($objectInfo['id'], 'console', '1-681', 'console', ''); // DB-9 RS-232 console
8ab645cf 1087 showOneLiner (81, array ('juniper-generic'));
661b3fdb
DO
1088 break;
1089 case preg_match ('/^1991\.1\.3\.45\./', $sysObjectID): // snFGSFamily
6c32c3ff 1090 case preg_match ('/^1991\.1\.3\.46\./', $sysObjectID): // snFLSFamily
ec523868 1091 case preg_match ('/^1991\.1\.3\.54\.2\.4\.1\.1$/', $sysObjectID): // FCX 648
1f54e1ba 1092 detectSoftwareType ($objectInfo, $sysDescr);
84986395 1093 $exact_release = preg_replace ('/^.*, IronWare Version ([^ ]+) .*$/', '\\1', $sysDescr);
661b3fdb
DO
1094 updateStickerForCell ($objectInfo, 5, $exact_release);
1095 # FOUNDRY-SN-AGENT-MIB::snChasSerNum.0
8228bdb4 1096 $sysChassi = $device->snmpget ('enterprises.1991.1.1.1.1.2.0');
661b3fdb
DO
1097 if ($sysChassi !== FALSE or $sysChassi !== NULL)
1098 updateStickerForCell ($objectInfo, 1, str_replace ('"', '', substr ($sysChassi, strlen ('STRING: '))));
1099
1100 # Type of uplink module installed.
1101 # table: FOUNDRY-SN-AGENT-MIB::snAgentBrdMainBrdDescription
1102 # Possible part numbers are:
1103 # FGS-1XG1XGC (one fixed CX4 port)
1104 # FGS-2XGC (two fixed CX4 ports)
1105 # FGS-2XG (two XFP slots)
6c32c3ff
AA
1106 # And for FLS result (which is not handled here) would be:
1107 # 1991.1.1.2.2.1.1.2.1 = STRING: "FLS-24G 24-port Management Module"
1108 # 1991.1.1.2.2.1.1.2.3 = STRING: "FLS-1XG 1-port 10G Module (1-XFP)"
1109 # 1991.1.1.2.2.1.1.2.4 = STRING: "FLS-1XG 1-port 10G Module (1-XFP)"
1110 # (assuming, that the device has 2 XFP modules in slots 3 and 4).
1111
8228bdb4 1112 foreach ($device->snmpwalkoid ('enterprises.1991.1.1.2.2.1.1.2') as $module_raw)
661b3fdb
DO
1113 if (preg_match ('/^STRING: "(FGS-1XG1XGC|FGS-2XGC) /i', $module_raw))
1114 {
1115 $iftable_processors['fgs-uplinks']['dict_key'] = '1-40'; // CX4
1116 break;
1117 }
1118
1119 # AC inputs
1120 # table: FOUNDRY-SN-AGENT-MIB::snChasPwrSupplyDescription
1121 # "Power supply 1 "
1122 # "Power supply 2 "
8228bdb4 1123 foreach ($device->snmpwalkoid ('enterprises.1991.1.1.1.2.1.1.2') as $PSU_raw)
661b3fdb
DO
1124 {
1125 $count = 0;
1126 $PSU_cooked = trim (preg_replace ('/^string: "(.+)"$/i', '\\1', $PSU_raw, 1, $count));
1127 if ($count)
1128 {
1129 checkPIC ('1-16');
1130 commitAddPort ($objectInfo['id'], $PSU_cooked, '1-16', '', '');
1131 }
1132 }
1133 # fixed console port
1134 checkPIC ('1-681');
1135 commitAddPort ($objectInfo['id'], 'console', '1-681', 'console', ''); // DB-9 RS-232 console
8ab645cf 1136 showOneLiner (81, array ('brocade-generic'));
661b3fdb 1137 break;
4eeadb79
DO
1138 case preg_match ('/^1916\.2\./', $sysObjectID): // Extreme Networks Summit
1139 $xos_release = preg_replace ('/^ExtremeXOS version ([[:digit:]]+)\..*$/', '\\1', $sysDescr);
1140 $xos_codes = array
1141 (
1142 '10' => 1350,
1143 '11' => 1351,
1144 '12' => 1352,
1145 );
1146 if (array_key_exists ($xos_release, $xos_codes))
1147 updateStickerForCell ($objectInfo, 4, $xos_codes[$xos_release]);
1148 checkPIC ('1-681');
1149 commitAddPort ($objectInfo['id'], 'console', '1-681', 'console', ''); // DB-9 RS-232
1150 checkPIC ('1-16');
1151 commitAddPort ($objectInfo['id'], 'AC-in', '1-16', '', '');
8ab645cf 1152 showOneLiner (81, array ('summit-generic'));
4eeadb79 1153 break;
7d69a266 1154 default: // Nortel...
74aee2dc
DO
1155 break;
1156 }
56a797ef
DO
1157 $ifInfo = array();
1158 $tablename = 'ifDescr';
8228bdb4 1159 foreach ($device->snmpwalkoid ($tablename) as $oid => $value)
56a797ef 1160 {
84986395
DO
1161 $randomindex = preg_replace ("/^.*${tablename}\.(.+)\$/", '\\1', $oid);
1162 $value = trim (preg_replace ('/^.+: (.+)$/', '\\1', $value), '"');
56a797ef
DO
1163 $ifInfo[$randomindex][$tablename] = $value;
1164 }
1165 $tablename = 'ifPhysAddress';
8228bdb4 1166 foreach ($device->snmpwalkoid ($tablename) as $oid => $value)
56a797ef 1167 {
84986395 1168 $randomindex = preg_replace ("/^.*${tablename}\.(.+)\$/", '\\1', $oid);
56a797ef
DO
1169 $value = trim ($value);
1170 // NET-SNMP may return MAC addresses in one of two (?) formats depending on
1171 // DISPLAY-HINT internal database. The best we can do about it is to accept both.
1172 // Bug originally reported by Walery Wysotsky against openSUSE 11.0.
6a845dce 1173 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
1174 {
1175 list ($dummy, $value) = explode (' ', $value);
1176 $addrbytes = explode (':', $value);
1177 foreach ($addrbytes as $bidx => $bytestr)
1178 if (strlen ($bytestr) == 1)
1179 $addrbytes[$bidx] = '0' . $bytestr;
1180 }
6a845dce 1181 elseif (preg_match ('/^hex-string:( [0-9a-f]{2}){6}/i', $value)) // Hex-STRING: xx yy zz xx yy zz
56a797ef 1182 $addrbytes = explode (' ', substr ($value, -17));
6a845dce
DO
1183 elseif (preg_match ('/22[0-9a-f]{12}22$/', bin2hex ($value))) // STRING: "??????"
1184 $addrbytes = array (substr (bin2hex ($value), -14, 12));
56a797ef
DO
1185 else
1186 continue; // martian format
1187 $ifInfo[$randomindex][$tablename] = implode ('', $addrbytes);
1188 }
1189 // process each interface only once regardless of how many processors we have to run
1190 foreach ($ifInfo as $iface)
1191 foreach ($known_switches[$sysObjectID]['processors'] as $processor_name)
1192 {
56a797ef 1193 $newname = preg_replace ($iftable_processors[$processor_name]['pattern'], $iftable_processors[$processor_name]['replacement'], $iface['ifDescr'], 1, $count);
1f54e1ba
DO
1194 if ($newname === NULL)
1195 {
8ab645cf 1196 showError ('PCRE pattern error, terminating');
1f54e1ba
DO
1197 break 2;
1198 }
56a797ef
DO
1199 if (!$count)
1200 continue; // try next processor on current port
1201 $newlabel = preg_replace ($iftable_processors[$processor_name]['pattern'], $iftable_processors[$processor_name]['label'], $iface['ifDescr'], 1, $count);
bdc91a5c 1202 checkPIC ($iftable_processors[$processor_name]['dict_key']);
73a9a0a0 1203 commitAddPort ($objectInfo['id'], $newname, $iftable_processors[$processor_name]['dict_key'], $newlabel, $iface['ifPhysAddress']);
56a797ef
DO
1204 if (!$iftable_processors[$processor_name]['try_next_proc']) // done with this port
1205 continue 2;
1206 }
1207 foreach ($known_switches[$sysObjectID]['processors'] as $processor_name)
8ab645cf 1208 showOneLiner (81, array ($processor_name));
8536e20a 1209 // No failure up to this point, thus leave current tab for the "Ports" one.
8ab645cf 1210 return buildRedirectURL (NULL, 'ports');
74aee2dc
DO
1211}
1212
8228bdb4 1213function doPDUSNMPmining ($objectInfo, $hostname, $snmpsetup)
38e05b77 1214{
29de85b6 1215 global $known_APC_SKUs;
8228bdb4 1216 $switch = new APCPowerSwitch ($hostname, $snmpsetup);
29de85b6
DO
1217 if (FALSE !== ($dict_key = array_search ($switch->getHWModel(), $known_APC_SKUs)))
1218 updateStickerForCell ($objectInfo, 2, $dict_key);
1219 updateStickerForCell ($objectInfo, 1, $switch->getHWSerial());
4848a7e3 1220 updateStickerForCell ($objectInfo, 3, $switch->getName());
29de85b6 1221 updateStickerForCell ($objectInfo, 5, $switch->getFWRev());
bdc91a5c 1222 checkPIC ('1-16');
29de85b6 1223 commitAddPort ($objectInfo['id'], 'input', '1-16', 'input', '');
4848a7e3
DO
1224 $portno = 1;
1225 foreach ($switch->getPorts() as $name => $port)
29de85b6
DO
1226 {
1227 $label = mb_strlen ($port[0]) ? $port[0] : $portno;
bdc91a5c 1228 checkPIC ('1-1322');
29de85b6
DO
1229 commitAddPort ($objectInfo['id'], $portno, '1-1322', $port[0], '');
1230 $portno++;
1231 }
8ab645cf
AA
1232 showSuccess ("Added ${portno} port(s)");
1233 return buildRedirectURL (NULL, 'ports');
38e05b77
DO
1234}
1235
4848a7e3 1236// APC SNMP code by Russ Garrett
38e05b77
DO
1237define('APC_STATUS_ON', 1);
1238define('APC_STATUS_OFF', 2);
1239define('APC_STATUS_REBOOT', 3);
1240
1241class SNMPDevice {
8228bdb4
DO
1242 protected $snmp;
1243
1244 function __construct($hostname, $snmpsetup) {
1245 if( isset($snmpsetup['community']) ) {
1246 $this->snmp = new SNMPv2($hostname, $snmpsetup);
1247 }
1248 else {
1249 $this->snmp = new SNMPv3($hostname, $snmpsetup);
1250 }
38e05b77 1251
38e05b77
DO
1252 }
1253
1254 function getName() {
1255 return $this->getString('sysName.0');
1256 }
1257
1258 function getDescription() {
1259 return $this->getString('sysDescr.0');
1260 }
8228bdb4
DO
1261
1262 function snmpget($oid) {
1263 return $this->snmp->snmpget($oid);
1264 }
1265
1266 function snmpwalkoid($oid) {
1267 return $this->snmp->snmpwalkoid($oid);
1268 }
38e05b77
DO
1269
1270 protected function snmpSet($oid, $type, $value) {
8228bdb4 1271 return $this->snmp->snmpset($oid, $type, $value);
38e05b77
DO
1272 }
1273
1274 protected function getString($oid) {
8228bdb4
DO
1275 return trim(str_replace('STRING: ', '', $this->snmp->snmpget($oid)), '"');
1276 }
1277}
1278
1279abstract class SNMP {
1280 protected $hostname;
1281 protected $snmpsetup;
1282
1283 function __construct($hostname, $snmpsetup) {
1284 $this->hostname = $hostname;
1285 $this->snmpsetup = $snmpsetup;
1286 }
1287
1288 abstract function snmpget($oid);
1289 abstract function snmpset($oid, $type, $value);
1290 abstract function snmpwalkoid($oid);
1291}
1292
1293class SNMPv2 extends SNMP {
1294 function snmpget($oid) {
1295 return snmpget($this->hostname, $this->snmpsetup['community'], $oid);
1296 }
1297
1298 function snmpset($oid, $type, $value) {
1299 return snmpset($this->hostname, $this->snmpsetup['community'], $oid, $type, $value);
1300 }
1301
1302 function snmpwalkoid($oid) {
1303 return snmpwalkoid($this->hostname, $this->snmpsetup['community'], $oid);
1304 }
1305}
1306
1307class SNMPv3 extends SNMP {
1308 function snmpget($oid) {
1309 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);
1310 }
1311
1312 function snmpset($oid, $type, $value) {
1313 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);
1314 }
1315
1316 function snmpwalkoid($oid) {
1317 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
1318 }
1319}
1320
1321class APCPowerSwitch extends SNMPDevice {
1322 protected $snmpMib = 'SNMPv2-SMI::enterprises.318';
1323
1324 function getPorts() {
8228bdb4
DO
1325 $data = $this->snmpwalk("{$this->snmpMib}.1.1.12.3.3.1.1.2");
1326 $status = $this->snmpwalk("{$this->snmpMib}.1.1.12.3.3.1.1.4");
38e05b77
DO
1327 $out = array();
1328 foreach ($data as $id => $d) {
1329 $out[$id + 1] = array(trim(str_replace('STRING: ', '', $d), '"'), str_replace('INTEGER: ', '', $status[$id]));
1330 }
1331 return $out;
1332 }
1333
1334 function getPortStatus($id) {
8228bdb4 1335 return trim($this->snmpget("{$this->snmpMib}.1.1.12.3.3.1.1.4.$id"), 'INTEGER: ');
38e05b77
DO
1336 }
1337
1338 function getPortName($id) {
8228bdb4 1339 return trim(str_replace('STRING: ', '', $this->snmpget("{$this->snmpMib}.1.1.12.3.3.1.1.2.$id")), '"');
38e05b77
DO
1340 }
1341
1342 function setPortName($id, $name) {
8228bdb4 1343 return $this->snmpset("{$this->snmpMib}.1.1.4.5.2.1.3.$id", 's', $name);
38e05b77
DO
1344 }
1345
1346 function portOff($id) {
1347 return $this->snmpSet("{$this->snmpMib}.1.1.12.3.3.1.1.4.$id", 'i', APC_STATUS_OFF);
1348 }
1349
1350 function portOn($id) {
1351 return $this->snmpSet("{$this->snmpMib}.1.1.12.3.3.1.1.4.$id", 'i', APC_STATUS_ON);
1352 }
1353
1354 function portReboot($id) {
1355 return $this->snmpSet("{$this->snmpMib}.1.1.12.3.3.1.1.4.$id", 'i', APC_STATUS_REBOOT);
1356 }
30ad8bc4
DO
1357 // rPDUIdentFirmwareRev.0 == .1.3.6.1.4.1.318.1.1.12.1.3.0 = STRING: "vN.N.N"
1358 function getFWRev()
1359 {
8228bdb4 1360 return preg_replace ('/^STRING: "(.+)"$/', '\\1', $this->snmpget ("{$this->snmpMib}.1.1.12.1.3.0"));
30ad8bc4
DO
1361 }
1362 // rPDUIdentSerialNumber.0 == .1.3.6.1.4.1.318.1.1.12.1.6.0 = STRING: "XXXXXXXXXXX"
1363 function getHWSerial()
1364 {
8228bdb4 1365 return preg_replace ('/^STRING: "(.+)"$/', '\\1', $this->snmpget ("{$this->snmpMib}.1.1.12.1.6.0"));
30ad8bc4
DO
1366 }
1367 // rPDUIdentModelNumber.0 == .1.3.6.1.4.1.318.1.1.12.1.5.0 = STRING: "APnnnn"
1368 function getHWModel()
1369 {
8228bdb4 1370 return preg_replace ('/^STRING: "(.*)"$/', '\\1', $this->snmpget ("{$this->snmpMib}.1.1.12.1.5.0"));
30ad8bc4 1371 }
38e05b77
DO
1372}
1373
2d511052
DO
1374// Take address in the form XX:XX:XX:XX:XX:XX and return the next
1375// address in the same form.
1376function nextMACAddress ($addr)
1377{
cc000fab
DO
1378 if ($addr == '')
1379 return '';
2d511052
DO
1380 $bytes = array();
1381 foreach (explode (':', $addr) as $hex)
1382 $bytes[] = hexdec ($hex);
1383 for ($i = 5; $i >= 0; $i--)
1384 {
1385 $bytes[$i] += 1;
1386 if ($bytes[$i] <= 255) // FF
1387 break; // no roll over
1388 $bytes[$i] = 0;
1389 }
1390 foreach (array_keys ($bytes) as $key)
1391 $bytes[$key] = sprintf ('%02X', $bytes[$key]);
1392 return implode (':', $bytes);
1393}
1394
1395function generatePortsForCatModule ($object_id, $slotno = 1, $mtype = 'X6748', $mac_address = '')
1396{
1397 global $dbxlink;
1398 $mac_address = l2addressFromDatabase (l2addressForDatabase ($mac_address));
1399 switch ($mtype)
1400 {
cc000fab 1401 case 'WS-X6748-GE-TX':
2d511052
DO
1402 $dbxlink->beginTransaction();
1403 for ($i = 1; $i <= 48; $i++)
1404 {
73a9a0a0 1405 commitAddPort ($object_id, "gi${slotno}/${i}", '1-24', "slot ${slotno} port ${i}", $mac_address);
cc000fab 1406 $mac_address = nextMACAddress ($mac_address);
2d511052
DO
1407 }
1408 $dbxlink->commit();
1409 break;
cc000fab
DO
1410 case 'WS-X6708-10GE':
1411 for ($i = 1; $i <= 8; $i++)
1412 {
1413 commitAddPort ($object_id, "te${slotno}/${i}", '6-1080', "slot ${slotno} port ${i}", $mac_address);
1414 $mac_address = nextMACAddress ($mac_address);
1415 }
1416 break;
8fe2d6f0
DO
1417 case 'WS-X6704-10GE':
1418 for ($i = 1; $i <= 4; $i++)
1419 {
1420 commitAddPort ($object_id, "te${slotno}/${i}", '5-1079', "slot ${slotno} port ${i}", $mac_address);
1421 $mac_address = nextMACAddress ($mac_address);
1422 }
1423 break;
cc000fab
DO
1424 case 'VS-S720-10G':
1425 commitAddPort ($object_id, "gi${slotno}/1", '4-1077', "slot ${slotno} port 1", $mac_address);
1426 $mac_address = nextMACAddress ($mac_address);
1427 commitAddPort ($object_id, "gi${slotno}/2", '4-1077', "slot ${slotno} port 2", $mac_address);
1428 $mac_address = nextMACAddress ($mac_address);
1429 commitAddPort ($object_id, "gi${slotno}/3", '1-24', "slot ${slotno} port 3", $mac_address);
1430 $mac_address = nextMACAddress ($mac_address);
1431 commitAddPort ($object_id, "te${slotno}/4", '6-1080', "slot ${slotno} port 4", $mac_address);
1432 $mac_address = nextMACAddress ($mac_address);
1433 commitAddPort ($object_id, "te${slotno}/5", '6-1080', "slot ${slotno} port 5", $mac_address);
1434 break;
3e34adae
DO
1435 case '3750G-24TS':
1436 // MAC address of 1st port is the next one after switch's address
cc000fab 1437 $mac_address = nextMACAddress ($mac_address);
3e34adae
DO
1438 for ($i = 1; $i <= 24; $i++)
1439 {
1440 commitAddPort ($object_id, "gi${slotno}/0/${i}", '1-24', "unit ${slotno} port ${i}", $mac_address);
cc000fab 1441 $mac_address = nextMACAddress ($mac_address);
3e34adae
DO
1442 }
1443 for ($i = 25; $i <= 28; $i++)
1444 {
1445 commitAddPort ($object_id, "gi${slotno}/0/${i}", '4-1077', "unit ${slotno} port ${i}", $mac_address);
abd1e9ac
DO
1446 $mac_address = nextMACAddress ($mac_address);
1447 }
1448 break;
1449 case '3750G-24T':
1450 $mac_address = nextMACAddress ($mac_address);
1451 for ($i = 1; $i <= 24; $i++)
1452 {
1453 commitAddPort ($object_id, "gi${slotno}/0/${i}", '1-24', "unit ${slotno} port ${i}", $mac_address);
cc000fab 1454 $mac_address = nextMACAddress ($mac_address);
3e34adae
DO
1455 }
1456 break;
d423bb7d
DO
1457 case '3750G-16TD':
1458 $mac_address = nextMACAddress ($mac_address);
1459 for ($i = 1; $i <= 16; $i++)
1460 {
1461 commitAddPort ($object_id, "gi${slotno}/0/${i}", '1-24', "unit ${slotno} port ${i}", $mac_address);
1462 $mac_address = nextMACAddress ($mac_address);
1463 }
1464 commitAddPort ($object_id, "te${slotno}/0/1", '5-1079', "unit ${slotno} port ${i}", $mac_address);
1465 break;
c5553818
DO
1466 case 'LE02G48TA':
1467 for ($i = 0; $i <= 47; $i++)
1468 commitAddPort ($object_id, "gi${slotno}/0/${i}", '1-24', "slot ${slotno} port ${i}", $mac_address);
1469 break;
1470 case 'LE02X12SA':
1471 for ($i = 0; $i <= 11; $i++)
1472 commitAddPort ($object_id, "gi${slotno}/0/${i}", '9-1084', "slot ${slotno} port ${i}", $mac_address);
1473 break;
2d511052
DO
1474 }
1475}
1476
1f54e1ba
DO
1477function detectSoftwareType ($objectInfo, $sysDescr)
1478{
1479 global $swtype_pcre;
1480 foreach ($swtype_pcre as $pattern => $dict_key)
1481 if (preg_match ($pattern, $sysDescr))
1482 {
1483 updateStickerForCell ($objectInfo, 4, $dict_key);
1484 return;
1485 }
1486}
2ffd5a2a 1487?>