summaryrefslogtreecommitdiffstats
path: root/For Weekly Test
diff options
context:
space:
mode:
authortt412011-07-27 01:44:34 +0200
committertt412011-07-27 01:44:34 +0200
commit80a8487546bdb528a91b734ee46e04600857e2fb (patch)
tree2c864d65fb6c2f18d9e8bcbb5016a76594b15ce4 /For Weekly Test
parentdelete import classcheck (diff)
downloadgsm-selftest-80a8487546bdb528a91b734ee46e04600857e2fb.tar.gz
gsm-selftest-80a8487546bdb528a91b734ee46e04600857e2fb.tar.xz
gsm-selftest-80a8487546bdb528a91b734ee46e04600857e2fb.zip
gsm test file final
Diffstat (limited to 'For Weekly Test')
-rw-r--r--For Weekly Test/30-07-2011/DeviceAddress.py23
-rw-r--r--For Weekly Test/30-07-2011/DeviceAddress.txt3
-rw-r--r--For Weekly Test/30-07-2011/gsmselftest.py242
-rw-r--r--For Weekly Test/30-07-2011/help.txt9
4 files changed, 277 insertions, 0 deletions
diff --git a/For Weekly Test/30-07-2011/DeviceAddress.py b/For Weekly Test/30-07-2011/DeviceAddress.py
new file mode 100644
index 0000000..1211b43
--- /dev/null
+++ b/For Weekly Test/30-07-2011/DeviceAddress.py
@@ -0,0 +1,23 @@
+class DeviceAddress:
+
+ def __init__(self):
+ self.add = None
+ self.num = None
+
+ def findDevice(self, device):
+ file = open('DeviceAddress.txt', 'r')
+
+ for line in file:
+
+ first = line.find('[')
+ second= line.find(']') # search for position
+ find = line[first+1:second]
+
+ space = line.find(' ')
+ newLine =line[space+1:]
+ space2 = newLine.find(' ')
+
+ if find == device:
+ self.add = newLine[0:space2]
+ self.num = newLine[space2+1:]
+ file.close()
diff --git a/For Weekly Test/30-07-2011/DeviceAddress.txt b/For Weekly Test/30-07-2011/DeviceAddress.txt
new file mode 100644
index 0000000..ae0b990
--- /dev/null
+++ b/For Weekly Test/30-07-2011/DeviceAddress.txt
@@ -0,0 +1,3 @@
+[sip] localhost 999
+
+[landline] localhost 888
diff --git a/For Weekly Test/30-07-2011/gsmselftest.py b/For Weekly Test/30-07-2011/gsmselftest.py
new file mode 100644
index 0000000..381f3f4
--- /dev/null
+++ b/For Weekly Test/30-07-2011/gsmselftest.py
@@ -0,0 +1,242 @@
+import sys
+import ControllerClass
+import PingClass
+import DeviceAddress
+from time import sleep
+
+def ping(handler):
+
+ global serverStatus
+
+ if handler == 'landline':
+ server = PingClass.Ping('sipgate.de')
+ serverStatus = server.ping(3)
+
+ elif handler == 'sip':
+ server = PingClass.Ping('132.230.4.8')
+ serverStatus = server.ping(3)
+
+ elif handler == 'unisip':
+ server = PingClass.Ping('132.230.252.228')
+ serverStatus = server.ping(3)
+
+ elif handler == 'gsmr1':
+ server = PingClass.Ping('localhost')
+ serverStatus = server.ping(3)
+
+ elif handler == 'gsmr2':
+ server = PingClass.Ping('132.230.4.64')
+ serverStatus = server.ping(3)
+
+
+def doTest(callFrom,callTo)
+ global testResult
+
+ ping(callFrom)
+ device = DeviceAddress.DeviceAddress()
+
+ if serverStatus <> 0:
+
+ ping(callTo)
+ if serverStatus <> 0:
+ device.findDevice(callTo)
+ recAdd = device.add
+ destNo = device.num
+
+ device.findDevice(callFrom)
+ callAdd = device.add
+
+ print '\n'
+ print "Caller: ", callFrom
+ print 'Destination: ', callTo
+ makeTest = ControllerClass.test(callFrom, callAdd, callTo, recAdd, destNo)
+ makeTest.FuncTest()
+
+ #db.addResult(taskID, makeTest.testResult)
+
+ if makeTest.repeatTest == True:
+ testRepeat = True
+
+ print "Result :", makeTest.testResult
+
+ #db.deleteTempTask(taskID)
+ #db.tasksList.remove(item)
+ #db.tasksList.insert(i,'')
+ sleep(3)
+ else:
+ print "[failed] 500 "+callTo+ " Server Internal Error"
+ else:
+ print "[failed] 500 "+callFrom+ " Server Internal Error"
+
+def doSipTest():
+
+ destList = ['gsmr1', 'gsmr2', 'gsmr3', 'landline', 'unisip', 'gsmeO', 'gsmeV', 'gsmeT', 'gsmeE']
+
+ for callTo in destList:
+
+ callFrom = 'sip'
+ doTest(callFrom, callTo)
+
+def doLandlineTest():
+
+ destList = ['gsmr1', 'gsmr2', 'gsmr3', 'sip']
+
+ for callTo in destList:
+
+ callFrom = 'landline'
+ doTest(callFrom, callTo)
+
+def doGsmrzTest():
+
+ destList = ['sip', 'gsmr1','gsmr2', 'gsmr3', 'landline', 'unisip', 'gsmeO', 'gsmeV', 'gsmeT', 'gsmeE']
+
+ for callTo in destList:
+
+ callFrom = 'gsmr1'
+ if callFrom <> callTo:
+ doTest(callFrom, callTo)
+
+ callFrom = 'gsmr2'
+ if callFrom <> callTo:
+ doTest(callFrom, callTo)
+
+ callFrom = 'gsmr3'
+ if callFrom <> callTo:
+ doTest(callFrom, callTo)
+ doGsmExtTest()
+
+def doGsmExtTest():
+
+ destList = ['sip', 'gsmr1','gsmr2', 'gsmr3']
+
+ for callTo in destList:
+
+ callFrom = 'gsmeO'
+ doTest(callFrom, callTo)
+
+ callFrom = 'gsmeV'
+ doTest(callFrom, callTo)
+
+ callFrom = 'gsmeT'
+ doTest(callFrom, callTo)
+
+ callFrom = 'gsmeE'
+ doTest(callFrom, callTo)
+
+def doAllTest():
+
+ doSipTest()
+ doLandlineTest()
+ doGsmTest()
+
+if len(sys.argv) > 1:
+ command = sys.argv[1]
+
+ 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', '--copyright', '--credits' or '--license' for more information."
+else:
+
+ db = DbClass.DBMySQLConnection('root', 'randompasswordSQL', 'localhost', 'gsmselftesting')
+ db.connectDB()
+ dbStatus = db.connectDB()
+
+ if dbStatus == 1:
+
+ if db.anyTasksToDo() == 1:
+ i=0
+ for item in db.tasksList:
+ taskID = item[0]
+ taskNo = item[1]
+ callFrom = item[2]
+ callTo = item[3]
+
+ destination = db.deviceAddress(str(callTo))
+
+ caller = db.deviceAddress(str(callFrom))
+
+ callAdd = caller[0]
+ recAdd = destination[0]
+ destNo = destination[1]
+
+ if callFrom == 'unisip':
+ destNo = destNo[7:]
+
+
+ print '\n'
+ print "Task ID: ", taskID
+ print "Calling From: ", callFrom
+ print "To: ", callTo
+ print "number: ", destNo
+
+ ping(callFrom)
+
+ if serverStatus <> 0:
+
+ ping(callTo)
+ if serverStatus <> 0:
+
+ makeTest = ControllerClass.test(callFrom, callAdd, callTo, recAdd, destNo)
+ makeTest.FuncTest()
+
+ db.addResult(taskID, makeTest.testResult)
+
+ if makeTest.repeatTest == True:
+ db.insertTaskIn2(callTo,callFrom,taskNo)
+
+ print "Result :", makeTest.testResult
+
+ db.deleteTempTask(taskID)
+ db.tasksList.remove(item)
+ db.tasksList.insert(i,'')
+ i = i+1
+
+ sleep(3)
+ else:
+ print "[failed] 500 "+callTo+ " Server Internal Error"
+ else:
+ print "[failed] 500 "+callFrom+ " Server Internal Error"
+ db.cleanTasksList()
+ else:
+ print "No job at all"
+ else:
+ sys.exit(5)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/For Weekly Test/30-07-2011/help.txt b/For Weekly Test/30-07-2011/help.txt
new file mode 100644
index 0000000..5a1f1ed
--- /dev/null
+++ b/For Weekly Test/30-07-2011/help.txt
@@ -0,0 +1,9 @@
+usage: python gsmselftest.py [option]
+
+Options and arguments (and corresponding environment variables):
+
+--all : To execute all test case
+--sip : To execute ALL test case
+--gsm : To execute GSM test case
+--extGsm : To execute external GSM test case
+--landline : To execute Landline test case