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
committerQinglong Lan <lanqinglong@huawei.com>2016-01-15 03:11:38 +0000
commitbe4d2778d535272a3683cb8e518c85065af6a582 (patch)
tree1526e9d3ca3abf8580d9582f4ea3d9317cfefb31 /testcases/Controllers/ONOS/Teston/CI/adapters/client.py
parent5509502fa7ebe0555c52afa5d574f4c1bba04eac (diff)
Modify ONOS test for CI running
Change-Id: I2ce678c1239920071f9eeb6fe251a92cb3737e6a Signed-off-by: lanqinglong <lanqinglong@huawei.com>
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')