diff options
author | Parth Yadav <parth.yadav@ramanujan.du.ac.in> | 2020-08-26 00:08:29 +0530 |
---|---|---|
committer | Parth Yadav <parth.yadav@ramanujan.du.ac.in> | 2020-08-26 00:11:28 +0530 |
commit | 9fa1356bf9aabd50c4adcec082eedf1410f9a7a7 (patch) | |
tree | 74ce496ab6e85c46360c59da3ff7284d36459aa0 /sdv/docker/sdvstate/validator/airship/airship.py | |
parent | 69f4c631e49c359338cff5c9f5b2c96c6fe6b280 (diff) |
Add support for TestAPI, Reporting and new checks
Adds following new checks:
* ceph_health_check
* prometheus_check
* grafana_check
* elasticsearch_check
* kibana_check
* nagios_check
* elasticsearch_exporter_check
* fluentd_exporter_check
* physical_network_check
* reserved_vnf_cores_check
* isolated_cores_check
* vswitch_pmd_cores_check
* vswitch_dpdk_lcore_check
* os_reserved_cores_check
* nova_scheduler_filters_check
* cpu_allocation_ratio_check
Updated result reporting format to match with TestAPI result formating
Signed-off-by: Parth Yadav<parthyadav3105@gmail.com>
Change-Id: I421fd20067d289e8735a2ed3f402c68f45ae69e9
Diffstat (limited to 'sdv/docker/sdvstate/validator/airship/airship.py')
-rw-r--r-- | sdv/docker/sdvstate/validator/airship/airship.py | 92 |
1 files changed, 84 insertions, 8 deletions
diff --git a/sdv/docker/sdvstate/validator/airship/airship.py b/sdv/docker/sdvstate/validator/airship/airship.py index e77f06f..18de66d 100644 --- a/sdv/docker/sdvstate/validator/airship/airship.py +++ b/sdv/docker/sdvstate/validator/airship/airship.py @@ -18,16 +18,15 @@ Airship Validator """ import logging -import ast -import json +from datetime import datetime as dt from tools.conf import settings -from tools.result_api import result_api, rfile -from tools.kube_utils import * +from tools.kube_utils import load_kube_api from validator.validator import Validator -## Checks -from .pod_health_check import pod_health_check +from . import * + + @@ -42,10 +41,87 @@ class AirshipValidator(Validator): super(AirshipValidator, self).__init__() self._logger = logging.getLogger(__name__) + self._report = {"installer": "Airship", + "criteria": "pass", + "details": {"total_checks": 0, + "pass": [], + "fail": [], + "metadata": {} + } + } + load_kube_api() - + def validate(self): """ + Validation method """ - pod_health_check() + + self._report['scenario'] = 'none' + self._report['case_name'] = 'ook_airship' + self._report['start_date'] = dt.now().strftime('%Y-%m-%d %H:%M:%S') + + + # PLATFORM CHECKS + self.update_report(pod_health_check()) + + # STORAGE CHECKS + self.update_report(ceph_health_check()) + + # MONITORING & LOGGING AGENTS CHECKS + self.update_report(prometheus_check()) + self.update_report(grafana_check()) + ## current version of AlertManager doesn't support this + # prometheus_alert_manager_check() + self.update_report(elasticsearch_check()) + self.update_report(kibana_check()) + self.update_report(nagios_check()) + self.update_report(elasticsearch_exporter_check()) + self.update_report(fluentd_exporter_check()) + + # NETWORK CHECKS + self.update_report(physical_network_check()) + + # COMPUTE CHECKS + self.update_report(reserved_vnf_cores_check()) + self.update_report(isolated_cores_check()) + self.update_report(vswitch_pmd_cores_check()) + self.update_report(vswitch_dpdk_lcores_check()) + self.update_report(os_reserved_cores_check()) + self.update_report(nova_scheduler_filters_check()) + self.update_report(cpu_allocation_ratio_check()) + + self._report['stop_date'] = dt.now().strftime('%Y-%m-%d %H:%M:%S') + + + def update_report(self, result): + """ + Updates report with new results + """ + case_name = result['case_name'] + criteria = result['criteria'] + + self._report['details']['total_checks'] += 1 + if criteria == 'pass': + self._report['details']['pass'].append(case_name) + elif criteria == 'fail': + self._report['details']['fail'].append(case_name) + self._report['criteria'] = 'fail' + + + + def get_report(self): + """ + Return final report as dict + """ + self._report["project_name"] = settings.getValue("project_name") + self._report["version"] = settings.getValue("project_version") + self._report["build_tag"] = "none" + + pdf = settings.getValue('pdf_file') + self._report["pod_name"] = pdf['management_info']['resource_pool_name'] + + store_result(self._report) + + return self._report |