diff --git a/html/includes/print-menubar.php b/html/includes/print-menubar.php index 9944f35cca..f853731232 100644 --- a/html/includes/print-menubar.php +++ b/html/includes/print-menubar.php @@ -153,8 +153,6 @@ if ($config['enable_billing']) { echo('
  • Pseudowires
  • '); $ifbreak = 1; } -if ($config['enable_vrfs']) { echo('
  • VRFs
  • '); $ifbreak = 1; } - ?> = '5')
      '); + if ($config['enable_vrfs']) { echo('
    • VRFs

    • '); } + ## BGP Sessions if ($_SESSION['userlevel'] >= '5' && (isset($config['enable_bgp']) && $config['enable_bgp'])) { diff --git a/html/pages/routing.inc.php b/html/pages/routing.inc.php index 6892188a1b..620a921d7f 100644 --- a/html/pages/routing.inc.php +++ b/html/pages/routing.inc.php @@ -18,6 +18,21 @@ print_optionbar_start('', ''); echo('BGP'); if ($_GET['opta'] == "bgp") { echo(""); } + echo(" | "); + + ## Start OSPF Menu -- FIXME only show if BGP enabled? + if ($_GET['opta'] == "ospf") { echo(""); } + echo('OSPF'); + if ($_GET['opta'] == "ospf") { echo(""); } + + echo(" | "); + + ## Start VRF Menu -- FIXME only show if BGP enabled? + if ($_GET['opta'] == "vrf") { echo(""); } + echo('VRF'); + if ($_GET['opta'] == "vrf") { echo(""); } + + print_optionbar_end('', ''); @@ -25,6 +40,7 @@ switch ($_GET['opta']) { case 'overview': case 'bgp': + case 'vrf': include('pages/routing/'.$_GET['opta'].'.inc.php'); break; default: diff --git a/html/pages/routing/vrf.inc.php b/html/pages/routing/vrf.inc.php new file mode 100644 index 0000000000..f508ae5bee --- /dev/null +++ b/html/pages/routing/vrf.inc.php @@ -0,0 +1,163 @@ += '5') { + + if(!isset($_GET['optb'])) { $_GET['optb'] = "all"; } + if(!isset($_GET['optc'])) { $_GET['optc'] = "basic"; } + + print_optionbar_start(); + + echo('VRF » '); + + if ($_GET['opta'] == "vrf" && $_GET['optb'] == "all") { echo(""); } + echo('All'); + if ($_GET['opta'] == "vrf" && $_GET['optb'] == "all") { echo(""); } + echo(' | '); + if ($_GET['opta'] == "vrf" && $_GET['optc'] == "basic") { echo(""); } + echo('Basic'); + if ($_GET['opta'] == "vrf" && $_GET['optc'] == "basic") { echo(""); } + echo(" | "); + if ($_GET['opta'] == "vrf" && $_GET['optc'] == "details") { echo(""); } + echo('Details'); + if ($_GET['opta'] == "vrf" && $_GET['optc'] == "details") { echo(""); } + echo(" | Graphs: ( "); + if ($_GET['opta'] == "vrf" && $_GET['optc'] == "bits") { echo(""); } + echo('Bits'); + if ($_GET['opta'] == "vrf" && $_GET['optc'] == "bits") { echo(""); } + echo(" | "); + if ($_GET['opta'] == "vrf" && $_GET['optc'] == "upkts") { echo(""); } + echo('Packets'); + if ($_GET['opta'] == "vrf" && $_GET['optc'] == "upkts") { echo(""); } + echo(" | "); + if ($_GET['opta'] == "vrf" && $_GET['optc'] == "nupkts") { echo(""); } + echo('NU Packets'); + if ($_GET['opta'] == "vrf" && $_GET['optc'] == "nupkts") { echo(""); } + echo(" | "); + if ($_GET['opta'] == "vrf" && $_GET['optc'] == "errors") { echo(""); } + echo('Errors'); + if ($_GET['opta'] == "vrf" && $_GET['optc'] == "errors") { echo(""); } + + echo(" )"); + + print_optionbar_end(); + +if($_GET['optb'] == "all" ) { + + echo("
      "); + $i = "1"; + $vrf_query = mysql_query("SELECT * FROM `vrfs` GROUP BY `mplsVpnVrfRouteDistinguisher`"); + while ($vrf = mysql_fetch_assoc($vrf_query)) + { + if (!is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; } + echo(""); + echo(""); + echo(""); + #echo(""); + echo(""); + + $i++; + } + echo("
      " . $vrf['vrf_name'] . "
      " . $vrf['mplsVpnVrfDescription'] . "
      " . $vrf['mplsVpnVrfRouteDistinguisher'] . "" . $vrf['mplsVpnVrfDescription'] . ""); + $devices = mysql_query("SELECT * FROM `vrfs` AS V, `devices` AS D WHERE `mplsVpnVrfRouteDistinguisher` = '".$vrf['mplsVpnVrfRouteDistinguisher']."' AND D.device_id = V.device_id"); + $x=1; + while ($device = mysql_fetch_assoc($devices)) + { + if (!is_integer($i/2)) + { + if (!is_integer($x/2)) { $dev_colour = $list_colour_a_a; } else { $dev_colour = $list_colour_a_b; } + } else { + if (!is_integer($x/2)) { $dev_colour = $list_colour_b_b; } else { $dev_colour = $list_colour_b_a; } + } + echo(""); + $x++; + } // End While + + echo("
      ".generate_device_link($device, shorthost($device['hostname']))); + + if ($device['vrf_name'] != $vrf['vrf_name']) { echo("Configured : ".$device['vrf_name']."', CAPTION, 'VRF Inconsistency' ,FGCOLOR,'#e5e5e5', BGCOLOR, '#c0c0c0', BORDER, 5, CELLPAD, 4, CAPCOLOR, '#050505');\" onmouseout=\"return nd();\"> "); } + echo(""); + $ports = mysql_query("SELECT * FROM `ports` WHERE `ifVrf` = '".$device['vrf_id']."' and device_id = '".$device['device_id']."'"); + unset($seperator); + + while ($port = mysql_fetch_assoc($ports)) + { + $port = array_merge ($device, $port); + + switch ($_GET['optc']) + { + case 'bits': + case 'pkts': + case 'nupkts': + case 'errors': + $port['width'] = "130"; + $port['height'] = "30"; + $port['from'] = $day; + $port['to'] = $now; + $port['bg'] = "#".$bg; + $port['graph_type'] = "port_".$_GET['optc']; + echo("
      +
      ".makeshortif($port['ifDescr'])."
      "); + generate_port_thumbnail($port); + echo("
      ".truncate(short_port_descr($port['ifAlias']), 22, '')."
      +
      "); + break; + + default: + echo($seperator.generate_port_link($port,makeshortif($port['ifDescr']))); + $seperator = ", "; + break; + } + } + echo("
      "); + +} else { + + echo("
      "); + $vrf_query = mysql_query("SELECT * FROM `vrfs` WHERE mplsVpnVrfRouteDistinguisher = '".$_GET['optb']."'"); + $vrf = mysql_fetch_assoc($vrf_query); + echo(""); + echo(""); + echo(""); + echo(""); + echo("
      " . $vrf['vrf_name'] . "" . $vrf['mplsVpnVrfRouteDistinguisher'] . "" . $vrf['mplsVpnVrfDescription'] . "
      "); + + $devices = mysql_query("SELECT * FROM `vrfs` AS V, `devices` AS D WHERE `mplsVpnVrfRouteDistinguisher` = '".$vrf['mplsVpnVrfRouteDistinguisher']."' AND D.device_id = V.device_id"); + $x=1; + + while ($device = mysql_fetch_assoc($devices)) + { + $hostname = $device['hostname']; + #if (!is_integer($x/2)) { $device_colour = $list_colour_a; } else { $device_colour = $list_colour_b; } + echo(""); + include("includes/device-header.inc.php"); + echo("
      "); + $ports = mysql_query("SELECT * FROM `ports` WHERE `ifVrf` = '".$device['vrf_id']."' and device_id = '".$device['device_id']."'"); + unset($seperator); + echo(""); + $i=1; + while ($interface = mysql_fetch_assoc($ports)) + { + if (!is_integer($x/2)) + { + if (is_integer($i/2)) { $int_colour = $list_colour_a_a; } else { $int_colour = $list_colour_a_b; } + } else { + if (is_integer($i/2)) { $int_colour = $list_colour_b_b; } else { $int_colour = $list_colour_b_a; } + } + include("includes/print-interface.inc.php"); + $i++; + } + $x++; + echo("
      "); + echo("
      "); + } + +} + +} else { + + include("includes/error-no-perm.inc.php"); + +} ## End Permission if + +?> diff --git a/html/pages/vrf.inc.php b/html/pages/vrf.inc.php deleted file mode 100644 index 9e34ed2451..0000000000 --- a/html/pages/vrf.inc.php +++ /dev/null @@ -1,68 +0,0 @@ - -Basic | -Details | Graphs: -Bits | -Packets | -NU Packets | -Errors -"); - -if ($_GET['opta'] == 'graphs') -{ - if ($_GET['optb']) - { - $graph_type = $_GET['optb']; - } else { - $graph_type = "bits"; - } - $dographs = 1; -} - -if ($_GET['opta'] == "details" ) -{ - $port_details = 1; -} - -echo("
      "); -$vrf_query = mysql_query("SELECT * FROM `vrfs` WHERE mplsVpnVrfRouteDistinguisher = '".$_GET['id']."'"); -$vrf = mysql_fetch_assoc($vrf_query); -echo(""); -echo(""); -echo(""); -echo(""); -echo("
      " . $vrf['vrf_name'] . "" . $vrf['mplsVpnVrfRouteDistinguisher'] . "" . $vrf['mplsVpnVrfDescription'] . "
      "); - -$devices = mysql_query("SELECT * FROM `vrfs` AS V, `devices` AS D WHERE `mplsVpnVrfRouteDistinguisher` = '".$vrf['mplsVpnVrfRouteDistinguisher']."' AND D.device_id = V.device_id"); -$x=1; - -while ($device = mysql_fetch_assoc($devices)) -{ - $hostname = $device['hostname']; - #if (!is_integer($x/2)) { $device_colour = $list_colour_a; } else { $device_colour = $list_colour_b; } - echo(""); - include("includes/device-header.inc.php"); - echo("
      "); - $ports = mysql_query("SELECT * FROM `ports` WHERE `ifVrf` = '".$device['vrf_id']."' and device_id = '".$device['device_id']."'"); - unset($seperator); - echo(""); - $i=1; - while ($interface = mysql_fetch_assoc($ports)) - { - if (!is_integer($x/2)) - { - if (is_integer($i/2)) { $int_colour = $list_colour_a_a; } else { $int_colour = $list_colour_a_b; } - } else { - if (is_integer($i/2)) { $int_colour = $list_colour_b_b; } else { $int_colour = $list_colour_b_a; } - } - include("includes/print-interface.inc.php"); - $i++; - } - $x++; - echo("
      "); - echo("
      "); -} - -?> \ No newline at end of file diff --git a/html/pages/vrfs.inc.php b/html/pages/vrfs.inc.php deleted file mode 100644 index 0339625a17..0000000000 --- a/html/pages/vrfs.inc.php +++ /dev/null @@ -1,81 +0,0 @@ -= '5') -{ - print_optionbar_start(); - echo(" -Basic | Graphs : -Bits | -Packets | -NU Packets | -Errors -"); - print_optionbar_end(); - - echo("
      "); - $i = "1"; - $vrf_query = mysql_query("SELECT * FROM `vrfs` GROUP BY `mplsVpnVrfRouteDistinguisher`"); - while ($vrf = mysql_fetch_assoc($vrf_query)) - { - if (!is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; } - echo(""); - echo(""); - echo(""); - #echo(""); - echo(""); - - $i++; - } - echo("
      " . $vrf['vrf_name'] . "
      " . $vrf['mplsVpnVrfDescription'] . "
      " . $vrf['mplsVpnVrfRouteDistinguisher'] . "" . $vrf['mplsVpnVrfDescription'] . ""); - $devices = mysql_query("SELECT * FROM `vrfs` AS V, `devices` AS D WHERE `mplsVpnVrfRouteDistinguisher` = '".$vrf['mplsVpnVrfRouteDistinguisher']."' AND D.device_id = V.device_id"); - $x=1; - while ($device = mysql_fetch_assoc($devices)) - { - if (!is_integer($i/2)) - { - if (!is_integer($x/2)) { $dev_colour = $list_colour_a_a; } else { $dev_colour = $list_colour_a_b; } - } else { - if (!is_integer($x/2)) { $dev_colour = $list_colour_b_b; } else { $dev_colour = $list_colour_b_a; } - } - echo(""); - $x++; - } // End While - - echo("
      ".generate_device_link($device, shorthost($device['hostname']))); - - if ($device['vrf_name'] != $vrf['vrf_name']) { echo("Configured : ".$device['vrf_name']."', CAPTION, 'VRF Inconsistency' ,FGCOLOR,'#e5e5e5', BGCOLOR, '#c0c0c0', BORDER, 5, CELLPAD, 4, CAPCOLOR, '#050505');\" onmouseout=\"return nd();\"> "); } - echo(""); - $ports = mysql_query("SELECT * FROM `ports` WHERE `ifVrf` = '".$device['vrf_id']."' and device_id = '".$device['device_id']."'"); - unset($seperator); - - while ($port = mysql_fetch_assoc($ports)) - { - $port = array_merge ($device, $port); - if ($_GET['opta']) - { - $port['width'] = "130"; - $port['height'] = "30"; - $port['from'] = $day; - $port['to'] = $now; - $port['bg'] = "#".$bg; - $port['graph_type'] = "port_".$_GET['opta']; - echo("
      -
      ".makeshortif($port['ifDescr'])."
      "); - generate_port_thumbnail($port); - echo("
      ".truncate(short_port_descr($port['ifAlias']), 22, '')."
      -
      "); - } else { - echo($seperator.generate_port_link($port,makeshortif($port['ifDescr']))); - $seperator = ", "; - } - } - echo("
      "); - -} else { - - include("includes/error-no-perm.inc.php"); - -} ## End Permission if - -?> \ No newline at end of file