2009-05-11 13:58:05 +00:00
<? php
2009-10-02 13:20:24 +00:00
print_optionbar_start ();
2011-09-17 19:07:42 +00:00
echo ( "<a href='pseudowires/'>Details</a> | Graphs :
<a href='pseudowires/graphs/mini/'>Mini</a>
2009-10-02 13:20:24 +00:00
" );
print_optionbar_end ();
2011-03-17 00:09:20 +00:00
list ( $opta , $optb , $optc , $optd , $opte ) = explode ( "/" , $_GET [ 'opta' ]);
2009-10-02 13:20:24 +00:00
echo ( "<table cellpadding=5 cellspacing=0 class=devicetable width=100%>" );
2009-05-11 13:58:05 +00:00
2011-05-13 13:52:01 +00:00
foreach ( dbFetchRows ( "SELECT * FROM pseudowires AS P, ports AS I, devices AS D WHERE P.interface_id = I.interface_id AND I.device_id = D.device_id ORDER BY D.hostname,I.ifDescr" ) as $pw_a )
2011-03-17 00:09:20 +00:00
{
$i = 0 ;
while ( $i < count ( $linkdone ))
{
$thislink = $pw_a [ 'device_id' ] . $pw_a [ 'interface_id' ];
if ( $linkdone [ $i ] == $thislink ) { $skip = "yes" ; }
$i ++ ;
2009-05-11 13:58:05 +00:00
}
2011-09-20 09:55:11 +00:00
$pw_b = dbFetchRow ( "SELECT * from `devices` AS D, `ports` AS I, `pseudowires` AS P WHERE D.device_id = ? AND D.device_id = I.device_id
2011-05-13 13:52:01 +00:00
AND P.cpwVcID = ? AND P.interface_id = I.interface_id" , array ( $pw_a [ 'peer_device_id' ], $pw_a [ 'cpwVcID' ]));
2009-05-11 13:58:05 +00:00
2011-03-17 00:09:20 +00:00
if ( ! port_permitted ( $pw_a [ 'interface_id' ])) { $skip = "yes" ; }
if ( ! port_permitted ( $pw_b [ 'interface_id' ])) { $skip = "yes" ; }
2009-08-12 15:01:01 +00:00
2011-03-17 00:09:20 +00:00
if ( $skip )
{
2009-08-12 15:01:01 +00:00
unset ( $skip );
} else {
2011-03-17 00:09:20 +00:00
if ( $bg == "ffffff" ) { $bg = "e5e5e5" ; } else { $bg = "ffffff" ; }
2010-08-02 22:09:52 +00:00
echo ( "<tr style= \" background-color: # $bg ; \" ><td rowspan=2 style='font-size:18px; padding:4px;'>" . $pw_a [ 'cpwVcID' ] . "</td><td>" . generate_device_link ( $pw_a ) . "</td><td>" . generate_port_link ( $pw_a ) . "</td>
2011-09-17 19:07:42 +00:00
<td rowspan=2> <img src='images/16/arrow_right.png'> </td>
2010-08-02 22:09:52 +00:00
<td>" . generate_device_link ( $pw_b ) . "</td><td>" . generate_port_link ( $pw_b ) . "</td></tr>" );
2009-10-02 13:20:24 +00:00
echo ( "<tr style= \" background-color: # $bg ; \" ><td colspan=2>" . $pw_a [ 'ifAlias' ] . "</td><td colspan=2>" . $pw_b [ 'ifAlias' ] . "</td></tr>" );
2011-03-17 00:09:20 +00:00
if ( $opta == "graphs" )
{
2009-10-02 13:20:24 +00:00
echo ( "<tr style= \" background-color: # $bg ; \" ><td></td><td colspan=2>" );
2011-03-17 00:09:20 +00:00
if ( ! $optb ) { $optb = "mini" ; }
if ( $pw_a )
{
2009-10-02 13:20:24 +00:00
$pw_a [ 'width' ] = "150" ;
$pw_a [ 'height' ] = "30" ;
$pw_a [ 'from' ] = $day ;
$pw_a [ 'to' ] = $now ;
$pw_a [ 'bg' ] = $bg ;
$types = array ( 'bits' , 'pkts' , 'errors' );
2011-03-17 00:09:20 +00:00
foreach ( $types as $graph_type )
{
2009-10-02 13:20:24 +00:00
$pw_a [ 'graph_type' ] = $graph_type ;
generate_port_thumbnail ( $pw_a );
}
}
echo ( "</td><td></td><td colspan=2>" );
2011-03-17 00:09:20 +00:00
if ( $pw_b )
{
2009-10-02 13:20:24 +00:00
$pw_b [ 'width' ] = "150" ;
$pw_b [ 'height' ] = "30" ;
$pw_b [ 'from' ] = $day ;
$pw_b [ 'to' ] = $now ;
$pw_b [ 'bg' ] = $bg ;
$types = array ( 'bits' , 'pkts' , 'errors' );
2011-03-17 00:09:20 +00:00
foreach ( $types as $graph_type )
{
2009-10-02 13:20:24 +00:00
$pw_b [ 'graph_type' ] = $graph_type ;
generate_port_thumbnail ( $pw_b );
}
}
echo ( "</td></tr>" );
}
2009-05-11 13:58:05 +00:00
$linkdone [] = $pw_b [ 'device_id' ] . $pw_b [ 'interface_id' ];
}
}
echo ( "</table>" );
2011-05-13 13:52:01 +00:00
?>