summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--For Weekly Test/Advance/initTestClass.py44
-rw-r--r--For Weekly Test/Advance/trueTableClass.py21
2 files changed, 54 insertions, 11 deletions
diff --git a/For Weekly Test/Advance/initTestClass.py b/For Weekly Test/Advance/initTestClass.py
index e7ed7f7..e48337b 100644
--- a/For Weekly Test/Advance/initTestClass.py
+++ b/For Weekly Test/Advance/initTestClass.py
@@ -9,7 +9,9 @@ from time import sleep
class doTest:
- def ping(self,handler):
+ def ping(self,handler): # function to check connection to the device
+
+
if handler == 'landline':
server = PingClass.Ping('sipgate.de')
@@ -33,6 +35,10 @@ class doTest:
else:
self.serverStatus = 1
+ def pings(self,IP):
+ self.serverStatus = None
+ server = PingClass.Ping(IP)
+ self.serverStatus = server.ping(2)
def initDB(self):
@@ -76,17 +82,25 @@ class doTest:
def initTest(self, callFrom, callTo):
- self.initDB()
+ self.initDB() # open database connection
- if self.dbStatus != 0:
+ if self.dbStatus != 0: # if connection to db establish, do the test
+
+ #fetch device account detail from database
+ dest = self.db.deviceAddress(str(callTo))
+ caller = self.db.deviceAddress(str(callFrom))
+ self.pings(dest[4])
- self.ping(callFrom)
+ #self.ping(callFrom) # check connection to the device,
if self.serverStatus <> 0:
- self.ping(callTo)
+ #self.ping(callTo)
+ self.pings(caller[4])
+
if self.serverStatus <> 0:
- dest = self.db.deviceAddress(str(callTo))
- caller = self.db.deviceAddress(str(callFrom))
+ #fetch device account detail from database
+ #dest = self.db.deviceAddress(str(callTo))
+ #caller = self.db.deviceAddress(str(callFrom))
self.initaccount(caller,callFrom)
if self.status == 1:
@@ -107,6 +121,7 @@ class doTest:
else:
self.result = 100
self.killProc() # kill all the handler
+ self.db.closeDBConn()
#sleep(5)
else:
self.result = 500
@@ -135,6 +150,7 @@ class doTest:
gsmRZList = list()
sipList = list()
destList = list()
+ self.db.closeDBConn()
for lists in deviceLists: #define category of the device
device = lists[0]
@@ -159,22 +175,32 @@ class doTest:
if openBSC == 200:
for callFrom in gsmRZList:
- i = random.randint(3, len(destList)-1) # need to check whether the caller and dest are same
+ i = random.randint(0, len(destList)-1) #Check whether the caller and dest are same
callTo = destList[i]
+ if callFrom == callTo: #Check whether the caller and dest are same
+ if i == 0:
+ i = i+1
+ else:
+ i = i-1
+ callTo = destList[i]
+
self.initTest(callFrom,callTo)
destList.remove(callTo)
+ destList.remove(callFrom)
+ gsmRZList.remove(callFrom)
self.smartResultList.append([callFrom, callTo, self.result])
i = random.randint(0, len(gsmRZList)-1) #
callTo = gsmRZList[i]
self.initTest('landline',callTo)
gsmRZList.remove(callTo)
- destList.remove(callTo)
+ #destList.remove(callTo)
self.smartResultList.append(['landline', callTo, self.result])
for callTo in destList:
callFrom = 'sip'
self.initTest(callFrom,callTo)
+
self.smartResultList.append([callFrom, callTo, self.result])
return self.smartResultList
diff --git a/For Weekly Test/Advance/trueTableClass.py b/For Weekly Test/Advance/trueTableClass.py
index df569cd..88b3d81 100644
--- a/For Weekly Test/Advance/trueTableClass.py
+++ b/For Weekly Test/Advance/trueTableClass.py
@@ -1,3 +1,4 @@
+import DbClass
class trueTable:
def __init__(self, resultsList):
@@ -9,11 +10,26 @@ class trueTable:
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()
+
+ for devLists in deviceLists: #define category of the external devices
+ device = devLists[0]
+ if device[0:5] == 'GSMRZ' or device[0:5] == 'GSMEx' or device == 'landline':
+ externalRZList.append(device) # fetch into the list
+ self.db.closeDBConn()
lists = self.resultsList
- externalRZList = ['GSMExt.Tm','GSMExt.O2','GSMExt.Voda','GSMExt.Eplus','landline'] # should fetch this from DB or mix between external GSM and SIP side.
-#fetch list from DB
+ #externalRZList = ['GSMExt.Tm','GSMExt.O2','GSMExt.Voda','GSMExt.Eplus','landline'] # should fetch this from DB or mix between external GSM and SIP side.
+ #fetch list from DB
self.nanoBts = list()
gsmResultList = list()
@@ -106,4 +122,5 @@ class trueTable:
found = True
if found != True:
self.nanoBts.append([dest,result])
+