1 | <?php |
||
2 | |||
3 | $cefs = []; |
||
4 | $cefs = snmpwalk_cache_threepart_oid($device, 'CISCO-CEF-MIB::cefSwitchingPath', $cefs); |
||
5 | d_echo($cefs); |
||
6 | |||
7 | if (is_array($cefs)) { |
||
0 ignored issues
–
show
introduced
by
Loading history...
|
|||
8 | if (! is_array($entity_array)) { |
||
9 | echo 'Caching OIDs: '; |
||
10 | $entity_array = []; |
||
11 | echo ' entPhysicalDescr'; |
||
12 | $entity_array = snmpwalk_cache_multi_oid($device, 'entPhysicalDescr', $entity_array, 'ENTITY-MIB'); |
||
13 | echo ' entPhysicalName'; |
||
14 | $entity_array = snmpwalk_cache_multi_oid($device, 'entPhysicalName', $entity_array, 'ENTITY-MIB'); |
||
15 | echo ' entPhysicalModelName'; |
||
16 | $entity_array = snmpwalk_cache_multi_oid($device, 'entPhysicalModelName', $entity_array, 'ENTITY-MIB'); |
||
17 | } |
||
18 | |||
19 | foreach ($cefs as $entity => $afis) { |
||
20 | $entity_name = $entity_array[$entity]['entPhysicalName'] . ' - ' . $entity_array[$entity]['entPhysicalModelName']; |
||
21 | echo "\n$entity $entity_name\n"; |
||
22 | foreach ($afis as $afi => $paths) { |
||
23 | echo " |- $afi\n"; |
||
24 | foreach ($paths as $path => $path_name) { |
||
25 | echo ' | |-' . $path . ': ' . $path_name['cefSwitchingPath'] . "\n"; |
||
26 | $cef_exists[$device['device_id']][$entity][$afi][$path] = 1; |
||
27 | |||
28 | if (dbFetchCell('SELECT COUNT(*) from `cef_switching` WHERE device_id = ? AND entPhysicalIndex = ? AND afi=? AND cef_index=?', [$device['device_id'], $entity, $afi, $path]) != '1') { |
||
29 | dbInsert(['device_id' => $device['device_id'], 'entPhysicalIndex' => $entity, 'afi' => $afi, 'cef_path' => $path], 'cef_switching'); |
||
30 | echo '+'; |
||
31 | } |
||
32 | } |
||
33 | } |
||
34 | } |
||
35 | unset($cefs); |
||
36 | }//end if |
||
37 | |||
38 | // FIXME - need to delete old ones. FIXME REALLY. |
||
39 | echo "\n"; |
||
40 | unset($entity_array); |
||
41 |