509 lines
16 KiB
PHP
Executable File
509 lines
16 KiB
PHP
Executable File
<?php
|
||
/*********************************************************
|
||
程序说明:
|
||
功能说明:设置七号信令中的 Link
|
||
|
||
调用关系:调用: header.inc
|
||
被调用:
|
||
|
||
变量说明:
|
||
|
||
作者:
|
||
|
||
修改注释:
|
||
NO.1
|
||
姓名: Cui Ticun
|
||
时间:2004-4-21
|
||
修改说明:Support OMC7.0,从advanced移到configuration中,修改
|
||
和添加了上方的操作按钮
|
||
*********************************************************/
|
||
require("../../inc/header.inc");
|
||
$helpId = "2.1.0";
|
||
$DEBUG = 0;
|
||
?>
|
||
<body leftmargin="15" rightmargin="10" onload="javascript:adjust();" onresize="javascript:adjust();" style="overflow:hidden;overflow-x:hidden;overflow-y:hidden;">
|
||
<?php
|
||
adjust_head();
|
||
adjust_title_head();
|
||
if($DEBUG) echo "<br>正在调试中!!";
|
||
//==========================================================
|
||
//变量定义
|
||
//==========================================================
|
||
$pubDb = 'OMC_PUB';
|
||
$paramTable ='OBJ_222.param_99';
|
||
$objIdStr ='2.5.1';
|
||
$maxNum = 30;
|
||
|
||
$nGetComm = 0;
|
||
$nSetComm = 3;
|
||
|
||
$sysId ='222_99_99';
|
||
$initValue ='initValue';
|
||
$editValue ='editValue';
|
||
$readValue ='readValue';
|
||
|
||
$nProcFail = 0;//failure
|
||
$nWaitProc = 1;//wait
|
||
$nInProc = 2;
|
||
$nOutProc = 3;
|
||
|
||
$linkAttConfArr=array(
|
||
array('Flag','06.0-06.0'),
|
||
array('Linkset ID', '00.0-00.7'),
|
||
array('SLC No.', '01.0-01.7'),
|
||
array('Host IP', '02.0-05.7'),
|
||
array('Signaling Type', '06.1-06.3'),
|
||
array('SG ID', '07.0-07.7'),
|
||
array('M2UA Interface ID','08.0-08.7'),
|
||
array('Alternative Host IP','15.0-18.7')
|
||
);
|
||
|
||
$linkTypeArr=array(
|
||
0=>'8ECP',
|
||
1=>'M2UA',
|
||
2=>'MTP3-Lite',
|
||
3=>'IUA',
|
||
4=>'M3UA'
|
||
);
|
||
$levelWhere = getLevelWhere($objIdStr);
|
||
if($DEBUG) echo "<BR>levelWhere=$levelWhere";
|
||
|
||
$defSql = "select initValue from OBJ_222.paramConf where $levelWhere and paramType='2'";//paramType=2,local
|
||
$defResult = mysqli_query($pubConn,$defSql);
|
||
$defRow = mysqli_fetch_array($defResult);
|
||
$defValue = $defRow[initValue];
|
||
|
||
if($DEBUG)echo "<br>defValue=$defValue";
|
||
//==========================================================
|
||
//输入变量
|
||
//==========================================================
|
||
if($DEBUG) echo "<br>setInstanceNo=$setInstanceNo";
|
||
if($DEBUG) echo "<BR>setObjIdStr =$setObjIdStr";
|
||
//==========================================================
|
||
//数据处理
|
||
//==========================================================
|
||
//处理get/set命令
|
||
if($_SERVER['REQUEST_METHOD'] == "POST"){
|
||
echo "<br><br><br><br><br>";
|
||
if(isset($setSys) || isset($getSys)){
|
||
if(isset($setSys)){
|
||
$moveSql = "UPDATE $paramTable SET readValue = initValue
|
||
WHERE level_1='2' AND level_2='5' AND level_3='1'
|
||
";
|
||
if($DEBUG) echo "<BR>moveSql=$moveSql";
|
||
mysqli_query($pubConn,$moveSql);
|
||
echo mysqli_error($pubConn);
|
||
|
||
$commIdStr = sysCommSend($sysId,$nSetComm,$objIdStr);
|
||
|
||
$showType="Set";
|
||
}else{
|
||
$commIdStr = sysCommSend($sysId,$nGetComm,$objIdStr);
|
||
$showType="Get";
|
||
}
|
||
if($DEBUG) echo "<BR>commIdStr =$commIdStr";
|
||
if($DEBUG) echo "<BR>commIdStr =$commIdStr";
|
||
$i = 0;
|
||
while(1)
|
||
{
|
||
//echo "<br>i=$i";
|
||
if($i == 0)
|
||
echo "<br>$showType Link";
|
||
if($i > $maxNum){
|
||
echo "<br><font size=\"2\" color=\"#FF0000\">Timeout</font>";
|
||
break;
|
||
}
|
||
echo "<img border=\"0\" src=\"../../images/arrow.gif\" width=\"10\" height=\"10\">";
|
||
flush();
|
||
$sysId = "222_99_99";
|
||
$chkType = "0";
|
||
$chRes=ChComm($sysId,$chkType);
|
||
//echo "<br>chRes=$chRes";
|
||
if($chRes == $nOutProc || $chRes == $nProcFail){
|
||
if($chRes == $nProcFail)
|
||
echo "<br><font size=\"2\" color=\"#FF0000\">$remark</font><br>";
|
||
elseif($remark == 'response timeout')
|
||
echo "<br><font size=\"2\" color=\"#FF0000\">$remark</font><br>";
|
||
else
|
||
echo "<br><font size=\"2\" color=\"#0000FF\">$remark</font><br>";
|
||
break;
|
||
}
|
||
|
||
sleep(1);
|
||
$i++;
|
||
}
|
||
$needCopyReadBuf = 1;
|
||
|
||
//Get link status
|
||
$commIdStr = sysCommSend($sysId,$nGetComm,"3.1");
|
||
$i = 0;
|
||
while(1)
|
||
{
|
||
//echo "<br>i=$i";
|
||
if($i == 0)
|
||
echo "<br>Get Link Status";
|
||
if($i > $maxNum){
|
||
echo "<br><font size=\"2\" color=\"#FF0000\">Timeout</font>";
|
||
break;
|
||
}
|
||
echo "<img border=\"0\" src=\"../../images/arrow.gif\" width=\"10\" height=\"10\">";
|
||
flush();
|
||
$sysId = "222_99_99";
|
||
$chkType = "0";
|
||
$chRes=ChComm($sysId,$chkType);
|
||
//echo "<br>chRes=$chRes";
|
||
if($chRes == $nOutProc || $chRes == $nProcFail){
|
||
if($chRes == $nProcFail)
|
||
echo "<br><font size=\"2\" color=\"#FF0000\">$remark</font><br>";
|
||
elseif($remark == 'response timeout')
|
||
echo "<br><font size=\"2\" color=\"#FF0000\">$remark</font><br>";
|
||
else
|
||
echo "<br><font size=\"2\" color=\"#0000FF\">$remark</font><br>";
|
||
break;
|
||
}
|
||
|
||
sleep(1);
|
||
$i++;
|
||
}
|
||
$moveSql = "UPDATE $paramTable SET initValue = readValue
|
||
WHERE level_1='2' AND level_2='5' AND level_3='1'
|
||
";
|
||
if($DEBUG) echo "<BR>moveSql=$moveSql";
|
||
mysqli_query($pubConn,$moveSql);
|
||
echo mysqli_error($pubConn);
|
||
|
||
$moveSql = "UPDATE $paramTable SET initValue = readValue
|
||
WHERE level_1='3' AND level_2='1'
|
||
";
|
||
if($DEBUG) echo "<BR>moveSql=$moveSql";
|
||
mysqli_query($pubConn,$moveSql);
|
||
echo mysqli_error($pubConn);
|
||
}elseif(isset($saveSys)){
|
||
$updSql = " UPDATE $paramTable SET initValue = '02'
|
||
WHERE level_1 = '3' AND level_2 = '7'
|
||
";
|
||
$updRes = @mysqli_query($pubConn,$updSql);
|
||
echo mysqli_error($pubConn);
|
||
$commIdStr=sysCommSend($sysId,$nSetComm,'3.7');
|
||
if($DEBUG) echo "<BR>commIdStr =$commIdStr";
|
||
if($DEBUG) echo "<BR>commIdStr =$commIdStr";
|
||
$i = 0;
|
||
while(1)
|
||
{
|
||
//echo "<br>i=$i";
|
||
if($i == 0)
|
||
echo "<br>Save parameter to system";
|
||
if($i > $maxNum){
|
||
echo "<br><font size=\"2\" color=\"#FF0000\">Timeout</font>";
|
||
break;
|
||
}
|
||
echo "<img border=\"0\" src=\"../../images/arrow.gif\" width=\"10\" height=\"10\">";
|
||
flush();
|
||
$sysId = "222_99_99";
|
||
$chkType = "0";
|
||
$chRes=ChComm($sysId,$chkType);
|
||
//echo "<br>chRes=$chRes";
|
||
if($chRes == $nOutProc || $chRes == $nProcFail){
|
||
if($chRes == $nProcFail)
|
||
echo "<br><font size=\"2\" color=\"#FF0000\">$remark</font><br>";
|
||
elseif($remark == 'response timeout')
|
||
echo "<br><font size=\"2\" color=\"#FF0000\">$remark</font><br>";
|
||
else
|
||
echo "<br><font size=\"2\" color=\"#0000FF\">$remark</font><br>";
|
||
break;
|
||
}
|
||
|
||
sleep(1);
|
||
$i++;
|
||
}
|
||
}elseif(isset($resetSys)){
|
||
$updSql = " UPDATE $paramTable SET initValue = '01'
|
||
WHERE level_1 = '3' AND level_2 = '7'
|
||
";
|
||
$updRes = @mysqli_query($pubConn,$updSql);
|
||
echo mysqli_error($pubConn);
|
||
$commIdStr=sysCommSend($sysId,$nSetComm,'3.7');
|
||
if($DEBUG) echo "<BR>commIdStr =$commIdStr";
|
||
if($DEBUG) echo "<BR>commIdStr =$commIdStr";
|
||
$i = 0;
|
||
while(1)
|
||
{
|
||
//echo "<br>i=$i";
|
||
if($i == 0)
|
||
echo "<br>Reset system";
|
||
if($i > $maxNum){
|
||
echo "<br><font size=\"2\" color=\"#FF0000\">Timeout</font>";
|
||
break;
|
||
}
|
||
echo "<img border=\"0\" src=\"../../images/arrow.gif\" width=\"10\" height=\"10\">";
|
||
flush();
|
||
$sysId = "222_99_99";
|
||
$chkType = "0";
|
||
$chRes=ChComm($sysId,$chkType);
|
||
//echo "<br>chRes=$chRes";
|
||
if($chRes == $nOutProc || $chRes == $nProcFail){
|
||
if($chRes == $nProcFail)
|
||
echo "<br><font size=\"2\" color=\"#FF0000\">$remark</font><br>";
|
||
elseif($remark == 'response timeout')
|
||
echo "<br><font size=\"2\" color=\"#FF0000\">$remark</font><br>";
|
||
else
|
||
echo "<br><font size=\"2\" color=\"#0000FF\">$remark</font><br>";
|
||
break;
|
||
}
|
||
|
||
sleep(1);
|
||
$i++;
|
||
}
|
||
}
|
||
}
|
||
if(1==$delete)
|
||
{
|
||
$delSql = "UPDATE $paramTable SET initValue = '$defValue'
|
||
WHERE level_1='2' AND level_2='5' AND level_3='1' AND instanceNo='$delValue'";
|
||
//echo "<br>delSql=$delSql";
|
||
$delRes = @mysqli_query($pubConn,$delSql);
|
||
echo mysqli_error($pubConn);
|
||
}
|
||
|
||
if($setSys || $getSys || $saveSys || $undoSet||$resetSys){
|
||
echo "<br>";
|
||
echo "<p align=\"left\"><a href=\"$PHP_SELF?setFlag=$setFlag\" target=\"contents\"><img align=absBottom border=0 src=\"../../images/left.gif\" width=\"14\" height=\"14\">$strBack</a>";
|
||
exit();
|
||
}
|
||
//==========================================================
|
||
//输出并显示数据
|
||
//==========================================================
|
||
if($DEBUG) echo "<BR>";
|
||
?>
|
||
|
||
<script LANGUAGE="JavaScript">
|
||
function openSet(objIdStr,instanceNo){
|
||
URL="./ss7LinkConf.php?instanceNo="+instanceNo+"&objIdStr="+objIdStr;
|
||
var setWindow = open(URL, 'newWin', 'toolbar=no,directories=no,menubar=no,scrollbars=yes,resizable=yes,status=yes,width=400,height=350');
|
||
setWindow.focus();
|
||
}
|
||
|
||
function delFirm(instanceNo)
|
||
{
|
||
var delValue,x,y;
|
||
x = document.body.scrollLeft;
|
||
y = document.body.scrollTop;
|
||
|
||
if(confirm('Do you want to delete the selected?')!=true){
|
||
window.location.href='<?php echo $PHP_SELF;?>'+"?scroll_x="+x+"&scroll_y="+y;
|
||
}else{
|
||
window.location.href='<?php echo $PHP_SELF;?>?&delete=1&delValue='+instanceNo+"&scroll_x="+x+"&scroll_y="+y;
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<?php
|
||
function ChComm($sysId,$chkType)
|
||
{
|
||
global $omc_db;
|
||
global $remark,$nProcFail,$nWaitProc,$nInProc,$nOutProc;
|
||
|
||
$commTable = "parameterComm";
|
||
|
||
$sysIdArr = explode('_',$sysId);
|
||
$sysTypeNo = $sysIdArr[0];
|
||
$sysNo = $sysIdArr[1];
|
||
$subSysNo = $sysIdArr[2];
|
||
|
||
if($chkType==0)
|
||
$selComm = " SELECT commState,remark FROM $commTable WHERE sysTypeNo = '$sysTypeNo' ";
|
||
else
|
||
$selComm = " SELECT commState,remark FROM $commTable WHERE sysTypeNo = '$sysTypeNo' AND sysNo = '$sysNo' ";
|
||
|
||
$selRes = @mysqli_query($pubConn,$selComm);
|
||
$selRow = @mysqli_fetch_array($selRes);
|
||
echo mysqli_error($pubConn);
|
||
$outProcCount=0;
|
||
do
|
||
{
|
||
$temCommState = $selRow[commState];
|
||
if(isset($selRow[remark])){
|
||
$remark = $selRow[remark];
|
||
if($DEBUG)echo "<br>remark=$remark";
|
||
}
|
||
if($DEBUG)echo "<br>temCommState=$temCommState";
|
||
if($temCommState == $nWaitProc){
|
||
return($nWaitProc);
|
||
}elseif($temCommState == $nInProc){
|
||
return($nInProc);
|
||
}elseif($temCommState == $nOutProc){
|
||
$commState = $nOutProc;
|
||
$outProcCount++;
|
||
}else{
|
||
$commState = $nProcFail;
|
||
}
|
||
}while($selRow = @mysqli_fetch_array($selRes));
|
||
if($outProcCount > 0){
|
||
return($nOutProc);
|
||
}else{
|
||
return($nProcFail);
|
||
}
|
||
}
|
||
?>
|
||
|
||
<?php
|
||
echo "<form method=\"POST\" name=\"setForm\" action=\"$PHP_SELF\">";
|
||
echo "<table id=\"table_up\" border=\"0\" width=\"100%\">";
|
||
echo "<tr>";
|
||
echo "<td width=\"50%\">";
|
||
echo "$strConfiguration > $strNetwork > SS7 > $strLink";
|
||
echo "</td>";
|
||
echo "<td width=\"50%\" align=\"right\" title=\"Help\">";
|
||
showHelp($helpId);
|
||
echo "</td>";
|
||
echo "</tr>";
|
||
echo "<tr>";
|
||
echo "<td align=\"left\">";
|
||
|
||
echo "<b>System:</b> ";
|
||
echo "<input type=\"submit\" name=\"getSys\" value=\"$strGet\" class=\"button\">";
|
||
echo "<input type=\"submit\" name=\"setSys\" value=\"$strSet\" class=\"button\">";
|
||
/*
|
||
if ( TRUE == session_is_registered("linkSetFlag") ) {
|
||
echo "<input type=\"submit\" name=\"undoSet\" value=\"$strUndo\" class=\"button\" style=\"left: 1; top: 2; width: 60; height: 25; position: relative\"> ";
|
||
}else{
|
||
echo "<input type=\"submit\" name=\"undoSet\" value=\"$strUndo\" DISABLED class=\"button\" style=\"left: 1; top: 2; width: 60; height: 25; position: relative\"> ";
|
||
}
|
||
*/
|
||
echo " ";
|
||
echo "<b>Command:</b> ";
|
||
echo "<input type=\"submit\" name=\"saveSys\" value=\"$strSave\" class=\"button\">";
|
||
echo "<input type=\"submit\" name=\"resetSys\" value=\"$strReset\" class=\"button\">";
|
||
echo "<input type=\"hidden\" name=\"objIdStr\" value=\"2.5.1\">";
|
||
echo "</form>";
|
||
|
||
echo "</td>";
|
||
echo "<td> </td>";
|
||
echo "</tr>";
|
||
echo "</table>";
|
||
adjust_title_tail();
|
||
adjust_content_head();
|
||
/*
|
||
echo "<br>";
|
||
echo "<b>System:</b> ";
|
||
echo "<input type=\"submit\" name=\"getSys\" value=\"$strGet\" class=\"button\" style=\"left: 1; top: 2; width: 60; height: 25; position: relative\">";
|
||
echo "<input type=\"submit\" name=\"setSys\" value=\"$strSet\" class=\"button\" style=\"left: 1; top: 2; width: 60; height: 25; position: relative\">";
|
||
echo "<input type=\"submit\" name=\"saveSys\" value=\"$strSave\" class=\"button\" style=\"left: 1; top: 2; width: 60; height: 25; position: relative\">";
|
||
if ( TRUE == session_is_registered("linkSetFlag") ) {
|
||
echo "<input type=\"submit\" name=\"undoSet\" value=\"$strUndo\" class=\"button\" style=\"left: 1; top: 2; width: 60; height: 25; position: relative\"> ";
|
||
}else{
|
||
echo "<input type=\"submit\" name=\"undoSet\" value=\"$strUndo\" DISABLED class=\"button\" style=\"left: 1; top: 2; width: 60; height: 25; position: relative\"> ";
|
||
}
|
||
echo "<b>Omc:</b> ";
|
||
echo "<input type=\"submit\" name=\"getOmc\" value=\"$strGet\" class=\"button\" style=\"left: 1; top: 2; width: 60; height: 25; position: relative\">";
|
||
echo "<input type=\"submit\" name=\"saveOmc\" value=\"$strSave\" class=\"button\" style=\"left: 1; top: 2; width: 60; height: 25; position: relative\"> ";
|
||
echo "<input type=\"hidden\" name=\"objIdStr\" value=\"2.5.1\">";
|
||
echo "</form>";
|
||
*/
|
||
|
||
?>
|
||
<br>
|
||
<table border="1" width="100%" cellpadding="1" cellspacing="0" bordercolor="#666666" bordercolordark="#FFFFFF">
|
||
<?php
|
||
echo "<tr bgcolor=\"#E6E6E6\">";
|
||
echo "<td width=\"5%\">No.</td>";
|
||
echo "<td width=\"10%\">Flag</td>";
|
||
echo "<td width=\"10%\">Linkset ID</td>";
|
||
echo "<td width=\"8%\">SLC</td>";
|
||
echo "<td width=\"12%\">Host IP</td>";
|
||
echo "<td width=\"12%\">Signaling Type</td>";
|
||
echo "<td width=\"10%\">SG ID</td>";
|
||
echo "<td width=\"15%\">M2UA Interface ID</td>";
|
||
echo "<td width=\"12%\">Alternative Host IP</td>";
|
||
echo "<td width=\"10%\">Status</td>";
|
||
echo "<td width=\"5%\">Delete</td>";
|
||
echo "</tr>";
|
||
|
||
$levelWhere = getLevelWhere($objIdStr);
|
||
if($DEBUG) echo "<BR>levelWhere=$levelWhere";
|
||
|
||
$getSql="SELECT $initValue,instanceNo FROM $paramTable
|
||
WHERE $levelWhere
|
||
";
|
||
if($DEBUG) echo "<BR>getSql=$getSql";
|
||
$result =mysqli_query($pubConn,$getSql);
|
||
echo mysqli_error($pubConn);
|
||
|
||
while($rows=mysqli_fetch_array($result)){
|
||
$instanceNo=$rows[1];
|
||
$value=$rows[0];
|
||
if(strcasecmp($rows[0],$defValue)==0){
|
||
continue;
|
||
}
|
||
$flag =getBitValue($value,$linkAttConfArr[0][1]);
|
||
$flag =hexdec($flag);
|
||
$linksetNo =getBitValue($value,$linkAttConfArr[1][1]);
|
||
$linksetNo =hexdec($linksetNo);
|
||
$slcNo =getBitValue($value,$linkAttConfArr[2][1]);
|
||
$slcNo =hexdec($slcNo);
|
||
$cpcIp =getBitValue($value,$linkAttConfArr[3][1]);
|
||
$cpcIp =byte2ip($cpcIp);
|
||
$linkType =getBitValue($value,$linkAttConfArr[4][1]);
|
||
$linkType =bindec($linkType);
|
||
$sgNo =getBitValue($value,$linkAttConfArr[5][1]);
|
||
$sgNo =hexdec($sgNo);
|
||
$m2uaInterfaceId=getBitValue($value,$linkAttConfArr[6][1]);
|
||
$m2uaInterfaceId=hexdec($m2uaInterfaceId);
|
||
$alternativeMTP3=getBitValue($value,$linkAttConfArr[7][1]);
|
||
$alternativeMTP3=byte2ip($alternativeMTP3);
|
||
|
||
|
||
if($objIdStr == $setObjIdStr && $instanceNo == $setInstanceNo){
|
||
echo "<tr bgcolor=\"#CCFFCC\">";
|
||
}else{
|
||
echo "<tr>";
|
||
}
|
||
{//get link Status
|
||
$objStr = '3.1';
|
||
$levelWhere = getLevelWhere($objStr);
|
||
$selSql = "select initValue from $paramTable where $levelWhere and instanceNo='$rows[instanceNo]'";
|
||
$staResult = @mysqli_query($pubConn,$selSql);
|
||
$staRows = @mysqli_fetch_array($staResult);
|
||
$status = hexdec($staRows[initValue]);
|
||
}
|
||
$linkStateArr = array(0=>'Unavailable',1=>'Available',2=>'Inhibited');
|
||
$flagArr=array(0=>'Disable',1=>'Enable');
|
||
echo "<td><a href=\"javascript:openSet('{$linkArr[0][0]}','$instanceNo')\">";
|
||
echo "$instanceNo</a></td>";
|
||
echo "<td>{$flagArr[$flag]}</td>";
|
||
echo "<td>$linksetNo</td>";
|
||
echo "<td>$slcNo</td>";
|
||
echo "<td>$cpcIp</td>";
|
||
echo "<td>{$linkTypeArr[$linkType]}</td>";
|
||
echo "<td>$sgNo</td>";
|
||
echo "<td>$m2uaInterfaceId</td>";
|
||
echo "<td>$alternativeMTP3</td>";
|
||
echo "<td>{$linkStateArr[$status]}</td>";
|
||
echo "<td><input type=\"checkbox\" name=\"C$instanceNo\" value=\"ON\" onClick=\"javascript:delFirm($instanceNo)\" ></td>";
|
||
echo "</tr>";
|
||
}
|
||
//New
|
||
echo "<tr>";
|
||
echo "<td><a href=\"javascript:openSet('$objIdStr','new')\">";
|
||
echo "New</a></td>";
|
||
echo "<td>--</td>";
|
||
echo "<td>--</td>";
|
||
echo "<td>--</td>";
|
||
echo "<td>--</td>";
|
||
echo "<td>--</td>";
|
||
echo "<td>--</td>";
|
||
echo "<td>--</td>";
|
||
echo "<td>--</td>";
|
||
echo "<td>--</td>";
|
||
echo "<td>--</td>";
|
||
echo "</tr>";
|
||
?>
|
||
</table>
|
||
</form>
|
||
|
||
<?php
|
||
adjust_content_tail();
|
||
?>
|
||
</body>
|
||
</html>
|