diff --git a/html/index.php b/html/index.php index 6103475c5..89a9900e0 100755 --- a/html/index.php +++ b/html/index.php @@ -10,7 +10,7 @@ if (strpos($_SERVER['REQUEST_URI'], "debug")) ini_set('display_errors', 1); ini_set('display_startup_errors', 1); ini_set('log_errors', 1); - ini_set('error_reporting', E_PARSE); + ini_set('error_reporting', E_ALL); } else { $debug = FALSE; ini_set('display_errors', 0); diff --git a/html/pages/device/routing.inc.php b/html/pages/device/routing.inc.php index 1b86de13e..1493e4e3b 100644 --- a/html/pages/device/routing.inc.php +++ b/html/pages/device/routing.inc.php @@ -1,23 +1,21 @@ '0') -{ - $datas[] = 'vrf'; -} +$routing_count['bgp'] = mysql_result(mysql_query("select count(*) from bgpPeers WHERE device_id = '" . $device['device_id'] . "'"), 0); +if ($routing_count['bgp']) { $datas[] = 'bgp'; } -$bgp_count = mysql_result(mysql_query("select count(*) from bgpPeers WHERE device_id = '" . $device['device_id'] . "'"), 0); -if ($bgp_count) { $datas[] = 'bgp'; } +$routing_count['ospf'] = mysql_result(mysql_query("select count(*) from ospf_ports WHERE device_id = '" . $device['device_id'] . "'"), 0); +if ($routing_count['ospf']) { $datas[] = 'ospf'; } -$cef_count = mysql_result(mysql_query("select count(*) from cef_switching WHERE device_id = '" . $device['device_id'] . "'"), 0); -if ($cef_count) { $datas[] = 'cef'; } +$routing_count['cef'] = mysql_result(mysql_query("select count(*) from cef_switching WHERE device_id = '" . $device['device_id'] . "'"), 0); +if ($routing_count['cef']) { $datas[] = 'cef'; } -$ospf_count = mysql_result(mysql_query("select count(*) from ospf_instances WHERE device_id = '" . $device['device_id'] . "'"), 0); -if ($ospf_count) { $datas[] = 'ospf'; } +$routing_count['vrf'] = @mysql_result(mysql_query("select count(*) from vrfs WHERE device_id = '" . $device['device_id'] . "'"), 0); +if($routing_count['vrf']) { $datas[] = 'vrf'; } -$type_text['overview'] = "Overview"; +#$type_text['overview'] = "Overview"; $type_text['bgp'] = "BGP"; $type_text['cef'] = "CEF"; $type_text['ospf'] = "OSPF"; @@ -25,11 +23,14 @@ $type_text['vrf'] = "VRFs"; print_optionbar_start(); -if (!$_GET['opta']) { $_GET['opta'] = "overview"; } +echo("Routing » "); unset($sep); foreach ($datas as $type) { + + if (!$_GET['opta']) { $_GET['opta'] = $type; } + echo($sep); if ($_GET['opta'] == $type) @@ -37,7 +38,7 @@ foreach ($datas as $type) echo(''); } - echo(" " . $type_text[$type] .""); + echo(" " . $type_text[$type] ." (".$routing_count[$type].")"); if ($_GET['opta'] == $type) { echo(""); } $sep = " | "; } diff --git a/html/pages/device/routing/ospf.inc.php b/html/pages/device/routing/ospf.inc.php index 6051ffbb3..debb248d6 100644 --- a/html/pages/device/routing/ospf.inc.php +++ b/html/pages/device/routing/ospf.inc.php @@ -1,5 +1,114 @@ "); -print_r(mysql_fetch_assoc(mysql_query("SELECT * FROM `ospf_instances` WHERE `device_id` = '".$device['device_id']."'"))); -echo(""); + +$sql = "SELECT * FROM `ospf_instances` WHERE `device_id` = '".$device['device_id']."'"; +$query = mysql_query($sql); + +$i_i = "0"; + +echo(''); + +#### Loop Instances + +while($instance = mysql_fetch_assoc($query)) +{ + + if (!is_integer($i_i/2)) { $instance_bg = $list_colour_a; } else { $instance_bg = $list_colour_b; } + + $area_count = mysql_result(mysql_query("SELECT COUNT(*) FROM `ospf_areas` WHERE `device_id` = '".$device['device_id']."'"),0); + $port_count = mysql_result(mysql_query("SELECT COUNT(*) FROM `ospf_ports` WHERE `device_id` = '".$device['device_id']."'"),0); + $port_count_enabled = mysql_result(mysql_query("SELECT COUNT(*) FROM `ospf_ports` WHERE `ospfIfAdminStat` = 'enabled' AND `device_id` = '".$device['device_id']."'"),0); + + $query = "SELECT * FROM ipv4_addresses AS A, ports AS I WHERE "; + $query .= "(A.ipv4_address = '".$peer['bgpPeerIdentifier']."' AND I.interface_id = A.interface_id)"; + $query .= " AND I.device_id = '".$device['device_id']."'"; + $ipv4_host = mysql_fetch_assoc(mysql_query($query)); + + if($instance['ospfAdminStat'] == "enabled") { $enabled = 'enabled'; } else { $enabled = 'disabled'; } + if($instance['ospfAreaBdrRtrStatus'] == "true") { $abr = 'yes'; } else { $abr = 'no'; } + if($instance['ospfASBdrRtrStatus'] == "true") { $asbr = 'yes'; } else { $asbr = 'no'; } + + echo(''); + echo(''); + echo(' '); + echo(' '); + echo(' '); + echo(' '); + echo(' '); + echo(' '); + echo(' '); + echo(''); + + echo(''); + echo(''); + echo(''); + + $i_i++; + +} ### End loop instances + +echo('
Router IdStatusABRASBRAreasPortsNeighbours
'.$instance['ospfRouterId'] . '' . $enabled . '' . $abr . '' . $asbr . '' . $area_count . '' . $port_count . '('.$port_count_enabled.')' . ($neighbour_count+0) . '
'); + echo(''); + echo(''); + + ##### Loop Areas + $i_a = 0; + $a_sql = "SELECT * FROM `ospf_areas` WHERE `device_id` = '".$device['device_id']."'"; + $a_query = mysql_query($a_sql); + while($area = mysql_fetch_assoc($a_query)) + { + + if (!is_integer($i_a/2)) { $area_bg = $list_colour_b_a; } else { $area_bg = $list_colour_b_b; } + + $area_port_count = mysql_result(mysql_query("SELECT COUNT(*) FROM `ospf_ports` WHERE `device_id` = '".$device['device_id']."' AND `ospfIfAreaId` = '".$area['ospfAreaId']."'"),0); + $area_port_count_enabled = mysql_result(mysql_query("SELECT COUNT(*) FROM `ospf_ports` WHERE `ospfIfAdminStat` = 'enabled' AND `device_id` = '".$device['device_id']."' AND `ospfIfAreaId` = '".$area['ospfAreaId']."'"),0); + + echo(''); + echo(' '); + echo(' '); + echo(' '); + echo(' '); + echo(''); + + echo(''); + echo(''); + echo(''); + + $i_a++; + + } ### End loop areas + + echo('
Area IdStatusPorts
'.$area['ospfAreaId'] . '' . $enabled . '' . $area_port_count . '('.$area_port_count_enabled.')
'); + echo(''); + echo(''); + + ##### Loop Ports + $i_p = $i_a + 1; + $p_sql = "SELECT * FROM `ospf_ports` AS O, `ports` AS P WHERE O.`ospfIfAdminStat` = 'enabled' AND O.`device_id` = '".$device['device_id']."' AND O.`ospfIfAreaId` = '".$area['ospfAreaId']."' AND P.interface_id = O.interface_id"; + $p_query = mysql_query($p_sql); + while($ospfport = mysql_fetch_assoc($p_query)) + { + + if (!is_integer($i_a/2)) { + if (!is_integer($i_p/2)) { $port_bg = $list_colour_b_b; } else { $port_bg = $list_colour_b_a; } + } else { + if (!is_integer($i_p/2)) { $port_bg = $list_colour_a_b; } else { $port_bg = $list_colour_a_a; } + } + + + if($ospfport['ospfIfAdminStat'] == "enabled") { $port_enabled = 'enabled'; } else { $port_enabled = 'disabled'; } + + echo(''); + echo(' '); + echo(' '); + echo(' '); + echo(' '); + echo(' '); + echo(''); + + $i_p++; + } + echo('
PortStatusPort TypePort State
'. generate_port_link($ospfport) . '' . $port_enabled . '' . $ospfport['ospfIfType'] . '' . $ospfport['ospfIfState'] . '
'); + echo('
'); + echo('
'); + ?> diff --git a/html/pages/device/routing/overview/ospf.inc.php b/html/pages/device/routing/overview/ospf.inc.php index 1414fbbb0..38b31b9da 100644 --- a/html/pages/device/routing/overview/ospf.inc.php +++ b/html/pages/device/routing/overview/ospf.inc.php @@ -1,26 +1,47 @@ '); -echo(" - - - - - - - - - - - - -
Router IDArea CountPort CountNeighbour Count
".$instance['ospfRouterId']."".$area_count."".$port_count."
-"); +#### Loop Instances + +while($instance = mysql_fetch_assoc($query)) +{ + + if (!is_integer($i_i/2)) { $instance_bg = $list_colour_a; } else { $instance_bg = $list_colour_b; } + + $area_count = mysql_result(mysql_query("SELECT COUNT(*) FROM `ospf_areas` WHERE `device_id` = '".$device['device_id']."'"),0); + $port_count = mysql_result(mysql_query("SELECT COUNT(*) FROM `ospf_ports` WHERE `device_id` = '".$device['device_id']."'"),0); + + $query = "SELECT * FROM ipv4_addresses AS A, ports AS I WHERE "; + $query .= "(A.ipv4_address = '".$peer['bgpPeerIdentifier']."' AND I.interface_id = A.interface_id)"; + $query .= " AND I.device_id = '".$device['device_id']."'"; + $ipv4_host = mysql_fetch_assoc(mysql_query($query)); + + if($instance['ospfAdminStat'] == "enabled") { $enabled = 'enabled'; } else { $enabled = 'disabled'; } + if($instance['ospfAreaBdrRtrStatus'] == "true") { $abr = 'yes'; } else { $abr = 'no'; } + if($instance['ospfASBdrRtrStatus'] == "true") { $asbr = 'yes'; } else { $asbr = 'no'; } + + echo('Router IdStatusABRASBRAreasPortsNeighbours'); + echo(''); + echo(' '.$instance['ospfRouterId'] . ''); + echo(' ' . $enabled . ''); + echo(' ' . $abr . ''); + echo(' ' . $asbr . ''); + echo(' ' . $area_count . ''); + echo(' ' . $port_count . ''); + echo(' ' . ($neighbour_count+0) . ''); + echo(''); + + + $i_i++; + +} ### End loop instances + +echo(''); ?> diff --git a/html/pages/routing.inc.php b/html/pages/routing.inc.php index fec16c52d..f2b49a4b2 100644 --- a/html/pages/routing.inc.php +++ b/html/pages/routing.inc.php @@ -1,23 +1,22 @@ Routing » "); unset($sep); foreach ($datas as $type) { + + if (!$_GET['opta']) { $_GET['opta'] = $type; } + echo($sep); if ($_GET['opta'] == $type) @@ -39,7 +41,7 @@ foreach ($datas as $type) echo(''); } - echo(" " . $type_text[$type] .""); + echo(" " . $type_text[$type] ." (".$routing_count[$type].")"); if ($_GET['opta'] == $type) { echo(""); } $sep = " | "; }