Commit 286d76b1 authored by José Luis  Gutiérrez's avatar José Luis Gutiérrez Committed by Alessandro Rubini

www: Vlan fix, SNMP Enable/Disable and some other format improvements in web interface

- Fixing javascript to include more than 1 table style
	- Vlan fix
	- Adding port 2 vlan management
	- minor fixes
	- Enable/Disable SNMP
parent ab11374b
......@@ -52,7 +52,7 @@
<hr>
<FORM align="right" method="post">
<input type="hidden" name="hal" value="hal">
<INPUT type="submit" value="Reboot PPSi&Hal daemons" class="btn">
<INPUT type="submit" value="Restart PPSi" class="btn">
</FORM>
<?php
......@@ -63,8 +63,8 @@
$output = shell_exec($ptp_command);
//Relaunching wrsw_hal to commit endpoint changes
shell_exec("killall wrsw_hal");
shell_exec("/wr/bin/wrsw_hal -c ".$GLOBALS['etcdir']."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 &");
}
......
......@@ -7,6 +7,7 @@ $ppsiconf="ppsi.conf";
$wrswhalconf="wrsw_hal.conf";
$sfpdatabaseconf="sfp_database.conf";
$wrdateconf="wr_date.conf";
$vlancolor = array("#27DE2A", "#B642A8", "#6E42B6", "#425DB6" , "#428DB6", "#42B6B4", "#42B68B", "#42B65F", "#82B642", "#B6AE42", "#B67E42");
/*
* Displays the current status of each enpoint.
......@@ -106,28 +107,28 @@ function wrs_main_info(){
$str = shell_exec("uname -n");
if(strcmp($str,"(none)")) shell_exec("/bin/busybox hostname -F /etc/hostname");
echo '<tr><th><b>Hostname:</b></th><th><center>'; $str = shell_exec("uname -n"); echo $str; echo '</center></th></tr>';
echo '<tr><th> <b>Switch Mode:</b> </th><th><center>'; $str = check_switch_mode(); echo $str; echo '</center></th></tr>';
echo '<tr><th> <b>IP Address:</b> </th><th><center>'; $ip = shell_exec("ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'"); echo $ip;
echo '<tr><th align=center><b><font color="darkblue">Hostname</font></b></th><th><center>'; $str = shell_exec("uname -n"); echo $str; echo '</center></th></tr>';
echo '<tr><th align=center> <b><font color="darkblue">Switch Mode</font></b> </th><th><center>'; $str = check_switch_mode(); echo $str; echo '</center></th></tr>';
echo '<tr><th align=center> <b><font color="darkblue">IP Address</font></b> </th><th><center>'; $ip = shell_exec("ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'"); echo $ip;
echo '(<a href="network.php">'; echo wrs_interface_setup(); echo '</a>)'; echo '</center></th></tr>';
echo '<tr><th> <b>HW Address:</b> </th><th><center>'; $mac = shell_exec("ifconfig eth0 | grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}'"); echo $mac; echo '</center></th></tr>';
echo '<tr><th align=center> <b><font color="darkblue">HW Address</font></b> </th><th><center>'; $mac = shell_exec("ifconfig eth0 | grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}'"); echo $mac; echo '</center></th></tr>';
//echo '<tr><th> <b>OS Release:</b> </th><th><center>'; $str = shell_exec("uname -r"); echo $str; echo '</center></th></tr>';
//echo '<tr><th> <b>OS name:</b> </th><th><center>'; $str = shell_exec("uname -s"); echo $str; echo '</center></th></tr>';
echo '<tr><th> <b>OS Version:</b> </th><th><center>'; $str = shell_exec("uname -r"); echo $str; $str = shell_exec("uname -v"); echo $str; echo '</center></th></tr>';
echo '<tr><th align=center> <b><font color="darkblue">OS Version</font></b> </th><th><center>'; $str = shell_exec("uname -r"); echo $str; $str = shell_exec("uname -v"); echo $str; echo '</center></th></tr>';
echo '<tr><th> <b>Gateware Version:</b> </th><th><center> '; $str = shell_exec("/wr/bin/shw_ver -g | grep version | awk '{ print $4}'");
echo '<tr><th align=center> <b><font color="darkblue">Gateware Version</font></b> </th><th><center> '; $str = shell_exec("/wr/bin/shw_ver -g | grep version | awk '{ print $4}'");
echo '<a href="showfile.php?help_id=gateware&name=GateWare Info" onClick="showPopup(this.href);return(false);"</a>';
echo $str; echo '</center></th></tr>';
echo '<tr><th> <b>PCB Version:</b> </th><th><center>'; $str = shell_exec("/wr/bin/shw_ver -p"); echo $str; echo '</center></th></tr>';
echo '<tr><th> <b>FPGA:</b> </th><th><center>'; $str = shell_exec("/wr/bin/shw_ver -f"); echo $str; echo '</center></th></tr>';
echo '<tr><th> <b>Compiling time:</b> </th><th><center>'; $str = shell_exec("/wr/bin/shw_ver -c"); echo $str; echo '</center></th></tr>';
echo '<tr><th> <b>White-Rabbit Date:</b></th><th><center>'; $str = shell_exec("TZ=".$_SESSION['utc']." /wr/bin/wr_date get"); echo $str; echo '</center></th></tr>';
echo '<tr><th> <b>PPSi:</b> </th><th><center>'; echo wrs_check_ptp_status() ? '[<A HREF="ptp.php">on</A>]' : '[<A HREF="ptp.php">off</A>]'; echo '</center></th></tr>';
echo '<tr><th> <b>Net-SNMP:</b> </th><th><center>'; echo check_snmp_status() ? '[on] ' : '[off] '; echo '&nbsp;&nbsp;ver. '; echo shell_exec("snmpd -v | grep version | awk '{print $3}'");
echo '<tr><th align=center> <b><font color="darkblue">PCB Version</font></b> </th><th><center>'; $str = shell_exec("/wr/bin/shw_ver -p"); echo $str; echo '</center></th></tr>';
echo '<tr><th align=center> <b><font color="darkblue">FPGA</font></b> </th><th><center>'; $str = shell_exec("/wr/bin/shw_ver -f"); echo $str; echo '</center></th></tr>';
echo '<tr><th align=center> <b><font color="darkblue">Compiling Time</font></b> </th><th><center>'; $str = shell_exec("/wr/bin/shw_ver -c"); echo $str; echo '</center></th></tr>';
echo '<tr><th align=center> <b><font color="darkblue">White-Rabbit Date</font></b></th><th><center>'; $str = shell_exec("TZ=".$_SESSION['utc']." /wr/bin/wr_date get"); echo $str; echo '</center></th></tr>';
echo '<tr><th align=center> <b><font color="darkblue">PPSi</font></b> </th><th><center>'; echo wrs_check_ptp_status() ? '[<A HREF="ptp.php">on</A>]' : '[<A HREF="ptp.php">off</A>]'; echo '</center></th></tr>';
echo '<tr><th align=center> <b><font color="darkblue">Net-SNMP Server</font></b> </th><th><center>'; echo check_snmp_status() ? '[on] ' : '[off] '; echo '&nbsp;&nbsp;ver. '; echo shell_exec("snmpd -v | grep version | awk '{print $3}'");
echo '( port '; $str = shell_exec("cat ".$GLOBALS['etcdir']."snmpd.conf | grep agent | cut -d: -f3 | awk '{print $1}'"); echo $str; echo ')'; echo " <a href='help.php?help_id=snmp' onClick='showPopup(this.href);return(false);'> [OIDs]</a></center></th></tr>";
echo '<tr><th> <b>NTP Server:</b> </th><th><center> <A HREF="management.php">'; $str = check_ntp_server(); echo $str; echo $_SESSION['utc']; echo '</A></center></th></tr>';
echo '<tr><th> <b>Max. Filesize Upload: </b></th><th><center>'; echo shell_exec("cat /etc/php.ini | grep upload_max_filesize | awk '{print $3}'"); echo '</center></th></tr>';
echo '<tr><th align=center> <b><font color="darkblue">NTP Server</font></b> </th><th><center> <A HREF="management.php">'; $str = check_ntp_server(); echo $str; echo $_SESSION['utc']; echo '</A></center></th></tr>';
echo '<tr><th align=center> <b><font color="darkblue">Max. Filesize Upload</font> </b></th><th><center>'; echo shell_exec("cat /etc/php.ini | grep upload_max_filesize | awk '{print $3}'"); echo '</center></th></tr>';
echo '</table>';
......@@ -686,8 +687,24 @@ function wrs_management(){
//Backup wrs firmware
} else if (!strcmp($cmd, "snmp")){
if(check_snmp_status()){ //It is running
//Stop SNMP
shell_exec("killall snmpd");
}else{ //Not running
shell_exec("/etc/init.d/S80snmp > /dev/null 2>&1 &");
}
header('Location: management.php');
}
}
......@@ -785,34 +802,17 @@ function wrs_ptp_configuration(){
$cmd .= " -p ".htmlspecialchars($_POST["p"]);
echo '<br>Priority changed to '.htmlspecialchars($_POST["p"]);
}
if ((!empty($_POST["daemongroup"])) && (!strcmp(htmlspecialchars($_POST["daemongroup"]),"On"))){
//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);
if(!strcmp($_POST['cmd'],"ppsiupdate")){
//Relaunching wrsw_hal to commit endpoint changes
//shell_exec("killall wrsw_hal");
//shell_exec("/wr/bin/wrsw_hal -c ".$GLOBALS['etcdir']."wrsw_hal.conf > /dev/null 2>&1 &");
echo '<center>PPSi enabled!</center>';
if(wrs_check_ptp_status()){ //PPSi is enabled.
shell_exec("killall ppsi");
}else{ //PPSi is disabled.
$ptp_command = "/wr/bin/ppsi > /dev/null 2>&1 &";
$output = shell_exec($ptp_command);
}
header('Location: ptp.php');
exit;
}
if ((!empty($_POST["daemongroup"])) && (!strcmp(htmlspecialchars($_POST["daemongroup"]),"Off"))){
shell_exec("killall ppsi");
//shell_exec("killall wrsw_hal");
echo '<center>PPSi stopped!</center>';
header('Location: ptp.php');
exit;
}
if(!empty($cmd)){
shell_exec("killall ppsi");
$ptp_command = "/wr/bin/ppsi -c ".$cmd. " > /dev/null 2>&1 &";
$output = shell_exec($ptp_command);
echo '<center>PTP initialized.</center>';
}
if (!empty($_POST["clkclass"])){
$old_value= rtrim(shell_exec("cat ".$GLOBALS['etcdir'].$GLOBALS['ppsiconf']." | grep class "));
......@@ -838,8 +838,8 @@ function wrs_ptp_configuration(){
$output = shell_exec($ptp_command);
//Relaunching wrsw_hal to commit endpoint changes
shell_exec("killall wrsw_hal");
shell_exec("/wr/bin/wrsw_hal -c ".$GLOBALS['etcdir']."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 &");
header('Location: ptp.php');
exit;
......@@ -979,6 +979,7 @@ function wrs_display_help($help_id, $name){
Options: <br>
- <b>Change mode:</b> Changes switch mode to Master/GrandMaster <br>
- <b>Reboot switch</b>: Reboots the switch <br>
- <b>Net-SNMP Server</b>: Enables/Disables remote management using SNMP <br>
- <b>NTP Server</b>: Sets the IP address of an external NTP server. By default it is configured as UTC, please use the second box to change it. This change is done on the webserver, not in the switch command line environment.<br>
- <b>Load Configuration Files</b>: You can upload individual configuration files to the switch (ppsi.conf, wrsw_hal.conf, snmp.conf, sfp_database.conf or a .tar.gz file with all of them.<br>
- <b>Backup Configuration Files</b>: Downloads a tar.gz file with all configuration files of the switch.<br>
......
......@@ -12,7 +12,6 @@
<script type="text/javascript">
function altRows(id){
if(document.getElementsByTagName){
var table = document.getElementById(id);
var rows = table.getElementsByTagName("tr");
......@@ -23,6 +22,17 @@ function altRows(id){
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";
}
}
}
}
window.onload=function(){
......
......@@ -24,28 +24,34 @@
<table border="0" align="center">
<tr>
<center>
<form method="post">
<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>
<form method="post">
<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>
<form method="post">
<th>Reboot system: </th>
<input type="hidden" name="cmd" value="reboot">
<th><input type="submit" value="Reboot switch" class="btn"> </th>
</form>
<form method="post">
<th>Reboot system: </th>
<input type="hidden" name="cmd" value="reboot">
<th><input type="submit" value="Reboot switch" class="btn"> </th>
</form>
</center>
</tr>
<tr>
<form method="post">
<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>
</table>
<table border="0" align="center">
<tr>
<form method="post">
<th><center>NTP Server:</center></th><th><INPUT type="text" name="ntpip" value="<?php $str = check_ntp_server(); echo $str; ?>"> </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
......@@ -75,10 +81,11 @@
}
?>
</th>
<th><input type="submit" value="Add NTP Server" class="btn"></th>
</form>
</tr>
</table>
<hr>
<br><br>
......
......@@ -44,15 +44,15 @@
<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>
<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" align="center" value="'.shell_exec("ifconfig eth0 | grep 'inet addr:' | cut -d: -f4 | awk '{ print $1}'").'" readonly name="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" align="center" value="'.shell_exec("ifconfig eth0 | grep 'inet addr:' | cut -d: -f3 | awk '{ print $1}'").'" readonly name="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>';
}
......@@ -89,23 +89,23 @@
<table border="0" align="center">
<tr>
<th align=left>IP Address: </th>
<th><INPUT type="text" value="192.168.1.10" name="ip" ></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 type="text" value="255.255.255.0" name="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 type="text" value="192.168.1.0" name="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 type="text" value="192.168.1.255" name="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 type="text" value="192.168.1.1" name="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">
......
......@@ -42,94 +42,106 @@
}
$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>Endpoint</th><th>VLANs ID</th><th>Mode</th><th>Priority</th><th>Mask</th></tr>';
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 '<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 '<option class="btn" selected="selected" value="disabled"><center>Disabled</center></option>';
echo '</select>'; // end Vlan ID assignation
}*/
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" selected="selected" value="0"><center>Access</center></option>';
echo '<option class="btn" value="1"><center>Trunk</center></option>';
echo '<option class="btn" value="2"><center>VLAN Disabled</center></option>';
echo '<option class="btn" value="3"><center>Unqualified port</center></option>';
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" selected="selected" value="0"><center>0</center></option>';
echo '<option class="btn" value="1"><center>1</center></option>';
echo '<option class="btn" value="2"><center>2</center></option>';
echo '<option class="btn" value="3"><center>3</center></option>';
echo '<option class="btn" value="4"><center>4</center></option>';
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 '</select>'; // end Priority
echo '</th>';
echo '<th align=center><INPUT type="text" size="3" name="mask'.$i.'" ></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><input type="submit" value="Add VLANs" class="btn" name="updatevlan" ></th></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
//if(strcmp($_POST['vlan'.$i],"disabled")){ //VLAN selected
$vlan_cmd .= " --ep ".$i;
if(!empty($_POST['mode'.$i])){$vlan_cmd .= " --emode ".$_POST['mode'.$i];}
if(!empty($_POST['prio'.$i])){$vlan_cmd .= " --eprio ".$_POST['prio'.$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{
//}else{
if(!strcmp($_POST['mode'.$i],"2")){ //Disable VLAN for endpoint
$vlan_cmd .= " --ep ".$i;
if(!empty($_POST['mode'.$i])){$vlan_cmd .= " --emode ".$_POST['mode'.$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" >
......
......@@ -24,9 +24,8 @@
<FORM method="POST">
<table id="daemon" border="0" align="center">
<tr>
<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 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>
......@@ -38,11 +37,11 @@
<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>
<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" name="clkacc" value="<?php echo shell_exec("cat ".$GLOBALS['etcdir'].$GLOBALS['ppsiconf']." | grep accuracy | awk '{print $2}'");?>"></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>
......@@ -79,7 +78,7 @@
</tr>
-->
</table>
<INPUT type="submit" value="Update & Relaunch" class="btn last">
<INPUT align="right" type="submit" value="Update & Relaunch" class="btn last">
</FORM>
......
......@@ -22,6 +22,9 @@
<?php $_SESSION['advance']=""; ?>
<?php
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);
......@@ -29,7 +32,7 @@
$vlans = explode("\n", $vlans);
echo '<table align=center border="1" class="altrowstable" id="alternatecolor" width="100%">';
echo '<tr align=center><th>VID</th><th>FID</th><th>Ports</th><th>DROP</th><th>PRIO</th><th>Action</th></tr>';
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++;
......@@ -38,7 +41,7 @@
$line = explode(" ", $line);
if(strcmp($line[3],"0x")){
echo '<tr align=center><th>'.$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>';
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>';
}
......@@ -72,10 +75,40 @@
</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>';
}
}
echo '</table>';
?>
<br><br><br><br><hr><p align="right"><A HREF="port2vlan.php">Assign Ports to VLANs</A></p>
......
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