summaryrefslogtreecommitdiffstats
path: root/For Weekly Test/30-07-2011/gsmselftest.py
diff options
context:
space:
mode:
Diffstat (limited to 'For Weekly Test/30-07-2011/gsmselftest.py')
-rwxr-xr-xFor Weekly Test/30-07-2011/gsmselftest.py54
1 files changed, 31 insertions, 23 deletions
diff --git a/For Weekly Test/30-07-2011/gsmselftest.py b/For Weekly Test/30-07-2011/gsmselftest.py
index 1f9c4e5..8cc4c16 100755
--- a/For Weekly Test/30-07-2011/gsmselftest.py
+++ b/For Weekly Test/30-07-2011/gsmselftest.py
@@ -3,7 +3,6 @@ import sys
import ControllerClass
import DbClass
import PingClass
-import DeviceAddressClass
from time import sleep
def ping(handler):
@@ -12,23 +11,23 @@ def ping(handler):
if handler == 'landline':
server = PingClass.Ping('sipgate.de')
- serverStatus = server.ping(3)
+ serverStatus = server.ping(1)
elif handler == 'sip':
server = PingClass.Ping('132.230.4.8')
- serverStatus = server.ping(3)
+ serverStatus = server.ping(1)
elif handler == 'unisip':
server = PingClass.Ping('132.230.252.228')
- serverStatus = server.ping(3)
+ serverStatus = server.ping(1)
elif handler == 'gsmr1':
server = PingClass.Ping('localhost')
- serverStatus = server.ping(3)
+ serverStatus = server.ping(1)
elif handler == 'gsmr2':
server = PingClass.Ping('132.230.4.64')
- serverStatus = server.ping(3)
+ serverStatus = server.ping(1)
else:
serverStatus = 1
@@ -57,33 +56,43 @@ def allPing():
def doTest(callFrom,callTo):
+
+
global testRepeat
+
testRepeat = None
ping(callFrom)
- device = DeviceAddressClass.DeviceAddress()
- if serverStatus <> 0:
+ db = DbClass.DBMySQLConnection('root', 'randompasswordSQL', 'localhost', 'gsmselftesting')
+ db.connectDB()
+ dbStatus = db.connectDB()
+
+
+ if serverStatus <> 0 and dbStatus == 1:
ping(callTo)
if serverStatus <> 0:
- device.findDevice(callTo)
- recAdd = device.add
- destNo = str(device.num)
+ destination = db.deviceAddress(str(callTo))
+ caller = db.deviceAddress(str(callFrom))
+
+ callAdd = caller[0]
+ accCaller = caller[2]+':'+caller[3]+':'+caller[4]+':'
- device.findDevice(callFrom)
- callAdd = device.add
+ 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, callTo, recAdd, destNo)
+ makeTest = ControllerClass.test(callFrom, callAdd, accCaller, callTo, recAdd, destNo, accDest)
makeTest.FuncTest()
if makeTest.repeatTest == True:
testRepeat = True
print 'Result :', makeTest.testResult
- sleep(3)
+ sleep(5)
else:
print '[failed] 500 '+callTo+ ' Server Internal Error'
else:
@@ -92,8 +101,8 @@ def doTest(callFrom,callTo):
def doSipTest():
print '--SIP Part Test--'
- destList = ['sip', 'gsmr1','gsmr2', 'gsmr3', 'landline', 'unisip', 'gsmeO', 'gsmeV', 'gsmeT', 'gsmeE']
- #destList = ['unisip']
+ #destList = ['sip', 'gsmr1','gsmr2', 'gsmr3', 'landline', 'unisip', 'gsmeO', 'gsmeV', 'gsmeT', 'gsmeE']
+ destList = ['landline']
for callTo in destList:
callFrom = 'sip'
@@ -197,15 +206,14 @@ else:
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)
-
- if callFrom == 'unisip':
- destNo = destNo[7:]
-
print '\n'
print 'Task ID :', taskID
print 'Calling From :', callFrom
@@ -220,7 +228,7 @@ else:
ping(callTo)
if serverStatus <> 0:
- makeTest = ControllerClass.test(callFrom, callAdd, callTo, recAdd, destNo)
+ makeTest = ControllerClass.test(callFrom, callAdd, accCaller, callTo, recAdd, destNo, accDest)
makeTest.FuncTest()
db.addResult(taskID, makeTest.testResult)
@@ -236,7 +244,7 @@ else:
i = i+1
- sleep(3)
+ sleep(5)
else:
db.addResult(taskID, '500')
print '[failed] 500 '+callTo+ ' Server Internal Error'