summaryrefslogtreecommitdiffstats
path: root/For Weekly Test/Advance/initTestClass.py
diff options
context:
space:
mode:
authorTriatmoko2011-10-09 11:52:54 +0200
committerTriatmoko2011-10-09 11:52:54 +0200
commitaf65ba60fb145f87f9ca7a0da121de4a83afde72 (patch)
tree138cf65f8e2525cfb28db72e2c08eddf6b7c6ede /For Weekly Test/Advance/initTestClass.py
parentController for website (diff)
downloadgsm-selftest-af65ba60fb145f87f9ca7a0da121de4a83afde72.tar.gz
gsm-selftest-af65ba60fb145f87f9ca7a0da121de4a83afde72.tar.xz
gsm-selftest-af65ba60fb145f87f9ca7a0da121de4a83afde72.zip
fix bugs on smart test
Diffstat (limited to 'For Weekly Test/Advance/initTestClass.py')
-rw-r--r--For Weekly Test/Advance/initTestClass.py44
1 files changed, 35 insertions, 9 deletions
diff --git a/For Weekly Test/Advance/initTestClass.py b/For Weekly Test/Advance/initTestClass.py
index e7ed7f7..e48337b 100644
--- a/For Weekly Test/Advance/initTestClass.py
+++ b/For Weekly Test/Advance/initTestClass.py
@@ -9,7 +9,9 @@ from time import sleep
class doTest:
- def ping(self,handler):
+ def ping(self,handler): # function to check connection to the device
+
+
if handler == 'landline':
server = PingClass.Ping('sipgate.de')
@@ -33,6 +35,10 @@ class doTest:
else:
self.serverStatus = 1
+ def pings(self,IP):
+ self.serverStatus = None
+ server = PingClass.Ping(IP)
+ self.serverStatus = server.ping(2)
def initDB(self):
@@ -76,17 +82,25 @@ class doTest:
def initTest(self, callFrom, callTo):
- self.initDB()
+ self.initDB() # open database connection
- if self.dbStatus != 0:
+ if self.dbStatus != 0: # if connection to db establish, do the test
+
+ #fetch device account detail from database
+ dest = self.db.deviceAddress(str(callTo))
+ caller = self.db.deviceAddress(str(callFrom))
+ self.pings(dest[4])
- self.ping(callFrom)
+ #self.ping(callFrom) # check connection to the device,
if self.serverStatus <> 0:
- self.ping(callTo)
+ #self.ping(callTo)
+ self.pings(caller[4])
+
if self.serverStatus <> 0:
- dest = self.db.deviceAddress(str(callTo))
- caller = self.db.deviceAddress(str(callFrom))
+ #fetch device account detail from database
+ #dest = self.db.deviceAddress(str(callTo))
+ #caller = self.db.deviceAddress(str(callFrom))
self.initaccount(caller,callFrom)
if self.status == 1:
@@ -107,6 +121,7 @@ class doTest:
else:
self.result = 100
self.killProc() # kill all the handler
+ self.db.closeDBConn()
#sleep(5)
else:
self.result = 500
@@ -135,6 +150,7 @@ class doTest:
gsmRZList = list()
sipList = list()
destList = list()
+ self.db.closeDBConn()
for lists in deviceLists: #define category of the device
device = lists[0]
@@ -159,22 +175,32 @@ class doTest:
if openBSC == 200:
for callFrom in gsmRZList:
- i = random.randint(3, len(destList)-1) # need to check whether the caller and dest are same
+ i = random.randint(0, len(destList)-1) #Check whether the caller and dest are same
callTo = destList[i]
+ if callFrom == callTo: #Check whether the caller and dest are same
+ if i == 0:
+ i = i+1
+ else:
+ i = i-1
+ callTo = destList[i]
+
self.initTest(callFrom,callTo)
destList.remove(callTo)
+ destList.remove(callFrom)
+ gsmRZList.remove(callFrom)
self.smartResultList.append([callFrom, callTo, self.result])
i = random.randint(0, len(gsmRZList)-1) #
callTo = gsmRZList[i]
self.initTest('landline',callTo)
gsmRZList.remove(callTo)
- destList.remove(callTo)
+ #destList.remove(callTo)
self.smartResultList.append(['landline', callTo, self.result])
for callTo in destList:
callFrom = 'sip'
self.initTest(callFrom,callTo)
+
self.smartResultList.append([callFrom, callTo, self.result])
return self.smartResultList