summaryrefslogtreecommitdiffstats
path: root/dovetail/utils/dovetail_utils.py
AgeCommit message (Collapse)AuthorFilesLines
2019-11-19Fix exception when running HA tests without pod.yamlxudan1-0/+24
1. use volumes '-v' to map files/directories which may be non-existing 2. use mounts '--mount' to map files/directories which couldn't be non-existing JIRA: DOVETAIL-789 Change-Id: I2184e5baed3d1491a2df4d3a1a77a11e3e9b4fc8 Signed-off-by: xudan <xudan16@huawei.com>
2019-09-18Fault fixing for cmd_exec util methodPanagiotis Karalis1-2/+3
When the 'dovetail run' command is assigned, the error "TypeError: must be str, not bytes" is appeared. Due to a different handling of strings in the Python3, this error is appeared during of command execution (i.e. exec_cmd method). Each piece of the string should be decoded, before it will be appended to the rest one. Signed-off-by: Panagiotis Karalis <panos.pkaralis@gmail.com> Change-Id: I65629f3f76cc3e44f3926a744d00791ef588d2aa
2019-09-16Move the proj to python3Panagiotis Karalis1-8/+8
The aim of this patch is to upgrade python version of this project from python2 to python3. Signed-off-by: Panagiotis Karalis <panos.pkaralis@gmail.com> Change-Id: I3d3ef01176fda1b23a0542a24625be2f3368c40e
2019-04-03Push CI results to OPNFV test DBxudan1-0/+28
In order to use OPNFV test results page to do the ayalysis of all OVP test cases, it needs to push all results generated by Dovetail CI jobs to test DB and then using http://testresults.opnfv.org/test/#/results to check all results. The following data must contain in the POST body: 1. project_name 2. case_name 3. details 4. installer 5. scenario 6. pod_name 7. build_tag 8. criteria 9. start_date 10. stop_date 11. version JIRA: DOVETAIL-767 Change-Id: I925ae249e24efd7bfb1c68a69150e9c22f0cdf36 Signed-off-by: xudan <xudan16@huawei.com>
2019-03-18Replace subprocess commands with Docker SDKStamatis Katsaounis1-14/+12
JIRA: DOVETAIL-752 This patch replaces all python subprocess commands with the Docker SDK relevant commands. Change-Id: Iac7caffd80a863a8a022247d735b2a7f2792e49d Signed-off-by: Stamatis Katsaounis <mokats@intracom-telecom.com>
2019-01-03Add ONAP VNF SDK verification testsxudan1-1/+1
Please refer to env_config.sh.onap.sample when testing it. The guide of preparing local env for onap package validation can be found here https://gerrit.onap.org/r/#/c/75119 Change-Id: I39d6b11544847756126623a7eb3b953dc800c470 Signed-off-by: xudan <xudan16@huawei.com>
2018-11-23Integrate k8s test cassesxudan1-34/+54
In order to integrate k8s test cases, Dovetail framework should do some refactor and make it more general for k8s test cases as well as ONAP ones. Integrate 2 k8s test cases. JIRA: DOVETAIL-748 Change-Id: Ibd87754ffb5fb29f6b4ce79232af860c2ed2da9c Signed-off-by: xudan <xudan16@huawei.com>
2018-11-14Add missing unit tests for utils filesStamatis Katsaounis1-27/+26
JIRA: DOVETAIL-724 This patch adds unit tests which were missing from dovetail code base. Furthermore it updates the test_parser existing unit test. Finally, it fixes some minor issues in dovetail_utils itself. Change-Id: I8fd7cd4f6b1ede11664914746d2279f062511639 Signed-off-by: Stamatis Katsaounis <mokats@intracom-telecom.com>
2018-09-05Enable the web portal to show all endpointsxudan1-6/+19
The endpoints info for the 2018.08 has been changed. The web portal needs some adaptions for the new data format. It keeps the same as 2018.01 and doesn't need to change dovetail-webportal. JIRA: DOVETAIL-725 Change-Id: I74cde3aa6032c7afac4b6ce1d2146e09a0f99fe5 Signed-off-by: xudan <xudan16@huawei.com>
2018-06-29Update licence headers to comply with guidelinesGeorg Kunz1-3/+2
Updating the licence headers to comply with the community guidelines [1] and anteater checks. [1] https://wiki.opnfv.org/display/DEV/Contribution+Guidelines#ContributionGuidelines-License Change-Id: Idec787e32daf76c0b1bd6108977b78828125da5e Signed-off-by: Georg Kunz <georg.kunz@ericsson.com>
2018-06-14Replace openstack commands with shadexudan1-43/+10
Use openstack shade to get endpoint infomation rather than executing openstack commands directly. The next step can replace openstack commands by shade for some test cases that need to create openstack resources (images, flavors) if we agree to use shade. JIRA: DOVETAIL-659 Change-Id: I72b302fb2d4a61e9249a7e53f81ea9464944dcd3 Signed-off-by: xudan <xudan16@huawei.com>
2018-05-04Remove local DBxudan1-18/+0
Remove local DB and can just report without launch local DB. Need to do a little modification with the web portal code. JIRA: DOVETAIL-593 Change-Id: I595db39cce4156596ee0522d4b7e642a23d78ab9 Signed-off-by: xudan <xudan16@huawei.com>
2018-04-10Support to specify docker image for each test casexudan1-0/+17
1. Currently each type of test cases will use one docker image. 2. For example, Functest test cases use opnfv/functest-restapi:euphrates Yardstick uses opnfv/yardstick:opnfv-5.1.0 3. It needs to support to specify the docker image for each test case. 4. For example, vping test cases use opnfv/functest-smoke:euphrates sdnvpn uses opnfv/functest-features:euphrates 5. The benefit of this is that these docker images are well verified by Functest CI and from Functest plan, they may not support functest-restapi docker image in its future release. JIRA: DOVETAIL-638 Change-Id: I8a30eea2233aeff809af2e241b6c939194397832 Signed-off-by: xudan <xudan16@huawei.com>
2018-03-14Bugfix: Failed to get the hardware infoxudan1-3/+4
The directory of userconfig has changed from /home/opnfv/dovetail/dovetail/userconfig to /etc/dovetail/userconfig. Change-Id: Id3e8b1f3e9299e9263a4adf3456b6733fdb62e11 Signed-off-by: xudan <xudan16@huawei.com>
2018-03-14Add process info to pod.yaml to specify the info of a special processxudan1-0/+28
1. Many HA test cases try to kill special processes with their name. 2. Then they check corresponding openstack services and the status of processes' recovery. 3. For different SUTs, the names of the processes and the hosts' names may be different. 4. So there is a requirement for Dovetail tool to provide one way to allow users to specify all the infos about process name and its host name. 5. All process infos can be added into file DOVETAIL_HOME/user_config/pod.yaml 6. The infos include 'attack_process' and 'attack_host' for each HA test cases. 7. If not given in this file, will use Yardtsick default values. JIRA: DOVETAIL-627 Change-Id: I83cee991f72a8685080ed562597c70d73002623a Signed-off-by: xudan <xudan16@huawei.com>
2018-03-01Bugfix: Dovetail tool will crash when hosts.yaml file with incorrect formatxudan1-1/+34
If the hosts.yaml file is like, — hosts_info: 192.168.141.101: it will raise an exception, File "/usr/local/lib/python2.7/dist-packages/dovetail/utils/dovetail_utils.py", line 227, in add_hosts_info names=hostnames) File "/usr/local/lib/python2.7/dist-packages/python_hosts/hosts.py", line 54, in _init_ raise Exception('Address and Name(s) must be specified.') Exception: Address and Name(s) must be specified. If the hosts.yaml file is empty, it will crash with, File "/usr/local/lib/python2.7/dist-packages/dovetail/container.py", line 174, in create if hosts_yaml['hosts_info']: TypeError: 'NoneType' object has no attribute '_getitem_' JIRA: DOVETAIL-621 Change-Id: I547928e514b3294c048379459c07df89879fbb03 Signed-off-by: xudan <xudan16@huawei.com>
2018-02-16Add a function to check the cacert filexudan1-3/+16
1. Currently it won't pass the cacert file to other containers if the OS_AUTH_URL is http not https. 2. However, even though the OS_AUTH_URL is http, it still needs cacert file somewhere for Functest and Rally. 3. This problem is found on Fuel Euphrates. 4. Add a function to check whether the cacert file exists. 5. If exists, pass it to testing project containers. JIRA: DOVETAIL-616 Change-Id: Ied7bcc72e8f1c738bbce32c18096ca13641d3cd7 Signed-off-by: xudan <xudan16@huawei.com>
2018-02-08Add ablity to config EXTERNAL_NETWORK in env_config.shEddie Arrage1-23/+28
- EXTERNAL_NETWORK env variable can be explicitly set - If set, the value will be used in Yardstack configuration - Otherwise, previous method of using output from 'openstack network list' will still be employed Change-Id: I9d8b4a69ff3f5093c034823cc95e92e151bfade6 Signed-off-by: Eddie Arrage <eddie.arrage@huawei.com>
2017-11-20bugfix: hosts info is wrongly processedSerenaFeng1-4/+8
changes: 1. add usage example in hosts.yaml.sample 2. fix /etc/hosts from wrong format {'hostname': 'ip'} to the right 'ip hostnames' 3. fix --add-hosts from wrong usage --add-host {'hostname': 'ip'} to the right --add-host='hostnames':ip 4. support per ip mapping mutiple hostnames, which is also in line with /etc/hosts schema JIRA: DOVETAIL-556 Change-Id: I92e8cb0fd3476b61f5c73a69e34c4a66aef51d6e Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
2017-11-02Get SUT's endpoint infoxudan1-0/+27
Get the admin endpoints of all service. JIRA: DOVETAIL-546 Change-Id: Ie0ac3bc5b4eb0885046e207b73217994a4f0e358 Signed-off-by: xudan <xudan16@huawei.com>
2017-11-02Get hardware info of SUTxudan1-0/+82
Hardware info: Use ansible to get all hardware info from all nodes. JIRA: DOVETAIL-540 Change-Id: I6a2dde1b2ebae2af8f702008c23110ebe63cc06f Signed-off-by: xudan <xudan16@huawei.com>
2017-09-07Modify logsxudan1-6/+7
JIRA: DOVETAIL-498 Change-Id: Ie98fc89cc840b557aa4186c6c2bee2d610432af0 Signed-off-by: xudan <xudan16@huawei.com>
2017-08-31Bugfix: the config files in useeconfig will cover user's configxudan1-0/+6
1. Now there are 2 sample files tempest_conf.yaml and hosts.yaml in userconfig, and thet will cover user's tempest_conf.yaml and hosts.yaml in $DOVETAIL_HOME/pre_config. 2. Rename the files in userconfig to be tempest_conf.yaml.sample and hosts.yaml.sample. 3. Add the hosts info in file /etc/hosts in Dovetail Container. JIRA: DOVETAIL-492 Change-Id: I2b5694a8058b864b510925eec595d6f2bd1062ff Signed-off-by: xudan <xudan16@huawei.com>
2017-08-16Bugfix: wrong command in function 'check_https_enabled'xudan1-3/+4
JIRA: DOVETAIL-482 1. In function check_https_enabled, it will use cmd "openstack catalog show identity |awk '/public/ {print $4}'" to check if it is https. 2. However, this command will not work if it is https. 3. Check https via OS_AUTH_URL rather than "openstack catalog show identity". Change-Id: If40ffa8e9b33c38123ff4b834198a8eaaedc1c9c Signed-off-by: xudan <xudan16@huawei.com>
2017-07-17Delete the ERROR log when it is not httpsxudan1-4/+5
JIRA: DOVETAIL-462 1. If it is not https, Dovetail will give a error log 2017-07-13 21:58:30,409 - container.Container - ERROR - The command 'openstack catalog show identity |awk '/public/ {print $4}'| grep 'https'' failed. 2. Remove this error log becuase it is not an error. Change-Id: I5791b1925cad8606d70eefd4940dd9bf46956305 Signed-off-by: xudan <xudan16@huawei.com>
2017-06-28Modify Dovetail logsxudan1-9/+11
JIRA: DOVETAIL-450 Change-Id: I795679c9559d1bead3aecefff28d21b6567aac2f Signed-off-by: xudan <xudan16@huawei.com>
2017-06-27https enabled checkingMatthewLi1-5/+16
JIRA: DOVETAIL-456 before to check OS_CACERT and OS_INSECURE when using https + credential or + no credential, there's a need to check if https enabled. error log https://build.opnfv.org/ci/view/dovetail/job/dovetail-fuel-baremetal-proposed_tests-danube/37/console Change-Id: Icdf17541fe6cf64b2f000d424c8d4dcc28cfd371 Signed-off-by: MatthewLi <matthew.lijun@huawei.com>
2017-06-21Merge "fix judgement for https+no credential case"hongbo tian1-2/+2
2017-06-21Merge "Docker version misalignment and move some irrelevant messages"Leo wang1-21/+14
2017-06-20fix judgement for https+no credential caseMatthewLi1-2/+2
Change-Id: Id3d4e9af04f1882f69b8c9fe588355d76ad001c4 Signed-off-by: MatthewLi <matthew.lijun@huawei.com>
2017-06-09https + no credential supportMatthewLi1-8/+16
JIRA: DOVETAIL-440 Change-Id: I2bb430de040127dea493e8bb5423ad8204f799e2 Signed-off-by: MatthewLi <matthew.lijun@huawei.com>
2017-06-07Docker version misalignment and move some irrelevant messagesxudan1-21/+14
JIRA: DOVETAIL-437 JIRA: DOVETAIL-444 1. Docker client version and server version should be 1.12.3 or later. 2. If any of them is older than 1.12.3, there will be an ERROR message. 3. Delete the “rm -rf results” message. Change-Id: I0c10cf256ef139cac4d43f36108bf5f3f9da8398 Signed-off-by: xudan <xudan16@huawei.com>
2017-05-04Get results json data from databasexudan1-1/+3
JIRA: DOVETAIL-417 1. If report results with files, all results will be stored in local files. 2. If report to database, will get results from database and stored with file results.json Change-Id: Ic30037bd66cd37042f82b75fac2043a876e21c6f Signed-off-by: xudan <xudan16@huawei.com>
2017-05-03local db support offline modeLeo Wang1-3/+3
JIRA: DOVETAIL-415 The local db also need to support offline, move all the git clone/apt/yum/pip/wget/curl into the Dockerfile Change-Id: I2392dc9f4a6bd6f6a5a3f4849625a576c51a44f8 Signed-off-by: Leo Wang <grakiss.wanglei@huawei.com>
2017-05-01Tips on update docker to right version, > 1.8grkiss1-0/+25
JIRA: DOVETAIL-414 Dovetail requires docker at version > 1.8, so add some validation in code, and also versions of client and server should match with each other, or there will be unpredictable errors. Gives a notice to user to decide whether to update the docker to the latest version(1.17) Change-Id: I1331f5c19943a73e8fe25f76bd21628233e556f3 Signed-off-by: grakiss <grakiss.wanglei@huawei.com>
2017-04-21use Functest tempest_custom test cases to run all Ipv6 test casesxudan1-6/+6
JIRA: DOVETAIL-401 1. modify all Ipv6 test cases, change tempest_smoke_serial/tempest_full_parallel into tempest_custom, add ID of each sub-testcases. 2. Some sub-testcases in ipv6.tc002, ipv6.tc003, ipv6.tc004 and ipv6.tc005 can not be found in the full tempest test case list. 2. disable testcases' script_result_acquired to enable tempest_custom run multiple times. 3. use build_tag-testcase_name(such as daily-master-79a6e392-28bb-4c40-9d88-a03bed99da2d-dovetail.ipv6.tc025) as the unique ID of each testcase. 4. comment out the progress bar, because it has some problems when print the report text. 5. Functest has changed the TEST_DB_URL from http://<testapi>:<port>/apv/v1 to http://<testapi>:<port>/apv/v1/results. 6. Functest has changed the TEST_DB_URL to file://<file_path>/<file_name>. see https://gerrit.opnfv.org/gerrit/#/c/33511/ Change-Id: I524f6702377f215f526158214842481eb44565be Signed-off-by: xudan <xudan16@huawei.com>
2017-04-12dovetail tool: bugfix: test cases are erroneously judgedxudan1-0/+14
JIRA: DOVETAIL-375 JIRA: DOVETAIL-390 1. defcore test cases are erroneously judged because of: a) defcore results json data lack some keys b) some sub-testcases' names are the same as the prefix of another sub-testcases. 2. this patch removes the extra keys and judge sub-testcases accurately. 3. remove "store_type" in functest_config.yml and yardstick_config.yml. 4. change some log levels from info to debug. Change-Id: I5f126e70309409cac66ef9a0909f1573d325098b Signed-off-by: xudan <xudan16@huawei.com>
2017-04-10dovetail tool: show progress during executing test casesxudan1-1/+6
JIRA: DOVETAIL-159 1. It takes long time to execute test cases that most of users think it hangs there, so a progress is needed to show the test is running. 2. add dynamic progress during execution 3. it' s a fake progress only showing the test is alive, not to show the percentage of completion. Change-Id: I0294659f79e8e09d1bcdd36d8f391d933e35b635 Signed-off-by: xudan <xudan16@huawei.com>
2017-03-31dovetail tool: check push_to_db success or failxudan1-0/+16
JIRA: DOVETAIL-380 If Functest fails to push results to db, there is just an error log in functest.log Dovetail needs to know the failure. Dovetail will get the results from db with keys, build_tag and testcase. If it can get the results data, it means push_to_db success. Fix the duration time wrong. Change-Id: If03bdf0ceb2f1a9d422381cdf06e1fd207358bd5 Signed-off-by: xudan <xudan16@huawei.com>
2017-03-21dovetail tool: remove installer and CI related variablesxudan1-0/+27
JIRA: DOVETAIL-371 1. remove all the envs in functest_config.yml and yardstick_config.yml 2. remove all relative cmds in cmd_config.yml 3. remove all the envs when running a new functest/yardstick container 4. add some variables just for functest pushing results to db 5. get the external network name for yardstick 6. make --debug/-d just control the log level shown on the screen 7. set requests=2.10.0 since python-openstackclient needs 'requests!=2.12.2,!=2.13.0,>=2.10.0' Change-Id: I9f941e09d067fc95a14c3c9be1374f41df4a9a16 Signed-off-by: xudan <xudan16@huawei.com>
2017-01-19dovetail tool: modify function exec_cmd to force it to flush the bufferxudan1-16/+11
1. force to flush the buffer line by line 2. remove the progress bar since it will stay in the screen if using the cli command JIRA: DOVETAIL-173, which will be ugly. JIRA: DOVETAIL-172 Change-Id: I47b823c7e0bce955a50086613a656c83ab7707e3 Signed-off-by: xudan <xudan16@huawei.com>
2017-01-13dovetail tool: command lineMatthewLi1-2/+3
JIRA: DOVETAIL-173 details please see https://wiki.opnfv.org/display/dovetail/Dovetail+Command+Line Change-Id: Iff04b0df8c4e6310d35a45b9c8ba3c7b3b5e1105 Signed-off-by: MatthewLi <matthew.lijun@huawei.com>
2016-12-22[dovetail tool]check and get results for each cmdLeo Wang1-1/+1
JIRA: DOVETAIL-166 Check the results of each cmds executed in test case 1. the results of pre_condition, post_condition, cmds need to be checked, so it can get a quick fail, dont need to go through the next step 2. it's more accurate to show where error occurred as early as possible 3. get results from shell scripts Change-Id: I5c1e59839c55b92de0e83e7e1eb552aa364b3f80 Signed-off-by: Leo Wang <grakiss.wanglei@huawei.com>
2016-12-16updated the process flow of function exec_cmdRyan.RCS1-34/+33
separate the log expressions to other functions removed statements that not necessary output error detail info in exception Change-Id: I721611d61dee83eb5f40ee954d433073114e231a JIRA: DOVETAIL-161 Signed-off-by: Ryan.RCS <lihainong@huawei.com>
2016-12-16dovetail tool: show progress during executing test casesxudan1-0/+19
1. the utils exec_cmd() will take a long time for some cmds such as executing test cases and pull images. 2. if the time is longer than 3 seconds, progress bar will be shown on the screen. JIRA: DOVETAIL-159 Change-Id: I4ae04d6e884853d843baf8f547394247f4165377 Signed-off-by: xudan <xudan16@huawei.com>
2016-11-28dovetail tool: add brackets to print message for consistencyzshi1-1/+1
Change-Id: I74c0aefb7ada960aac55aed15aab6b7b9984154e Signed-off-by: zshi <zshi@redhat.com>
2016-10-14[dovetail_tool] Fix the python style scanned by flake8xudan1-11/+15
JIRA: DOVETAIL-34 Change-Id: Ib9a6dd254f1d77b0cbbfa66e8e1e44df1ce14a4b Signed-off-by: xudan <xudan16@huawei.com>
2016-10-12preparation for setup.pyMatthewLi1-0/+87
JIRA: DOVETAIL-26 1)change the directory scripts to dovetail, to make it unified in OPNFV and for setup.py 2)change the paths accordingly 3)this should be first merged, since docker is changed, then to add setup.py and run the local test Change-Id: I65974bde17f310ebbfe3c025532b05dae8752945 Signed-off-by: MatthewLi <matthew.lijun@huawei.com>