Commit fefa999c authored by Adam Wujek's avatar Adam Wujek 💬

www: rename network interfaces from wrX to wriX+1

Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent 0fd57baa
...@@ -24,9 +24,9 @@ ...@@ -24,9 +24,9 @@
echo '<form method=POST> echo '<form method=POST>
Select an Endpoint: <select name="endpoint" class="sec">'; Select an Endpoint: <select name="endpoint" class="sec">';
for($op = 0; $op < 18; $op++){ for($op = 1; $op <= 18; $op++){
echo '<option value="wr'.$op.'">wr'.$op.'</option>'; echo '<option value="'.$op.'">wri'.$op.'</option>';
} }
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
echo '<option value="txcal1">Enable Calibration Transmission</option>'; echo '<option value="txcal1">Enable Calibration Transmission</option>';
echo '<option value="txcal0">Disable Calibration Transmission</option>'; echo '<option value="txcal0">Disable Calibration Transmission</option>';
echo '<option value="dump">See Registers</option>'; echo '<option value="dump">See Registers</option>';
echo '<option value="wr">Modify Registers</option>'; echo '<option value="wri">Modify Registers</option>';
//echo '<option value="rt">Show Flags</option>'; //echo '<option value="rt">Show Flags</option>';
echo '<option value="lock">Lock Endpoint</option>'; echo '<option value="lock">Lock Endpoint</option>';
//echo '<option value="master">Make Master</option>'; //echo '<option value="master">Make Master</option>';
......
...@@ -38,8 +38,7 @@ ...@@ -38,8 +38,7 @@
$header = array ("WR port","Protocol","Tx","Rx","Mode","Fiber"); $header = array ("WR port","Protocol","Tx","Rx","Mode","Fiber");
else else
$header = array ("WR port","Tx","Rx","Mode","Fiber"); $header = array ("WR port","Tx","Rx","Mode","Fiber");
$matrix = array ("key=CONFIG_PORT00_PARAMS,".$_SESSION["KCONFIG"]["CONFIG_PORT00_PARAMS"], $matrix = array ("key=CONFIG_PORT01_PARAMS,".$_SESSION["KCONFIG"]["CONFIG_PORT01_PARAMS"],
"key=CONFIG_PORT01_PARAMS,".$_SESSION["KCONFIG"]["CONFIG_PORT01_PARAMS"],
"key=CONFIG_PORT02_PARAMS,".$_SESSION["KCONFIG"]["CONFIG_PORT02_PARAMS"], "key=CONFIG_PORT02_PARAMS,".$_SESSION["KCONFIG"]["CONFIG_PORT02_PARAMS"],
"key=CONFIG_PORT03_PARAMS,".$_SESSION["KCONFIG"]["CONFIG_PORT03_PARAMS"], "key=CONFIG_PORT03_PARAMS,".$_SESSION["KCONFIG"]["CONFIG_PORT03_PARAMS"],
"key=CONFIG_PORT04_PARAMS,".$_SESSION["KCONFIG"]["CONFIG_PORT04_PARAMS"], "key=CONFIG_PORT04_PARAMS,".$_SESSION["KCONFIG"]["CONFIG_PORT04_PARAMS"],
...@@ -56,6 +55,7 @@ ...@@ -56,6 +55,7 @@
"key=CONFIG_PORT15_PARAMS,".$_SESSION["KCONFIG"]["CONFIG_PORT15_PARAMS"], "key=CONFIG_PORT15_PARAMS,".$_SESSION["KCONFIG"]["CONFIG_PORT15_PARAMS"],
"key=CONFIG_PORT16_PARAMS,".$_SESSION["KCONFIG"]["CONFIG_PORT16_PARAMS"], "key=CONFIG_PORT16_PARAMS,".$_SESSION["KCONFIG"]["CONFIG_PORT16_PARAMS"],
"key=CONFIG_PORT17_PARAMS,".$_SESSION["KCONFIG"]["CONFIG_PORT17_PARAMS"], "key=CONFIG_PORT17_PARAMS,".$_SESSION["KCONFIG"]["CONFIG_PORT17_PARAMS"],
"key=CONFIG_PORT18_PARAMS,".$_SESSION["KCONFIG"]["CONFIG_PORT18_PARAMS"],
); );
print_multi_form($matrix, $header, $formatID, $class, $infoname, $size); print_multi_form($matrix, $header, $formatID, $class, $infoname, $size);
......
...@@ -28,11 +28,11 @@ ...@@ -28,11 +28,11 @@
echo '<table class="altrowstable" id="alternatecolor" style="width:100%;text-align:center">'; echo '<table class="altrowstable" id="alternatecolor" style="width:100%;text-align:center">';
for($i = 0; $i < 9; $i++){ for($i = 0; $i < 9; $i++){
echo '<tr>'; echo '<tr>';
echo '<th>wr'.($i).'</td>'; echo '<th>wri'.($i+1).'</td>';
echo '<td><a href="modifymode.php?wr='.($i).'&mode='.$modes[$i].'">'.$modes[$i].'</a></th>'; echo '<td><a href="modifymode.php?wri='.($i+1).'&mode='.$modes[$i].'">'.$modes[$i].'</a></th>';
echo '<th>wr'.($i+9).'</th>'; echo '<th>wri'.($i+10).'</th>';
echo '<td><a href="modifymode.php?wr='.($i+9).'&mode='.$modes[$i+9].'">'.$modes[$i+9].'</a></td>'; echo '<td><a href="modifymode.php?wri='.($i+10).'&mode='.$modes[$i+9].'">'.$modes[$i+9].'</a></td>';
echo '</tr>'; echo '</tr>';
} }
echo '</table>'; echo '</table>';
......
...@@ -93,7 +93,7 @@ function wrs_header_ports(){ ...@@ -93,7 +93,7 @@ function wrs_header_ports(){
} }
else $mode="linkdown"; else $mode="linkdown";
$desc=sprintf("#%02d: wr%d (%s)",$cont+1,$cont,$mode); $desc=sprintf("#%02d: wri%d (%s)",$cont+1,$cont+1,$mode);
echo '<th>'."<img class='".$mode."' src='img/".$mode.".png' alt='".$desc."', title='".$desc."'>".'</th>'; echo '<th>'."<img class='".$mode."' src='img/".$mode.".png' alt='".$desc."', title='".$desc."'>".'</th>';
$cont++; $cont++;
...@@ -480,10 +480,10 @@ function wr_endpoint_phytool($option1, $endpoint){ ...@@ -480,10 +480,10 @@ function wr_endpoint_phytool($option1, $endpoint){
$output=shell_exec("/wr/bin/wr_phytool ".$endpoint." dump"); $output=shell_exec("/wr/bin/wr_phytool ".$endpoint." dump");
$ports = explode(" ", $output); $ports = explode(" ", $output);
echo 'wri'.$endpoint.'<BR>';
echo "<table border='0' align='center'>"; echo "<table border='0' align='center'>";
echo '<tr>'; echo '<tr>';
echo '<th>'.$endpoint.' Register</th>'; echo '<th>Register</th>';
echo '<th>Value</th>'; echo '<th>Value</th>';
echo '</tr>'; echo '</tr>';
...@@ -503,20 +503,17 @@ function wr_endpoint_phytool($option1, $endpoint){ ...@@ -503,20 +503,17 @@ function wr_endpoint_phytool($option1, $endpoint){
//} //}
// User wants to modify endpoint's registers // User wants to modify endpoint's registers
} else if(!strcmp($option1, "wr")){ } else if(!strcmp($option1, "wri")){
$output=shell_exec("/wr/bin/wr_phytool ".$endpoint." dump");
$ports = explode(" ", $output);
echo '<br>'; echo '<br>';
echo '<center></center><form method=POST>'; echo '<center></center><form method=POST>';
echo "<table border='0' align='center'>"; echo "<table border='0' align='center'>";
echo '<tr>'; echo '<tr>';
echo '<th>'.$endpoint.' Registers</th>'; echo '<th>wri'.$endpoint.' Registers</th>';
echo '<th><center>Value</center></th>'; echo '<th><center>Value</center></th>';
echo '</tr>'; echo '</tr>';
/* wr_phytool prints 17 registers */
for($i=0; $i<18; $i++){ for($i=0; $i<17; $i++){
echo '<tr>'; echo '<tr>';
echo '<th>R'.$i.'</th>'; echo '<th>R'.$i.'</th>';
echo '<th><input type="text" name="r'.$i.'" value="'.$_POST['r'.$i].'"></th>'; echo '<th><input type="text" name="r'.$i.'" value="'.$_POST['r'.$i].'"></th>';
...@@ -526,12 +523,12 @@ function wr_endpoint_phytool($option1, $endpoint){ ...@@ -526,12 +523,12 @@ function wr_endpoint_phytool($option1, $endpoint){
echo '</tr>'; echo '</tr>';
echo '</table>'; echo '</table>';
echo '<input type="hidden" name="option1" value="wr">'; echo '<input type="hidden" name="option1" value="wri">';
echo '<input type="hidden" name="wr" value="yes">'; echo '<input type="hidden" name="wri" value="yes">';
echo '<input type="hidden" name="endpoint" value="'.$endpoint.'">'; echo '<input type="hidden" name="endpoint" value="'.$endpoint.'">';
echo '<center><input type="submit" value="Update" class="btn"></center></form><center>'; echo '<center><input type="submit" value="Update" class="btn"></center></form><center>';
if(!empty($_POST['wr'])){ if(!empty($_POST['wri'])){
for($i=0; $i<18 ; $i++){ for($i=0; $i<18 ; $i++){
if (!empty($_POST['r'.$i])){ if (!empty($_POST['r'.$i])){
$cmd = '/wr/bin/wr_phytool '.$_POST['endpoint'].' wr '.dechex($i).' '.$_POST['r'.$i].''; $cmd = '/wr/bin/wr_phytool '.$_POST['endpoint'].' wr '.dechex($i).' '.$_POST['r'.$i].'';
...@@ -573,8 +570,8 @@ function wr_endpoint_phytool($option1, $endpoint){ ...@@ -573,8 +570,8 @@ function wr_endpoint_phytool($option1, $endpoint){
function wr_show_endpoint_rt_show(){ function wr_show_endpoint_rt_show(){
/* use port number between 1 and 18 */
$output=shell_exec('/wr/bin/wr_phytool wr0 rt show'); $output=shell_exec('/wr/bin/wr_phytool 1 rt show');
$rts = nl2br($output); $rts = nl2br($output);
echo $rts; echo $rts;
} }
...@@ -1161,7 +1158,7 @@ function parse_endpoint_modes(){ ...@@ -1161,7 +1158,7 @@ function parse_endpoint_modes(){
$modes = array(); $modes = array();
for($i = 0; $i < 18; $i++){ for($i = 1; $i <= 18; $i++){
$endpoint = intval($i); $endpoint = intval($i);
$endpoint = sprintf("%02s", $endpoint); $endpoint = sprintf("%02s", $endpoint);
$endpoint = strval($endpoint); $endpoint = strval($endpoint);
...@@ -1219,12 +1216,7 @@ function parse_mask2ports($vlanmask){ ...@@ -1219,12 +1216,7 @@ function parse_mask2ports($vlanmask){
for($i=0; $i<18; $i++){ for($i=0; $i<18; $i++){
if($bin[$i]=="1"){ if($bin[$i]=="1"){
$ports .= "wr".($i+1)." "; $ports .= "wri".($i+1)." ";
$counter++;
if($counter==4){
$ports .= "<br>";
$counter = 0;
}
} }
} }
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<?php <?php
$endpoint = intval($_GET["wr"]); $endpoint = intval($_GET["wri"]);
$endpoint = sprintf("%02s", $endpoint); $endpoint = sprintf("%02s", $endpoint);
$endpoint = strval($endpoint); $endpoint = strval($endpoint);
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
$single_line = explode(" ",$vlans_assignment[$i+1]); //info per endpoint line $single_line = explode(" ",$vlans_assignment[$i+1]); //info per endpoint line
echo '<tr>'; echo '<tr>';
echo '<th><center><b>wr'.($i+1).'</b></center></th>'; echo '<th><center><b>'.($single_line[0]).'</b></center></th>';
//Show the Vlan option button //Show the Vlan option button
echo '<th>'; echo '<th>';
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
echo '<option class="btn" value="'.$vlan[0].$vlan[1].'"><center>ID'.$vlan[0].$vlan[1].'</center></option>'; 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 '<input STYLE="background-color:'.$vlancolor[$single_line[5]].';text-align:center;" size="5" type="text" value="'.$single_line[5].'" name="vlan'.($i).'">';
//echo '<option class="btn" selected="selected" value="disabled"><center>Disabled</center></option>'; //echo '<option class="btn" selected="selected" value="disabled"><center>Disabled</center></option>';
//echo '</select>'; // end Vlan ID assignation //echo '</select>'; // end Vlan ID assignation
...@@ -75,24 +75,24 @@ ...@@ -75,24 +75,24 @@
echo '<th>'; // Mode selection echo '<th>'; // Mode selection
echo '<select name=mode'.($i).'>'; 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[1],"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[1],"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[1],"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 '<option class="btn" '; echo (!strcmp($single_line[1],"3")) ? 'selected="selected"' : ''; echo ' value="3"><center>Unqualified port</center></option>';
echo '</select>'; // end mode echo '</select>'; // end mode
echo '</th>'; echo '</th>';
echo '<th>'; // Priority selection echo '<th>'; // Priority selection
echo '<select name=prio'.($i).'>'; 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[4],"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[4],"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[4],"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[4],"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[4],"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[4],"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[4],"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 '<option class="btn" '; echo (!strcmp($single_line[4],"7")) ? 'selected="selected"' : ''; echo 'value="7"><center>7</center></option>';
echo '</select>'; // end Priority echo '</select>'; // end Priority
...@@ -115,27 +115,28 @@ ...@@ -115,27 +115,28 @@
for($i = 0; $i < 18; $i++){ 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; $vlan_cmd .= " --ep ".($i+1);
$vlan_cmd .= " --emode ".$_POST['mode'.$i]; $vlan_cmd .= " --emode ".$_POST['mode'.$i];
$vlan_cmd .= " --eprio ".$_POST['prio'.$i]; $vlan_cmd .= " --eprio ".$_POST['prio'.$i];
if(!empty($_POST['vlan'.$i])){$vlan_cmd .= " --evid ".$_POST['vlan'.$i];} if(!empty($_POST['vlan'.$i])){$vlan_cmd .= " --evid ".$_POST['vlan'.$i];}
if(!empty($_POST['mask'.$i])){$vlan_cmd .= " --eumask ".$_POST['mask'.$i];} if(!empty($_POST['mask'.$i])){$vlan_cmd .= " --eumask ".$_POST['mask'.$i];}
$output = shell_exec($vlan_cmd); $output = shell_exec($vlan_cmd);
echo $vlan_cmd; echo $vlan_cmd;
echo '<br><p><center>Port WR'.($i+1).' added to VLAN'.$_POST['vlan'.$i].'</center></p>'; echo '<br><p><center>Port wri'.($i+1).' added to VLAN'.$_POST['vlan'.$i].'</center></p>';
//}else{ //}else{
if(!strcmp($_POST['mode'.$i],"2")){ //Disable VLAN for endpoint if(!strcmp($_POST['mode'.$i],"2")){ //Disable VLAN for endpoint
$vlan_cmd .= " --ep ".$i; $vlan_cmd .= " --ep ".($i+1);
$vlan_cmd .= " --emode ".$_POST['mode'.$i]; $vlan_cmd .= " --emode ".$_POST['mode'.$i];
$output = shell_exec($vlan_cmd); $output = shell_exec($vlan_cmd);
echo '<br><p><center>VLAN removed for port WR'.($i+1).'</center></p>'; echo '<br><p><center>VLAN removed for port wri'.($i+1).'</center></p>';
} }
//} //}
$vlan_cmd= "/wr/bin/wrs_vlans "; $vlan_cmd= "/wr/bin/wrs_vlans ";
} }
/* redirect to vlan.php */
header('Location: vlan.php'); header('Location: vlan.php');
} }
......
...@@ -99,7 +99,7 @@ ...@@ -99,7 +99,7 @@
if($counter>=2 && !empty($line)){ if($counter>=2 && !empty($line)){
$line = explode(" ", $line); $line = explode(" ", $line);
echo '<tr align=center><td>WR'.($line[1]+1).'</td><td>'.$line[2]." (".$line[3].')</td><td>'.($line[5]).'</td><td bgcolor="'.$vlancolor[$line[6]].'">VLAN '.$line[6].'</td><td>'.$line[7].'</td></td></tr>'; echo '<tr align=center><td>'.($line[0]).'</td><td>'.$line[1]." (".$line[2].')</td><td>'.($line[4]).'</td><td bgcolor="'.$vlancolor[$line[5]].'">VLAN '.$line[5].'</td><td>'.$line[6].'</td></td></tr>';
} }
......
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