summaryrefslogtreecommitdiffstats
path: root/For Weekly Test/Advance/testingfile.py
diff options
context:
space:
mode:
Diffstat (limited to 'For Weekly Test/Advance/testingfile.py')
-rw-r--r--For Weekly Test/Advance/testingfile.py157
1 files changed, 35 insertions, 122 deletions
diff --git a/For Weekly Test/Advance/testingfile.py b/For Weekly Test/Advance/testingfile.py
index 4762e93..f7f3f05 100644
--- a/For Weekly Test/Advance/testingfile.py
+++ b/For Weekly Test/Advance/testingfile.py
@@ -1,136 +1,49 @@
-import DbClass
-class trueTable:
- def __init__(self):
-
- self.resultsList = list()
- self.outGoingRZ = None
- 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 initTrueTable(self):
-
- self.initDB()
- deviceLists = self.db.deviceList() #fetch device list from database
- externalRZList = list()
- print deviceLists
- for devLists in deviceLists: #define category of the external devices
- device = devLists[0]
- print device
- 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()
- print externalRZList
- 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:
- stop = True
- if result == '200':
- self.asteriskServer = True #set status of asterik server as working
- if len(self.nanoBts) == 0:
- self.nanoBts.append(['nanoBts '+str(j),True])
- else:
- found = False
- for y in self.nanoBts: #find the existing nanoBts result
- name = y[0]
- if name == 'nanoBts '+str(j):
- found = True
- if found != True: #if doesnt found the nanoBts, add the result to the list, otherwise just ignoring
- self.nanoBts.append(['nanoBts '+str(j),True])
- found = False
- 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 and call == 'landline':
- for z in externalRZList:
- if dest == z:
- self.incomingRZ = True # find the result for imcoming call to GSM RZ from external RZ network
- elif result == '486':
- if key == call:# and dest == 'landline':
- for z in externalRZList:
- if dest == z:
- self.outGoingRZ = False
- if key == dest:# and call == 'landline':
- for z in externalRZList:
- if call == z:
- self.incomingRZ = False
- self.nanoBts.append(['nanoBts '+str(j),False])
- if result == '998' and key == dest: # find how to solve this!!!
- print 'GSMRZ'+str(j)+ " handler error"
-
- if result == '999' and key == call: # find how to solve this!!!
- print 'GSMRZ'+str(j)+ " handler error"
- print ''
-
-
- j = j+1
- elif j == i:
- stop = True
-
- if call[0:5]=='GSMEx': # looking for calling from GSMexternal
+nanoBts = list()
+lists = [['sip', 'GSMExt.o2',200],['sip', 'GSMExt.Tm',200],['sip', 'GSMExt.Eplus',486],['sip', 'GSMExt.Voda',200],['GSMExt.o2','sip',200],['GSMExt.Voda','sip',200],['GSMExt.Eplus','sip',486],['GSMExt.Tm','sip',486]]
+def test():
+ for x in lists:
+ call=x[0]
+ dest=x[1]
+ result=x[2]
+ #print x
+ if call[0:5]=='GSMEx': # looking for calling from GSMexternal
found = False
- if len(self.nanoBts) ==0:
- self.nanoBts.append([call,result])
+ if len(nanoBts) == 0:
+ nanoBts.append([call, result])
found = False
else:
- for y in self.nanoBts: #find the existing result for GSM external in the list
+ delete = False
+ for y in nanoBts: #find the existing result for GSM external in the list
name = y[0]
if name == call:
- found = True
+ if int(y[1]) == 486:
+ delete = True
+ 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
+ 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])
+ if len(nanoBts) == 0:
+ nanoBts.append([dest,result])
found = False
else:
- for y in self.nanoBts:
+ delete = False
+ for y in nanoBts:
name = y[0]
if name == dest:
- found = True
+ if int(y[1]) == 486:
+ delete = True
+ item = y
+ nanoBts.remove(y)
+ else:
+ found = True
if found != True:
- self.nanoBts.append([dest,result])
-
- print self.incomingRZ
- print self.outGoingRZ
-
-x = trueTable()
-x.initTrueTable()
+ nanoBts.append([dest,result])
+ #print nanoBts
+test()
+print nanoBts