summaryrefslogtreecommitdiffstats
path: root/Code/Server-Code/gsmselftest.py
diff options
context:
space:
mode:
Diffstat (limited to 'Code/Server-Code/gsmselftest.py')
-rw-r--r--Code/Server-Code/gsmselftest.py25
1 files changed, 13 insertions, 12 deletions
diff --git a/Code/Server-Code/gsmselftest.py b/Code/Server-Code/gsmselftest.py
index 55f1415..9f8ab79 100644
--- a/Code/Server-Code/gsmselftest.py
+++ b/Code/Server-Code/gsmselftest.py
@@ -78,8 +78,16 @@ def initDB(): # function for connection database
db = DbClass.DBMySQLConnection()
db.connectDB()
dbStatus = db.connectDB()
- if dbStatus == 1:
- db.lockMutex(600)
+ if dbStatus != 1:
+ print bcolors.FAIL+"Cant connect to database"+ bcolors.ENDC
+ if dbStatus ==2:
+ print bcolors.FAIL+"can't connect to mysql, mysql shutdown or wrong host"+ bcolors.ENDC
+ elif dbStatus ==0:
+ print bcolors.FAIL+"wrong username or password"+ bcolors.ENDC
+ sys.exit()
+ else:
+ if dbStatus == 1:
+ db.lockMutex(600)
def initNagiosString(x):
@@ -184,9 +192,6 @@ def smartTest():
gsmRZList = list()
sipList = list()
destList = list()
- rem = list()
- item = list()
-
cpgsmRZList = list()
for lists in deviceLists: #define category of the device
@@ -271,7 +276,6 @@ def smartTest():
callTo = dest[1]
if callFrom != callTo:
testDest(callFrom, callTo, 2)
- rem.append(dest)
else:
continue
@@ -283,8 +287,6 @@ def smartTest():
callFrom = 'sip'
callTo = dest[0]
testDest(callFrom, callTo, 2)
- rem.append(dest)
-
caller = dest[0] # to test nanobts if the test come from RZ GSM but fehler
if caller[0:5] == 'GSMRZ' and int(dest[3]) != 2 and dest[1] != 'sip':
@@ -296,7 +298,6 @@ def smartTest():
if repeatTest == True:
callFrom = 'sip'
testDest(callFrom, dest[0], 2)
- rem.append(dest)
# test to make sure nanoBTS working or not. sice probably that nanotbts seems error but actually not.
for RZ in cpgsmRZList:
@@ -329,8 +330,6 @@ def smartTest():
else:
x = i-1
testDest(cpgsmRZList[x], cpgsmRZList[i], 2)
- item = '['+str(From)+','+str(callTo)+','+str(result)+','+str(1)+']'
- rem.append(item)
return smartResultList
@@ -762,8 +761,10 @@ else:
else:
sys.exit('WE DIDN\'T RECEIVE THE CONFIRMATION')
+try:
db.closeDBConn()
-
+except ValueError:
+ message = "Error"