Commit cfdbd93f authored by Alessandro Rubini's avatar Alessandro Rubini

Merge branch 'guti-140618-rebased'

parents c565a117 86634428
......@@ -109,6 +109,8 @@ WR
: White Rabbit.
WRS
: White Rabbit Switch.
WMI
: Web Management Interface
\clearpage
......@@ -206,6 +208,8 @@ The device is factory configured with the following default settings:
* SSH user: **root**
* SSH password: (empty/just press enter)
* Boot method: from Nandflash firmware
* Web Management Interface user: **admin**
* Web Management Interface password: (empty)
Quick Startup
......@@ -334,6 +338,26 @@ by the one in your subnetwork.
![Putty - SSH connection](putty-SSH.png)
Login using the Web Management Interface
-----------------------
If you want to access and manage the [WRS] using the web interface, it is necessary to connect the [WRS] manager ethernet port to your local network.
The access should be carried out by a network browser (Mozilla Firefox and Google Chrome supported) as it follows:
1. Open your browser and type the IP address (i.e. 192.168.1.50) of the [WRS]. By default, the network IP configuration
is provided by the DHCP server in the same network and can be retrieved from it.
![Web Management Interface - Login](wwwlogin.png)
2. After accessing the [WMI], you should enter the web interface user and password, which is not
same for the SSH connection, otherwise you will be only able to see the Dashboard info.
By default the user is **admin** with no password. For this reason it is strongly recommended to change the password.
In order to change the [WMI] password you just need to click on "**User: admin**" on the left side of the webpage.
You have to enter your username (**admin**), old password, new password and repeat the new password.
Once you submit the new password you will be redirected to the main screen and logged out.
After login:
-------------------
......@@ -354,6 +378,34 @@ The SFP ports are labeled from 1 to 18 on the front panel but their correspondin
network interface are named from `wr0` to `wr17`.
Web Management Interface Features:
-------------------
[WMI] is a web interface that allows the [WRS] management from a web browser. It displays the main configuration and status of the main services and programms that are available for the switch, such as endpoints' mode and calibration status, SFP calibration, PTP, SNMP, VLANs, etc. It acts as an abstraction layer between the back-end scritps and programs in */wr/bin/* folder, making the WR switch management easier for the user.
![Web Management Interface - Switch Management](wwwmanagement.png)
List of all the actions that can be performed by using the [WMI]:
- Display info: IP configuration, switch HW/SW/GW description, WR date, PPSi status, SNMP server status, NTP server status.
- Stop/run services: PPSi, WRSW_HAL, NTP.
- NTP server setup.
- Modify endpoint wr_master/wr_slave mode.
- VLAN setup.
- White-Rabbit timing.
- Modify maximum filesize of uploaded files to the switch.
- PPSi daemon configuration: clock class, clock accuracy, etc.
- Terminal simulation avoiding SSH connections.
- Login system.
- Modify login password.
- Load lm32 and FPGA binaries into the switch.
- Switch reboot.
- Backup and restore configuration files for services (PPSi, HAL, SNMP, etc).
- Restore configuration files from tarball.
- Flash firmware.
- Backup firmware.
Configurations
==================
......@@ -592,6 +644,7 @@ Features
* WRP daemon (node discovery, etc.)
* DHCP client
* SSH server
* Web Management Interface
* Python Support
* NTP Client/Relay/Server
* ARP/ DNS / EtherWake protocol
......
<?php include 'functions.php'; include 'head.php'; ?>
<body>
<body id="advance">
<div class="main">
<div class="page">
<div class="header" >
......
<?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">User Administration <a href='help.php?help_id=network' 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="left">
<form method="post">
<tr><th>Username: </th><th><INPUT type="text" name="user" value="admin" readonly></th></tr>
<tr><th>Old Password: </th><th><INPUT type="password" name="oldpasswd" > </th></tr>
<tr><th>New Password: </th><th> <INPUT type="password" name="newpasswd" > </th></tr>
<tr><th>Confirm Password: </th><th><INPUT type="password" name="confirmpasswd" > </th></tr>
<tr><th></th><th align="center"><input type="submit" value="Change Password" class="btn"></th></tr>
</form>
</table>
<?php
wrs_change_wrfs("rw");
//Change user password
$success=false;
if( empty($_POST['user'])){
echo '<br><br><br><p align=center>Please fill fields.<br></p>';
}else{
$saved_hash = shell_exec("cat ".$GLOBALS['phpusersfile']." | grep ".$_POST["user"]." | awk '{print $2}'");
$saved_hash = str_replace("\n","",$saved_hash);
$username = $_POST["user"];
$oldpassword = $_POST["oldpasswd"];
$newpasswd = $_POST["newpasswd"];
$confirmpasswd = $_POST["confirmpasswd"];
//First confirm old password
$salt="wrs4.0salt";
$pass = $oldpassword;
$hash = md5($pass); // md5 hash #1
$hash_md5 = md5($salt.$pass); // md5 hash with salt #2
$hash_md5_double = md5(sha1($salt.$pass)); // md5 hash with salt & sha1 #3
if (!strcmp($hash_md5_double, $saved_hash) && !strcmp($newpasswd, $confirmpasswd) && !strcmp($_POST["user"],$_SESSION['myusername'])){ //old password is correct && new and confirm are the same
//set the new one
$pass = $confirmpasswd;
$hash = md5($pass); // md5 hash #1
$hash_md5 = md5($salt.$pass); // md5 hash with salt #2
$hash_md5_double = md5(sha1($salt.$pass)); // md5 hash with salt & sha1 #3
//Save in file
//We save the changes in a temporarely file in /tmp
$old_value=$username." ".$saved_hash;
$new_value=$username." ".$hash_md5_double;
$output = shell_exec('cat '.$GLOBALS['phpusersfile'].' | sed -i "s/'.$old_value.'/'.$new_value.'/g" '.$GLOBALS['phpusersfile']); //replace password for the user
//$file = fopen("/etc/phpusers","w+");
//fwrite($file,$output);
//fclose($file);
$success=true;
echo '<br><br><br><p align=center>Password changed.<br></p>';
}else{
$success=false;
echo '<br><br><br><p align=center>Error changing password.<br></p>';
}
}
wrs_change_wrfs("ro");
if($success) header('Location: logout.php');
?>
</div>
</div>
</div>
<div class="footer">
<?php include 'footer.php' ?>
</div>
</div>
</div>
</body>
</html>
<?php include 'functions.php'; include 'head.php'; ?>
<body>
<body id="contact">
<div class="main">
<div class="page">
<div class="header" >
......@@ -16,16 +16,26 @@
</div>
<div class="rightpanel">
<div class="rightbody">
<h1 class="title">Contact</h1>
<h1 class="title">About</h1>
<?php $_SESSION['advance']=""; ?>
<p><strong>White-Rabbit switch Firmware v<?php $str = shell_exec("uname -v"); echo $str; ?> </strong></p><p>&nbsp;</p>
<p><strong>Open Hardware Repository <a href="http://www.ohwr.org/projects/white-rabbit/wiki">http://www.ohwr.org/projects/white-rabbit/wiki</a> </strong></p></strong></p><p>&nbsp;</p>
<p><strong>Built in <?php $str = shell_exec("/wr/bin/shw_ver -c"); echo $str; ?></strong></p><p>&nbsp;</p>
<p><strong>WRSW OS: <?php $str = shell_exec("uname -r"); echo $str; ?> </strong></p>
<p><strong><?php $str = shell_exec("/wr/bin/shw_ver -g"); $str = str_replace("\n","<br>",$str);
$str=str_replace("Reading GW info","",$str); echo $str; ?></strong></p><p>&nbsp;</p>
<br>
<center><p align=right><strong>Open Hardware Repository <a href="http://www.ohwr.org/projects/white-rabbit/wiki">http://www.ohwr.org/projects/white-rabbit/wiki</a> </strong></p></strong></p><p>&nbsp;</p>
<p align=right><strong>White-Rabbit Mailing List <a href="mailto:white-rabbit-dev@ohwr.org?subject=[White-Rabbit Switch Local Management Tool]">(white-rabbit-dev@ohwr.org)</a> </strong></p></center>
<a href='http://www.ugr.es'><IMG SRC='img/ugr.gif' align=right width=250 , hight=100 , border=0 , alt='UGR'></a><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>
<p align=right><strong>Developed by Jos&eacute; Luis Guti&eacute;rrez <a href="mailto:jlgutierrez@ugr.es?subject=[White-Rabbit Switch Local Management Tool]">(jlgutierrez@ugr.es)</a> </strong></p>
<br><br><br><br><br>
<center>
<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">
</center>
<br><br>
<p align=right><strong>Developers: </strong>Alessandro Rubini, Tomasz Wlostowski, Benoit Rat, Federico Vega, Grzegorz Daniluk, Maciej Lipinski, Jose Luis Gutierrez</p>
</div>
</div>
......
/*
* This work is part of the White Rabbit project
*
* Copyright (C) 2014 UGR (www.ugr.es)
* Copyright (C) 2014 7S (www.sevensols.com)
* Author: Jose Luis Gutierrez <jlgutierrez@ugr.es>
* Author: Benoit Rat <benoit@sevensols.com>
*
* Released according to the GNU GPL, version 2 or any later version.
*/
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
}
hr {
border: none;
border-top: 1px dashed black;
height: 1px;
}
/*
* This work is part of the White Rabbit project
*
* Color scheme:
*
*
* Button:
*
* Light: #3A8AAF
* Dark: #002350
*
*
*
* Copyright (C) 2014 UGR (www.ugr.es)
* Copyright (C) 2014 7S (www.sevensols.com)
* Author: Jose Luis Gutierrez <jlgutierrez@ugr.es>
* Author: Benoit Rat <benoit@sevensols.com>
*
* Released according to the GNU GPL, version 2 or any later version.
*/
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
......@@ -6,6 +26,8 @@ body {
background-repeat: repeat;
margin: 30px 0px 0px 0px;
}
h1, h2, h3, h4, h5, h6, p, ul, ol, li, form, input, textarea {
padding: 0px;
margin: 0px;
......@@ -28,7 +50,7 @@ h1, h2, h3, h4, h5, h6, p, ul, ol, li, form, input, textarea {
}
.header-ports {
background-image: url(../img/header.jpg);
background-color:#ACD0DB;
height: 140px;
margin-top: 15px;
......@@ -83,6 +105,7 @@ h1, h2, h3, h4, h5, h6, p, ul, ol, li, form, input, textarea {
padding: 25px 20px;
margin-right: -260px;
position: relative;
min-height:400px;
}
.leftpanel h2 {
font-size: 14px;
......@@ -108,9 +131,15 @@ h1, h2, h3, h4, h5, h6, p, ul, ol, li, form, input, textarea {
color: #000000;
text-decoration: none;
}
.leftpanel ul li a:hover {
.leftpanel ul a:hover, .leftpanel ul.advance li a:hover {
color: #23b14d;
}
.leftpanel ul.advance li a {
color:grey;
margin-left:10px;
}
.rightpanel {
width: 540px;
float: left;
......@@ -136,19 +165,32 @@ h1, h2, h3, h4, h5, h6, p, ul, ol, li, form, input, textarea {
border-bottom-style: dashed;
border-bottom-color: #cccccc;
}
.title a {
top: -20px;
position: relative;
width: 100%;
float: left;
}
.title a img {
width:20px;
}
.copyright {
border: 0px;
height: 1px;
width: 1px;
}
.footer {
background-image: url(../img/footer.jpg);
background-repeat: no-repeat;
background-position: left top;
/*background: #002350;*/
background:black;
width: 800px;
height: 77px;
float: left;
margin-bottom: 10px;
}
.footer p {
font-size: 11px;
line-height: 57px;
......@@ -159,63 +201,48 @@ h1, h2, h3, h4, h5, h6, p, ul, ol, li, form, input, textarea {
color:#ffffff;
text-decoration:none;
}
.btn {
background: #3498db;
background-image: -webkit-linear-gradient(top, #3498db, #2980b9);
background-image: -moz-linear-gradient(top, #3498db, #2980b9);
background-image: -ms-linear-gradient(top, #3498db, #2980b9);
background-image: -o-linear-gradient(top, #3498db, #2980b9);
background-image: linear-gradient(to bottom, #3498db, #2980b9);
-webkit-border-radius: 60;
-moz-border-radius: 60;
border-radius: 60px;
font-family: Arial;
color: #ffffff;
font-size: 12px;
padding: 1px 5px 2px 7px;
text-decoration: none;
a, a:visited {
color: #002350;
}
.btn:hover {
background: #3cb0fd;
background-image: -webkit-linear-gradient(top, #3cb0fd, #3498db);
background-image: -moz-linear-gradient(top, #3cb0fd, #3498db);
background-image: -ms-linear-gradient(top, #3cb0fd, #3498db);
background-image: -o-linear-gradient(top, #3cb0fd, #3498db);
background-image: linear-gradient(to bottom, #3cb0fd, #3498db);
text-decoration: none;
a:hover {
color: #3A8AAF;
}
.sec {
background: #9bcff2;
background-image: -webkit-linear-gradient(top, #9bcff2, #4fa2d6);
background-image: -moz-linear-gradient(top, #9bcff2, #4fa2d6);
background-image: -ms-linear-gradient(top, #9bcff2, #4fa2d6);
background-image: -o-linear-gradient(top, #9bcff2, #4fa2d6);
background-image: linear-gradient(to bottom, #9bcff2, #4fa2d6);
-webkit-border-radius: 5;
-moz-border-radius: 5;
border-radius: 5px;
.btn {
background: #3A8AAF;
background-image: -webkit-linear-gradient(top, #3A8AAF, #002350);
background-image: -moz-linear-gradient(top, #3A8AAF, #002350);
background-image: -ms-linear-gradient(top, #3A8AAF, #002350);
background-image: -o-linear-gradient(top, #3A8AAF, #002350);
background-image: linear-gradient(to bottom, #3A8AAF, #002350);
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
font-family: Arial;
color: #ffffff;
font-size: 12px;
padding: 1px 5px 2px 7px;
padding: 1px 6px;
text-decoration: none;
border:1px solid darkgrey;
min-height:20px;
}
.sec:hover {
background: #3cb0fd;
background-image: -webkit-linear-gradient(top, #3cb0fd, #3498db);
background-image: -moz-linear-gradient(top, #3cb0fd, #3498db);
background-image: -ms-linear-gradient(top, #3cb0fd, #3498db);
background-image: -o-linear-gradient(top, #3cb0fd, #3498db);
background-image: linear-gradient(to bottom, #3cb0fd, #3498db);
.btn:hover {
background: #3A8AAF;
text-decoration: none;
}
/**
* Light: #3A8AAF
* Dark: #002350
**/
table.altrowstable {
font-family: verdana,arial,sans-serif;
font-size: 10px;
font-size: 11px;
color: #333333;
border-width: 1px;
border-color: #a9c6c9;
......@@ -223,22 +250,47 @@ table.altrowstable {
}
table.altrowstable th {
border-width: 1px;
padding: 8px;
padding: 2px;
border-style: solid;
border-color: #a9c6c9;
}
table.altrowstable td {
border-width: 1px;
padding: 8px;
padding: 4px;
border-style: solid;
border-color: #a9c6c9;
}
table.altrowstabledash {
font-family: verdana,arial,sans-serif;
font-size: 11px;
color: #333333;
border-width: 1px;
border-color: #a9c6c9;
border-collapse: collapse;
}
table.altrowstabledash th {
border-width: 1px;
padding: 4px;
border-style: solid;
border-color: #a9c6c9;
}
table.altrowstabledash td {
border-width: 1px;
padding: 4px;
border-style: solid;
border-color: #a9c6c9;
}
table tr.sub{
color:white;
background-color:#3A8AAF;
}
.oddrowcolor{
background-color: #d4e3e5;
}
.evenrowcolor{
background-color: #c3dde0;
}
.tableheader {
background-color: #95BEE6;
color:white;
......@@ -254,3 +306,46 @@ font-weight: bold;
text-align: center;
width: 80%;
}
input {
padding:0px 1px;
}
form input.last {
min-height:22px;
margin: 20px auto;
margin-left: 30%; /**TODO: Bad Hack **/
}
#epcalib form {
width:90%;
margin: 0 auto;
}
#epcalib form table {
width:100%;
border:none;
}
#epcalib form table .empty, #epcalib form table .empty th{
background:none;
border:none;
height:2px;
}
#ptp #daemon {
width: 50%;
border-bottom: 1px dotted grey;
margin-bottom:10px;
padding-bottom:10px;
}
#ptp #daemon input.btn {
height: 22px;
width: 80px;
}
#management input.btn, #load input.btn {
width: 100px;
height: 22px;
}
<?php include 'functions.php'; include 'head.php'; ?>
<body>
<body id="management">
<div class="main">
<div class="page">
<div class="header" >
......@@ -16,46 +16,25 @@
</div>
<div class="rightpanel">
<div class="rightbody">
<h1 class="title">Switch Administration <a href='help.php?help_id=dashboard' onClick='showPopup(this.href);return(false);'><img align=right src="./img/question.png"></a></h1>
<h1 class="title">VLAN 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']=""; ?>
<FORM align="center" method="post">
<b>Download configuration files to PC: </b><INPUT type="submit" value="Download" class="btn">
<input type="hidden" name="download" value="hal">
</FORM>
<br>
<FORM align="center" action="endpointmode.php" method="post">
<b>Upload configuration files to PC: </b><INPUT type="submit" value="Upload" class="btn">
<input type="hidden" name="upload" value="hal">
</FORM>
<?php
if (!empty($_POST["download"])){
$filename = "configuration.tar";
$filepath = "/tmp/";
if(!strcmp($_GET['vlan'],"all")){ // Delete all vlans and free ports
shell_exec("/wr/bin/wrsw_vlans --clear");
// http headers for zip downloads
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"".$filename."\"");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($filepath.$filename));
ob_end_flush();
@readfile($filepath.$filename);
}
}else{
shell_exec("/wr/bin/wrsw_vlans --rvid ".$_GET['vlan']." --del");
if (!empty($_POST["upload"])){
}
header('Location: vlan.php');
}
?>
......
download folder for system backups
<?php include 'functions.php'; include 'head.php'; ?>
<body>
<body id="endpoint">
<div class="main">
<div class="page">
<div class="header" >
......
<?php include 'functions.php'; include 'head.php'; ?>
<body>
<body id="epcalib">
<div class="main">
<div class="page">
<div class="header" >
......@@ -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";
......@@ -54,7 +54,7 @@
// Timing values:
echo '<tr><th>Switch Timing Values</th></tr>';
echo '<tr class="sub"><th>Switch Timing Values</th></tr>';
echo '<tr><th>PPS Width: </th><th><INPUT type="text" value = "100000" name="pps" > </th></tr>';
echo '<tr><th>Use NMEA: </th><th><INPUT type="text" value = "1" name="nmea" > </th></tr>';
echo '<tr><th>Switch Mode: [Master/GrandMaster] </th><th><INPUT type="text" value = "GrandMaster" name="switchmode" > </th></tr>';
......@@ -62,7 +62,8 @@
// port values:
for($i=0; $i<18; $i++){
echo '<tr><th>Endpoint '.($i+1).'</th></tr>';
echo '<tr class="empty"><th></th></tr>';
echo '<tr class="sub"><th>Endpoint '.($i+1).'</th></tr>';
if($i<4){ echo '<tr><th>Rx min:</th><th><INPUT type="text" value = "160000" name="rx'.$i.'" > </th></tr>';
}else{ echo '<tr><th>Rx min:</th><th><INPUT type="text" value = "161200" name="rx'.$i.'" > </th></tr>';}
echo '<tr><th>Tx min:</th><th><INPUT type="text" value = "0" name="tx'.$i.'" > </th></tr>';
......@@ -73,9 +74,11 @@
}
echo '<input type="hidden" name="newconf" value="newconf">';
echo '</table>';
echo '<div>';
echo '<input type="hidden" name="newconf" value="newconf">';
echo '<input align="right" type="submit" value="Create new file & Reboot" class="btn">';
echo '</div>';
echo '</form>';
......@@ -138,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>';
......
<?php include 'functions.php'; include 'head.php'; ?>
<body>
<body id="epmode">
<div class="main">
<div class="page">
<div class="header" >
......@@ -23,9 +23,10 @@
<?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 '<table align=center border="1" class="altrowstable" id="alternatecolor" width="50%">';
//echo '<tr><th><center>Endpoint</center></th><th><center>Mode</center></th></tr>';
for($i = 0; $i < 9; $i++){
echo '<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="Restart PPSi" 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("killall wrsw_hal");
//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() ?>
<table border="0" align="center">
<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 echo wrs_php_filesize();?>000></th>
</FORM>
</tr>
<!--
<tr></tr><tr></tr><tr>
<FORM method="POST" ENCTYPE="multipart/form-data" >
<th align=center>Download a backup of the entire Switch</th>
<th><INPUT type=submit value="Backup Firmware" class="btn"><input type="hidden" name="cmd" value="backup-wrs"></th>
</FORM>
</tr>
-->
<?php
//Include downloading and flashing from OHWR if file wr-switch-sw-v4.0-rc1-20140710_binaries.tar is available
//$ohwrlink="http://www.ohwr.org/attachments/download/3095/wr-switch-sw-v4.0-rc1-20140710_binaries.tar";
//echo '<tr></tr><tr></tr><tr><tr></tr><tr></tr><tr><tr></tr><tr></tr><tr>';
//echo ' <tr>
//<th >Download binaries from OHWR <FORM method="POST" onsubmit="return confirm("Are you sure you want to upload and flash a new firmware?");"></th>
//<th ><INPUT type=hidden name="cmd" value="remoteflash" >
//<INPUT type=submit value="Download&Flash Firmware from OHWR" class="btn" ></th>
//</FORM>
//</tr>';
?>
</table>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<hr>
<p align=center ><font color="red">NOTE: Flashing the switch with a wrong binary file might damage your device. <br>Please visit the
<A HREF="http://www.ohwr.org/projects/wr-switch-sw/files" TARGET="_new">OHR website</A> for more details.</font>
</p>
<hr>
<?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>
......@@ -12,15 +12,25 @@
<script type="text/javascript">
function altRows(id){
if(document.getElementsByTagName){
var table = document.getElementById(id);
var rows = table.getElementsByTagName("tr");
for(i = 0; i < rows.length; i++){
if(i % 2 == 0){
rows[i].className = "evenrowcolor";
rows[i].className += " evenrowcolor";
}else{
rows[i].className += " oddrowcolor";
}
}
var table = document.getElementById(id+1);
var rows = table.getElementsByTagName("tr");
for(i = 0; i < rows.length; i++){
if(i % 2 == 0){
rows[i].className += " evenrowcolor";
}else{
rows[i].className = "oddrowcolor";
rows[i].className += " oddrowcolor";
}
}
}
......
<?php include 'functions.php' ?>
<html>
<html id="help">
<head>
<title>Help Menu</title>
<link href="css/help.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#FFFF99">
<h1><center>Help</center></h1>
......
userspace/rootfs_override/var/www/img/uncheck.png

10 KB | W: | H:

userspace/rootfs_override/var/www/img/uncheck.png

3.76 KB | W: | H:

userspace/rootfs_override/var/www/img/uncheck.png
userspace/rootfs_override/var/www/img/uncheck.png
userspace/rootfs_override/var/www/img/uncheck.png
userspace/rootfs_override/var/www/img/uncheck.png
  • 2-up
  • Swipe
  • Onion skin
<?php include 'functions.php'; include 'head.php'; ?>
<body>
<body id="dashboard">
<div class="main">
<div class="page">
<div class="header" >
<!--<h1>White-Rabbit Switch Tool</h1>-->
<div class="header-ports" ><?php shell_exec("rm /tmp/ports.conf"); wrs_header_ports(); ?></div>
<div class="header-ports" ><?php wrs_header_ports(); ?></div>
<div class="topmenu">
<?php include 'topmenu.php' ?>
</div>
......
<?php include 'functions.php'; include 'head.php'; ?>
<body>
<body id="load">
<div class="main">
<div class="page">
<div class="header" >
......@@ -19,41 +19,41 @@
<h1 class="title">Load LM32 & FPGA Files <a href='help.php?help_id=load' 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>
<th><FORM method="POST" ENCTYPE="multipart/form-data" >
<th><FORM method="POST" ENCTYPE="multipart/form-data" onsubmit="return confirm('Are you sure you want to upload a new FPGA binary file? \nThis could result in the malfunction of the switch.');">
<INPUT type=file name="fpgafile" >
<INPUT type=submit Value="Load FPGA bin" class="btn" >
<INPUT type=hidden name=MAX_FILE_SIZE VALUE=<?php wrs_php_filesize();?>000>
</FORM></th>
</tr>
<tr>
<th ><FORM method="POST" ENCTYPE="multipart/form-data">
<th ><FORM method="POST" ENCTYPE="multipart/form-data" onsubmit="return confirm('Are you sure you want to upload a new lm32 binary file? \nThis could result in the malfunction of the switch.');">
<INPUT type=file name="lm32file" >
<INPUT type=submit value="Load lm32 bin" class="btn">
<INPUT type=hidden name=MAX_FILE_SIZE VALUE=<?php wrs_php_filesize();?>000>
</FORM></th>
</tr>
<tr>
<th ><FORM method="POST" ENCTYPE="multipart/form-data">
<INPUT type=file name="file" >
<INPUT type=submit value="Load firmware" class="btn" >
<INPUT type=hidden name=MAX_FILE_SIZE VALUE= <?php wrs_php_filesize();?>000>
</FORM></th>
</tr>
</table>
<br><br><br><center>Max. filesize is now <?php echo shell_exec("cat /etc/php.ini | grep upload_max_filesize | awk '{print $3}'");
<!--
<br><br><br><center>Max. filesize is now <?php //echo shell_exec("cat /etc/php.ini | grep upload_max_filesize | awk '{print $3}'");
?></center>
<table border="0" align="center">
<tr>
<form align="center" method="post">
Change PHP File Size Upload: <INPUT type="text" name="size" >
<input type="submit" value="Change" class="btn">
<th>New PHP Filesize: </th><th><INPUT type="text" name="size" > </th>
<th><input type="submit" value="Change" class="btn"></th>
</tr>
</form>
</table>
-->
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><hr>
<br><br><br><hr>
*Note: After loading a FPGA or lm32 binary the switch will reboot.
<?
......@@ -61,9 +61,6 @@
wrs_load_files();
wrs_change_wrfs("ro");
//echo '<center>';
//wrs_check_writeable();
//echo '</center>';
?>
......
<?php include 'functions.php'; include 'head.php'; ?>
<body>
<body id="login">
<div class="main">
<div class="page">
<div class="header" >
......@@ -23,11 +23,38 @@
$message="";
if(count($_POST)>0) {
$users = shell_exec('cat /etc/users');
$users = explode(" ", $users);
//If /etc/phpusers does not exist we create the file and "admin" "" user&pass
if (!file_exists($GLOBALS['phpusersfile'])) {
$username = "admin";
$password = "";
$salt="wrs4.0salt";
$pass = $password;
$hash = md5($pass); // md5 hash #1
$hash_md5 = md5($salt.$pass); // md5 hash with salt #2
$hash_md5_double = md5(sha1($salt.$pass)); // md5 hash with salt & sha1 #3
$output= $username." ".$hash_md5_double."\n";
wrs_change_wrfs("rw");
$file = fopen($GLOBALS['phpusersfile'],"w+");
fwrite($file,$output);
fclose($file);
wrs_change_wrfs("ro");
}
$username = $_POST["login"];
$password = $_POST["password"];
if ((!strcmp($username, "root")) && (!strcmp($password, ""))){
$saved_hash = shell_exec("cat ".$GLOBALS['phpusersfile']." | grep ".$username." | awk '{print $2}'");
$saved_hash = str_replace("\n","",$saved_hash);
$user_exists = shell_exec("cat ".$GLOBALS['phpusersfile']." | grep -c ".$username);
$salt="wrs4.0salt";
$pass = $password;
$hash = md5($pass); // md5 hash #1
$hash_md5 = md5($salt.$pass); // md5 hash with salt #2
$hash_md5_double = md5(sha1($salt.$pass)); // md5 hash with salt & sha1 #3
if (!strcmp($hash_md5_double,$saved_hash) && $user_exists>0){
session_start();
$_SESSION["myusername"] = $username;
......@@ -36,11 +63,10 @@
header('Location: index.php');
}else{
echo 'Invalid Username or Password';
}
}
//if(isset($_SESSION["user_id"])) {
//header("Location:index.php");
?>
......
<?php include 'functions.php'; include 'head.php'; ?>
<body>
<body id="management">
<div class="main">
<div class="page">
<div class="header" >
......@@ -23,57 +23,134 @@
<table border="0" align="center">
<tr>
<center>
<form method="post">
<th><center>Switch Mode: (<?php $str = check_switch_mode(); echo $str; ?>) </center><input type="hidden" name="cmd" value="change"></th>
<th>Switch Mode: (<?php $str = check_switch_mode(); echo $str; ?>)</th>
<input type="hidden" name="cmd" value="change">
<th><input type="submit" value="Change Mode" class="btn"></th>
</form>
</tr>
<!--<tr>
<tr>
<form method="post">
<th><center>Halt system: </center><input type="hidden" name="cmd" value="halt"></th>
<th><input type="submit" value="Halt switch" class="btn"></th>
<th>Reboot system: </th>
<input type="hidden" name="cmd" value="reboot">
<th><input type="submit" value="Reboot switch" class="btn"> </th>
</form>
</tr> -->
</center>
</tr>
<tr>
<form method="post">
<th><center>Reboot system: </center><input type="hidden" name="cmd" value="reboot"></th>
<th><input type="submit" value="Reboot switch" class="btn"></th>
<th align=left>Net-SNMP Server: </th>
<input type="hidden" name="cmd" value="snmp">
<th><INPUT type="submit" STYLE="text-align:center;" value="<?php echo (check_snmp_status()) ? 'Disable SNMP' : 'Enable SNMP'; ?>" class="btn"></th>
</form>
</tr>
</tr><th> </th><th> </th><tr></tr><th> </th><th> </th><tr>
<!--<tr>
</form>
</table>
<table border="0" align="center">
<tr>
<form method="post">
<th><center>Mount partition as writable: </center><input type="hidden" name="cmd" value="rw"></th>
<th><input type="submit" value="Remount" class="btn"></th>
<th><center>NTP Server:</center></th><th><INPUT type="text" STYLE="text-align:center;" name="ntpip" value="<?php $str = check_ntp_server(); echo $str; ?>"> </th>
<th><input type="hidden" name="cmd" value="ntp">
<select name="utc" >
<?php
$selected_utc=$_SESSION['utc'];
$selected_utc=str_replace("UTC","",$selected_utc);
$selected_utc=trim($selected_utc);
for($op = -12; $op < 0; $op++){
if($selected_utc==$op && !empty($selected_utc)){
echo '<option selected="UTC'.$op.'" class="btn" value="UTC'.($op).'"><center>UTC'.($op).'</center></option>';
}else{
echo '<option class="btn" value="UTC'.($op).'"><center>UTC'.($op).'</center></option>';
}
}
if(!strcmp($selected_utc,"")){
echo '<option selected="UTC" class="btn" value="UTC"><center>UTC</center></option>';
}else{
echo '<option class="btn" value="UTC"><center>UTC</center></option>';
}
for($op = 1; $op < 15; $op++){
if($selected_utc==$op && !empty($selected_utc)){
echo '<option elected="UTC'.$op.'" class="btn" value="UTC+'.($op).'"><center>UTC+'.($op).'</center></option>';
}else{
echo '<option class="btn" value="UTC+'.($op).'"><center>UTC+'.($op).'</center></option>';
}
}
?>
</th>
<th><input type="submit" value="Add NTP Server" class="btn"></th>
</form>
</tr>
</table>
<hr>
<br><br>
<center><p><strong>Load configuration files</strong></p></center>
<table border="1" align="center" class='altrowstable' id='alternatecolor' width="80%">
<tr>
<FORM method="POST" ENCTYPE="multipart/form-data">
<th>PPSi Config </th>
<th ><INPUT type=file name="ppsi_conf" ></th>
<th><INPUT type=submit value="Load" class="btn" ><INPUT type=hidden name=MAX_FILE_SIZE VALUE= <?php wrs_php_filesize();?>000></th>
</form>
<form method="post">
<th><center>Mount partition as read-only: </center><input type="hidden" name="cmd" value="ro"></th>
<th><input type="submit" value="Remount" class="btn"></th>
</tr>
<tr>
<FORM method="POST" ENCTYPE="multipart/form-data">
<th>SFP Config </th>
<th ><INPUT type=file name="sfp_conf" ></th>
<th><INPUT type=submit value="Load" class="btn" ><INPUT type=hidden name=MAX_FILE_SIZE VALUE= <?php wrs_php_filesize();?>000></th>
</form>
</tr>-->
</tr><th> </th><th> </th><tr></tr><th> </th><th> </th><tr>
</tr>
<tr>
<form method="post">
<th>Change PHP File Size Upload: <INPUT type="text" name="size" > </th>
<input type="hidden" name="cmd" value="size">
<th><input type="submit" value="Change" class="btn"></th>
<FORM method="POST" ENCTYPE="multipart/form-data">
<th>SNMP Config</th>
<th ><INPUT type=file name="snmp_conf" ></th>
<th><INPUT type=submit value="Load" class="btn" ><INPUT type=hidden name=MAX_FILE_SIZE VALUE= <?php wrs_php_filesize();?>000></th>
</form>
</tr>
<tr>
<FORM method="POST" ENCTYPE="multipart/form-data">
<th>HAL Config </th>
<th ><INPUT type=file name="hal_conf" ></th>
<th><INPUT type=submit value="Load" class="btn" ><INPUT type=hidden name=MAX_FILE_SIZE VALUE= <?php wrs_php_filesize();?>000></th>
</form>
</tr>
<tr>
<th></th>
<th></th>
<th></th>
</tr>
<tr>
<FORM method="POST" ENCTYPE="multipart/form-data">
<th>Restore from backup</th>
<th ><INPUT type=file name="restore_conf" ></th>
<th><INPUT type=submit value="Load" class="btn" ><INPUT type=hidden name=MAX_FILE_SIZE VALUE= <?php wrs_php_filesize();?>000></th>
</form>
</tr>
</table>
</table>
<br><br><br><br>
<center>
<FORM align="center" method="POST" ENCTYPE="multipart/form-data">
<th>Backup Configuration files to your computer </th>
<input type="hidden" name="cmd" value="Backup">
<th><INPUT type=submit value="Backup" class="btn" ></th>
</form>
</center>
<?php
wrs_change_wrfs("rw");
wrs_management();
//wrs_check_writeable();
wrs_change_wrfs("ro");
?>
......
......@@ -10,8 +10,8 @@ echo '</ul><br><hr>';
echo '<div class="login">
<h3>Login</h3>
<form method="post" action="login.php">
<p><input type="text" name="login" value="" placeholder="Username"></p>
<p><input type="password" name="password" value="" placeholder="Password"></p>
<input type="text" name="login" value="" placeholder="Username" size="15">
<input type="password" name="password" value="" placeholder="Password" size="15">
<!--<p class="remember_me">
<label>
<input type="checkbox" name="remember_me" id="remember_me">
......@@ -24,22 +24,25 @@ 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="network.php"> Network Setup </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="load.php"> LM32 & FPGA </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="administration.php"> Switch Administration </a></li>';
echo '<li><a href="advance.php"> Advanced Mode </a></li>';
if(!empty($_SESSION['advance'])){
echo '<li>&nbsp;<a href="sfpcalibration.php"><font color="gray"> SFP Calibration </font></a></li>';
echo '<li>&nbsp;<a href="endpoint.php"><font color="gray"> Endpoint Tool</font> </a></li>';
echo '<li>&nbsp;<a href="endpointcalibration.php"><font color="gray"> Endpoint Calibration </font></a></li>';
echo '<li>&nbsp;<a href="terminal.php"> <font color="gray">Virtual Console </font></a></li>';
echo '<ul class="advance">';
echo '<li><a href="sfpcalibration.php">SFP Calibration</a></li>';
echo '<li><a href="endpoint.php">Endpoint Tool </a></li>';
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>';
echo '<b>User: <font color="blue">'.$_SESSION["myusername"].' </font></b>';
echo '<b>User: <font color="blue"><a href="change_passwd.php">'.$_SESSION["myusername"].'</a> </font></b>';
echo '<a href="./logout.php">(logout)</a>';
}
?>
......
<?php include 'functions.php'; include 'head.php'; ?>
<body>
<body id="modifymode">
<div class="main">
<div class="page">
<div class="header" >
......@@ -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 Management <a href='help.php?help_id=network' 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
wrs_change_wrfs("rw");
if((empty($_POST["networkgroup"]))){
echo '
<table border="0" class="altrowstable" id="alternatecolor" align="center">
<tr>
<th><font color="blue">Current eth0</font></th>
</tr><tr></tr><tr></tr>
<tr>
<th align=left>IP Address: </th>
<th ><INPUT type="text" STYLE="text-align:center;" 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" STYLE="text-align:center;" 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" STYLE="text-align:center;" 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 = $GLOBALS['interfacesfile'];
$tmpfile="/tmp/interfaces";
shell_exec('rm '.$interface_file);
$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 /usr/etc/network
copy($tmpfile, $interface_file);
echo '<center>DHCP is now set for eth0<br>Rebooting switch</center>';
//Let's reboot
shell_exec('reboot');
}
if ((!empty($_POST["networkgroup"])) && (!strcmp(htmlspecialchars($_POST["networkgroup"]),"Static"))){
echo '<FORM method="POST">
<table border="0" align="center" class="altrowstable" id="alternatecolor">
<tr>
<th align=left>IP Address: </th>
<th><INPUT STYLE="text-align:center;" type="text" value="192.168.1.10" name="ip" ></th>
</tr>
<tr>
<th align=left>Netmask: </th>
<th><INPUT STYLE="text-align:center;" type="text" value="255.255.255.0" name="netmask" ></th>
</tr>
<tr>
<th align=left>Network: </th>
<th><INPUT STYLE="text-align:center;" type="text" value="192.168.1.0" name="network" ></th>
</tr>
<tr>
<th align=left>Broadcast: </th>
<th><INPUT STYLE="text-align:center;" type="text" value="192.168.1.255" name="broadcast" ></th>
</tr>
<tr>
<th align=left>Gateway: </th>
<th><INPUT STYLE="text-align:center;" 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 = $GLOBALS['interfacesfile'];
$tmpfile="/tmp/interfaces";
shell_exec('rm '.$interface_file);
$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 /usr/etc/network
copy($tmpfile, $interface_file);
echo '<center>New static configuration saved for eth0<br>Changes will take place after reboot.</center>';
//Let's reboot
shell_exec('reboot');
}
wrs_change_wrfs("ro");
?>
</div>
</div>
</div>
<div class="footer">
<?php include 'footer.php' ?>
</div>
</div>
</div>
</body>
</html>
<?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">VLAN Management <a href='help.php?help_id=vlan' onClick='showPopup(this.href);return(false);'><img align=right src="./img/question.png"></a></h1>
<?php session_is_started() ?>
<?php $_SESSION['advance']=""; ?>
<?php
$vlan_cmd = "/wr/bin/wrsw_vlans ";
if(!empty($_POST['vid'])){ $vlan_cmd .= " --rvid ".$_POST['vid'];}
if(!empty($_POST['fid'])){$vlan_cmd .= " --rfid ".$_POST['fid'];}
if(!empty($_POST['mask'])){$vlan_cmd .= " --rmask ".$_POST['mask'];}
if(!empty($_POST['drop'])){$vlan_cmd .= " --rdrop ".$_POST['drop'];}
if(!empty($_POST['prio'])){$vlan_cmd .= " --rprio ".$_POST['prio'];}
shell_exec($vlan_cmd);
header('Location: vlan.php');
?>
</div>
</div>
</div>
<div class="footer">
<?php include 'footer.php' ?>
</div>
</div>
</div>
</body>
</html>
<?php include 'functions.php'; include 'head.php'; ?>
<body id="vlan">
<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">Port-VLAN Assigment <a href='help.php?help_id=vlanassignment' onClick='showPopup(this.href);return(false);'><img align=right src="./img/question.png"></a></h1>
<?php session_is_started() ?>
<?php $_SESSION['advance']=""; ?>
<?php
// Get VLANS
echo '<center><strong>Port-VLAN List</strong></center><hr>';
$tmp_vlan_file="/tmp/vlans.conf";
$vlans = shell_exec("/wr/bin/wrsw_vlans --list >".$tmp_vlan_file);
$vlans = shell_exec("cat ".$tmp_vlan_file." | sed -n '/ /s/ \+/ /gp'");
$vlans = explode("\n", $vlans);
$name_vlans="";
$counter = 0;
foreach($vlans as $line){
$counter++;
if($counter>=3 && !empty($line)){
$line = explode(" ", $line);
$name_vlans .= $line[1]." ";
}
}
$name_vlans = explode(" ", $name_vlans);
// Get Previous assignment
$tmp_assign_file="/tmp/port2vlan.conf";
$vlans_assignment = shell_exec("/wr/bin/wrsw_vlans --elist >".$tmp_assign_file);
$vlans_assignment = shell_exec("cat ".$tmp_assign_file." | sed -n '/ /s/ \+/ /gp'");
$vlans_assignment = explode("\n", $vlans_assignment);
echo '<table align=center border="1" class="altrowstable" id="alternatecolor">';
echo '<tr align=center><th><font color="blue">Endpoint</font></th><th><font color="blue">VLAN ID</font></th><th><font color="blue">Mode</font></th><th><font color="blue">Priority</font></th><th><font color="blue">Mask</font></th></tr>';
echo '<form method=POST>';
for($i = 0; $i < 18; $i++){
$single_line = explode(" ",$vlans_assignment[$i+1]); //info per endpoint line
echo '<tr>';
echo '<th><center><b>wr'.($i+1).'</b></center></th>';
//Show the Vlan option button
echo '<th>';
//echo '<select name=vlan'.($i).'>';
/*foreach($name_vlans as $vlan){
if(!empty($vlan[0])){
echo '<option class="btn" value="'.$vlan[0].$vlan[1].'"><center>ID'.$vlan[0].$vlan[1].'</center></option>';
}
}*/
echo '<input STYLE="background-color:'.$vlancolor[$single_line[6]].';text-align:center;" size="5" type="text" value="'.$single_line[6].'" name="vlan'.($i).'">';
//echo '<option class="btn" selected="selected" value="disabled"><center>Disabled</center></option>';
//echo '</select>'; // end Vlan ID assignation
echo '</th>';
echo '<th>'; // Mode selection
echo '<select name=mode'.($i).'>';
echo '<option class="btn" '; echo (!strcmp($single_line[2],"0")) ? 'selected="selected"' : ''; echo ' value="0"><center>Access</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[2],"1")) ? 'selected="selected"' : ''; echo ' value="1"><center>Trunk</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[2],"2")) ? 'selected="selected"' : ''; echo ' value="2"><center>VLAN Disabled</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[2],"3")) ? 'selected="selected"' : ''; echo ' value="3"><center>Unqualified port</center></option>';
echo '</select>'; // end mode
echo '</th>';
echo '<th>'; // Priority selection
echo '<select name=prio'.($i).'>';
echo '<option class="btn" '; echo (!strcmp($single_line[5],"0")) ? 'selected="selected"' : ''; echo 'value="0"><center>0</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[5],"1")) ? 'selected="selected"' : ''; echo 'value="1"><center>1</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[5],"2")) ? 'selected="selected"' : ''; echo 'value="2"><center>2</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[5],"3")) ? 'selected="selected"' : ''; echo 'value="3"><center>3</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[5],"4")) ? 'selected="selected"' : ''; echo 'value="4"><center>4</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[5],"5")) ? 'selected="selected"' : ''; echo 'value="5"><center>5</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[5],"6")) ? 'selected="selected"' : ''; echo 'value="6"><center>6</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[5],"7")) ? 'selected="selected"' : ''; echo 'value="7"><center>7</center></option>';
echo '</select>'; // end Priority
echo '</th>';
echo '<th align=center><INPUT type="text" size="8" name="mask'.$i.'" ></th>';
echo '</tr>';
}
echo '<tr><th></th><th></th><th></th><th></th><th align=center><input type="submit" value="Update" class="btn" name="updatevlan" ></th></tr>
</form>';
echo '</table>';
echo '<br>'.$_POST['mode0'];
//Parse input and run the command
if (!empty($_POST['updatevlan'])){
$vlan_cmd= "/wr/bin/wrsw_vlans ";
for($i = 0; $i < 18; $i++){
//if(strcmp($_POST['vlan'.$i],"disabled")){ //VLAN selected
$vlan_cmd .= " --ep ".$i;
$vlan_cmd .= " --emode ".$_POST['mode'.$i];
$vlan_cmd .= " --eprio ".$_POST['prio'.$i];
if(!empty($_POST['vlan'.$i])){$vlan_cmd .= " --evid ".$_POST['vlan'.$i];}
if(!empty($_POST['mask'.$i])){$vlan_cmd .= " --eumask ".$_POST['mask'.$i];}
$output = shell_exec($vlan_cmd);
echo $vlan_cmd;
echo '<br><p><center>Port WR'.($i+1).' added to VLAN'.$_POST['vlan'.$i].'</center></p>';
//}else{
if(!strcmp($_POST['mode'.$i],"2")){ //Disable VLAN for endpoint
$vlan_cmd .= " --ep ".$i;
$vlan_cmd .= " --emode ".$_POST['mode'.$i];
$output = shell_exec($vlan_cmd);
echo '<br><p><center>VLAN removed for port WR'.($i+1).'</center></p>';
}
//}
$vlan_cmd= "/wr/bin/wrsw_vlans ";
}
header('Location: vlan.php');
}
?>
<br><br><FORM align="right" method="POST" action="vlan.php" ENCTYPE="multipart/form-data">
<INPUT type=submit value="Go back" class="btn" >
</form>
</div>
</div>
</div>
<div class="footer">
<?php include 'footer.php' ?>
</div>
</div>
</div>
</body>
</html>
<?php include 'functions.php'; include 'head.php'; ?>
<body>
<body id="ptp">
<div class="main">
<div class="page">
<div class="header" >
......@@ -16,25 +16,34 @@
</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']=""; ?>
<FORM method="POST">
<table border="0" align="center">
<table id="daemon" border="0" align="center">
<tr>
<th align=left>PTP 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 align=center>PPSi Daemon: </th>
<input type="hidden" name="cmd" value="ppsiupdate">
<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" STYLE="text-align:center;" size="10" 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" STYLE="text-align:center;" size="10" 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>
......@@ -66,15 +75,24 @@
<tr>
<th align=left>Priority: </th>
<th><INPUT type="text" name="p" ></th>
<th><INPUT type="submit" value="Submit Configuration" class="btn"></th>
</tr>
-->
</table>
<INPUT align="right" type="submit" value="Update & Relaunch" class="btn last">
</FORM>
<?php
<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
wrs_change_wrfs("rw");
wrs_ptp_configuration();
wrs_change_wrfs("ro");
?>
......
<?php include 'functions.php'; include 'head.php'; ?>
<body>
<body id="sfpcalib">
<div class="main">
<div class="page">
<div class="header" >
......@@ -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>';
......
<?php include 'functions.php'; include 'head.php'; ?>
<body>
<body id="terminal">
<div class="main">
<div class="page">
<div class="header" >
......@@ -18,15 +18,26 @@
<div class="rightbody">
<h1 class="title">White-Rabbit Switch Console <a href='help.php?help_id=console' onClick='showPopup(this.href);return(false);'><img align=right src="./img/question.png"></a></h1>
<?php session_is_started() ?>
<?php session_is_started();
<FORM action="terminal.php" method="POST" accept-charset="UTF-8">
Unix Command: <input type="text" name="cmd">
$hostname = $_SESSION['hostname'];
$ip = $_SESSION['ip'];
if(empty($hostname) || empty($ip)){
$_SESSION['hostname'] = trim(shell_exec("hostname"));
$_SESSION['ip'] = trim(shell_exec("ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'"));
$hostname = $_SESSION['hostname'];
$ip = $_SESSION['ip'];
}
echo '<FORM action="terminal.php" method="POST" accept-charset="UTF-8">
'.$hostname.'@'.$_SESSION["ip"].'$: <input type="text" name="cmd" autofocus="autofocus" autocomplete="off">
<input type="submit" value="Enter" class="btn">
</FORM>
</FORM>';
<?php
wrs_change_wrfs("rw");
/*$path = shell_exec("echo $PATH");
if(substr_count($path , "/wr/bin")==0){
......@@ -35,6 +46,7 @@
echo "PATH=".$path;
}*/
// If pwd is empty, we go to the root directory
if(empty($_SESSION["pwd"])){$_SESSION["pwd"]="/";}
shell_exec("cd ".$_SESSION["pwd"]);
......@@ -46,7 +58,7 @@
$cmd_aux = $cmd;
if(substr_count($cmd_aux , "cd")>0){
$cmd = " ls ";
//$cmd = " ls ";
// moving backwards
if(substr_count($cmd_aux , "cd ..")>0){
......@@ -100,11 +112,16 @@
$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;
BORDER-BOTTOM: #000 2px solid; HEIGHT: 350px; TEXT-ALIGN: left">
<p>'.$_SESSION["pwd"].'$:'.$cmd.'<br>'.$output.'</p> </div></div>';
<p>'.$hostname.'@'.$ip.':'.$_SESSION["pwd"].'$ '.$cmd.'<br>'.$output.'</p> </div></div>';
......
......@@ -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>';
......
<?php include 'functions.php'; include 'head.php'; ?>
<body>
<body id="vlan">
<div class="main">
<div class="page">
<div class="header" >
......@@ -22,47 +22,102 @@
<?php $_SESSION['advance']=""; ?>
<?php
echo '<table align=center border="1" class="altrowstable" id="alternatecolor">';
echo '<tr><th>Endpoint</th><th>VLANs</th></tr>';
for($i = 0; $i < 18; $i++){
echo '<tr>';
echo '<td><center><b>wr'.($i+1).'</b></center></td>';
//Show the Vlan option button
echo '<td>';
echo '<form method=POST><div>
<select name='.($i).'>';
for($op = 0; $op < 18; $op++){
echo '<option class="btn" value="'.($op+1).'"><center>Vlan'.($op+1).'</center></option>';
echo '<center><strong>Existing VLANs</strong></center><hr>';
$tmp_vlan_file="/tmp/vlans.conf";
$vlans = shell_exec("/wr/bin/wrsw_vlans --list >".$tmp_vlan_file);
$vlans = shell_exec("cat ".$tmp_vlan_file." | sed -n '/ /s/ \+/ /gp'");
$vlans = explode("\n", $vlans);
}
echo '</select>';
echo '<table align=center border="1" class="altrowstable" id="alternatecolor" width="100%">';
echo '<tr align=center><th><font color="blue">Vlan ID</font></th><th><font color="blue">FID</font></th><th><font color="blue">Ports</font></th><th><font color="blue">Drop?</font></th><th><font color="blue">Priority</font></th><th><font color="blue">Action</font></th></tr>';
$counter = 0;
foreach($vlans as $line){
$counter++;
echo '</td>';
if($counter>=2 && !empty($line)){
$line = explode(" ", $line);
if(strcmp($line[3],"0x")){
echo '<tr align=center><th bgcolor="'.$vlancolor[$line[1]].'">VLAN '.$line[1].'</th><th>'.$line[2].'</th><th>'.parse_mask2ports($line[3]).'</th><th>'.$line[4].'</th><th>'.$line[5].'</th><th><A HREF="delvlan.php?vlan='.$line[1].'.">Delete</A></th></tr>';
}else{
echo '<tr align=center><th>'.$line[1].'</th><th>'.$line[2].'</th><th>'.parse_mask2ports($line[3].$line[4]).'</th><th>'.$line[5].'</th><th>'.$line[6].'</th><th><A HREF="delvlan.php?vlan='.$line[1].'.">Delete</A></th></tr>';
}
}
echo '<input type="hidden" value=cmd name=cmd>';
echo '<p align="right"><input type="submit" value="Add VLANs" class="btn" ></p>
</form>';
echo '</tr>';
}
//Form for a new one:
echo '<tr align=center>
<FORM method="POST" action="newvlan.php" "ENCTYPE="multipart/form-data">
<th align=center><INPUT type="text" size="3" name="vid" ></th>
<th align=center><INPUT type="text" size="3"name="fid" ></th>
<th align=center><INPUT type="text" size="5" name="mask" ></th>
<th align=center>
<select name="drop">
<option value="1">YES</option>
<option selected="selected" value="0">NO</option>
</select>
</th>
<th align=center>
<select name="prio">
<option selected="selected"value=""></option>
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
</select>
</th>
<th align=center><INPUT type=submit value="Add VLAN" class="btn"></th>
</form>
</tr>';
echo '</table>';
?>
<br><p align="right"><A HREF="delvlan.php?vlan=all" onclick="return confirm('You are deleting all VLANs, are you sure?')">Delete All VLANs</A></p>
<?php
//Display Port2Vlan assignment
echo '<br><br>';
echo '<center><strong>Port2Vlan assignments</strong></center><hr>';
echo '<table align=center border="1" class="altrowstable" id="alternatecolor1" width="100%">';
echo '<tr align=center><th><font color="blue">Port</font></strong></th><th><font color="blue">QMode</font></th><th><font color="blue">Priority</font></th><th><font color="blue">VLAN ID</font></th><th><font color="blue">MAC Address</font></th></tr>';
$tmp_vlan_file="/tmp/port2vlan.conf";
$vlans = shell_exec("/wr/bin/wrsw_vlans --elist >".$tmp_vlan_file);
$vlans = shell_exec("cat ".$tmp_vlan_file." | sed -n '/ /s/ \+/ /gp'");
$vlans = explode("\n", $vlans);
$counter = 0;
foreach($vlans as $line){
$counter++;
if($counter>=2 && !empty($line)){
$line = explode(" ", $line);
echo '<tr align=center><th>WR'.($line[1]+1).'</th><th>'.$line[2]." (".$line[3].')</th><th>'.($line[5]).'</th><th bgcolor="'.$vlancolor[$line[6]].'">VLAN '.$line[6].'</th><th>'.$line[7].'</th></th></tr>';
//Parse input and run the command
if (!empty($_POST['cmd'])){
$input = $_POST;
wrs_vlan_configuration($input);
}
wrs_vlan_display();
}
echo '<tr><th></th><th></th><th></th><th></th><th align=center><FORM method="POST" action="port2vlan.php"><INPUT type=submit align=center value="Edit Table" class="btn"></form></th></tr>';
echo '</table>';
?>
<br><br><br><br><hr><p align="right"><A HREF="port2vlan.php">Assign Ports to VLANs</A></p>
</div>
</div>
</div>
......
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