Merge pull request #1 from ahassany/driver_fixes
Driver fixes for MiniNet
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index 060a8cc..c9b7c08 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -1,24 +1,24 @@
#!/usr/bin/env python
'''
-Created on 31-May-2013
+Created on 31-May-2013
-@author: Anil Kumar (anilkumar.s@paxterrasolutions.com)
+@author: Anil Kumar (anilkumar.s@paxterrasolutions.com)
- TestON is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 2 of the License, or
- (at your option) any later version.
+TestON is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
- TestON is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+TestON is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with TestON. If not, see <http://www.gnu.org/licenses/>.
+You should have received a copy of the GNU General Public License
+along with TestON. If not, see <http://www.gnu.org/licenses/>.
-'''
+'''
import time
import pexpect
import struct, fcntl, os, sys, signal
@@ -34,9 +34,9 @@
super(CLI, self).__init__()
def connect(self,**connectargs):
- '''
- Creates ssh handle for ONOS.
- '''
+'''
+Creates ssh handle for ONOS.
+'''
try:
for key in connectargs:
vars(self)[key] = connectargs[key]
@@ -66,15 +66,15 @@
def start(self):
'''
- Starts ONOS on remote machine.
- Returns false if any errors were encountered.
- '''
- try:
+Starts ONOS on remote machine.
+Returns false if any errors were encountered.
+'''
+ try:
self.handle.sendline("")
self.handle.expect("\$")
self.handle.sendline(self.home + "/onos.sh core start")
self.handle.expect("onos.sh core start")
- i=self.handle.expect(["STARTED","FAILED"])
+ i=self.handle.expect(["STARTED","FAILED"])
if i==0:
try:
self.handle.expect("\$", timeout=60)
@@ -87,7 +87,7 @@
main.log.error(self.name + ": ONOS Failed ")
return main.FALSE
raise
- main.log.error(self.name + ": ONOS expect script missed something... ")
+ main.log.error(self.name + ": ONOS expect script missed something... ")
return main.FALSE
except:
main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
@@ -98,8 +98,8 @@
def start_rest(self):
'''
- Starts the rest server on ONOS.
- '''
+Starts the rest server on ONOS.
+'''
try:
response = self.execute(cmd= self.home + "/start-rest.sh start",prompt="\$",timeout=10)
if re.search("admin",response):
@@ -107,8 +107,8 @@
time.sleep(5)
return main.TRUE
else :
- main.log.warn(self.name + ": Failed to start Rest Server")
- return main.FALSE
+ main.log.warn(self.name + ": Failed to start Rest Server")
+ return main.FALSE
except:
main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
main.log.error( traceback.print_exc() )
@@ -118,8 +118,8 @@
def status(self):
'''
- Called onos.sh core status and returns TRUE/FALSE accordingly
- '''
+Called onos.sh core status and returns TRUE/FALSE accordingly
+'''
try:
self.execute(cmd="\n",prompt="\$",timeout=10)
response = self.execute(cmd= self.home + "/onos.sh core status ",prompt="\d+\sinstance\sof\sonos\srunning",timeout=10)
@@ -141,12 +141,12 @@
def isup(self):
'''
- A more complete check to see if ONOS is up and running properly.
- First, it checks if the process is up.
- Second, it reads the logs for "Exception: Connection refused"
- Third, it makes sure the logs are actually moving.
- returns TRUE/FALSE accordingly.
- '''
+A more complete check to see if ONOS is up and running properly.
+First, it checks if the process is up.
+Second, it reads the logs for "Exception: Connection refused"
+Third, it makes sure the logs are actually moving.
+returns TRUE/FALSE accordingly.
+'''
try:
self.execute(cmd="\n",prompt="\$",timeout=10)
response = self.execute(cmd= self.home + "/onos.sh core status ",prompt="running",timeout=10)
@@ -165,10 +165,10 @@
main.log.error(self.name + ": ONOS is frozen...")#logs aren't moving
return main.FALSE
elif re.search( pattern2,tail1 ):
- main.log.info(self.name + ": Connection Refused found in onos log")
+ main.log.info(self.name + ": Connection Refused found in onos log")
return main.FALSE
elif re.search( pattern2,tail2 ):
- main.log.info(self.name + ": Connection Refused found in onos log")
+ main.log.info(self.name + ": Connection Refused found in onos log")
return main.FALSE
else:
main.log.info(self.name + ": Onos log is moving! It's looking good!")
@@ -185,10 +185,10 @@
- def rest_status(self):
+ def rest_status(self):
'''
- Checks if the rest server is running.
- '''
+Checks if the rest server is running.
+'''
try:
response = self.execute(cmd= self.home + "/start-rest.sh status ",prompt="running",timeout=10)
if re.search("rest\sserver\sis\srunning",response):
@@ -210,14 +210,14 @@
def stop(self):
'''
- Runs ./onos.sh core stop to stop ONOS
- '''
+Runs ./onos.sh core stop to stop ONOS
+'''
try:
self.handle.sendline("")
self.handle.expect("\$")
self.handle.sendline(self.home + "/onos.sh core stop")
self.handle.expect("stop", 2)
- result = self.handle.before
+ result = self.handle.before
self.handle.expect("\$", 60)
if re.search("Killed", result):
main.log.info(self.name + ": ONOS Killed Successfully")
@@ -235,8 +235,8 @@
def rest_stop(self):
'''
- Runs ./start-rest.sh stop to stop ONOS rest server
- '''
+Runs ./start-rest.sh stop to stop ONOS rest server
+'''
try:
response = self.execute(cmd= self.home + "/start-rest.sh stop ",prompt="killing",timeout=10)
self.execute(cmd="\n",prompt="\$",timeout=10)
@@ -256,25 +256,25 @@
def disconnect(self):
'''
- Called when Test is complete to disconnect the ONOS handle.
- '''
+Called when Test is complete to disconnect the ONOS handle.
+'''
response = ''
try:
self.handle.sendline("exit")
self.handle.expect("closed")
- except:
+ except:
main.log.error(self.name + ": Connection failed to the host")
response = main.FALSE
return response
def get_version(self):
- '''
- Writes the COMMIT number to the report to be parsed by Jenkins data collecter.
'''
+Writes the COMMIT number to the report to be parsed by Jenkins data collecter.
+'''
try:
self.handle.sendline("export TERM=xterm-256color")
self.handle.expect("xterm-256color")
- self.handle.expect("\$")
+ self.handle.expect("\$")
self.handle.sendline("cd " + self.home + "; git log -1 --pretty=fuller | grep -A 5 \"commit\"; cd \.\.")
self.handle.expect("cd ..")
self.handle.expect("\$")
@@ -287,10 +287,10 @@
main.exit()
def add_flow(self, testONip, user, password, flowDef):
- '''
- Copies the flowdef file from TestStation -> ONOS machine
- Then runs ./add_flow.py to add the flows to ONOS
- '''
+ '''
+Copies the flowdef file from TestStation -> ONOS machine
+Then runs ./add_flow.py to add the flows to ONOS
+'''
try:
main.log.info("Adding Flows...")
self.handle.sendline("scp %s@%s:%s /tmp/flowtmp" %(user,testONip,flowDef))
@@ -319,7 +319,7 @@
else:
main.log.error("Failed to add flows...")
- return main.FALSE
+ return main.FALSE
except:
main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
main.log.error( traceback.print_exc() )
@@ -330,8 +330,8 @@
def delete_flow(self, *delParams):
'''
- Deletes a specific flow, a range of flows, or all flows.
- '''
+Deletes a specific flow, a range of flows, or all flows.
+'''
try:
if len(delParams)==1:
if str(delParams[0])=="all":
@@ -366,11 +366,11 @@
def check_flow(self):
'''
- Calls the ./get_flow.py all and checks:
- - If each FlowPath has at least one FlowEntry
- - That there are no "NOT"s found
- returns TRUE/FALSE
- '''
+Calls the ./get_flow.py all and checks:
+- If each FlowPath has at least one FlowEntry
+- That there are no "NOT"s found
+returns TRUE/FALSE
+'''
try:
flowEntryDetect = 1
count = 0
@@ -401,7 +401,7 @@
main.log.info(self.name + ": Number of FlowPaths: "+str(count))
return main.TRUE
elif i==4:
- main.log.error(self.name + ":Check_flow() - Command Timeout!")
+ main.log.error(self.name + ":Check_flow() - Command Timeout!")
return main.FALSE
except:
main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
@@ -412,8 +412,8 @@
def get_flow(self, *flowParams):
'''
- Returns verbose output of ./get_flow.py
- '''
+Returns verbose output of ./get_flow.py
+'''
try:
if len(flowParams)==1:
if str(flowParams[0])=="all":
@@ -452,8 +452,8 @@
def get_json(self, url):
'''
- Helper functions used to parse the json output of a rest call
- '''
+Helper functions used to parse the json output of a rest call
+'''
try:
try:
command = "curl -s %s" % (url)
@@ -466,7 +466,7 @@
if type(parsedResult) == 'dict' and parsedResult.has_key('code'):
print "REST %s returned code %s" % (command, parsedResult['code'])
parsedResult = ""
- return parsedResult
+ return parsedResult
except:
main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
main.log.error( traceback.print_exc() )
@@ -475,9 +475,9 @@
main.exit()
def check_switch(self,RestIP,correct_nr_switch, RestPort ="8080" ):
- '''
- Used by check_status
- '''
+ '''
+Used by check_status
+'''
try:
buf = ""
retcode = 0
@@ -499,7 +499,7 @@
for s in parsedResult:
cnt += 1
- if s['state'] == "ACTIVE":
+ if s['state'] == "ACTIVE":
active += 1
buf += "switch: network %d : %d switches %d active\n" % (0+1, cnt, active)
@@ -520,9 +520,9 @@
main.exit()
def check_link(self,RestIP, nr_links, RestPort = "8080"):
- '''
- Used by check_status
- '''
+ '''
+Used by check_status
+'''
try:
buf = ""
retcode = 0
@@ -539,7 +539,7 @@
interlink=0
for s in parsedResult:
- intra = intra + 1
+ intra = intra + 1
if intra != nr_links:
buf += "link fail\n"
@@ -554,12 +554,12 @@
main.exit()
def check_status_report(self, ip, numoswitch, numolink, port="8080"):
- '''
- Checks the number of swithes & links that ONOS sees against the supplied values.
- Writes to the report log.
'''
+Checks the number of swithes & links that ONOS sees against the supplied values.
+Writes to the report log.
+'''
try:
- main.log.info(self.name + ": Making some rest calls...")
+ main.log.info(self.name + ": Making some rest calls...")
switch = self.check_switch(ip, int(numoswitch), port)
link = self.check_link(ip, int(numolink), port)
value = switch[0]
@@ -567,7 +567,7 @@
main.log.report( self.name + ": \n-----\n%s%s-----\n" % ( switch[1], link[1]) )
if value != 0:
return main.FALSE
- else:
+ else:
# "PASS"
return main.TRUE
except:
@@ -578,12 +578,12 @@
main.exit()
def check_status(self, ip, numoswitch, numolink, port = "8080"):
- '''
- Checks the number of swithes & links that ONOS sees against the supplied values.
- Writes to the main log.
- '''
+ '''
+Checks the number of swithes & links that ONOS sees against the supplied values.
+Writes to the main log.
+'''
try:
- main.log.info(self.name + ": Making some rest calls...")
+ main.log.info(self.name + ": Making some rest calls...")
switch = self.check_switch(ip, int(numoswitch), port)
link = self.check_link(ip, int(numolink), port)
value = switch[0]
@@ -591,7 +591,7 @@
main.log.info(self.name + ": \n-----\n%s%s-----\n" % ( switch[1], link[1]) )
if value != 0:
return main.FALSE
- else:
+ else:
# "PASS"
return main.TRUE
except:
@@ -603,8 +603,8 @@
def drop_keyspace(self):
'''
- Drops the ONOS keyspace
- '''
+Drops the ONOS keyspace
+'''
try:
self.handle.sendline(self.home + "/scripts/drop-keyspace.sh")
self.handle.expect("keyspace")
@@ -622,15 +622,15 @@
def check_for_no_exceptions(self):
'''
- TODO: Rewrite
- Used by CassndraCheck.py to scan ONOS logs for Exceptions
- '''
+TODO: Rewrite
+Used by CassndraCheck.py to scan ONOS logs for Exceptions
+'''
try:
self.handle.sendline("dsh 'grep Exception ~/ONOS/onos-logs/onos.*.log'")
- self.handle.expect("\$ dsh")
+ self.handle.expect("\$ dsh")
self.handle.expect("\$")
output = self.handle.before
- main.log.info(self.name + ": " + output )
+ main.log.info(self.name + ": " + output )
if re.search("Exception",output):
return main.FALSE
else :
@@ -645,26 +645,26 @@
def git_pull(self):
'''
- Stops the ONOS, pulls the latest code, and builds with mvn.
- Assumes that "git pull" works without login
- '''
+Stops the ONOS, pulls the latest code, and builds with mvn.
+Assumes that "git pull" works without login
+'''
try:
- main.log.info(self.name + ": Stopping ONOS")
+ main.log.info(self.name + ": Stopping ONOS")
self.stop()
self.handle.sendline("cd " + self.home)
self.handle.expect("ONOS\$")
self.handle.sendline("git pull")
- uptodate = 0
+ uptodate = 0
i=self.handle.expect(['fatal','Username\sfor\s(.*):\s','Unpacking\sobjects',pexpect.TIMEOUT,'Already up-to-date','Aborting'],timeout=180)
#debug
- #main.log.report(self.name +": \n"+"git pull response: " + str(self.handle.before) + str(self.handle.after))
+ #main.log.report(self.name +": \n"+"git pull response: " + str(self.handle.before) + str(self.handle.after))
if i==0:
- main.log.error(self.name + ": Git pull had some issue...")
+ main.log.error(self.name + ": Git pull had some issue...")
return main.FALSE
elif i==1:
- main.log.error(self.name + ": Git Pull Asking for username!!! BADD!")
- return main.FALSE
+ main.log.error(self.name + ": Git Pull Asking for username!!! BADD!")
+ return main.FALSE
elif i==2:
main.log.info(self.name + ": Git Pull - pulling repository now")
self.handle.expect("ONOS\$", 120)
@@ -673,7 +673,7 @@
return main.FALSE
elif i==4:
main.log.info(self.name + ": Git Pull - Already up to date")
- uptodate = 1
+ uptodate = 1
elif i==5:
main.log.info(self.name + ": Git Pull - Aborting... Are there conflicting git files?")
return main.FALSE
@@ -682,9 +682,9 @@
return main.FALSE
if uptodate == 0:
- main.log.info(self.name + ": mvn clean")
+ main.log.info(self.name + ": mvn clean")
self.handle.sendline("mvn clean")
- while 1:
+ while 1:
i=self.handle.expect(['BUILD\sFAILURE','BUILD\sSUCCESS','ONOS\$',pexpect.TIMEOUT],timeout=30)
if i == 0:
main.log.error(self.name + ": Build failure!")
@@ -692,15 +692,15 @@
elif i == 1:
main.log.info(self.name + ": Build success!")
elif i == 2:
- main.log.info(self.name + ": Build complete")
+ main.log.info(self.name + ": Build complete")
break;
elif i == 3:
main.log.error(self.name + ": mvn clean TIMEOUT!")
return main.FALSE
- main.log.info(self.name + ": mvn compile")
+ main.log.info(self.name + ": mvn compile")
self.handle.sendline("mvn compile")
- while 1:
+ while 1:
i=self.handle.expect(['BUILD\sFAILURE','BUILD\sSUCCESS','ONOS\$',pexpect.TIMEOUT],timeout=60)
if i == 0:
main.log.error(self.name + ": Build failure!")
@@ -709,7 +709,7 @@
main.log.info(self.name + ": Build success!")
return main.TRUE
elif i == 2:
- main.log.info(self.name + ": Build complete")
+ main.log.info(self.name + ": Build complete")
return main.TRUE
elif i == 3:
main.log.error(self.name + ": mvn compile TIMEOUT!")
@@ -733,10 +733,10 @@
if i == 0:
main.log.error(self.name + ": tcpdump - No such device exists. tcpdump attempted on: " + intf)
return main.FALSE
- elif i == 1:
+ elif i == 1:
main.log.info(self.name + ": tcpdump started on " + intf)
return main.TRUE
- elif i == 2:
+ elif i == 2:
main.log.error(self.name + ": tcpdump command timed out! Check interface name, given interface was: " + intf)
return main.FALSE
else:
@@ -787,7 +787,7 @@
for port in enumerate(switch[1]['ports']):
if ( port[1]['devices'] != [] ):
try:
- foundIP = port[1]['devices'][0]['ipv4addresses'][0]['ipv4']
+ foundIP = port[1]['devices'][0]['ipv4addresses'][0]['ipv4']
except:
print "Error in detecting IP address."
if foundIP == hostIP:
diff --git a/TestON/drivers/common/cli/ramcloudclidriver.py b/TestON/drivers/common/cli/ramcloudclidriver.py
index 6f72403..e651034 100644
--- a/TestON/drivers/common/cli/ramcloudclidriver.py
+++ b/TestON/drivers/common/cli/ramcloudclidriver.py
@@ -63,8 +63,8 @@
if self.handle :
return main.TRUE
else :
- main.log.error("Connection failed to the host "+self.user_name+"@"+self.ip_address)
- main.log.error("Failed to connect to the Onos system")
+ main.log.error(self.name+": Connection failed to the host "+self.user_name+"@"+self.ip_address)
+ main.log.error(self.name+": Failed to connect to the Onos system")
return main.FALSE
@@ -72,20 +72,28 @@
'''
This Function will start RamCloud Servers
'''
- main.log.info( "Starting RAMCloud Server" )
+ main.log.info(self.name+": Starting RAMCloud Server" )
self.handle.sendline("")
self.handle.expect("\$")
self.handle.sendline(self.home + "/onos.sh rc-server start")
self.handle.expect("onos.sh rc-server start")
self.handle.expect("\$")
response = self.handle.before + self.handle.after
- print response
+ #print ("RESPONSE IS: "+response)
time.sleep(5)
- if re.search("Starting\sRAMCloud\sserver\s(.*)", response):
- main.log.info(self.name + ": RAMCloud Server Started ")
+ if re.search("Killed\sexisting\sprocess", response):
+ main.log.info(self.name + ": Previous RAMCloud killed. ")
+ if re.search("Starting\sRAMCloud\sserver",response):
+ main.log.info(self.name + ": RAMCloud Server Started")
+ return main.TRUE
+ else:
+ main.log.info(self.name + ": Failed to start RAMCloud Server"+response)
+ return main.FALSE
+ elif re.search("Starting\sRAMCloud\sserver",response):
+ main.log.info(self.name + ": RAMCloud Server Started")
return main.TRUE
else:
- main.log.error(self.name + ": Failed to start RAMCloud Server"+ response)
+ main.log.info(self.name + ": Failed to start RAMCloud Server"+response)
return main.FALSE
@@ -93,72 +101,79 @@
'''
This Function will start RamCloud
'''
- main.log.info( "Starting RAMCloud Coordinator" )
+ main.log.info(self.name+": Starting RAMCloud Coordinator" )
self.handle.sendline("")
self.handle.expect("\$")
self.handle.sendline(self.home + "/onos.sh rc-coord start")
self.handle.expect("onos.sh rc-coord start")
self.handle.expect("\$")
response = self.handle.before + self.handle.after
- time.sleep(5)
- if re.search("Starting\sRAMCloud\scoordinator\s(.*)", response):
- main.log.info("RAMCloud Coordinator Started ")
+ if re.search("Starting\sRAMCloud\scoordinator\s", response):
+ if re.search("Killed\sexisting\sprocess", response):
+ main.log.warn(self.name+": Process was already running, killing existing process")
+ main.log.info(self.name+": RAMCloud Coordinator Started ")
return main.TRUE
else:
- main.log.error("Failed to start RAMCloud Coordinator"+ response)
+ main.log.error(self.name+": Failed to start RAMCloud Coordinator"+ response)
return main.FALSE
def status_serv(self):
'''
This Function will return the Status of the RAMCloud
'''
- time.sleep(5)
- self.execute(cmd="\n",prompt="\$",timeout=10)
- response = self.execute(cmd=self.home + "/onos.sh rc-server status ",prompt="\d+\sramcloud\sserver\srunning(.*)",timeout=10)
-
+ main.log.info(self.name + ": Getting RC-Server Status")
+ self.handle.sendline("")
+ self.handle.expect("\$")
+ self.handle.sendline(self.home + "/onos.sh rc-server status")
+ self.handle.expect("onos.sh rc-server status")
+ self.handle.expect("\$")
+ response = self.handle.before + self.handle.after
- self.execute(cmd="\n",prompt="\$",timeout=10)
- return response
-
- if re.search("0\sRAMCloud\sserver\srunning(.*)") :
- main.log.info("RAMCloud not running")
+ if re.search("0\sRAMCloud\sserver\srunning", response) :
+ main.log.info(self.name+": RAMCloud not running")
return main.TRUE
- elif re.search("1\sRAMCloud\sserver\srunning(.*)"):
- main.log.warn("RAMCloud Running")
+ elif re.search("1\sRAMCloud\sserver\srunning",response):
+ main.log.warn(self.name+": RAMCloud Running")
return main.TRUE
+ else:
+ main.log.info( self.name+": WARNING: status recieved unknown response")
+ return main.FALSE
def status_coor(self):
'''
This Function will return the Status of the RAMCloud
'''
- time.sleep(5)
self.execute(cmd="\n",prompt="\$",timeout=10)
- response = self.execute(cmd=self.home + "/onos.sh rc-coord status ",prompt="\d+\sramcloud\scoordinator\sis\srunning(.*)",timeout=10)
-
-
+ response = self.execute(cmd=self.home + "/onos.sh rc-coord status ",prompt="\d+\sRAMCloud\scoordinator\srunning",timeout=10)
self.execute(cmd="\n",prompt="\$",timeout=10)
- return response
+ #return response
- if re.search("0\sRAMCloud\scoordinator\sis\srunning(.*)") :
- main.log.info("RAMCloud Coordinator not running")
+ if re.search("0\sRAMCloud\scoordinator\srunning", response) :
+ main.log.warn(self.name+": RAMCloud Coordinator not running")
return main.TRUE
- elif re.search("1\sRAMCloud\scoordinator\sis\srunning(.*)"):
- main.log.warn("RAMCloud Coordinator Running")
+ elif re.search("1\sRAMCloud\scoordinator\srunning", response):
+ main.log.info(self.name+": RAMCloud Coordinator Running")
return main.TRUE
+ else:
+ main.log.warn( self.name+": coordinator status recieved unknown response")
+ return main.FALSE
def stop_serv(self):
'''
This Function will stop the RAMCloud if it is Running
- '''
- self.execute(cmd="\n",prompt="\$",timeout=10)
- time.sleep(5)
- response = self.execute(cmd=slef.home + "/onos.sh rc-server stop ",prompt="Killed\sexisting\sprosess(.*)",timeout=10)
- self.execute(cmd="\n",prompt="\$",timeout=10)
- if re.search("Killed\sexisting\sprosess(.*)",response):
+ '''
+ main.log.info(self.name + ": Stopping RC-Server")
+ self.handle.sendline("")
+ self.handle.expect("\$")
+ self.handle.sendline(self.home + "/onos.sh rc-server stop")
+ self.handle.expect("onos.sh rc-server stop")
+ self.handle.expect("\$")
+ response = self.handle.before + self.handle.after
+ if re.search("Killed\sexisting\sprocess",response):
main.log.info("RAMCloud Server Stopped")
return main.TRUE
else:
- main.log.warn("RAMCloud is not Running")
+ main.log.warn(self.name+": RAMCloud is not Running")
return main.FALSE
@@ -168,13 +183,13 @@
'''
self.execute(cmd="\n",prompt="\$",timeout=10)
time.sleep(5)
- response = self.execute(cmd=self.home + "/onos.sh rc-coord stop ",prompt="Killed\sexisting\sprosess(.*)",timeout=10)
+ response = self.execute(cmd=self.home + "/onos.sh rc-coord stop ",prompt="Killed\sexisting\sprocess",timeout=10)
self.execute(cmd="\n",prompt="\$",timeout=10)
- if re.search("Killed\sexisting\sprosess(.*)",response):
- main.log.info("RAMCloud Coordinator Stopped")
+ if re.search("Killed\sexisting\sprocess",response):
+ main.log.info(self.name+": RAMCloud Coordinator Stopped")
return main.TRUE
else:
- main.log.warn("RAMCloud is not Running")
+ main.log.warn(self.name+": RAMCloud was not Running")
def disconnect(self):
'''
@@ -185,29 +200,6 @@
self.handle.sendline("exit")
self.handle.expect("closed")
else :
- main.log.error("Connection failed to the host")
+ main.log.error("Connection failed to the host when trying to disconnect from RAMCloud component")
response = main.FALSE
return response
-
- def isup(self):
- '''
- A more complete status check of ramcloud.
- Tries 5 times to call start-ramcloud-server.sh status
- returns TRUE if it sees four occurances of both Up, and Normal
- '''
- tries = 5
- main.log.info("trying %i times" % tries )
- for i in range(tries):
- self.execute(cmd="\n",prompt="\$",timeout=10)
- self.handle.sendline("")
- self.handle.expect("\$")
- self.handle.sendline(self.home + "/onos.sh rc-server status")
- data = self.handle.expect(['1 RAMCloud server running','0 RAMCloud server running',pexpect.TIMEOUT],timeout=30)
- if data==0:
- main.log.report("RAMCloud Up and Running!")
- return main.TRUE
- elif data==1:
- main.log.report("RAMCloud is down!")
-
-
- return main.FALSE