summaryrefslogtreecommitdiffstats
path: root/For Weekly Test/12-09-2011
diff options
context:
space:
mode:
authortt412011-09-06 20:33:53 +0200
committertt412011-09-06 20:33:53 +0200
commitc09d3153d10894331a7296540d7ed2bfed4686bb (patch)
tree8027c8b2be38aab7d726e84e5dd9870f6b445b78 /For Weekly Test/12-09-2011
parentAdded new CSS for the result table inside of mutex page! (diff)
downloadgsm-selftest-c09d3153d10894331a7296540d7ed2bfed4686bb.tar.gz
gsm-selftest-c09d3153d10894331a7296540d7ed2bfed4686bb.tar.xz
gsm-selftest-c09d3153d10894331a7296540d7ed2bfed4686bb.zip
add new feature. for manual configuration mobile devices.
Diffstat (limited to 'For Weekly Test/12-09-2011')
-rw-r--r--For Weekly Test/12-09-2011/ControllerClass.pycbin7701 -> 7357 bytes
-rw-r--r--For Weekly Test/12-09-2011/gsmselftest1.py3
-rw-r--r--For Weekly Test/12-09-2011/gsmselftest2.py369
-rw-r--r--For Weekly Test/12-09-2011/initTestClass.pycbin7794 -> 7802 bytes
4 files changed, 370 insertions, 2 deletions
diff --git a/For Weekly Test/12-09-2011/ControllerClass.pyc b/For Weekly Test/12-09-2011/ControllerClass.pyc
index c82c11c..42a681a 100644
--- a/For Weekly Test/12-09-2011/ControllerClass.pyc
+++ b/For Weekly Test/12-09-2011/ControllerClass.pyc
Binary files differ
diff --git a/For Weekly Test/12-09-2011/gsmselftest1.py b/For Weekly Test/12-09-2011/gsmselftest1.py
index 81d23cf..59d7bf0 100644
--- a/For Weekly Test/12-09-2011/gsmselftest1.py
+++ b/For Weekly Test/12-09-2011/gsmselftest1.py
@@ -167,8 +167,7 @@ def updateDevice():
while True:
print "Mobile device configuration"
- print "Menu: s = start device configuration, q = quit"
-
+ print "Menu: s = start device configuration, q = quit : ",
input = sys.stdin.readline().rstrip("\r\n")
print ''
if input == 's':
diff --git a/For Weekly Test/12-09-2011/gsmselftest2.py b/For Weekly Test/12-09-2011/gsmselftest2.py
new file mode 100644
index 0000000..3ba94d3
--- /dev/null
+++ b/For Weekly Test/12-09-2011/gsmselftest2.py
@@ -0,0 +1,369 @@
+#! /usr/bin/env python
+from serial import * #serial port library
+import sys
+import ControllerClass
+import DbClass
+import PingClass
+import trueTableClass
+import initTestClass
+import usbDetectClass
+from time import sleep
+
+global resultsList
+resultsList = list()
+
+GSMListPrefix = [['GSMExt.Tm','0151'],['GSMExt.Tm','0160'],['GSMExt.Tm','0170'],['GSMExt.Tm','0171'],['GSMExt.Tm','0175'],['GSMExt.Voda','0152'],['GSMExt.Voda','0162'],['GSMExt.Voda','0172'],['GSMExt.Voda','0173'],['GSMExt.Voda','0174'],['GSMExt.Eplus','0157'],['GSMExt.Eplus','0177'],['GSMExt.Eplus','0155'],['GSMExt.Eplus','0163'],['GSMExt.Eplus','0178'],['GSMExt.O2','0159'],['GSMExt.O2','0176'],['GSMExt.O2','0179']]
+
+
+def allPing():
+
+ global sipGate
+ global sipServer
+ global unisip
+ global gsmBox1
+ global gsmBox2
+
+ server = PingClass.Ping('sipgate.de')
+ sipGate = server.ping(1)
+
+ server = PingClass.Ping('132.230.4.8')
+ sipServer = server.ping(1)
+
+ server = PingClass.Ping('132.230.252.228')
+ unisip = server.ping(1)
+
+ server = PingClass.Ping('localhost')
+ gsmBox1 = server.ping(1)
+
+ server = PingClass.Ping('10.4.58.241')
+ gsmBox2 = server.ping(1)
+
+def initDB():
+ global dbStatus
+ global db
+
+ db = DbClass.DBMySQLConnection('root', 'randompasswordSQL', 'localhost', 'gsmselftesting')
+ db.connectDB()
+ dbStatus = db.connectDB()
+
+
+def initTrueTable():
+ initResult = trueTableClass.trueTable(resultsList)
+ initResult.initTrueTable()
+
+ if initResult.o2Card == False and initResult.eplusCard == False and initResult.vodaCard == False and initResult.tmobileCard == False:
+ print 'GSM BOX Modem down'
+ else:
+ if initResult.o2Card == False:
+ print "O2 card indicate having problem"
+ if initResult.eplusCard == False:
+ print "eplus card indicate having problem"
+ if initResult.vodaCard == False:
+ print "vodaphone card indicate having problem"
+ if initResult.tmobileCard == False:
+ print "T-Mobile card indicate having problem"
+ print '\n'
+
+ if initResult.nanoBTS1 == False and initResult.nanoBTS2 == False and initResult.nanoBTS3 == False:
+ print 'openBSC down'
+ else:
+ if initResult.nanoBTS1 == False:
+ print "nanoBTS 1 indicate having problem"
+ if initResult.nanoBTS2 == False:
+ print "nanoBTS 2 indicate having problem"
+ if initResult.nanoBTS3 == False:
+ print "nanoBTS 3 indicate having problem"
+
+ if initResult.outgoingLandline == False:
+ print 'outgoing from GSM RZ to landline having problem'
+ print '\n'
+
+ if initResult.asteriskServer == False:
+ print "Asterisk server indicate having problem"
+ elif initResult.asteriskServer == True:
+ print 'Asterisk server working good'
+ print '\n'
+
+def doSipTest():
+
+ destList = ['gsmr1','gsmr2', 'gsmr3', 'landline', 'unisip', 'GSMExt.O2', 'GSMExt.Voda', 'GSMExt.Eplus', 'GSMExt.Tm' ]
+ doTest = initTestClass.doTheTest()
+ for callTo in destList:
+
+ callFrom = 'sip'
+ doTest.initTest(callFrom,callTo)
+ resultsList.append([callFrom, callTo, doTest.result])
+
+def doLandlineTest():
+
+ destList = ['GSMRZ1','unisip', 'sip']
+ doTest = initTestClass.doTheTest()
+ for callTo in destList:
+
+ callFrom = 'landline'
+ doTest.initTest(callFrom,callTo)
+ resultsList.append([callFrom, callTo, doTest.result])
+ initTrueTable()
+
+def doGsmrzTest():
+
+ destList = ['GSMRZ1','GSMRZ2', 'GSMRZ3']
+ callList = ['sip']
+ doTest = initTestClass.doTheTest()
+
+ for callFrom in callList:
+
+ for callTo in destList:
+ doTest.initTest(callFrom,callTo)
+ resultsList.append([callFrom, callTo, doTest.result])
+ initTrueTable()
+
+def doGsmExtTest():
+
+ destList = ['GSMExt.O2', 'GSMExt.Voda', 'GSMExt.Eplus', 'GSMExt.Tm']
+ callList = ['sip']
+
+ doTest = initTestClass.doTheTest()
+
+ for callFrom in callList:
+ for callTo in destList:
+ doTest.initTest(callFrom,callTo)
+ resultsList.append([callFrom, callTo, doTest.result])
+ initTrueTable()
+
+def doAllTest():
+
+ doSipTest()
+ doLandlineTest()
+ doGsmrzTest()
+ doGsmExtTest()
+
+def regularTest():
+ regulartest = initTestClass.doTheTest()
+ regulartest.smartTest()
+
+def findPort(portName):
+ global connect
+ global prefix
+ global num
+ global IMEI
+ global portClass
+ sleep(0.5)
+ portLog = os.popen('dmesg | grep \'pl2303 converter now attached to '+portName+'\'').read()
+ sleep(0.5)
+ if portLog != '':
+ connect = 1
+ portClass = usbDetectClass.serialPort(portName)
+ portClass.findNumber()
+ portClass.findIMEI()
+ IMEI = portClass.IMEI
+ num = portClass.number
+ number = portClass.number
+ prefix = number[0:4]
+ else:
+ connect = 0
+
+def initDevice(deviceName):
+ print 'Device Name :',deviceName
+ print ' Device IMEI : ',
+ imei = sys.stdin.readline().rstrip("\r\n")
+ print 'Phone number : ',
+ number = sys.stdin.readline().rstrip("\r\n")
+ print 'Port Name : /dev/',
+ portName = sys.stdin.readline().rstrip("\r\n")
+ print ''
+
+ if deviceName == 'GSMRZ2' or deviceName == 'GSMRZ2':
+ if number =='':
+ print print ' == cant save device configuration, number missing =='
+ else:
+ portClass.initUpdate(deviceName, portName, number)
+ else:
+ if imei == '' or portName == '':
+ print ' == cant save device configuration, please fill IMEI / port name of the device =='
+ else:
+ findPort(portName)
+ if connect == 1:
+ if str(IMEI) != str(imei) and str(num) != str(number):
+ print '== error, device not found =='
+ elif str(IMEI) == str(imei):
+ portClass.initUpdate(deviceName, portName, number)
+ print '== Device succeced added =='
+ elif str(num) == str(number) and str(IMEI) != str(imei):
+ portClass.initUpdate(deviceName, portName, number)
+ print '== Device succeced added, but have different IMEI =='
+ else:
+ print '== error, no device connected =='
+
+
+def updateDevice():
+ quit = False
+ while quit != True:
+ print ''
+ print "Mobile device configuration"
+ print "Menu: s = automatic device configuration, m = Manual configuration, q = quit : ",
+ input = sys.stdin.readline().rstrip("\r\n")
+ print ''
+ if input == 'm':
+
+ while True:
+ print ''
+ print "Mobile device name: "
+ print " 1. GSM O2"
+ print " 2. GSM Vodafone"
+ print " 3. GSM Eplus"
+ print " 4. GSM T-Mobile"
+ print " 5. GSM RZ 1"
+ print " 6. GSM RZ 2"
+ print " 7. GSM RZ 3"
+ print " 8. Back to menu"
+ print ""
+ print "you choise : ",
+ input = sys.stdin.readline().rstrip("\r\n")
+
+ if input == '8':
+ break
+ elif input == '1':
+ initDevice('GSMExt.O2')
+ elif input == '2':
+ initDevice('GSMExt.Voda')
+ elif input == '3':
+ initDevice('GSMExt.Eplus')
+ elif input == '4':
+ initDevice('GSMExt.Tm')
+ elif input == '5':
+ initDevice('GSMRZ1')
+ elif input == '6':
+ initDevice('GSMRZ2')
+ elif input == '7':
+ initDevice('GSMRZ3')
+ else:
+ print 'please choose between 1-8'
+ if input == 's':
+ i = 0
+ while i !=10:
+ portName ='ttyUSB'+str(i)
+ findPort(portName)
+ i=i+1
+ if connect == 1:
+ for listNum in GSMListPrefix:
+ if prefix == listNum[1]:
+ print 'Device Name :',listNum[0]
+ print 'IMEI :',IMEI
+ print 'Phone Number :',num
+ print 'Port Name : /dev/'+portName
+
+ newPortName = '/dev/'+portName
+ portClass.initUpdate(listNum[0], newPortName, num)
+ print '\n'
+
+
+
+ if input == "q":
+ break
+ sys.exit()
+
+if len(sys.argv) > 1:
+
+ command = sys.argv[1]
+ print ' '
+
+ if command == '--all':
+ doAllTest()
+
+ elif command == '--sip':
+ doSipTest()
+
+ elif command == '--gsmrz':
+ doGsmrzTest()
+
+ elif command == '--gsmext':
+ doGsmExtTest()
+
+ elif command == '--landline':
+ doLandlineTest()
+
+ elif command == '--smart':
+ regularTest()
+
+ elif command == '--devconf':
+ updateDevice()
+
+ 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:
+
+ initDB()
+ if dbStatus == 1:
+
+ if db.anyTasksToDo() == 1:
+
+ #allPing()
+ i=0
+ makeTest = initTestClass.doTheTest()
+ for item in db.tasksList:
+
+ taskID = item[0]
+ taskNo = item[1]
+ callFrom = item[2]
+ callTo = item[3]
+
+ #if i == 0:
+ #db.updatePingResult(taskNo, sipServer, sipGate, unisip, gsmBox1, gsmBox2)
+ print '\n'
+ print 'Task ID :', taskID
+ print 'Calling From :', callFrom
+ print 'To :', callTo
+
+
+ makeTest.initTest(callFrom,callTo)
+
+ db.addResult(taskID, makeTest.result)
+
+ resultsList.append([callFrom, callTo, makeTest.result])
+
+ db.errorCode(makeTest.result)
+ print 'Result : ' +makeTest.result+ ' ' +db.errCode
+
+ db.deleteTempTask(taskID)
+ i = i+1
+
+ db.cleanTasksList()
+
+
+ print '\n'
+ initTrueTable() # fetch result list and make adjustment about the result
+ else:
+ print "--- No job at all ---"
+ else:
+ sys.exit(1)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/For Weekly Test/12-09-2011/initTestClass.pyc b/For Weekly Test/12-09-2011/initTestClass.pyc
index 38b537f..ec36c0b 100644
--- a/For Weekly Test/12-09-2011/initTestClass.pyc
+++ b/For Weekly Test/12-09-2011/initTestClass.pyc
Binary files differ