Package TestON :: Package bin :: Module cli :: Class CLI
[hide private]
[frames] | no frames]

Class CLI

source code

        object --+        
                 |        
threading._Verbose --+    
                     |    
      threading.Thread --+
                         |
               cmd.Cmd --+
                         |
                object --+
                         |
                        CLI

command-line interface to execute the test.

Instance Methods [hide private]
 
__init__(self, teston, stdin=sys.stdin)
Instantiate a line-oriented interpreter framework.
source code
 
emptyline(self)
Don't repeat last command when you hit return.
source code
 
do_help(self, line)
Describe available CLI commands.
source code
 
do_run(self, args)
run command will execute the test with following optional command line arguments logdir <directory to store logs in> testcases <list of testcases separated by comma or range of testcases separated by hypen> mail <mail-id or list of mail-ids seperated by comma> example 1, to execute the examples specified in the ~/examples diretory.
source code
 
do_resume(self, line)
resume command will continue the execution of paused test.
source code
 
do_nextstep(self, line)
nextstep will execute the next-step of the paused test and it will pause the test after finishing of step.
source code
 
do_dumpvar(self, line)
dumpvar will print all the test data in raw format.
source code
 
do_currentcase(self, line)
currentcase will return the current case in the test execution.
source code
 
do_currentstep(self, line)
currentstep will return the current step in the test execution.
source code
 
do_stop(self, line)
Will stop the paused test, if any !
source code
 
do_gettest(self, line)
gettest will return the test name which is under execution or recently executed.
source code
 
do_showlog(self, line)
showlog will show the test's Log teston>showlog Last executed test's log is : //home/openflow/TestON/logs/PoxTest_07_Jan_2013_21_42_11/PoxTest_07_Jan_2013_21_42_11.log .....
source code
 
parseArgs(self, args, options)
This will parse the command line arguments.
source code
 
initOptions(self, options)
This will initialize the commandline options.
source code
 
testcasesInRange(self, index, option, args, options)
This method will handle testcases list,specified in range [1-10].
source code
 
cmdloop(self, intro=introduction)
Repeatedly issue a prompt, accept input, parse an initial prefix off the received input, and dispatch to action methods, passing them the remainder of the line as argument.
source code
 
do_echo(self, line)
Echoing of given input.
source code
 
do_sh(self, line)
Run an external shell command sh pwd sh ifconfig etc.
source code
 
do_py(self, line)
Evaluate a Python expression.
source code
 
do_interpret(self, line)
interpret will translate the single line openspeak statement to equivalent python script.
source code
 
do_do(self, line)
Do will translate and execute the openspeak statement for the paused test.
source code
 
do_compile(self, line)
compile will translate the openspeak (.ospk) file into TestON test script (python).
source code
 
do_exit(self, _line)
Exit
source code
 
do_quit(self, line)
Exit
source code
 
do_EOF(self, line)
Exit
source code
 
isatty(self)
Is our standard input a tty?
source code
 
do_source(self, line)
Read shell commands from an input file and execute them sequentially.
source code
 
do_updatedriver(self, line)
updatedriver will update the given driver name which exists into mentioned config file.
source code
 
do_time(self, line)
Measure time taken for any command in TestON.
source code
 
default(self, line)
Called on an input line when the command prefix is not recognized.
source code

Inherited from threading.Thread: __repr__, daemon, getName, ident, isAlive, isDaemon, is_alive, join, name, run, setDaemon, setName, start

Inherited from threading.Thread (private): _set_daemon, _set_ident

Inherited from threading._Verbose (private): _note

Inherited from cmd.Cmd: columnize, complete, complete_help, completedefault, completenames, get_names, onecmd, parseline, postcmd, postloop, precmd, preloop, print_topics

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  prompt = 'teston> '
  helpStr = " teston help"

Inherited from cmd.Cmd: doc_header, doc_leader, identchars, intro, lastcmd, misc_header, nohelp, ruler, undoc_header, use_rawinput

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, teston, stdin=sys.stdin)
(Constructor)

source code 

Instantiate a line-oriented interpreter framework.

The optional argument 'completekey' is the readline name of a completion key; it defaults to the Tab key. If completekey is not None and the readline module is available, command completion is done automatically. The optional arguments stdin and stdout specify alternate input and output file objects; if not specified, sys.stdin and sys.stdout are used.

Overrides: object.__init__
(inherited documentation)

emptyline(self)

source code 

Don't repeat last command when you hit return.

Overrides: cmd.Cmd.emptyline

do_help(self, line)

source code 

Describe available CLI commands.

Overrides: cmd.Cmd.do_help

do_resume(self, line)

source code 

resume command will continue the execution of paused test. teston>resume [2013-01-07 23:03:44.640723] [PoxTest] [STEP] 1.1: Checking the host reachability using pingHost 2013-01-07 23:03:44,858 - PoxTest - INFO - Expected Prompt Found ....

do_nextstep(self, line)

source code 

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>

do_dumpvar(self, line)

source code 

dumpvar will print all the test data in raw format. usgae : teston>dumpvar main Here 'main' will be the test object.

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.

do_currentcase(self, line)

source code 

currentcase will return the current case in the test execution.

teston>currentcase Currently executing test case is: 2

do_currentstep(self, line)

source code 

currentstep will return the current step in the test execution.

teston>currentstep Currently executing test step is: 2.3

do_gettest(self, line)

source code 

gettest will return the test name which is under execution or recently executed.

Test under execution: teston>gettest Currently executing Test is: PoxTest

Test recently executed: Recently executed test is: MininetTest

do_showlog(self, line)

source code 

showlog will show the test's Log teston>showlog Last executed test's log is : //home/openflow/TestON/logs/PoxTest_07_Jan_2013_21_42_11/PoxTest_07_Jan_2013_21_42_11.log ..... teston>showlog Currently executing Test's log is: /home/openflow/TestON/logs/PoxTest_07_Jan_2013_21_46_58/PoxTest_07_Jan_2013_21_46_58.log .....

cmdloop(self, intro=introduction)

source code 

Repeatedly issue a prompt, accept input, parse an initial prefix off the received input, and dispatch to action methods, passing them the remainder of the line as argument.

Overrides: cmd.Cmd.cmdloop
(inherited documentation)

do_py(self, line)

source code 

Evaluate a Python expression.

py main.log.info("Sample Log Information") 2013-01-07 12:07:26,804 - PoxTest - INFO - Sample Log Information

do_interpret(self, line)

source code 

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")

do_do(self, line)

source code 

Do will translate and execute the openspeak statement for the paused test. do <OpenSpeak statement>

do_compile(self, line)

source code 

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.

usage: ----- teston>compile /home/openflow/TestON/PoxTest.ospk

Auto-generated test-script file is /home/openflow/TestON/PoxTest.py

do_source(self, line)

source code 

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

do_updatedriver(self, line)

source code 

updatedriver will update the given driver name which exists into mentioned config file.
It will receive two optional arguments :

1. Config File Path 
2. Drivers List to be updated.

Default : config file = "~/TestON/config/updatedriver" ,
          Driver List = all drivers specified in config file .

default(self, line)

source code 

Called on an input line when the command prefix is not recognized.

Overrides: cmd.Cmd.default