aboutsummaryrefslogtreecommitdiffstats
path: root/functest/utils/openstack_utils.py
AgeCommit message (Collapse)AuthorFilesLines
2018-02-16Get properly env vars or their default valuesCédric Ollivier1-5/+5
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-12Export env vars via os.environ in test_openstack_utils.pyCédric Ollivier1-1/+1
CONST shouldn't be used for getting/setting env vars. It adds complexity and may raise side effects. Change-Id: I8319748dd2f0abb95b82a2f65191cac8ccba7f5e Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2018-02-08Move source_credentials() into run_tests.pyCédric Ollivier1-16/+0
It's also renamed source_envfile(). Change-Id: I0e7c38c2def125961f86dc2bc9a63cfb6ad87c03 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2018-01-26proper instance status handlingPeriyasamy Palanisamy1-1/+4
This would fix the exception happening in the SDNVPN CI testsuite. Example: http://artifacts.opnfv.org/logs/functest/lf-pod1/2018-01-21_17-18-06/bgpvpn.log Change-Id: Ie22dcdbba5299177d4e98e5995433553df5bfa68 Signed-off-by: Periyasamy Palanisamy <periyasamy.palanisamy@ericsson.com>
2017-12-15Inject all envs in openrc into CONSTLinda Wang1-0/+1
After "env_prepare" is removed, some specific vars in openrc (eg,."EXTERNAL_NETWORK") loaded to os.environ should be injected into CONST in one python process. Change-Id: Iaa5c6047033dc2a30c533174e2016111759aec31 Signed-off-by: Linda Wang <wangwulin@huawei.com>
2017-11-23Remove openstack utils calls in rally and tempestLinda Wang1-43/+0
Mainly, update "rally deployment create --file=rally_conf.json" to "rally deployment create --fromenv" Change-Id: I6dd4c7ea2d9d6f47dee49a4fd416e62bd557f45e Signed-off-by: Linda Wang <wangwulin@huawei.com>
2017-11-02Adopt new config schema for rally 0.10Linda Wang1-1/+2
The new config schema is used by Rally 0.10: https://raw.githubusercontent.com/openstack/rally/master/samples/deployments/existing-keystone-v3.json JIRA: FUNCTEST-883 Change-Id: I67c0081e23d7a763934ef2f8ce09f122c33af902 Signed-off-by: Linda Wang <wangwulin@huawei.com>
2017-09-11Remove volume type handlingJuha Kosonen1-33/+0
Rally scenarios don't require volume type to exist as a precondition. Change-Id: Id735346e062af084635fd8f76f3686005b9b8add Signed-off-by: Juha Kosonen <juha.kosonen@nokia.com>
2017-09-07Remove redundant tempest cleanup utilityLinda Wang1-59/+0
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-09-01Add UEFI support in functestCatalina Focsa1-5/+15
Add extra properties to the cirros image for ARM architecture. In the glanceclient repository, the create method expects **kwargs as parameters, thus an extra_properties variable containing a dictionary of property-value pairs can be added (if given) to the image to be created. If the properties do not appear, the call should not affect the image properties because the dictionary is initialized as empty. Change-Id: I690da90e6c6f250bd0a3d99cce39aa250e19b9c2 Signed-off-by: Catalina Focsa <catalina.focsa@enea.com>
2017-08-23Refactor resource creation and cleanup in TempestMartin Kulhavy1-0/+59
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-17Specify valid external network as an envLinda Wang1-1/+8
In some deployments, the retrieved external network by the def get_external_net checked by "router:external" is not available. So it is necessary to specify the available external network as an env by user for some deployments. JIRA: FUNCTEST-865 Change-Id: I561bc7d57e06214516a4cdbebd67632cd9746fba Signed-off-by: Linda Wang <wangwulin@huawei.com>
2017-08-15Fix domain in tenant creationJuha Kosonen1-1/+14
Use the ID of the domain when creating a tenant on keystone v3. Change-Id: Ic415237e2bb2d537f07ab2245816a575f977aaa0 Signed-off-by: Juha Kosonen <juha.kosonen@nokia.com>
2017-07-27Omit space line in openrc fileLinda Wang1-4/+6
For alpine testing in compass OSA, sourcing openrc failed due to space lines included. Change-Id: I23166090a2fa7c2ce0aa03be581231cbb3cea34a Signed-off-by: Linda Wang <wangwulin@huawei.com>
2017-07-06Fix get_endpointLinda Wang1-2/+2
Different endpoint urls can be searched with 'admin', 'internal' and 'public' interface. Change-Id: I57207826d0dc2c18ce0e6a0abf09140f639f64ba Signed-off-by: Linda Wang <wangwulin@huawei.com>
2017-07-03[cloudify_ims] Support Cloudify 4.0boucherv1-21/+38
- Delete all shell commands to use cloudify python lib - Cloudify Manager installation with a packaged image - SNAPS integration - Adapt test_vnf unit tests - Initiate test cloudify_ims unit tests (to be completed) JIRA: FUNCTEST-838 Change-Id: Ia4b499d4155e6af5d37d6d5cf4310a5a9693c7ce Signed-off-by: boucherv <valentin.boucher@orange.com> Signed-off-by: Morgan Richomme <morgan.richomme@orange.com>
2017-06-29Remove BGPVPN utils in Functestjose.lausuch1-37/+0
These util functions should be under control of the SDNVPN project. After [1] and [2] it is safe to remove them in Functest [1] https://gerrit.opnfv.org/gerrit/#/c/36655/ [2] https://gerrit.opnfv.org/gerrit/#/c/36505/ Change-Id: I2f6596cd60678bb0c50adb9b4bc0d59545c3fb0a Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
2017-06-26Merge "Make rally support https insecure deployment"Jose Lausuch1-5/+8
2017-06-26Merge "Use glance to list images"Jose Lausuch1-5/+5
2017-06-26Change floating ips management from nova to neutronjose.lausuch1-7/+7
Nova does not longer support floating ip creation/deletion. This patch moves that logic to neutron client. Change-Id: I2c4146149fe5be534d9c50d78d831b5af1957ad7 Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
2017-06-24Make rally support https insecure deploymentLinda Wang1-5/+8
When running in https environment, rally should support insecure deployment if no cacert file is provided. JIRA: FUNCTEST-828 Change-Id: I29b0fc8c2e1b74a1ce08293706cd9f11f975b6d5 Signed-off-by: Linda Wang <wangwulin@huawei.com>
2017-06-24Use glance to list imagesLinda Wang1-5/+5
1. Images list is not supported by novaclient 8.0.0 2. It moves images list out of nova and into glance Change-Id: I2a2d40a2ca3a0cf1ebfb55697b3c58af8748a805 Signed-off-by: Linda Wang <wangwulin@huawei.com>
2017-06-23Merge "Enable https insecure for functest"Jose Lausuch1-8/+4
2017-06-21Enable https insecure for functestLinda Wang1-8/+4
1. When running in https environment, functest should provide an option to disable server certificate verification. 2. For check_os.sh, the param "--insecure" is passed to openstack cli, e.g.. openstack --insecure server list. JIRA: FUNCTEST-828 Change-Id: Ie2c5b14152c92e87318fcfaf8b234f59275eb6b8 Signed-off-by: Linda Wang <wangwulin@huawei.com>
2017-06-06Refactor core VNF classMorgan Richomme1-0/+68
- Simplify processing - Implement run method to inherit testcase methods - Add unit tests - Fix all pylint issues It also obliges vnf and its uts to be rated 10/10 by pylint. JIRA: FUNCTEST-830 Co-Authored-By: Cédric Ollivier <cedric.ollivier@orange.com> Change-Id: I8dd24eea55089277c9e5b2b51fb14dc377f2fcaf Signed-off-by: Morgan Richomme <morgan.richomme@orange.com> Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-05-21Delete line breaks before binary operatorCédric Ollivier1-4/+4
They are considered as warnings by flake8. Change-Id: I84ffedc41c24133aa0d45e312bb095526aa1095b Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-05-17Add Python3 support to the ODL testcaseCédric Ollivier1-57/+57
It also adds this support to its dependencies. Change-Id: I0534f0c7b0e15a9ee89f522f314cf5200874454c Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-05-05Merge "Delete functest.utils.functest_logger"Jose Lausuch1-3/+2
2017-05-04Delete functest.utils.functest_loggerCédric Ollivier1-3/+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-05-04Merge "Update rally_conf.json for creating deployment"Jose Lausuch1-2/+10
2017-05-02Add the choice of interface for keystoneclientLinda Wang1-1/+3
1. When functest is running on external host not jumpserver, keystoneclient is used to retrieve or create projects/tenants and users, which would fail to establish connection to the admin endpoint. 2. Keystoneclient will connect to the public endpoint by setting the env OS_INTERFACE to be public. 3. Remove the admin endpoint check in check_os.sh. JIRA: FUNCTEST-801 Change-Id: I324f5c8fdf61447319070a23f6b6bc6b1bbc1d48 Signed-off-by: Linda Wang <wangwulin@huawei.com>
2017-04-27Update rally_conf.json for creating deploymentLinda Wang1-2/+10
1. The rally_conf.json is obtained via def get_credentials_for_rally(), where the parameter endpoint_type is supposed to get from the env OS_ENDPOINT_TYPE or OS_INTERFACE, just as the def get_creds_from_env_vars() in rally project [1]. [1] https://github.com/openstack/rally/blob/master/rally/cli/envutils.py JIRA: FUNCTEST-801 Change-Id: I6b6be82b9ff7f04948b47c4fca836d415fe13f8b Signed-off-by: Linda Wang <wangwulin@huawei.com>
2017-04-20[VNF_base] Support existing tenant and userboucherv1-0/+18
Support existing tenant and user with a get_or_create_tenant method. If the tenant and user already exist it only get the id of those JIRA: FUNCTEST-799 Change-Id: Id5daf2904592e42199471bdd3547e861e6db6e32 Signed-off-by: boucherv <valentin.boucher@orange.com>
2017-03-30Check a rule existence for a specific security grouptomsou1-0/+34
Implement a functionality to check if a rule concerning a specific security group exists - function get_security_group_rules(neutron_client, sg_id) returns the list of the security rules for a specific security group - function check_security_group_rules(neutron_client, sg_id, direction, protocol, port_min=None, port_max=None) checks if a specific rule for a specific security group exists and returns True or False - implement unit tests for the two new functions This new functionality is needed for sdnvpn project Change-Id: Ib930bc9a76141932f4164d88e2640b49f3df4d77 Signed-off-by: tomsou <soth@intracom-telecom.com>
2017-03-23Merge "Support running on openstack which enabled https"Jose Lausuch1-2/+15
2017-03-21Change execute bitsCédric Ollivier1-0/+0
It applies the rules proposed by "Improve unix permissions fixes" [1]. [1] https://gerrit.opnfv.org/gerrit/#/c/31171/ Change-Id: If5142befb74165a982f9281e8770289b303d483d Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-03-13Support running on openstack which enabled httpshelenyao1-2/+15
JIRA: FUNCTEST-757 Change-Id: Ic87bee3020b9714bcd83105127440a9c1a7ff2ad Signed-off-by: helenyao <yaohelan@huawei.com>
2017-03-01Merge "Fix bad log message when trying to create an existing sec group"Jose Lausuch1-26/+33
2017-03-01Fix bad log messageMorgan Richomme1-26/+33
when trying to create an existing sec group JIRA: FUNCTEST-741 Change-Id: I049cdbd854bf5c4fbc490fb0fd52689800159da5 Signed-off-by: Morgan Richomme <morgan.richomme@orange.com>
2017-02-28[odl-sfc] Add function to retrieve a resource from HEATJuan Vidal1-0/+28
Introduces function to retrieve a HEAT client. For the moment, the only wrapper function is the one to retrieve resources. Added unit tests to cover the new functions. python-heatclient is added to requirements.txt and test_requirements.txt. Change-Id: I547138141c6aad611f2353599fb70a013c83058a Signed-off-by: Juan Vidal <juan.vidal.allende@ericsson.com>
2017-02-14Limit the substitution of ' in env varsCédric Ollivier1-4/+6
Only ' located and the beginning or at the end of the string are removed. It completes the first proposal [1]. [1] https://gerrit.opnfv.org/gerrit/#/c/28563/ Change-Id: Ic21cea4c6e98d92983f385c875c3e214411b5f2d Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-02-14Bugfix: remove double quotes from environment variablesjose.lausuch1-1/+2
JIRA: FUNCTEST-724 Change-Id: Iae248d710813a241752e1a06fb87d650caf3d188 Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
2017-02-09Fix source_credentials in openstack_utilsCédric Ollivier1-7/+7
It fixes issues raised when an env var contains '=' (e.g. LS_COLORS). It now exports the vars listed in rc_file without creating a new process. Change-Id: I6e6a4e3ab9c45afe4d40015831acb283acbe564c Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2016-12-26Enable the tenant related featureshelenyao1-25/+32
JIRA: FUNCTEST-670 The tenant related features were enabled for OpenStack snapshot and cleanup. Change-Id: Ie9a4012c0d29f57ed5a14139ccb5f8e29b6000dd Signed-off-by: helenyao <yaohelan@huawei.com>
2016-12-25Adapt create_tenant and create_user to keystone v3jose.lausuch1-9/+28
JIRA: FUNCTEST-670 Change-Id: I5bb288be2dd5cee1776930ca94d1acad82f50160 Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
2016-12-21Updated vims to support keystone v3Jose Lausuch1-15/+25
Adding the choice, into openstack_utils, to get openstack client with environment credentials or with a specific credentials (new user/tenant..) JIRA: FUNCTEST-529 Change-Id: I295808311de40f37a07b5a831852876a51f276f3 Signed-off-by: boucherv <valentin.boucher@orange.com>
2016-12-16Fix the issue of unexpected keyword argument 'endpoint_type'helenyao1-70/+61
JIRA: FUNCTEST-662 Different OpenStack has different version of RC file thus the environment variables vary. The keystoneauth1 initialization only support limited input. This patch only feed the required input to keystoneauth1. Moreover, the patch optimized the code by removing hardcode and improved the scalability. Change-Id: Id6815f96a11f2918bc2c7bc1c33f38c3f5754e11 Signed-off-by: helenyao <yaohelan@huawei.com>
2016-12-14Authenticate clients with keystoneauth1.sessionhelenyao1-63/+98
JIRA: FUNCTEST-529 1. use keystoneauth1.session to initialize the client for each service The keystoneauth1.session.Session class was introduced into keystoneauth1 as an attempt to bring a unified interface to the various OpenStack clients that share common authentication and request parameters between a variety of services. 2. update ODL case to leverage session to get the endpoint info Change-Id: Ic8c01b9b7ed86d3bdd9f5125504bc47f46a37700 Signed-off-by: helenyao <yaohelan@huawei.com>
2016-12-13Merge "Rename add_floating_ip arg to floatingip_addr"Jose Lausuch1-3/+3
2016-12-13Merge "Add host aggregate / av zones util functions"Jose Lausuch1-0/+103