hasGlobalRead()) { include 'includes/error-no-perm.inc.php'; } else { $link_array = array( 'page' => 'routing', 'protocol' => 'vrf', ); print_optionbar_start(); echo "VRFs » "; $menu_options = array('basic' => 'Basic', ); if (!$vars['view']) { $vars['view'] = 'basic'; } $sep = ''; foreach ($menu_options as $option => $text) { if ($vars['view'] == $option) { echo " '; } echo ' | '; } unset($sep); echo ' Graphs: '; $graph_types = array( 'bits' => 'Bits', 'upkts' => 'Unicast Packets', 'nupkts' => 'Non-Unicast Packets', 'errors' => 'Errors', 'etherlike' => 'Etherlike', ); foreach ($graph_types as $type => $descr) { echo "$type_sep"; if ($vars['graph'] == $type) { echo " '; } $type_sep = ' | '; } print_optionbar_end(); if ($vars['view'] == 'basic' || $vars['view'] == 'graphs') { // Pre-Cache in arrays // That's heavier on RAM, but much faster on CPU (1:40) // Specifying the fields reduces a lot the RAM used (1:4) . $vrf_fields = 'vrf_id, mplsVpnVrfRouteDistinguisher, mplsVpnVrfDescription, vrf_name'; $dev_fields = 'D.device_id as device_id, hostname, os, hardware, version, features, location, status, `ignore`, disabled'; $port_fields = 'port_id, ifvrf, device_id, ifDescr, ifAlias, ifName'; foreach (dbFetchRows("SELECT $vrf_fields, $dev_fields FROM `vrfs` AS V, `devices` AS D WHERE D.device_id = V.device_id") as $vrf_device) { if (empty($vrf_devices[$vrf_device['vrf_name']][$vrf_device['mplsVpnVrfRouteDistinguisher']])) { $vrf_devices[$vrf_device['vrf_name']][$vrf_device['mplsVpnVrfRouteDistinguisher']][0] = $vrf_device; } else { array_push($vrf_devices[$vrf_device['vrf_name']][$vrf_device['mplsVpnVrfRouteDistinguisher']], $vrf_device); } } unset($ports); foreach (dbFetchRows("SELECT $port_fields FROM `ports` WHERE ifVrf<>0") as $port) { if (empty($ports[$port['ifvrf']][$port['device_id']])) { $ports[$port['ifvrf']][$port['device_id']][0] = $port; } else { array_push($ports[$port['ifvrf']][$port['device_id']], $port); } } echo "
";
echo "";
echo $vrf['vrf_name'].' '; echo "".$vrf['mplsVpnVrfDescription'].' | ';
echo ''.$vrf['mplsVpnVrfRouteDistinguisher'].' | '; echo '
| ';
$i++;
}//end foreach
echo '