Commit 9895f40d authored by José Luis  Gutiérrez's avatar José Luis Gutiérrez Committed by Alessandro Rubini

www: Front-end Adaptation to WRS 4.0

Front-end Adaptation to WRS 4.0:
	- New firmware menu
	- endpoint tools adaptation.
	- ppsi adaptation
	- adding firmware tools (not ready, needs back-end).
	- terminal fixes
	- dhcp vs static ip

- Minor fixes
parent 17eb0770
......@@ -32,7 +32,6 @@
<IMG SRC="img/cern.jpg" WIDTH=80 ALT="CERN">
<IMG SRC="img/7s.png" WIDTH=80 ALT="Seven Solutions">
<IMG SRC="img/ugr.gif" WIDTH=140 ALT="University of Granada">
<IMG SRC="img/integrasys.jpg" WIDTH=140 ALT="Integrasys">
</center>
<br><br>
......
......@@ -26,7 +26,7 @@
<?php
$file_init = 'global = {'."\n";
$file_init .= "\t".'sfp_database_path = "/wr/etc/sfp_database.conf";'."\n";
$file_init .= "\t".'sfp_database_path = "'.$GLOBALS['etcdir'].'sfp_database.conf";'."\n";
$file_init .= '};'."\n\n";
$file_init .= 'timing = {'."\n\n";
......@@ -141,7 +141,7 @@
fclose($file);
//We move the file to /wr/etc/
copy('/tmp/wrsw_hal.conf', '/wr/etc/wrsw_hal.conf');
copy('/tmp/wrsw_hal.conf', $GLOBALS['etcdir'].'wrsw_hal.conf');
echo '<center><font color="green">File successfully created. Rebooting switch. </font></center>';
......
......@@ -23,7 +23,8 @@
<?php
//Load all
$modes = parse_wrsw_hal_file();
//$modes = parse_wrsw_hal_file();
$modes = parse_ppsi_conf_file();
echo '<table align=center border="1" class="altrowstable" id="alternatecolor">';
//echo '<tr><th><center>Endpoint</center></th><th><center>Mode</center></th></tr>';
......@@ -47,24 +48,25 @@
?>
<br>
<br><br><br><br><br><br>
<hr>
<FORM align="right" method="post">
<input type="hidden" name="hal" value="hal">
<INPUT type="submit" value="Reboot Hal daemon" class="btn">
<INPUT type="submit" value="Reboot PPSi&Hal daemons" class="btn">
</FORM>
<?php
if (!empty($_POST["hal"])){
//We must relaunch ptpd too. (by default)
shell_exec("killall ppsi");
$ptp_command = "/wr/bin/ppsi > /dev/null 2>&1 &";
$output = shell_exec($ptp_command);
//Relaunching wrsw_hal to commit endpoint changes
shell_exec("killall wrsw_hal");
shell_exec("/wr/bin/wrsw_hal -c /wr/etc/wrsw_hal.conf > /dev/null 2>&1 &");
shell_exec("/wr/bin/wrsw_hal -c ".$GLOBALS['etcdir']."wrsw_hal.conf > /dev/null 2>&1 &");
//We must relaunch ptpd too. (by default)
shell_exec("killall ptpd");
$ptp_command = "/wr/bin/ptpd -A -c > /dev/null 2>&1 &";
$output = shell_exec($ptp_command);
}
?>
......
<?php include 'functions.php'; include 'head.php'; ?>
<body id="management">
<div class="main">
<div class="page">
<div class="header" >
<!--<h1>White-Rabbit Switch Tool</h1>-->
<div class="header-ports" ><?php wrs_header_ports(); ?></div>
<div class="topmenu">
<?php include 'topmenu.php' ?>
</div>
</div>
<div class="content">
<div class="leftpanel">
<h2>Main Menu</h2>
<?php include 'menu.php' ?>
</div>
<div class="rightpanel">
<div class="rightbody">
<h1 class="title">Firmware Management <a href='help.php?help_id=firmware' onClick='showPopup(this.href);return(false);'><img align=right src="./img/question.png"></a></h1>
<?php session_is_started() ?>
<?php $_SESSION['advance']=""; ?>
<table border="0" align="center">
<tr>
<form method="post">
<th>Change PHP File Size Upload: (<?php wrs_php_filesize();?>M)<INPUT type="text" name="size" > </th>
<input type="hidden" name="cmd" value="size">
<th><input type="submit" value="Change" class="btn"></th>
</form>
</tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr>
<FORM method="POST" ENCTYPE="multipart/form-data" onsubmit="return confirm('Are you sure you want to upload and flash a new firmware?');">
<th ><INPUT type=file name="file" ></th>
<th><INPUT type=submit value="Flash Firmware" class="btn" ><INPUT type=hidden name=MAX_FILE_SIZE VALUE= <?php wrs_php_filesize();?>000></th>
</FORM>
</tr><tr></tr><tr></tr><tr>
<FORM method="POST" ENCTYPE="multipart/form-data" >
<th>Download a backup of the entire wrs</th>
<th><INPUT type=submit value="Backup Firmware" class="btn"><input type="hidden" name="cmd" value="backup-wrs"></th>
</FORM>
</tr>
</table>
<?php
wrs_change_wrfs("rw");
wrs_management();
wrs_change_wrfs("ro");
?>
</div>
</div>
</div>
<div class="footer">
<?php include 'footer.php' ?>
</div>
</div>
</div>
</body>
</html>
......@@ -32,6 +32,7 @@
$_SESSION["myusername"] = $username;
echo 'Logged in as '.$_SESSION["myusername"];
header('Location: index.php');
}else{
......
......@@ -24,12 +24,11 @@ echo '<div class="login">
}else{
//The rest of the menu for logged users
if(file_exists('/wr/bin/wrsw_rtud_new')) {echo '<li><a href="vlan.php"> VLAN Configuration </a></li>';}
echo '<li><a href="ptp.php"> PTP Configuration </a></li>';
echo '<li><a href="ptp.php"> PPSi Setup </a></li>';
echo '<li><a href="endpointmode.php"> Endpoint Mode</a></li>';
echo '<li><a href="vlan.php"> VLAN Setup </a></li>';
echo '<li><a href="management.php"> Switch Management </a></li>';
echo '<li><a href="advance.php"> Advance Mode </a></li>';
echo '<li><a href="advance.php"> Advanced Mode </a></li>';
//echo '<li><a href="administration.php"> Switch Administration </a></li>';
if(!empty($_SESSION['advance'])){
echo '<ul class="advance">';
......@@ -38,6 +37,7 @@ echo '<div class="login">
echo '<li><a href="endpointcalibration.php">Endpoint Calibration</a></li>';
echo '<li><a href="load.php">LM32 & FPGA</a></li>';
echo '<li><a href="terminal.php">Virtual Console</a></li>';
echo '<li><a href="firmware.php">Firmware</a></li>';
echo '</ul>';
}
echo '</ul><br><hr>';
......
......@@ -29,6 +29,9 @@
wrs_modify_endpoint_mode($endpoint, $mode);
wrs_change_wrfs("ro");
header('Location: endpointmode.php');
exit;
?>
<hr>
<FORM align="right" action="endpointmode.php" method="post">
......
<?php include 'functions.php'; include 'head.php'; ?>
<body id="ptp">
<div class="main">
<div class="page">
<div class="header" >
<!--<h1>White-Rabbit Switch Tool</h1>-->
<div class="header-ports" ><?php wrs_header_ports(); ?></div>
<div class="topmenu">
<?php include 'topmenu.php' ?>
</div>
</div>
<div class="content">
<div class="leftpanel">
<h2>Main Menu</h2>
<?php include 'menu.php' ?>
</div>
<div class="rightpanel">
<div class="rightbody">
<h1 class="title">Network Interface Setup <a href='help.php?help_id=ptp' onClick='showPopup(this.href);return(false);'><img align=right src="./img/question.png"></a></h1>
<?php session_is_started() ?>
<?php $_SESSION['advance']=""; ?>
<FORM method="POST">
<table id="daemon" border="0" align="center">
<tr>
<th align=left>eth0 Setup: </th>
<th><input type="radio" name="networkgroup" value="DHCP" <?php if(!strcmp(wrs_interface_setup(), "dhcp")) echo "checked" ?> > DHCP <br>
<input type="radio" name="networkgroup" value="Static" <?php if(!strcmp(wrs_interface_setup(), "static")) echo "checked" ?> > Static <br>
<th><INPUT type="submit" value="Change" class="btn"></th>
</tr>
</table>
</FORM>
<?php
if((empty($_POST["networkgroup"]))){
echo '<center>Current eth0 setup<br></center>';
echo '
<table border="0" align="center">
<tr>
<th align=left>IP Address: </th>
<th ><INPUT type="text" align="center" value="'.shell_exec("ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'").'" readonly name="ip" ></th>
</tr>
<tr>
<th align=left>Netmask: </th>
<th><INPUT type="text" align="center" value="'.shell_exec("ifconfig eth0 | grep 'inet addr:' | cut -d: -f4 | awk '{ print $1}'").'" readonly name="netmask" ></th>
</tr>
<tr>
<th align=left>Broadcast: </th>
<th><INPUT type="text" align="center" value="'.shell_exec("ifconfig eth0 | grep 'inet addr:' | cut -d: -f3 | awk '{ print $1}'").'" readonly name="broadcast" ></th>
</tr>
</table>';
}
if ((!empty($_POST["networkgroup"])) && (!strcmp(htmlspecialchars($_POST["networkgroup"]),"DHCP"))){
$interface_file = "/etc/network/interfaces";
$tmpfile="/tmp/interfaces";
shell_exec('rm /etc/network/interfaces');
$output="# Configure Loopback\nauto lo\niface lo inet loopback\n\n#Force eth0 to be configured by DHCP\nauto eth0\niface eth0 inet dhcp\n\n# Uncomment this example for static configuration\n";
$output.="#iface eth0 inet static\n";
$output.="#\taddress 192.168.1.10";
$output.="\n#\tnetmask 255.255.255.0";
$output.="\n#\tnetwork 192.168.1.0";
$output.="\n#\tbroadcast 192.168.1.255";
$output.="\n#\tgateway 192.168.1.1\n";
$file = fopen($tmpfile,"w+");
fwrite($file,$output);
fclose($file);
//We move the file to /wr/etc/
copy($tmpfile, $interface_file);
echo '<center>DHCP is now set for eth0<br>Restarting network</center>';
//Let's up eth0
shell_exec('/etc/init.d/S40network restart');
}
if ((!empty($_POST["networkgroup"])) && (!strcmp(htmlspecialchars($_POST["networkgroup"]),"Static"))){
//shell_exec('sed -i "s/iface eth0 inet dhcp/#iface eth0 inet dhcp/g" /etc/network/interfaces');
echo '<FORM method="POST">
<table border="0" align="center">
<tr>
<th align=left>IP Address: </th>
<th><INPUT type="text" value="192.168.1.10" name="ip" ></th>
</tr>
<tr>
<th align=left>Netmask: </th>
<th><INPUT type="text" value="255.255.255.0" name="netmask" ></th>
</tr>
<tr>
<th align=left>Network: </th>
<th><INPUT type="text" value="192.168.1.0" name="network" ></th>
</tr>
<tr>
<th align=left>Broadcast: </th>
<th><INPUT type="text" value="192.168.1.255" name="broadcast" ></th>
</tr>
<tr>
<th align=left>Gateway: </th>
<th><INPUT type="text" value="192.168.1.1" name="gateway" ></th>
</tr>
</table>
<INPUT type="submit" value="Save New Configuration" class="btn last">
</FORM>';
}
if ((!empty($_POST["ip"])) && (!empty($_POST["netmask"])) && (!empty($_POST["network"])) && (!empty($_POST["broadcast"])) && (!empty($_POST["gateway"]))){
$interface_file = "/etc/network/interfaces";
$tmpfile="/tmp/interfaces";
shell_exec('rm /etc/network/interfaces');
$output="# Configure Loopback\nauto lo\niface lo inet loopback\n\n#Force eth0 to be configured by DHCP\n#auto eth0\n#iface eth0 inet dhcp\n\n# Uncomment this example for static configuration\n";
$output.="iface eth0 inet static\n";
$output.="\taddress ".$_POST["ip"];
$output.="\n\tnetmask ".$_POST["netmask"];
$output.="\n\tnetwork ".$_POST["network"];
$output.="\n\tbroadcast ".$_POST["broadcast"];
$output.="\n\tgateway ".$_POST["gateway"]."\n";
$file = fopen($tmpfile,"w+");
fwrite($file,$output);
fclose($file);
//We move the file to /wr/etc/
copy($tmpfile, $interface_file);
echo '<center>New static configuration saved for eth0<br>Restarting network</center>';
//Let's up eth0
shell_exec('/etc/init.d/S40network restart');
}
?>
</div>
</div>
</div>
<div class="footer">
<?php include 'footer.php' ?>
</div>
</div>
</div>
</body>
</html>
......@@ -16,7 +16,7 @@
</div>
<div class="rightpanel">
<div class="rightbody">
<h1 class="title">PTP Configuration <a href='help.php?help_id=ptp' onClick='showPopup(this.href);return(false);'><img align=right src="./img/question.png"></a></h1>
<h1 class="title">PPSi Configuration <a href='help.php?help_id=ptp' onClick='showPopup(this.href);return(false);'><img align=right src="./img/question.png"></a></h1>
<?php session_is_started() ?>
<?php $_SESSION['advance']=""; ?>
......@@ -24,17 +24,27 @@
<FORM method="POST">
<table id="daemon" border="0" align="center">
<tr>
<th align=left>PTP Daemon: </th>
<th align=left>PPSi Daemon: </th>
<th><input type="radio" name="daemongroup" value="On" <?php echo (wrs_check_ptp_status()) ? 'checked' : ''; ?> > On <br>
<input type="radio" name="daemongroup" value="Off" <?php echo (wrs_check_ptp_status()) ? '' : 'checked'; ?> > Off <br>
<th><INPUT type="submit" value="Update" class="btn"></th>
<th><INPUT type="submit" value="<?php echo (wrs_check_ptp_status()) ? 'Disable PPSi' : 'Enable PPSi'; ?>" class="btn"></th>
</tr>
</table>
</FORM>
<FORM method="POST">
<table border="0" align="center">
<tr>
<th align=left>Clock Class: </th>
<th><INPUT type="text" name="clkclass" value="<?php echo shell_exec("cat ".$GLOBALS['etcdir'].$GLOBALS['ppsiconf']." | grep class | awk '{print $2}'");?>" ></th>
</tr>
<tr>
<th align=left>Clock Accuracy: </th>
<th><INPUT type="text" name="clkacc" value="<?php echo shell_exec("cat ".$GLOBALS['etcdir'].$GLOBALS['ppsiconf']." | grep accuracy | awk '{print $2}'");?>"></th>
</tr>
<!--
<tr>
<th align=left>Network Interface Binding: </th>
<th><INPUT type="text" name="b" ></th>
......@@ -67,10 +77,23 @@
<th align=left>Priority: </th>
<th><INPUT type="text" name="p" ></th>
</tr>
-->
</table>
<INPUT type="submit" value="Submit Configuration" class="btn last">
<INPUT type="submit" value="Update & Relaunch" class="btn last">
</FORM>
<br><br><br><br><br><br><br><br><br><br><br><br>
<hr>
<p align="right">Click <A HREF="endpointmode.php">here</A> to modify endpoint mode configuration</p>
<?php
// Generating the form
?>
<?php
wrs_ptp_configuration();
......
......@@ -119,7 +119,7 @@
fclose($file);
//We move the file to /wr/etc/
copy('/tmp/sfp_database.conf', '/wr/etc/sfp_database.conf');
copy('/tmp/sfp_database.conf',$GLOBALS['etcdir'].'sfp_database.conf');
echo '<center><font color="green">File successfully created. Rebooting switch. </font></center>';
......
......@@ -100,6 +100,9 @@
$output = shell_exec( $path." ; cd ".$_SESSION["pwd"]." ; ".$cmd);
}
//Format output
$output=str_replace("\n","<br>",$output);
echo '<div align="center"> <div id="preview" style= "BORDER-RIGHT: #000 1px solid; PADDING-RIGHT: 0px;
BORDER-TOP: #000 1px solid; PADDING-LEFT: 2px; PADDING-BOTTOM: 2px; WORD-SPACING: 1px; OVERFLOW: scroll;
BORDER-LEFT: #000 1px solid; WIDTH: 100%; PADDING-TOP: 1px;
......
......@@ -11,10 +11,11 @@ echo '<ul>
echo '<ul>
<li><a href="index.php"> Dashboard </a></li>
<li><a href="ptp.php"> PTP Configuration </a></li>
<li><a href="ptp.php"> PPSi Setup </a></li>
<li><a href="vlan.php"> VLAN Setup </a></li>
<li><a href="endpointmode.php"> Endpoint Mode</a></li>
<li><a href="management.php"> Switch Management </a></li>
<li><a href="contact.php"> Contact Us </a></li>
<li><a href="contact.php"> About </a></li>
</ul>';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment