Merge "add qtip reporting"
authorMorgan Richomme <morgan.richomme@orange.com>
Wed, 10 May 2017 12:23:05 +0000 (12:23 +0000)
committerGerrit Code Review <gerrit@opnfv.org>
Wed, 10 May 2017 12:23:05 +0000 (12:23 +0000)
1  2 
utils/test/reporting/reporting.yaml
utils/test/reporting/utils/reporting_utils.py

@@@ -3,6 -3,7 +3,6 @@@ general
      installers:
          - apex
          - compass
 -        - daisy
          - fuel
          - joid
  
@@@ -36,6 -37,7 +36,6 @@@ functest
      blacklist:
          - ovno
          - security_scan
 -        - rally_sanity
          - healthcheck
          - odl_netvirt
          - aaa
          - orchestra_ims
          - juju_epc
          - orchestra
 -        - promise
      max_scenario_criteria: 50
      test_conf: https://git.opnfv.org/cgit/functest/plain/functest/ci/testcases.yaml
      log_level: ERROR
      jenkins_url: https://build.opnfv.org/ci/view/functest/job/
 -    exclude_noha: "False"
 -    exclude_virtual: "False"
 +    exclude_noha: False
 +    exclude_virtual: False
  
  yardstick:
      test_conf: https://git.opnfv.org/cgit/yardstick/plain/tests/ci/report_config.yaml
@@@ -60,6 -63,8 +60,8 @@@ storperf
      log_level: ERROR
  
  qtip:
+     log_level: ERROR
+     period: 1
  
  bottleneck:
  
@@@ -10,7 -10,6 +10,7 @@@ from urllib2 import Request, urlopen, U
  import logging
  import json
  import os
 +import requests
  import pdfkit
  import yaml
  
@@@ -199,6 -198,35 +199,35 @@@ def getScenarioStatus(installer, versio
      return result_dict
  
  
+ def getQtipResults(version, installer):
+     period = get_config('qtip.period')
+     url_base = get_config('testapi.url')
+     url = ("http://" + url_base + "?project=qtip" +
+            "&installer=" + installer +
+            "&version=" + version + "&period=" + str(period))
+     request = Request(url)
+     try:
+         response = urlopen(request)
+         k = response.read()
+         response.close()
+         results = json.loads(k)['results']
+     except URLError as e:
+         print('Got an error code:', e)
+     result_dict = {}
+     if results:
+         for r in results:
+             key = '{}/{}'.format(r['pod_name'], r['scenario'])
+             if key not in result_dict.keys():
+                 result_dict[key] = []
+             result_dict[key].append(r['details']['score'])
+     # return scenario_results
+     return result_dict
  def getNbtestOk(results):
      nb_test_ok = 0
      for r in results:
@@@ -299,44 -327,6 +328,44 @@@ def getScenarioPercent(scenario_score, 
      return score
  
  
 +# *********
 +# Functest
 +# *********
 +def getFunctestConfig(version=""):
 +    config_file = get_config('functest.test_conf') + version
 +    response = requests.get(config_file)
 +    return yaml.safe_load(response.text)
 +
 +
 +def getArchitectures(scenario_results):
 +    supported_arch = ['x86']
 +    if (len(scenario_results) > 0):
 +        for scenario_result in scenario_results.values():
 +            for value in scenario_result:
 +                if ("armband" in value['build_tag']):
 +                    supported_arch.append('aarch64')
 +                    return supported_arch
 +    return supported_arch
 +
 +
 +def filterArchitecture(results, architecture):
 +    filtered_results = {}
 +    for name, results in results.items():
 +        filtered_values = []
 +        for value in results:
 +            if (architecture is "x86"):
 +                # drop aarch64 results
 +                if ("armband" not in value['build_tag']):
 +                    filtered_values.append(value)
 +            elif(architecture is "aarch64"):
 +                # drop x86 results
 +                if ("armband" in value['build_tag']):
 +                    filtered_values.append(value)
 +        if (len(filtered_values) > 0):
 +            filtered_results[name] = filtered_values
 +    return filtered_results
 +
 +
  # *********
  # Yardstick
  # *********
@@@ -406,6 -396,14 +435,14 @@@ def export_csv(scenario_file_name, inst
          scenario_installer_file.close
  
  
+ def generate_csv(scenario_file):
+     import shutil
+     # csv
+     # generate sub files based on scenario_history.txt
+     csv_file = scenario_file.replace('txt', 'csv')
+     shutil.copy2(scenario_file, csv_file)
  def export_pdf(pdf_path, pdf_doc_name):
      try:
          pdfkit.from_file(pdf_path, pdf_doc_name)