aboutsummaryrefslogtreecommitdiffstats
path: root/utils
AgeCommit message (Collapse)AuthorFilesLines
2016-09-01Add print-to-a-file option when executing a command in functest_utilsjose.lausuch1-4/+11
Change-Id: I8b91979380d0f4794d5ceaf8edb2a9d80cd7170f Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
2016-09-01stop hardcoded FUNCTEST_REPO path everywhereSerenaFeng2-7/+1
functest repo is used by almost every testcase, each place we get it like: REPOS_DIR = os.getenv('repos_dir') FUNCTEST_REPO = ("%s/functest" % REPOS_DIR) provide a common interface in functest_util.py JIRA: FUNCTEST-453 Change-Id: Ie0635dacc761ed2d05b7e606530368844f32ebaf Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
2016-09-01Merge "unify functest_yaml obtain process"Jose Lausuch1-6/+9
2016-08-31unify functest_yaml obtain processSerenaFeng1-6/+9
functest_yaml is needed in almost all of the testcases, the obtain process is the same: with open(os.environ["CONFIG_FUNCTEST_YAML"]) as f: functest_yaml = yaml.safe_load(f) f.close() abstract a method to unify the process, and provide the interface JIRA: FUNCTEST-447 Change-Id: I96a9a9962d7b466f10bbd3b5ab2495957524e22a Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
2016-08-31Remove all logers as utils method args.Cédric Ollivier1-32/+29
As it modifies method params, it could break the testcases. JIRA: FUNCTEST-428 Change-Id: I4263d9bd812f1803e513464e3c321cc4a7281958 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2016-08-31Use a global logger instead of method argsCédric Ollivier1-74/+44
It's the first step to safely remove all logers as method args. Outputs printed by bash scripts called by execute_command are no longer written in functest.log. Else logs printed by python scripts will be duplicated in it. JIRA: FUNCTEST-428 Change-Id: I60702f3b62121f731cd6845c335e227f97df37c9 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2016-08-31unify testcases.yaml obtain processSerenaFeng1-1/+5
hardcoded "''FUNCTEST_REPO + "/ci/testcases.yaml"''' appears wherever testcases.yaml is needed, abstract a method to provide unified interface JIRA: FUNCTEST-449 Change-Id: Ida8e3d90926d3e2245883a29f577ecb121bd5d6c Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
2016-08-30Flush stdout as it can be redirected to logCédric Ollivier1-0/+1
It avoids mixed logs in Jenkins' console by flushing every message printed by the forked programs as logger.info() does. It must be complete by refactoring logger management in util functions [1] and by preventing output buffering in forked programs. [1] https://jira.opnfv.org/browse/FUNCTEST-428 JIRA: FUNCTEST-441 Change-Id: Id8da814d79ea6b1e6b91b49e23a85c3802e11515 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2016-08-26Set env vars as mandatory to push to DBCédric Ollivier1-5/+24
Now env vars are mandatory in push_results_to_db. It avoids testing programs to check them even if they are useless from their points of view. The related getters aren't removed to help debugging via logger_test_results which could be run without report. Change-Id: Iadb94319529f5ec4230fb62042511948183b93ed Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2016-08-26refactor create shared network process to eliminate reduplicateSerenaFeng1-0/+22
Some places shared network is created through create_network_full first, then update it to shared, abstract a uniformed method to eliminate reduplicate JIRA: FUNCTEST-437 Change-Id: I13c20ab061323188c5eb3b8c861674df38083c62 Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
2016-08-26refactor create or get image process to eliminate reduplicateSerenaFeng1-0/+20
Some places when create image is referred, they check if image exist, if exist use it directly, else create a new one. Abstract a method to integrate the process JIRA: FUNCTEST-432 Change-Id: I83d1112aa5cb0d3cdfab92fd49cd5f2c1cceff82 Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
2016-08-23Merge "Avoid duplicating logs in run_tests.py"valentin boucher1-1/+2
2016-08-23Merge "when create/get/update failed return None rather than False"Morgan Richomme1-21/+21
2016-08-23Avoid duplicating logs in run_tests.pyCédric Ollivier1-1/+2
When run_tests.py sets logger as execute_command arg, logs are duplicated in functest.log and not shown in console (as every DEBUG message). As logger is mainly managed by the python scripts in charge of testing, it can be safely removed here. stderr is also redirected to stdout in execute_command to print possible relevant data. JIRA: FUNCTEST-431 Change-Id: Ie77544b4679e12e0a0ac7f5e5989d86862fe106b Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2016-08-23when create/get/update failed return None rather than FalseSerenaFeng1-21/+21
In openstack_util.py, when create/get/update network or other resources failed, False is returned, which is incompatible with success return value such as id, network_nic. JIRA: FUNCTEST-427 Change-Id: Id2f55d8524e5aff150ba6bfb799085377a63baa4 Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
2016-08-23refactor push_result_to_db print thingSerenaFeng1-11/+38
when Exceptions happen, the print code is too difficult to understand and maintain, modify to make it clear jira: FUNCTEST-425 Change-Id: Ie12af989e711df3791167955642f2edf1164b146 Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
2016-08-22bugfix: push_result_to_db exception showSerenaFeng1-0/+5
When pod is not exist in DB, exception will be shown as 'Error pushing results into Database '<type 'exceptions.TypeError'>'', very unclear, make it very difficult to fix the problem. Modify it to show as the testapi returned 'HTTPError: HTTP 404: Not Found (Could not find pod [zte-no])' JIRA: FUNCTEST-424 Change-Id: I55fc4639d745b84f6d32a148bd13793d236e2a09 Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
2016-08-19Fix print when push_results_to_db failsCédric Ollivier1-2/+2
Change-Id: I82741a8727fc17bc6648e1b1e92511b3efd93b8a Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2016-08-17Check the response status codeCédric Ollivier1-0/+1
Now an HTTPError exception is raised in case of a 4XX or 5XX error response. Change-Id: Idd91c1d2b2a1b81a1cf7d075527cb302099cdb4e Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2016-08-17Add reporting flag to push reuslts only from CIMorgan Richomme1-3/+12
JIRA: FUNCTEST-416 Change-Id: I1a5800be0dcf75573f44e6214b23917aadc1cbf7 Signed-off-by: Morgan Richomme <morgan.richomme@orange.com>
2016-08-10Create config_functest patch to update the conf with scenarioboucherv1-4/+17
Adding support of LXD scenario JIRA: FUNCTEST-268 Change-Id: I5891ff9de674d99d32d8db747be501ee8a2e6609 Signed-off-by: boucherv <valentin.boucher@orange.com>
2016-08-04Merge "unify test result check for feature project and apply to parser"valentin boucher1-2/+19
2016-08-04unify test result check for feature project and apply to parserSerenaFeng1-2/+19
add check_test_result() method to unify test result process JIRA: FUNCTEST-405 Change-Id: Iee4d2876cbbf372f8c3e3bf94448036669bc7f7e Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
2016-08-03functest utils - get_resolvconf_ns() Ensure that dns works with dns name ↵boucherv1-5/+9
resolution JIRA: FUNCTEST-402 Change-Id: I5fa9204aafb13330eb810950aa7bc728f1a69162 Signed-off-by: boucherv <valentin.boucher@orange.com>
2016-07-29correct rally criteria checkSerenaFeng1-0/+19
add method check_success_rate() to unify criteria check by success_rate JIRA: FUNCTEST-398 Change-Id: I1b3f0ccd7061b80ac88356206f29844e31e4101b Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
2016-07-29unify test results logger and apply to parserSerenaFeng1-0/+21
refine a unified method to log the test results and use it to parser. JIRA: FUNCTEST-397 Change-Id: I5ed6b04107be5590b1d9d5683c8f1846fef5a4d4 Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
2016-07-28Add region name to OpenStack credentialsDimitri Mazmanov1-0/+4
Currently functest doesn't account for regions when it tries to instantieate OpenStack clients. As a result, the code fails when functest is used in a multi-region environment. The fix forces functest account for region name. Signed-off-by: Dimitri Mazmanov <dimitri.mazmanov@ericsson.com> Change-Id: Iebbd20042548c02da9d5ed7e58a454347a555778
2016-07-28Add endpoint type support on functestboucherv1-6/+31
By default public endpoint was used but now you can use internal or admin JIRA: FUNCTEST-387 Change-Id: If1adaa88248d379ad6d74b20f2dffd76278b67b9 Signed-off-by: boucherv <valentin.boucher@orange.com>
2016-07-27Make openstack_clean be aware of the names and not only the IDsjose.lausuch1-8/+16
Sometimes, when using the same container for a different deployment, the IDs of the openstack resources are different but the names are the same. This will avoid cleaning for example the user 'admin' regardless of the ID it has. JIRA: FUNCTEST-383 Change-Id: If27603f8f6d0cb7ad0aeba6e3c89ca19e2b8aed2 Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
2016-07-22Fix execute_command function to show all the outputjose.lausuch1-8/+6
This function wasn't showing anything for some commands, like 'rally show images' and 'rally show flavors' JIRA: FUNCTEST-348 Change-Id: I75bf5f3504ea8ffea42c2fb237d6863c655259e1 Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
2016-07-20Remove logger as input parameter of functions in openstack_utilsjose.lausuch1-7/+5
JIRA: FUNCTEST-376 Also some fixes to get rid of flake8 violations in onos-sfc Change-Id: I52c2fd30a6b81af20ea779db2d73b9386524f7ce Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
2016-07-19Add logger to openstack_utils to output error messagesjose.lausuch1-92/+109
This will help to see the exception error when something fails JIRA: FUNCTEST-376 Change-Id: Ibaa6954fc63af00d552ac32b3cf903b9218200d1 Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
2016-07-19Show real time tempest test executionjose.lausuch1-1/+2
JIRA: FUNCTEST-375 Change-Id: I4f0cb68639b927f2980389d9331ec260605c8caf Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
2016-07-18Don't take openstack snapshot when "-n" option is setjose.lausuch1-10/+10
JIRA: FUNCTEST-236 Change-Id: I37bfa4ebe88a8cf02f2cddc8fc4cce70ad87b775 Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
2016-07-14Use common way to get the openstack clientsjose.lausuch3-48/+21
Instead of repeating the code in all the scripts and importing the openstack libraries, the clients shall be given by openstack utils, which is its purpose JIRA: FUNCTEST-163 Change-Id: I1ccc05a3af44ee1ab5938ea9e4e01dbe55f4816d Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
2016-07-12Chmod 755 all py files which can be executedCédric Ollivier2-0/+0
All files where __main__ is checked can now be executed by everyone. It results from [1]. [1] find . -name "*.py" |xargs grep __main__ |cut -d\: -f 1 |xargs chmod 755 Change-Id: I9ad153cfdde0447213e35dac102e668d9e754cf9 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2016-07-11Add fixed_ip and files parameters in openstack_utils in create_instancejose.lausuch1-10/+20
This is needed i.e. for sdnvpn test case Change-Id: I235a6871a86b7a0c4a9ab27a3aef4bfd62ba4d43 Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
2016-07-08Add delete bgpvpn function in openstack utilsjose.lausuch1-0/+5
JIRA: FUNCTEST-99 Change-Id: I0d28e5d07c857f4e80d7cf96a2ff4dbf87075abe Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
2016-07-07Fix function get_hypervisors in openstack utilsjose.lausuch1-1/+2
JIRA: FUNCTEST-99 Change-Id: I23fd3fae08255d36ec158e5a522640615b5d8a10 Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
2016-07-07Added 'vacation' test casevitikkan1-0/+52
Running this test case illustrates how Functest code base and performance tend to grow when trying to catch more and more bugs in OPNFV environment. The case is not bound to any tier. Change-Id: Ib3c2f3f3d9d78c1251fbb35e6ea6afd3cf1afbdb Signed-off-by: vitikkan <viktor.tikkanen@nokia.com>
2016-07-07[SDNVPN] Bugfix bgpvpn functions in openstack utilsjose.lausuch1-5/+4
JIRA: FUNCTEST-99 Change-Id: Ia3fd91ec1dff5283edc3df098bb5cec342f87aea Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
2016-07-07[SDNVPN] Add helper functions to create bgpvpn and associationsNikolas Hermanns1-0/+19
JIRA: FUNCTEST-99 These functions are used by sdnvpn test cases to create vpns and network associations Change-Id: I2fb25c84d8d02ea1cc92677e6a33e469a5d3ddc3 Signed-off-by: Nikolas Hermanns <nikolas.hermanns@ericsson.com>
2016-07-06Add support functions for SDNVPN test casesjose.lausuch1-5/+22
JIRA: FUNCTEST-99 Get availability zones from nova client and give the possibility to create an instance on a specific hypervisor (availability zone) Change-Id: Ieb2d26764c50ea4f4403818bb73a238236e03ee4 Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
2016-07-04Add example script creating an instancejose.lausuch1-22/+81
This is to be used by feature projects or newcomers to functest. SFC or BGPVPN test cases can be based on this one. The script creates an instance and assigns a floating IP to it. Change-Id: If35495631031187bfb5382ba8c0a8884dfaa3d7f Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com> Depends-On: Ie10d55872bc8c5a404b0d0156ee49a9d94482008
2016-07-04Add openstack clients and create instance in openstack_utilsjose.lausuch2-7/+89
JIRA: FUNCTEST-346 Change-Id: Ie10d55872bc8c5a404b0d0156ee49a9d94482008 Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
2016-07-04Change OpenStack clean behaviourjose.lausuch3-52/+80
JIRA: FUNCTEST-236 The openstack snapshot generation is now triggered before running a test case and removed from prepare_env Change-Id: I4d1bc95dedd7f59d4b1d5866f288e1c1a70ec69e Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
2016-06-16Remove default values if the os credentials are not setjose.lausuch1-5/+12
If the creds are not sourced, then exit. Change-Id: I55c9cd3a5a0885b81df4ce14502ba816546bcbaa Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
2016-06-13Fix bug: use right format for date when pushing to DBMorgan Richomme1-2/+5
JIRA: FUNCTEST-303 Change-Id: I53e7c8f963ef0fa248d76e0d1c5f04326a750dcc Signed-off-by: Morgan Richomme <morgan.richomme@orange.com>
2016-06-08Adapt functest testcase to APi refactoringMorgan Richomme1-6/+24
JIRA: FUNCTEST-303 Change-Id: Ia276d9ca6e8d62b496c3b5f81561b14b02c43fd7 Signed-off-by: Morgan Richomme <morgan.richomme@orange.com>
2016-06-02Merge "Add criteria in testcases.yaml and Test class"Morgan Richomme1-0/+18