diff options
Diffstat (limited to 'utils')
-rw-r--r-- | utils/installer-adapter/ApexAdapter.py | 32 | ||||
-rw-r--r-- | utils/installer-adapter/CompassAdapter.py | 32 | ||||
-rw-r--r-- | utils/installer-adapter/FuelAdapter.py | 236 | ||||
-rw-r--r-- | utils/installer-adapter/InstallerHandler.py | 78 | ||||
-rw-r--r-- | utils/installer-adapter/JoidAdapter.py | 32 | ||||
-rw-r--r-- | utils/installer-adapter/RelengLogger.py | 51 | ||||
-rw-r--r-- | utils/installer-adapter/SSHUtils.py | 120 | ||||
-rw-r--r-- | utils/installer-adapter/__init__.py (renamed from utils/test/result_collection_api/update/templates/__init__.py) | 0 | ||||
-rw-r--r-- | utils/installer-adapter/example.py | 22 | ||||
-rw-r--r-- | utils/test/dashboard/README.rst | 0 | ||||
-rw-r--r-- | utils/test/dashboard/dashboard/conf/config.py | 8 | ||||
-rw-r--r-- | utils/test/dashboard/dashboard/conf/testcases.py | 2 | ||||
-rw-r--r-- | utils/test/dashboard/dashboard/elastic2kibana/dashboard_assembler.py | 2 | ||||
-rw-r--r-- | utils/test/dashboard/dashboard/elastic2kibana/main.py | 16 | ||||
-rw-r--r-- | utils/test/dashboard/dashboard/elastic2kibana/utility.py | 2 | ||||
-rw-r--r-- | utils/test/dashboard/dashboard/elastic2kibana/visualization_assembler.py | 2 | ||||
-rw-r--r-- | utils/test/dashboard/dashboard/elastic2kibana_main.py | 4 | ||||
-rw-r--r-- | utils/test/dashboard/dashboard/functest/format.py (renamed from utils/test/dashboard/dashboard/mongo2elastic/format.py) | 18 | ||||
-rw-r--r-- | utils/test/dashboard/dashboard/mongo2elastic/main.py | 22 | ||||
-rw-r--r-- | utils/test/dashboard/dashboard/mongo2elastic_main.py | 4 | ||||
-rw-r--r-- | utils/test/dashboard/dashboard/qtip/format.py | 19 | ||||
-rw-r--r-- | utils/test/dashboard/etc/config.ini | 1 | ||||
-rwxr-xr-x | utils/test/dashboard/install.sh | 54 | ||||
-rw-r--r-- | utils/test/dashboard/setup.cfg | 43 | ||||
-rw-r--r-- | utils/test/dashboard/setup.py | 8 | ||||
-rwxr-xr-x | utils/test/reporting/functest/reporting-status.py | 81 | ||||
-rw-r--r-- | utils/test/reporting/functest/reportingUtils.py | 8 | ||||
-rw-r--r-- | utils/test/reporting/yardstick/reporting-status.py | 50 | ||||
-rw-r--r-- | utils/test/reporting/yardstick/reportingUtils.py | 21 | ||||
-rw-r--r-- | utils/test/reporting/yardstick/scenarioResult.py | 7 | ||||
-rw-r--r-- | utils/test/reporting/yardstick/template/index-status-tmpl.html | 63 | ||||
-rw-r--r-- | utils/test/testapi/3rd_party/static/.gitignore (renamed from utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/.gitignore) | 0 | ||||
-rw-r--r-- | utils/test/testapi/3rd_party/static/css/highlight.default.css (renamed from utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/css/highlight.default.css) | 0 | ||||
-rw-r--r-- | utils/test/testapi/3rd_party/static/css/hightlight.default.css (renamed from utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/css/hightlight.default.css) | 0 | ||||
-rw-r--r-- | utils/test/testapi/3rd_party/static/css/screen.css (renamed from utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/css/screen.css) | 0 | ||||
-rw-r--r-- | utils/test/testapi/3rd_party/static/endpoint.html (renamed from utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/endpoint.html) | 0 | ||||
-rw-r--r-- | utils/test/testapi/3rd_party/static/images/explorer_icons.png (renamed from utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/images/explorer_icons.png) | bin | 5763 -> 5763 bytes | |||
-rw-r--r-- | utils/test/testapi/3rd_party/static/images/logo_small.png (renamed from utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/images/logo_small.png) | bin | 770 -> 770 bytes | |||
-rw-r--r-- | utils/test/testapi/3rd_party/static/images/pet_store_api.png (renamed from utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/images/pet_store_api.png) | bin | 824 -> 824 bytes | |||
-rw-r--r-- | utils/test/testapi/3rd_party/static/images/throbber.gif (renamed from utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/images/throbber.gif) | bin | 9257 -> 9257 bytes | |||
-rw-r--r-- | utils/test/testapi/3rd_party/static/images/wordnik_api.png (renamed from utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/images/wordnik_api.png) | bin | 980 -> 980 bytes | |||
-rw-r--r-- | utils/test/testapi/3rd_party/static/index.html (renamed from utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/index.html) | 0 | ||||
-rw-r--r-- | utils/test/testapi/3rd_party/static/lib/backbone-min.js (renamed from utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/lib/backbone-min.js) | 0 | ||||
-rw-r--r-- | utils/test/testapi/3rd_party/static/lib/handlebars-1.0.0.js (renamed from utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/lib/handlebars-1.0.0.js) | 0 | ||||
-rw-r--r-- | utils/test/testapi/3rd_party/static/lib/highlight.7.3.pack.js (renamed from utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/lib/highlight.7.3.pack.js) | 0 | ||||
-rw-r--r-- | utils/test/testapi/3rd_party/static/lib/jquery-1.8.0.min.js (renamed from utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/lib/jquery-1.8.0.min.js) | 0 | ||||
-rw-r--r-- | utils/test/testapi/3rd_party/static/lib/jquery.ba-bbq.min.js (renamed from utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/lib/jquery.ba-bbq.min.js) | 0 | ||||
-rw-r--r-- | utils/test/testapi/3rd_party/static/lib/jquery.slideto.min.js (renamed from utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/lib/jquery.slideto.min.js) | 0 | ||||
-rw-r--r-- | utils/test/testapi/3rd_party/static/lib/jquery.wiggle.min.js (renamed from utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/lib/jquery.wiggle.min.js) | 0 | ||||
-rw-r--r-- | utils/test/testapi/3rd_party/static/lib/shred.bundle.js (renamed from utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/lib/shred.bundle.js) | 0 | ||||
-rw-r--r-- | utils/test/testapi/3rd_party/static/lib/shred/content.js (renamed from utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/lib/shred/content.js) | 0 | ||||
-rw-r--r-- | utils/test/testapi/3rd_party/static/lib/swagger-oauth.js (renamed from utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/lib/swagger-oauth.js) | 0 | ||||
-rw-r--r-- | utils/test/testapi/3rd_party/static/lib/swagger.js (renamed from utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/lib/swagger.js) | 0 | ||||
-rw-r--r-- | utils/test/testapi/3rd_party/static/lib/underscore-min.js (renamed from utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/lib/underscore-min.js) | 0 | ||||
-rw-r--r-- | utils/test/testapi/3rd_party/static/o2c.html (renamed from utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/o2c.html) | 0 | ||||
-rw-r--r-- | utils/test/testapi/3rd_party/static/swagger-ui.js (renamed from utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/swagger-ui.js) | 0 | ||||
-rw-r--r-- | utils/test/testapi/3rd_party/static/swagger-ui.min.js (renamed from utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/swagger-ui.min.js) | 0 | ||||
-rw-r--r-- | utils/test/testapi/README.rst (renamed from utils/test/result_collection_api/README.rst) | 2 | ||||
-rw-r--r-- | utils/test/testapi/docker/Dockerfile (renamed from utils/test/result_collection_api/docker/Dockerfile) | 2 | ||||
-rwxr-xr-x | utils/test/testapi/docker/prepare-env.sh (renamed from utils/test/result_collection_api/docker/prepare-env.sh) | 0 | ||||
-rwxr-xr-x | utils/test/testapi/docker/start-server.sh (renamed from utils/test/result_collection_api/docker/start-server.sh) | 0 | ||||
-rw-r--r-- | utils/test/testapi/etc/config.ini (renamed from utils/test/result_collection_api/etc/config.ini) | 0 | ||||
-rwxr-xr-x | utils/test/testapi/install.sh | 20 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/__init__.py (renamed from utils/test/result_collection_api/opnfv_testapi/__init__.py) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/cmd/__init__.py (renamed from utils/test/result_collection_api/opnfv_testapi/cmd/__init__.py) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/cmd/server.py (renamed from utils/test/result_collection_api/opnfv_testapi/cmd/server.py) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/common/__init__.py (renamed from utils/test/result_collection_api/opnfv_testapi/common/__init__.py) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/common/config.py (renamed from utils/test/result_collection_api/opnfv_testapi/common/config.py) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/common/constants.py (renamed from utils/test/result_collection_api/opnfv_testapi/common/constants.py) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/resources/__init__.py (renamed from utils/test/result_collection_api/opnfv_testapi/resources/__init__.py) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/resources/handlers.py (renamed from utils/test/result_collection_api/opnfv_testapi/resources/handlers.py) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/resources/models.py (renamed from utils/test/result_collection_api/opnfv_testapi/resources/models.py) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/resources/pod_handlers.py (renamed from utils/test/result_collection_api/opnfv_testapi/resources/pod_handlers.py) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/resources/pod_models.py (renamed from utils/test/result_collection_api/opnfv_testapi/resources/pod_models.py) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/resources/project_handlers.py (renamed from utils/test/result_collection_api/opnfv_testapi/resources/project_handlers.py) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/resources/project_models.py (renamed from utils/test/result_collection_api/opnfv_testapi/resources/project_models.py) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/resources/result_handlers.py (renamed from utils/test/result_collection_api/opnfv_testapi/resources/result_handlers.py) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/resources/result_models.py (renamed from utils/test/result_collection_api/opnfv_testapi/resources/result_models.py) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/resources/testcase_handlers.py (renamed from utils/test/result_collection_api/opnfv_testapi/resources/testcase_handlers.py) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/resources/testcase_models.py (renamed from utils/test/result_collection_api/opnfv_testapi/resources/testcase_models.py) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/router/__init__.py (renamed from utils/test/result_collection_api/opnfv_testapi/router/__init__.py) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/router/url_mappings.py (renamed from utils/test/result_collection_api/opnfv_testapi/router/url_mappings.py) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/tests/__init__.py (renamed from utils/test/result_collection_api/opnfv_testapi/tests/__init__.py) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/tests/unit/__init__.py (renamed from utils/test/result_collection_api/opnfv_testapi/tests/unit/__init__.py) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/tests/unit/fake_pymongo.py (renamed from utils/test/result_collection_api/opnfv_testapi/tests/unit/fake_pymongo.py) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/tests/unit/test_base.py (renamed from utils/test/result_collection_api/opnfv_testapi/tests/unit/test_base.py) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/tests/unit/test_fake_pymongo.py (renamed from utils/test/result_collection_api/opnfv_testapi/tests/unit/test_fake_pymongo.py) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/tests/unit/test_pod.py (renamed from utils/test/result_collection_api/opnfv_testapi/tests/unit/test_pod.py) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/tests/unit/test_project.py (renamed from utils/test/result_collection_api/opnfv_testapi/tests/unit/test_project.py) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/tests/unit/test_result.py (renamed from utils/test/result_collection_api/opnfv_testapi/tests/unit/test_result.py) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/tests/unit/test_testcase.py (renamed from utils/test/result_collection_api/opnfv_testapi/tests/unit/test_testcase.py) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/tests/unit/test_version.py (renamed from utils/test/result_collection_api/opnfv_testapi/tests/unit/test_version.py) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/tornado_swagger/README.md (renamed from utils/test/result_collection_api/opnfv_testapi/tornado_swagger/README.md) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/tornado_swagger/__init__.py (renamed from utils/test/result_collection_api/opnfv_testapi/tornado_swagger/__init__.py) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/tornado_swagger/handlers.py (renamed from utils/test/result_collection_api/opnfv_testapi/tornado_swagger/handlers.py) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/tornado_swagger/settings.py (renamed from utils/test/result_collection_api/opnfv_testapi/tornado_swagger/settings.py) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/tornado_swagger/swagger.py (renamed from utils/test/result_collection_api/opnfv_testapi/tornado_swagger/swagger.py) | 0 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/tornado_swagger/views.py (renamed from utils/test/result_collection_api/opnfv_testapi/tornado_swagger/views.py) | 0 | ||||
-rw-r--r-- | utils/test/testapi/requirements.txt (renamed from utils/test/result_collection_api/requirements.txt) | 0 | ||||
-rwxr-xr-x | utils/test/testapi/run_test.sh (renamed from utils/test/result_collection_api/run_test.sh) | 0 | ||||
-rw-r--r-- | utils/test/testapi/setup.cfg (renamed from utils/test/result_collection_api/setup.cfg) | 0 | ||||
-rw-r--r-- | utils/test/testapi/setup.py (renamed from utils/test/result_collection_api/setup.py) | 0 | ||||
-rw-r--r-- | utils/test/testapi/test-requirements.txt (renamed from utils/test/result_collection_api/test-requirements.txt) | 0 | ||||
-rw-r--r-- | utils/test/testapi/update/README.md (renamed from utils/test/result_collection_api/update/README.md) | 0 | ||||
-rw-r--r-- | utils/test/testapi/update/__init__.py (renamed from utils/test/result_collection_api/update/__init__.py) | 0 | ||||
-rwxr-xr-x | utils/test/testapi/update/playbook-update.sh (renamed from utils/test/result_collection_api/update/playbook-update.sh) | 0 | ||||
-rw-r--r-- | utils/test/testapi/update/templates/__init__.py | 0 | ||||
-rw-r--r-- | utils/test/testapi/update/templates/backup_mongodb.py (renamed from utils/test/result_collection_api/update/templates/backup_mongodb.py) | 0 | ||||
-rw-r--r-- | utils/test/testapi/update/templates/changes_in_mongodb.py (renamed from utils/test/result_collection_api/update/templates/changes_in_mongodb.py) | 0 | ||||
-rw-r--r-- | utils/test/testapi/update/templates/restore_mongodb.py (renamed from utils/test/result_collection_api/update/templates/restore_mongodb.py) | 0 | ||||
-rwxr-xr-x | utils/test/testapi/update/templates/rm_images.sh (renamed from utils/test/result_collection_api/update/templates/rm_images.sh) | 0 | ||||
-rw-r--r-- | utils/test/testapi/update/templates/rm_olds.sh (renamed from utils/test/result_collection_api/update/templates/rm_olds.sh) | 0 | ||||
-rw-r--r-- | utils/test/testapi/update/templates/update_mongodb.py (renamed from utils/test/result_collection_api/update/templates/update_mongodb.py) | 0 | ||||
-rw-r--r-- | utils/test/testapi/update/templates/utils.py (renamed from utils/test/result_collection_api/update/templates/utils.py) | 0 | ||||
-rw-r--r-- | utils/test/testapi/update/test.yml (renamed from utils/test/result_collection_api/update/test.yml) | 0 | ||||
-rw-r--r-- | utils/test/testapi/update/update.yml (renamed from utils/test/result_collection_api/update/update.yml) | 0 | ||||
-rw-r--r-- | utils/test/testapi/update/update_api.py (renamed from utils/test/result_collection_api/update/update_api.py) | 0 |
117 files changed, 938 insertions, 124 deletions
diff --git a/utils/installer-adapter/ApexAdapter.py b/utils/installer-adapter/ApexAdapter.py new file mode 100644 index 000000000..17a27b10a --- /dev/null +++ b/utils/installer-adapter/ApexAdapter.py @@ -0,0 +1,32 @@ +############################################################################## +# Copyright (c) 2016 Ericsson AB and others. +# Author: Jose Lausuch (jose.lausuch@ericsson.com) +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + + +class ApexAdapter: + + def __init__(self, installer_ip): + self.installer_ip = installer_ip + + def get_deployment_info(self): + pass + + def get_nodes(self): + pass + + def get_controller_ips(self): + pass + + def get_compute_ips(self): + pass + + def get_file_from_installer(self, origin, target, options=None): + pass + + def get_file_from_controller(self, origin, target, ip=None, options=None): + pass diff --git a/utils/installer-adapter/CompassAdapter.py b/utils/installer-adapter/CompassAdapter.py new file mode 100644 index 000000000..47cbc646d --- /dev/null +++ b/utils/installer-adapter/CompassAdapter.py @@ -0,0 +1,32 @@ +############################################################################## +# Copyright (c) 2016 Ericsson AB and others. +# Author: Jose Lausuch (jose.lausuch@ericsson.com) +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + + +class CompassAdapter: + + def __init__(self, installer_ip): + self.installer_ip = installer_ip + + def get_deployment_info(self): + pass + + def get_nodes(self): + pass + + def get_controller_ips(self): + pass + + def get_compute_ips(self): + pass + + def get_file_from_installer(self, origin, target, options=None): + pass + + def get_file_from_controller(self, origin, target, ip=None, options=None): + pass diff --git a/utils/installer-adapter/FuelAdapter.py b/utils/installer-adapter/FuelAdapter.py new file mode 100644 index 000000000..672fd5175 --- /dev/null +++ b/utils/installer-adapter/FuelAdapter.py @@ -0,0 +1,236 @@ +############################################################################## +# Copyright (c) 2016 Ericsson AB and others. +# Author: Jose Lausuch (jose.lausuch@ericsson.com) +# George Paraskevopoulos (geopar@intracom-telecom.com) +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +import SSHUtils as ssh_utils +import RelengLogger as rl + + +class FuelAdapter: + + def __init__(self, installer_ip, user="root", password="r00tme"): + self.installer_ip = installer_ip + self.installer_user = user + self.installer_password = password + self.installer_connection = ssh_utils.get_ssh_client( + installer_ip, + self.installer_user, + password=self.installer_password) + self.logger = rl.Logger("Handler").getLogger() + + def runcmd_fuel_installer(self, cmd): + _, stdout, stderr = (self + .installer_connection + .exec_command(cmd)) + error = stderr.readlines() + if len(error) > 0: + self.logger.error("error %s" % ''.join(error)) + return error + output = ''.join(stdout.readlines()) + return output + + def runcmd_fuel_nodes(self): + return self.runcmd_fuel_installer('fuel nodes') + + def runcmd_fuel_env(self): + return self.runcmd_fuel_installer('fuel env') + + def get_clusters(self): + environments = [] + output = self.runcmd_fuel_env() + lines = output.rsplit('\n') + if len(lines) < 2: + self.logger.infp("No environments found in the deployment.") + return None + else: + fields = lines[0].rsplit(' | ') + + index_id = -1 + index_status = -1 + index_name = -1 + index_release_id = -1 + + for i in range(0, len(fields) - 1): + if "id" in fields[i]: + index_id = i + elif "status" in fields[i]: + index_status = i + elif "name" in fields[i]: + index_name = i + elif "release_id" in fields[i]: + index_release_id = i + + # order env info + for i in range(2, len(lines) - 1): + fields = lines[i].rsplit(' | ') + dict = {"id": fields[index_id].strip(), + "status": fields[index_status].strip(), + "name": fields[index_name].strip(), + "release_id": fields[index_release_id].strip()} + environments.append(dict) + + return environments + + def get_nodes(self, options=None): + nodes = [] + output = self.runcmd_fuel_nodes() + lines = output.rsplit('\n') + if len(lines) < 2: + self.logger.info("No nodes found in the deployment.") + return None + else: + # get fields indexes + fields = lines[0].rsplit(' | ') + + index_id = -1 + index_status = -1 + index_name = -1 + index_cluster = -1 + index_ip = -1 + index_mac = -1 + index_roles = -1 + index_online = -1 + + for i in range(0, len(fields) - 1): + if "id" in fields[i]: + index_id = i + elif "status" in fields[i]: + index_status = i + elif "name" in fields[i]: + index_name = i + elif "cluster" in fields[i]: + index_cluster = i + elif "ip" in fields[i]: + index_ip = i + elif "mac" in fields[i]: + index_mac = i + elif "roles " in fields[i]: + index_roles = i + elif "online" in fields[i]: + index_online = i + + # order nodes info + for i in range(2, len(lines) - 1): + fields = lines[i].rsplit(' | ') + dict = {"id": fields[index_id].strip(), + "status": fields[index_status].strip(), + "name": fields[index_name].strip(), + "cluster": fields[index_cluster].strip(), + "ip": fields[index_ip].strip(), + "mac": fields[index_mac].strip(), + "roles": fields[index_roles].strip(), + "online": fields[index_online].strip()} + if options and options['cluster']: + if fields[index_cluster].strip() == options['cluster']: + nodes.append(dict) + else: + nodes.append(dict) + + return nodes + + def get_controller_ips(self, options): + nodes = self.get_nodes(options=options) + controllers = [] + for node in nodes: + if "controller" in node["roles"]: + controllers.append(node['ip']) + return controllers + + def get_compute_ips(self, options=None): + nodes = self.get_nodes(options=options) + computes = [] + for node in nodes: + if "compute" in node["roles"]: + computes.append(node['ip']) + return computes + + def get_deployment_info(self): + str = "Deployment details:\n" + str += "\tInstaller: Fuel\n" + str += "\tScenario: Unknown\n" + sdn = "None" + clusters = self.get_clusters() + str += "\tN.Clusters: %s\n" % len(clusters) + for cluster in clusters: + cluster_dic = {'cluster': cluster['id']} + str += "\tCluster info:\n" + str += "\t ID: %s\n" % cluster['id'] + str += "\t NAME: %s\n" % cluster['name'] + str += "\t STATUS: %s\n" % cluster['status'] + nodes = self.get_nodes(options=cluster_dic) + num_nodes = len(nodes) + for node in nodes: + if "opendaylight" in node['roles']: + sdn = "OpenDaylight" + elif "onos" in node['roles']: + sdn = "ONOS" + num_controllers = len( + self.get_controller_ips(options=cluster_dic)) + num_computes = len(self.get_compute_ips(options=cluster_dic)) + ha = False + if num_controllers > 1: + ha = True + + str += "\t HA: %s\n" % ha + str += "\t NUM.NODES: %s\n" % num_nodes + str += "\t CONTROLLERS: %s\n" % num_controllers + str += "\t COMPUTES: %s\n" % num_computes + str += "\t SDN CONTR.: %s\n\n" % sdn + str += self.runcmd_fuel_nodes() + return str + + def get_file_from_installer(self, remote_path, local_path, options=None): + self.logger.debug("Fetching %s from %s" % + (remote_path, self.installer_ip)) + get_file_result = ssh_utils.get_file(self.installer_connection, + remote_path, + local_path) + if get_file_result is None: + self.logger.error("SFTP failed to retrieve the file.") + return 1 + self.logger.info("%s successfully copied from Fuel to %s" % + (remote_path, local_path)) + + def get_file_from_controller(self, + remote_path, + local_path, + ip=None, + user='root', + options=None): + if ip is None: + controllers = self.get_controller_ips(options=options) + if len(controllers) == 0: + self.logger.info("No controllers found in the deployment.") + return 1 + else: + target_ip = controllers[0] + else: + target_ip = ip + + installer_jumphost = { + 'ip': self.installer_ip, + 'username': self.installer_user, + 'password': self.installer_password + } + controller_conn = ssh_utils.get_ssh_client( + target_ip, + user, + jumphost=installer_jumphost) + + self.logger.debug("Fetching %s from %s" % + (remote_path, target_ip)) + + get_file_result = ssh_utils.get_file(controller_conn, + remote_path, + local_path) + if get_file_result is None: + self.logger.error("SFTP failed to retrieve the file.") + return 1 + self.logger.info("%s successfully copied from %s to %s" % + (remote_path, target_ip, local_path)) diff --git a/utils/installer-adapter/InstallerHandler.py b/utils/installer-adapter/InstallerHandler.py new file mode 100644 index 000000000..b81b806ca --- /dev/null +++ b/utils/installer-adapter/InstallerHandler.py @@ -0,0 +1,78 @@ +############################################################################## +# Copyright (c) 2015 Ericsson AB and others. +# Author: Jose Lausuch (jose.lausuch@ericsson.com) +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +from FuelAdapter import FuelAdapter +from ApexAdapter import ApexAdapter +from CompassAdapter import CompassAdapter +from JoidAdapter import JoidAdapter + + +INSTALLERS = ["fuel", "apex", "compass", "joid"] + + +class InstallerHandler: + + def __init__(self, + installer, + installer_ip, + installer_user, + installer_pwd=None): + self.installer = installer.lower() + self.installer_ip = installer_ip + self.installer_user = installer_user + self.installer_pwd = installer_pwd + + if self.installer == INSTALLERS[0]: + self.InstallerAdapter = FuelAdapter(self.installer_ip, + self.installer_user, + self.installer_pwd) + elif self.installer == INSTALLERS[1]: + self.InstallerAdapter = ApexAdapter(self.installer_ip) + elif self.installer == INSTALLERS[2]: + self.InstallerAdapter = CompassAdapter(self.installer_ip) + elif self.installer == INSTALLERS[3]: + self.InstallerAdapter = JoidAdapter(self.installer_ip) + else: + print("Installer %s is not valid. " + "Please use one of the followings: %s" + % (self.installer, INSTALLERS)) + exit(1) + + def get_deployment_info(self): + return self.InstallerAdapter.get_deployment_info() + + def get_nodes(self, options=None): + return self.InstallerAdapter.get_nodes(options=options) + + def get_controller_ips(self, options=None): + return self.InstallerAdapter.get_controller_ips(options=options) + + def get_compute_ips(self, options=None): + return self.InstallerAdapter.get_compute_ips(options=options) + + def get_file_from_installer(self, + remote_path, + local_path, + options=None): + return self.InstallerAdapter.get_file_from_installer(remote_path, + local_path, + options=options) + + def get_file_from_controller(self, + remote_path, + local_path, + ip=None, + options=None): + return self.InstallerAdapter.get_file_from_controller(remote_path, + local_path, + ip=ip, + options=options) + + def get_all(self): + pass diff --git a/utils/installer-adapter/JoidAdapter.py b/utils/installer-adapter/JoidAdapter.py new file mode 100644 index 000000000..be8c2ebac --- /dev/null +++ b/utils/installer-adapter/JoidAdapter.py @@ -0,0 +1,32 @@ +############################################################################## +# Copyright (c) 2016 Ericsson AB and others. +# Author: Jose Lausuch (jose.lausuch@ericsson.com) +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + + +class JoidAdapter: + + def __init__(self, installer_ip): + self.installer_ip = installer_ip + + def get_deployment_info(self): + pass + + def get_nodes(self): + pass + + def get_controller_ips(self): + pass + + def get_compute_ips(self): + pass + + def get_file_from_installer(self, origin, target, options=None): + pass + + def get_file_from_controller(self, origin, target, ip=None, options=None): + pass diff --git a/utils/installer-adapter/RelengLogger.py b/utils/installer-adapter/RelengLogger.py new file mode 100644 index 000000000..6fa4ef2e2 --- /dev/null +++ b/utils/installer-adapter/RelengLogger.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python +# +# jose.lausuch@ericsson.com +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Logging levels: +# Level Numeric value +# CRITICAL 50 +# ERROR 40 +# WARNING 30 +# INFO 20 +# DEBUG 10 +# NOTSET 0 +# +# Usage: +# import RelengLogger as rl +# logger = fl.Logger("script_name").getLogger() +# logger.info("message to be shown with - INFO - ") +# logger.debug("message to be shown with - DEBUG -") + +import logging + + +class Logger: + + def __init__(self, logger_name, level="INFO"): + + self.logger = logging.getLogger(logger_name) + self.logger.propagate = 0 + self.logger.setLevel(logging.DEBUG) + + ch = logging.StreamHandler() + formatter = logging.Formatter('%(asctime)s - %(name)s - ' + '%(levelname)s - %(message)s') + ch.setFormatter(formatter) + if level.lower() == "debug": + ch.setLevel(logging.DEBUG) + else: + ch.setLevel(logging.INFO) + self.logger.addHandler(ch) + + hdlr = logging.FileHandler('/tmp/releng.log') + hdlr.setFormatter(formatter) + hdlr.setLevel(logging.DEBUG) + self.logger.addHandler(hdlr) + + def getLogger(self): + return self.logger diff --git a/utils/installer-adapter/SSHUtils.py b/utils/installer-adapter/SSHUtils.py new file mode 100644 index 000000000..c93888694 --- /dev/null +++ b/utils/installer-adapter/SSHUtils.py @@ -0,0 +1,120 @@ +############################################################################## +# Copyright (c) 2015 Ericsson AB and others. +# Authors: George Paraskevopoulos (geopar@intracom-telecom.com) +# Jose Lausuch (jose.lausuch@ericsson.com) +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + + +import paramiko +import RelengLogger as rl +import os + +logger = rl.Logger('SSHUtils').getLogger() + + +def get_ssh_client(hostname, username, password=None, jumphost=None): + client = None + try: + if jumphost is None: + client = paramiko.SSHClient() + else: + client = JumpHostHopClient() + client.configure_jump_host(jumphost['ip'], + jumphost['username'], + jumphost['password']) + + if client is None: + raise Exception('Could not connect to client') + + client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + client.connect(hostname, + username=username, + password=password) + return client + except Exception, e: + logger.error(e) + return None + + +def get_file(ssh_conn, src, dest): + try: + sftp = ssh_conn.open_sftp() + sftp.get(src, dest) + return True + except Exception, e: + logger.error("Error [get_file(ssh_conn, '%s', '%s']: %s" % + (src, dest, e)) + return None + + +def put_file(ssh_conn, src, dest): + try: + sftp = ssh_conn.open_sftp() + sftp.put(src, dest) + return True + except Exception, e: + logger.error("Error [put_file(ssh_conn, '%s', '%s']: %s" % + (src, dest, e)) + return None + + +class JumpHostHopClient(paramiko.SSHClient): + ''' + Connect to a remote server using a jumphost hop + ''' + def __init__(self, *args, **kwargs): + self.logger = rl.Logger("JumpHostHopClient").getLogger() + self.jumphost_ssh = None + self.jumphost_transport = None + self.jumphost_channel = None + self.jumphost_ip = None + self.jumphost_ssh_key = None + self.local_ssh_key = os.path.join(os.getcwd(), 'id_rsa') + super(JumpHostHopClient, self).__init__(*args, **kwargs) + + def configure_jump_host(self, jh_ip, jh_user, jh_pass, + jh_ssh_key='/root/.ssh/id_rsa'): + self.jumphost_ip = jh_ip + self.jumphost_ssh_key = jh_ssh_key + self.jumphost_ssh = paramiko.SSHClient() + self.jumphost_ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + self.jumphost_ssh.connect(jh_ip, + username=jh_user, + password=jh_pass) + self.jumphost_transport = self.jumphost_ssh.get_transport() + + def connect(self, hostname, port=22, username='root', password=None, + pkey=None, key_filename=None, timeout=None, allow_agent=True, + look_for_keys=True, compress=False, sock=None, gss_auth=False, + gss_kex=False, gss_deleg_creds=True, gss_host=None, + banner_timeout=None): + try: + if self.jumphost_ssh is None: + raise Exception('You must configure the jump ' + 'host before calling connect') + + get_file_res = get_file(self.jumphost_ssh, + self.jumphost_ssh_key, + self.local_ssh_key) + if get_file_res is None: + raise Exception('Could\'t fetch SSH key from jump host') + jumphost_key = (paramiko.RSAKey + .from_private_key_file(self.local_ssh_key)) + + self.jumphost_channel = self.jumphost_transport.open_channel( + "direct-tcpip", + (hostname, 22), + (self.jumphost_ip, 22)) + + self.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + super(JumpHostHopClient, self).connect(hostname, + username=username, + pkey=jumphost_key, + sock=self.jumphost_channel) + os.remove(self.local_ssh_key) + except Exception, e: + self.logger.error(e) diff --git a/utils/test/result_collection_api/update/templates/__init__.py b/utils/installer-adapter/__init__.py index e69de29bb..e69de29bb 100644 --- a/utils/test/result_collection_api/update/templates/__init__.py +++ b/utils/installer-adapter/__init__.py diff --git a/utils/installer-adapter/example.py b/utils/installer-adapter/example.py new file mode 100644 index 000000000..804d79c3d --- /dev/null +++ b/utils/installer-adapter/example.py @@ -0,0 +1,22 @@ +# This is an example of usage of this Tool +# Author: Jose Lausuch (jose.lausuch@ericsson.com) + +from InstallerHandler import InstallerHandler + +fuel_handler = InstallerHandler(installer='fuel', + installer_ip='10.20.0.2', + installer_user='root', + installer_pwd='r00tme') +print("Nodes in cluster 1:\n%s\n" % + fuel_handler.get_nodes(options={'cluster': '1'})) +print("Nodes in cluster 2:\n%s\n" % + fuel_handler.get_nodes(options={'cluster': '2'})) +print("Nodes:\n%s\n" % fuel_handler.get_nodes()) +print("Controller nodes:\n%s\n" % fuel_handler.get_controller_ips()) +print("Compute nodes:\n%s\n" % fuel_handler.get_compute_ips()) +print("\n%s\n" % fuel_handler.get_deployment_info()) +fuel_handler.get_file_from_installer('/root/deploy/dea.yaml', './dea.yaml') +fuel_handler.get_file_from_controller( + '/etc/neutron/neutron.conf', './neutron.conf') +fuel_handler.get_file_from_controller( + '/root/openrc', './openrc') diff --git a/utils/test/dashboard/README.rst b/utils/test/dashboard/README.rst new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/utils/test/dashboard/README.rst diff --git a/utils/test/dashboard/dashboard/conf/config.py b/utils/test/dashboard/dashboard/conf/config.py index 48fed8894..6114e90a9 100644 --- a/utils/test/dashboard/dashboard/conf/config.py +++ b/utils/test/dashboard/dashboard/conf/config.py @@ -1,5 +1,6 @@ #! /usr/bin/env python +import urlparse from ConfigParser import SafeConfigParser, NoOptionError @@ -22,11 +23,12 @@ class APIConfig: """ def __init__(self): - self._default_config_location = "../etc/config.ini" + self._default_config_location = "/etc/dashboard/config.ini" self.es_url = 'http://localhost:9200' self.es_creds = None self.kibana_url = None self.js_path = None + self.index_url = None def _get_str_parameter(self, section, param): try: @@ -67,6 +69,8 @@ class APIConfig: obj.es_creds = obj._get_str_parameter("elastic", "creds") obj.kibana_url = obj._get_str_parameter("kibana", "url") obj.js_path = obj._get_str_parameter("kibana", "js_path") + index = obj._get_str_parameter("elastic", "index") + obj.index_url = urlparse.urljoin(obj.es_url, index) return obj @@ -74,7 +78,9 @@ class APIConfig: return "elastic_url = %s \n" \ "elastic_creds = %s \n" \ "kibana_url = %s \n" \ + "index_url = %s \n" \ "js_path = %s \n" % (self.es_url, self.es_creds, self.kibana_url, + self.index_url, self.js_path) diff --git a/utils/test/dashboard/dashboard/conf/testcases.py b/utils/test/dashboard/dashboard/conf/testcases.py index e120987dd..ff801b4c9 100644 --- a/utils/test/dashboard/dashboard/conf/testcases.py +++ b/utils/test/dashboard/dashboard/conf/testcases.py @@ -1,7 +1,7 @@ import yaml -with open('./functest/testcases.yaml') as f: +with open('/etc/dashboard/testcases.yaml') as f: testcases_yaml = yaml.safe_load(f) f.close() diff --git a/utils/test/dashboard/dashboard/elastic2kibana/dashboard_assembler.py b/utils/test/dashboard/dashboard/elastic2kibana/dashboard_assembler.py index da7ccfc24..651168bbb 100644 --- a/utils/test/dashboard/dashboard/elastic2kibana/dashboard_assembler.py +++ b/utils/test/dashboard/dashboard/elastic2kibana/dashboard_assembler.py @@ -1,7 +1,7 @@ import json import utility -from common import elastic_access +from dashboard.common import elastic_access class DashboardAssembler(object): diff --git a/utils/test/dashboard/dashboard/elastic2kibana/main.py b/utils/test/dashboard/dashboard/elastic2kibana/main.py index 9ee894279..112d2226e 100644 --- a/utils/test/dashboard/dashboard/elastic2kibana/main.py +++ b/utils/test/dashboard/dashboard/elastic2kibana/main.py @@ -1,13 +1,12 @@ #! /usr/bin/env python import json -import urlparse import argparse -from common import elastic_access -from common import logger_utils -from conf import config -from conf import testcases +from dashboard.common import elastic_access +from dashboard.common import logger_utils +from dashboard.conf import config +from dashboard.conf import testcases from dashboard_assembler import DashboardAssembler from visualization_assembler import VisualizationAssembler @@ -131,10 +130,9 @@ class KibanaConstructor(object): } }) - elastic_data = elastic_access.get_docs( - urlparse.urljoin(CONF.es_url, '/test_results/mongo2elastic'), - CONF.es_creds, - query) + elastic_data = elastic_access.get_docs(CONF.index_url, + CONF.es_creds, + query) pods_and_scenarios = {} diff --git a/utils/test/dashboard/dashboard/elastic2kibana/utility.py b/utils/test/dashboard/dashboard/elastic2kibana/utility.py index dccd28aed..55578bd8c 100644 --- a/utils/test/dashboard/dashboard/elastic2kibana/utility.py +++ b/utils/test/dashboard/dashboard/elastic2kibana/utility.py @@ -2,7 +2,7 @@ import json from jinja2 import Environment, PackageLoader -env = Environment(loader=PackageLoader('elastic2kibana', 'templates')) +env = Environment(loader=PackageLoader('dashboard', 'elastic2kibana/templates')) env.filters['jsonify'] = json.dumps diff --git a/utils/test/dashboard/dashboard/elastic2kibana/visualization_assembler.py b/utils/test/dashboard/dashboard/elastic2kibana/visualization_assembler.py index 1cb0ba8d1..d7e6e543a 100644 --- a/utils/test/dashboard/dashboard/elastic2kibana/visualization_assembler.py +++ b/utils/test/dashboard/dashboard/elastic2kibana/visualization_assembler.py @@ -1,7 +1,7 @@ import json import utility -from common import elastic_access +from dashboard.common import elastic_access class VisStateBuilder(object): diff --git a/utils/test/dashboard/dashboard/elastic2kibana_main.py b/utils/test/dashboard/dashboard/elastic2kibana_main.py deleted file mode 100644 index 3ec27cb40..000000000 --- a/utils/test/dashboard/dashboard/elastic2kibana_main.py +++ /dev/null @@ -1,4 +0,0 @@ -from elastic2kibana.main import main - -if __name__ == '__main__': - main() diff --git a/utils/test/dashboard/dashboard/mongo2elastic/format.py b/utils/test/dashboard/dashboard/functest/format.py index 0bbde1746..ef485bae0 100644 --- a/utils/test/dashboard/dashboard/mongo2elastic/format.py +++ b/utils/test/dashboard/dashboard/functest/format.py @@ -184,21 +184,3 @@ 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 diff --git a/utils/test/dashboard/dashboard/mongo2elastic/main.py b/utils/test/dashboard/dashboard/mongo2elastic/main.py index 303d82c6f..688f55f7d 100644 --- a/utils/test/dashboard/dashboard/mongo2elastic/main.py +++ b/utils/test/dashboard/dashboard/mongo2elastic/main.py @@ -5,15 +5,15 @@ import json import os import subprocess import traceback -import urlparse import uuid import argparse -from common import logger_utils, elastic_access -from conf import testcases -from conf.config import APIConfig -from mongo2elastic import format +from dashboard.common import elastic_access +from dashboard.common import logger_utils +from dashboard.conf import testcases +from dashboard.conf.config import APIConfig +from dashboard.mongo2elastic import format logger = logger_utils.DashboardLogger('mongo2elastic').get @@ -187,7 +187,7 @@ class DocumentsPublisher(object): self._remove() exit(-1) - def get_existed_docs(self): + def get_exists(self): if self.days == 0: body = '''{{ "query": {{ @@ -241,10 +241,6 @@ class DocumentsPublisher(object): def main(): - base_elastic_url = urlparse.urljoin(CONF.es_url, '/test_results/mongo2elastic') - days = args.latest_days - es_creds = CONF.es_creds - for project, case_dicts in testcases.testcases_yaml.items(): for case_dict in case_dicts: case = case_dict.get('name') @@ -252,6 +248,6 @@ def main(): DocumentsPublisher(project, case, fmt, - days, - base_elastic_url, - es_creds).export().get_existed_docs().publish() + args.latest_days, + CONF.index_url, + CONF.es_creds).export().get_exists().publish() diff --git a/utils/test/dashboard/dashboard/mongo2elastic_main.py b/utils/test/dashboard/dashboard/mongo2elastic_main.py deleted file mode 100644 index 141d8f3ab..000000000 --- a/utils/test/dashboard/dashboard/mongo2elastic_main.py +++ /dev/null @@ -1,4 +0,0 @@ -from mongo2elastic.main import main - -if __name__ == '__main__': - main() diff --git a/utils/test/dashboard/dashboard/qtip/format.py b/utils/test/dashboard/dashboard/qtip/format.py new file mode 100644 index 000000000..b78fa5b9b --- /dev/null +++ b/utils/test/dashboard/dashboard/qtip/format.py @@ -0,0 +1,19 @@ +#! /usr/bin/env python + + +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 diff --git a/utils/test/dashboard/etc/config.ini b/utils/test/dashboard/etc/config.ini index d9327981e..77adc1687 100644 --- a/utils/test/dashboard/etc/config.ini +++ b/utils/test/dashboard/etc/config.ini @@ -2,6 +2,7 @@ # the CONF object in config.ini must be updated [elastic] url = http://localhost:9200 +index = testapi/results creds = [kibana] diff --git a/utils/test/dashboard/install.sh b/utils/test/dashboard/install.sh new file mode 100755 index 000000000..9fd60d916 --- /dev/null +++ b/utils/test/dashboard/install.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +usage=" +Script to install dashboard automatically. +This script should be run under root. + +usage: + bash $(basename "$0") [-h|--help] [-t <test_name>] + +where: + -h|--help show this help text + -p|--project project dashboard + <project_name>" + +# Parse parameters +while [[ $# > 0 ]] + do + key="$1" + case $key in + -h|--help) + echo "$usage" + exit 0 + shift + ;; + -p|--project) + PROJECT="$2" + shift + ;; + *) + echo "unknown option $1 $2" + exit 1 + ;; + esac + shift # past argument or value +done + +if [[ $(whoami) != "root" ]]; then + echo "Error: This script must be run as root!" + exit 1 +fi + +if [ -z ${PROJECT+x} ]; then + echo "project must be specified" + exit 1 +fi + +if [ $PROJECT != "functest" ] && [ $PROJECT != "qtip" ];then + echo "unsupported project $PROJECT" + exit 1 +fi + +cp -f dashboard/$PROJECT/format.py dashboard/mongo2elastic +cp -f dashboard/$PROJECT/testcases.yaml etc/ +python setup.py install diff --git a/utils/test/dashboard/setup.cfg b/utils/test/dashboard/setup.cfg new file mode 100644 index 000000000..dd0135861 --- /dev/null +++ b/utils/test/dashboard/setup.cfg @@ -0,0 +1,43 @@ +[metadata] +name = dashboard +summary = Test Result Collector +description-file = + README.rst +author = SerenaFeng +author-email = feng.xiaowei@zte.com.cn +#home-page = http://www.opnfv.org/ +classifier = + Environment :: opnfv + Intended Audience :: Information Technology + Intended Audience :: System Administrators + License :: OSI Approved :: Apache Software License + Operating System :: POSIX :: Linux + Programming Language :: Python + Programming Language :: Python :: 2 + Programming Language :: Python :: 2.7 + +[global] +setup-hooks = + pbr.hooks.setup_hook + +[files] +packages = + dashboard +package_data = + dashboard = + elastic2kibana/templates/*.* +data_files = + /etc/dashboard = + etc/config.ini + etc/testcases.yaml + +[entry_points] +console_scripts = + dashboard_mongo2elastic = dashboard.mongo2elastic.main:main + dashboard_elastic2kibana = dashboard.elastic2kibana.main:main + +[egg_info] +tag_build = +tag_date = 0 +tag_svn_revision = 0 + diff --git a/utils/test/dashboard/setup.py b/utils/test/dashboard/setup.py new file mode 100644 index 000000000..59637a509 --- /dev/null +++ b/utils/test/dashboard/setup.py @@ -0,0 +1,8 @@ +import setuptools + +__author__ = 'serena' + + +setuptools.setup( + setup_requires=['pbr>=1.8'], + pbr=True) diff --git a/utils/test/reporting/functest/reporting-status.py b/utils/test/reporting/functest/reporting-status.py index b527b7861..653448eaf 100755 --- a/utils/test/reporting/functest/reporting-status.py +++ b/utils/test/reporting/functest/reporting-status.py @@ -82,6 +82,10 @@ for version in conf.versions: items = {} scenario_result_criteria = {} + scenario_file_name = (conf.REPORTING_PATH + + "/functest/release/" + version + + "/scenario_history.txt") + # For all the scenarios get results for s, s_result in scenario_results.items(): logger.info("---------------------------------") @@ -185,11 +189,8 @@ for version in conf.versions: scenario_criteria = conf.MAX_SCENARIO_CRITERIA s_score = str(scenario_score) + "/" + str(scenario_criteria) - s_score_percent = 0.0 - try: - s_score_percent = float(scenario_score) / float(scenario_criteria) * 100 - except: - logger.error("cannot calculate the score percent") + s_score_percent = utils.getScenarioPercent(scenario_score, + scenario_criteria) s_status = "KO" if scenario_score < scenario_criteria: @@ -209,10 +210,7 @@ for version in conf.versions: f.write(info) # Save daily results in a file - path_validation_file = (conf.REPORTING_PATH + - "/functest/release/" + version + - "/scenario_history.txt") - with open(path_validation_file, "a") as f: + with open(scenario_file_name, "a") as f: info = (reportingDate + "," + s + "," + installer + "," + s_score + "," + str(round(s_score_percent)) + "\n") @@ -239,34 +237,39 @@ for version in conf.versions: version=version, date=reportingDate) - with open(conf.REPORTING_PATH + "/functest/release/" + version + - "/index-status-" + installer + ".html", "wb") as fh: - fh.write(outputText) + # csv + # generate sub files based on scenario_history.txt + scenario_installer_file_name = (conf.REPORTING_PATH + + "/functest/release/" + version + + "/scenario_history_" + installer + + ".txt") + scenario_installer_file = open(scenario_installer_file_name, "a") + logger.info("Generate CSV...") + with open(scenario_file_name, "r") as f: + for line in f: + if installer in line: + logger.debug("Add new line... %s" % line) + scenario_installer_file.write(line) + scenario_installer_file.close + + with open(conf.REPORTING_PATH + "/functest/release/" + version + + "/index-status-" + installer + ".html", "wb") as fh: + fh.write(outputText) + logger.info("CSV generated...") - # Generate outputs for export - # pdf - try: - pdf_path = ("http://testresults.opnfv.org/reporting/" + - "functest/release/" + version + - "/index-status-" + installer + ".html") - pdf_doc_name = (conf.REPORTING_PATH + - "/functest/release/" + version + - "/status-" + installer + ".pdf") - pdfkit.from_url(pdf_path, pdf_doc_name) - except IOError: - logger.info("pdf generated anyway...") - except: - logger.error("impossible to generate PDF") - # csv - # generate sub files based on scenario_history.txt - scenario_installer_file_name = (conf.REPORTING_PATH + - "/functest/release/" + version + - "/scenario_history_" + - installer + ".txt") - scenario_installer_file = open(scenario_installer_file_name, "w") - - with open(path_validation_file, "r") as f: - for line in f: - if installer in line: - scenario_installer_file.write(line) - scenario_installer_file.close + # Generate outputs for export + # pdf + logger.info("Generate PDF...") + try: + pdf_path = ("http://testresults.opnfv.org/reporting/" + + "functest/release/" + version + + "/index-status-" + installer + ".html") + pdf_doc_name = (conf.REPORTING_PATH + + "/functest/release/" + version + + "/status-" + installer + ".pdf") + pdfkit.from_url(pdf_path, pdf_doc_name) + logger.info("PDF generated...") + except IOError: + logger.info("pdf generated anyway...") + except: + logger.error("impossible to generate PDF") diff --git a/utils/test/reporting/functest/reportingUtils.py b/utils/test/reporting/functest/reportingUtils.py index 9ba02e821..74d6f19c9 100644 --- a/utils/test/reporting/functest/reportingUtils.py +++ b/utils/test/reporting/functest/reportingUtils.py @@ -176,3 +176,11 @@ def getJenkinsUrl(build_tag): print 'Impossible to get jenkins url:' return jenkins_url + +def getScenarioPercent(scenario_score,scenario_criteria): + score = 0.0 + try: + score = float(scenario_score) / float(scenario_criteria) * 100 + except: + print 'Impossible to calculate the percentage score' + return score diff --git a/utils/test/reporting/yardstick/reporting-status.py b/utils/test/reporting/yardstick/reporting-status.py index 60f1523bb..49809e9d8 100644 --- a/utils/test/reporting/yardstick/reporting-status.py +++ b/utils/test/reporting/yardstick/reporting-status.py @@ -8,10 +8,7 @@ # import datetime import jinja2 -import requests -import sys -import time -import yaml +import os import reportingUtils as utils import reportingConf as conf @@ -20,6 +17,7 @@ from scenarios import config as cf # Logger logger = utils.getLogger("Yardstick-Status") +reportingDate = datetime.datetime.now().strftime("%Y-%m-%d %H:%M") logger.info("*******************************************") logger.info("* Generating reporting scenario status *") @@ -35,21 +33,23 @@ for version in conf.versions: # get scenarios results data scenario_results = utils.getScenarioStatus(installer, version) if 'colorado' == version: - stable_result = utils.getScenarioStatus(installer, 'stable/colorado') - for k,v in stable_result.items(): - if not scenario_results.has_key(k): + stable_result = utils.getScenarioStatus(installer, + 'stable/colorado') + for k, v in stable_result.items(): + if k not in scenario_results.keys(): scenario_results[k] = [] scenario_results[k] += stable_result[k] scenario_result_criteria = {} for s in scenario_results.keys(): - if cf.has_key(installer) and cf[installer].has_key(s): + if installer in cf.keys() and s in cf[installer].keys(): scenario_results.pop(s) # From each scenarios get results list for s, s_result in scenario_results.items(): logger.info("---------------------------------") - logger.info("installer %s, version %s, scenario %s:" % (installer, version, s)) + logger.info("installer %s, version %s, scenario %s:" % (installer, + version, s)) ten_criteria = len(s_result) ten_score = 0 @@ -62,15 +62,38 @@ for version in conf.versions: for v in four_result: four_score += v - s_status = str(utils.get_status(four_result, s_result)) + s_status = str(utils.get_percent(four_result, s_result)) s_four_score = str(four_score) + '/' + str(four_criteria) s_ten_score = str(ten_score) + '/' + str(ten_criteria) - scenario_result_criteria[s] = sr.ScenarioResult(s_status, s_four_score, s_ten_score) + s_score_percent = utils.get_percent(four_result, s_result) if '100' == s_status: logger.info(">>>>> scenario OK, save the information") else: - logger.info(">>>> scenario not OK, last 4 iterations = %s, last 10 days = %s" % (s_four_score, s_ten_score)) + logger.info(">>>> scenario not OK, last 4 iterations = %s, \ + last 10 days = %s" % (s_four_score, s_ten_score)) + + # Save daily results in a file + path_validation_file = (conf.REPORTING_PATH + + "/release/" + version + + "/scenario_history.txt") + + if not os.path.exists(path_validation_file): + with open(path_validation_file, 'w') as f: + info = 'date,scenario,installer,details,score\n' + f.write(info) + + with open(path_validation_file, "a") as f: + info = (reportingDate + "," + s + "," + installer + + "," + s_ten_score + "," + + str(s_score_percent) + "\n") + f.write(info) + + scenario_result_criteria[s] = sr.ScenarioResult(s_status, + s_four_score, + s_ten_score, + s_score_percent) + logger.info("--------------------------") templateLoader = jinja2.FileSystemLoader(conf.REPORTING_PATH) @@ -82,7 +105,8 @@ for version in conf.versions: outputText = template.render(scenario_results=scenario_result_criteria, installer=installer, period=conf.PERIOD, - version=version) + version=version, + date=reportingDate) with open(conf.REPORTING_PATH + "/release/" + version + "/index-status-" + installer + ".html", "wb") as fh: diff --git a/utils/test/reporting/yardstick/reportingUtils.py b/utils/test/reporting/yardstick/reportingUtils.py index 71eb9196c..ec9ed76dc 100644 --- a/utils/test/reporting/yardstick/reportingUtils.py +++ b/utils/test/reporting/yardstick/reportingUtils.py @@ -32,7 +32,7 @@ def getLogger(module): def getScenarioStatus(installer, version): url = (conf.URL_BASE + "?case=" + "scenario_status" + "&installer=" + installer + - "&version=" + version +"&period=" + str(conf.PERIOD)) + "&version=" + version + "&period=" + str(conf.PERIOD)) request = Request(url) try: @@ -53,7 +53,7 @@ def getScenarioStatus(installer, version): scenario_results[r['scenario']] = [] scenario_results[r['scenario']].append(r) - for k,v in scenario_results.items(): + for k, v in scenario_results.items(): # scenario_results[k] = v[:conf.LASTEST_TESTS] s_list = [] for element in v: @@ -66,20 +66,25 @@ def getScenarioStatus(installer, version): # return scenario_results return result_dict + def subfind(given_list, pattern_list): + for i in range(len(given_list)): - if given_list[i] == pattern_list[0] and given_list[i:i + conf.LASTEST_TESTS] == pattern_list: + if given_list[i] == pattern_list[0] and \ + given_list[i:i + conf.LASTEST_TESTS] == pattern_list: return True return False -def get_percent(status): - + +def _get_percent(status): + if status * 100 % 6: return round(float(status) * 100 / 6, 1) else: return status * 100 / 6 -def get_status(four_list, ten_list): + +def get_percent(four_list, ten_list): four_score = 0 ten_score = 0 @@ -97,13 +102,13 @@ def get_status(four_list, ten_list): else: status = four_score + 1 - return get_percent(status) + return _get_percent(status) def _test(): status = getScenarioStatus("compass", "master") print "status:++++++++++++++++++++++++" - print json.dumps(status,indent=4) + print json.dumps(status, indent=4) if __name__ == '__main__': # pragma: no cover diff --git a/utils/test/reporting/yardstick/scenarioResult.py b/utils/test/reporting/yardstick/scenarioResult.py index 61ffb2ce7..1f7eb2b24 100644 --- a/utils/test/reporting/yardstick/scenarioResult.py +++ b/utils/test/reporting/yardstick/scenarioResult.py @@ -9,10 +9,12 @@ class ScenarioResult(object): - def __init__(self, status, four_days_score='', ten_days_score=''): + def __init__(self, status, four_days_score='', ten_days_score='', + score_percent=0.0): self.status = status self.four_days_score = four_days_score self.ten_days_score = ten_days_score + self.score_percent = score_percent def getStatus(self): return self.status @@ -22,3 +24,6 @@ class ScenarioResult(object): def getFourDaysScore(self): return self.four_days_score + + def getScorePercent(self): + return self.score_percent diff --git a/utils/test/reporting/yardstick/template/index-status-tmpl.html b/utils/test/reporting/yardstick/template/index-status-tmpl.html index 602ce8a74..5a4dc347c 100644 --- a/utils/test/reporting/yardstick/template/index-status-tmpl.html +++ b/utils/test/reporting/yardstick/template/index-status-tmpl.html @@ -3,9 +3,56 @@ <meta charset="utf-8"> <!-- Bootstrap core CSS --> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet"> - <link href="default.css" rel="stylesheet"> + <link href="../../../css/default.css" rel="stylesheet"> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script> + <script type="text/javascript" src="http://d3js.org/d3.v2.min.js"></script> + <script type="text/javascript" src="../../../js/gauge.js"></script> + <script type="text/javascript" src="../../../js/trend.js"></script> + <script> + function onDocumentReady() { + // Gauge management + {% for scenario in scenario_results.keys() -%} + var gaugeScenario{{loop.index}} = gauge('#gaugeScenario{{loop.index}}'); + {%- endfor %} + // assign success rate to the gauge + function updateReadings() { + {% for scenario in scenario_results.keys() -%} + gaugeScenario{{loop.index}}.update({{scenario_results[scenario].getScorePercent()}}); + {%- endfor %} + } + updateReadings(); + } + + // trend line management + //d3.csv("./scenario_history.txt", function(data) { + d3.csv("./scenario_history.txt", function(data) { + // *************************************** + // Create the trend line + {% for scenario in scenario_results.keys() -%} + // for scenario {{scenario}} + // Filter results + var trend{{loop.index}} = data.filter(function(row) { + return row["scenario"]=="{{scenario}}" && row["installer"]=="{{installer}}"; + }) + // Parse the date + trend{{loop.index}}.forEach(function(d) { + d.date = parseDate(d.date); + d.score = +d.score + }); + // Draw the trend line + var mytrend = trend("#trend_svg{{loop.index}}",trend{{loop.index}}) + // **************************************** + {%- endfor %} + }); + if ( !window.isLoaded ) { + window.addEventListener("load", function() { + onDocumentReady(); + }, false); + } else { + onDocumentReady(); + } + </script> <script type="text/javascript"> $(document).ready(function (){ $(".btn-more").click(function() { @@ -18,10 +65,10 @@ <body> <div class="container"> <div class="masthead"> - <h3 class="text-muted">Yardstick status page ({{version}})</h3> + <h3 class="text-muted">Yardstick status page ({{version}}, {{date}})</h3> <nav> <ul class="nav nav-justified"> - <li class="active"><a href="index.html">Home</a></li> + <li class="active"><a href="http://testresults.opnfv.org/reporting/index.html">Home</a></li> <li><a href="index-status-apex.html">Apex</a></li> <li><a href="index-status-compass.html">Compass</a></li> <li><a href="index-status-fuel.html">Fuel</a></li> @@ -42,15 +89,15 @@ <tr> <th width="40%">Scenario</th> <th width="20%">Status</th> - <th width="20%">Last 4 Iterations</th> - <th width="20%">Last 10 Days</th> + <th width="20%">Trend</th> + <th width="10%">Last 4 Iterations</th> + <th width="10%">Last 10 Days</th> </tr> {% for scenario,result in scenario_results.iteritems() -%} <tr class="tr-ok"> <td>{{scenario}}</td> - <td> - <img src="../../img/gauge_{{ scenario_results[scenario].getStatus() }}.png"> - </td> + <td><div id="gaugeScenario{{loop.index}}"></div></td> + <td><div id="trend_svg{{loop.index}}"></div></td> <td>{{scenario_results[scenario].getFourDaysScore()}}</td> <td>{{scenario_results[scenario].getTenDaysScore()}}</td> </tr> diff --git a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/.gitignore b/utils/test/testapi/3rd_party/static/.gitignore index ebf4281dc..ebf4281dc 100644 --- a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/.gitignore +++ b/utils/test/testapi/3rd_party/static/.gitignore diff --git a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/css/highlight.default.css b/utils/test/testapi/3rd_party/static/css/highlight.default.css index e417fc179..e417fc179 100644 --- a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/css/highlight.default.css +++ b/utils/test/testapi/3rd_party/static/css/highlight.default.css diff --git a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/css/hightlight.default.css b/utils/test/testapi/3rd_party/static/css/hightlight.default.css index e417fc179..e417fc179 100644 --- a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/css/hightlight.default.css +++ b/utils/test/testapi/3rd_party/static/css/hightlight.default.css diff --git a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/css/screen.css b/utils/test/testapi/3rd_party/static/css/screen.css index 2882b8d66..2882b8d66 100644 --- a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/css/screen.css +++ b/utils/test/testapi/3rd_party/static/css/screen.css diff --git a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/endpoint.html b/utils/test/testapi/3rd_party/static/endpoint.html index 4ae3bde0c..4ae3bde0c 100644 --- a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/endpoint.html +++ b/utils/test/testapi/3rd_party/static/endpoint.html diff --git a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/images/explorer_icons.png b/utils/test/testapi/3rd_party/static/images/explorer_icons.png Binary files differindex ed9d2fffb..ed9d2fffb 100644 --- a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/images/explorer_icons.png +++ b/utils/test/testapi/3rd_party/static/images/explorer_icons.png diff --git a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/images/logo_small.png b/utils/test/testapi/3rd_party/static/images/logo_small.png Binary files differindex 5496a6557..5496a6557 100644 --- a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/images/logo_small.png +++ b/utils/test/testapi/3rd_party/static/images/logo_small.png diff --git a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/images/pet_store_api.png b/utils/test/testapi/3rd_party/static/images/pet_store_api.png Binary files differindex f9f9cd4ae..f9f9cd4ae 100644 --- a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/images/pet_store_api.png +++ b/utils/test/testapi/3rd_party/static/images/pet_store_api.png diff --git a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/images/throbber.gif b/utils/test/testapi/3rd_party/static/images/throbber.gif Binary files differindex 063938892..063938892 100644 --- a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/images/throbber.gif +++ b/utils/test/testapi/3rd_party/static/images/throbber.gif diff --git a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/images/wordnik_api.png b/utils/test/testapi/3rd_party/static/images/wordnik_api.png Binary files differindex dca4f1455..dca4f1455 100644 --- a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/images/wordnik_api.png +++ b/utils/test/testapi/3rd_party/static/images/wordnik_api.png diff --git a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/index.html b/utils/test/testapi/3rd_party/static/index.html index db209f4a8..db209f4a8 100644 --- a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/index.html +++ b/utils/test/testapi/3rd_party/static/index.html diff --git a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/lib/backbone-min.js b/utils/test/testapi/3rd_party/static/lib/backbone-min.js index c1c0d4fff..c1c0d4fff 100644 --- a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/lib/backbone-min.js +++ b/utils/test/testapi/3rd_party/static/lib/backbone-min.js diff --git a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/lib/handlebars-1.0.0.js b/utils/test/testapi/3rd_party/static/lib/handlebars-1.0.0.js index c70f09d1d..c70f09d1d 100644 --- a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/lib/handlebars-1.0.0.js +++ b/utils/test/testapi/3rd_party/static/lib/handlebars-1.0.0.js diff --git a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/lib/highlight.7.3.pack.js b/utils/test/testapi/3rd_party/static/lib/highlight.7.3.pack.js index 9a95a75ea..9a95a75ea 100644 --- a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/lib/highlight.7.3.pack.js +++ b/utils/test/testapi/3rd_party/static/lib/highlight.7.3.pack.js diff --git a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/lib/jquery-1.8.0.min.js b/utils/test/testapi/3rd_party/static/lib/jquery-1.8.0.min.js index 066d72c7e..066d72c7e 100644 --- a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/lib/jquery-1.8.0.min.js +++ b/utils/test/testapi/3rd_party/static/lib/jquery-1.8.0.min.js diff --git a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/lib/jquery.ba-bbq.min.js b/utils/test/testapi/3rd_party/static/lib/jquery.ba-bbq.min.js index bcbf24834..bcbf24834 100644 --- a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/lib/jquery.ba-bbq.min.js +++ b/utils/test/testapi/3rd_party/static/lib/jquery.ba-bbq.min.js diff --git a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/lib/jquery.slideto.min.js b/utils/test/testapi/3rd_party/static/lib/jquery.slideto.min.js index ba32cff36..ba32cff36 100644 --- a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/lib/jquery.slideto.min.js +++ b/utils/test/testapi/3rd_party/static/lib/jquery.slideto.min.js diff --git a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/lib/jquery.wiggle.min.js b/utils/test/testapi/3rd_party/static/lib/jquery.wiggle.min.js index 2adb0d6d5..2adb0d6d5 100644 --- a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/lib/jquery.wiggle.min.js +++ b/utils/test/testapi/3rd_party/static/lib/jquery.wiggle.min.js diff --git a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/lib/shred.bundle.js b/utils/test/testapi/3rd_party/static/lib/shred.bundle.js index 74d081689..74d081689 100644 --- a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/lib/shred.bundle.js +++ b/utils/test/testapi/3rd_party/static/lib/shred.bundle.js diff --git a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/lib/shred/content.js b/utils/test/testapi/3rd_party/static/lib/shred/content.js index b8051fedd..b8051fedd 100644 --- a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/lib/shred/content.js +++ b/utils/test/testapi/3rd_party/static/lib/shred/content.js diff --git a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/lib/swagger-oauth.js b/utils/test/testapi/3rd_party/static/lib/swagger-oauth.js index 7c8839a95..7c8839a95 100644 --- a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/lib/swagger-oauth.js +++ b/utils/test/testapi/3rd_party/static/lib/swagger-oauth.js diff --git a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/lib/swagger.js b/utils/test/testapi/3rd_party/static/lib/swagger.js index 78e8b2949..78e8b2949 100644 --- a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/lib/swagger.js +++ b/utils/test/testapi/3rd_party/static/lib/swagger.js diff --git a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/lib/underscore-min.js b/utils/test/testapi/3rd_party/static/lib/underscore-min.js index 5a0cb3b00..5a0cb3b00 100644 --- a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/lib/underscore-min.js +++ b/utils/test/testapi/3rd_party/static/lib/underscore-min.js diff --git a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/o2c.html b/utils/test/testapi/3rd_party/static/o2c.html index d32d130ec..d32d130ec 100644 --- a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/o2c.html +++ b/utils/test/testapi/3rd_party/static/o2c.html diff --git a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/swagger-ui.js b/utils/test/testapi/3rd_party/static/swagger-ui.js index 4c9922642..4c9922642 100644 --- a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/swagger-ui.js +++ b/utils/test/testapi/3rd_party/static/swagger-ui.js diff --git a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/swagger-ui.min.js b/utils/test/testapi/3rd_party/static/swagger-ui.min.js index 28cb9e6a4..28cb9e6a4 100644 --- a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/static/swagger-ui.min.js +++ b/utils/test/testapi/3rd_party/static/swagger-ui.min.js diff --git a/utils/test/result_collection_api/README.rst b/utils/test/testapi/README.rst index c0075bc76..44ab2a475 100644 --- a/utils/test/result_collection_api/README.rst +++ b/utils/test/testapi/README.rst @@ -25,7 +25,7 @@ How to install From within your environment, just run: - python setup.py install + ./install.sh How to run ^^^^^^^^^^ diff --git a/utils/test/result_collection_api/docker/Dockerfile b/utils/test/testapi/docker/Dockerfile index ffee4c231..b0272e609 100644 --- a/utils/test/result_collection_api/docker/Dockerfile +++ b/utils/test/testapi/docker/Dockerfile @@ -46,7 +46,7 @@ RUN pip install --upgrade pip RUN git config --global http.sslVerify false RUN git clone https://gerrit.opnfv.org/gerrit/releng /home/releng -WORKDIR /home/releng/utils/test/result_collection_api/ +WORKDIR /home/releng/utils/test/testapi/ RUN pip install -r requirements.txt RUN python setup.py install CMD ["bash", "docker/start-server.sh"] diff --git a/utils/test/result_collection_api/docker/prepare-env.sh b/utils/test/testapi/docker/prepare-env.sh index 99433cc8c..99433cc8c 100755 --- a/utils/test/result_collection_api/docker/prepare-env.sh +++ b/utils/test/testapi/docker/prepare-env.sh diff --git a/utils/test/result_collection_api/docker/start-server.sh b/utils/test/testapi/docker/start-server.sh index 8bf6084ae..8bf6084ae 100755 --- a/utils/test/result_collection_api/docker/start-server.sh +++ b/utils/test/testapi/docker/start-server.sh diff --git a/utils/test/result_collection_api/etc/config.ini b/utils/test/testapi/etc/config.ini index 0edb73a3f..0edb73a3f 100644 --- a/utils/test/result_collection_api/etc/config.ini +++ b/utils/test/testapi/etc/config.ini diff --git a/utils/test/testapi/install.sh b/utils/test/testapi/install.sh new file mode 100755 index 000000000..43229eabb --- /dev/null +++ b/utils/test/testapi/install.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +usage=" +Script to install opnfv_tesgtapi automatically. +This script should be run under root. + +usage: + bash $(basename "$0") [-h|--help] [-t <test_name>] + +where: + -h|--help show this help text" + +if [[ $(whoami) != "root" ]]; then + echo "Error: This script must be run as root!" + exit 1 +fi + +cp -fr 3rd_party/static opnfv_testapi/tornado_swagger +python setup.py install +rm -fr opnfv_testapi/tornado_swagger/static diff --git a/utils/test/result_collection_api/opnfv_testapi/__init__.py b/utils/test/testapi/opnfv_testapi/__init__.py index 363bc388e..363bc388e 100644 --- a/utils/test/result_collection_api/opnfv_testapi/__init__.py +++ b/utils/test/testapi/opnfv_testapi/__init__.py diff --git a/utils/test/result_collection_api/opnfv_testapi/cmd/__init__.py b/utils/test/testapi/opnfv_testapi/cmd/__init__.py index 363bc388e..363bc388e 100644 --- a/utils/test/result_collection_api/opnfv_testapi/cmd/__init__.py +++ b/utils/test/testapi/opnfv_testapi/cmd/__init__.py diff --git a/utils/test/result_collection_api/opnfv_testapi/cmd/server.py b/utils/test/testapi/opnfv_testapi/cmd/server.py index c3d734607..c3d734607 100644 --- a/utils/test/result_collection_api/opnfv_testapi/cmd/server.py +++ b/utils/test/testapi/opnfv_testapi/cmd/server.py diff --git a/utils/test/result_collection_api/opnfv_testapi/common/__init__.py b/utils/test/testapi/opnfv_testapi/common/__init__.py index 05c0c9392..05c0c9392 100644 --- a/utils/test/result_collection_api/opnfv_testapi/common/__init__.py +++ b/utils/test/testapi/opnfv_testapi/common/__init__.py diff --git a/utils/test/result_collection_api/opnfv_testapi/common/config.py b/utils/test/testapi/opnfv_testapi/common/config.py index ecab88ae3..ecab88ae3 100644 --- a/utils/test/result_collection_api/opnfv_testapi/common/config.py +++ b/utils/test/testapi/opnfv_testapi/common/config.py diff --git a/utils/test/result_collection_api/opnfv_testapi/common/constants.py b/utils/test/testapi/opnfv_testapi/common/constants.py index 4d39a142d..4d39a142d 100644 --- a/utils/test/result_collection_api/opnfv_testapi/common/constants.py +++ b/utils/test/testapi/opnfv_testapi/common/constants.py diff --git a/utils/test/result_collection_api/opnfv_testapi/resources/__init__.py b/utils/test/testapi/opnfv_testapi/resources/__init__.py index 05c0c9392..05c0c9392 100644 --- a/utils/test/result_collection_api/opnfv_testapi/resources/__init__.py +++ b/utils/test/testapi/opnfv_testapi/resources/__init__.py diff --git a/utils/test/result_collection_api/opnfv_testapi/resources/handlers.py b/utils/test/testapi/opnfv_testapi/resources/handlers.py index 5059f5d77..5059f5d77 100644 --- a/utils/test/result_collection_api/opnfv_testapi/resources/handlers.py +++ b/utils/test/testapi/opnfv_testapi/resources/handlers.py diff --git a/utils/test/result_collection_api/opnfv_testapi/resources/models.py b/utils/test/testapi/opnfv_testapi/resources/models.py index e79308b53..e79308b53 100644 --- a/utils/test/result_collection_api/opnfv_testapi/resources/models.py +++ b/utils/test/testapi/opnfv_testapi/resources/models.py diff --git a/utils/test/result_collection_api/opnfv_testapi/resources/pod_handlers.py b/utils/test/testapi/opnfv_testapi/resources/pod_handlers.py index 8f44439e7..8f44439e7 100644 --- a/utils/test/result_collection_api/opnfv_testapi/resources/pod_handlers.py +++ b/utils/test/testapi/opnfv_testapi/resources/pod_handlers.py diff --git a/utils/test/result_collection_api/opnfv_testapi/resources/pod_models.py b/utils/test/testapi/opnfv_testapi/resources/pod_models.py index 7231806f6..7231806f6 100644 --- a/utils/test/result_collection_api/opnfv_testapi/resources/pod_models.py +++ b/utils/test/testapi/opnfv_testapi/resources/pod_models.py diff --git a/utils/test/result_collection_api/opnfv_testapi/resources/project_handlers.py b/utils/test/testapi/opnfv_testapi/resources/project_handlers.py index 1e9a97230..1e9a97230 100644 --- a/utils/test/result_collection_api/opnfv_testapi/resources/project_handlers.py +++ b/utils/test/testapi/opnfv_testapi/resources/project_handlers.py diff --git a/utils/test/result_collection_api/opnfv_testapi/resources/project_models.py b/utils/test/testapi/opnfv_testapi/resources/project_models.py index f70630cda..f70630cda 100644 --- a/utils/test/result_collection_api/opnfv_testapi/resources/project_models.py +++ b/utils/test/testapi/opnfv_testapi/resources/project_models.py diff --git a/utils/test/result_collection_api/opnfv_testapi/resources/result_handlers.py b/utils/test/testapi/opnfv_testapi/resources/result_handlers.py index 400b84ac1..400b84ac1 100644 --- a/utils/test/result_collection_api/opnfv_testapi/resources/result_handlers.py +++ b/utils/test/testapi/opnfv_testapi/resources/result_handlers.py diff --git a/utils/test/result_collection_api/opnfv_testapi/resources/result_models.py b/utils/test/testapi/opnfv_testapi/resources/result_models.py index f73f5c612..f73f5c612 100644 --- a/utils/test/result_collection_api/opnfv_testapi/resources/result_models.py +++ b/utils/test/testapi/opnfv_testapi/resources/result_models.py diff --git a/utils/test/result_collection_api/opnfv_testapi/resources/testcase_handlers.py b/utils/test/testapi/opnfv_testapi/resources/testcase_handlers.py index 253aa6649..253aa6649 100644 --- a/utils/test/result_collection_api/opnfv_testapi/resources/testcase_handlers.py +++ b/utils/test/testapi/opnfv_testapi/resources/testcase_handlers.py diff --git a/utils/test/result_collection_api/opnfv_testapi/resources/testcase_models.py b/utils/test/testapi/opnfv_testapi/resources/testcase_models.py index c9dce6088..c9dce6088 100644 --- a/utils/test/result_collection_api/opnfv_testapi/resources/testcase_models.py +++ b/utils/test/testapi/opnfv_testapi/resources/testcase_models.py diff --git a/utils/test/result_collection_api/opnfv_testapi/router/__init__.py b/utils/test/testapi/opnfv_testapi/router/__init__.py index 3fc79f1d5..3fc79f1d5 100644 --- a/utils/test/result_collection_api/opnfv_testapi/router/__init__.py +++ b/utils/test/testapi/opnfv_testapi/router/__init__.py diff --git a/utils/test/result_collection_api/opnfv_testapi/router/url_mappings.py b/utils/test/testapi/opnfv_testapi/router/url_mappings.py index eb648ecbb..eb648ecbb 100644 --- a/utils/test/result_collection_api/opnfv_testapi/router/url_mappings.py +++ b/utils/test/testapi/opnfv_testapi/router/url_mappings.py diff --git a/utils/test/result_collection_api/opnfv_testapi/tests/__init__.py b/utils/test/testapi/opnfv_testapi/tests/__init__.py index 9f28b0bfa..9f28b0bfa 100644 --- a/utils/test/result_collection_api/opnfv_testapi/tests/__init__.py +++ b/utils/test/testapi/opnfv_testapi/tests/__init__.py diff --git a/utils/test/result_collection_api/opnfv_testapi/tests/unit/__init__.py b/utils/test/testapi/opnfv_testapi/tests/unit/__init__.py index 3fc79f1d5..3fc79f1d5 100644 --- a/utils/test/result_collection_api/opnfv_testapi/tests/unit/__init__.py +++ b/utils/test/testapi/opnfv_testapi/tests/unit/__init__.py diff --git a/utils/test/result_collection_api/opnfv_testapi/tests/unit/fake_pymongo.py b/utils/test/testapi/opnfv_testapi/tests/unit/fake_pymongo.py index 3dd87e603..3dd87e603 100644 --- a/utils/test/result_collection_api/opnfv_testapi/tests/unit/fake_pymongo.py +++ b/utils/test/testapi/opnfv_testapi/tests/unit/fake_pymongo.py diff --git a/utils/test/result_collection_api/opnfv_testapi/tests/unit/test_base.py b/utils/test/testapi/opnfv_testapi/tests/unit/test_base.py index ff1a1932c..ff1a1932c 100644 --- a/utils/test/result_collection_api/opnfv_testapi/tests/unit/test_base.py +++ b/utils/test/testapi/opnfv_testapi/tests/unit/test_base.py diff --git a/utils/test/result_collection_api/opnfv_testapi/tests/unit/test_fake_pymongo.py b/utils/test/testapi/opnfv_testapi/tests/unit/test_fake_pymongo.py index 5f50ba867..5f50ba867 100644 --- a/utils/test/result_collection_api/opnfv_testapi/tests/unit/test_fake_pymongo.py +++ b/utils/test/testapi/opnfv_testapi/tests/unit/test_fake_pymongo.py diff --git a/utils/test/result_collection_api/opnfv_testapi/tests/unit/test_pod.py b/utils/test/testapi/opnfv_testapi/tests/unit/test_pod.py index a1184d554..a1184d554 100644 --- a/utils/test/result_collection_api/opnfv_testapi/tests/unit/test_pod.py +++ b/utils/test/testapi/opnfv_testapi/tests/unit/test_pod.py diff --git a/utils/test/result_collection_api/opnfv_testapi/tests/unit/test_project.py b/utils/test/testapi/opnfv_testapi/tests/unit/test_project.py index 327ddf7b2..327ddf7b2 100644 --- a/utils/test/result_collection_api/opnfv_testapi/tests/unit/test_project.py +++ b/utils/test/testapi/opnfv_testapi/tests/unit/test_project.py diff --git a/utils/test/result_collection_api/opnfv_testapi/tests/unit/test_result.py b/utils/test/testapi/opnfv_testapi/tests/unit/test_result.py index 8479b35cd..8479b35cd 100644 --- a/utils/test/result_collection_api/opnfv_testapi/tests/unit/test_result.py +++ b/utils/test/testapi/opnfv_testapi/tests/unit/test_result.py diff --git a/utils/test/result_collection_api/opnfv_testapi/tests/unit/test_testcase.py b/utils/test/testapi/opnfv_testapi/tests/unit/test_testcase.py index cb767844a..cb767844a 100644 --- a/utils/test/result_collection_api/opnfv_testapi/tests/unit/test_testcase.py +++ b/utils/test/testapi/opnfv_testapi/tests/unit/test_testcase.py diff --git a/utils/test/result_collection_api/opnfv_testapi/tests/unit/test_version.py b/utils/test/testapi/opnfv_testapi/tests/unit/test_version.py index b6fbf45dc..b6fbf45dc 100644 --- a/utils/test/result_collection_api/opnfv_testapi/tests/unit/test_version.py +++ b/utils/test/testapi/opnfv_testapi/tests/unit/test_version.py diff --git a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/README.md b/utils/test/testapi/opnfv_testapi/tornado_swagger/README.md index d815f2161..d815f2161 100644 --- a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/README.md +++ b/utils/test/testapi/opnfv_testapi/tornado_swagger/README.md diff --git a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/__init__.py b/utils/test/testapi/opnfv_testapi/tornado_swagger/__init__.py index 363bc388e..363bc388e 100644 --- a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/__init__.py +++ b/utils/test/testapi/opnfv_testapi/tornado_swagger/__init__.py diff --git a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/handlers.py b/utils/test/testapi/opnfv_testapi/tornado_swagger/handlers.py index 2154b4697..2154b4697 100644 --- a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/handlers.py +++ b/utils/test/testapi/opnfv_testapi/tornado_swagger/handlers.py diff --git a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/settings.py b/utils/test/testapi/opnfv_testapi/tornado_swagger/settings.py index 88d0d0f88..88d0d0f88 100644 --- a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/settings.py +++ b/utils/test/testapi/opnfv_testapi/tornado_swagger/settings.py diff --git a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/swagger.py b/utils/test/testapi/opnfv_testapi/tornado_swagger/swagger.py index 3d21edefb..3d21edefb 100644 --- a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/swagger.py +++ b/utils/test/testapi/opnfv_testapi/tornado_swagger/swagger.py diff --git a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/views.py b/utils/test/testapi/opnfv_testapi/tornado_swagger/views.py index 25083195b..25083195b 100644 --- a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/views.py +++ b/utils/test/testapi/opnfv_testapi/tornado_swagger/views.py diff --git a/utils/test/result_collection_api/requirements.txt b/utils/test/testapi/requirements.txt index e1fd9e4cc..e1fd9e4cc 100644 --- a/utils/test/result_collection_api/requirements.txt +++ b/utils/test/testapi/requirements.txt diff --git a/utils/test/result_collection_api/run_test.sh b/utils/test/testapi/run_test.sh index 9b25f8ffc..9b25f8ffc 100755 --- a/utils/test/result_collection_api/run_test.sh +++ b/utils/test/testapi/run_test.sh diff --git a/utils/test/result_collection_api/setup.cfg b/utils/test/testapi/setup.cfg index 927957ac7..927957ac7 100644 --- a/utils/test/result_collection_api/setup.cfg +++ b/utils/test/testapi/setup.cfg diff --git a/utils/test/result_collection_api/setup.py b/utils/test/testapi/setup.py index 15dda961f..15dda961f 100644 --- a/utils/test/result_collection_api/setup.py +++ b/utils/test/testapi/setup.py diff --git a/utils/test/result_collection_api/test-requirements.txt b/utils/test/testapi/test-requirements.txt index ddbdefcfd..ddbdefcfd 100644 --- a/utils/test/result_collection_api/test-requirements.txt +++ b/utils/test/testapi/test-requirements.txt diff --git a/utils/test/result_collection_api/update/README.md b/utils/test/testapi/update/README.md index cb0e67b33..cb0e67b33 100644 --- a/utils/test/result_collection_api/update/README.md +++ b/utils/test/testapi/update/README.md diff --git a/utils/test/result_collection_api/update/__init__.py b/utils/test/testapi/update/__init__.py index 363bc388e..363bc388e 100644 --- a/utils/test/result_collection_api/update/__init__.py +++ b/utils/test/testapi/update/__init__.py diff --git a/utils/test/result_collection_api/update/playbook-update.sh b/utils/test/testapi/update/playbook-update.sh index 86d30e4b2..86d30e4b2 100755 --- a/utils/test/result_collection_api/update/playbook-update.sh +++ b/utils/test/testapi/update/playbook-update.sh diff --git a/utils/test/testapi/update/templates/__init__.py b/utils/test/testapi/update/templates/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/utils/test/testapi/update/templates/__init__.py diff --git a/utils/test/result_collection_api/update/templates/backup_mongodb.py b/utils/test/testapi/update/templates/backup_mongodb.py index 7e0dd5545..7e0dd5545 100644 --- a/utils/test/result_collection_api/update/templates/backup_mongodb.py +++ b/utils/test/testapi/update/templates/backup_mongodb.py diff --git a/utils/test/result_collection_api/update/templates/changes_in_mongodb.py b/utils/test/testapi/update/templates/changes_in_mongodb.py index 1a4d5a16f..1a4d5a16f 100644 --- a/utils/test/result_collection_api/update/templates/changes_in_mongodb.py +++ b/utils/test/testapi/update/templates/changes_in_mongodb.py diff --git a/utils/test/result_collection_api/update/templates/restore_mongodb.py b/utils/test/testapi/update/templates/restore_mongodb.py index c45a0e621..c45a0e621 100644 --- a/utils/test/result_collection_api/update/templates/restore_mongodb.py +++ b/utils/test/testapi/update/templates/restore_mongodb.py diff --git a/utils/test/result_collection_api/update/templates/rm_images.sh b/utils/test/testapi/update/templates/rm_images.sh index 6722573b4..6722573b4 100755 --- a/utils/test/result_collection_api/update/templates/rm_images.sh +++ b/utils/test/testapi/update/templates/rm_images.sh diff --git a/utils/test/result_collection_api/update/templates/rm_olds.sh b/utils/test/testapi/update/templates/rm_olds.sh index c6bca1867..c6bca1867 100644 --- a/utils/test/result_collection_api/update/templates/rm_olds.sh +++ b/utils/test/testapi/update/templates/rm_olds.sh diff --git a/utils/test/result_collection_api/update/templates/update_mongodb.py b/utils/test/testapi/update/templates/update_mongodb.py index ba4334aa3..ba4334aa3 100644 --- a/utils/test/result_collection_api/update/templates/update_mongodb.py +++ b/utils/test/testapi/update/templates/update_mongodb.py diff --git a/utils/test/result_collection_api/update/templates/utils.py b/utils/test/testapi/update/templates/utils.py index a18ff0389..a18ff0389 100644 --- a/utils/test/result_collection_api/update/templates/utils.py +++ b/utils/test/testapi/update/templates/utils.py diff --git a/utils/test/result_collection_api/update/test.yml b/utils/test/testapi/update/test.yml index a8868720d..a8868720d 100644 --- a/utils/test/result_collection_api/update/test.yml +++ b/utils/test/testapi/update/test.yml diff --git a/utils/test/result_collection_api/update/update.yml b/utils/test/testapi/update/update.yml index e6663d905..e6663d905 100644 --- a/utils/test/result_collection_api/update/update.yml +++ b/utils/test/testapi/update/update.yml diff --git a/utils/test/result_collection_api/update/update_api.py b/utils/test/testapi/update/update_api.py index db8ad2d90..db8ad2d90 100644 --- a/utils/test/result_collection_api/update/update_api.py +++ b/utils/test/testapi/update/update_api.py |