# check signal on rz 1, 2, and 3 to indicated test # only have option destination to GSM RZ, such as SIP to GSM RZ not SIP to GSM RZ 1, 2 or 3! # if the result is not 200 or 486, do one more test. because its means we have problem with handler. waiting 5 second and do the test. #resultsList = list() #resultsList = [['sip', 'GSMRZ1', '200'],['sip', 'GSMRZ2', '200'],['sip', 'GSMRZ3', '200']] resultsList = [['sip', 'GSMExt.O2', '486'],['sip', 'GSMExt.Voda', '486'],['sip', 'GSMExt.Tm', '486']] callerList = ['sip'] destinationList = ['GSMRZ'] def initDB(): global dbStatus global db db = DbClass.DBMySQLConnection('root', 'randompasswordSQL', 'localhost', 'gsmselftesting') db.connectDB() dbStatus = db.connectDB() def initTest(callFrom,callTo): global dest global caller global callAdd global accCaller global recAdd global destNo global accDest global result initDB() if dbStatus != 0: dest = db.deviceAddress(str(callTo)) 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]+':' makeTest = ControllerClass.test(caller, callAdd, accCaller, callTo, recAdd, destNo, accDest) makeTest.FuncTest() result = makeTest.testResult else: print "No connection to Database" return result def smartTest(): for callFrom in callerList: for destination in destinationList: if destination == 'GSMRZ': print "make a call to GSMRZ1" initTest('sip','GSMRZ1') if result == '200': print "make a call to GSMRZ2" initTest('sip','GSMRZ2') if result == '200': print "make a call to GSMRZ3" initTest('sip','GSMRZ3') if result == '200': print "all netwrok on GSMRZ are fine" elif result == '486': print "BTS 3 Down" else: print "have problem with handler" elif result == '486': print "make a call to GSMRZ3" initTest('sip','GSMRZ3') if result == '200': print "BTS 2 Down" elif result == '486': print "BTS 2 and 3 indicate having problem" else: print "have problem with handler" else: print "have problem with handler" elif result == '486': print "make a call to GSMRZ2" initTest('sip','GSMRZ2') if result == '200': print "make a call to GSMRZ3" initTest('sip','GSMRZ3') if result == '200': print "BTS 1 Down" else: print "BTS 1 & 3 indicate having problem" else: print "make a call to GSMRZ3" if result == '200': print "BTS 1 & 2 indicate having problem" else: print "OpenBSc Down" else: print "have problem with handler" elif destination == 'GSMExt': print "make a call to O2" initTest('sip','GSMExt.O2') if result == '200': print "make a call to Voda" initTest('sip','GSMExt.Voda') if result == '200': print "make a call to T-Mobile" initTest('sip','GSMExt.Tm') if result == '200': print "All netwrok on GSM external are fine" else: print "T-Mobile card indicate having problem" else: print "make a call to T-Mobile" initTest('sip','GSMExt.Tm') if result == '200': print "Vodaphone card indicate having problem" else: print "Vodaphone and T-Mobile card indicate having problem" if result != '200': print "make a call to Vodaphone" initTest('sip','GSMExt.Voda') if result == '200': print "make a call to T-Mobile" initTest('sip','GSMExt.Tm') if result == '200': print "O2 card indicate having problem" else: print "O2 and T-Mobile card indicate having problem" else: print "make a call to T-Mobile" initTest('sip','GSMExt.Tm') if result == '200': print "O2 and Vodaphone card indicate having problem" else: print "GSM External Modem Down" elif destination == 'SIP': print "make a call to Landline" initTest('sip','Landline') if result == '200': print "make a call to UNISIP" initTest('sip','unisip') if result =='200': print "All SIP network is fine" else: print "UNISIP indicate having problem" else: print "making a call to UNISIP" initTest('sip','unisip') if result == '200': print "Landline indicate having problem" else: print "SIP Network Down" for caller in callerList: smartTest()