summaryrefslogtreecommitdiffstats
path: root/For Weekly Test/tricode/initTestClass.py
diff options
context:
space:
mode:
authorgsmselftest2011-10-21 23:18:49 +0200
committergsmselftest2011-10-21 23:18:49 +0200
commit3c6204d5539f89d1b42ba3ae049af2140ad34504 (patch)
treed53d9415c5897a3081ad5289f3042905a7746044 /For Weekly Test/tricode/initTestClass.py
parentReport writing! (diff)
downloadgsm-selftest-3c6204d5539f89d1b42ba3ae049af2140ad34504.tar.gz
gsm-selftest-3c6204d5539f89d1b42ba3ae049af2140ad34504.tar.xz
gsm-selftest-3c6204d5539f89d1b42ba3ae049af2140ad34504.zip
last modification
Diffstat (limited to 'For Weekly Test/tricode/initTestClass.py')
-rwxr-xr-xFor Weekly Test/tricode/initTestClass.py70
1 files changed, 27 insertions, 43 deletions
diff --git a/For Weekly Test/tricode/initTestClass.py b/For Weekly Test/tricode/initTestClass.py
index 15a167c..73b06a7 100755
--- a/For Weekly Test/tricode/initTestClass.py
+++ b/For Weekly Test/tricode/initTestClass.py
@@ -67,10 +67,8 @@ class doTest:
#fetch device account detail from database
dest = self.db.deviceAddress(str(callTo))
caller = self.db.deviceAddress(str(callFrom))
- #self.pings(dest[4])
if self.pings(caller[4]) <> 0:
- #self.pings(caller[4])
if self.pings(dest[4]) <> 0:
@@ -108,6 +106,12 @@ class doTest:
self.db.closeDBConn()
return self.result
+ def errorCodes(self, callFrom, callTo, result):
+ self.initDB()
+ message = '|' + str(callFrom) + '|' + str(callTo) + '|' + str(result) + '|' + str(self.db.errorCode(result))
+ self.messageList.append(message)
+ self.db.closeDBConn()
+
# function to search in the list
def isThere(self, keyword,lists):
x = 0
@@ -118,6 +122,11 @@ class doTest:
else:
x = x+1
+ def testDestination(self, callFrom, callTo, tried):
+ self.initTest(callFrom,callTo)
+ self.smartResultList.append([callFrom,callTo, self.result,tried])
+ self.errorCodes(callFrom, callTo, self.result)
+
def smartTest(self):
self.initDB()
self.smartResultList = list()
@@ -149,14 +158,10 @@ class doTest:
i = random.randint(0, len(gsmRZList)-1)
callTo = gsmRZList[i]
callFrom = 'unisip'
- self.initTest(callFrom,callTo)
-
+ self.testDestination(callFrom, callTo, 2)
gsmRZList.remove(callTo)
destList.remove(callTo)
- self.smartResultList.append([callFrom, callTo, self.result, 1])
- message = '|' + str(callFrom) + '|' + str(callTo) + '|' + str(self.result) + '|' + str(self.db.errCode)
- self.messageList.append(message)
for callFrom in gsmRZList:
@@ -169,27 +174,21 @@ class doTest:
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,1])
- message = '|' + str(callFrom) + '|' + str(callTo) + '|' + str(self.result) + '|' + str(self.db.errCode)
- self.messageList.append(message)
+ self.testDestination(callFrom, callTo, 1)
+
# test incoming call from outside rz network to gsm rz
i = random.randint(0, len(gsmRZList)-1) #
callTo = gsmRZList[i]
callFrom = 'landline'
- self.initTest(callFrom,callTo)
-
if self.isThere(callTo,destList) == 1: # Checking whether caller at gsmrz list in the destination list, if yes delete it.
destList.remove(callTo)
- self.smartResultList.append([callFrom, callTo, self.result,1])
- message = '|' + str(callFrom) + '|' + str(callTo) + '|' + str(self.result) + '|' + str(self.db.errCode)
- self.messageList.append(message)
+ self.testDestination(callFrom, callTo, 1)
+
# testing from random GSM RZ to sip
#i = random.randint(0, len(cpgsmRZList)-1) #
#callFrom = cpgsmRZList[i]
@@ -199,10 +198,8 @@ class doTest:
for callTo in destList:
callFrom = 'sip'
- self.initTest(callFrom, callTo)
- self.smartResultList.append([callFrom, callTo, self.result,1])
- message = '|' + str(callFrom) + '|' + str(callTo) + '|' + str(self.result) + '|' + str(self.db.errCode)
- self.messageList.append(message)
+ self.testDestination(callFrom, callTo, 1)
+
#checking unsuccess call, to make sure that destination are really unreachable
for dest in self.smartResultList:
#check unsuccess call and did the test have already tried, 2 means has been check
@@ -215,10 +212,7 @@ class doTest:
if testDestination == True:
callFrom = 'sip'
callTo = dest[1]
- self.initTest(callFrom,callTo)
- self.smartResultList.append([callFrom,callTo, self.result,2])
- message = '|' + str(callFrom) + '|' + str(callTo) + '|' + str(self.result) + '|' + str(self.db.errCode)
- self.messageList.append(message)
+ self.testDestination(callFrom, callTo, 2)
rem.append(dest)
#check unsuccess call because caller handler having problem
@@ -230,22 +224,14 @@ class doTest:
testDestination = True
if testDestination == True:
callFrom = 'sip'
- callTo = dest[1]
- self.initTest(callFrom,callTo)
- self.smartResultList.append([callFrom,callTo, self.result,2])
- message = '|' + str(callFrom) + '|' + str(callTo) + '|' + str(self.result) + '|' + str(self.db.errCode)
- self.messageList.append(message)
- #rem.append(dest)
+ self.testDestination(callFrom, dest[1], 2)
+
caller = dest[0] # to test nanobts if the test come from RZ GSM but fehler
if caller[0:5] == 'GSMRZ' and int(dest[3]) != 2 and dest[1] != 'sip':
if int(dest[2]) == 486:
callFrom = 'sip'
- callTo = dest[1]
- self.initTest(callFrom,callTo)
- self.smartResultList.append([callFrom,callTo, self.result,2])
- message = '|' + str(callFrom) + '|' + str(callTo) + '|' + str(self.result) + '|' + str(self.db.errCode)
- self.messageList.append(message)
+ self.testDestination(callFrom, dest[0], 2)
rem.append(dest)
# test to make sure nanoBTS working or not. sice probably that nanotbts seems error but actually not.
@@ -256,6 +242,9 @@ class doTest:
if gsmrzResult[0] == RZ or gsmrzResult[1] == RZ:
if int(gsmrzResult[2]) == 486:
repeat = True
+ From = gsmrzResult[0]
+ To = gsmrzResult[1]
+ result = gsmrzResult[2]
if gsmrzResult[1] == RZ and int(gsmrzResult[2]) == 998:
cpgsmRZList.remove(RZ)
if gsmrzResult[0] == RZ and int(gsmrzResult[2]) == 999:
@@ -265,17 +254,12 @@ class doTest:
if repeat == True:
i = random.randint(0, len(cpgsmRZList)-1) #
- callTo = cpgsmRZList[i]
if i == 0:
x = i+1
else:
x = i-1
- callFrom = cpgsmRZList[x]
- self.initTest(callFrom, callTo)
- self.smartResultList.append([callFrom, callTo, self.result,2])
- message = '|' + str(callFrom) + '|' + str(callTo) + '|' + str(self.result) + '|' + str(self.db.errCode)
- self.messageList.append(message)
- item = '['+str(gsmrzResult[0])+','+str(gsmrzResult[1])+','+str(gsmrzResult[2])+','+str(1)+']'
+ self.testDestination(cpgsmRZList[x], cpgsmRZList[i], 2)
+ item = '['+str(From)+','+str(callTo)+','+str(result)+','+str(1)+']'
rem.append(item)
for remov in rem: