From b241534d5a37ac93368aec79727238e3aed75d43 Mon Sep 17 00:00:00 2001 From: lanqinglong Date: Fri, 15 Jan 2016 10:28:42 +0800 Subject: Modify ONOS test for CI running Change-Id: I2ce678c1239920071f9eeb6fe251a92cb3737e6a Signed-off-by: lanqinglong (cherry picked from commit be4d2778d535272a3683cb8e518c85065af6a582) --- testcases/Controllers/ONOS/Teston/CI/adapters/client.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'testcases/Controllers/ONOS/Teston/CI/adapters/client.py') 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') -- cgit 1.2.3-korg