aboutsummaryrefslogtreecommitdiffstats
path: root/testcases/Controllers/ONOS/Teston/CI/adapters/client.py
diff options
context:
space:
mode:
authorjose.lausuch <jose.lausuch@ericsson.com>2016-04-20 16:03:44 +0200
committerjose.lausuch <jose.lausuch@ericsson.com>2016-04-21 00:01:59 +0200
commitef62824e0471d07a4a3a40c401fc433070d961c6 (patch)
tree6d1bd61e7d49446ba1b1a52bb9978e1c5b88173c /testcases/Controllers/ONOS/Teston/CI/adapters/client.py
parent3a85a34474a9d7a9384f22bce35e7b81177830e3 (diff)
Fix Flake8 Violations in the Functest scripts
JIRA: FUNCTEST-213 Change-Id: I66c02dd6ff12ffb9798ebe44a4cfe7bfc73e76c3 Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
Diffstat (limited to 'testcases/Controllers/ONOS/Teston/CI/adapters/client.py')
-rw-r--r--testcases/Controllers/ONOS/Teston/CI/adapters/client.py47
1 files changed, 26 insertions, 21 deletions
diff --git a/testcases/Controllers/ONOS/Teston/CI/adapters/client.py b/testcases/Controllers/ONOS/Teston/CI/adapters/client.py
index a61670ef..15bb73c9 100644
--- a/testcases/Controllers/ONOS/Teston/CI/adapters/client.py
+++ b/testcases/Controllers/ONOS/Teston/CI/adapters/client.py
@@ -11,21 +11,20 @@ Description:
#
"""
from environment import environment
-import os
import time
import pexpect
-import re
import requests
import json
-class client( environment ):
- def __init__( self ):
- environment.__init__( self )
+class client(environment):
+
+ def __init__(self):
+ environment.__init__(self)
self.loginfo = environment()
self.testcase = ''
- def RunScript( self, handle, testname, timeout=300 ):
+ def RunScript(self, handle, testname, timeout=300):
"""
Run ONOS Test Script
Parameters:
@@ -34,17 +33,21 @@ class client( environment ):
masterpassword: The server password of running ONOS
"""
self.testcase = testname
- self.ChangeTestCasePara( testname, self.masterusername, self.masterpassword )
+ self.ChangeTestCasePara(testname, self.masterusername,
+ self.masterpassword)
runhandle = handle
- runtest = self.home + "/OnosSystemTest/TestON/bin/cli.py run " + testname
+ 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])
+ Result = runhandle.expect(["PEXPECT]#", pexpect.EOF,
+ pexpect.TIMEOUT])
curshowscreeninfo = runhandle.before
- if (len(lastshowscreeninfo) != len(curshowscreeninfo)):
- self.loginfo.log(str(curshowscreeninfo)[len(lastshowscreeninfo)::])
+ if(len(lastshowscreeninfo) != len(curshowscreeninfo)):
+ self.loginfo.log(str(curshowscreeninfo)
+ [len(lastshowscreeninfo)::])
lastshowscreeninfo = curshowscreeninfo
if Result == 0:
print "Done!"
@@ -53,28 +56,30 @@ class client( environment ):
circletime += 1
if circletime > timeout:
break
- self.loginfo.log( "Timeout when running the test, please check!" )
+ self.loginfo.log("Timeout when running the test, please check!")
- def onosstart( self ):
- #This is the compass run machine user&pass,you need to modify
+ def onosstart(self):
+ # This is the compass run machine user&pass,you need to modify
print "Test Begin....."
self.OnosConnectionSet()
masterhandle = self.SSHlogin(self.localhost, self.masterusername,
- self.masterpassword)
- self.OnosEnvSetup( masterhandle )
+ self.masterpassword)
+ self.OnosEnvSetup(masterhandle)
return masterhandle
- def onosclean( self, handle ):
- self.SSHRelease( handle )
+ def onosclean(self, handle):
+ self.SSHRelease(handle)
self.loginfo.log('Release onos handle Successful')
- def push_results_to_db( self, payload, pushornot = 1):
+ def push_results_to_db(self, payload, pushornot=1):
if pushornot != 1:
return 1
url = self.Result_DB + "/results"
- params = {"project_name": "functest", "case_name": "ONOS-" + self.testcase,
- "pod_name": 'huawei-build-2', "details": payload}
+ params = {"project_name": "functest", "case_name": "ONOS-" +
+ self.testcase, "pod_name": 'huawei-build-2',
+ "details": payload}
+
headers = {'Content-Type': 'application/json'}
try:
r = requests.post(url, data=json.dumps(params), headers=headers)