summaryrefslogtreecommitdiffstats
path: root/For Weekly Test/Advance/ControllerClass.py
diff options
context:
space:
mode:
Diffstat (limited to 'For Weekly Test/Advance/ControllerClass.py')
-rwxr-xr-xFor Weekly Test/Advance/ControllerClass.py29
1 files changed, 23 insertions, 6 deletions
diff --git a/For Weekly Test/Advance/ControllerClass.py b/For Weekly Test/Advance/ControllerClass.py
index 45e7b83..ca36bac 100755
--- a/For Weekly Test/Advance/ControllerClass.py
+++ b/For Weekly Test/Advance/ControllerClass.py
@@ -77,19 +77,27 @@ class doTheTest:
self.testResult = 998
self.caller.sendData('TERMINATE CONNECTION')
self.caller.closeConnection()
+ self.initCancelTest()
else:
self.testResult = 605
logger.logEvent('605 General Handler Error: caller handler no respond timeout')
self.caller.sendData('TERMINATE CONNECTION')
self.caller.closeConnection()
-
+ self.initCancelTest()
else:
self.testResult = 999
logger.logEvent('999 General Handler Error: Could not connect to Caller handler')
+ def initCancelTest(self)
+ #close SSH connection when using gsmBox and destination doesnt respond. to make sure SSH connection are terminate
+ if self.callFrom[0:5] == 'GSMRZ':
+ if self.callFrom != 'GSMRZ1':
+ # close SSH tunneling
+ self.boxCaller.killTunneling()
+ # waiting results state
def waitingFeedback(self):
logger.logEvent('Waiting Feedback')
self.resultDest = self.receiver.receiveData(15)
@@ -106,6 +114,7 @@ class doTheTest:
self.testResult = 200
self.initTerminate()
+ #send start call message to caller
def startCall(self):
logger.logEvent('Start Call')
self.receiver.sendData('RECEIVE START')
@@ -122,6 +131,7 @@ class doTheTest:
newLine = line[line.find(':')+1:]
self.server = newLine[0:newLine.find(':')]
+ # define the caller configuration such as port name and port caller.
def initCaller(self):
logger.logEvent('init Caller')
logger.logEvent(self.callFrom)
@@ -132,7 +142,7 @@ class doTheTest:
self.initGSM(self.portCaller, self.callPortName, self.callFrom)
else:
self.initAccount(self.accCaller)
-
+ #open SSH tunneling
self.boxCaller = SSHTunnelBoxClass.SSHTunneling(self.portCaller, 50008, self.server, self.username, self.password)
self.boxCaller.startTunneling()
@@ -143,6 +153,7 @@ class doTheTest:
else:
subprocess.Popen(args=["gnome-terminal", '--command=python SIPHandler.py '+self.accCaller+ ' ' +str(self.portCaller)])
+ # define the destination configuration such as port name and port caller.
def initReceiver(self):
logger.logEvent('init Receiver')
logger.logEvent(self.dest)
@@ -153,6 +164,7 @@ class doTheTest:
self.initGSM(self.portDest, self.destPortName, self.dest)
else:
self.initAccount(self.accDest)
+ #open SSH tunneling
self.boxDest = SSHTunnelBoxClass.SSHTunneling(self.portDest, 50008, self.server, self.username, self.password)
self.boxDest.startTunneling()
@@ -163,20 +175,24 @@ class doTheTest:
self.portDest = 50100
subprocess.Popen(args=['gnome-terminal', '--command=python SIPHandler.py '+self.accDest+ ' ' +str(self.portDest)])
- def initTerminate(self):
+ # send terminate message to Handlers
+ def initTerminate(self, handlers):
self.caller.sendData('TERMINATE CONNECTION')
self.receiver.sendData('TERMINATE CONNECTION')
if self.callFrom[0:5] == 'GSMRZ':
if self.callFrom != 'GSMRZ1':
+ # close SSH tunneling
self.boxCaller.killTunneling()
if self.dest[0:5] == 'GSMRZ':
if self.dest != 'GSMRZ1':
+ # close SSH tunneling
self.boxDest.killTunneling()
self.receiver.closeConnection()
self.caller.closeConnection()
- def callerGreeting(self):
+ def callerGreeting(self): # send greeting message to the caller handler
self.connected = None
+ #open connection to the Handler
self.caller = ClientClass.Connection('localhost',self.portCaller)
self.caller.connect()
@@ -190,8 +206,9 @@ class doTheTest:
logger.logEvent('Cannt connect to Caller')
self.connected = 'NOT OK'
- def receiverGreeting(self):
+ def receiverGreeting(self): # send greeting message to the destination handler
self.connected = None
+ #open connection to the Handler
self.receiver = ClientClass.Connection('localhost', self.portDest)
self.receiver.connect()
@@ -206,7 +223,7 @@ class doTheTest:
self.connected = 'NOT OK'
def initGSM(self, portCommunication, portDevice, handler):
-
+ #open GSM Handler
subprocess.Popen(args=["gnome-terminal", '--command=python GSMHandler.py '+str(portCommunication)+ ' ' +str(portDevice)+' '+str(handler)])