summaryrefslogtreecommitdiffstats
path: root/For Weekly Test
diff options
context:
space:
mode:
authorTriatmoko2011-08-01 23:24:00 +0200
committerTriatmoko2011-08-01 23:24:00 +0200
commita22e0028f6bb2a856fd7c2ea433b8a4124b26c56 (patch)
treeeaba55e02ff53bf06d1a586ace311b25ff0c8036 /For Weekly Test
parentadd new file for agustus. this test include truetable to indicate which part ... (diff)
downloadgsm-selftest-a22e0028f6bb2a856fd7c2ea433b8a4124b26c56.tar.gz
gsm-selftest-a22e0028f6bb2a856fd7c2ea433b8a4124b26c56.tar.xz
gsm-selftest-a22e0028f6bb2a856fd7c2ea433b8a4124b26c56.zip
test file. not yet tested.
Diffstat (limited to 'For Weekly Test')
-rw-r--r--For Weekly Test/19-08-2011/.DS_Storebin0 -> 6148 bytes
-rw-r--r--For Weekly Test/19-08-2011/TrueTable.py3
-rw-r--r--For Weekly Test/19-08-2011/TrueTable2.py72
-rw-r--r--For Weekly Test/19-08-2011/gsmselftest1.py642
4 files changed, 688 insertions, 29 deletions
diff --git a/For Weekly Test/19-08-2011/.DS_Store b/For Weekly Test/19-08-2011/.DS_Store
new file mode 100644
index 0000000..5008ddf
--- /dev/null
+++ b/For Weekly Test/19-08-2011/.DS_Store
Binary files differ
diff --git a/For Weekly Test/19-08-2011/TrueTable.py b/For Weekly Test/19-08-2011/TrueTable.py
index d47da64..6c32b78 100644
--- a/For Weekly Test/19-08-2011/TrueTable.py
+++ b/For Weekly Test/19-08-2011/TrueTable.py
@@ -8,7 +8,8 @@ resultsList = [['sip', 'GSMExt.O2', '486'],['sip', 'GSMExt.Voda', '486'],['sip',
callerList = ['sip']
def initTrueTable(caller):
-
+
+ callerList = ['sip']
for x in resultsList:
caller = x[0]
destination = x[1]
diff --git a/For Weekly Test/19-08-2011/TrueTable2.py b/For Weekly Test/19-08-2011/TrueTable2.py
index 808cfc4..31652a8 100644
--- a/For Weekly Test/19-08-2011/TrueTable2.py
+++ b/For Weekly Test/19-08-2011/TrueTable2.py
@@ -1,6 +1,6 @@
# 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']]
@@ -29,7 +29,7 @@ def initTest(callFrom,callTo):
initDB()
if dbStatus != 0:
-
+
dest = db.deviceAddress(str(callTo))
caller = db.deviceAddress(str(callFrom))
@@ -40,14 +40,18 @@ def initTest(callFrom,callTo):
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:
@@ -65,25 +69,32 @@ def smartTest():
if result == '200':
print "all netwrok on GSMRZ are fine"
- else:
+ elif result == '486':
print "BTS 3 Down"
-
- else:
+ 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"
- else:
+ elif result == '486':
print "BTS 2 and 3 indicate having problem"
-
- if result != '200':
+ 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:
@@ -91,60 +102,65 @@ def smartTest():
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')
@@ -157,7 +173,7 @@ def smartTest():
print "All SIP network is fine"
else:
print "UNISIP indicate having problem"
-
+
else:
print "making a call to UNISIP"
initTest('sip','unisip')
diff --git a/For Weekly Test/19-08-2011/gsmselftest1.py b/For Weekly Test/19-08-2011/gsmselftest1.py
new file mode 100644
index 0000000..ec69a6f
--- /dev/null
+++ b/For Weekly Test/19-08-2011/gsmselftest1.py
@@ -0,0 +1,642 @@
+#! /usr/bin/env python
+import sys
+import ControllerClass
+import DbClass
+import PingClass
+from time import sleep
+
+def ping(handler):
+
+ global serverStatus
+
+ if handler == 'landline':
+ server = PingClass.Ping('sipgate.de')
+ serverStatus = server.ping(1)
+
+ elif handler == 'sip':
+ server = PingClass.Ping('132.230.4.8')
+ serverStatus = server.ping(1)
+
+ elif handler == 'unisip':
+ server = PingClass.Ping('132.230.252.228')
+ serverStatus = server.ping(1)
+
+ elif handler == 'gsmr1':
+ server = PingClass.Ping('localhost')
+ serverStatus = server.ping(1)
+
+ elif handler == 'gsmr2':
+ server = PingClass.Ping('132.230.4.64')
+ serverStatus = server.ping(1)
+ else:
+ serverStatus = 1
+
+def allPing():
+
+ global sipGate
+ global sipServer
+ global sipLoc
+ global gsmBox1
+ global gsmBox2
+
+ server = PingClass.Ping('sipgate.de')
+ sipGate = server.ping(3)
+
+ server = PingClass.Ping('132.230.4.8')
+ sipServer = server.ping(3)
+
+ server = PingClass.Ping('132.230.252.228')
+ sipLoc = server.ping(3)
+
+ server = PingClass.Ping('localhost')
+ gsmBox1 = server.ping(3)
+
+ server = PingClass.Ping('132.230.4.64')
+ gsmBox2 = server.ping(3)
+
+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
+ global repeatTest
+
+ 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
+ repeatTest = makeTest.repeatTest
+
+ else:
+ print "No connection to Database"
+
+ return result
+
+def initTrueTable(caller):
+
+ for x in resultsList:
+ caller = x[0]
+ destination = x[1]
+ result = x[2]
+
+ if caller == x[0]:
+
+ if destination == 'GSMRZ1' and
+ if result =='486':
+
+ for y in resultsList:
+ destination = y[1]
+ result = y[2]
+
+ if caller == y[0]:
+ if destination == 'GSMRZ2':
+ if result == '200':
+
+ for z in resultsList:
+
+ destination = z[1]
+ result = z[2]
+
+ if caller == z[0]:
+ if destination == 'GSMRZ3':
+
+ if result == '200':
+ print "BTS RZ 1 Broken"
+ elif == '486':
+ print "BTS RZ 1 & 3 indicate having Problem"
+ else:
+ print "incomplete test, Handler having error, please do one more test"
+
+ elif destination == '486':
+
+ for z in resultsList:
+
+ destination = z[1]
+ result = z[2]
+
+ if caller == z[0]:
+ if destination == 'GSMRZ3':
+
+ if result == '200':
+ print "BTS RZ 1 & 2 indicate having Problem"
+ elif result ='486':
+ print "OpenBSc Down"
+ else:
+ print "incomplete test, Handler having error, please do one more test"
+ else:
+ print "incomplete test, Handler having error, please do one more test"
+
+ elif result =='200':
+
+ for y in resultsList:
+
+ destination = y[1]
+ result = y[2]
+
+ if caller == y[0]:
+ if destination == 'GSMRZ2':
+ if result == '200':
+
+ for z in resultsList:
+
+ destination = z[1]
+ result = z[2]
+
+ if caller == z[0]:
+ if destination == 'GSMRZ3':
+
+ if result != '200':
+ print "BTS RZ 3 Broken"
+ else:
+ print "All is Fine"
+ elif result == '486':
+
+ for z in resultsList:
+
+ destination = z[1]
+ result = z[2]
+
+ if caller == z[0]:
+ if destination == 'GSMRZ3':
+
+ if result == '200':
+ print "BTS RZ 2 Broken"
+ elif result == '486':
+ print "BTS RZ 2 & 3 indicate having Problem"
+ else:
+ print "incomplete test, Handler having error, please do one more test"
+ else:
+ print "incomplete test, Handler having error, please do one more test"
+
+ else:
+ print "incomplete test, Handler having error, please do one more test"
+
+ elif destination == 'GSMExt.O2':
+ if result == '486':
+ for y in resultsList:
+
+ destination = y[1]
+ result = y[2]
+
+ if caller == y[0]:
+ if destination == 'GSMExt.Voda':
+ if result == '200':
+
+ for z in resultsList:
+
+ destination = z[1]
+ result = z[2]
+
+ if caller == z[0]:
+ if destination == 'GSMExt.Tm':
+
+ if result != '200':
+ print "O2 & T-Mobile indicate having Problem"
+ else:
+ print "O2 indicate broken"
+
+ else:
+ for z in resultsList:
+
+ destination = z[1]
+ result = z[2]
+
+ if caller == z[0]:
+ if destination == 'GSMExt.Tm':
+
+ if result == '200':
+ print "O2 and Vodaphone indicate having problem"
+ else:
+ print "GSM External Modem broken"
+ elif result == '200':
+ for y in resultsList:
+
+ destination = y[1]
+ result = y[2]
+
+ if caller == y[0]:
+ if destination == 'GSMExt.Voda':
+ if result == '200':
+
+ for z in resultsList:
+
+ destination = z[1]
+ result = z[2]
+
+ if caller == z[0]:
+ if destination == 'GSMExt.Tm':
+
+ if result == '200':
+ print "GSM external modem is Fine"
+ elif result == '486':
+ print "T-Mobile indicate broken"
+ else:
+ print "incomplete test, Handler having error, please do one more test"
+ elif result == '486':
+ for z in resultsList:
+
+ destination = z[1]
+ result = z[2]
+
+ if caller == z[0]:
+ if destination == 'GSMExt.Tm':
+
+ if result == '200':
+ print "Vodaphone indicate broken"
+ elif result == '486':
+ print "Vodaphone and T-Mobile indicate having problem"
+ else:
+ print "incomplete test, Handler having error, please do one more test"
+ else:
+ print "incomplete test, Handler having error, please do one more test"
+ else:
+ print "incomplete test, Handler having error, please do one more test"
+
+
+def doTest(callFrom,callTo):
+
+ global resultList
+ print '\n'
+ resultsList = list()
+
+ testRepeat = None
+ ping(callFrom)
+
+ if serverStatus <> 0 and dbStatus == 1:
+
+ ping(callTo)
+ if serverStatus <> 0:
+ initTest(callFrom,callTo)
+ resultList.append([callTo, callFrom, result])
+ db.errorCode(result)
+ print 'Result : ' +str(result)+ ' ' +db.errCode
+ sleep(5)
+ else:
+ print '[failed] 500 '+callTo+ ' Server Internal Error'
+ else:
+ print '[failed] 500 '+callFrom+ ' Server Internal Error'
+
+def doSipTest():
+
+ print '--SIP Part Test--'
+ #destList = ['sip', 'gsmr1','gsmr2', 'gsmr3', 'landline', 'unisip', 'gsmeO', 'gsmeV', 'gsmeT', 'gsmeE']
+ destList = ['landline']
+ for callTo in destList:
+
+ callFrom = 'sip'
+ if callFrom <> callTo:
+ doTest(callFrom, callTo)
+ if repeatTest == True:
+ doTest(callTo,callFrom)
+
+def doLandlineTest():
+
+ print '--Landline Part Test--'
+ destList = ['gsmr1', 'gsmr2', 'gsmr3', 'sip']
+
+ for callTo in destList:
+
+ callFrom = 'landline'
+ doTest(callFrom, callTo)
+ if repeatTest == True:
+ doTest(callTo,callFrom)
+
+def doGsmrzTest():
+
+ print '--GSM Part Test--'
+ destList = ['sip', 'gsmr1','gsmr2', 'gsmr3', 'landline', 'unisip', 'gsmeO', 'gsmeV', 'gsmeT', 'gsmeE']
+ callList = ['gsmr1','gsmr2', 'gsmr3']
+
+ for callFrom in callList:
+
+ for callTo in destList:
+ if callTo <> callFrom:
+ doTest(callFrom, callTo)
+ if repeatTest == True:
+ doTest(callTo,callFrom)
+
+ doGsmExtTest()
+
+def doGsmExtTest():
+
+ destList = ['sip', 'gsmr1','gsmr2', 'gsmr3']
+ callList = ['gsmeO', 'gsmeV', 'gsmeT', 'gsmeE']
+
+ for callFrom in callList:
+ for callTo in destList:
+
+ doTest(callFrom, callTo)
+ if repeatTest == True:
+ doTest(callTo,callFrom)
+
+def doAllTest():
+
+ doSipTest()
+ doLandlineTest()
+ doGsmTest()
+
+def smartTest():
+ callerList = ['sip']
+ 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 "incomplete test, Handler having error, please do one more test"
+ else:
+ print "incomplete test, Handler having error, please do one more test"
+
+ 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"
+ elif result == '486':
+ print "BTS 1 & 3 indicate having problem"
+ else:
+ print "incomplete test, Handler having error, please do one more test"
+
+ elif result == '486':
+ print "make a call to GSMRZ3"
+
+ if result == '200':
+ print "BTS 1 & 2 indicate having problem"
+ elif result == '486':
+ print "OpenBSc Down"
+ else:
+ print "incomplete test, Handler having error, please do one more test"
+ else:
+ print "incomplete test, Handler having error, please do one more test"
+ else:
+ print "incomplete test, Handler having error, please do one more test"
+
+
+
+
+ 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"
+ elif result == '486':
+ print "T-Mobile card indicate having problem"
+ else:
+ print "incomplete test, Handler having error, please do one more test"
+
+ elif result == '486':
+ print "make a call to T-Mobile"
+ initTest('sip','GSMExt.Tm')
+
+ if result == '200':
+ print "Vodaphone card indicate having problem"
+ elif result == '486':
+ print "Vodaphone and T-Mobile card indicate having problem"
+ else:
+ print "incomplete test, Handler having error, please do one more test"
+
+ if result == '486':
+ 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"
+ elif result == '486':
+ print "O2 and T-Mobile card indicate having problem"
+
+ elif result == '486':
+ print "make a call to T-Mobile"
+ initTest('sip','GSMExt.Tm')
+
+ if result == '200':
+ print "O2 and Vodaphone card indicate having problem"
+ elif result == '486':
+ print "GSM External Modem Down"
+ else:
+ print "incomplete test, Handler having error, please do one more test"
+ else:
+ print "incomplete test, Handler having error, please do one more test"
+ else:
+ print "incomplete test, Handler having error, please do one more test"
+
+ 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"
+ elif result == '486':
+ print "UNISIP indicate having problem"
+ else:
+ print "incomplete test, Handler having error, please do one more test"
+
+ elif result == '486':
+ print "making a call to UNISIP"
+ initTest('sip','unisip')
+
+ if result == '200':
+ print "Landline indicate having problem"
+ elif result == '486':
+ print "SIP Network Down"
+ else:
+ print "incomplete test, Handler having error, please do one more test"
+ else:
+ print "incomplete test, Handler having error, please do one more test"
+
+if len(sys.argv) > 1:
+
+ command = sys.argv[1]
+ print '\n'
+
+ if command == '--all':
+ doAllTest()
+
+ elif command == '--sip':
+ doSipTest()
+
+ elif command == '--gsm':
+ doGsmTest()
+
+ elif command == '--landline':
+ doLandlineTest()
+
+ elif command == '-- smart':
+ smartTest()
+
+ elif command == '--help':
+ file = open('help.txt', 'r')
+ print file.read()
+
+ else:
+ print "command not found, Type '--help', '--credits' for more information."
+ print '\n'
+else:
+ global resultList
+ print '\n'
+ resultsList = list()
+
+ if dbStatus == 1:
+
+ if db.anyTasksToDo() == 1:
+
+ #allPing()
+ i=0
+ for item in db.tasksList:
+ print item
+ taskID = item[0]
+ taskNo = item[1]
+ callFrom = item[2]
+ callTo = item[3]
+ tried = item[4]
+
+
+ #if i == 0:
+ # db.updatePingResult(taskNo, sipServer, sipGate, sipLoc, gsmBox1, gsmBox2)
+ print '\n'
+ print 'Task ID :', taskID
+ print 'Calling From :', callFrom
+ print 'To :', callTo
+ print 'number :', destNo
+ print 'status :', tried
+
+ ping(callFrom)
+
+ if serverStatus <> 0:
+
+ ping(callTo)
+ if serverStatus <> 0:
+
+ initTest(callFrom,callTo)
+
+ db.addResult(taskID, result)
+ resultList.append([callTo, callFrom, result])
+
+ if repeatTest == True and tried <> '1':
+ db.insertTaskIn2(callTo,callFrom,taskNo, '1')
+
+ db.errorCode(result)
+ print 'Result : ' +str(result)+ ' ' +db.errCode
+
+ db.deleteTempTask(taskID)
+ db.tasksList.remove(item)
+ db.tasksList.insert(i,'')
+
+ i = i+1
+
+ sleep(5)
+
+ else:
+ db.addResult(taskID, '500')
+ print '[failed] 500 '+callTo+ ' Server Internal Error'
+ else:
+ db.addResult(taskID, '500')
+ print '[failed] 500 '+callFrom+' Server Internal Error'
+ db.cleanTasksList()
+
+ # fetch result list and make adjustment about the result
+ callerList = ['sip']
+ for caller in callerList:
+ initTrueTable(caller)
+ else:
+ print "No job at all"
+ else:
+ sys.exit(1)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+