summaryrefslogtreecommitdiffstats
path: root/For Weekly Test/Old/30-07-2011/gsmselftest.py
diff options
context:
space:
mode:
Diffstat (limited to 'For Weekly Test/Old/30-07-2011/gsmselftest.py')
-rw-r--r--For Weekly Test/Old/30-07-2011/gsmselftest.py293
1 files changed, 0 insertions, 293 deletions
diff --git a/For Weekly Test/Old/30-07-2011/gsmselftest.py b/For Weekly Test/Old/30-07-2011/gsmselftest.py
deleted file mode 100644
index f8a385c..0000000
--- a/For Weekly Test/Old/30-07-2011/gsmselftest.py
+++ /dev/null
@@ -1,293 +0,0 @@
-#! /usr/bin/env python
-import sys
-import ControllerClass
-import DbClass
-import PingClass
-from time import sleep
-
-def ping(handler):
-
- global serverStatus
-
- if handler == 'landline':
- server = PingClass.Ping('sipgate.de')
- serverStatus = server.ping(1)
-
- elif handler == 'sip':
- server = PingClass.Ping('132.230.4.8')
- serverStatus = server.ping(1)
-
- elif handler == 'unisip':
- server = PingClass.Ping('132.230.252.228')
- serverStatus = server.ping(1)
-
- elif handler == 'gsmr1':
- server = PingClass.Ping('localhost')
- serverStatus = server.ping(1)
-
- elif handler == 'gsmr2':
- server = PingClass.Ping('132.230.4.64')
- serverStatus = server.ping(1)
- else:
- serverStatus = 1
-
-def allPing():
-
- global sipGate
- global sipServer
- global sipLoc
- global gsmBox1
- global gsmBox2
-
- server = PingClass.Ping('sipgate.de')
- sipGate = server.ping(3)
-
- server = PingClass.Ping('132.230.4.8')
- sipServer = server.ping(3)
-
- server = PingClass.Ping('132.230.252.228')
- sipLoc = server.ping(3)
-
- server = PingClass.Ping('localhost')
- gsmBox1 = server.ping(3)
-
- server = PingClass.Ping('132.230.4.64')
- gsmBox2 = server.ping(3)
-
-
-def doTest(callFrom,callTo):
-
-
- global testRepeat
-
- testRepeat = None
- ping(callFrom)
-
- db = DbClass.DBMySQLConnection('root', 'randompasswordSQL', 'localhost', 'gsmselftesting')
- db.connectDB()
- dbStatus = db.connectDB()
-
-
- if serverStatus <> 0 and dbStatus == 1:
-
- ping(callTo)
- if serverStatus <> 0:
- destination = db.deviceAddress(str(callTo))
- caller = db.deviceAddress(str(callFrom))
-
- callAdd = caller[0]
- accCaller = caller[2]+':'+caller[3]+':'+caller[4]+':'
-
- recAdd = destination[0]
- destNo = destination[1]
- accDest = destination[2]+':'+destination[3]+':'+destination[4]+':'
-
- print '\n'
- print 'Caller :', callFrom
- print 'Destination :', callTo
- makeTest = ControllerClass.test(callFrom, callAdd, accCaller, callTo, recAdd, destNo, accDest)
- makeTest.FuncTest()
-
- if makeTest.repeatTest == True:
- testRepeat = True
- db.errorCode(makeTest.testResult)
- print 'Result : ' +str(makeTest.testResult)+ ' ' +db.errCode
- sleep(5)
- else:
- print '[failed] 500 '+callTo+ ' Server Internal Error'
- else:
- print '[failed] 500 '+callFrom+ ' Server Internal Error'
-
-def doSipTest():
-
- print '--SIP Part Test--'
- #destList = ['sip', 'gsmr1','gsmr2', 'gsmr3', 'landline', 'unisip', 'gsmeO', 'gsmeV', 'gsmeT', 'gsmeE']
- destList = ['landline']
- for callTo in destList:
-
- callFrom = 'sip'
- if callFrom <> callTo:
- doTest(callFrom, callTo)
- if testRepeat == True:
- doTest(callTo,callFrom)
-
-def doLandlineTest():
-
- print '--Landline Part Test--'
- destList = ['gsmr1', 'gsmr2', 'gsmr3', 'sip']
-
- for callTo in destList:
-
- callFrom = 'landline'
- doTest(callFrom, callTo)
- if testRepeat == True:
- doTest(callTo,callFrom)
-
-def doGsmrzTest():
-
- print '--GSM Part Test--'
- destList = ['sip', 'gsmr1','gsmr2', 'gsmr3', 'landline', 'unisip', 'gsmeO', 'gsmeV', 'gsmeT', 'gsmeE']
- callList = ['gsmr1','gsmr2', 'gsmr3']
-
- for callFrom in callList:
-
- for callTo in destList:
- if callTo <> callFrom:
- doTest(callFrom, callTo)
- if testRepeat == True:
- doTest(callTo,callFrom)
-
- doGsmExtTest()
-
-def doGsmExtTest():
-
- destList = ['sip', 'gsmr1','gsmr2', 'gsmr3']
- callList = ['gsmeO', 'gsmeV', 'gsmeT', 'gsmeE']
-
- for callFrom in callList:
- for callTo in destList:
-
- doTest(callFrom, callTo)
- if testRepeat == True:
- doTest(callTo,callFrom)
-
-def initResult(i, result):
- global resultsList
-
-
-
-
-def doAllTest():
-
- doSipTest()
- doLandlineTest()
- doGsmTest()
-
-if len(sys.argv) > 1:
-
- command = sys.argv[1]
- print '\n'
-
- if command == '--all':
- doAllTest()
-
- elif command == '--sip':
- doSipTest()
-
- elif command == '--gsm':
- doGsmTest()
-
- elif command == '--landline':
- doLandlineTest()
-
- elif command == '--help':
- file = open('help.txt', 'r')
- print file.read()
-
- else:
- print "command not found, Type '--help', '--credits' for more information."
- print '\n'
-else:
- global resultList
- print '\n'
- db = DbClass.DBMySQLConnection('root', 'randompasswordSQL', 'localhost', 'gsmselftesting')
- db.connectDB()
- dbStatus = db.connectDB()
- resultsList = list()
-
- if dbStatus == 1:
-
- if db.anyTasksToDo() == 1:
-
- #allPing()
- i=0
- for item in db.tasksList:
- print item
- taskID = item[0]
- taskNo = item[1]
- callFrom = item[2]
- callTo = item[3]
- tried = item[4]
-
- destination = db.deviceAddress(str(callTo))
-
- caller = db.deviceAddress(str(callFrom))
-
- callAdd = caller[0]
- accCaller = caller[2]+':'+caller[3]+':'+caller[4]+':'
-
- recAdd = destination[0]
- destNo = destination[1]
- accDest = destination[2]+':'+destination[3]+':'+destination[4]+':'
-
- #if i == 0:
- # db.updatePingResult(taskNo, sipServer, sipGate, sipLoc, gsmBox1, gsmBox2)
- print '\n'
- print 'Task ID :', taskID
- print 'Calling From :', callFrom
- print 'To :', callTo
- print 'number :', destNo
- print 'status :', tried
-
- ping(callFrom)
-
- if serverStatus <> 0:
-
- ping(callTo)
- if serverStatus <> 0:
-
- makeTest = ControllerClass.test(callFrom, callAdd, accCaller, callTo, recAdd, destNo, accDest)
- makeTest.FuncTest()
-
- db.addResult(taskID, makeTest.testResult)
- resultList.append([callTo, callFrom, makeTest.testResult])
-
- if makeTest.repeatTest == True and tried <> '1':
- db.insertTaskIn2(callTo,callFrom,taskNo, '1')
-
- db.errorCode(makeTest.testResult)
- print 'Result : ' +str(makeTest.testResult)+ ' ' +db.errCode
-
- db.deleteTempTask(taskID)
- db.tasksList.remove(item)
- db.tasksList.insert(i,'')
-
- i = i+1
-
- sleep(5)
- else:
- db.addResult(taskID, '500')
- print '[failed] 500 '+callTo+ ' Server Internal Error'
- else:
- db.addResult(taskID, '500')
- print '[failed] 500 '+callFrom+' Server Internal Error'
- db.cleanTasksList()
- else:
- print "No job at all"
- else:
- sys.exit(1)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-