Merge "Tune sudo settings on server"
authorFatih Degirmenci <fatih.degirmenci@ericsson.com>
Wed, 12 Oct 2016 12:56:49 +0000 (12:56 +0000)
committerGerrit Code Review <gerrit@opnfv.org>
Wed, 12 Oct 2016 12:56:49 +0000 (12:56 +0000)
utils/test/dashboard/dashboard/conf/config.py
utils/test/dashboard/dashboard/elastic2kibana/main.py
utils/test/dashboard/dashboard/elastic2kibana/templates/qpi.json [new file with mode: 0644]
utils/test/dashboard/dashboard/mongo2elastic/format.py
utils/test/dashboard/dashboard/mongo2elastic/main.py
utils/test/dashboard/dashboard/qtip/__init__.py [new file with mode: 0644]
utils/test/dashboard/dashboard/qtip/testcases.yaml [new file with mode: 0644]
utils/test/dashboard/etc/config.ini

index 143b193..48fed88 100644 (file)
@@ -26,7 +26,6 @@ class APIConfig:
         self.es_url = 'http://localhost:9200'
         self.es_creds = None
         self.kibana_url = None
-        self.is_js = True
         self.js_path = None
 
     def _get_str_parameter(self, section, param):
@@ -67,7 +66,6 @@ class APIConfig:
         obj.es_url = obj._get_str_parameter("elastic", "url")
         obj.es_creds = obj._get_str_parameter("elastic", "creds")
         obj.kibana_url = obj._get_str_parameter("kibana", "url")
-        obj.is_js = obj._get_bool_parameter("kibana", "js")
         obj.js_path = obj._get_str_parameter("kibana", "js_path")
 
         return obj
@@ -76,9 +74,7 @@ class APIConfig:
         return "elastic_url = %s \n" \
                "elastic_creds = %s \n" \
                "kibana_url = %s \n" \
-               "is_js = %s \n" \
                "js_path = %s \n" % (self.es_url,
                                     self.es_creds,
                                     self.kibana_url,
-                                    self.is_js,
                                     self.js_path)
index 35a1543..9ee8942 100644 (file)
@@ -64,13 +64,12 @@ class KibanaConstructor(object):
                                                visualizations,
                                                CONF.es_url,
                                                CONF.es_creds)
-                if CONF.is_js:
-                    self._set_js_dict(case,
-                                      pod,
-                                      installer,
-                                      family,
-                                      vis_p.get('name'),
-                                      dashboard.id)
+                self._set_js_dict(case,
+                                  pod,
+                                  installer,
+                                  family,
+                                  vis_p.get('name'),
+                                  dashboard.id)
 
     @staticmethod
     def _construct_visualizations(project,
@@ -112,10 +111,9 @@ class KibanaConstructor(object):
         js_installer[pod] = CONF.kibana_url + '#/dashboard/' + id
 
     def config_js(self):
-        if CONF.is_js:
-            with open(CONF.js_path, 'w+') as conf_js_fdesc:
-                conf_js_fdesc.write('var kibana_dashboard_links = ')
-                conf_js_fdesc.write(str(self.js_dict).replace("u'", "'"))
+        with open(CONF.js_path, 'w+') as conf_js_fdesc:
+            conf_js_fdesc.write('var kibana_dashboard_links = ')
+            conf_js_fdesc.write(str(self.js_dict).replace("u'", "'"))
 
     def _get_pods_and_scenarios(self, project, case, installer):
         query = json.JSONEncoder().encode({
diff --git a/utils/test/dashboard/dashboard/elastic2kibana/templates/qpi.json b/utils/test/dashboard/dashboard/elastic2kibana/templates/qpi.json
new file mode 100644 (file)
index 0000000..a46f315
--- /dev/null
@@ -0,0 +1,45 @@
+{% set aggs = aggs|default([]) -%}
+
+{
+  "title": "qpi",
+  "type": "line",
+  "listeners": {},
+  "params": {
+    "addLegend": true,
+    "shareYAxis": true,
+    "addTooltip": true,
+    "smoothLines": false,
+    "scale": "linear",
+    "interpolate": "linear",
+    "times": [],
+    "addTimeMarker": false,
+    "defaultYExtents": false,
+    "setYExtents": false,
+    "yAxis": {},
+    "mode": "stacked"
+  },
+  "aggs": [
+    {% for agg in aggs %}
+    {
+      "id": {{agg.id }},
+      "type": "avg",
+      "schema": "metric",
+      "params": {
+        "field": "{{agg.field}}"
+      }
+    },
+    {% endfor %}
+    {
+      "id": {{ aggs|length + 1 }},
+      "type": "date_histogram",
+      "schema": "segment",
+      "params": {
+        "field": "start_date",
+        "interval": "auto",
+        "customInterval": "2h",
+        "min_doc_count": 1,
+        "extended_bounds": {}
+      }
+    }
+  ]
+}
index ef485ba..0bbde17 100644 (file)
@@ -184,3 +184,21 @@ def format_vims(testcase):
         }
     }
     return True
+
+
+def format_qpi(testcase):
+    """
+    Look for these and leave any of those:
+        details.index
+
+    If none are present, then return False
+    """
+    details = testcase['details']
+    if 'index' not in details:
+        return False
+
+    for key, value in details.items():
+        if key != 'index':
+            del details[key]
+
+    return True
index a526d53..303d82c 100644 (file)
@@ -91,10 +91,16 @@ class DocumentVerification(object):
         return self.skip
 
     def _fix_date(self, date_string):
+        if date_string == 'None':
+            return None
         if isinstance(date_string, dict):
             return date_string['$date']
-        else:
-            return date_string[:-3].replace(' ', 'T') + 'Z'
+        if 'T' not in date_string:
+            date_string = date_string[:-3].replace(' ', 'T')
+        if not date_string.endswith('Z'):
+            date_string += 'Z'
+
+        return date_string
 
 
 class DocumentPublisher(object):
diff --git a/utils/test/dashboard/dashboard/qtip/__init__.py b/utils/test/dashboard/dashboard/qtip/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/utils/test/dashboard/dashboard/qtip/testcases.yaml b/utils/test/dashboard/dashboard/qtip/testcases.yaml
new file mode 100644 (file)
index 0000000..cd337cd
--- /dev/null
@@ -0,0 +1,28 @@
+qtip:
+    -
+        name: compute_test_suite
+        format: qpi
+        test_family: compute
+        visualizations:
+            -
+                name: qpi
+                fields:
+                    - field: details.index
+    -
+        name: network_test_suite
+        test_family: network
+        format: qpi
+        visualizations:
+            -
+                name: qpi
+                fields:
+                    - field: details.index
+    -
+        name:storage_test_suite
+        format: qpi
+        test_family: storage
+        visualizations:
+            -
+                name: qpi
+                fields:
+                    - field: details.index
index 1e67bd8..d932798 100644 (file)
@@ -6,5 +6,4 @@ creds =
 
 [kibana]
 url = http://10.63.243.17:5601/app/kibana
-js = true
 js_path = /usr/share/nginx/html/kibana_dashboards/conf.js