2011-04-12 22:29:29 +00:00
<? php
print_optionbar_start ();
$menu_options = array ( 'basic' => 'Basic' ,
2011-09-20 14:37:54 +00:00
'graphs' => 'Graphs' ,
2011-04-12 22:29:29 +00:00
);
2011-05-02 14:28:40 +00:00
if ( ! $_GET [ 'optb' ]) { $_GET [ 'optb' ] = "basic" ; }
2011-04-19 21:54:43 +00:00
echo ( '<span style="font-weight: bold;">CEF</span> » ' );
2011-04-12 22:29:29 +00:00
$sep = "" ;
foreach ( $menu_options as $option => $text )
{
echo ( $sep );
2011-04-19 21:54:43 +00:00
if ( $_GET [ 'optb' ] == $option ) { echo ( "<span class='pagemenu-selected'>" ); }
echo ( '<a href="device/' . $device [ 'device_id' ] . '/routing/cef/' . $option . ( $_GET [ 'optb' ] ? '/' . $_GET [ 'optb' ] : '' ) . '/">' . $text
2011-04-12 22:29:29 +00:00
. '</a>' );
2011-04-19 21:54:43 +00:00
if ( $_GET [ 'optb' ] == $option ) { echo ( "</span>" ); }
2011-04-12 22:29:29 +00:00
$sep = " | " ;
}
unset ( $sep );
print_optionbar_end ();
2011-04-13 10:22:08 +00:00
echo ( '<div id="content">
<table border="0" cellspacing="0" cellpadding="5" width="100%">' );
2011-04-12 22:29:29 +00:00
2011-04-13 10:22:08 +00:00
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>' );
2011-04-12 22:29:29 +00:00
$i = 0 ;
2011-05-16 10:44:50 +00:00
foreach ( dbFetchRows ( "SELECT * FROM `cef_switching` WHERE `device_id` = ? ORDER BY `entPhysicalIndex`, `afi`, `cef_index`" , array ( $device [ 'device_id' ])) as $cef )
2011-04-12 22:29:29 +00:00
{
2011-05-16 10:44:50 +00:00
$entity = dbFetchRow ( "SELECT * FROM `entPhysical` WHERE device_id = ? AND `entPhysicalIndex` = ?" , array ( $device [ 'device_id' ], $cef [ 'entPhysicalIndex' ]));
2011-04-12 22:29:29 +00:00
if ( ! is_integer ( $i / 2 )) { $bg_colour = $list_colour_a ; } else { $bg_colour = $list_colour_b ; }
$interval = $cef [ 'updated' ] - $cef [ 'updated_prev' ];
2011-09-20 14:37:54 +00:00
if ( ! $entity [ 'entPhysicalModelName' ] && $entity [ 'entPhysicalContainedIn' ])
2011-04-13 10:22:08 +00:00
{
2011-05-16 10:44:50 +00:00
$parent_entity = dbFetchRow ( "SELECT * FROM `entPhysical` WHERE device_id = ? AND `entPhysicalIndex` = ?" , array ( $device [ 'device_id' ], $entity [ 'entPhysicalContainedIn' ]));
2011-04-13 10:22:08 +00:00
$entity_descr = $entity [ 'entPhysicalName' ] . " (" . $parent_entity [ 'entPhysicalModelName' ] . ")" ;
} else {
$entity_descr = $entity [ 'entPhysicalName' ] . " (" . $entity [ 'entPhysicalModelName' ] . ")" ;
}
echo ( "<tr bgcolor= $bg_colour ><td>" . $entity_descr . "</td>
2011-04-12 22:29:29 +00:00
<td>" . $cef [ 'afi' ] . "</td>
2011-04-13 10:22:08 +00:00
<td>" );
switch ( $cef [ 'cef_path' ]) {
case "RP RIB" :
2011-04-22 10:00:12 +00:00
echo '<a title="Process switching with CEF assistance.">RP RIB</a>' ;
2011-04-13 10:22:08 +00:00
break ;
case "RP LES" :
2011-04-22 10:00:12 +00:00
echo '<a title="Low-end switching. Centralized CEF switch path.">RP LES</a>' ;
2011-04-13 10:22:08 +00:00
break ;
case "RP PAS" :
2011-04-22 10:00:12 +00:00
echo '<a title="CEF turbo switch path.">RP PAS</a>' ;
2011-04-13 10:22:08 +00:00
break ;
default :
echo $cef [ 'cef_path' ];
}
2011-04-12 22:29:29 +00:00
2011-04-13 10:22:08 +00:00
echo ( "</td>" );
2011-04-12 22:29:29 +00:00
echo ( "<td>" . format_si ( $cef [ 'drop' ]));
2011-09-20 14:37:54 +00:00
if ( $cef [ 'drop' ] > $cef [ 'drop_prev' ]) { echo ( " <span style='color:red;'>(" . round (( $cef [ 'drop' ] - $cef [ 'drop_prev' ]) / $interval , 2 ) . "/sec)</span>" ); }
2011-04-12 22:29:29 +00:00
echo ( "</td>" );
echo ( "<td>" . format_si ( $cef [ 'punt' ]));
2011-09-20 14:37:54 +00:00
if ( $cef [ 'punt' ] > $cef [ 'punt_prev' ]) { echo ( " <span style='color:red;'>(" . round (( $cef [ 'punt' ] - $cef [ 'punt_prev' ]) / $interval , 2 ) . "/sec)</span>" ); }
2011-04-12 22:29:29 +00:00
echo ( "</td>" );
2011-04-22 10:00:12 +00:00
echo ( "<td>" . format_si ( $cef [ 'punt2host' ]));
2011-09-20 14:37:54 +00:00
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
echo ( "</td>" );
echo ( "</tr>
" );
2011-04-13 19:08:01 +00:00
2011-09-20 14:37:54 +00:00
if ( $_GET [ 'optb' ] == "graphs" )
2011-04-13 19:08:01 +00:00
{
$graph_array [ 'height' ] = "100" ;
$graph_array [ 'width' ] = "215" ;
$graph_array [ 'to' ] = $now ;
$graph_array [ 'id' ] = $cef [ 'cef_switching_id' ];
$graph_array [ 'type' ] = "cefswitching_graph" ;
echo ( "<tr bgcolor=' $bg_colour '><td colspan=6>" );
include ( "includes/print-quadgraphs.inc.php" );
echo ( "</td></tr>" );
}
2011-04-12 22:29:29 +00:00
$i ++ ;
}
2011-04-13 10:22:08 +00:00
echo ( "</table></div>" );
2011-04-12 22:29:29 +00:00
?>