summaryrefslogtreecommitdiffstats
path: root/Under-Testing/Server-Code-New/ControllerClass.py
diff options
context:
space:
mode:
authorgsmselftest2011-11-17 19:12:47 +0100
committergsmselftest2011-11-17 19:12:47 +0100
commitfadf2551d69a15fdd5782b686b962d4e16e4dd92 (patch)
tree30fe337c0e3a1e86d9ced6772c54f83458c615ec /Under-Testing/Server-Code-New/ControllerClass.py
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.
Diffstat (limited to 'Under-Testing/Server-Code-New/ControllerClass.py')
-rw-r--r--Under-Testing/Server-Code-New/ControllerClass.py33
1 files changed, 12 insertions, 21 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)])