From d3e5b3926a59f9916e8cc5af493f4da27e22e8d5 Mon Sep 17 00:00:00 2001 From: Mac-Linux Date: Fri, 22 Jul 2011 20:53:45 +0200 Subject: editing file for weekly test. --- For Weekly Test/23-07-2011/Controller.py | 119 ++++++------------------------- 1 file changed, 22 insertions(+), 97 deletions(-) (limited to 'For Weekly Test/23-07-2011/Controller.py') diff --git a/For Weekly Test/23-07-2011/Controller.py b/For Weekly Test/23-07-2011/Controller.py index 0f8812f..b30ee6f 100644 --- a/For Weekly Test/23-07-2011/Controller.py +++ b/For Weekly Test/23-07-2011/Controller.py @@ -1,46 +1,19 @@ import sys -import os -import time -import MySQLdb -import subprocess - - -import classClient #import class socket -import classDb #import class db -import classPing -import classController +import classClient +import classDb +import 2classController +import classCheck from time import sleep - -sipNum = "4661929" -landlnNum = "076145875681" -unisipNum = "076120397897" - -# Main software - -# Check DB connection db = classDb.DBMySQLConnection('root', 'randompasswordSQL', 'localhost', 'gsmselftesting') db.connectDB() -print "" dbStatus = db.connectDB() if dbStatus == 1: - - # Check Ping to the Every Handler - sipServer = classPing.Ping('132.230.4.8') - sipServerStatus = sipServer.ping(3) - - sipGateServer = classPing.Ping('sipgate.de') - sipGateServerStatus = sipGateServer.ping(3) - sipLocalServer = classPing.Ping('132.230.252.228') - sipLocalServerStatus = sipLocalServer.ping(3) - -# Fetch The task information from DB - db.anyTasksToDo() - #x = () + db.anyTasksToDo() for item in db.tasksList: @@ -49,79 +22,31 @@ if dbStatus == 1: callFrom = item[2] callTo = item[3] - print "Test ID : " , taskID - print "Caller : " , callFrom + print "Test ID : " , taskID + print "Caller : " , callFrom print "Receiver : " , callTo - if callFrom == "sip": - if sipServerStatus == 0: - print "[failed] 500 Server Internal Error" + call = classCheck(callFrom) + rec = classCheck(callTo) - else: - - if callTo == "gsmrz1": + if call.serverStatus <> 0: - x = classController.test('-S',"gsmBox1","4661455") - x.FuncTest() - - db.addResult(taskID, x.testResult) + if rec.serverStatus <> 0: - if x.repeatTest == True: - db.insertTaskIn2(callTo,callFrom,taskNo) + makeTest = classController.test(callFrom, callTo,rec.destNumber) + makeTest.FuncTest() - if callTo == "gsmrz2": - - if gsmBox1Status == 0: - print "[failed] 500 Server Internal Error" - - else: - x = classController.test('-S', "gsmBox2", "4661404") - x.FuncTest() - - db.addResult(taskID, x.testResult) - - if x.repeatTest == True: - db.insertTaskIn2(callTo,callFrom,taskNo) - - if callTo == "gsmrz3": + db.addResult(taskID, makeTest.testResult) - if gsmBox2Status == 0: - print "[failed] 500 Server Internal Error" - - else: - x = classController.test('-S', "gsmBox3","4661405") - x.FuncTest() - - db.addResult(taskID, x.testResult) - - if x.repeatTest == True: - db.insertTaskIn2(callTo,callFrom,taskNo) - - if callTo == "landline": - - if sipGateServerStatus == 0: - print "[failed] 500 Server Internal Error" - - else: - x = classController.test('-S', '-L',landlnNum) - x.FuncTest() - - db.addResult(taskID, x.testResult) - - if x.repeatTest == True: - db.insertTaskIn2(callTo,callFrom,taskNo) - sleep(5) - - if callTo == "localsip": - if sipLocalServerStatus == 0: - print "[failed] 500 Server Internal Error" - - else: - x = classController.test('-S', '-U',unisipNum) - x.FuncTest() + if makeTest.repeatTest == True: + db.insertTaskIn2(callTo,callFrom,taskNo) + else: + print "[failed] 500 "+callTo+ " Server Internal Error" + else: + print "[failed] 500 "+callFrom+ " Server Internal Error" - db.addResult(taskID, x.testResult) - sleep(5) + call = None + rec = None # will exit if DB connection failed else: -- cgit v1.2.3-55-g7522