Merge "added cli option onoscell & updated setCell"
diff --git a/TestON/bin/cli.py b/TestON/bin/cli.py
index a02871b..1b8bdbd 100755
--- a/TestON/bin/cli.py
+++ b/TestON/bin/cli.py
@@ -255,7 +255,7 @@
try :
for index, option in enumerate(args):
if index > 0 :
- if re.match("logdir|mail|example|testdir|testcases", option, flags = 0):
+ if re.match("logdir|mail|example|testdir|testcases|onoscell", option, flags = 0):
index = index+1
options[option] = args[index]
options = self.testcasesInRange(index,option,args,options)
@@ -275,6 +275,7 @@
options['example'] = None
options['testdir'] = None
options['testcases'] = None
+ options['onoscell'] = None
return options
def testcasesInRange(self,index,option,args,options):
diff --git a/TestON/core/teston.py b/TestON/core/teston.py
index aeb944c..8eea845 100644
--- a/TestON/core/teston.py
+++ b/TestON/core/teston.py
@@ -613,6 +613,7 @@
verifyLogdir(options)
verifyMail(options)
verifyTestCases(options)
+ verifyOnosCell(options)
def verifyTest(options):
if options.testname:
@@ -677,6 +678,13 @@
print "testcases not specifed in params, please provide in params file or 'testcases' commandline argument"
sys.exit()
+def verifyOnosCell(options):
+ # Verifying onoscell option. This could be extended to do even more from here.
+ if options.onoscell:
+ main.onoscell = options.onoscell
+ else :
+ main.onoscell = main.FALSE
+
def verifyTestScript(options):
'''
Verifyies test script.
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index 3f55a52..8a87a49 100644
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -732,6 +732,7 @@
"""
Calls 'cell <name>' to set the environment variables on ONOSbench
"""
+ import re
try:
if not cellname:
main.log.error( "Must define cellname" )
@@ -750,9 +751,13 @@
self.handle.expect("\$")
handleMore = self.handle.before
- main.log.info( "Cell call returned: " + handleBefore +
+ cell_result = handleBefore + handleAfter + handleMore
+ print cell_result
+ if( re.search( "No such cell", cell_result ) ):
+ main.log.error( "Cell call returned: " + handleBefore +
handleAfter + handleMore )
-
+ main.cleanup()
+ main.exit()
return main.TRUE
except pexpect.EOF: