+def report(testcase, start_date, stop_date, criteria, details_doc):
+ headers = {'Content-type': 'application/json'}
+ results = {
+ "project_name": "bottlenecks",
+ "case_name": testcase,
+ "description": ("test results for " + testcase),
+ "pod_name": os.environ.get('NODE_NAME', 'unknown'),
+ "installer": os.environ.get('INSTALLER_TYPE', 'unknown'),
+ "version": os.environ.get('BRANCH', 'unknown'),
+ "build_tag": os.environ.get('BUILD_TAG', 'unknown'),
+ "stop_date": stop_date,
+ "start_date": start_date,
+ "criteria": criteria,
+ "scenario": os.environ.get('DEPLOY_SCENARIO', 'unknown')
+ }
+ results['details'] = {"test_results": details_doc}
+
+ target = "http://testresults.opnfv.org/test/api/v1/results"
+ timeout = 5
+
+ try:
+ LOG.debug('Test result : %s', jsonutils.dump_as_bytes(results))
+ print ('Start posting test results to community MongoDB')
+ res = requests.post(target,
+ data=jsonutils.dump_as_bytes(results),
+ headers=headers,
+ timeout=timeout)
+ LOG.debug('Test result posting finished with status code'
+ ' %d.' % res.status_code)
+ print ('Test results posting finished with status code'
+ ' %d.' % res.status_code)
+ except Exception as err:
+ LOG.exception('Failed to record result data: %s', err)
+
+
+def posca_run(test_level, test_name, REPORT="False"):