Fix whitespace issues
Change-Id: I7c96843996f4847f9e15022f1dc6cd85e8a092f7
diff --git a/TestON/bin/cli.py b/TestON/bin/cli.py
index f6417a6..b515486 100755
--- a/TestON/bin/cli.py
+++ b/TestON/bin/cli.py
@@ -17,7 +17,7 @@
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/>.
+ along with TestON. If not, see <http://www.gnu.org/licenses/>.
'''
@@ -102,7 +102,7 @@
test.start()
else :
print main.TEST+ " test execution paused, please resume that before executing to another test"
-
+
def do_resume(self, line):
'''
resume command will continue the execution of paused test.
@@ -115,20 +115,20 @@
testthread.play()
else :
print "There is no test to resume"
-
+
def do_nextstep(self,line):
'''
- nextstep will execute the next-step of the paused test and
+ nextstep will execute the next-step of the paused test and
it will pause the test after finishing of step.
-
+
teston> nextstep
Will pause the test's execution, after completion of this step.....
-
+
teston> [2013-01-07 21:24:26.286601] [PoxTest] [STEP] 1.8: Checking the host reachability using pingHost
2013-01-07 21:24:26,455 - PoxTest - INFO - Expected Prompt Found
.....
teston>
-
+
'''
if testthread:
main.log.info("Executing the nextstep, Will pause test execution, after completion of the step")
@@ -137,17 +137,17 @@
testthread.pause()
else:
print "There is no paused test "
-
+
def do_dumpvar(self,line):
'''
dumpvar will print all the test data in raw format.
- usgae :
+ usgae :
teston>dumpvar main
Here 'main' will be the test object.
-
- teston>dumpvar params
+
+ teston>dumpvar params
here 'params' will be the parameters specified in the params file.
-
+
teston>dumpvar topology
here 'topology' will be topology specification of the test specified in topo file.
'''
@@ -161,25 +161,25 @@
print e
else :
print "There is no paused test "
-
+
def do_currentcase(self,line):
'''
currentcase will return the current case in the test execution.
-
+
teston>currentcase
Currently executing test case is: 2
-
+
'''
if testthread:
print "Currently executing test case is: "+str(main.CurrentTestCaseNumber)
else :
print "There is no paused test "
-
-
+
+
def do_currentstep(self,line):
'''
currentstep will return the current step in the test execution.
-
+
teston>currentstep
Currently executing test step is: 2.3
'''
@@ -187,25 +187,25 @@
print "Currently executing test step is: "+str(main.CurrentTestCaseNumber)+'.'+str(main.stepCount)
else :
print "There is no paused test "
-
-
+
+
def do_stop(self,line):
'''
Will stop the paused test, if any !
'''
if testthread:
testthread.stop()
-
+
return 'exited by user command'
-
+
def do_gettest(self,line):
'''
gettest will return the test name which is under execution or recently executed.
-
+
Test under execution:
- teston>gettest
+ teston>gettest
Currently executing Test is: PoxTest
-
+
Test recently executed:
Recently executed test is: MininetTest
'''
@@ -214,10 +214,10 @@
print "Currently executing Test is: "+main.TEST
else :
print "Recently executed test is: "+main.TEST
-
+
except NameError:
print "There is no previously executed Test"
-
+
def do_showlog(self,line):
'''
showlog will show the test's Log
@@ -231,22 +231,22 @@
try :
if testthread :
print "Currently executing Test's log is: "+main.LogFileName
-
+
else :
print "Last executed test's log is : "+main.LogFileName
-
+
logFile = main.LogFileName
logFileHandler = open(logFile, 'r')
for msg in logFileHandler.readlines() :
print msg,
-
+
logFileHandler.close()
-
+
except NameError:
print "There is no previously executed Test"
-
-
-
+
+
+
def parseArgs(self,args,options):
'''
This will parse the command line arguments.
@@ -263,9 +263,9 @@
options['testname'] = option
except IndexError,e:
print e
-
+
return options
-
+
def initOptions(self,options):
'''
This will initialize the commandline options.
@@ -276,8 +276,8 @@
options['testdir'] = None
options['testcases'] = None
options['onoscell'] = None
- return options
-
+ return options
+
def testcasesInRange(self,index,option,args,options):
'''
This method will handle testcases list,specified in range [1-10].
@@ -293,16 +293,16 @@
i = start_case
while i <= end_case:
testcases.append(i)
- i= i+1
+ i= i+1
else :
print "Please specify testcases properly like 1-5"
else :
options[option] = args[index]
return options
options[option] = str(testcases)
-
+
return options
-
+
def cmdloop(self, intro=introduction):
print introduction
while True:
@@ -330,23 +330,23 @@
def do_py( self, line ):
'''
Evaluate a Python expression.
-
+
py main.log.info("Sample Log Information")
2013-01-07 12:07:26,804 - PoxTest - INFO - Sample Log Information
-
+
'''
try:
exec( line )
except Exception, e:
output( str( e ) + '\n' )
-
+
def do_interpret(self,line):
'''
interpret will translate the single line openspeak statement to equivalent python script.
-
+
teston> interpret ASSERT result EQUALS main.TRUE ONPASS "Ping executed successfully" ONFAIL "Ping failed"
utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Ping executed successfully",onfail="Ping failed")
-
+
'''
from core import openspeak
ospk = openspeak.OpenSpeak()
@@ -355,7 +355,7 @@
print translated_code
except AttributeError, e:
print 'Dynamic params are not allowed in single statement translations'
-
+
def do_do (self,line):
'''
Do will translate and execute the openspeak statement for the paused test.
@@ -371,21 +371,21 @@
print 'Dynamic params are not allowed in single statement translations'
else :
print "Do will translate and execute the openspeak statement for the paused test.\nPlease use interpret to translate the OpenSpeak statement."
-
+
def do_compile(self,line):
'''
compile will translate the openspeak (.ospk) file into TestON test script (python).
- It will receive the openspeak file path as input and will generate
- equivalent test-script file in the same directory.
-
+ It will receive the openspeak file path as input and will generate
+ equivalent test-script file in the same directory.
+
usage:
-----
teston>compile /home/openflow/TestON/PoxTest.ospk
-
+
Auto-generated test-script file is /home/openflow/TestON/PoxTest.py
'''
from core import openspeak
- openspeak = openspeak.OpenSpeak()
+ openspeak = openspeak.OpenSpeak()
openspeakfile = line
if os.path.exists(openspeakfile) :
openspeak.compiler(openspeakfile=openspeakfile,writetofile=1)
@@ -397,7 +397,7 @@
"Exit"
if testthread:
testthread.stop()
-
+
sys.exit()
return 'exited by user command'
@@ -419,16 +419,16 @@
'''
Read shell commands from an input file and execute them sequentially.
cmdsource.txt :
-
+
"pwd
ls "
-
+
teston>source /home/openflow/cmdsource.txt
/home/openflow/TestON/bin/
cli.py __init__.py
-
+
'''
-
+
args = line.split()
if len(args) != 1:
error( 'usage: source <file>\n' )
@@ -443,15 +443,15 @@
break
except IOError:
error( 'error reading file %s\n' % args[ 0 ] )
-
+
def do_updatedriver(self,line):
'''
updatedriver will update the given driver name which exists into mentioned config file.
It will receive two optional arguments :
-
- 1. Config File Path
+
+ 1. Config File Path
2. Drivers List to be updated.
-
+
Default : config file = "~/TestON/config/updatedriver" ,
Driver List = all drivers specified in config file .
'''
@@ -464,28 +464,28 @@
index = index + 1
config = args[index]
elif option == 'drivers' :
- index = index + 1
+ index = index + 1
drivers = args[index]
except IndexError:
- pass
+ pass
import updatedriver
converter = updatedriver.UpdateDriver()
-
+
if config == '':
path = re.sub("(bin)$", "", os.getcwd())
config = path + "/config/updatedriver.cfg"
configDict = converter.configparser(config)
-
+
else :
converter.configparser(config)
configDict = converter.configparser(config)
-
-
+
+
converter.writeDriver(drivers)
-
-
-
-
+
+
+
+
def do_time( self, line ):
"Measure time taken for any command in TestON."
start = time.time()
@@ -535,7 +535,7 @@
result = self.test_on.cleanup()
self.is_stop = True
- __builtin__.testthread = False
+ __builtin__.testthread = False
def pause(self):
'''
@@ -551,17 +551,17 @@
'''
self._stopevent.clear()
cli.pause = False
-
+
def stop(self):
'''
Will stop the test execution.
'''
-
+
print "Stopping the test"
self.is_stop = True
cli.stop = True
__builtin__.testthread = False
-
+
def output(msg):
'''
Simply, print the message in console