summaryrefslogtreecommitdiffstats
path: root/For Weekly Test/tricode/trueTableClass.py
diff options
context:
space:
mode:
authorgsmselftest2011-10-20 18:14:09 +0200
committergsmselftest2011-10-20 18:14:09 +0200
commit8c16ed8663a52c827ed562ea9bdbd7de02a48906 (patch)
tree538a807fe1bdb3bb8f0abf819750147ce4e98b5d /For Weekly Test/tricode/trueTableClass.py
parentMerge branch 'master' of lab.ks.uni-freiburg.de:lsfks/projekte/gsm-selftest (diff)
downloadgsm-selftest-8c16ed8663a52c827ed562ea9bdbd7de02a48906.tar.gz
gsm-selftest-8c16ed8663a52c827ed562ea9bdbd7de02a48906.tar.xz
gsm-selftest-8c16ed8663a52c827ed562ea9bdbd7de02a48906.zip
almost final version
Diffstat (limited to 'For Weekly Test/tricode/trueTableClass.py')
-rwxr-xr-xFor Weekly Test/tricode/trueTableClass.py164
1 files changed, 164 insertions, 0 deletions
diff --git a/For Weekly Test/tricode/trueTableClass.py b/For Weekly Test/tricode/trueTableClass.py
new file mode 100755
index 0000000..36ddef6
--- /dev/null
+++ b/For Weekly Test/tricode/trueTableClass.py
@@ -0,0 +1,164 @@
+import DbClass
+
+class trueTable:
+ def __init__(self, resultsList):
+
+ self.resultsList = resultsList
+ self.outGoingRZ = False
+ self.asteriskServer = None
+ self.incomingRZ = None
+ self.openBSC = None
+ self.nanoBTS = None
+
+ def initDB(self):
+ # function for connect to database
+ self.db = DbClass.DBMySQLConnection('root', 'randompasswordSQL', 'localhost', 'gsmselftesting')
+ self.db.connectDB()
+ self.dbStatus = self.db.connectDB()
+
+ def lookingBTSname(self, btsname):
+ if len(self.nanoBts) == 0:
+ self.nanoBts.append([btsName,True])
+ found = True
+ else:
+ found = False
+ for y in self.nanoBts: #find the existing nanoBts result
+ name = y[0]
+ if name == btsName:
+ if y[1] == False:
+ self.nanoBts.remove(btsName)
+ else:
+ found = True
+ return found
+
+ def initTrueTable(self):
+ global btsName
+ self.initDB()
+ deviceLists = self.db.deviceList() #fetch device list from database
+ externalRZList = list()
+
+ for devLists in deviceLists: #define category of the external devices
+ device = devLists[0]
+ if device[0:5] == 'GSMEx' or device == 'landline':
+ externalRZList.append(device) # fetch into the list
+ self.db.closeDBConn()
+ lists = self.resultsList
+ self.nanoBts = list()
+ gsmResultList = list()
+
+ i= 1
+ for w in lists:
+ call=w[0]
+ dest=w[1]
+
+
+ if call[0:5]=='GSMRZ':
+ if i <= int(call[5:]):
+ i = int(call[5:])
+ if dest[0:5]=='GSMRZ':
+
+ if i <= int(dest[5:]):
+ i = int(dest[5:])
+ i = i+1
+
+ for x in lists: # to find nanoBts, asterik server and open BSC status regarding result test for GSM RZ
+ call=x[0]
+ dest=x[1]
+ result=x[2]
+ stop = False
+ j=1
+
+ if call[0:5]=='GSMRZ' or dest[0:5]=='GSMRZ':
+ while stop != True:
+ if j != i:
+ key = 'GSMRZ'+str(j)
+ if key == call or key == dest:
+
+ btsName = 'nanoBts '+str(j)
+ if result == '200':
+ btsName = 'nanoBts '+str(j)
+ self.asteriskServer = True #set status of asterik server as working
+ if self.lookingBTSname(btsName) != True:
+ #if doesnt found the nanoBts, add the result to the list, otherwise just ignoring
+ self.nanoBts.append([btsName,True])
+
+ if key == call:#
+ for z in externalRZList:# find the result for outgoing call from GSM RZ to external RZ network
+ if dest == z:
+ self.outGoingRZ = True #set status as working for outgoing RZ
+ if key == dest:
+ for z in externalRZList:
+ if call == z:
+ self.incomingRZ = True # find the result for imcoming call to GSM RZ from external RZ network
+ elif result == '486':
+ found = False
+ if key == call:# and dest == 'landline':
+ for z in externalRZList:
+ if dest == z and self.outGoingRZ != True:
+ self.outGoingRZ = False
+ if key == dest:# and call == 'landline':
+ for z in externalRZList:
+ if call == z and self.incomingRZ != True:
+ self.incomingRZ = False
+ if self.nanoBts == '':
+ self.nanoBts.append([btsName,False])
+ for y in self.nanoBts: #find the existing nanoBts result
+ name = y[0]
+ if name == btsName and y[1] != True:
+ found = True
+ if found != True:
+ self.nanoBts.append([btsName,False])
+
+
+ if result == '998' and key == dest: # find how to solve this!!!
+
+ if self.lookingBTSname(key) != True:
+ self.nanoBts.append([key,result])
+
+ if result == '999' and key == call: # find how to solve this!!!
+
+ if self.lookingBTSname(key) != True:
+ self.nanoBts.append([key,result])
+
+
+ j = j+1
+ elif j == i:
+ stop = True
+
+ if call[0:5]=='GSMEx': # looking for calling from GSMexternal
+ found = False
+ if len(self.nanoBts) == 0:
+ self.nanoBts.append([call,result])
+ found = False
+ else:
+ for y in self.nanoBts: #find the existing result for GSM external in the list
+ name = y[0]
+ if name == call:
+ if int(y[1]) == 486 or int(y[1]) == 999 or int(y[1]) == 998:
+ self.nanoBts.remove(y)
+ else:
+ found = True
+ if found != True:
+ self.nanoBts.append([call,result])
+
+ if dest[0:5]=='GSMEx': # looking for destination call to GSMexternal
+ found = False
+ if len(self.nanoBts) == 0:
+ self.nanoBts.append([dest,result])
+ found = False
+ else:
+
+ for y in self.nanoBts:
+ name = y[0]
+ if name == dest:
+ if int(y[1]) == 486 or int(y[1]) == 999 or int(y[1]) == 998:
+ self.nanoBts.remove(y)
+ else:
+ found = True
+ if found != True:
+ self.nanoBts.append([dest,result])
+ for device in externalRZList:
+ if device == dest and int(result[1]) == 200:
+ self.outGoingRZ = True
+
+