summaryrefslogtreecommitdiffstats
path: root/testcases/Controllers/ONOS/Teston/CI/adapters/client.py
diff options
context:
space:
mode:
authorlanqinglong <lanqinglong@huawei.com>2016-01-15 10:28:42 +0800
committerMorgan Richomme <morgan.richomme@orange.com>2016-01-15 08:30:01 +0000
commitb241534d5a37ac93368aec79727238e3aed75d43 (patch)
tree1526e9d3ca3abf8580d9582f4ea3d9317cfefb31 /testcases/Controllers/ONOS/Teston/CI/adapters/client.py
parent822e22975778006780728e2759640fae8d4c1c02 (diff)
Modify ONOS test for CI running
Change-Id: I2ce678c1239920071f9eeb6fe251a92cb3737e6a Signed-off-by: lanqinglong <lanqinglong@huawei.com> (cherry picked from commit be4d2778d535272a3683cb8e518c85065af6a582)
Diffstat (limited to 'testcases/Controllers/ONOS/Teston/CI/adapters/client.py')
-rw-r--r--testcases/Controllers/ONOS/Teston/CI/adapters/client.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/testcases/Controllers/ONOS/Teston/CI/adapters/client.py b/testcases/Controllers/ONOS/Teston/CI/adapters/client.py
index 32e3749f0..535b71f85 100644
--- a/testcases/Controllers/ONOS/Teston/CI/adapters/client.py
+++ b/testcases/Controllers/ONOS/Teston/CI/adapters/client.py
@@ -8,6 +8,8 @@ import os
import time
import pexpect
import re
+import requests
+import json
class client( environment ):
@@ -35,7 +37,7 @@ class client( environment ):
Result = runhandle.expect(["PEXPECT]#", pexpect.EOF, pexpect.TIMEOUT])
curshowscreeninfo = runhandle.before
if (len(lastshowscreeninfo) != len(curshowscreeninfo)):
- print str(curshowscreeninfo)[len(lastshowscreeninfo)::]
+ self.loginfo.log(str(curshowscreeninfo)[len(lastshowscreeninfo)::])
lastshowscreeninfo = curshowscreeninfo
if Result == 0:
print "Done!"
@@ -61,9 +63,14 @@ class client( environment ):
self.loginfo.log('Release onos handle Successful')
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}
headers = {'Content-Type': 'application/json'}
- r = requests.post(url, data=json.dumps(params), headers=headers)
- self.loginfo.log('Pushing result via Northbound, info:' + r )
+ try:
+ r = requests.post(url, data=json.dumps(params), headers=headers)
+ self.loginfo.log(r)
+ except:
+ self.loginfo.log('Error pushing results into Database')