summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Controller/ControllerClass.py177
-rw-r--r--Controller/classClient.py74
-rw-r--r--Controller/classClient.pycbin2780 -> 0 bytes
-rw-r--r--Controller/classDb.py212
-rw-r--r--Controller/classDb.pycbin5666 -> 0 bytes
-rw-r--r--Controller/classPing.py28
-rw-r--r--Controller/gsmselftest.py271
-rw-r--r--Database/ErrorCodeTable.sql46
-rw-r--r--Database/gsmselftesting.sql80
-rw-r--r--Database/localhost.sql135
-rwxr-xr-xFor Weekly Test/tricode/ControllerClass.py38
-rw-r--r--documenting/Database.diabin0 -> 2135 bytes
12 files changed, 85 insertions, 976 deletions
diff --git a/Controller/ControllerClass.py b/Controller/ControllerClass.py
deleted file mode 100644
index 04c9614..0000000
--- a/Controller/ControllerClass.py
+++ /dev/null
@@ -1,177 +0,0 @@
-import sys
-import os
-import subprocess
-
-import ClientClass
-
-import LogFileClass
-logger = LogFileClass.Logging('classController.log')
-
-from time import sleep
-
-
-class test:
-
- def __init__(self, callFrom, callAdd, callTo, recAdd, destNo):
-
- self.callFrom = callFrom
- self.dest = callTo
- self.destNo = destNo
- self.repeatTest = None
- self.portCaller = None
- self.portDest = None
- self.resultCaller = None
- self.resultDest = None
- self.testResult = None
- self.callAdd = callAdd
- self.recAdd = recAdd
- self.receiver = None
- self.caller = None
- self.connected = None
-
-
- def FuncTest(self):
-
- logger.logEvent('')
-
- self.initCaller()
- sleep(3)
-
- self.callerGreeting()
-
- if self.connected == 'OK':
-
- self.caller.sendData('CALLER|'+self.destNo)
- callerHandler = self.caller.receiveData(60)
-
- if callerHandler == "CALLER READY":
- logger.logEvent('Caller handler : Ready')
-
- self.initReceiver()
- sleep(3)
- self.receiverGreeting()
-
- if self.connected == 'OK':
-
- self.receiver.sendData('RECEIVER')
- destHandler = self.receiver.receiveData(60)
-
- if destHandler == 'RECEIVER READY':
- logger.logEvent('Receiver handler : Ready')
-
- self.startCall()
- self.waitingFeedback()
-
- else:
- self.testResult = 604
- logger.logEvent('604 General Handler Error: Destination handler no respond timeout')
- self.caller.sendData('TERMINATE CONNECTION')
- self.receiver.closeConnection()
-
- else:
- logger.logEvent('998 General Handler Error: Could not connect Destination handler')
- self.testResult = 998
- self.caller.sendData('TERMINATE CONNECTION')
- self.caller.closeConnection()
- else:
- self.testResult = 605
- logger.logEvent('605 General Handler Error: caller handler no respond timeout')
-
- self.caller.closeConnection()
-
- else:
- self.testResult = 999
- logger.logEvent('999 General Handler Error: Could not connect to Caller handler')
-
-
-
- def waitingFeedback(self):
- logger.logEvent('Waiting Feedback')
- self.resultCaller = self.caller.receiveData(60)
- self.resultDest = self.receiver.receiveData(60)
-
- if self.resultCaller <> 'CALL OK' or self.resultDest <> 'CALL OK':
-
- logger.logEvent('Test Failed')
- self.testResult = 486
- self.repeatTest = True
- self.initTerminate()
-
- else:
- logger.logEvent('Test Succeed')
- self.testResult = 200
- self.initTerminate()
-
-
- def startCall(self):
- logger.logEvent('Start Call')
- self.receiver.sendData('RECEIVE START')
- self.caller.sendData('CALL START')
-
-
- def initCaller(self):
- logger.logEvent('init Caller')
-
- if self.callFrom =="gsmr1":
- self.portCaller = 50008
-
- elif self.callFrom =="gsmr2":
- self.portCaller = 50008 #temp
-
- elif self.callFrom =="gsmr3":
- self.portCaller = 50097
-
- else:
- self.portCaller = 50099
- subprocess.Popen(args=["gnome-terminal", '--command=python sipHandler.py '+self.callFrom+ ' ' +str(self.portCaller)])
-
- def initReceiver(self):
- logger.logEvent('init Receiver')
-
- if self.dest =="gsmr1":
- self.portDest = 50008
-
- elif self.dest =="gsmr2":
- self.portDest = 50008 #temp
-
- elif self.dest =="gsmr3":
- self.portDest = 50103
-
- else:
- self.portDest = 50100
- subprocess.Popen(args=['gnome-terminal', '--command=python sipHandler.py '+self.dest+ ' ' +str(self.portDest)])
-
- def initTerminate(self):
- self.caller.sendData('TERMINATE CONNECTION')
- self.receiver.sendData('TERMINATE CONNECTION')
-
- def callerGreeting(self):
- self.connected = None
- self.caller = ClientClass.Connection(self.callAdd,self.portCaller)
- self.caller.connect()
-
- if self.caller.connected == 1:
- logger.logEvent('Connected to Caller Handler')
- self.caller.sendData('HELLO HANDLER')
- if self.caller.receiveData(30) == 'HELLO CONTROLLER':
- logger.logEvent('Caller Handler respond')
- self.connected = 'OK'
- else:
- logger.logEvent('Cannt connect to Caller')
- self.connected = 'NOT OK'
-
- def receiverGreeting(self):
- self.connected = None
- self.receiver = ClientClass.Connection(self.recAdd, self.portDest)
- self.receiver.connect()
-
- if self.receiver.connected == 1:
- logger.logEvent('Connected to Receiver Handler')
- self.receiver.sendData('HELLO HANDLER')
- if self.receiver.receiveData(30) == 'HELLO CONTROLLER':
- logger.logEvent('Receiver Handler respond')
- self.connected = 'OK'
- else:
- logger.logEvent('Cannt connect to Receiver')
- self.connected = 'NOT OK'
-
diff --git a/Controller/classClient.py b/Controller/classClient.py
deleted file mode 100644
index 625e48e..0000000
--- a/Controller/classClient.py
+++ /dev/null
@@ -1,74 +0,0 @@
-import socket
-import sys
-import os
-import string
-
-class Connection:
- def __init__(self, h, p):
- self.host = h
- self.port = p
- self.s = None
- self.connected = 0
-
- def connect(self):
- self.s = None
-
- alive = self.ping()
- if alive == 0:
- return 'The machine is not alive'
- for res in socket.getaddrinfo(self.host, self.port, socket.AF_UNSPEC, socket.SOCK_STREAM):
- af, socktype, proto, canonname, sa = res
- try:
- self.s = socket.socket(af, socktype, proto)
- self.s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) #this resolves the bug with live packets
- except socket.error, msg:
- self.s = None
- self.connected = 0
- continue
- try:
- self.s.connect(sa)
- except socket.error, msg:
- self.s.close()
- self.connected = 0
- self.s = None
- continue
- break
- if self.s is None:
- self.connected = 0
- return 'Could not open socket'
- else:
- self.connected = 1
- return 'Connected'
-
- def sendData(self, data):
- if self.connected == 1:
- self.s.send(data)
-
- def receiveData(self):
- if self.connected == 1:
- return self.s.recv(1024)
- else:
- return 'Not connected'
-
- def closeConnection(self):
- if self.connected == 1:
- self.s.close()
- self.connected = 0
- return 'Closed'
-
- def ping(self):
- ping_cmd = os.popen('ping '+ self.host + ' -c 1 -W 1').read()
- pingAlive = int(string.find(ping_cmd, '1 received'))
- if pingAlive != -1:
- return 1
- else:
- return 0
-
-#MAIN PART
-x = Connection('localhost',50008)
-print x.connect()
-x.sendData('hello server :)')
-print x.receiveData()
-x.sendData('I send you another message')
-x.closeConnection()
-
diff --git a/Controller/classClient.pyc b/Controller/classClient.pyc
deleted file mode 100644
index f0a0323..0000000
--- a/Controller/classClient.pyc
+++ /dev/null
Binary files differ
diff --git a/Controller/classDb.py b/Controller/classDb.py
deleted file mode 100644
index 615b868..0000000
--- a/Controller/classDb.py
+++ /dev/null
@@ -1,212 +0,0 @@
-import MySQLdb
-import string
-
-class DBMySQLConnection:
- def __init__(self, username, password, host, dbname):
- #initialize at the start all the user parameters
- self.usern = username
- self.passw = password
- self.host = host
- self.db = dbname
- self.connectionCreated = 0
- self.tasksList = list()
- global debugMode
- debugMode = 0
-
- def connectDB(self):
- try:
- #try the connection
- self.datBaseConn=MySQLdb.connect(self.host,self.usern, self.passw,self.db)
- self.datBaseConn.paramstyle = 'format'
- self.cur = self.datBaseConn.cursor() #make the cursor, used for sending queries
- self.connectionCreated = 1 #use it as an indicator that the connection was created
- return 1
-
- except MySQLdb.Error, e:
- #if we have an error then try to catch it
- error=str(e)
- if error[1:5] == '1045':
- #wrong username or password
- return 0
- elif error[1:5] == '2002':
- #can't connect to mysql, mysql shutdown or wrong host
- return 2
- else:
- if debugMode == 1:
- print error
- return 3
-
- def closeDBConn(self):
- #close the connection to the database here
- if self.connectionCreated == 1:
- try:
- #close the cursor and then the connection to the DB
- self.cur.close()
- self.datBaseConn.close()
- return 1
- except MySQLdb.Error, e:
- #in case of an error
- if debugMode == 1:
- error = str(e)
- print error
- return 3
- else:
- #I never really had a connection
- return 0
-
- def anyTasksToDo(self):
- #see are there any jobs to be executed and make a list out of it
- if self.connectionCreated == 1:
- try:
- self.cur.execute("SELECT * FROM TempTaskTable")
- output = self.cur.fetchall() #get the mysql response
- #parse the output from the mysql by creating a list
- #with lists where each attribue(column) gets independent
- #element of the list
- for record in output:
- columns = list()
- for entry in record:
- columns.append(str(entry))
- self.tasksList.append(columns)
- return 1
- except MySQLdb.Error, e:
- error = str(e)
- if error[1:5] == '1146':
- return 2 #the table doesn't exist
- if debugMode == 1:
- print str(e)
- return 3
- else:
- return 0
-
- def cleanTasksList(self):
- if self.connectionCreated == 1:
- del self.tasksList[:]
- return 1
- else:
- return 0
-
- def removeTaskFromList(self, taskID):
- #remove only one task from the task list
- if self.connectionCreated == 1:
- for index in range(len(self.tasksList)):
- item = self.tasksList[index]
- if item[0] == str(taskID):
- #self.tasksList.remove(index)
- #print 'found it'
- del self.tasksList[index]
- return 1 #deleted taskID
-
- return 2 #didn't find that taskID
- else:
- return 0
-
- def deviceAddress(self,deviceName):
- if self.connectionCreated == 1:
- try:
- successful = self.cur.execute("SELECT `deviceIP` FROM DeviceAddress where `deviceName`=%s", deviceName)
- #self.cur.execute()
- output = self.cur.fetchall() #get the mysql response
- #parse the output from the mysql by creating a list
- #with lists where each attribue(column) gets independent
- #element of the list
- deviceAddr = ''
- for record in output:
- columns = list()
- for entry in record:
- deviceAddr = str(entry)
- return deviceAddr
- except MySQLdb.Error, e:
- error = str(e)
- if error[1:5] == '1146':
- return 2 #the table doesn't exist
- if debugMode == 1:
- print str(e)
- return 3 #some error happened
- else:
- return 0 #I am not connected
-
- def updateTaskResult(self, taskID, status):
- if self.connectionCreated == 1:
- try:
- successful = self.cur.execute("UPDATE TaskTable SET status=%i WHERE taskID=%i"%(int(status), int(taskID)))
- output = self.cur.fetchone()
-
- if debugMode == 1:
- print output
- if successful == 0:
- return 1 #update successful
- else:
- return 4 #taskID doesn't exist
-
- except MySQLdb.Error, e:
- if debugMode == 1:
- print str(e)
- return 3
- else:
- return 0
-
- def updatePingResult(self, taskNo, sipServer, sipGate, sipLoc, gsmBox1, gsmBox2):
- if self.connectionCreated == 1:
- try:
- successful = self.cur.execute("UPDATE PingResultTable SET sipServer=%i, sipGate=%i, sipLoc=%i, gsmBox1=%i, gsmBox2=%i WHERE taskNo=%i"%(int(sipServer), int(sipGate), int(sipLoc), int(gsmBox1), int(gsmBox2), int(taskNo)))
- output = self.cur.fetchone()
-
- if debugMode == 1:
- print output
- if successful == 0:
- return 1 #ping table updated
- else:
- return 4 #the taskNo didn't exist
-
-
- except MySQLdb.Error, e:
- if debugMode == 1:
- print str(e)
- return 3
- else:
- return 0
-
- def deleteTempTask(self, taskID):
- if self.connectionCreated == 1:
- try:
- successful = self.cur.execute("DELETE FROM TempTaskTable WHERE taskID=%i"%(int(taskID)))
- output = self.cur.fetchone()
-
- if debugMode == 1:
- print output
-
- if successful == 1:
- return 1 #deleted it
- else:
- return 4 #that taskID didn't exist or something else
- except MySQLdb.Error, e:
- if debugMode == 1:
- print str(e)
- return 3
-
- else:
- return 0
-
- def addResult(self, taskID, result):
- if self.connectionCreated == 1:
- try:
- successful = self.cur.execute("INSERT INTO ResultTable(taskID, result) VALUES ('%i', '%i')"%(int(taskID), int(result)))
- output = self.cur.fetchone()
-
- if debugMode == 1:
- print output
- if successful == 1:
- return 1 #successfully added the result
- else:
- return 4 #hmmm
- except MySQLdb.Error, e:
- error = str(e)
- if error[1:5] == '1062':
- return 2 #duplicate entry for the key
- if debugMode == 1:
- print str(e)
- return 3
- else:
- return 0
-
diff --git a/Controller/classDb.pyc b/Controller/classDb.pyc
deleted file mode 100644
index 522034d..0000000
--- a/Controller/classDb.pyc
+++ /dev/null
Binary files differ
diff --git a/Controller/classPing.py b/Controller/classPing.py
deleted file mode 100644
index e13b32b..0000000
--- a/Controller/classPing.py
+++ /dev/null
@@ -1,28 +0,0 @@
-import subprocess
-import string
-
-class Ping:
-
- def __init__(self, pingAddress):
- self.pingAddress = pingAddress
-
- def ping(self,numberTries):
- tried = 1
- while numberTries >= tried:
- tried += 1
- #the parameter c 1 means only one ping to be sent, parameter W 3 means how many seconds the time out should be, 3 seconds
- ping_cmd = subprocess.Popen(['ping', self.pingAddress, '-c', '1', '-W', '2'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT).communicate()[0]
-
- pingAlive = int(string.find(ping_cmd, '1 received'))
- unknownHost = int(string.find(ping_cmd, 'unknown host'))
-
-
- if pingAlive != -1:
- break
-
- if unknownHost != -1:
- return 2 #unknown host
- if pingAlive != -1:
- return 1 #ping works fine
- else:
- return 0 #no ping response
diff --git a/Controller/gsmselftest.py b/Controller/gsmselftest.py
deleted file mode 100644
index 400970f..0000000
--- a/Controller/gsmselftest.py
+++ /dev/null
@@ -1,271 +0,0 @@
-#! /usr/bin/env python
-import sys
-import ControllerClass
-import DbClass
-import PingClass
-import DeviceAddress
-from time import sleep
-
-def ping(handler):
-
- global serverStatus
-
- if handler == 'landline':
- server = PingClass.Ping('sipgate.de')
- serverStatus = server.ping(3)
-
- elif handler == 'sip':
- server = PingClass.Ping('132.230.4.8')
- serverStatus = server.ping(3)
-
- elif handler == 'unisip':
- server = PingClass.Ping('132.230.252.228')
- serverStatus = server.ping(3)
-
- elif handler == 'gsmr1':
- server = PingClass.Ping('localhost')
- serverStatus = server.ping(3)
-
- elif handler == 'gsmr2':
- server = PingClass.Ping('132.230.4.64')
- serverStatus = server.ping(3)
-
-
-def doTest(callFrom,callTo):
- global testResult
-
- ping(callFrom)
- device = DeviceAddress.DeviceAddress()
-
- if serverStatus <> 0:
-
- ping(callTo)
- if serverStatus <> 0:
- device.findDevice(callTo)
- recAdd = device.add
- destNo = str(device.num)
-
- device.findDevice(callFrom)
- callAdd = device.add
-
- print '\n'
- print "Caller: ", callFrom
- print 'Destination: ', callTo
- makeTest = ControllerClass.test(callFrom, callAdd, callTo, recAdd, destNo)
- makeTest.FuncTest()
-
- #db.addResult(taskID, makeTest.testResult)
-
- if makeTest.repeatTest == True:
- testRepeat = True
-
- print "Result :", makeTest.testResult
-
- #db.deleteTempTask(taskID)
- #db.tasksList.remove(item)
- #db.tasksList.insert(i,'')
- sleep(3)
- else:
- print "[failed] 500 "+callTo+ " Server Internal Error"
- else:
- print "[failed] 500 "+callFrom+ " Server Internal Error"
-
-def doSipTest():
-
- print '--SIP Part Test--'
- destList = ['sip', 'gsmr1','gsmr2', 'gsmr3', 'landline', 'unisip', 'gsmeO', 'gsmeV', 'gsmeT', 'gsmeE']
- #destList = ['unisip']
- for callTo in destList:
-
- callFrom = 'sip'
- if callFrom <> callTo:
- doTest(callFrom, callTo)
-
-def doLandlineTest():
-
- print '--Landline Part Test--'
- destList = ['gsmr1', 'gsmr2', 'gsmr3', 'sip']
-
- for callTo in destList:
-
- callFrom = 'landline'
- doTest(callFrom, callTo)
-
-def doGsmrzTest():
-
- print '--GSM Part Test--'
- destList = ['sip', 'gsmr1','gsmr2', 'gsmr3', 'landline', 'unisip', 'gsmeO', 'gsmeV', 'gsmeT', 'gsmeE']
- calllist = ['gsmr1','gsmr2', 'gsmr3']
-
- for callFrom in calllist:
-
- for callTo in destList:
- if callTo <> callFrom:
- doTest(callFrom, callTo)
-
- doGsmExtTest()
-
-def doGsmExtTest():
-
- destList = ['sip', 'gsmr1','gsmr2', 'gsmr3']
-
- for callTo in destList:
-
- callFrom = 'gsmeO'
- doTest(callFrom, callTo)
-
- callFrom = 'gsmeV'
- doTest(callFrom, callTo)
-
- callFrom = 'gsmeT'
- doTest(callFrom, callTo)
-
- callFrom = 'gsmeE'
- doTest(callFrom, callTo)
-
-def doAllTest():
-
- doSipTest()
- doLandlineTest()
- doGsmTest()
-
-if len(sys.argv) > 1:
-
- command = sys.argv[1]
- print '\n'
-
- if command == '--all':
- doAllTest()
-
- elif command == '--sip':
- doSipTest()
-
- elif command == '--gsm':
- doGsmTest()
-
- elif command == '--landline':
- doLandlineTest()
-
- elif command == '--help':
- file = open('help.txt', 'r')
- print file.read()
-
- else:
- print "command not found, Type '--help', '--copyright', '--credits' or '--license' for more information."
- print '\n'
-else:
- print '\n'
- db = DbClass.DBMySQLConnection('root', 'randompasswordSQL', 'localhost', 'gsmselftesting')
- db.connectDB()
- dbStatus = db.connectDB()
-
- if dbStatus == 1:
-
- if db.anyTasksToDo() == 1:
-
- allPing()
- i=0
- for item in db.tasksList:
- taskID = item[0]
- taskNo = item[1]
- callFrom = item[2]
- callTo = item[3]
-
- destination = db.deviceAddress(str(callTo))
-
- caller = db.deviceAddress(str(callFrom))
-
- callAdd = caller[0]
- recAdd = destination[0]
- destNo = destination[1]
-
- #if i == 0:
- # db.updatePingResult(taskNo, sipServer, sipGate, sipLoc, gsmBox1, gsmBox2)
-
- if callFrom == 'unisip':
- destNo = destNo[7:]
-
- print '\n'
- print "Task ID: ", taskID
- print "Calling From: ", callFrom
- print "To: ", callTo
- print "number: ", destNo
-
- ping(callFrom)
-
- if serverStatus <> 0:
-
- ping(callTo)
- if serverStatus <> 0:
-
- makeTest = ControllerClass.test(callFrom, callAdd, callTo, recAdd, destNo)
- makeTest.FuncTest()
-
- db.addResult(taskID, makeTest.testResult)
-
- if makeTest.repeatTest == True:
- db.insertTaskIn2(callTo,callFrom,taskNo)
-
- print "Result :", makeTest.testResult
-
- db.deleteTempTask(taskID)
- db.tasksList.remove(item)
- db.tasksList.insert(i,'')
- i = i+1
-
- sleep(3)
- else:
- print "[failed] 500 "+callTo+ " Server Internal Error"
- else:
- print "[failed] 500 "+callFrom+ " Server Internal Error"
- db.cleanTasksList()
- else:
- print "No job at all"
- else:
- sys.exit(5)
-
-
-
-def allPing():
-
- global sipGate
- global sipServer
- global sipLoc
- global gsmBox1
- global gsmBox2
-
- server = PingClass.Ping('sipgate.de')
- sipGate = server.ping(3)
-
- server = PingClass.Ping('132.230.4.8')
- sipServer = server.ping(3)
-
- server = PingClass.Ping('132.230.252.228')
- sipLoc = server.ping(3)
-
- server = PingClass.Ping('localhost')
- gsmBox1 = server.ping(3)
-
- server = PingClass.Ping('132.230.4.64')
- gsmBox2 = server.ping(3)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Database/ErrorCodeTable.sql b/Database/ErrorCodeTable.sql
deleted file mode 100644
index 3dd6332..0000000
--- a/Database/ErrorCodeTable.sql
+++ /dev/null
@@ -1,46 +0,0 @@
--- phpMyAdmin SQL Dump
--- version 3.3.10deb1
--- http://www.phpmyadmin.net
---
--- Host: localhost
--- Generation Time: Jul 29, 2011 at 01:19 PM
--- Server version: 5.1.54
--- PHP Version: 5.3.5-1ubuntu7.2
-
-SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
-
-
-/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
-/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
-/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
-/*!40101 SET NAMES utf8 */;
-
---
--- Database: `gsmselftesting`
---
-
--- --------------------------------------------------------
-
---
--- Table structure for table `ErrorCodeTable`
---
-
-DROP TABLE IF EXISTS `ErrorCodeTable`;
-CREATE TABLE IF NOT EXISTS `ErrorCodeTable` (
- `errorcode` int(4) NOT NULL,
- `description` varchar(100) NOT NULL,
- PRIMARY KEY (`errorcode`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-
---
--- Dumping data for table `ErrorCodeTable`
---
-
-INSERT INTO `ErrorCodeTable` (`errorcode`, `description`) VALUES
-(200, 'Call was OK'),
-(604, 'General Handler Error: Destination handler no respond timeout'),
-(998, 'General Handler Error: Could not connect Destination handler'),
-(605, 'General Handler Error: caller handler no respond timeout'),
-(999, 'General Handler Error: Could not connect to Caller handler'),
-(486, 'Call Failed'),
-(500, 'Server Internal Error');
diff --git a/Database/gsmselftesting.sql b/Database/gsmselftesting.sql
index 0f3e70b..566997d 100644
--- a/Database/gsmselftesting.sql
+++ b/Database/gsmselftesting.sql
@@ -3,7 +3,7 @@
-- http://www.phpmyadmin.net
--
-- Host: localhost
--- Generation Time: Sep 02, 2011 at 02:10 PM
+-- Generation Time: Oct 30, 2011 at 10:28 PM
-- Server version: 5.1.54
-- PHP Version: 5.3.5-1ubuntu7.2
@@ -18,9 +18,6 @@ SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
--
-- Database: `gsmselftesting`
--
-DROP DATABASE IF EXISTS `gsmselftesting`;
-CREATE DATABASE `gsmselftesting` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
-USE `gsmselftesting`;
-- --------------------------------------------------------
@@ -47,12 +44,13 @@ INSERT INTO `DeviceAddressTable` (`deviceName`, `portName`, `number`, `lastChang
('sip', 'localhost', '07612034661928', '2011-07-26 00:00:00', 'mpselftest1', '1mpselftest', '132.230.4.8'),
('unisip', 'localhost', '076120397898', '2011-07-27 00:00:00', '4976120397898', 'itzEfmLkzvS9', '132.230.252.228'),
('landline', 'localhost', '076145875681', '2011-07-26 00:00:00', '1289459', 'MMW9AX', 'sipgate.de'),
-('GSMRZ1', 'localhost', '07612034661xxx', '2011-07-27 15:47:08', '', '', ''),
-('GSMRZ2', 'localhost', '07612034661455', '2011-07-27 15:48:04', '', '', ''),
-('GSMExt.Eplus', 'localhost', '015782677224', '2011-07-28 14:33:43', '', '', ''),
-('GSMExt.Voda', 'localhost', '015252423662', '2011-07-28 14:35:33', '', '', ''),
-('GSMExt.Tm', 'localhost', '015128040906', '2011-08-29 14:47:18', '', '', ''),
-('GSMExt.O2', 'localhost', '017678038038', '2011-07-28 14:36:13', '', '', '');
+('GSMRZ1', '/dev/ttyUSB0', '07612034661449', '2011-07-27 15:47:08', '', '', ''),
+('GSMRZ2', 'localhost', '07612034661473', '2011-07-27 15:48:04', 'lsfks', 'lsfks', '132.230.4.67'),
+('GSMExt.Eplus', '/dev/ttyUSB4', '015782677224', '2011-07-28 14:33:43', '', '', ''),
+('GSMExt.Voda', '/dev/ttyUSB3', '015252423662', '2011-07-28 14:35:33', '', '', ''),
+('GSMExt.Tm', '/dev/ttyUSB1', '015128040906', '2011-08-29 14:47:18', '', '', ''),
+('GSMExt.O2', '/dev/ttyUSB2', '017678038038', '2011-07-28 14:36:13', '', '', ''),
+('GSMRZ3', 'localhost', '07612034661455', '2011-10-14 16:34:07', 'lsfks', 'root', '132.230.4.57');
-- --------------------------------------------------------
@@ -61,25 +59,64 @@ INSERT INTO `DeviceAddressTable` (`deviceName`, `portName`, `number`, `lastChang
--
CREATE TABLE IF NOT EXISTS `ErrorCodeTable` (
- `errorcode` int(4) NOT NULL,
+ `respondCode` int(4) NOT NULL,
`description` varchar(100) NOT NULL,
- PRIMARY KEY (`errorcode`)
+ PRIMARY KEY (`respondCode`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `ErrorCodeTable`
--
-INSERT INTO `ErrorCodeTable` (`errorcode`, `description`) VALUES
+INSERT INTO `ErrorCodeTable` (`respondCode`, `description`) VALUES
(200, 'Call was OK'),
-(604, 'General Handler Error: Destination handler no respond timeout'),
-(998, 'General Handler Error: Could not connect Destination handler'),
-(605, 'General Handler Error: caller handler no respond timeout'),
-(999, 'General Handler Error: Could not connect to Caller handler'),
+(604, 'General Handler Error: Destination handler did not respond. Timeout'),
+(998, 'General Handler Error: Could not connect to the destination handler!'),
+(605, 'General Handler Error: Caller handler did not respond. Timeout'),
+(999, 'General Handler Error: Could not connect to the caller handler!'),
(486, 'Call Failed'),
(500, 'Server Internal Error'),
-(333, 'No connection to Database'),
-(100, 'Missing account detail');
+(333, 'Could not establish a connection to the database!'),
+(100, 'Missing account detail'),
+(402, 'Payment Required (Eplus Card)'),
+(801, 'Connection to caller establishment, but device error'),
+(802, 'Connection to destination establishment, but device error');
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `GSMPrefix`
+--
+
+CREATE TABLE IF NOT EXISTS `GSMPrefix` (
+ `carrier` varchar(13) NOT NULL,
+ `prefix` varchar(4) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+--
+-- Dumping data for table `GSMPrefix`
+--
+
+INSERT INTO `GSMPrefix` (`carrier`, `prefix`) VALUES
+('GSMExt.Tm', '0151'),
+('GSMExt.Tm', '0160'),
+('GSMExt.Tm', '0170'),
+('GSMExt.Tm', '0175'),
+('GSMExt.Tm', '0171'),
+('GSMExt.Voda', '0162'),
+('GSMExt.Voda', '0172'),
+('GSMExt.Voda', '0173'),
+('GSMExt.Voda', '0174'),
+('GSMExt.Eplus', '0157'),
+('GSMExt.Eplus', '0177'),
+('GSMExt.Eplus', '0155'),
+('GSMExt.Eplus', '0163'),
+('GSMExt.Eplus', '0178'),
+('GSMExt.O2', '0159'),
+('GSMExt.O2', '0176'),
+('GSMExt.O2', '0179'),
+('GSMRZ1', '0761'),
+('GSMExt.Voda', '0152');
-- --------------------------------------------------------
@@ -118,9 +155,6 @@ CREATE TABLE IF NOT EXISTS `ResultTable` (
-- Dumping data for table `ResultTable`
--
-INSERT INTO `ResultTable` (`taskID`, `result`) VALUES
-(1, 486),
-(2, 486);
-- --------------------------------------------------------
@@ -135,7 +169,7 @@ CREATE TABLE IF NOT EXISTS `TaskTable` (
`to` varchar(15) NOT NULL,
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`taskID`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=25 ;
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
--
-- Dumping data for table `TaskTable`
diff --git a/Database/localhost.sql b/Database/localhost.sql
deleted file mode 100644
index ed64338..0000000
--- a/Database/localhost.sql
+++ /dev/null
@@ -1,135 +0,0 @@
--- phpMyAdmin SQL Dump
--- version 3.3.10deb1
--- http://www.phpmyadmin.net
---
--- Host: localhost
--- Generation Time: Jul 19, 2011 at 02:01 PM
--- Server version: 5.1.54
--- PHP Version: 5.3.5-1ubuntu7.2
-
-SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
-
-
-/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
-/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
-/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
-/*!40101 SET NAMES utf8 */;
-
---
--- Database: `gsmselftesting`
---
-CREATE DATABASE `gsmselftesting` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
-USE `gsmselftesting`;
-
--- --------------------------------------------------------
-
---
--- Table structure for table `DeviceAddressTable`
---
-
-CREATE TABLE IF NOT EXISTS `DeviceAddressTable` (
- `deviceName` varchar(10) NOT NULL,
- `deviceIP` varchar(60) NOT NULL,
- `lastChange` datetime NOT NULL,
- PRIMARY KEY (`deviceName`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-
---
--- Dumping data for table `DeviceAddressTable`
---
-
-
--- --------------------------------------------------------
-
---
--- Table structure for table `ErrorCodeTable`
---
-
-CREATE TABLE IF NOT EXISTS `ErrorCodeTable` (
- `errorcode` int(4) NOT NULL,
- `description` varchar(100) NOT NULL,
- PRIMARY KEY (`errorcode`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-
---
--- Dumping data for table `ErrorCodeTable`
---
-
-
--- --------------------------------------------------------
-
---
--- Table structure for table `PingResultTable`
---
-
-CREATE TABLE IF NOT EXISTS `PingResultTable` (
- `taskNo` int(11) NOT NULL,
- `sipServer` int(3) NOT NULL,
- `sipGate` int(3) NOT NULL,
- `sipLoc` int(3) NOT NULL,
- `gsmBox1` int(3) NOT NULL,
- `gsmBox2` int(3) NOT NULL,
- PRIMARY KEY (`taskNo`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-
---
--- Dumping data for table `PingResultTable`
---
-
-
--- --------------------------------------------------------
-
---
--- Table structure for table `ResultTable`
---
-
-CREATE TABLE IF NOT EXISTS `ResultTable` (
- `taskID` int(11) NOT NULL,
- `result` int(3) NOT NULL,
- PRIMARY KEY (`taskID`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-
---
--- Dumping data for table `ResultTable`
---
-
-
--- --------------------------------------------------------
-
---
--- Table structure for table `TaskTable`
---
-
-CREATE TABLE IF NOT EXISTS `TaskTable` (
- `taskID` int(11) NOT NULL AUTO_INCREMENT,
- `taskNo` int(11) NOT NULL,
- `from` varchar(10) NOT NULL,
- `to` varchar(10) NOT NULL,
- `status` int(2) NOT NULL,
- `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
- PRIMARY KEY (`taskID`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-
---
--- Dumping data for table `TaskTable`
---
-
-
--- --------------------------------------------------------
-
---
--- Table structure for table `TempTaskTable`
---
-
-CREATE TABLE IF NOT EXISTS `TempTaskTable` (
- `taskID` int(11) NOT NULL,
- `taskNo` int(11) NOT NULL,
- `from` varchar(10) NOT NULL,
- `to` varchar(10) NOT NULL,
- PRIMARY KEY (`taskID`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-
---
--- Dumping data for table `TempTaskTable`
---
-
diff --git a/For Weekly Test/tricode/ControllerClass.py b/For Weekly Test/tricode/ControllerClass.py
index 1a25361..d6ee603 100755
--- a/For Weekly Test/tricode/ControllerClass.py
+++ b/For Weekly Test/tricode/ControllerClass.py
@@ -30,34 +30,42 @@ class doTheTest:
def FuncTest(self):
- logger.logEvent('')
+ logger.logEvent(' -- -X- --')
self.initCaller()
if self.callFrom =="GSMRZ3" or self.callFrom =="GSMRZ2": # wait until ssh connection establish
- sleep(6)
+ if self.continues == 1:
+ sleep(6)
+ self.callerGreeting()
+ else:
+ self.connected = 'NOT OK'
else:
sleep(2)
- self.callerGreeting()
+ self.callerGreeting()
if self.connected == 'OK':
self.caller.sendData('CALLER|'+self.destNo)
- callerHandler = self.caller.receiveData(20)
+ callerHandler = self.caller.receiveData(25)
if callerHandler == "CALLER READY":
logger.logEvent('Caller handler : Ready')
self.initReceiver()
if self.dest =="GSMRZ3" or self.dest =="GSMRZ2": # wait until ssh connection establish
- sleep(6)
+ if self.continues == 1:
+ sleep(6)
+ self.receiverGreeting()
+ else:
+ self.connected = 'NOT OK'
else:
sleep(2)
- self.receiverGreeting()
+ self.receiverGreeting()
if self.connected == 'OK':
self.receiver.sendData('RECEIVER')
- destHandler = self.receiver.receiveData(20)
+ destHandler = self.receiver.receiveData(25)
if destHandler == 'RECEIVER READY':
logger.logEvent('Receiver handler : Ready')
@@ -104,6 +112,7 @@ class doTheTest:
def initCancelTest(self):
#close SSH connection when using gsmBox and destination doesnt respond. to make sure SSH connection are terminate
+ logger.logEvent('init Cancel test')
if self.callFrom[0:5] == 'GSMRZ':
if self.callFrom != 'GSMRZ1':
# close SSH tunneling
@@ -176,9 +185,10 @@ class doTheTest:
self.initAccount(self.accCaller)
#open SSH tunneling
self.boxCaller = SSHTunnelBoxClass.SSHTunneling(self.portCaller, 50008, self.server, self.username, self.password)
- self.boxCaller.startTunneling()
-
-
+ if int(self.boxCaller.startTunneling()) != 0:
+ self.continues = 1
+ else:
+ self.continues = 0
elif self.callFrom[0:4] == 'GSME':
self.initGSM(self.portCaller, self.callPortName, self.callFrom)
@@ -199,6 +209,10 @@ class doTheTest:
#open SSH tunneling
self.boxDest = SSHTunnelBoxClass.SSHTunneling(self.portDest, 50008, self.server, self.username, self.password)
self.boxDest.startTunneling()
+ if int(self.boxCaller.startTunneling()) != 0:
+ self.continues = 1
+ else:
+ self.continues = 0
elif self.dest[0:4] == 'GSME':
self.initGSM(self.portDest, self.destPortName, self.dest)
@@ -209,6 +223,7 @@ class doTheTest:
# send terminate message to Handlers
def initTerminate(self):
+ logger.logEvent('TERMINATE CONNECTION')
self.caller.sendData('TERMINATE CONNECTION')
self.receiver.sendData('TERMINATE CONNECTION')
if self.callFrom[0:5] == 'GSMRZ':
@@ -223,6 +238,7 @@ class doTheTest:
self.caller.closeConnection()
def callerGreeting(self): # send greeting message to the caller handler
+ logger.logEvent('Caller Greeting')
self.connected = None
#open connection to the Handler
self.caller = ClientClass.Connection('localhost',self.portCaller)
@@ -243,6 +259,7 @@ class doTheTest:
self.connected = 'NOT OK'
def receiverGreeting(self): # send greeting message to the destination handler
+ logger.logEvent('Receiver Greeting')
self.connected = None
#open connection to the Handler
self.receiver = ClientClass.Connection('localhost', self.portDest)
@@ -265,6 +282,7 @@ class doTheTest:
def initGSM(self, portCommunication, portDevice, handler):
#open GSM Handler
+ logger.logEvent('Init GSM')
subprocess.Popen(args=["gnome-terminal", '--command=python GSMHandler.py '+str(portCommunication)+ ' ' +str(portDevice)+' '+str(handler)])
diff --git a/documenting/Database.dia b/documenting/Database.dia
new file mode 100644
index 0000000..33c179c
--- /dev/null
+++ b/documenting/Database.dia
Binary files differ