summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgsmselftest2011-11-17 19:12:47 +0100
committergsmselftest2011-11-17 19:12:47 +0100
commitfadf2551d69a15fdd5782b686b962d4e16e4dd92 (patch)
tree30fe337c0e3a1e86d9ced6772c54f83458c615ec
parentupdate loging files for every handler and fic device configuration function (diff)
downloadgsm-selftest-fadf2551d69a15fdd5782b686b962d4e16e4dd92.tar.gz
gsm-selftest-fadf2551d69a15fdd5782b686b962d4e16e4dd92.tar.xz
gsm-selftest-fadf2551d69a15fdd5782b686b962d4e16e4dd92.zip
need more test for tonight. Will be final version by tomorrow noon.
-rw-r--r--Under-Testing/Server-Code-New/ControllerClass.py33
-rw-r--r--Under-Testing/Server-Code-New/DbClass.py2
-rw-r--r--Under-Testing/Server-Code-New/GSMHandler.py15
-rw-r--r--Under-Testing/Server-Code-New/SIPHandler.py37
-rw-r--r--Under-Testing/Server-Code-New/gsmselftest.py29
-rw-r--r--Under-Testing/Server-Code-New/handler.txt2
-rw-r--r--Under-Testing/Server-Code-New/initTestClass.py1
-rw-r--r--Under-Testing/Website/mutexSmartTest.php354
-rw-r--r--[-rwxr-xr-x]Under-Testing/Website/mutexTry.php232
-rw-r--r--Website/mutexSmartTest.php359
-rw-r--r--Website/mutexTry.php1
11 files changed, 531 insertions, 534 deletions
diff --git a/Under-Testing/Server-Code-New/ControllerClass.py b/Under-Testing/Server-Code-New/ControllerClass.py
index 321bc2d..4ed0d9d 100644
--- a/Under-Testing/Server-Code-New/ControllerClass.py
+++ b/Under-Testing/Server-Code-New/ControllerClass.py
@@ -38,13 +38,13 @@ class controller:
if self.callFrom =="GSMRZ3" or self.callFrom =="GSMRZ2": # wait until ssh connection establish
if self.continues == 1:
#putting 6 seconds sleep to prevent unsuccess login using SSH since we have problem with duration time loging into beagle board
- sleep(2)
+ sleep(6)
self.callerGreeting()
else:
self.connected = 'NOT OK'
else:
#waiting 2 seconds if doesnt use ssh connection until handler ready
- sleep(5)
+ sleep(2)
self.callerGreeting()
logger.logEvent('Status Handler Connection :'+self.connected)
@@ -60,13 +60,13 @@ class controller:
if self.dest =="GSMRZ3" or self.dest =="GSMRZ2": # wait until ssh connection establish
if self.continues == 1:
#putting 6 seconds sleep to prevent unsuccess login using SSH since we have problem with duration time loging into beagle board
- sleep(2)
+ sleep(6)
self.receiverGreeting()
else:
self.connected = 'NOT OK'
else:
#waiting 2 seconds if doesnt use ssh connection until handler ready
- sleep(5)
+ sleep(2)
self.receiverGreeting()
logger.logEvent('Status Handler Connection :'+self.connected)
@@ -144,16 +144,19 @@ class controller:
self.resultCaller = self.caller.receiveData(20)
#print 'result '+self.resultCaller+'--'+self.resultDest
if self.resultCaller == 'DEVICE NOT READY':
+ logger.logEvent('Task :'+self.callFrom+' - '+self.dest)
logger.logEvent('Caller DEVICE NOT READY')
self.testResult = 801
self.initTerminate()
elif self.dest == 'DEVICE NOT READY':
+ logger.logEvent('Task :'+self.callFrom+' - '+self.dest)
logger.logEvent('Caller DEVICE NOT READY')
self.testResult = 802
self.initTerminate()
elif self.resultCaller == 'CALL OK' and self.resultDest =='CALL OK':
+ logger.logEvent('Task :'+self.callFrom+' - '+self.dest)
logger.logEvent('Test Succeed')
self.testResult = 200
self.initTerminate()
@@ -161,17 +164,20 @@ class controller:
#build specially only for Eplus card. since they use prepaid card.
if self.dest == 'GSMExt.Eplus':
if self.resultCaller == 'CALL OK' and self.resultDest <> 'TIME OUT':
+ logger.logEvent('Task :'+self.callFrom+' - '+self.dest)
logger.logEvent('Test Failed - Eplus No credit on Eplus')
self.testResult = 402
self.initTerminate()
else:
logger.logEvent('Test Failed')
+ logger.logEvent('Task :'+self.callFrom+' - '+self.dest)
self.testResult = 486
self.initTerminate()
else:
#one or both of the handler send un success test. assign failed to this test
if self.resultCaller <> 'CALL OK' or self.resultDest <> 'CALL OK':
+ logger.logEvent('Task :'+self.callFrom+' - '+self.dest)
logger.logEvent('Test Failed')
self.testResult = 486
self.initTerminate()
@@ -209,14 +215,8 @@ class controller:
else:
self.initAccount(self.accCaller, self.callFrom, self.callPortName,self.portCaller)
#open SSH tunneling
- if self.callFrom =="GSMRZ2":
- localPortNumber = 50222
- elif self.callFrom =="GSMRZ3":
- localPortNumber = 50333
- else:
- localPortNumber = 50888
- self.boxCaller = SSHTunnelBoxClass.SSHTunneling(self.portCaller, localPortNumber, self.server, self.username, self.password)
+ self.boxCaller = SSHTunnelBoxClass.SSHTunneling(self.portCaller, 50008, self.server, self.username, self.password)
status = self.boxCaller.startTunneling()
logger.logEvent('SSH Status :'+str(status))
@@ -234,7 +234,6 @@ class controller:
self.initAccount(self.accCaller,self.callFrom, self.callPortName,self.portCaller)
script = 'SIPHandler.py'
subprocess.Popen(['python',script], shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- #subprocess.Popen(args=["gnome-terminal", '--command=python SIPHandler.py '+self.accCaller+ ' ' +str(self.portCaller)])
# define the destination configuration such as port name and port caller.
def initReceiver(self):
@@ -249,14 +248,8 @@ class controller:
else:
self.initAccount(self.accDest, self.dest, self.destPortName,self.portDest)
#open SSH tunneling
- if self.dest =="GSMRZ2":
- localPortNumber = 50222
- elif self.dest =="GSMRZ3":
- localPortNumber = 50333
- else:
- localPortNumber = 50888
- self.boxDest = SSHTunnelBoxClass.SSHTunneling(self.portDest, localPortNumber, self.server, self.username, self.password)
+ self.boxDest = SSHTunnelBoxClass.SSHTunneling(self.portDest, 50008, self.server, self.username, self.password)
status = self.boxDest.startTunneling()
#check whether the SSH tunneling succes or not, 0 is failed!
@@ -275,7 +268,6 @@ class controller:
self.initAccount(self.accDest, self.dest, self.destPortName,self.portDest)
script = 'SIPHandler.py'
subprocess.Popen(['python',script], shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- #subprocess.Popen(args=['gnome-terminal', '--command=python SIPHandler.py '+self.accDest+ ' ' +str(self.portDest)])
# send terminate message to Handlers
def initTerminate(self):
@@ -363,7 +355,6 @@ class controller:
logger.logEvent('Init GSM')
script = 'GSMHandler.py'
subprocess.Popen(['python',script], shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- #subprocess.Popen(args=["gnome-terminal", '--command=python GSMHandler.py '+str(portCommunication)+ ' ' +str(portDevice)+' '+str(handler)])
diff --git a/Under-Testing/Server-Code-New/DbClass.py b/Under-Testing/Server-Code-New/DbClass.py
index d937eb1..b147e0e 100644
--- a/Under-Testing/Server-Code-New/DbClass.py
+++ b/Under-Testing/Server-Code-New/DbClass.py
@@ -5,7 +5,7 @@ class DBMySQLConnection:
def __init__(self):
#initialize at the start all the user parameters
self.usern = "root"
- self.passw = ""
+ self.passw = "randompasswordSQL"
self.host = "localhost"
self.db = "gsmselftesting"
self.connectionCreated = 0
diff --git a/Under-Testing/Server-Code-New/GSMHandler.py b/Under-Testing/Server-Code-New/GSMHandler.py
index 7cfcfb1..1379fe9 100644
--- a/Under-Testing/Server-Code-New/GSMHandler.py
+++ b/Under-Testing/Server-Code-New/GSMHandler.py
@@ -15,6 +15,16 @@ def initLogfile():
nameOfLogFile = str(handler)+' handler.log'
+def writeToFile():
+ try:
+ string = '--'
+ with open('handler.txt', 'w') as F:
+ writer = csv.writer(F)
+ writer.writerow([string])
+ F.close()
+ except ValueError:
+ print "can't write to file"
+
def openFile():
global sipServer, username, password, handler
global portListen
@@ -25,14 +35,11 @@ def openFile():
reader = csv.reader(File, delimiter=':')
for row in reader:
if str(row[0]) == 'Account':
- #username = str(row[1])
- #password = str(row[2])
- #sipServer = str(row[3])
handler = str(row[4])
portAddress = str(row[5])
portListen = int(row[6])
File.close()
-
+ writeToFile()
baudRate = 19200
diff --git a/Under-Testing/Server-Code-New/SIPHandler.py b/Under-Testing/Server-Code-New/SIPHandler.py
index 6758f88..eb5302c 100644
--- a/Under-Testing/Server-Code-New/SIPHandler.py
+++ b/Under-Testing/Server-Code-New/SIPHandler.py
@@ -25,28 +25,12 @@ class Account(pj.AccountCallback):
call_cb = Calling(current_call)
current_call.set_callback(call_cb)
- server.sendData('Incoming Call')
- logger.logEvent('Current Call :'+current_call)
+ logger.logEvent('Incoming Call')
call.answer(200)
- logger.logEvent("Answer call")
+
sleep(2)
- #print 'Answer Call'
- try :
- logger.logEvent("Try to Hangup the call")
- call.hangup()
- logger.logEvent("Hangup call")
- except ValueError:
- logger.logEvent('CALL OK but cant hangup call')
-
- if current_call <> None:
- logger.logEvent("Hangup call")
- #print 'Hangup Call'
- try:
- call.hangup()
- except ValueError:
- message = 'cant hangup the call'
- #server.sendData('CALL OK')
+
logger.logEvent('CALL OK')
#creating object for calling
@@ -91,6 +75,16 @@ def make_call(uri):
server.sendData('CALL NOT OK')
return None
+def writeToFile():
+ try:
+ string = '--'
+ with open('handler.txt', 'w') as F:
+ writer = csv.writer(F)
+ writer.writerow([string])
+ F.close()
+ except ValueError:
+ print "can't write to file"
+
def openFile():
global sipServer, username, password, ip, portadd
global port
@@ -103,10 +97,9 @@ def openFile():
username = str(row[1])
password = str(row[2])
sipServer = str(row[3])
- #handler = str(row[4])
- #portadd = str(row[5])
port = int(row[6])
File.close()
+ writeToFile()
#send greeting message to the controller
def greeting():
@@ -265,7 +258,7 @@ while stop <> True:
break
logger.logEvent("Goodbye")
-
+logger.closeLogging()
# trying to clean everything before shutting down
try:
acc.delete()
diff --git a/Under-Testing/Server-Code-New/gsmselftest.py b/Under-Testing/Server-Code-New/gsmselftest.py
index ffd24c9..7e43173 100644
--- a/Under-Testing/Server-Code-New/gsmselftest.py
+++ b/Under-Testing/Server-Code-New/gsmselftest.py
@@ -86,11 +86,11 @@ def initNagiosString(x):
initResult = truthtableClass.trueTable(x)
initResult.initTrueTable()
- if int(initResult.FAILED) !=0 :
+ if int(initResult.FAILED) != 0:
print "GSM CRITICAL - Number of test "+str(initResult.testMount)+'; Failure '+str(initResult.FAILED)+'; Unknown '+str(initResult.handlerError)
elif int(initResult.handlerError) != 0:
print "GSM WARNING - Number of test "+str(initResult.testMount)+'; Failure '+str(initResult.FAILED)+'; Unknown '+str(initResult.handlerError)
- elif int(initResult.OK) == int(initResult.testMount):
+ elif int(initResult.FAILED) == 0 and int(initResult.handlerError) == 0:
print "GSM OK - Number of test "+str(initResult.testMount)+'; Failure '+str(initResult.FAILED)+'; Unknown '+str(initResult.handlerError)
else:
@@ -168,7 +168,7 @@ def isThere(keyword,lists):
def testDest(callFrom, callTo, tried):
- makeTest.initTest(callFrom,callTo)#xxxx
+ makeTest.initTest(callFrom,callTo)
db.insertTask(taskNum,callFrom,callTo)
smartResultList.append([callFrom,callTo, makeTest.result,tried])
taskID = db.maxTaskID()
@@ -245,10 +245,11 @@ def smartTest():
#checking unsuccess call, to make sure that destination are really unreachable
for dest in smartResultList:
#check unsuccess call and did the test have already tried, 2 means has been check
- if int(dest[2]) == 486 or int(dest[2]) == 999 or int(dest[2]) == 998 or int(dest[2]) == 801 or int(dest[2]) == 802:
+ if int(dest[2]) == 486 or int(dest[2]) == 999 or int(dest[2]) == 998 or int(dest[2]) == 801 or int(dest[2]) == 802:
+
if int(dest[3]) != 2 and dest[1] != 'sip':
testDestination = True
- founds = False
+ testFromRZ = False
testCaller = True
# make sure that destination have not tested by another part and give success result.
for test in smartResultList:
@@ -259,28 +260,24 @@ def smartTest():
if int(test[2]) == 200:
testCaller = False
#if destination have not tested by other part. try to test from RZ GSM
- if int(test[2]) == 200 and founds != True:
+ if int(test[2]) == 200 and testFromRZ != True:
for caller in cpgsmRZList:
if caller == test[0] or caller == test[1]:
callFrom = caller
- founds = True
+ testFromRZ = True
- if dest[0] != 'sip':
- founds = False
-
if testDestination == True:
- if founds != True:
+ if testFromRZ != True:
callFrom = 'sip'
callTo = dest[1]
- if dest[0] != 'sip':
- testDest(callFrom, callTo, 2)
- rem.append(dest)
+ testDest(callFrom, callTo, 2)
+ rem.append(dest)
#check unsuccess call because caller handler having problem
#destination handler having problem, we should make test also to the caller
if int(dest[2]) == 998 or int(dest[2]) == 802 or int(dest[2]) == 486:
if testCaller == True:
- if founds != True:
+ if testFromRZ != True:
callFrom = 'sip'
callTo = dest[0]
testDest(callFrom, callTo, 2)
@@ -672,8 +669,6 @@ def closeFunction(dbConn,serverSocket):
if len(sys.argv) > 1:
command = sys.argv[1]
-
- print ' '
if command == '--all':
resultsList = list()
diff --git a/Under-Testing/Server-Code-New/handler.txt b/Under-Testing/Server-Code-New/handler.txt
index 3533154..45b50ac 100644
--- a/Under-Testing/Server-Code-New/handler.txt
+++ b/Under-Testing/Server-Code-New/handler.txt
@@ -1 +1 @@
-Account:1289459:MMW9AX:sipgate.de:landline:localhost:36692
+--
diff --git a/Under-Testing/Server-Code-New/initTestClass.py b/Under-Testing/Server-Code-New/initTestClass.py
index 58bf705..568f840 100644
--- a/Under-Testing/Server-Code-New/initTestClass.py
+++ b/Under-Testing/Server-Code-New/initTestClass.py
@@ -93,6 +93,7 @@ class initTesting:
makeTest.FuncTest()
self.result = str(makeTest.testResult)
+
else:
self.result = 100
else:
diff --git a/Under-Testing/Website/mutexSmartTest.php b/Under-Testing/Website/mutexSmartTest.php
index 0d535f9..663f2f0 100644
--- a/Under-Testing/Website/mutexSmartTest.php
+++ b/Under-Testing/Website/mutexSmartTest.php
@@ -1,23 +1,21 @@
<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
@apache_setenv('no-gzip',1);
@ini_set('zlib.output_compression',0);
@ini_set('implicit_flush',1);
-//Connection stuff
+# DB Connection
include 'dbconnection.php';
+# Socket configuration
$port = 34500;
$ip = 'localhost';
@@ -25,142 +23,138 @@ $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die('Error connecting to mys
mysql_select_db($dbname);
-
-//mutex functions, isfree, lock and release
+#mutex functions, isfree, lock and release
include 'mutexFunctions.php';
+
$nameOfLock = 'Webpage';
$timeToKeepTheMutex = 360;
-//Check if the webpage is already open
+#Check if the webpage is already open
$locking = isLocked($nameOfLock);
-if ($locking == '1') //1 means nobody is on the website
+#1 means nobody is on the website
+if ($locking == '1')
{
- //Set a mutex for the webpage
- $lockMe = Lock($nameOfLock,$timeToKeepTheMutex);
-
- if ($lockMe == '1') //1 means a successful lock
- {
- $softwareLock = 'SoftwareStarted';
- $taskAmount= 1;
- $numberofTask =0;
+ $lockMe = Lock($nameOfLock,$timeToKeepTheMutex); //Set a mutex for the webpage
+ if ($lockMe == '1') #1 means a successful lock
+ {
+ #check if the software is running!
+ $softwareLock = 'SoftwareStarted';
+ $taskAmount= 1;
+ $numberofTask =0;
+ if($taskAmount != 0 or $taskAmount == 'ON')
+ {
+ $softwareRunning = isLocked($softwareLock);
+ #1 means software is not started yet, start it
+ if($softwareRunning == '1')
+ {
+ $startApp = fsockopen($ip, 34600, $errno, $error, 5);
+ if (!$startApp)
+ {
+ printf('THE SOFTWARE THAT SHOULD RUN IN BACKGROUND IS NOT RUNNING! -- try to start startSoftware.py script under Server-Code folder');
+ }
+ 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);
+ }
- if($taskAmount != 0 or $taskAmount == 'ON')
- {
- #try to lock the startSoftware
- $StartSoftware = isLocked($softwareLock);
- if($StartSoftware == '1') //1 means software is not started yet, start it
- {
- //trying connect to startsoftware
- $startApp = fsockopen($ip, 34600, $errno, $error, 5);
- if (!$startApp)
- {
- printf('THE SOFTWARE THAT SHOULD RUN IN BACKGROUND IS NOT RUNNING!');
- printf('Solution: - You need to start the script which always running background (startSoftware.py)');
- printf(' - You can find this script on Code -> Server-Code -startSoftware.py');
- printf(' - python startSoftware.py');
- }
- else
- {
- socket_set_timeout( $startApp, 50);
- //send START APP Message to start software to start the task
- fwrite($startApp, "START APP");
- usleep(2500);
- fclose($startApp);
- }
+ #sleep till the software starts
+ sleep(5);
- //sleep till the controller starting
- sleep(6);
- #try to lock the controller
- $controller = isLocked($softwareLock);
-
- if($controller == '0') //Software running and waiting for connection!
- {
- //try to open the socket and connect to the software
- $fp = fsockopen($ip, $port, $errno, $error, 5);
+ #try to lock the controller
+ $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);
+ # send message to controller to start the smart test
+ fwrite($fp, "SMART TEST");
- 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);
- fwrite($fp, "SMART TEST");
- if(!feof($fp))
- {
- while(!feof($fp))
- {
- //receive data!
- $received = fgets($fp, 128);
+ if(!feof($fp))
+ {
+ while(!feof($fp))
+ {
+ #receive data!
+ $received = fgets($fp, 128);
- //we got the confirmation from the testing software
- if ($received == "CONFIRM\n")
- {
- $GSMRZ1 = 0;
- $GSMRZ2 = 0;
- $GSMRZ3 = 0;
+ if ($received == "CONFIRM\n")
+ #we got the confirmation from the controller
+ {
+ $GSMRZ1 = 0;
+ $GSMRZ2 = 0;
+ $GSMRZ3 = 0;
+
+ $SIP = 0;
+ $UNISIP = 0;
+ $LANDLINE = 0;
+ $LSFKS = 0;
- $SIP = 0;
- $UNISIP = 0;
- $LANDLINE = 0;
- $LSFKS = 0;
+ $GSMEE = 0;
+ $GSMEV = 0;
+ $GSMET = 0;
+ $GSMEO = 0;
- $GSMEE = 0;
- $GSMEV = 0;
- $GSMET = 0;
- $GSMEO = 0;
+ $SIPP = 0;
+ $LANDLINEP = 0;
+ $UNISIPP = 0;
+ $NANOBTS1P = 0;
+ $NANOBTS2P = 0;
+
+ echo str_pad(' ',4096).'<br>'."\n";
+ ob_implicit_flush(1);
- $SIPP = 0;
- $LANDLINEP = 0;
- $UNISIPP = 0;
- $NANOBTS1P = 0;
- $NANOBTS2P = 0;
- echo str_pad(' ',4096).'<br>'."\n";
- ob_implicit_flush(1);
- echo '<div id="main">
- <table summary = "Results">
+ 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>
+ <tr>
+ <th scope = "col"> From: </th>
+ <th scope = "col" > To: </th>
+ <th scope = "col"> Message: </th>
+ <th scope = "col"> Status: </th>
+ </tr>
</thead>
- <tbody>';
- ob_implicit_flush(1);
- }
- elseif ($received == "TEST DONE\n")
- {
- if ($taskAmount == "ON")
- {
- $taskAmount = "SMART TEST";
- }
+ <tbody>';
+ ob_implicit_flush(1);
+ }
+ 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>';
- ob_implicit_flush(1);
- 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]);
-
- // start algorithm to define the result for the picture
+ 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">SMART TEST<br>Number of tasks: '.$numberofTask.'<br> TEST SUCCESSFULLY FINISHED!</font></div>';
+ ob_implicit_flush(1);
+ usleep(100);
+ #tell the testing software it may close
+ fwrite($fp, 'DISCONNECT');
+ 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')
@@ -280,6 +274,7 @@ if ($locking == '1') //1 means nobody is on the website
}
}
}
+
if($callFrom == 'GSMRZ2' || $callTo == 'GSMRZ2')
{
if($testStatus == '200' || $testStatus == '402')
@@ -359,9 +354,12 @@ if ($locking == '1') //1 means nobody is on the website
{
$NANOBTS1P= 2;
}
+
}
}
+
}
+
if($callFrom == 'GSMRZ3' || $callTo == 'GSMRZ3')
{
if($testStatus == '200' || $testStatus == '402')
@@ -442,8 +440,10 @@ if ($locking == '1') //1 means nobody is on the website
{
$NANOBTS2P= 2;
}
+
}
- }
+ }//
+
}
if($callFrom == 'GSMEXT.O2' || $callTo == 'GSMEXT.O2')
{
@@ -583,6 +583,7 @@ if ($locking == '1') //1 means nobody is on the website
}
}
}
+
if($callFrom == 'GSMEXT.EPLUS' || $callTo == 'GSMEXT.EPLUS')
{
if($testStatus == '200')
@@ -660,6 +661,7 @@ if ($locking == '1') //1 means nobody is on the website
}
}
}
+
if($callFrom == 'GSMEXT.TM' || $callTo == 'GSMEXT.TM')
{
if($testStatus == '200' || $testStatus == '402')
@@ -730,6 +732,7 @@ if ($locking == '1') //1 means nobody is on the website
}
}
+
if($callFrom == 'LANDLINE' || $callTo == 'LANDLINE')
{
@@ -742,6 +745,7 @@ if ($locking == '1') //1 means nobody is on the website
}
elseif($testStatus == '486')
{
+ $LANDLINEP = 1;
if ($LANDLINE != 1)
{
$LANDLINE = -1;
@@ -870,6 +874,7 @@ if ($locking == '1') //1 means nobody is on the website
{
$UNISIPP = 0;
}
+
}
elseif ($testStatus == '501')
{
@@ -889,71 +894,66 @@ if ($locking == '1') //1 means nobody is on the website
}
}
}
-
- 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 '<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>';
ob_implicit_flush(1);
- usleep(100);
- //tell the software to proceed with the test and confirm receiving data
- fwrite($fp, "CONTINUE");
- }
- }
- }
+ usleep(100);
+ # tesll controller to continue the test
+ fwrite($fp, "CONTINUE");
+ }
+ }
+ }
fclose($fp);//close the soccket and the connection
- }
- }
- elseif($controller == '1')
- {
- echo 'Testing software was not started(didn\'t obtain the lock)! Check it!';
- echo 'Soulution : Check login information (username, password, db name) in DBClass.py';
- echo ' Check manual start manually gsmselftest.py (./gsmselftest.py)';
- }
- else
- {
- echo 'Testing software didn\'t obtain the lock';
- echo 'Soulution : Check login information in DBClass.py';
- echo ' Check manual start manually gsmselftest.py (./gsmselftest.py)';
- }
- }
- elseif($StartSoftware == '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($softwareRunning1 == '1')
+ {
+ echo 'Controller 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>";
+ echo 'Somebody is using the web site already!' . "<br>";
}
else
{
- echo 'We have some serious error here';
+ echo 'We have some serious error here';
}
?>
-
</div>
</body>
</html>
diff --git a/Under-Testing/Website/mutexTry.php b/Under-Testing/Website/mutexTry.php
index 20da2a4..308323d 100755..100644
--- a/Under-Testing/Website/mutexTry.php
+++ b/Under-Testing/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>
@@ -11,9 +10,9 @@
@apache_setenv('no-gzip',1);
@ini_set('zlib.output_compression',0);
@ini_set('implicit_flush',1);
-
//Connection stuff
-include 'dbconnection.php'
+//DB
+include 'dbconnection.php';
//Socket
$port = 34500;
@@ -21,114 +20,122 @@ $ip = 'localhost';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die('Error connecting to mysql');
+//$dbname = 'gsmselftesting';
mysql_select_db($dbname);
-
-//mutex functions, isfree, lock and release
-include 'mutexFunctions.php';
-//insert task functions
-include 'insertData.php';
+//End of connection stuff
+include 'mutexFunctions.php'; //mutex functions, isfree, lock and release
+include 'insertData.php'; //insert task functions
$nameOfLock = 'Webpage';
$timeToKeepTheMutex = 360;
-//Check if the webpage is already open
-$locking = isLocked($nameOfLock);
+$locking = isLocked($nameOfLock);//Check if the webpage is already open
if ($locking == '1') //1 means nobody is on the website
{
- //Set a mutex for the webpage
- $lockMe = Lock($nameOfLock,$timeToKeepTheMutex);
- if ($lockMe == '1') //1 means a successful lock
- {
- // read posted data and add them to the database
- include 'post.php';
- $softwareLock = 'SoftwareStarted';
-
- if($taskAmount != 0)
- {
- #try to lock the startSoftware
- $StartSoftware = isLocked($softwareLock);
- if($StartSoftware == '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!');
- printf('Solution: - You need to start the script which always running background (startSoftware.py)');
- printf(' - You can find this script on Code -> Server-Code -startSoftware.py');
- printf(' - python startSoftware.py');
- }
- 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 till the software starts
- sleep(6);
- $controller = isLocked($softwareLock);
- if($controller == '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!';
+ $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
+// 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);
+ 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);
+ }
+
+ //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!
+ {
+ //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);
- fwrite($fp, "START TEST");
- if(!feof($fp))
- {
- while(!feof($fp))
- {
- $received = fgets($fp, 128); //receive data!
- //we got the confirmation from the testing software
- if ($received == "CONFIRM\n")
- {
- $GSMRZ1 = 0;
- $GSMRZ2 = 0;
- $GSMRZ3 = 0;
-
- $SIP = 0;
- $UNISIP = 0;
- $LANDLINE = 0;
- $LSFKS = 0;
+ }
+ 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");
+
+ //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;
- $GSMEE = 0;
- $GSMEV = 0;
- $GSMET = 0;
- $GSMEO = 0;
-
- $SIPP = 2;
- $LANDLINEP = 2;
- $UNISIPP = 2;
- $NANOBTS1P = 2;
- $NANOBTS2P = 2;
- echo str_pad(' ',4096).'<br>'."\n";
- ob_implicit_flush(1);
- 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))
- {
+ $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 str_pad(' ',4096).'<br>'."\n";
+ ob_implicit_flush(1);
+
+ 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>';
+ ob_implicit_flush(1);
+ 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'];
@@ -158,6 +165,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')
{
@@ -260,7 +268,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')
@@ -274,7 +282,7 @@ if ($locking == '1') //1 means nobody is on the website
}
elseif($testStatus == '999' || $testStatus == '801')
{
- $GSMRZ1 = 0;
+ $GSMRZ1 = 0; //where is nanoBTS1
}
}
}
@@ -322,7 +330,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;
}
}
@@ -353,7 +361,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;
@@ -408,7 +416,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;
}
}
@@ -439,7 +447,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;
@@ -749,6 +757,7 @@ if ($locking == '1') //1 means nobody is on the website
}
elseif($testStatus == '486')
{
+ $LANDLINEP = 1;
if ($LANDLINE != 1)
{
$LANDLINE = -1;
@@ -904,6 +913,7 @@ if ($locking == '1') //1 means nobody is on the website
<td> ' . $dataForTable[4] . ' </td>
<td>' . $dataForTable[3] . '</td>
</tr>';
+ //echo $received . '<br>';
ob_implicit_flush(1);
usleep(100);
fwrite($fp, "CONTINUE"); //tell the software to proceed with the test and confirm receiving data
@@ -916,7 +926,7 @@ if ($locking == '1') //1 means nobody is on the website
}
}
- elseif($controller == '1')
+ elseif($softwareRunning1 == '1')
{
echo 'Testing software was not started(didn\'t obtain the lock)! Check it!';
}
@@ -925,7 +935,7 @@ if ($locking == '1') //1 means nobody is on the website
echo 'Testing software didn\'t obtain the lock';
}
}
- elseif($StartSoftware == '0') //0 means the software is still running in the background
+ 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!)';
}
@@ -934,6 +944,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 b/Website/mutexSmartTest.php
index c7308ac..663f2f0 100644
--- a/Website/mutexSmartTest.php
+++ b/Website/mutexSmartTest.php
@@ -12,148 +12,149 @@
@ini_set('zlib.output_compression',0);
@ini_set('implicit_flush',1);
-//Connection stuff
-//DB
+# DB Connection
include 'dbconnection.php';
-//Socket
+
+# Socket configuration
$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
+
+#mutex functions, isfree, lock and release
+include 'mutexFunctions.php';
+
$nameOfLock = 'Webpage';
$timeToKeepTheMutex = 360;
-$locking = isLocked($nameOfLock);//Check if the webpage is already open
+#Check if the webpage is already open
+$locking = isLocked($nameOfLock);
-if ($locking == '1') //1 means nobody is on the website
+#1 means nobody is on the website
+if ($locking == '1')
{
- $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;
- 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);
- }
-
- //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!
- {
- //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
+ $lockMe = Lock($nameOfLock,$timeToKeepTheMutex); //Set a mutex for the webpage
+ if ($lockMe == '1') #1 means a successful lock
+ {
+ #check if the software is running!
+ $softwareLock = 'SoftwareStarted';
+ $taskAmount= 1;
+ $numberofTask =0;
+ if($taskAmount != 0 or $taskAmount == 'ON')
+ {
+ $softwareRunning = isLocked($softwareLock);
+ #1 means software is not started yet, start it
+ if($softwareRunning == '1')
+ {
+ $startApp = fsockopen($ip, 34600, $errno, $error, 5);
+ if (!$startApp)
+ {
+ printf('THE SOFTWARE THAT SHOULD RUN IN BACKGROUND IS NOT RUNNING! -- try to start startSoftware.py script under Server-Code folder');
+ }
+ 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 till the software starts
+ sleep(5);
+
+ #try to lock the controller
+ $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);
+ # send message to controller to start the smart test
+ fwrite($fp, "SMART TEST");
+
+ if(!feof($fp))
+ {
+ while(!feof($fp))
+ {
+ #receive data!
+ $received = fgets($fp, 128);
+
+ if ($received == "CONFIRM\n")
+ #we got the confirmation from the controller
+ {
+ $GSMRZ1 = 0;
+ $GSMRZ2 = 0;
+ $GSMRZ3 = 0;
- $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 str_pad(' ',4096).'<br>'."\n";
- ob_implicit_flush(1);
-
- 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>';
- ob_implicit_flush(1);
- }
- 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>';
- ob_implicit_flush(1);
- 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]);
- //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!
+ $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;
+
+ echo str_pad(' ',4096).'<br>'."\n";
+ ob_implicit_flush(1);
+
+ 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>
+ <tbody>';
+ ob_implicit_flush(1);
+ }
+ 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">SMART TEST<br>Number of tasks: '.$numberofTask.'<br> TEST SUCCESSFULLY FINISHED!</font></div>';
+ ob_implicit_flush(1);
+ usleep(100);
+ #tell the testing software it may close
+ fwrite($fp, 'DISCONNECT');
+ 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')
@@ -744,6 +745,7 @@ if ($locking == '1') //1 means nobody is on the website
}
elseif($testStatus == '486')
{
+ $LANDLINEP = 1;
if ($LANDLINE != 1)
{
$LANDLINE = -1;
@@ -892,61 +894,56 @@ if ($locking == '1') //1 means nobody is on the website
}
}
}
- //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 $received . '<br>';
- ob_implicit_flush(1);
- 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
-
- }
+ 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>';
+ ob_implicit_flush(1);
+ usleep(100);
+ # tesll controller to continue the test
+ fwrite($fp, "CONTINUE");
+ }
+ }
+ }
+
+ 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!';
- }
-
- //$release = ReleaseLock($nameOfLock);
- //echo $release . "<br>";
- }
- 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($softwareRunning1 == '1')
+ {
+ echo 'Controller 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
{
diff --git a/Website/mutexTry.php b/Website/mutexTry.php
index 262a5f3..308323d 100644
--- a/Website/mutexTry.php
+++ b/Website/mutexTry.php
@@ -757,6 +757,7 @@ if ($locking == '1') //1 means nobody is on the website
}
elseif($testStatus == '486')
{
+ $LANDLINEP = 1;
if ($LANDLINE != 1)
{
$LANDLINE = -1;