summaryrefslogtreecommitdiffstats
path: root/Website
diff options
context:
space:
mode:
authorgsmselftest2011-11-16 19:37:39 +0100
committergsmselftest2011-11-16 19:37:39 +0100
commit99e436329fd2d68e67b4f3b8bf6ef82a477e0406 (patch)
treeee6a073b22dfae1f1e9f55c702a6feb014322768 /Website
parentunder Testing folder (diff)
downloadgsm-selftest-99e436329fd2d68e67b4f3b8bf6ef82a477e0406.tar.gz
gsm-selftest-99e436329fd2d68e67b4f3b8bf6ef82a477e0406.tar.xz
gsm-selftest-99e436329fd2d68e67b4f3b8bf6ef82a477e0406.zip
Modified now they work, switched to old and added new flush handling without creating a lots of new lines
Diffstat (limited to 'Website')
-rw-r--r--Website/mutexSmartTest.php33
-rw-r--r--Website/mutexSmartTest.php_old951
-rw-r--r--[-rwxr-xr-x]Website/mutexTry.php47
-rwxr-xr-xWebsite/mutexTry.php_old966
4 files changed, 1965 insertions, 32 deletions
diff --git a/Website/mutexSmartTest.php b/Website/mutexSmartTest.php
index 5ce264a..f2bb0b2 100644
--- a/Website/mutexSmartTest.php
+++ b/Website/mutexSmartTest.php
@@ -8,10 +8,14 @@
<body onscroll="scrollEvent();" onload="loaderInit();">
<div>
<?php
+@apache_setenv('no-gzip',1);
+@ini_set('zlib.output_compression',0);
+@ini_set('implicit_flush',1);
+
//Connection stuff
//DB
include 'dbconnection.php';
-
+//Socket
$port = 34500;
$ip = 'localhost';
@@ -32,6 +36,10 @@ if ($locking == '1') //1 means nobody is on the website
$lockMe = Lock($nameOfLock,$timeToKeepTheMutex); //Set a mutex for the webpage
if ($lockMe == '1') //1 means a successful lock
{
+ // read posted data and add them to the database
+// echo 'WE had errors: '. $errorAdding;
+ //stuff to do here
+ //check if the software is running!
$softwareLock = 'SoftwareStarted';
$taskAmount= 1;
$numberofTask =0;
@@ -53,9 +61,10 @@ if ($locking == '1') //1 means nobody is on the website
fclose($startApp);
}
- sleep(6); //sleep till the software starts
-
- //the software should be running already and set the lock, now we test it and then connect to it!
+ //exec("/usr/bin/python /var/www/tricode/gsmselftest2.py > /dev/null 2>&1 &"); //start the software in background and don't wait for any output
+ sleep(6); //sleep half second till the software starts
+ //the software should be running already and set the lock, now we test it and then connect to it!
+
$softwareRunning1 = isLocked($softwareLock);
if($softwareRunning1 == '0') //Software running and waiting for connection!
{
@@ -115,9 +124,7 @@ if ($locking == '1') //1 means nobody is on the website
</thead>
<!-- start of the table rows-->
<tbody>';
- echo str_repeat("\n",7024);
- flush();
-
+ ob_implicit_flush(1);
}
elseif ($received == "TEST DONE\n")
{
@@ -128,9 +135,8 @@ if ($locking == '1') //1 means nobody is on the website
echo '<div id="sidebar">';
echo "<a class='pChart' href='networkResult.php?S=$SIP&RZ1=$GSMRZ1&RZ2=$GSMRZ2&RZ3=$GSMRZ3&US=$UNISIP&LL=$LANDLINE&LS=$LSFKS&EE=$GSMEE&EV=$GSMEV&ET=$GSMET&EO=$GSMEO&SP=$SIPP&SGP=$LANDLINEP&USP=$UNISIPP&NBP1=$NANOBTS1P&NBP2=$NANOBTS2P' data-pchart-alt='Picture3'>Picture 3</a></div>";
echo '<div id="footer"><font size ="3" face="Century Gothic" color="black">Number of tasks: '.$numberofTask.'<br> TEST SUCCESSFULLY FINISHED!</font></div>';
- echo str_repeat("\n",7024);
- flush();
- usleep(100);
+ ob_implicit_flush(1);
+ usleep(100);
fwrite($fp, 'DISCONNECT'); //tell the testing software it may close
break;
}
@@ -143,6 +149,7 @@ if ($locking == '1') //1 means nobody is on the website
$callFrom = strtoupper($dataForTable[1]);
$callTo = strtoupper($dataForTable[2]);
$testStatus = strtoupper($dataForTable[3]);
+ //ADD HERE THE TEST CASES BUT MAKE IT INSIDE OF A FILE (e.q. include 'testing.php'); HERE I PUT IT ONLY FOR EXAMPLE PURPOSES!
if($callFrom == 'SIP' || $callTo == 'SIP')
{
@@ -889,8 +896,8 @@ if ($locking == '1') //1 means nobody is on the website
<td> ' . $dataForTable[4] . ' </td>
<td>' . $dataForTable[3] . '</td>
</tr>';
- echo str_repeat("\n",7024);
- flush();
+ //echo $received . '<br>';
+ ob_implicit_flush(1);
usleep(100);
fwrite($fp, "CONTINUE"); //tell the software to proceed with the test and confirm receiving data
}
@@ -920,6 +927,8 @@ if ($locking == '1') //1 means nobody is on the website
echo 'We have an unknown error! Refresh te web page!';
}
+ //$release = ReleaseLock($nameOfLock);
+ //echo $release . "<br>";
}
else
{
diff --git a/Website/mutexSmartTest.php_old b/Website/mutexSmartTest.php_old
new file mode 100644
index 0000000..5ce264a
--- /dev/null
+++ b/Website/mutexSmartTest.php_old
@@ -0,0 +1,951 @@
+<html>
+<head>
+<script src='delayedLoading.js' type="text/javascript"></script>
+<!--ADD HERE ALL THE NEEDED META DATA -->
+<title>Network test live results!</title>
+<link rel="stylesheet" href="css/tableCSS.css" type="text/css" media="screen">
+</head>
+<body onscroll="scrollEvent();" onload="loaderInit();">
+<div>
+<?php
+//Connection stuff
+//DB
+include 'dbconnection.php';
+
+$port = 34500;
+$ip = 'localhost';
+
+$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die('Error connecting to mysql');
+
+mysql_select_db($dbname);
+//End of connection stuff
+include 'mutexFunctions.php'; //mutex functions, isfree, lock and release
+ //insert task functions
+
+$nameOfLock = 'Webpage';
+$timeToKeepTheMutex = 360;
+
+$locking = isLocked($nameOfLock);//Check if the webpage is already open
+
+if ($locking == '1') //1 means nobody is on the website
+{
+ $lockMe = Lock($nameOfLock,$timeToKeepTheMutex); //Set a mutex for the webpage
+ if ($lockMe == '1') //1 means a successful lock
+ {
+ $softwareLock = 'SoftwareStarted';
+ $taskAmount= 1;
+ $numberofTask =0;
+ if($taskAmount != 0 or $taskAmount == 'ON')
+ {
+ $softwareRunning = isLocked($softwareLock);
+ if($softwareRunning == '1') //1 means software is not started yet, start it
+ {
+ $startApp = fsockopen($ip, 34600, $errno, $error, 5);
+ if (!$startApp)
+ {
+ printf('THE SOFTWARE THAT SHOULD RUN IN BACKGROUND IS NOT RUNNING!');
+ }
+ else
+ {
+ socket_set_timeout( $startApp, 50); //one should set the number of the longest test, so we can define the timeout
+ fwrite($startApp, "START APP");
+ usleep(2500);
+ fclose($startApp);
+ }
+
+ sleep(6); //sleep till the software starts
+
+ //the software should be running already and set the lock, now we test it and then connect to it!
+ $softwareRunning1 = isLocked($softwareLock);
+ if($softwareRunning1 == '0') //Software running and waiting for connection!
+ {
+ //try to open the socket and connect to the software
+ $fp = fsockopen($ip, $port, $errno, $error, 5);
+
+ if (!$fp)
+ {
+ echo 'Could not open the socket or connect to the testing software! Check ports on both sides!';
+
+ }
+ else
+ {
+ socket_set_timeout($fp,50); //one should set the number of the longest test, so we can define the timeout function (it is the number after "$fp,")
+ fwrite($fp, "SMART TEST");
+
+ //fwrite($fp, "SMART TEST"); //send command to start the tests
+ if(!feof($fp))
+ {
+ while(!feof($fp))
+ {
+ $received = fgets($fp, 128); //receive data!
+
+ if ($received == "CONFIRM\n") //we got the confirmation from the testing software
+ {
+ //test finished successfully
+
+ $GSMRZ1 = 0;
+ $GSMRZ2 = 0;
+ $GSMRZ3 = 0;
+
+ $SIP = 0;
+ $UNISIP = 0;
+ $LANDLINE = 0;
+ $LSFKS = 0;
+
+ $GSMEE = 0;
+ $GSMEV = 0;
+ $GSMET = 0;
+ $GSMEO = 0;
+
+ $SIPP = 0;
+ $LANDLINEP = 0;
+ $UNISIPP = 0;
+ $NANOBTS1P = 0;
+ $NANOBTS2P = 0;
+ /////////// end of test!
+ echo '<div id="main">
+ <table summary = "Results">
+ <thead>
+ <tr>
+ <th scope = "col"> From: </th>
+ <th scope = "col" > To: </th>
+ <th scope = "col"> Message: </th>
+ <th scope = "col"> Status: </th>
+ </tr>
+ </thead>
+ <!-- start of the table rows-->
+ <tbody>';
+ echo str_repeat("\n",7024);
+ flush();
+
+ }
+ elseif ($received == "TEST DONE\n")
+ {
+ if ($taskAmount == "ON"){$taskAmount = "SMART TEST";}
+
+ echo '</tbody></table>';
+ echo '</div>';
+ echo '<div id="sidebar">';
+ echo "<a class='pChart' href='networkResult.php?S=$SIP&RZ1=$GSMRZ1&RZ2=$GSMRZ2&RZ3=$GSMRZ3&US=$UNISIP&LL=$LANDLINE&LS=$LSFKS&EE=$GSMEE&EV=$GSMEV&ET=$GSMET&EO=$GSMEO&SP=$SIPP&SGP=$LANDLINEP&USP=$UNISIPP&NBP1=$NANOBTS1P&NBP2=$NANOBTS2P' data-pchart-alt='Picture3'>Picture 3</a></div>";
+ echo '<div id="footer"><font size ="3" face="Century Gothic" color="black">Number of tasks: '.$numberofTask.'<br> TEST SUCCESSFULLY FINISHED!</font></div>';
+ echo str_repeat("\n",7024);
+ flush();
+ usleep(100);
+ fwrite($fp, 'DISCONNECT'); //tell the testing software it may close
+ break;
+ }
+ else
+ {
+ //parse the received data!
+ $numberofTask++;
+ $received = str_replace("\n",'',$received);
+ $dataForTable = explode("|", $received);
+ $callFrom = strtoupper($dataForTable[1]);
+ $callTo = strtoupper($dataForTable[2]);
+ $testStatus = strtoupper($dataForTable[3]);
+
+ if($callFrom == 'SIP' || $callTo == 'SIP')
+ {
+ if($testStatus == '200' || $testStatus == '402')
+ {
+ $SIP = 1;
+ $SIPP = 1;
+ $LSFKS = 1;
+ }
+ elseif($testStatus == '486')
+ {
+ //Check that SIP already working or not, if working, leave as it is, otherwise update that sip broken. same with LSFKS
+ if ($SIP != 1)
+ {
+ $SIP = 1;
+ }
+ $SIPP = 1;
+ if ($LSFKS != 1)
+ {
+ $LSFKS = -1;
+ }
+ }
+ if ($callFrom == 'SIP')
+ {
+ if ($testStatus == '998' || $testStatus == '802')
+ {
+ $SIP = 1;
+ $SIPP = 1;
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+
+ }
+ elseif($testStatus == '999')
+ {
+ if ($SIP != 1)
+ {
+ $SIP = -1;
+ }
+ $SIPP = 2;
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+ }
+ }
+ elseif ($callTo == 'SIP')
+ {
+ if ($testStatus == '999')
+ {
+ if ($SIP != 1)
+ {
+ $SIP = 0;
+ }
+ if ($SIPP != 1)
+ {
+ $SIPP = 0;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+ }
+ elseif($testStatus == '998')
+ {
+ if ($SIP != 1)
+ {
+ $SIP = -1;
+ }
+ $SIPP = 2;
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+ }
+ }
+ }
+ if($callFrom == 'GSMRZ1' || $callTo == 'GSMRZ1')
+ {
+ if($testStatus == '200' || $testStatus == '402')
+ {
+ $GSMRZ1 = 1;
+ }
+ elseif($testStatus == '486')
+ {
+ if ($GSMRZ1 != 1)
+ {
+ $GSMRZ1 = -1;
+ }
+ }
+ if ($callFrom == 'GSMRZ1')
+ {
+ if ($testStatus == '999' || $testStatus == '801')
+ {
+ if ($GSMRZ1 != 1)
+ {
+ $GSMRZ1 = 0;
+ }
+ }
+ elseif($testStatus == '998' || $testStatus == '802')
+ {
+ $GSMRZ1 = 0; //where is nanoBTS1
+ }
+ }
+ elseif ($callTo == 'GSMRZ1')
+ {
+ if ($testStatus == '998' || $testStatus == '802')
+ {
+ if ($GSMRZ1 != 1)
+ {
+ $GSMRZ1 = 0;
+ }
+ }
+ elseif($testStatus == '999' || $testStatus == '801')
+ {
+ $GSMRZ1 = 0; //where is nanoBTS1
+ }
+ }
+ }
+
+ if($callFrom == 'GSMRZ2' || $callTo == 'GSMRZ2')
+ {
+ if($testStatus == '200' || $testStatus == '402')
+ {
+ $GSMRZ2 = 1;
+ $NANOBTS1P = 1;
+ }
+ elseif($testStatus == '486')
+ {
+ if ($GSMRZ2 != 1)
+ {
+ $GSMRZ2 = -1;
+ }
+ $NANOBTS1P = 1;
+ }
+ if ($callFrom == 'GSMRZ2')
+ {
+ if ($testStatus == '999' || $testStatus == '801')
+ {
+ if ($GSMRZ2 != 1)
+ {
+ $GSMRZ2= 0;
+ }
+
+ if ($testStatus == '801')
+ {
+ $NANOBTS1P= 1;
+ }
+ if ($testStatus == '999')
+ {
+ if ($NANOBTS1P != 1)
+ {
+ $NANOBTS1P= 0;
+ }
+ }
+ }
+ elseif ($testStatus == '500')
+ {
+ $NANOBTS1P = 0;
+ $GSMRZ2= 0;
+ }
+ elseif($testStatus == '998' || $testStatus == '802')
+ {
+ $GSMRZ2 = 0; //where is nanoBTS1
+ $NANOBTS1P= 1;
+ }
+ }
+ elseif ($callTo == 'GSMRZ2')
+ {
+ if ($testStatus == '998' || $testStatus == '802')
+ {
+ if ($GSMRZ2 != 1)
+ {
+ $GSMRZ2 = 0;
+ }
+ if ($testStatus == '802')
+ {
+ $NANOBTS1P= 1;
+ }
+ if ($testStatus == '998')
+ {
+ if ($NANOBTS1P != 1)
+ {
+ $NANOBTS1P= 0;
+ }
+ }
+ }
+ elseif ($testStatus == '501')
+ {
+ $NANOBTS1P = 0;
+ $GSMRZ2= 0;
+ }
+ elseif($testStatus == '999' || $testStatus == '801')
+ {
+ $GSMRZ2 = 0; //where is nanoBTS1
+ if ($NANOBTS1P != 1)
+ {
+ $NANOBTS1P= 2;
+ }
+
+ }
+ }
+
+ }
+
+ if($callFrom == 'GSMRZ3' || $callTo == 'GSMRZ3')
+ {
+ if($testStatus == '200' || $testStatus == '402')
+ {
+ $GSMRZ3 = 1;
+ $NANOBTS2P = 1;
+ }
+ elseif($testStatus == '486')
+ {
+
+ if ($GSMRZ3 != 1)
+ {
+ $GSMRZ3 = -1;
+ }
+ $NANOBTS2P = 1;
+ }
+ if ($callFrom == 'GSMRZ3')
+ {
+ if ($testStatus == '999' || $testStatus == '801')
+ {
+ if ($GSMRZ3 != 1)
+ {
+ $GSMRZ3= 0;
+ }
+
+ if ($testStatus == '801')
+ {
+ $NANOBTS2P= 1;
+ }
+ if ($testStatus == '999')
+ {
+ if ($NANOBTS2P != 1)
+ {
+ $NANOBTS2P= 0;
+ }
+ }
+ }
+ elseif ($testStatus == '5010')
+ {
+ $NANOBTS2P = 0;
+ $GSMRZ3= 0;
+ }
+ elseif($testStatus == '998' || $testStatus == '802')
+ {
+ $GSMRZ3 = 0; //where is nanoBTS1
+ $NANOBTS2P= 1;
+ }
+ }
+ elseif ($callTo == 'GSMRZ3')
+ {
+ if ($testStatus == '998' || $testStatus == '802')
+ {
+ if ($GSMRZ3 != 1)
+ {
+ $GSMRZ3 = 0;
+ }
+ if ($testStatus == '802')
+ {
+ $NANOBTS2P= 1;
+ }
+ if ($testStatus == '998')
+ {
+ if ($NANOBTS2P != 1)
+ {
+ $NANOBTS2P= 0;
+ }
+ }
+ }
+ elseif ($testStatus == '501')
+ {
+ $NANOBTS2P = 0;
+ $GSMRZ3= 0;
+ }
+ elseif($testStatus == '999' || $testStatus == '801')
+ {
+ $GSMRZ3 = 0; //where is nanoBTS1
+ if ($NANOBTS1P != 1)
+ {
+ $NANOBTS2P= 2;
+ }
+
+ }
+ }//
+
+ }
+ if($callFrom == 'GSMEXT.O2' || $callTo == 'GSMEXT.O2')
+ {
+ if($testStatus == '200' || $testStatus == '402')
+ {
+ $GSMEO = 1;
+ $LSFKS = 1;
+ }
+ elseif($testStatus == '486')
+ {
+ if ($GSMEO != 1)
+ {
+ $GSMEO = -1;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = -1;
+ }
+ }
+ if ($callFrom == 'GSMEXT.O2')
+ {
+ if ($testStatus == '999' || $testStatus == '801')
+ {
+ if ($GSMEO != 1)
+ {
+ $GSMEO = 0;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+ }
+ elseif($testStatus == '998' || $testStatus == '802')
+ {
+ if ($GSMEO != 1)
+ {
+ $GSMEO =1;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+ }
+ }
+ elseif ($callTo == 'GSMEXT.O2')
+ {
+ if ($testStatus == '999' || $testStatus == '801')
+ {
+ if ($GSMEO != 1)
+ {
+ $GSMEO = 0;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+ }
+ elseif($testStatus == '998' || $testStatus == '802')
+ {
+ if ($GSMEO != 1)
+ {
+ $GSMEO =0;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+ }
+ }
+ }
+ if($callFrom == 'GSMEXT.VODA' || $callTo == 'GSMEXT.VODA')
+ {
+ if($testStatus == '200' || $testStatus == '402')
+ {
+ $GSMEV = 1;
+ $LSFKS = 1;
+ }
+ elseif($testStatus == '486')
+ {
+ if ($GSMEV != 1)
+ {
+ $GSMEV = -1;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = -1;
+ }
+ }
+ if ($callFrom == 'GSMEXT.VODA')
+ {
+ if ($testStatus == '999' || $testStatus == '801')
+ {
+ if ($GSMEV != 1)
+ {
+ $GSMEV = 0;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+ }
+ elseif($testStatus == '998' || $testStatus == '802')
+ {
+ if ($GSMEV != 1)
+ {
+ $GSMEV =1;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+ }
+ }
+ elseif ($callTo == 'GSMEXT.VODA')
+ {
+ if ($testStatus == '999' || $testStatus == '801')
+ {
+ if ($GSMEV != 1)
+ {
+ $GSMEV = 0;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+ }
+ elseif($testStatus == '998' || $testStatus == '802')
+ {
+ if ($GSMEV != 1)
+ {
+ $GSMEV =0;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+ }
+ }
+ }
+
+ if($callFrom == 'GSMEXT.EPLUS' || $callTo == 'GSMEXT.EPLUS')
+ {
+ if($testStatus == '200')
+ {
+ $GSMEE = 1;
+ $LSFKS = 1;
+ }
+ elseif($testStatus == '486')
+ {
+ if ($GSMEE != 1)
+ {
+ $GSMEE = -1;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = -1;
+ }
+ }
+ if ($callFrom == 'GSMEXT.EPLUS')
+ {
+ if ($testStatus == '999' || $testStatus == '801')
+ {
+ if ($GSMEE != 1)
+ {
+ $GSMEE = 0;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+ }
+ elseif($testStatus == '998' || $testStatus == '802')
+ {
+ if ($GSMEE != 1)
+ {
+ $GSMEE =1;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+ }
+ }
+ elseif ($callTo == 'GSMEXT.EPLUS')
+ {
+ if ($testStatus == '999' || $testStatus == '801')
+ {
+ if ($GSMEE != 1)
+ {
+ $GSMEE = 0;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+ }
+ elseif($testStatus == '998' || $testStatus == '802')
+ {
+ if ($GSMEE != 1)
+ {
+ $GSMEE=0;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+ }
+ elseif($testStatus == '402')
+ {
+ if ($GSMEE != 1)
+ {
+ $GSMEE=0;
+ }
+ $LSFKS = 1;
+ }
+ }
+ }
+
+ if($callFrom == 'GSMEXT.TM' || $callTo == 'GSMEXT.TM')
+ {
+ if($testStatus == '200' || $testStatus == '402')
+ {
+ $GSMET = 1;
+ $LSFKS = 1;
+ }
+ elseif($testStatus == '486')
+ {
+ if ($GSMET != 1)
+ {
+ $GSMET = -1;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = -1;
+ }
+ }
+ if ($callFrom == 'GSMEXT.TM')
+ {
+ if ($testStatus == '999' || $testStatus == '801')
+ {
+ if ($GSMET != 1)
+ {
+ $GSMET = 0;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+ }
+ elseif($testStatus == '998' || $testStatus == '802')
+ {
+ if ($GSMET != 1)
+ {
+ $GSMET =1;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+ }
+ }
+ elseif ($callTo == 'GSMEXT.TM')
+ {
+ if ($testStatus == '999' || $testStatus == '801')
+ {
+ if ($GSMET != 1)
+ {
+ $GSMET = 0;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+ }
+ elseif($testStatus == '998' || $testStatus == '802')
+ {
+ if ($GSMET != 1)
+ {
+ $GSMET =0;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+ }
+ }
+
+ }
+
+ if($callFrom == 'LANDLINE' || $callTo == 'LANDLINE')
+ {
+
+ if($testStatus == '200' || $testStatus == '402')
+ {
+
+ $LANDLINEP = 1;
+ $LANDLINE = 1;
+ $LSFKS = 1;
+ }
+ elseif($testStatus == '486')
+ {
+ if ($LANDLINE != 1)
+ {
+ $LANDLINE = -1;
+ }
+ }
+ if ($callFrom == 'LANDLINE')
+ {
+ if ($testStatus == '999')
+ {
+ if ($LANDLINE != 1)
+ {
+ $LANDLINE = -1;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = -1;
+ }
+ if ($LANDLINEP != 1)
+ {
+ $LANDLINEP = 2;
+ }
+ }
+ elseif ($testStatus == '500')
+ {
+ $LANDLINEP = 0;
+ $LANDLINE = 0;
+ }
+ elseif($testStatus == '998' || $testStatus == '802')
+ {
+ $LANDLINE = 1;
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+ $LANDLINEP = 1;
+ }
+ }
+ elseif ($callTo == 'LANDLINE')
+ {
+ if ($testStatus == '999' || $testStatus == '801')
+ {
+ if ($LANDLINE != 1)
+ {
+ $LANDLINE = 0;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+ if ($LANDLINEP != 1)
+ {
+ $LANDLINEP = 0;
+ }
+ }
+ elseif ($testStatus == '501')
+ {
+ $LANDLINEP = 0;
+ $LANDLINE = 0;
+ }
+ elseif($testStatus == '998')
+ {
+ if ($LANDLINE != 1)
+ {
+ $LANDLINE = -1;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+ if ($LANDLINEP != 1)
+ {
+ $LANDLINEP = 2;
+ }
+ }
+ }
+ }
+ if($callFrom == 'UNISIP' || $callTo == 'UNISIP')
+ {
+
+ if($testStatus == '200' || $testStatus == '402')
+ {
+ $UNISIPP = 1;
+ $UNISIP = 1;
+ }
+ elseif($testStatus == '486')
+ {
+ $UNISIPP = 1;
+ if ($UNISIP != 1)
+ {
+ $UNISIP = -1;
+ }
+ }
+ if ($callFrom == 'UNISIP')
+ {
+ if ($testStatus == '999' || $testStatus == '801')
+ {
+ if ($UNISIP != 1)
+ {
+ $UNISIP = -1;
+ }
+ if ($UNISIPP != 1)
+ {
+ $UNISIPP = 2;
+ }
+ }
+ elseif ($testStatus == '500')
+ {
+ $UNISIPP = 0;
+ $UNISIP = 0;
+ }
+ elseif($testStatus == '998' || $testStatus == '802')
+ {
+ $UNISIP = 1;
+ $UNISIPP = 1;
+ }
+ }
+ if ($callTo == 'UNISIP')
+ {
+ if ($testStatus == '998' || $testStatus == '802')
+ {
+ if ($UNISIP != 1)
+ {
+ $UNISIP = -1;
+ }
+ if ($UNISIPP != 1)
+ {
+ $UNISIPP = 0;
+ }
+
+ }
+ elseif ($testStatus == '501')
+ {
+ $UNISIPP = 0;
+ $UNISIP = 0;
+ }
+ elseif($testStatus == '999' || $testStatus == '801')
+ {
+ if ($UNISIP != 1)
+ {
+ $UNISIP = 0;
+ }
+ if ($UNISIPP != 1)
+ {
+ $UNISIPP = 0;
+ }
+ }
+ }
+ }
+ //END OF TEST CASE EXAMPLE
+ echo '<tr>
+ <th scope = "row" id = "r100">'. $dataForTable[1] . '</th>
+ <th scope = "row" id = "r100">'. $dataForTable[2] . '</th>
+ <td> ' . $dataForTable[4] . ' </td>
+ <td>' . $dataForTable[3] . '</td>
+ </tr>';
+ echo str_repeat("\n",7024);
+ flush();
+ usleep(100);
+ fwrite($fp, "CONTINUE"); //tell the software to proceed with the test and confirm receiving data
+ }
+ }
+ }
+
+ fclose($fp);//close the soccket and the connection
+
+ }
+
+ }
+ elseif($softwareRunning1 == '1')
+ {
+ echo 'Testing software was not started(didn\'t obtain the lock)! Check it!';
+ }
+ else
+ {
+ echo 'Testing software didn\'t obtain the lock';
+ }
+ }
+ elseif($softwareRunning == '0') //0 means the software is still running in the background
+ {
+ echo 'Testing software is still running! Maybe you should kill it (if not started manually!)';
+ }
+ else
+ {
+ echo 'We have an unknown error! Refresh te web page!';
+ }
+
+ }
+ else
+ {
+ echo 'No single test was selected! Please go back and select at least one test';
+ }
+ }
+ elseif($lockMe == '0') //0 means if the attempt timed out (for example, because another client has previously locked the name)
+ {
+ echo 'Someone was faster than you';
+ }
+ else
+ {
+ // # if an error occurred (such as running out of memory or the thread was killed with
+ echo 'We have an error here';
+ }
+}
+elseif ($locking == '0') //0 means somebody is already on the web site
+{
+ echo 'Somebody is using the web site already!' . "<br>";
+}
+else
+{
+ echo 'We have some serious error here';
+}
+?>
+</div>
+</body>
+</html>
+
diff --git a/Website/mutexTry.php b/Website/mutexTry.php
index 5579437..f6c22b0 100755..100644
--- a/Website/mutexTry.php
+++ b/Website/mutexTry.php
@@ -1,5 +1,4 @@
-<html>
-<head>
+d>
<script src='delayedLoading.js' type="text/javascript"></script>
<!--ADD HERE ALL THE NEEDED META DATA -->
<title>Network test live results!</title>
@@ -8,10 +7,12 @@
<body onscroll="scrollEvent();" onload="loaderInit();">
<div>
<?php
-
+@apache_setenv('no-gzip',1);
+@ini_set('zlib.output_compression',0);
+@ini_set('implicit_flush',1);
//Connection stuff
//DB
-include 'dbconnection.php'
+include 'dbconnection.php';
//Socket
$port = 34500;
@@ -19,6 +20,7 @@ $ip = 'localhost';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die('Error connecting to mysql');
+//$dbname = 'gsmselftesting';
mysql_select_db($dbname);
//End of connection stuff
include 'mutexFunctions.php'; //mutex functions, isfree, lock and release
@@ -36,9 +38,12 @@ if ($locking == '1') //1 means nobody is on the website
{
include 'post.php'; // read posted data and add them to the database
+// echo 'WE had errors: '. $errorAdding;
+ //stuff to do here
//check if the software is running!
$softwareLock = 'SoftwareStarted';
-
+
+ //$taskAmount= 1
if($taskAmount != 0)
{
$softwareRunning = isLocked($softwareLock);
@@ -57,7 +62,8 @@ if ($locking == '1') //1 means nobody is on the website
fclose($startApp);
}
- sleep(6); //sleep till the software starts
+ //exec("/usr/bin/python /var/www/tricode/gsmselftest2.py > /dev/null 2>&1 &"); //start the software in background and don't wait for any output
+ sleep(6); //sleep half second till the software starts
//the software should be running already and set the lock, now we test it and then connect to it!
$softwareRunning1 = isLocked($softwareLock);
@@ -77,6 +83,7 @@ if ($locking == '1') //1 means nobody is on the website
fwrite($fp, "START TEST");
+ //fwrite($fp, "SMART TEST"); //send command to start the tests
if(!feof($fp))
{
while(!feof($fp))
@@ -119,8 +126,7 @@ if ($locking == '1') //1 means nobody is on the website
</thead>
<!-- start of the table rows-->
<tbody>';
- echo str_repeat("\n",7024);
- flush();
+ ob_implicit_flush(1);
sleep(6);
$pings = mysql_query("select * from PingResultTable where taskNo=(select max(taskNo) from PingResultTable)");
@@ -143,9 +149,8 @@ if ($locking == '1') //1 means nobody is on the website
echo '<div id="sidebar">';
echo "<a class='pChart' href='networkResult.php?S=$SIP&RZ1=$GSMRZ1&RZ2=$GSMRZ2&RZ3=$GSMRZ3&US=$UNISIP&LL=$LANDLINE&LS=$LSFKS&EE=$GSMEE&EV=$GSMEV&ET=$GSMET&EO=$GSMEO&SP=$SIPP&SGP=$LANDLINEP&USP=$UNISIPP&NBP1=$NANOBTS1P&NBP2=$NANOBTS2P&TASKID=$taskNo' data-pchart-alt='Picture3'>Picture 3</a></div>";
echo '<div id="footer"><font size ="3" face="Century Gothic" color="black"> Number of tasks: '.$taskAmount.'<br> Number of tasks tried to add to the DB but had an error: '. $errorAdding .'<br> TEST SUCCESSFULLY FINISHED!</font></div>';
- echo str_repeat("\n",7024);
- flush();
- usleep(100);
+ ob_implicit_flush(1);
+ usleep(100);
fwrite($fp, 'DISCONNECT'); //tell the testing software it may close
break;
}
@@ -157,6 +162,7 @@ if ($locking == '1') //1 means nobody is on the website
$callFrom = strtoupper($dataForTable[1]);
$callTo = strtoupper($dataForTable[2]);
$testStatus = strtoupper($dataForTable[3]);
+ //ADD HERE THE TEST CASES BUT MAKE IT INSIDE OF A FILE (e.q. include 'testing.php'); HERE I PUT IT ONLY FOR EXAMPLE PURPOSES!
if($callFrom == 'SIP' || $callTo == 'SIP')
{
@@ -259,7 +265,7 @@ if ($locking == '1') //1 means nobody is on the website
}
elseif($testStatus == '998' || $testStatus == '802')
{
- $GSMRZ1 = 0;
+ $GSMRZ1 = 0; //where is nanoBTS1
}
}
elseif ($callTo == 'GSMRZ1')
@@ -273,7 +279,7 @@ if ($locking == '1') //1 means nobody is on the website
}
elseif($testStatus == '999' || $testStatus == '801')
{
- $GSMRZ1 = 0;
+ $GSMRZ1 = 0; //where is nanoBTS1
}
}
}
@@ -321,7 +327,7 @@ if ($locking == '1') //1 means nobody is on the website
}
elseif($testStatus == '998' || $testStatus == '802')
{
- $GSMRZ2 = 0;
+ $GSMRZ2 = 0; //where is nanoBTS1
$NANOBTS1P= 1;
}
}
@@ -352,7 +358,7 @@ if ($locking == '1') //1 means nobody is on the website
}
elseif($testStatus == '999' || $testStatus == '801')
{
- $GSMRZ2 = 0;
+ $GSMRZ2 = 0; //where is nanoBTS1
if ($NANOBTS1P != 1)
{
$NANOBTS1P= 2;
@@ -407,7 +413,7 @@ if ($locking == '1') //1 means nobody is on the website
}
elseif($testStatus == '998' || $testStatus == '802')
{
- $GSMRZ3 = 0;
+ $GSMRZ3 = 0; //where is nanoBTS1
$NANOBTS2P= 1;
}
}
@@ -438,7 +444,7 @@ if ($locking == '1') //1 means nobody is on the website
}
elseif($testStatus == '999' || $testStatus == '801')
{
- $GSMRZ3 = 0;
+ $GSMRZ3 = 0; //where is nanoBTS1
if ($NANOBTS1P != 1)
{
$NANOBTS2P= 2;
@@ -903,9 +909,8 @@ if ($locking == '1') //1 means nobody is on the website
<td> ' . $dataForTable[4] . ' </td>
<td>' . $dataForTable[3] . '</td>
</tr>';
-
- echo str_repeat("\n",7024);
- flush();
+ //echo $received . '<br>';
+ ob_implicit_flush(1);
usleep(100);
fwrite($fp, "CONTINUE"); //tell the software to proceed with the test and confirm receiving data
}
@@ -935,6 +940,8 @@ if ($locking == '1') //1 means nobody is on the website
echo 'We have an unknown error! Refresh te web page!';
}
+ //$release = ReleaseLock($nameOfLock);
+ //echo $release . "<br>";
}
else
{
diff --git a/Website/mutexTry.php_old b/Website/mutexTry.php_old
new file mode 100755
index 0000000..5579437
--- /dev/null
+++ b/Website/mutexTry.php_old
@@ -0,0 +1,966 @@
+<html>
+<head>
+<script src='delayedLoading.js' type="text/javascript"></script>
+<!--ADD HERE ALL THE NEEDED META DATA -->
+<title>Network test live results!</title>
+<link rel="stylesheet" href="css/tableCSS.css" type="text/css" media="screen">
+</head>
+<body onscroll="scrollEvent();" onload="loaderInit();">
+<div>
+<?php
+
+//Connection stuff
+//DB
+include 'dbconnection.php'
+
+//Socket
+$port = 34500;
+$ip = 'localhost';
+
+$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die('Error connecting to mysql');
+
+mysql_select_db($dbname);
+//End of connection stuff
+include 'mutexFunctions.php'; //mutex functions, isfree, lock and release
+include 'insertData.php'; //insert task functions
+
+$nameOfLock = 'Webpage';
+$timeToKeepTheMutex = 360;
+
+$locking = isLocked($nameOfLock);//Check if the webpage is already open
+
+if ($locking == '1') //1 means nobody is on the website
+{
+ $lockMe = Lock($nameOfLock,$timeToKeepTheMutex); //Set a mutex for the webpage
+ if ($lockMe == '1') //1 means a successful lock
+ {
+
+ include 'post.php'; // read posted data and add them to the database
+ //check if the software is running!
+ $softwareLock = 'SoftwareStarted';
+
+ if($taskAmount != 0)
+ {
+ $softwareRunning = isLocked($softwareLock);
+ if($softwareRunning == '1') //1 means software is not started yet, start it
+ {
+ $startApp = fsockopen($ip, 34600, $errno, $error, 5);
+ if (!$startApp)
+ {
+ printf('THE SOFTWARE THAT SHOULD RUN IN BACKGROUND IS NOT RUNNING!');
+ }
+ else
+ {
+ socket_set_timeout( $startApp, 50); //one should set the number of the longest test, so we can define the timeout
+ fwrite($startApp, "START APP");
+ usleep(2500);
+ fclose($startApp);
+ }
+
+ sleep(6); //sleep till the software starts
+ //the software should be running already and set the lock, now we test it and then connect to it!
+
+ $softwareRunning1 = isLocked($softwareLock);
+ if($softwareRunning1 == '0') //Software running and waiting for connection!
+ {
+ //try to open the socket and connect to the software
+ $fp = fsockopen($ip, $port, $errno, $error, 5);
+
+ if (!$fp)
+ {
+ echo 'Could not open the socket or connect to the testing software! Check ports on both sides!';
+
+ }
+ else
+ {
+ socket_set_timeout($fp,50); //one should set the number of the longest test, so we can define the timeout function (it is the number after "$fp,")
+
+ fwrite($fp, "START TEST");
+
+ if(!feof($fp))
+ {
+ while(!feof($fp))
+ {
+ $received = fgets($fp, 128); //receive data!
+
+ if ($received == "CONFIRM\n") //we got the confirmation from the testing software
+ {
+ //test finished successfully
+
+ $GSMRZ1 = 0;
+ $GSMRZ2 = 0;
+ $GSMRZ3 = 0;
+
+ $SIP = 0;
+ $UNISIP = 0;
+ $LANDLINE = 0;
+ $LSFKS = 0;
+
+ $GSMEE = 0;
+ $GSMEV = 0;
+ $GSMET = 0;
+ $GSMEO = 0;
+
+ $SIPP = 2;
+ $LANDLINEP = 2;
+ $UNISIPP = 2;
+ $NANOBTS1P = 2;
+ $NANOBTS2P = 2;
+ /////////// end of test!
+ echo '<div id="main">
+ <table summary = "Results">
+ <thead>
+ <tr>
+ <th scope = "col"> From: </th>
+ <th scope = "col" > To: </th>
+ <th scope = "col"> Message: </th>
+ <th scope = "col"> Status: </th>
+ </tr>
+ </thead>
+ <!-- start of the table rows-->
+ <tbody>';
+ echo str_repeat("\n",7024);
+ flush();
+ sleep(6);
+ $pings = mysql_query("select * from PingResultTable where taskNo=(select max(taskNo) from PingResultTable)");
+
+ while($row = mysql_fetch_array($pings))
+ {
+ // echo $row['taskNo'];
+ $SIPP = $row['sipServer'];
+ $LANDLINEP = $row['sipGate'];
+ $UNISIPP = $row['unisip'];
+ $NANOBTS1P = $row['gsmBox1'];
+ $NANOBTS2P = $row['gsmBox2'];
+ }
+ }
+ elseif ($received == "TEST DONE\n")
+ {
+
+
+ echo '</tbody></table>';
+ echo '</div>';
+ echo '<div id="sidebar">';
+ echo "<a class='pChart' href='networkResult.php?S=$SIP&RZ1=$GSMRZ1&RZ2=$GSMRZ2&RZ3=$GSMRZ3&US=$UNISIP&LL=$LANDLINE&LS=$LSFKS&EE=$GSMEE&EV=$GSMEV&ET=$GSMET&EO=$GSMEO&SP=$SIPP&SGP=$LANDLINEP&USP=$UNISIPP&NBP1=$NANOBTS1P&NBP2=$NANOBTS2P&TASKID=$taskNo' data-pchart-alt='Picture3'>Picture 3</a></div>";
+ echo '<div id="footer"><font size ="3" face="Century Gothic" color="black"> Number of tasks: '.$taskAmount.'<br> Number of tasks tried to add to the DB but had an error: '. $errorAdding .'<br> TEST SUCCESSFULLY FINISHED!</font></div>';
+ echo str_repeat("\n",7024);
+ flush();
+ usleep(100);
+ fwrite($fp, 'DISCONNECT'); //tell the testing software it may close
+ break;
+ }
+ else
+ {
+ //parse the received data!
+ $received = str_replace("\n",'',$received);
+ $dataForTable = explode("|", $received);
+ $callFrom = strtoupper($dataForTable[1]);
+ $callTo = strtoupper($dataForTable[2]);
+ $testStatus = strtoupper($dataForTable[3]);
+
+ if($callFrom == 'SIP' || $callTo == 'SIP')
+ {
+ if($testStatus == '200' || $testStatus == '402')
+ {
+ $SIP = 1;
+ $SIPP = 1;
+ $LSFKS = 1;
+ }
+ elseif($testStatus == '486')
+ {
+ //Check that SIP already working or not, if working, leave as it is, otherwise update that sip broken. same with LSFKS
+ if ($SIP != 1)
+ {
+ $SIP = 1;
+ }
+ $SIPP = 1;
+ if ($LSFKS != 1)
+ {
+ $LSFKS = -1;
+ }
+ }
+ if ($callFrom == 'SIP')
+ {
+ if ($testStatus == '998' || $testStatus == '802')
+ {
+ $SIP = 1;
+ $SIPP = 1;
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+
+ }
+ elseif($testStatus == '999')
+ {
+ if ($SIP != 1)
+ {
+ $SIP = -1;
+ }
+ $SIPP = 2;
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+ }
+ }
+ elseif ($callTo == 'SIP')
+ {
+ if ($testStatus == '999')
+ {
+ if ($SIP != 1)
+ {
+ $SIP = 0;
+ }
+ if ($SIPP != 1)
+ {
+ $SIPP = 0;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+ }
+ elseif($testStatus == '998')
+ {
+ if ($SIP != 1)
+ {
+ $SIP = -1;
+ }
+ $SIPP = 2;
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+ }
+ }
+ }
+ if($callFrom == 'GSMRZ1' || $callTo == 'GSMRZ1')
+ {
+ if($testStatus == '200' || $testStatus == '402')
+ {
+ $GSMRZ1 = 1;
+ }
+ elseif($testStatus == '486')
+ {
+ if ($GSMRZ1 != 1)
+ {
+ $GSMRZ1 = -1;
+ }
+ }
+ if ($callFrom == 'GSMRZ1')
+ {
+ if ($testStatus == '999' || $testStatus == '801')
+ {
+ if ($GSMRZ1 != 1)
+ {
+ $GSMRZ1 = 0;
+ }
+ }
+ elseif($testStatus == '998' || $testStatus == '802')
+ {
+ $GSMRZ1 = 0;
+ }
+ }
+ elseif ($callTo == 'GSMRZ1')
+ {
+ if ($testStatus == '998' || $testStatus == '802')
+ {
+ if ($GSMRZ1 != 1)
+ {
+ $GSMRZ1 = 0;
+ }
+ }
+ elseif($testStatus == '999' || $testStatus == '801')
+ {
+ $GSMRZ1 = 0;
+ }
+ }
+ }
+
+ if($callFrom == 'GSMRZ2' || $callTo == 'GSMRZ2')
+ {
+ if($testStatus == '200' || $testStatus == '402')
+ {
+ $GSMRZ2 = 1;
+ $NANOBTS1P = 1;
+ }
+ elseif($testStatus == '486')
+ {
+ if ($GSMRZ2 != 1)
+ {
+ $GSMRZ2 = -1;
+ }
+ $NANOBTS1P = 1;
+ }
+ if ($callFrom == 'GSMRZ2')
+ {
+ if ($testStatus == '999' || $testStatus == '801')
+ {
+ if ($GSMRZ2 != 1)
+ {
+ $GSMRZ2= 0;
+ }
+
+ if ($testStatus == '801')
+ {
+ $NANOBTS1P= 1;
+ }
+ if ($testStatus == '999')
+ {
+ if ($NANOBTS1P != 1)
+ {
+ $NANOBTS1P= 0;
+ }
+ }
+ }
+ elseif ($testStatus == '500')
+ {
+ $NANOBTS1P = 0;
+ $GSMRZ2= 0;
+ }
+ elseif($testStatus == '998' || $testStatus == '802')
+ {
+ $GSMRZ2 = 0;
+ $NANOBTS1P= 1;
+ }
+ }
+ elseif ($callTo == 'GSMRZ2')
+ {
+ if ($testStatus == '998' || $testStatus == '802')
+ {
+ if ($GSMRZ2 != 1)
+ {
+ $GSMRZ2 = 0;
+ }
+ if ($testStatus == '802')
+ {
+ $NANOBTS1P= 1;
+ }
+ if ($testStatus == '998')
+ {
+ if ($NANOBTS1P != 1)
+ {
+ $NANOBTS1P= 0;
+ }
+ }
+ }
+ elseif ($testStatus == '501')
+ {
+ $NANOBTS1P = 0;
+ $GSMRZ2= 0;
+ }
+ elseif($testStatus == '999' || $testStatus == '801')
+ {
+ $GSMRZ2 = 0;
+ if ($NANOBTS1P != 1)
+ {
+ $NANOBTS1P= 2;
+ }
+
+ }
+ }
+
+ }
+
+ if($callFrom == 'GSMRZ3' || $callTo == 'GSMRZ3')
+ {
+ if($testStatus == '200' || $testStatus == '402')
+ {
+ $GSMRZ3 = 1;
+ $NANOBTS2P = 1;
+ }
+ elseif($testStatus == '486')
+ {
+
+ if ($GSMRZ3 != 1)
+ {
+ $GSMRZ3 = -1;
+ }
+ $NANOBTS2P = 1;
+ }
+ if ($callFrom == 'GSMRZ3')
+ {
+ if ($testStatus == '999' || $testStatus == '801')
+ {
+ if ($GSMRZ3 != 1)
+ {
+ $GSMRZ3= 0;
+ }
+
+ if ($testStatus == '801')
+ {
+ $NANOBTS2P= 1;
+ }
+ if ($testStatus == '999')
+ {
+ if ($NANOBTS2P != 1)
+ {
+ $NANOBTS2P= 0;
+ }
+ }
+ }
+ elseif ($testStatus == '5010')
+ {
+ $NANOBTS2P = 0;
+ $GSMRZ3= 0;
+ }
+ elseif($testStatus == '998' || $testStatus == '802')
+ {
+ $GSMRZ3 = 0;
+ $NANOBTS2P= 1;
+ }
+ }
+ elseif ($callTo == 'GSMRZ3')
+ {
+ if ($testStatus == '998' || $testStatus == '802')
+ {
+ if ($GSMRZ3 != 1)
+ {
+ $GSMRZ3 = 0;
+ }
+ if ($testStatus == '802')
+ {
+ $NANOBTS2P= 1;
+ }
+ if ($testStatus == '998')
+ {
+ if ($NANOBTS2P != 1)
+ {
+ $NANOBTS2P= 0;
+ }
+ }
+ }
+ elseif ($testStatus == '501')
+ {
+ $NANOBTS2P = 0;
+ $GSMRZ3= 0;
+ }
+ elseif($testStatus == '999' || $testStatus == '801')
+ {
+ $GSMRZ3 = 0;
+ if ($NANOBTS1P != 1)
+ {
+ $NANOBTS2P= 2;
+ }
+
+ }
+ }//
+
+ }
+ if($callFrom == 'GSMEXT.O2' || $callTo == 'GSMEXT.O2')
+ {
+ if($testStatus == '200' || $testStatus == '402')
+ {
+ $GSMEO = 1;
+ $LSFKS = 1;
+ }
+ elseif($testStatus == '486')
+ {
+ if ($GSMEO != 1)
+ {
+ $GSMEO = -1;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = -1;
+ }
+ }
+ if ($callFrom == 'GSMEXT.O2')
+ {
+ if ($testStatus == '999' || $testStatus == '801')
+ {
+ if ($GSMEO != 1)
+ {
+ $GSMEO = 0;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+ }
+ elseif($testStatus == '998' || $testStatus == '802')
+ {
+ if ($GSMEO != 1)
+ {
+ $GSMEO =1;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+ }
+ }
+ elseif ($callTo == 'GSMEXT.O2')
+ {
+ if ($testStatus == '999' || $testStatus == '801')
+ {
+ if ($GSMEO != 1)
+ {
+ $GSMEO = 0;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+ }
+ elseif($testStatus == '998' || $testStatus == '802')
+ {
+ if ($GSMEO != 1)
+ {
+ $GSMEO =0;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+ }
+ }
+ }
+ if($callFrom == 'GSMEXT.VODA' || $callTo == 'GSMEXT.VODA')
+ {
+ if($testStatus == '200' || $testStatus == '402')
+ {
+ $GSMEV = 1;
+ $LSFKS = 1;
+ }
+ elseif($testStatus == '486')
+ {
+ if ($GSMEV != 1)
+ {
+ $GSMEV = -1;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = -1;
+ }
+ }
+ if ($callFrom == 'GSMEXT.VODA')
+ {
+ if ($testStatus == '999' || $testStatus == '801')
+ {
+ if ($GSMEV != 1)
+ {
+ $GSMEV = 0;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+ }
+ elseif($testStatus == '998' || $testStatus == '802')
+ {
+ if ($GSMEV != 1)
+ {
+ $GSMEV =1;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+ }
+ }
+ elseif ($callTo == 'GSMEXT.VODA')
+ {
+ if ($testStatus == '999' || $testStatus == '801')
+ {
+ if ($GSMEV != 1)
+ {
+ $GSMEV = 0;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+ }
+ elseif($testStatus == '998' || $testStatus == '802')
+ {
+ if ($GSMEV != 1)
+ {
+ $GSMEV =0;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+ }
+ }
+ }
+
+ if($callFrom == 'GSMEXT.EPLUS' || $callTo == 'GSMEXT.EPLUS')
+ {
+ if($testStatus == '200')
+ {
+ $GSMEE = 1;
+ $LSFKS = 1;
+ }
+ elseif($testStatus == '486')
+ {
+ if ($GSMEE != 1)
+ {
+ $GSMEE = -1;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = -1;
+ }
+ }
+ if ($callFrom == 'GSMEXT.EPLUS')
+ {
+ if ($testStatus == '999' || $testStatus == '801')
+ {
+ if ($GSMEE != 1)
+ {
+ $GSMEE = 0;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+ }
+ elseif($testStatus == '998' || $testStatus == '802')
+ {
+ if ($GSMEE != 1)
+ {
+ $GSMEE =1;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+ }
+ }
+ elseif ($callTo == 'GSMEXT.EPLUS')
+ {
+ if ($testStatus == '999' || $testStatus == '801')
+ {
+ if ($GSMEE != 1)
+ {
+ $GSMEE = 0;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+ }
+ elseif($testStatus == '998' || $testStatus == '802')
+ {
+ if ($GSMEE != 1)
+ {
+ $GSMEE=0;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+ }
+ elseif($testStatus == '402')
+ {
+ if ($GSMEE != 1)
+ {
+ $GSMEE=0;
+ }
+ $LSFKS = 1;
+ }
+ }
+ }
+
+ if($callFrom == 'GSMEXT.TM' || $callTo == 'GSMEXT.TM')
+ {
+ if($testStatus == '200' || $testStatus == '402')
+ {
+ $GSMET = 1;
+ $LSFKS = 1;
+ }
+ elseif($testStatus == '486')
+ {
+ if ($GSMET != 1)
+ {
+ $GSMET = -1;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = -1;
+ }
+ }
+ if ($callFrom == 'GSMEXT.TM')
+ {
+ if ($testStatus == '999' || $testStatus == '801')
+ {
+ if ($GSMET != 1)
+ {
+ $GSMET = 0;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+ }
+ elseif($testStatus == '998' || $testStatus == '802')
+ {
+ if ($GSMET != 1)
+ {
+ $GSMET =1;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+ }
+ }
+ elseif ($callTo == 'GSMEXT.TM')
+ {
+ if ($testStatus == '999' || $testStatus == '801')
+ {
+ if ($GSMET != 1)
+ {
+ $GSMET = 0;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+ }
+ elseif($testStatus == '998' || $testStatus == '802')
+ {
+ if ($GSMET != 1)
+ {
+ $GSMET =0;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+ }
+ }
+
+ }
+
+ if($callFrom == 'LANDLINE' || $callTo == 'LANDLINE')
+ {
+
+ if($testStatus == '200' || $testStatus == '402')
+ {
+
+ $LANDLINEP = 1;
+ $LANDLINE = 1;
+ $LSFKS = 1;
+ }
+ elseif($testStatus == '486')
+ {
+ if ($LANDLINE != 1)
+ {
+ $LANDLINE = -1;
+ }
+ }
+ if ($callFrom == 'LANDLINE')
+ {
+ if ($testStatus == '999')
+ {
+ if ($LANDLINE != 1)
+ {
+ $LANDLINE = -1;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = -1;
+ }
+ if ($LANDLINEP != 1)
+ {
+ $LANDLINEP = 2;
+ }
+ }
+ elseif ($testStatus == '500')
+ {
+ $LANDLINEP = 0;
+ $LANDLINE = 0;
+ }
+ elseif($testStatus == '998' || $testStatus == '802')
+ {
+ $LANDLINE = 1;
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+ $LANDLINEP = 1;
+ }
+ }
+ elseif ($callTo == 'LANDLINE')
+ {
+ if ($testStatus == '999' || $testStatus == '801')
+ {
+ if ($LANDLINE != 1)
+ {
+ $LANDLINE = 0;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+ if ($LANDLINEP != 1)
+ {
+ $LANDLINEP = 0;
+ }
+ }
+ elseif ($testStatus == '501')
+ {
+ $LANDLINEP = 0;
+ $LANDLINE = 0;
+ }
+ elseif($testStatus == '998')
+ {
+ if ($LANDLINE != 1)
+ {
+ $LANDLINE = -1;
+ }
+ if ($LSFKS != 1)
+ {
+ $LSFKS = 0;
+ }
+ if ($LANDLINEP != 1)
+ {
+ $LANDLINEP = 2;
+ }
+ }
+ }
+ }
+ if($callFrom == 'UNISIP' || $callTo == 'UNISIP')
+ {
+
+ if($testStatus == '200' || $testStatus == '402')
+ {
+ $UNISIPP = 1;
+ $UNISIP = 1;
+ }
+ elseif($testStatus == '486')
+ {
+ $UNISIPP = 1;
+ if ($UNISIP != 1)
+ {
+ $UNISIP = -1;
+ }
+ }
+ if ($callFrom == 'UNISIP')
+ {
+ if ($testStatus == '999' || $testStatus == '801')
+ {
+ if ($UNISIP != 1)
+ {
+ $UNISIP = -1;
+ }
+ if ($UNISIPP != 1)
+ {
+ $UNISIPP = 2;
+ }
+ }
+ elseif ($testStatus == '500')
+ {
+ $UNISIPP = 0;
+ $UNISIP = 0;
+ }
+ elseif($testStatus == '998' || $testStatus == '802')
+ {
+ $UNISIP = 1;
+ $UNISIPP = 1;
+ }
+ }
+ if ($callTo == 'UNISIP')
+ {
+ if ($testStatus == '998' || $testStatus == '802')
+ {
+ if ($UNISIP != 1)
+ {
+ $UNISIP = -1;
+ }
+ if ($UNISIPP != 1)
+ {
+ $UNISIPP = 0;
+ }
+
+ }
+ elseif ($testStatus == '501')
+ {
+ $UNISIPP = 0;
+ $UNISIP = 0;
+ }
+ elseif($testStatus == '999' || $testStatus == '801')
+ {
+ if ($UNISIP != 1)
+ {
+ $UNISIP = 0;
+ }
+ if ($UNISIPP != 1)
+ {
+ $UNISIPP = 0;
+ }
+ }
+ }
+ }
+ //END OF TEST CASE EXAMPLE
+ echo '<tr>
+ <th scope = "row" id = "r100">'. $dataForTable[1] . '</th>
+ <th scope = "row" id = "r100">'. $dataForTable[2] . '</th>
+ <td> ' . $dataForTable[4] . ' </td>
+ <td>' . $dataForTable[3] . '</td>
+ </tr>';
+
+ echo str_repeat("\n",7024);
+ flush();
+ usleep(100);
+ fwrite($fp, "CONTINUE"); //tell the software to proceed with the test and confirm receiving data
+ }
+ }
+ }
+
+ fclose($fp);//close the soccket and the connection
+
+ }
+
+ }
+ elseif($softwareRunning1 == '1')
+ {
+ echo 'Testing software was not started(didn\'t obtain the lock)! Check it!';
+ }
+ else
+ {
+ echo 'Testing software didn\'t obtain the lock';
+ }
+ }
+ elseif($softwareRunning == '0') //0 means the software is still running in the background
+ {
+ echo 'Testing software is still running! Maybe you should kill it (if not started manually!)';
+ }
+ else
+ {
+ echo 'We have an unknown error! Refresh te web page!';
+ }
+
+ }
+ else
+ {
+ echo 'No single test was selected! Please go back and select at least one test';
+ }
+ }
+ elseif($lockMe == '0') //0 means if the attempt timed out (for example, because another client has previously locked the name)
+ {
+ echo 'Someone was faster than you';
+ }
+ else
+ {
+ // # if an error occurred (such as running out of memory or the thread was killed with
+ echo 'We have an error here';
+ }
+}
+elseif ($locking == '0') //0 means somebody is already on the web site
+{
+ echo 'Somebody is using the web site already!' . "<br>";
+}
+else
+{
+ echo 'We have some serious error here';
+}
+?>
+</div>
+</body>
+</html>
+