summaryrefslogtreecommitdiffstats
path: root/For Weekly Test/12-09-2011/initTestClass.py
diff options
context:
space:
mode:
Diffstat (limited to 'For Weekly Test/12-09-2011/initTestClass.py')
-rw-r--r--For Weekly Test/12-09-2011/initTestClass.py296
1 files changed, 45 insertions, 251 deletions
diff --git a/For Weekly Test/12-09-2011/initTestClass.py b/For Weekly Test/12-09-2011/initTestClass.py
index 8f4cbc8..8552e20 100644
--- a/For Weekly Test/12-09-2011/initTestClass.py
+++ b/For Weekly Test/12-09-2011/initTestClass.py
@@ -2,6 +2,7 @@ import sys
import ControllerClass
import DbClass
import PingClass
+import random
from time import sleep
class doTest:
@@ -31,7 +32,6 @@ class doTest:
self.serverStatus = 1
-
def initDB(self):
self.db = DbClass.DBMySQLConnection('root', 'randompasswordSQL', 'localhost', 'gsmselftesting')
@@ -94,260 +94,54 @@ class doTest:
return self.result
- def smartTest(self):
- global handlerError
-
- self.ping('sip')
- if self.serverStatus == 0:
- print "Dont have connection to SIP Asterisk server, can't make a test"
- sys.exit(1)
-
- handlerError = "incomplete test, Handler having error, please do one more test"
-
- callerList = ['sip']
- destinationList = ['SIP']
- #destinationList = ['GSMExt', 'GSMRZ', 'SIP', 'RZOutgoing', 'RZincoming']
- for callFrom in callerList:
- for destination in destinationList:
-
- if destination == 'GSMRZ':
- self.initTest(callFrom,'GSMRZ1')
- if self.result == '200':
- self.initTest(callFrom,'GSMRZ2')
- if self.result == '200':
- self.initTest(callFrom,'GSMRZ3')
- if self.result == '200':
- print "all network on GSMRZ are working"
- elif self.result == '486':
- print "BTS 3 Down"
- else:
- print handlerError
-
- elif self.result == '486':
- self.initTest(callFrom,'GSMRZ3')
- if self.result == '200':
- print "BTS 2 Down"
- elif self.result == '486':
- print "BTS 2 and 3 indicate having problem"
- else:
- print handlerError
- else:
- print handlerError
-
- elif self.result == '486':
- self.initTest(callFrom,'GSMRZ2')
- if self.result == '200':
- self.initTest(callFrom,'GSMRZ3')
- if self.result == '200':
- print "BTS 1 Down"
- elif self.result == '486':
- print "BTS 1 & 3 indicate having problem"
- else:
- print handlerError
-
- elif self.result == '486':
- self.initTest(callFrom,'GSMRZ3')
- if self.result == '200':
- print "BTS 1 & 2 indicate having problem"
- elif self.result == '486':
- print "OpenBSc Down"
- else:
- print handlerError
- else:
- print handlerError
- else:
- print handlerError
+ def isThere(keyword,lists):
+ x = 0
+ for item in lists:
-
- elif destination == 'GSMExt':
- self.initTest(callFrom,'GSMExt.O2')
- if self.result == '200':
- self.initTest(callFrom,'GSMExt.Voda')
- if self.result == '200':
- self.initTest(callFrom,'GSMExt.Eplus')
- if self.result == '200':
- self.initTest(callFrom,'GSMExt.Tm')
- if self.result == '200':
- print "All network on GSM external are working"
- elif self.result == '486':
- print "T-Mobile card indicate having problem"
- else:
- print handlerError
-
- elif self.result == '486':
- self.initTest(callFrom,'GSMExt.Tm')
- if self.result == '200':
- print "E-Plus card indicate having problem"
- elif self.result == '486':
- print "T-Mobile and E-Plus card indicate having problem"
- else:
- print handlerError
- elif self.result == '486':
- self.initTest(callFrom,'GSMExt.Eplus')
- if self.result == '200':
- self.initTest(callFrom,'GSMExt.Tm')
- if self.result == '200':
- print "Vodaphone card indicate having problem"
- elif self.result == '486':
- print "T-Mobile and Vodaphone cards indicate having problem"
- else:
- print handlerError
-
- elif self.result == '486':
- self.initTest(callFrom,'GSMExt.Tm')
- if self.result == '200':
- print "Vodaphone and E-Plus card indicate having problem"
- elif self.result == '486':
- print "T-Mobile, E-Plus and Vodaphone cards indicate having problem"
- else:
- print handlerError
- else:
- print handlerError
- else:
- print handlerError
-
- elif self.result == '486':
- self.initTest(callFrom,'GSMExt.Voda')
- if self.result == '200':
- self.initTest(callFrom,'GSMExt.Eplus')
- if self.result == '200':
- self.initTest(callFrom,'GSMExt.Tm')
- if self.result == '200':
- print "O2 card indicate having problem"
- elif self.result == '486':
- print "T-Mobile and O2 cards indicate having problem"
- else:
- print handlerError
- elif self.result == '486':
-
- self.initTest(callFrom,'GSMExt.Tm')
- if self.result == '200':
- print "O2 and E-Plus cards indicate having problem"
- elif self.result == '486':
- print "T-Mobile, E-Plus and O2 cards indicate having problem"
- else:
- print handlerError
- else:
- print handlerError
-
- elif self.result == '486':
- self.initTest(callFrom,'GSMExt.Eplus')
- if self.result == '200':
- self.initTest(callFrom,'GSMExt.Tm')
- if self.result == '200':
- print "O2 and Vodaphone cards indicate having problem"
- elif self.result == '486':
- print "T-Mobile, O2 and Vodaphone cards indicate having problem"
- else:
- print handlerError
+ if item == keyword:
+ return 1
+ else:
+ x = x+1
- elif self.result == '486':
- self.initTest(callFrom,'GSMExt.Tm')
- if self.result == '200':
- print "O2, E-Plus and Vodaphone cards indicate having problem"
- elif self.result == '486':
- print "GSM External Modem Down"
- else:
- print handlerError
- else:
- print handlerError
- else:
- print handlerError
- else:
- print handlerError
-
- elif destination == 'SIP':
+ def smartTest(self):
+ global handlerError
+ smartResultList = list()
+ testPendingList = list()
+ #callerList = ['sip']
+ destList = ['GSMRZ1','GSMRZ2','GSMRZ3','GSMExt.O2','GSMExt.Voda','GSMExt.Eplus','GSMExt.Tm']
+ gsmList = ['GSMExt.O2','GSMExt.Voda','GSMExt.Eplus','GSMExt.Tm']
+ gsmRZList = ['GSMRZ1','GSMRZ2','GSMRZ3']
+
+ i = random.randint(0, len(gsmRZList)-1)
+ callTo = gsmRZList[i]
+ self.initTest('unisip',callTo)
+ gsmRZList.remove(callTo)
+ destList.remove(callTo)
+ openBSC = self.result
+ self.smartResultList.append(['unisip', callTo, self.result])
- self.ping('landline')
- if self.serverStatus <> 0:
- self.initTest(callFrom,'landline')
- if self.result == '200':
- self.ping('unisip')
- if self.serverStatus <> 0:
- self.initTest(callFrom,'unisip')
- if self.result =='200':
- print "All SIP network are working"
- elif self.result == '486':
- print "University telephone network indicate having problem"
- else:
- print handlerError
- else:
- print "No connection to University telephone network server, check your connection"
+ if openBSC == 200:
+ for callFrom in gsmRZList:
+ i = random.randint(3, len(destList)-1) # need to check wheter the caller and dest is same
+ callTo = destList[i]
+ self.initTest(callFrom,callTo)
+ destList.remove(callTo)
+ 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)
+ 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
- elif self.result == '486':
- self.ping('unisip')
- if self.serverStatus <> 0:
- self.initTest(callFrom,'unisip')
- if self.result == '200':
- print "Landline indicate having problem"
- elif self.result == '486':
- print "SIP Network Down"
- else:
- print handlerError
- else:
- print "No connection to University telephone network server, check your connection"
- else:
- print handlerError
- else:
- print "No connection to SIP Gate server, check your connection"
-
- elif destination == 'RZOutgoing':
- self.ping('landline')
- if self.serverStatus <> 0:
- self.initTest('GSMRZ1','landline')
- if self.result == '200':
- self.ping('unisip')
- if self.serverStatus <> 0:
- self.initTest('GSMRZ1','unisip')
- if self.result =='200':
- print "Outgoing call from GSM RZ is working"
- elif self.result == '486':
- print "Outgoing call from GSM RZ to UTN indicate having problem"
- else:
- print handlerError
- else:
- print "No connection to University telephone network server, check your connection"
- elif self.result == '486':
- self.ping('unisip')
- if self.serverStatus <> 0:
- self.initTest('GSMRZ1','unisip')
- if self.result == '200':
- print "Outgoing call from GSM RZ to Landline indicate having problem"
- elif self.result == '486':
- print "Outgoing call from GSM RZ to Landline and UTN indicate having problem"
- else:
- print handlerError
- else:
- print "No connection to University telephone network server, check your connection"
- else:
- print handlerError
- else:
- print "No connection to SIP Gate server, check your connection"
-
- elif destination == 'RZincoming':
-
- self.ping('landline')
- if self.serverStatus <> 0:
- self.initTest('landline', 'GSMRZ1')
- if self.result == '486':
- self.initTest('GSMExt.O2','GSMRZ1')
- if self.result =='200':
- print "incoming call to GSM RZ working"
- elif self.result == '486':
- self.initTest('GSMExt.Voda','GSMRZ1')
- if self.result =='200':
- print "incoming call to GSM RZ working"
- elif self.result == '486':
- print "incoming call to GSM RZ notworking"
- else:
- print handlerError
- else:
- print handlerError
-
- elif self.result == '200':
- print "incoming call to GSM RZ working"
- else:
- print "No connection to SIP Gate server, check your connection"