summaryrefslogtreecommitdiffstats
path: root/For Weekly Test/Old/20-07-2011/Controller.py
diff options
context:
space:
mode:
authorgsmselgtest2011-09-02 14:03:42 +0200
committergsmselgtest2011-09-02 14:03:42 +0200
commit4e27bfa0dff3c328ae8db1b119f089afe02acc83 (patch)
treec8aa12210f176c420c59ecdae7929ae63b269c5e /For Weekly Test/Old/20-07-2011/Controller.py
parentMerge branch 'master' of lab.ks.uni-freiburg.de:lsfks/projekte/gsm-selftest (diff)
downloadgsm-selftest-4e27bfa0dff3c328ae8db1b119f089afe02acc83.tar.gz
gsm-selftest-4e27bfa0dff3c328ae8db1b119f089afe02acc83.tar.xz
gsm-selftest-4e27bfa0dff3c328ae8db1b119f089afe02acc83.zip
rearange test file
Diffstat (limited to 'For Weekly Test/Old/20-07-2011/Controller.py')
-rw-r--r--For Weekly Test/Old/20-07-2011/Controller.py183
1 files changed, 183 insertions, 0 deletions
diff --git a/For Weekly Test/Old/20-07-2011/Controller.py b/For Weekly Test/Old/20-07-2011/Controller.py
new file mode 100644
index 0000000..c1d63a4
--- /dev/null
+++ b/For Weekly Test/Old/20-07-2011/Controller.py
@@ -0,0 +1,183 @@
+import sys
+import os
+import time
+import MySQLdb
+import subprocess
+
+
+import classClient #import class socket
+import classDb #import class db
+import classPing
+import classController
+from time import sleep
+
+
+
+sipNum = "4661929"
+landlnNum = "076145875681"
+unisipNum = "076120397897"
+
+
+sipCall = "sipCall.py"
+sipRec = "sipReceiver.py"
+landlnCall = "landlineCall.py"
+landlnRec = "landlineReceiver.py"
+localSipRec = "localsipReceiver.py"
+
+
+# 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 = ()
+
+ for item in db.tasksList:
+
+ taskID = item[0]
+ taskNo = item[1]
+ callFrom = item[2]
+ callTo = item[3]
+
+ print "Test ID : " , taskID
+ print "Caller : " , callFrom
+ print "Receiver : " , callTo
+
+ if callFrom == "sip":
+ if sipServerStatus == 0:
+ print "[failed] 500 Server Internal Error"
+
+ else:
+
+ if callTo == "gsmrz1":
+
+ x = classController.test(sipCall, "localhost", "gsmincom_.py", "localhost","4661455")
+ x.FuncTest()
+
+ db.addResult(taskID, x.testResult)
+
+ if x.repeatTest == True:
+ db.insertTaskIn2(callTo,callFrom,taskNo)
+
+ if callTo == "gsmrz2":
+
+ if gsmBox1Status == 0:
+ print "[failed] 500 Server Internal Error"
+
+ else:
+ x = classController.test(sipCall, "localhost", "Box1", "132.0.0.2","404")
+ x.FuncTest()
+
+ db.addResult(taskID, x.testResult)
+
+ if x.repeatTest == True:
+ db.insertTaskIn2(callTo,callFrom,taskNo)
+
+ if callTo == "gsmrz3":
+
+ if gsmBox2Status == 0:
+ print "[failed] 500 Server Internal Error"
+
+ else:
+ x = classController.test(sipCall, "localhost", "Box2", "132.0.0.3","405")
+ 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(sipCall, "localhost", landlnRec, "localhost",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(sipCall, "localhost", localSipRec, "localhost",unisipNum)
+ x.FuncTest()
+
+ db.addResult(taskID, x.testResult)
+ sleep(5)
+
+ if callTo == "externalgsm":
+ x.FuncTest(sipCall, "localhost", o2Rec, "localhost","405")
+ db.addResult(taskID, testResult)
+
+ x.FuncTest(sipCall, "localhost", tmobileRec, "localhost","405")
+ db.addResult(taskID, testResult)
+
+ x.FuncTest(sipCall, "localhost", vodafoneRec, "localhost","405")
+ db.addResult(taskID, testResult)
+
+ x.FuncTest(sipCall, "localhost", "xx", "localhost","405")
+ db.addResult(taskID, testResult)
+
+
+
+ if callFrom =="gsmrz1":
+
+ if callTo =="sip":
+ if sipServerStatus == 0:
+ print "[failed] 500 Server Internal Error"
+
+ else:
+ x.FuncTest("gsmcall_.py", "localhost", sipRec, "localhost",sipNum)
+ db.addResult(taskID, testResult)
+ sleep(10)
+
+
+ if callTo =="gsmrz2":
+ if gsmBox1Status == 0:
+ print "[failed] 500 Server Internal Error"
+
+ else:
+ x.FuncTest("Box1", "132.0.0.2", sipRec, "localhost",sipNum)
+ db.addResult(taskID, testResult)
+
+ if callTo =="gsmrz3":
+ if gsmBox2Status == 0:
+ print "[failed] 500 Server Internal Error"
+
+ else:
+ x.FuncTest("Box2", "132.0.0.3", sipRec, "localhost",sipNum)
+ db.addResult(taskID, testResult)
+
+
+
+
+# will exit if DB connection failed
+else:
+ sys.exit(5)
+