2011-04-12 22:29:29 +00:00
<? php
print_optionbar_start ();
2015-07-10 13:36:21 +02:00
$link_array = array (
'page' => 'device' ,
'device' => $device [ 'device_id' ],
'tab' => 'routing' ,
'proto' => 'cef' ,
);
if ( ! isset ( $vars [ 'view' ])) {
$vars [ 'view' ] = 'basic' ;
}
2011-04-12 22:29:29 +00:00
2015-07-10 13:36:21 +02:00
echo '<span style="font-weight: bold;">CEF</span> » ' ;
2011-04-19 21:54:43 +00:00
2015-07-10 13:36:21 +02:00
if ( $vars [ 'view' ] == 'basic' ) {
echo "<span class='pagemenu-selected'>" ;
}
2011-04-12 22:29:29 +00:00
2015-07-10 13:36:21 +02:00
echo generate_link ( 'Basic' , $link_array , array ( 'view' => 'basic' ));
if ( $vars [ 'view' ] == 'basic' ) {
echo '</span>' ;
}
2011-11-29 10:34:18 +00:00
2015-07-10 13:36:21 +02:00
echo ' | ' ;
2011-04-12 22:29:29 +00:00
2015-07-10 13:36:21 +02:00
if ( $vars [ 'view' ] == 'graphs' ) {
echo "<span class='pagemenu-selected'>" ;
}
echo generate_link ( 'Graphs' , $link_array , array ( 'view' => 'graphs' ));
if ( $vars [ 'view' ] == 'graphs' ) {
echo '</span>' ;
}
2011-04-12 22:29:29 +00:00
print_optionbar_end ();
2015-07-10 13:36:21 +02:00
echo '<div id="content">
<table border="0" cellspacing="0" cellpadding="5" width="100%">' ;
echo '<tr><th><a title="Physical hardware entity">Entity</a></th>
<th><a title="Address Family">AFI</a></th>
<th><a title="CEF Switching Path">Path</a></th>
<th><a title="Number of packets dropped.">Drop</a></th>
<th><a title="Number of packets that could not be switched in the normal path and were punted to the next-fastest switching vector.">Punt</a></th>
<th><a title="Number of packets that could not be switched in the normal path and were punted to the host.<br />For switch paths other than a centralized turbo switch path, punt and punt2host function the same way. With punt2host from a centralized turbo switch path (PAS and RSP), punt will punt the packet to LES, but punt2host will bypass LES and punt directly to process switching.">Punt2Host</a></th>
</tr>' ;
$i = 0 ;
foreach ( dbFetchRows ( 'SELECT * FROM `cef_switching` WHERE `device_id` = ? ORDER BY `entPhysicalIndex`, `afi`, `cef_index`' , array ( $device [ 'device_id' ])) as $cef ) {
$entity = dbFetchRow ( 'SELECT * FROM `entPhysical` WHERE device_id = ? AND `entPhysicalIndex` = ?' , array ( $device [ 'device_id' ], $cef [ 'entPhysicalIndex' ]));
if ( ! is_integer ( $i / 2 )) {
2019-06-23 00:29:12 -05:00
$bg_colour = \LibreNMS\Config :: get ( 'list_colour.even' );
2016-08-18 20:28:22 -05:00
} else {
2019-06-23 00:29:12 -05:00
$bg_colour = \LibreNMS\Config :: get ( 'list_colour.odd' );
2015-07-10 13:36:21 +02:00
}
$interval = ( $cef [ 'updated' ] - $cef [ 'updated_prev' ]);
if ( ! $entity [ 'entPhysicalModelName' ] && $entity [ 'entPhysicalContainedIn' ]) {
$parent_entity = dbFetchRow ( 'SELECT * FROM `entPhysical` WHERE device_id = ? AND `entPhysicalIndex` = ?' , array ( $device [ 'device_id' ], $entity [ 'entPhysicalContainedIn' ]));
$entity_descr = $entity [ 'entPhysicalName' ] . ' (' . $parent_entity [ 'entPhysicalModelName' ] . ')' ;
2016-08-18 20:28:22 -05:00
} else {
2015-07-10 13:36:21 +02:00
$entity_descr = $entity [ 'entPhysicalName' ] . ' (' . $entity [ 'entPhysicalModelName' ] . ')' ;
}
echo "<tr bgcolor= $bg_colour ><td>" . $entity_descr . '</td>
<td>' . $cef [ 'afi' ] . '</td>
<td>' ;
switch ( $cef [ 'cef_path' ]) {
2016-08-18 20:28:22 -05:00
case 'RP RIB' :
echo '<a title="Process switching with CEF assistance.">RP RIB</a>' ;
break ;
2015-07-10 13:36:21 +02:00
2016-08-18 20:28:22 -05:00
case 'RP LES' :
echo '<a title="Low-end switching. Centralized CEF switch path.">RP LES</a>' ;
break ;
2015-07-10 13:36:21 +02:00
2016-08-18 20:28:22 -05:00
case 'RP PAS' :
echo '<a title="CEF turbo switch path.">RP PAS</a>' ;
break ;
2015-07-10 13:36:21 +02:00
2016-08-18 20:28:22 -05:00
default :
echo $cef [ 'cef_path' ];
2015-07-10 13:36:21 +02:00
}
echo '</td>' ;
echo '<td>' . format_si ( $cef [ 'drop' ]);
if ( $cef [ 'drop' ] > $cef [ 'drop_prev' ]) {
echo ( " <span style='color:red;'>(" . round ((( $cef [ 'drop' ] - $cef [ 'drop_prev' ]) / $interval ), 2 ) . '/sec)</span>' );
}
echo '</td>' ;
echo '<td>' . format_si ( $cef [ 'punt' ]);
if ( $cef [ 'punt' ] > $cef [ 'punt_prev' ]) {
echo ( " <span style='color:red;'>(" . round ((( $cef [ 'punt' ] - $cef [ 'punt_prev' ]) / $interval ), 2 ) . '/sec)</span>' );
}
echo '</td>' ;
echo '<td>' . format_si ( $cef [ 'punt2host' ]);
if ( $cef [ 'punt2host' ] > $cef [ 'punt2host_prev' ]) {
echo ( " <span style='color:red;'>(" . round ((( $cef [ 'punt2host' ] - $cef [ 'punt2host_prev' ]) / $interval ), 2 ) . '/sec)</span>' );
}
2011-04-12 22:29:29 +00:00
2015-07-10 13:36:21 +02:00
echo '</td>' ;
echo '</tr>
' ;
if ( $vars [ 'view' ] == 'graphs' ) {
$graph_array [ 'height' ] = '100' ;
$graph_array [ 'width' ] = '215' ;
2019-06-23 00:29:12 -05:00
$graph_array [ 'to' ] = \LibreNMS\Config :: get ( 'time.now' );
2015-07-10 13:36:21 +02:00
$graph_array [ 'id' ] = $cef [ 'cef_switching_id' ];
$graph_array [ 'type' ] = 'cefswitching_graph' ;
echo "<tr bgcolor=' $bg_colour '><td colspan=6>" ;
2019-04-11 23:26:42 -05:00
include 'includes/html/print-graphrow.inc.php' ;
2015-07-10 13:36:21 +02:00
echo '</td></tr>' ;
}
$i ++ ;
}
2011-04-12 22:29:29 +00:00
2015-07-10 13:36:21 +02:00
echo '</table></div>' ;