aboutsummaryrefslogtreecommitdiffstats
path: root/functest/utils/functest_utils.py
AgeCommit message (Collapse)AuthorFilesLines
2023-03-13Detect OpenStack ZedCédric Ollivier1-1/+5
Change-Id: I3b0c9e030f2d31a6151d9ba44f2a06a627b3d913 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2021-11-15Update linters and fix all new issuesCédric Ollivier1-9/+8
It mostly add encoding in open calls and leverage f-strings. Change-Id: Ifead18fc724a452c1067dcf91dc577032edc9c59 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2021-08-18Update to Alpine 3.14Cédric Ollivier1-14/+12
It also fixes lots of new pylint warnings. Change-Id: I3376aee5649596c53bc2941ad4d8e0674a2967fe Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2021-05-17Detect OpenStack ussuriCédric Ollivier1-1/+3
Change-Id: I645913aba06fc87a89fbb5a1a7c090777ca1be7f Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2020-04-30Update OpenStack release detectionCédric Ollivier1-1/+3
Change-Id: Icad13836d88583ee676525d4743f12a5b888ebe2 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2020-01-24Update Alpine to 3.11Cédric Ollivier1-2/+2
It also updates Python to 3.8 (default version). It selects arm32v6 et arm64v8 repos and switches multiarch binfmt. https://alpinelinux.org/posts/Alpine-3.11.0-released.html Change-Id: Ib41cf0ab805ce2137658f3ff656b0a88c7b4ebf5 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2019-09-29Detect OpenStack TrainCédric Ollivier1-1/+4
It takes into account latest max nova microversions [1] [1] https://docs.openstack.org/nova/latest/reference/api-microversion-history.html Change-Id: Icb9838b09ad22f6e87e9d8fb3c47525bdc1e3307 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2019-09-28Fix falsy linksCédric Ollivier1-2/+2
It completes the previous commit "Allow getting service via any endpoint" [1]. [1] https://gerrit.opnfv.org/gerrit/c/functest/+/68542 Change-Id: Ib396ed75e2385f99bce51e09d37f7f05808b5b5e Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2019-09-28Allow getting service via any endpointCédric Ollivier1-0/+47
It overrides the default implementation provided by Shade. Change-Id: I3ad2f8ba543be4483f108c4bd7765018dddc5b19 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2019-05-25Set utf-8 in decode and encode callsCédric Ollivier1-2/+2
It eases backporting in iruya and hunter as a few logs can't be decoded as ascii [1]. [1] https://build.opnfv.org/ci/job/functest-opnfv-functest-vnf-iruya-juju_epc-run/56/console Change-Id: I52a6f9a25130cbf62e8ce3b9972064ab73177665 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2019-05-13Update to Python3Cédric Ollivier1-2/+2
Functest containers leverage on Python3 instead of python2. https://mail.python.org/pipermail/python-dev/2018-March/152348.html It also updates robotframework librairies to latest release and Vmtp to master ([1] is needed) It patches cloudify rest client to support python3. Vmtp is currently disabled because it currently supports python2 only. [1] https://github.com/openstack/vmtp/commit/a5d062881d91bf4f547d92c6e289bea30feb5d6e#diff-b4ef698db8ca845e5845c4618278f29a Change-Id: I39964a212ec2d4dbf53c9ea7c63f02e0b6a05b48 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2019-04-20Add Stein in Nova API microversionsCédric Ollivier1-1/+3
Change-Id: I42e854122fde9495cb3472ccc78900eccb20670d Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2018-10-15Ease configuring extra specs via env varsDelia Popescu1-1/+1
Ease configuring flavor extra specs, as well as image extra specs. Set environment variables for image_properties and flavor extra_specs for ovs|fdio scenario from the start. Image extra_properties and flavor extra_specs will continue to get updates from functest config file but so will from IMAGE_PROPERTIES and FLAVOR_EXTRA_SPECS env variables. Change-Id: Ie1c69e66d2e2e158915d214402fe44d9991c56d3 Signed-off-by: Delia Popescu <delia.popescu@enea.com>
2018-10-14Fix image properties parsingCédric Ollivier1-0/+32
It removes useless spaces and now conforms with oslo.conf dict. New helpers and unit tests are available. Change-Id: I20335c5e5c3840cc872e158c6072d97a3f2cb98c Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2018-09-14Update get_openstack_version()Cédric Ollivier1-2/+4
It takes Rocky maximum version into account. Change-Id: I55469de4a63f1f824222660130a20d7fd8fa42c3 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2018-08-18Generate API doc rst filesCédric Ollivier1-4/+2
It also fixes few docstrings Change-Id: I10bae7b7fab40edd931dd55ab8859946e3b38a71 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2018-07-21Add helpers to detect OpenStack versionsCédric Ollivier1-1/+63
It leverages on Nova API Microversions [1]. [1] https://docs.openstack.org/nova/latest/reference/api-microversion-history.html Change-Id: I60abf9089036e56fcbcd6c2b734666ea20875ceb Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2018-06-30Inherit rally from VmReady1Cédric Ollivier1-19/+0
It also fixes clean(). Change-Id: I42d1305d5cdb5a717cfa7fce26798ac7102310f7 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2018-05-05Implement get_external_network via shadeCédric Ollivier1-0/+19
It fixes the current issues as EXTERNAL_NETWORK is mainly unset by all Installers [1]. [1] https://build.opnfv.org/ci/view/functest/job/functest-fuel-armband-baremetal-arm-daily-fraser/31/console Change-Id: I8ee62623701c15b9ff962d0a0e07a77934ff03ac Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2018-02-26Remove obsolete Functest utilsCédric Ollivier1-98/+0
Only 3 functions are kept as part of our framework: - execute_command_raise() - execute_command() - get_parameter_from_yaml() Change-Id: I966a1d6122391dae85aa3c77813ad2f1698ceb45 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2018-02-22Switch from CONST to CONFCédric Ollivier1-2/+2
It also removes constants.CONST and env.Environment which are now useless. Depends-On: I764a0a2a24447c941d1e726f3116593b29dd1c1e Depends-On: I6cfa832466dcefd737314633d807512e46267a69 Change-Id: Ife41c59d9f2e6ec4e49df38af962039f99554bc5 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2018-02-19Remove last CONST.__getattribute__()Cédric Ollivier1-3/+2
Change-Id: I82f6aa1e723c88eebd4c7410da4b9741a482e9bc Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2018-02-16Get properly env vars or their default valuesCédric Ollivier1-3/+3
It defines env.get() as an unique way to get Functest env vars or their default values. It can be considered as a wrapper above os.environ. It enforces backward compatibility via CONST which mustn't be used for that purpose. It should be noted that it also stops using CONST for getting OpenStack env vars. Change-Id: I333dc1afbc0123166a7eaff8b551370098efa341 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2018-02-09Move get_dict_by_test() into run_tests.pyCédric Ollivier1-23/+0
It also removes functest_utils.get_criteria_by_test() Change-Id: I3f265642acd053755e32f8e92f1086b93517c247 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2018-01-26Fix pylint errors in several utils modulesCédric Ollivier1-52/+40
All utils which are moving to xtesting are now fixed. It remains OpenStack and Functest utils (+ the related unit tests) which doesn't move to the new package. Change-Id: If13c627c8444c62d5c6bf9c8057d6413aa0e56c7 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2018-01-21Move push_results_to_db to TestCaseCédric Ollivier1-101/+0
It removes the link between TestCase and Functest utils (xtesting). It should be noted that testresults url can only be set by env var. Co-Authored-By: Cédric Ollivier <cedric.ollivier@orange.com> Change-Id: Ie072c675890d0ae2e63619c599d2684a8c7d762d Signed-off-by: Jose Lausuch <jalausuch@suse.com> Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-12-20Remove logger_test_resultsCédric Ollivier1-33/+0
It was only called in Feature which the result is already printed (see __str__()). It also eases moving Feature to xtesting as it breaks the link to functest_utils. Change-Id: Ib72d651dc7d89598704ff4d52d8b1ecb2bdade5b Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-12-12All patching config files in memoryLinda Wang1-13/+0
It adds the yaml content as Config attribute and allow patching it without modifying the file (and reimport constants or config). It also removes obsolete data in config_patch.yaml and moves several functions in the right modules (Config) JIRA: ARMBAND-334 Co-Authored-By: Cédric Ollivier <cedric.ollivier@orange.com> Change-Id: I5c9a574d3283828063154c977cdfbc2abfdc6777 Signed-off-by: Linda Wang <wangwulin@huawei.com> Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-11-30Stop updating test_db_url in config file by env varLinda Wang1-1/+4
If TEST_DB_URL is declared in env variable, use it before considering the var in config file. Change-Id: I656ad8765287c48d60af7ab88b421805d76fb231 Signed-off-by: Linda Wang <wangwulin@huawei.com>
2017-09-07Remove redundant tempest cleanup utilityLinda Wang1-4/+4
All the resources including the project, user, network, images and flavors to enable tempest running, are created by snaps-OO, which will definitely clean up those finally. Change-Id: Iea3e3f275cc6cfd2cee421fcafef90aaf2e6cf3e Signed-off-by: Linda Wang <wangwulin@huawei.com>
2017-08-29Remove get_installer_typeLinda Wang1-13/+0
JIRA: FUNCTEST-763 Change-Id: Ib05f699063393eb6eaa9f559854aca50b77aead3 Signed-off-by: Linda Wang <wangwulin@huawei.com>
2017-08-28Obtain scenario by CONST instead of get functionLinda Wang1-15/+1
JIRA: FUNCTEST-763 Change-Id: Ic9fa3243b50a09de8a5e531fed8298997367dd84 Signed-off-by: Linda Wang <wangwulin@huawei.com>
2017-08-24Merge "Obtain pod_name by CONST instead of get function"Morgan Richomme1-14/+1
2017-08-23Refactor resource creation and cleanup in TempestMartin Kulhavy1-4/+4
Use Snaps to create resources before running a testcase and to clean up afterwards. Use Tempest Cleanup utility to clean other resources. Change-Id: Ic0f69d3bafb60dfb283d18ac507e9f5992e9ae38 Signed-off-by: Martin Kulhavy <martin.kulhavy@nokia.com>
2017-08-17Obtain pod_name by CONST instead of get functionLinda Wang1-14/+1
JIRA: FUNCTEST-763 Change-Id: Id334745a1eac8b933d77f9cb36a506a02366d760 Signed-off-by: Linda Wang <wangwulin@huawei.com>
2017-08-15Obtain build_tag by CONST instead of get functionLinda Wang1-15/+4
JIRA: FUNCTEST-763 Change-Id: I86b0b515a3d51df20a35c2aeb461a95d0c5797fd Signed-off-by: Linda Wang <wangwulin@huawei.com>
2017-06-20Remove all references to /home/opnfv/repos/functestCédric Ollivier1-5/+3
It also removes relative (and incomplete) references which could be defined in modules instead of this global configuration. Change-Id: Ie20dc3547e49b6224aa8100cd380d37b87ece5a9 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-06-19Stop getting git data from functest dirCédric Ollivier1-10/+0
Functest is no longer a git clone. Change-Id: Ieaceacaa820e9a7a3c64e8c1fbd2a8a9321f234d Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-06-01Use CONST to retrieve db_url rather than getter functionLinda Wang1-14/+6
1. Remove get_db_url() 2. If TEST_DB_URL declared in env, update test_db_url in config_functest.yaml file during env preparation 3. No matter TEST_DB_URL declared in env or not, Result_DB = CONST.__getattribute__("results_test_db_url") JIRA: FUNCTEST-763 Change-Id: I20da7ef98bbcc56731e0ff7061b05c1dde6cbfc3 Signed-off-by: Linda Wang <wangwulin@huawei.com>
2017-05-21Sort keys when dumping jsonCédric Ollivier1-1/+2
Otherwise dumping them could break some unit tests as they are unordered collections [1]. [1] https://build.opnfv.org/ci/job/functest-verify-master/4122/ Change-Id: I108e946926ae9690cf2421e565f2bb81500f9160 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-05-19Set default value for CONFIG_FUNCTEST_YAMLCédric Ollivier1-2/+3
It calculates via the full path of env.py. Change-Id: Ief958833f5116cdb116d0153d85a0ae03063ec5c Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-05-18Remove check_success_ratejose.lausuch1-10/+0
After the introduction of is_successful method in TestCase class, this is not needed anymore. Change-Id: I70f6f9e10495601cd5443467347b97efe27b81a3 Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
2017-05-17Update self.result value to INTjose.lausuch1-2/+2
So far, the test cases are storing a string "PASS" "FAIL" in the self.result variable. The way the new framework works is with INT Values. Change-Id: I45e8693327740faadd8254b21569adfb2cefa6c8 Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
2017-05-17Add Python3 support to the ODL testcaseCédric Ollivier1-6/+6
It also adds this support to its dependencies. Change-Id: I0534f0c7b0e15a9ee89f522f314cf5200874454c Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-05-04Delete functest.utils.functest_loggerCédric Ollivier1-2/+2
It deletes functest.utils.functest_logger and the related unit tests. Then it modifies all functest modules to get all loggers via logging.getLogger(). __name__ is mainly used as getLogger arg as proposed by logging [1]. All loggers and handlers are now defined via functest/ci/logging.ini instead of a dict loaded by an external json file. Now only warn messages and info messages from ci and core packages are printed in console. [1] https://docs.python.org/2/library/logging.html Change-Id: Ic192855e0f9bf94825d8f7ec73549a0f3b8d44c5 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-04-26Manage criteria in TestCaseCédric Ollivier1-16/+7
It converts all criteria values to the corresponding percent in functest/ci/testcases.yaml. Result is expected to be equal or greater than criteria. If both are 0, result is considered as false. It is compatible with the old behavior but warns to update. It will allow a safer remove. It also fixes a bug in test_tempest to allow merging [1] and tier_handler.py which required that type criteria was str. [1] https://gerrit.opnfv.org/gerrit/#/c/27949/ Change-Id: Ib6edcfa3103b7d51b0bdc83119f1cea2a8be9fbc Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-04-26Switch TestCase attribute criteria to resultCédric Ollivier1-3/+3
It mainly avoids mixing input and output. Criteria is now an input set in functest/ci/testcases.yaml and then must be passed as __init__() args (which will be proposed in an additional change). Then it also renames the related TestCase method to check_result(). Change-Id: Ifc3c8e3ea6cde7e3edf7174bed4bf2bf0894e8e3 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-04-19Stop hardcoding results suffix in push_to_dbMatthewLi1-1/+1
Adding results in url is useless as it is defined in results section in config_functest.yaml. It allows defining the full name in case of dumping to file (see decorator.py). The commented local file is the value required by dovetail. Co-Authored-By: Cédric Ollivier <cedric.ollivier@orange.com> Change-Id: I35ba9b34d99e138292f099934e28585ee8b85604 Signed-off-by: MatthewLi <matthew.lijun@huawei.com> Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-04-11Modify TestCase constructor attributesCédric Ollivier1-1/+1
Every feature/testcase now allows receiving the data defined in testcases.yaml as args (name is renamed to case_name). From the time being, only project and case names are handled. Next pending patches will add criteria, cmd and repo to this list. It keeps the default values for case names except for features which will be aggregated into Feature. Change-Id: Id742d100b8183d7f10894c24ae6879d1b2b60ac9 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-03-20bug fix: version not retrieved on weekly jobsMorgan Richomme1-7/+1
a first fix had been done but the version was retrieved 2 times with the regex this patch removes the second regex and re-use get_version the associated unit tests has been removed because even if the build_tag is badly formated, it will not prevent the results to be pushed with version = unknown JIRA: FUNCTEST-765 Change-Id: I2cbe8ba1dd7278c3f3510a47c667c433f65e00f8 Signed-off-by: Morgan Richomme <morgan.richomme@orange.com>