summaryrefslogtreecommitdiffstats
path: root/For Weekly Test/tricode/gsmselftest-website2.py
diff options
context:
space:
mode:
authorTriatmoko2011-10-23 15:08:32 +0200
committerTriatmoko2011-10-23 15:08:32 +0200
commit76f13d2a68cee2326e936f9c2f425566b463d6cb (patch)
tree81fd2de9f57dd049390773248d71bd0dc151740e /For Weekly Test/tricode/gsmselftest-website2.py
parentReport writing (diff)
downloadgsm-selftest-76f13d2a68cee2326e936f9c2f425566b463d6cb.tar.gz
gsm-selftest-76f13d2a68cee2326e936f9c2f425566b463d6cb.tar.xz
gsm-selftest-76f13d2a68cee2326e936f9c2f425566b463d6cb.zip
coller text
Diffstat (limited to 'For Weekly Test/tricode/gsmselftest-website2.py')
-rwxr-xr-xFor Weekly Test/tricode/gsmselftest-website2.py66
1 files changed, 42 insertions, 24 deletions
diff --git a/For Weekly Test/tricode/gsmselftest-website2.py b/For Weekly Test/tricode/gsmselftest-website2.py
index 87df001..d558bc1 100755
--- a/For Weekly Test/tricode/gsmselftest-website2.py
+++ b/For Weekly Test/tricode/gsmselftest-website2.py
@@ -10,6 +10,22 @@ import usbDetectClass
import ServerClassSoftware
from time import sleep
+class bcolors:
+ HEADER = '\033[95m'
+ OKBLUE = '\033[94m'
+ OKGREEN = '\033[92m'
+ WARNING = '\033[93m'
+ FAIL = '\033[91m'
+ ENDC = '\033[0m'
+
+ def disable(self):
+ self.HEADER = ''
+ self.OKBLUE = ''
+ self.OKGREEN = ''
+ self.WARNING = ''
+ self.FAIL = ''
+ self.ENDC = ''
+
global resultsList
resultsList = list()
@@ -59,7 +75,7 @@ def initTrueTable(x):
initResult.initTrueTable()
global finalResult
print '\n'
- openBSC = None
+ openBSC = Nonebcolors.OKGREEN +
finalResult = list()
for x in initResult.nanoBts:
finalResult.append(x)
@@ -67,40 +83,41 @@ def initTrueTable(x):
if x[1] == True:
openBSC = True
asterikServer = True
- print name+ ' Working'
+ print bcolors.OKGREEN +name+ ' Working'+ bcolors.ENDC
else:
if int(x[1]) == 486:
- print name+ ' not Working'
+ print bcolors.FAIL+name+ ' not Working' + bcolors.ENDC
elif int(x[1]) == 200:
- print name+ ' Working'
+ print bcolors.OKGREEN +name+ ' Working'
elif int(x[1]) == 998 or int(x[1]) == 999:
- print name+ ' not Working, handler error'
+ print bcolors.FAIL+name+ ' not Working, handler error'+ bcolors.ENDC
else:
- print name+ ' not Working'
+ print bcolors.OKGREEN +name+ ' not Working'+ bcolors.ENDC
+
finalResult.append(['openBSC', openBSC])
finalResult.append(['asterikServer', asterikServer])
print ''
if openBSC != None:
if openBSC == True:
- print 'openBSC working'
+ print bcolors.OKGREEN +'openBSC working'+ bcolors.ENDC
else:
- print 'openBSC doesnt work'
+ print bcolors.FAIL+'openBSC doesnt work'+ bcolors.ENDC
print ''
if initResult.asteriskServer == True:
- print 'asterik server is working'
+ print bcolors.OKGREEN +'asterik server is working'+ bcolors.ENDC
print '\n'
if initResult.outGoingRZ == True:
- print 'Outgoing call from RZ is working'
+ print bcolors.OKGREEN +'Outgoing call from RZ is working'+ bcolors.ENDC
elif initResult.outGoingRZ == False:
- print 'Outgoing call from RZ is not working'
+ print bcolors.FAIL+'Outgoing call from RZ is not working'+ bcolors.ENDC
if initResult.incomingRZ == True:
- print 'incoming call from outside RZ to GSM RZ is working'
+ print bcolors.OKGREEN +'incoming call from outside RZ to GSM RZ is working'+ bcolors.ENDC
elif initResult.incomingRZ == False:
- print 'incoming call from outside RZ to GSM RZ is not working'
+ print bcolors.FAIL+'incoming call from outside RZ to GSM RZ is not working'+ bcolors.ENDC
print '\n'
def doSipTest():
@@ -119,7 +136,6 @@ def doIncomingTest(): #incoming call to RZ network
destList = ['GSMRZ1','unisip', 'GSMRZ2','GSMRZ3']
doTest = initTestClass.doTest()
for callTo in destList:
-
callFrom = 'landline'
doTest.initTest(callFrom,callTo)
resultsList.append([callFrom, callTo, doTest.result])
@@ -132,7 +148,6 @@ def doGsmrzTest():
doTest = initTestClass.doTest()
for callFrom in callList:
-
for callTo in destList:
doTest.initTest(callFrom,callTo)
resultsList.append([callFrom, callTo, doTest.result])
@@ -228,7 +243,10 @@ def withDB(x):
resultsList.append([callFrom, callTo, makeTest.result])
db.errorCode(makeTest.result)
- print 'Result : ' +makeTest.result+ ' ' +db.errCode
+ if int(makeTest.result) == 200:
+ print bcolors.OKGREEN +'Result : ' +makeTest.result+ ' ' +db.errCode + bcolors.ENDC
+ else:
+ print bcolors.FAIL+'Result : ' +makeTest.result+ ' ' +db.errCode + bcolors.ENDC
if x == True: # if x = True means that this function call by website
@@ -248,10 +266,10 @@ def withDB(x):
initTrueTable(resultsList) # fetch result list and make adjustment about the result
db.closeDBConn()
else:
- print "--- No job at all ---"
+ print bcolors.FAIL+"--- No job at all ---" + bcolors.ENDC
db.closeDBConn()
else:
- print 'Cant connect to database'
+ print bcolors.FAIL+'Cant connect to database'+ bcolors.ENDC
sys.exit(1)
def findPort(portName): # take information in existing usb port
@@ -286,20 +304,20 @@ def initDevice(deviceName):
print ''
if imei == '' or portName == '':
- print ' == cant save device configuration, please fill IMEI / port name of the device =='
+ print bcolors.FAIL+' == cant save device configuration, please fill IMEI / port name of the device =='+ bcolors.ENDC
else:
findPort(portName)
if connect == 1:
if str(IMEI) != str(imei) and str(num) != str(number):
- print '== error, device not found =='
+ print bcolors.FAIL+'== error, device not found =='+ bcolors.ENDC
elif str(IMEI) == str(imei):
portClass.initUpdate(deviceName, portName, number)
- print '== Device succeced added =='
+ print bcolors.OKGREEN +'== Device succeced added =='+ bcolors.ENDC
elif str(num) == str(number) and str(IMEI) != str(imei):
portClass.initUpdate(deviceName, portName, number)
- print '== Device succeced added, but have different IMEI =='
+ print bcolors.WARNING'== Device succeced added, but have different IMEI =='+ bcolors.ENDC
else:
- print '== error, no device connected =='
+ print bcolors.FAIL+'== error, no device connected =='+ bcolors.ENDC
def autoUpdateDevice():
i = 0
@@ -346,7 +364,7 @@ def updateDevice(): #update port name list of device on DB
print "your choise : ",
input = sys.stdin.readline().rstrip("\r\n")
- if input == '8':
+ if input == '6':
break
elif input == '1':
initDevice('GSMExt.O2')