Merge two versions of get_sw_controller
Remove print statements
Add Documentation
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index ad07d95..5f7d8a3 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -573,14 +573,20 @@
result = re.match(pattern, line)
if result:
version = result.group(0)
- return version
+ return version
- def get_sw_controller_sanity(self, sw):
+ def get_sw_controller(self, sw):
+ '''
+ Parameters:
+ sw: The name of an OVS switch. Example "s1"
+ Return:
+ The output of the command from the mininet cli or main.FALSE on timeout
+ '''
command = "sh ovs-vsctl get-controller "+str(sw)
try:
- response = self.execute(cmd=command,prompt="mininet>",timeout=10)
+ response = self.execute(cmd=command, prompt="mininet>", timeout=10)
if response:
- return main.TRUE
+ return response
else:
return main.FALSE
except pexpect.EOF:
@@ -588,26 +594,6 @@
main.log.error(self.name + ": " + self.handle.before)
main.cleanup()
main.exit()
- else:
- main.log.info(response)
-
- def get_sw_controller(self,sw):
- command = "sh ovs-vsctl get-controller "+str(sw)
- try:
- response = self.execute(cmd=command,prompt="mininet>",timeout=10)
- print(response)
- if response:
- print("**********************")
- return response
- else:
- return main.FALSE
- except pexpect.EOF:
- main.log.error(self.name + ": EOF exception found")
- main.log.error(self.name + ": " + self.handle.before)
- main.cleanup()
- main.exit()
- else:
- main.log.info(response)
def assign_sw_controller(self,**kwargs):
'''