Disabled";
}
if ($port['ifAdminStatus'] == 'up' && $port['ifOperStatus'] != 'up') {
$status = "Enabled / Disconnected";
}
if ($port['ifAdminStatus'] == 'up' && $port['ifOperStatus'] == 'up') {
$status = "Enabled / Connected";
}
$i = 1;
$inf = fixifName($ifname);
$bg = '#ffffff';
$show_all = 1;
echo "
";
print_optionbar_start();
$link_array = [
'page' => 'device',
'device' => $device['device_id'],
'tab' => 'port',
'port' => $port['port_id'],
];
$menu_options['graphs'] = 'Graphs';
$menu_options['realtime'] = 'Real time';
// FIXME CONDITIONAL
$menu_options['arp'] = 'ARP Table';
$menu_options['fdb'] = 'FDB Table';
$menu_options['events'] = 'Eventlog';
$menu_options['notes'] = 'Notes';
if (dbFetchCell("SELECT COUNT(*) FROM `sensors` WHERE `device_id` = ? AND `entPhysicalIndex` = ? AND entPhysicalIndex_measured = 'ports'", [$device['device_id'], $port['ifIndex']])) {
$menu_options['sensors'] = 'Health';
}
if (dbFetchCell("SELECT COUNT(*) FROM `ports_adsl` WHERE `port_id` = '" . $port['port_id'] . "'")) {
$menu_options['adsl'] = 'ADSL';
}
if (dbFetchCell("SELECT COUNT(*) FROM `ports` WHERE `pagpGroupIfIndex` = '" . $port['ifIndex'] . "' and `device_id` = '" . $device['device_id'] . "'")) {
$menu_options['pagp'] = 'PAgP';
}
if (dbFetchCell("SELECT COUNT(*) FROM `ports_vlans` WHERE `port_id` = '" . $port['port_id'] . "' and `device_id` = '" . $device['device_id'] . "'")) {
$menu_options['vlans'] = 'VLANs';
}
// Are there any CBQoS components for this device?
$component = new LibreNMS\Component();
$options = []; // Re-init array in case it has been declared previously.
$options['filter']['type'] = ['=', 'Cisco-CBQOS'];
$components = $component->getComponents($device['device_id'], $options);
$components = $components[$device['device_id']]; // We only care about our device id.
if (count($components) > 0) {
$menu_options['cbqos'] = 'CBQoS';
}
if (LibreNMS\Plugins::countHooks('port_container')) {
// Checking if any plugin implements the port_container. If yes, allow to display the menu_option
$menu_options['plugins'] = 'Plugins';
}
$sep = '';
foreach ($menu_options as $option => $text) {
echo $sep;
if ($vars['view'] == $option) {
echo "';
}
$sep = ' | ';
}
unset($sep);
if (dbFetchCell("SELECT count(*) FROM mac_accounting WHERE port_id = '" . $port['port_id'] . "'") > '0') {
echo generate_link($descr, $link_array, ['view' => 'macaccounting', 'graph' => $type]);
echo ' | Mac Accounting : ';
if ($vars['view'] == 'macaccounting' && $vars['graph'] == 'bits' && $vars['subview'] == 'graphs') {
echo "';
}
echo '(';
if ($vars['view'] == 'macaccounting' && $vars['graph'] == 'bits' && $vars['subview'] == 'minigraphs') {
echo "';
}
echo '|';
if ($vars['view'] == 'macaccounting' && $vars['graph'] == 'bits' && $vars['subview'] == 'top10') {
echo "';
}
echo ') | ';
if ($vars['view'] == 'macaccounting' && $vars['graph'] == 'pkts' && $vars['subview'] == 'graphs') {
echo "';
}
echo '(';
if ($vars['view'] == 'macaccounting' && $vars['graph'] == 'pkts' && $vars['subview'] == 'minigraphs') {
echo "';
}
echo '|';
if ($vars['view'] == 'macaccounting' && $vars['graph'] == 'pkts' && $vars['subview'] == 'top10') {
echo "';
}
echo ')';
}//end if
if (dbFetchCell("SELECT COUNT(*) FROM juniAtmVp WHERE port_id = '" . $port['port_id'] . "'") > '0') {
// FIXME ATM VPs
// FIXME URLs BROKEN
echo ' | ATM VPs : ';
if ($vars['view'] == 'junose-atm-vp' && $vars['graph'] == 'bits') {
echo "';
}
echo ' | ';
if ($vars['view'] == 'junose-atm-vp' && $vars['graph'] == 'packets') {
echo "';
}
echo ' | ';
if ($vars['view'] == 'junose-atm-vp' && $vars['graph'] == 'cells') {
echo "';
}
echo ' | ';
if ($vars['view'] == 'junose-atm-vp' && $vars['graph'] == 'errors') {
echo "';
}
}//end if
if (Auth::user()->hasGlobalAdmin() && \LibreNMS\Config::get('enable_billing') == 1) {
$bills = dbFetchRows('SELECT `bill_id` FROM `bill_ports` WHERE `port_id`=?', [$port['port_id']]);
if (count($bills) === 1) {
echo "
'bill', 'bill_id' => $bills[0]['bill_id']]) . "'> View Bill";
} elseif (count($bills) > 1) {
echo "
'bills']) . "'> View Bills";
} else {
echo "
'bills', 'view' => 'add', 'port' => $port['port_id']]) . "'> Create Bill";
}
}
print_optionbar_end();
echo "
";
require 'includes/html/pages/device/port/' . $vars['view'] . '.inc.php';
echo '
';