'routing', 'protocol' => 'mpls', ); if (!isset($vars['view'])) { $vars['view'] = 'lsp'; } echo 'MPLS » '; if ($vars['view'] == 'lsp') { echo ""; } echo generate_link('LSP', $link_array, array('view' => 'lsp')); if ($vars['view'] == 'lsp') { echo ''; } echo ' | '; if ($vars['view'] == 'paths') { echo ""; } echo generate_link('Paths', $link_array, array('view' => 'paths')); if ($vars['view'] == 'paths') { echo ''; } print_optionbar_end(); echo '
'; if ($vars['view'] == 'lsp') { echo ''; $i = 0; foreach (dbFetchRows('SELECT *, `vrf_name` FROM `mpls_lsps` AS l, `vrfs` AS v WHERE `l`.`vrf_oid` = `v`.`vrf_oid` AND `l`.`device_id` = `v`.`device_id` ORDER BY `l`.`device_id`, `l`.`mplsLspName`') as $lsp) { $device = device_by_id_cache($lsp['device_id']); if (!is_integer($i / 2)) { $bg_colour = \LibreNMS\Config::get('list_colour.even'); } else { $bg_colour = \LibreNMS\Config::get('list_colour.odd'); } $adminstate_status_color = $operstate_status_color = $path_status_color = 'default'; if ($lsp['mplsLspAdminState'] == 'inService') { $adminstate_status_color = 'success'; } if ($lsp['mplsLspOperState'] == 'inService') { $operstate_status_color = 'success'; } elseif ($lsp['mplsLspAdminState'] == 'inService' && $lsp['mplsLspOperState'] == 'outOfService') { $operstate_status_color = 'danger'; } if ($lsp['mplsLspConfiguredPaths'] + $lsp['mplsLspStandbyPaths'] == $lsp['mplsLspOperationalPaths']) { $path_status_color = 'success'; } elseif ($lsp['mplsLspOperationalPaths'] == '0') { $path_status_color = 'danger'; } elseif ($lsp['mplsLspConfiguredPaths'] + $lsp['mplsLspStandbyPaths'] > $lsp['mplsLspOperationalPaths']) { $path_status_color = 'warning'; } $avail = round($lsp['mplsLspPrimaryTimeUp'] / $lsp['mplsLspAge'] * 100, 5); $host = @dbFetchRow('SELECT * FROM `ipv4_addresses` AS A, `ports` AS I, `devices` AS D WHERE A.ipv4_address = ? AND I.port_id = A.port_id AND D.device_id = I.device_id', [$lsp['mplsLspToAddr']]); $destination = $lsp['mplsLspToAddr']; if (is_array($host)) { $destination = generate_device_link($host, 0, array('tab' => 'routing', 'proto' => 'mpls')); } echo "'; echo ''; $i++; } echo '
Device Name Destination VRF Admin State Oper State Last Change at Transitions Last Transition Paths
Conf / Stby / Oper
Type FRR Availability
%
" . generate_device_link($device, 0, array('tab' => 'routing', 'proto' => 'mpls')) . ' ' . $lsp['mplsLspName'] . ' ' . $destination . ' ' . $lsp['vrf_name'] . ' ' . $lsp['mplsLspAdminState'] . ' ' . $lsp['mplsLspOperState'] . ' ' . formatUptime($lsp['mplsLspLastChange']) . ' ' . $lsp['mplsLspTransitions'] . ' ' . formatUptime($lsp['mplsLspLastTransition']) . ' ' . $lsp['mplsLspConfiguredPaths'] . ' / ' . $lsp['mplsLspStandbyPaths'] . ' / ' . $lsp['mplsLspOperationalPaths'] . ' ' . $lsp['mplsLspType'] . ' ' . $lsp['mplsLspFastReroute'] . ' ' . $avail . '
'; } // endif lsp view if ($vars['view'] == 'paths') { echo 'Device LSP Name Index Type Admin State Oper State Last Change at Transitions Bandwidth Oper BW State Failcode Fail Node Metric Oper Metric '; $i = 0; foreach (dbFetchRows('SELECT *, `mplsLspName` FROM `mpls_lsp_paths` AS `p`, `mpls_lsps` AS `l` WHERE `p`.`lsp_id` = `l`.`lsp_id` ORDER BY `p`.`device_id`, `l`.`mplsLspName`') as $path) { $device = device_by_id_cache($path['device_id']); if (!is_integer($i / 2)) { $bg_colour = \LibreNMS\Config::get('list_colour.even'); } else { $bg_colour = \LibreNMS\Config::get('list_colour.odd'); } $adminstate_status_color = $operstate_status_color = 'default'; $failcode_status_color = 'warning'; if ($path['mplsLspPathAdminState'] == 'inService') { $adminstate_status_color = 'success'; } if ($path['mplsLspPathFailCode'] == 'noError') { $failcode_status_color = 'success'; } if ($path['mplsLspPathOperState'] == 'inService') { $operstate_status_color = 'success'; } elseif ($path['mplsLspPathAdminState'] == 'inService' && $path['mplsLspPathOperState'] == 'outOfService') { $operstate_status_color = 'danger'; } $host = @dbFetchRow('SELECT * FROM `ipv4_addresses` AS A, `ports` AS I, `devices` AS D WHERE A.ipv4_address = ? AND I.port_id = A.port_id AND D.device_id = I.device_id', [$path['mplsLspPathFailNodeAddr']]); $destination = $lsp['mplsLspPathFailNodeAddr']; if (is_array($host)) { $destination = generate_device_link($host, 0, array('tab' => 'routing', 'proto' => 'mpls')); } echo " " . generate_device_link($device, 0, array('tab' => 'routing', 'proto' => 'mpls')) . ' ' . $path['mplsLspName'] . ' ' . $path['path_oid'] . ' ' . $path['mplsLspPathType'] . ' ' . $path['mplsLspPathAdminState'] . ' ' . $path['mplsLspPathOperState'] . ' ' . formatUptime($path['mplsLspPathLastChange']) . ' ' . $path['mplsLspPathTransitionCount'] . ' ' . $path['mplsLspPathBandwidth'] . ' ' . $path['mplsLspPathOperBandwidth'] . ' ' . $path['mplsLspPathState'] . ' ' . $path['mplsLspPathFailCode'] . ' ' . $destination . ' ' . $path['mplsLspPathMetric'] . ' ' . $path['mplsLspPathOperMetric'] . ''; echo ''; $i++; } echo ''; }