diff options
author | lanqinglong <lanqinglong@huawei.com> | 2015-10-13 21:02:11 +0800 |
---|---|---|
committer | Qinglong Lan <lanqinglong@huawei.com> | 2015-10-14 10:15:36 +0000 |
commit | 47595881eba7292de87ec5d7aeb4b123ba6eb0f1 (patch) | |
tree | 1e59d98e2af913e7090841bf04b8affc1e32c349 /testcases | |
parent | 53adf4a3727ebd64f3052de31c21e67a1c51d2c1 (diff) |
intergrate the basic function senario and testcases in TESTON
JIRA:FUNCTEST-47
include tests:
Northbound test
Ovsdb test
Change-Id: Icd5bc2da117cc5c2f7196a0f06fa8934fd8e022f
Signed-off-by: lanqinglong <lanqinglong@huawei.com>
Diffstat (limited to 'testcases')
-rw-r--r-- | testcases/Controllers/ONOS/Teston/CI/adapters/client.py | 35 | ||||
-rw-r--r-- | testcases/Controllers/ONOS/Teston/CI/onosfunctest.py | 8 |
2 files changed, 33 insertions, 10 deletions
diff --git a/testcases/Controllers/ONOS/Teston/CI/adapters/client.py b/testcases/Controllers/ONOS/Teston/CI/adapters/client.py index 25adcbe08..c84f187fa 100644 --- a/testcases/Controllers/ONOS/Teston/CI/adapters/client.py +++ b/testcases/Controllers/ONOS/Teston/CI/adapters/client.py @@ -4,6 +4,10 @@ Description: lanqinglong@huawei.com """ from environment import environment +import os +import time +import pexpect +import re class client( environment ): @@ -11,7 +15,7 @@ class client( environment ): environment.__init__( self ) self.loginfo = environment() - def RunScript( self, testname ): + def RunScript( self, handle, testname, timeout=300 ): """ Run ONOS Test Script Parameters: @@ -20,11 +24,27 @@ class client( environment ): masterpassword: The server password of running ONOS """ self.ChangeTestCasePara( testname, self.masterusername, self.masterpassword ) - runtest = "OnosSystemTest/TestON/bin/cli.py run " + testname - os.system(runtest) - print "Done!" + runhandle = handle + runtest = self.home + "/OnosSystemTest/TestON/bin/cli.py run " + testname + runhandle.sendline(runtest) + circletime = 0 + lastshowscreeninfo = '' + while True: + Result = runhandle.expect(["PEXPECT]#", pexpect.EOF, pexpect.TIMEOUT]) + curshowscreeninfo = runhandle.before + if (len(lastshowscreeninfo) != len(curshowscreeninfo)): + print str(curshowscreeninfo)[len(lastshowscreeninfo)::] + lastshowscreeninfo = curshowscreeninfo + if Result == 0: + print "Done!" + return + time.sleep(1) + circletime += 1 + if circletime > timeout: + break + self.loginfo.log( "Timeout when running the test, please check!" ) - def onosbasic(self): + def onosstart( self ): #This is the compass run machine user&pass,you need to modify print "Test Begin....." @@ -32,4 +52,7 @@ class client( environment ): masterhandle = self.SSHlogin(self.localhost, self.masterusername, self.masterpassword) self.OnosEnvSetup( masterhandle ) - self.SSHRelease( masterhandle )
\ No newline at end of file + return masterhandle + + def onosclean( self, handle ): + self.SSHRelease( handle ) diff --git a/testcases/Controllers/ONOS/Teston/CI/onosfunctest.py b/testcases/Controllers/ONOS/Teston/CI/onosfunctest.py index 3286a15f8..fe6f9d776 100644 --- a/testcases/Controllers/ONOS/Teston/CI/onosfunctest.py +++ b/testcases/Controllers/ONOS/Teston/CI/onosfunctest.py @@ -9,7 +9,6 @@ lanqinglong@huawei.com """ from adapters.client import client - if __name__=="__main__": main = client() @@ -24,8 +23,9 @@ if __name__=="__main__": main.OCN = '189.42.8.104' main.OCN2 = '189.42.8.105' main.localhost = main.OCT - main.onosbasic() #scripts to run - main.RunScript("FUNCvirNetNB") - main.RunScript("FUNCovsdbtest") + runhandle = main.onosstart() + main.RunScript(runhandle, "FUNCvirNetNB") + main.RunScript(runhandle, "FUNCovsdbtest") + main.onosclean( runhandle ) |