diff options
42 files changed, 8 insertions, 1829 deletions
diff --git a/api/apidoc/functest.ci.check_deployment.rst b/api/apidoc/functest.ci.check_deployment.rst deleted file mode 100644 index 278fa3a9a..000000000 --- a/api/apidoc/functest.ci.check_deployment.rst +++ /dev/null @@ -1,7 +0,0 @@ -functest.ci.check\_deployment module -==================================== - -.. automodule:: functest.ci.check_deployment - :members: - :undoc-members: - :show-inheritance: diff --git a/api/apidoc/functest.ci.rst b/api/apidoc/functest.ci.rst deleted file mode 100644 index 06d0cd508..000000000 --- a/api/apidoc/functest.ci.rst +++ /dev/null @@ -1,17 +0,0 @@ -functest.ci package -=================== - -Submodules ----------- - -.. toctree:: - - functest.ci.check_deployment - -Module contents ---------------- - -.. automodule:: functest.ci - :members: - :undoc-members: - :show-inheritance: diff --git a/api/apidoc/functest.opnfv_tests.openstack.rst b/api/apidoc/functest.opnfv_tests.openstack.rst index f883cbad4..d035ce85d 100644 --- a/api/apidoc/functest.opnfv_tests.openstack.rst +++ b/api/apidoc/functest.opnfv_tests.openstack.rst @@ -12,7 +12,6 @@ Subpackages functest.opnfv_tests.openstack.rally functest.opnfv_tests.openstack.refstack functest.opnfv_tests.openstack.shaker - functest.opnfv_tests.openstack.snaps functest.opnfv_tests.openstack.tempest functest.opnfv_tests.openstack.vgpu functest.opnfv_tests.openstack.vmtp diff --git a/api/apidoc/functest.opnfv_tests.openstack.snaps.api_check.rst b/api/apidoc/functest.opnfv_tests.openstack.snaps.api_check.rst deleted file mode 100644 index ac540e9c8..000000000 --- a/api/apidoc/functest.opnfv_tests.openstack.snaps.api_check.rst +++ /dev/null @@ -1,7 +0,0 @@ -functest.opnfv\_tests.openstack.snaps.api\_check module -======================================================= - -.. automodule:: functest.opnfv_tests.openstack.snaps.api_check - :members: - :undoc-members: - :show-inheritance: diff --git a/api/apidoc/functest.opnfv_tests.openstack.snaps.health_check.rst b/api/apidoc/functest.opnfv_tests.openstack.snaps.health_check.rst deleted file mode 100644 index 81e4fd341..000000000 --- a/api/apidoc/functest.opnfv_tests.openstack.snaps.health_check.rst +++ /dev/null @@ -1,7 +0,0 @@ -functest.opnfv\_tests.openstack.snaps.health\_check module -========================================================== - -.. automodule:: functest.opnfv_tests.openstack.snaps.health_check - :members: - :undoc-members: - :show-inheritance: diff --git a/api/apidoc/functest.opnfv_tests.openstack.snaps.rst b/api/apidoc/functest.opnfv_tests.openstack.snaps.rst deleted file mode 100644 index 2bd4ba2c7..000000000 --- a/api/apidoc/functest.opnfv_tests.openstack.snaps.rst +++ /dev/null @@ -1,22 +0,0 @@ -functest.opnfv\_tests.openstack.snaps package -============================================= - -Submodules ----------- - -.. toctree:: - - functest.opnfv_tests.openstack.snaps.api_check - functest.opnfv_tests.openstack.snaps.health_check - functest.opnfv_tests.openstack.snaps.smoke - functest.opnfv_tests.openstack.snaps.snaps_suite_builder - functest.opnfv_tests.openstack.snaps.snaps_test_runner - functest.opnfv_tests.openstack.snaps.snaps_utils - -Module contents ---------------- - -.. automodule:: functest.opnfv_tests.openstack.snaps - :members: - :undoc-members: - :show-inheritance: diff --git a/api/apidoc/functest.opnfv_tests.openstack.snaps.smoke.rst b/api/apidoc/functest.opnfv_tests.openstack.snaps.smoke.rst deleted file mode 100644 index 90f5a10ad..000000000 --- a/api/apidoc/functest.opnfv_tests.openstack.snaps.smoke.rst +++ /dev/null @@ -1,7 +0,0 @@ -functest.opnfv\_tests.openstack.snaps.smoke module -================================================== - -.. automodule:: functest.opnfv_tests.openstack.snaps.smoke - :members: - :undoc-members: - :show-inheritance: diff --git a/api/apidoc/functest.opnfv_tests.openstack.snaps.snaps_suite_builder.rst b/api/apidoc/functest.opnfv_tests.openstack.snaps.snaps_suite_builder.rst deleted file mode 100644 index e21864f85..000000000 --- a/api/apidoc/functest.opnfv_tests.openstack.snaps.snaps_suite_builder.rst +++ /dev/null @@ -1,7 +0,0 @@ -functest.opnfv\_tests.openstack.snaps.snaps\_suite\_builder module -================================================================== - -.. automodule:: functest.opnfv_tests.openstack.snaps.snaps_suite_builder - :members: - :undoc-members: - :show-inheritance: diff --git a/api/apidoc/functest.opnfv_tests.openstack.snaps.snaps_test_runner.rst b/api/apidoc/functest.opnfv_tests.openstack.snaps.snaps_test_runner.rst deleted file mode 100644 index b72c28ee4..000000000 --- a/api/apidoc/functest.opnfv_tests.openstack.snaps.snaps_test_runner.rst +++ /dev/null @@ -1,7 +0,0 @@ -functest.opnfv\_tests.openstack.snaps.snaps\_test\_runner module -================================================================ - -.. automodule:: functest.opnfv_tests.openstack.snaps.snaps_test_runner - :members: - :undoc-members: - :show-inheritance: diff --git a/api/apidoc/functest.opnfv_tests.openstack.snaps.snaps_utils.rst b/api/apidoc/functest.opnfv_tests.openstack.snaps.snaps_utils.rst deleted file mode 100644 index d98919903..000000000 --- a/api/apidoc/functest.opnfv_tests.openstack.snaps.snaps_utils.rst +++ /dev/null @@ -1,7 +0,0 @@ -functest.opnfv\_tests.openstack.snaps.snaps\_utils module -========================================================= - -.. automodule:: functest.opnfv_tests.openstack.snaps.snaps_utils - :members: - :undoc-members: - :show-inheritance: diff --git a/api/apidoc/functest.rst b/api/apidoc/functest.rst index b308853d1..e6eb5189c 100644 --- a/api/apidoc/functest.rst +++ b/api/apidoc/functest.rst @@ -6,7 +6,6 @@ Subpackages .. toctree:: - functest.ci functest.core functest.opnfv_tests functest.utils diff --git a/docker/healthcheck/testcases.yaml b/docker/healthcheck/testcases.yaml index e3eb028c9..5aac7010e 100644 --- a/docker/healthcheck/testcases.yaml +++ b/docker/healthcheck/testcases.yaml @@ -146,33 +146,6 @@ tiers: - /src/odl_test/csit/suites/openstack/neutron - - case_name: api_check - project_name: functest - criteria: 100 - blocking: true - description: >- - This test case verifies the retrieval of OpenStack clients: - Keystone, Glance, Neutron and Nova and may perform some - simple queries. When the config value of - snaps.use_keystone is True, functest must have access to - the cloud's private network. - run: - name: api_check - - - - case_name: snaps_health_check - project_name: functest - criteria: 100 - blocking: true - description: >- - This test case creates executes the SimpleHealthCheck - Python test class which creates an, image, flavor, network, - and Cirros VM instance and observes the console output to - validate the single port obtains the correct IP address. - run: - name: snaps_health_check - - - case_name: tempest_smoke project_name: functest criteria: 100 diff --git a/docker/smoke/testcases.yaml b/docker/smoke/testcases.yaml index 878db7059..aa936fec7 100644 --- a/docker/smoke/testcases.yaml +++ b/docker/smoke/testcases.yaml @@ -106,22 +106,6 @@ tiers: - 'test_auto_allocated_topology_rbac' - - case_name: snaps_smoke - project_name: functest - criteria: 100 - blocking: false - description: >- - This test case contains tests that setup and destroy - environments with VMs with and without Floating IPs - with a newly created user and project. Set the config - value snaps.use_floating_ips (True|False) to toggle - this functionality. When the config value of - snaps.use_keystone is True, functest must have access to - the cloud's private network. - run: - name: snaps_smoke - - - case_name: neutron_trunk project_name: functest criteria: 100 diff --git a/docs/release/release-notes/functest-release.rst b/docs/release/release-notes/functest-release.rst index ee1e8e89f..2509eddfa 100644 --- a/docs/release/release-notes/functest-release.rst +++ b/docs/release/release-notes/functest-release.rst @@ -32,15 +32,12 @@ The internal test cases are: * vping_ssh * vping_userdata * cinder_test - * api_check - * snaps_health_check * odl * tempest_smoke * neutron-tempest-plugin-api * rally_sanity * refstack_defcore * patrole - * snaps_smoke * neutron_trunk * networking-bgpvpn * networking-sfc diff --git a/docs/testing/developer/devguide/index.rst b/docs/testing/developer/devguide/index.rst index 101236f27..8565cb6aa 100644 --- a/docs/testing/developer/devguide/index.rst +++ b/docs/testing/developer/devguide/index.rst @@ -81,9 +81,7 @@ Functest internal test cases The internal test cases in Euphrates are: - * api_check * connection_check - * snaps_health_check * vping_ssh * vping_userdata * odl @@ -105,8 +103,7 @@ The main internal test cases are in the opnfv_tests subfolder of the repository, the internal test cases can be grouped by domain: * sdn: odl, odl_fds - * openstack: api_check, connection_check, snaps_health_check, vping_ssh, - vping_userdata, tempest_*, rally_* + * openstack: connection_check, vping_ssh, vping_userdata, tempest_*, rally_* * vnf: cloudify_ims If you want to create a new test case you will have to create a new folder @@ -126,7 +123,6 @@ The external test cases are: * fds * promise * refstack_defcore - * snaps_smoke * functest-odl-sfc * orchestra_clearwaterims * orchestra_openims @@ -229,14 +225,11 @@ as follows:: |-- openstack_tacker.py `-- openstack_utils.py -It is recommended to use the SNAPS-OO library for deploying OpenStack -instances. SNAPS `[4]`_ is an OPNFV project providing OpenStack utils. - TestAPI ======= Functest is using the Test collection framework and the TestAPI developed by -the OPNFV community. See `[5]`_ for details. +the OPNFV community. See `[4]`_ for details. Reporting @@ -248,7 +241,7 @@ jinja2 templates `[3]`_. Dashboard ========= -Additional dashboarding is managed at the testing group level, see `[6]`_ for +Additional dashboarding is managed at the testing group level, see `[5]`_ for details. @@ -256,7 +249,7 @@ details. How TOs ======= -See How to section on Functest wiki `[7]`_ +See How to section on Functest wiki `[6]`_ ========== @@ -269,12 +262,10 @@ _`[2]`: http://artifacts.opnfv.org/functest/docs/userguide/index.html functest u _`[3]`: https://git.opnfv.org/releng-testresults/tree/reporting -_`[4]`: https://git.opnfv.org/snaps/ - -_`[5]`: http://docs.opnfv.org/en/latest/testing/testing-dev.html +_`[4]`: http://docs.opnfv.org/en/latest/testing/testing-dev.html -_`[6]`: https://opnfv.biterg.io/goto/283dba93ca18e95964f852c63af1d1ba +_`[5]`: https://opnfv.biterg.io/goto/283dba93ca18e95964f852c63af1d1ba -_`[7]`: https://wiki.opnfv.org/pages/viewpage.action?pageId=7768932 +_`[6]`: https://wiki.opnfv.org/pages/viewpage.action?pageId=7768932 IRC support chan: #opnfv-functest diff --git a/docs/testing/user/configguide/intro.rst b/docs/testing/user/configguide/intro.rst index d20eb111c..02329995c 100644 --- a/docs/testing/user/configguide/intro.rst +++ b/docs/testing/user/configguide/intro.rst @@ -64,9 +64,6 @@ follows:: + + + + + + SUT = System Under Test -Note connectivity to management network is not needed for most of the -testcases. But it may be needed for some specific snaps tests. - All the libraries and dependencies needed by all of the Functest tools are pre-installed into the Docker images. This allows running Functest on any platform. diff --git a/docs/testing/user/configguide/prerequisites.rst b/docs/testing/user/configguide/prerequisites.rst index 6155882d3..4b1ba10af 100644 --- a/docs/testing/user/configguide/prerequisites.rst +++ b/docs/testing/user/configguide/prerequisites.rst @@ -14,13 +14,6 @@ Several prerequisites are needed for Functest: #. An admin/management network created on the SUT #. Connectivity from the Jumphost to the SUT public/external network -Some specific SNAPS tests may require a connectivity from the Jumphost to the -SUT admin/management network but most of the test cases do not. This -requirement can be changed by overriding the 'interface' attribute -(OS_INTERFACE) value to 'public' in the credentials file. Another means to -circumvent this issue would be to change the 'snaps.use_keystone' value from -True to False. - WARNING: Connectivity from Jumphost is essential and it is of paramount importance to make sure it is working before even considering to install and run Functest. Make also sure you understand how your networking is diff --git a/docs/testing/user/userguide/test_details.rst b/docs/testing/user/userguide/test_details.rst index 53078ea8b..31519676c 100644 --- a/docs/testing/user/userguide/test_details.rst +++ b/docs/testing/user/userguide/test_details.rst @@ -24,25 +24,10 @@ The tests are: * *connection_check* - * *api_check* - * *snaps_health_check* -Connection_check consists in 9 test cases (test duration < 5s) checking the +Connection_check consists in test cases (test duration < 5s) checking the connectivity with Glance, Keystone, Neutron, Nova and the external network. -Api_check verifies the retrieval of OpenStack clients: Keystone, Glance, -Neutron and Nova and may perform some simple queries. When the config value of -snaps.use_keystone is True, functest must have access to the cloud's private -network. This suite consists in 49 tests (test duration < 2 minutes). - -Snaps_health_check creates a VM with a single port with an IPv4 address that -is assigned by DHCP and then validates the expected IP with the actual. - -The flavors for the SNAPS test cases are able to be configured giving new -metadata values as well as new values for the basic elements of flavor (i.e. -ram, vcpu, disk, ephemeral, swap etc). The snaps.flavor_extra_specs dict in the -config_functest.yaml file could be used for this purpose. - Self-obviously, successful completion of the 'healthcheck' testcase is a necessary pre-requisite for the execution of all other test Tiers. @@ -228,21 +213,6 @@ NOTE: Test case 'rally_sanity' executes a limited number of Rally smoke test cases. Test case 'rally_full' executes the full defined set of Rally tests. -snaps_smoke ------------- - -This test case contains tests that setup and destroy environments with VMs with -and without Floating IPs with a newly created user and project. Set the config -value snaps.use_floating_ips (True|False) to toggle this functionality. -Please note that When the configuration value of snaps.use_keystone is True, -Functest must have access the cloud's private network. -This suite consists in 120 tests (test duration ~= 50 minutes) - -The flavors for the SNAPS test cases are able to be configured giving new -metadata values as well as new values for the basic elements of flavor (i.e. -ram, vcpu, disk, ephemeral, swap etc). The snaps.flavor_extra_specs dict in -the config_functest.yaml file could be used for this purpose. - SDN Controllers --------------- diff --git a/docs/testing/user/userguide/test_overview.rst b/docs/testing/user/userguide/test_overview.rst index 4240bf3cd..9c9708e7e 100644 --- a/docs/testing/user/userguide/test_overview.rst +++ b/docs/testing/user/userguide/test_overview.rst @@ -25,13 +25,6 @@ validate the scenario for the release. | Domain | Tier | Test case | Comments | +=============+===============+============+==================================+ | VIM | healthcheck | connection | Check OpenStack connectivity | -| | | \_check | through SNAPS framework | -| | +------------+----------------------------------+ -| | | api_check | Check OpenStack API through | -| | | | SNAPS framework | -| | +------------+----------------------------------+ -| | | snaps | basic instance creation, check | -| | | \_health | DHCP | | | | \_check | | | +---------------+------------+----------------------------------+ | | smoke | vping_ssh | NFV "Hello World" using an SSH | @@ -62,9 +55,6 @@ validate the scenario for the release. | | | rally | Run a subset of the OpenStack | | | | \_sanity | Rally Test Suite in smoke mode | | | +------------+----------------------------------+ -| | | snaps\ | Run the SNAPS-OO integration | -| | | \_smoke | tests | -| | +------------+----------------------------------+ | | | refstack | Reference RefStack suite | | | | \_defcore | tempest selection for NFV | | | +------------+----------------------------------+ diff --git a/functest/ci/__init__.py b/functest/ci/__init__.py deleted file mode 100644 index e69de29bb..000000000 --- a/functest/ci/__init__.py +++ /dev/null diff --git a/functest/ci/check_deployment.py b/functest/ci/check_deployment.py deleted file mode 100644 index 16c69345c..000000000 --- a/functest/ci/check_deployment.py +++ /dev/null @@ -1,188 +0,0 @@ -#!/usr/bin/env python - -# Copyright (c) 2017 Ericsson and others. -# -# 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 - -""" OpenStack deployment checker - -Verifies that: - - - Credentials file is given and contains the right information - - OpenStack endpoints are reachable -""" - -import logging -import logging.config -import os -import socket - -import pkg_resources -from six.moves import urllib -from snaps.openstack.tests import openstack_tests -from snaps.openstack.utils import glance_utils -from snaps.openstack.utils import keystone_utils -from snaps.openstack.utils import neutron_utils -from snaps.openstack.utils import nova_utils - -from functest.utils import constants -from functest.opnfv_tests.openstack.snaps import snaps_utils - -__author__ = "Jose Lausuch <jose.lausuch@ericsson.com>" - -LOGGER = logging.getLogger(__name__) - - -def verify_connectivity(endpoint): - """ Returns true if an hostname/port is reachable""" - try: - connection = socket.socket() - connection.settimeout(10) - url = urllib.parse.urlparse(endpoint) - port = url.port - if not port: - port = 443 if url.scheme == "https" else 80 - connection.connect((url.hostname, port)) - LOGGER.debug('%s:%s is reachable!', url.hostname, port) - return True - except socket.error: - LOGGER.error('%s:%s is not reachable.', url.hostname, port) - except Exception: # pylint: disable=broad-except - LOGGER.exception( - 'Errors when verifying connectivity to %s:%s', url.hostname, port) - return False - - -def get_auth_token(os_creds): - """ Get auth token """ - sess = keystone_utils.keystone_session(os_creds) - try: - return sess.get_token() - except Exception as error: - LOGGER.error("Got token ...FAILED") - raise error - - -class CheckDeployment(object): - """ Check deployment class.""" - - def __init__(self, rc_file=constants.ENV_FILE): - self.rc_file = rc_file - self.services = ('compute', 'network', 'image') - self.os_creds = None - - def check_rc(self): - """ Check if RC file exists and contains OS_AUTH_URL """ - if not os.path.isfile(self.rc_file): - raise IOError('RC file {} does not exist!'.format(self.rc_file)) - if 'OS_AUTH_URL' not in open(self.rc_file).read(): - raise SyntaxError('OS_AUTH_URL not defined in {}.'. - format(self.rc_file)) - - def check_auth_endpoint(self): - """ Verifies connectivity to the OS_AUTH_URL given in the RC file - and get auth token""" - rc_endpoint = self.os_creds.auth_url - if not verify_connectivity(rc_endpoint): - raise Exception("OS_AUTH_URL {} is not reachable.". - format(rc_endpoint)) - LOGGER.info("Connectivity to OS_AUTH_URL %s ...OK", rc_endpoint) - if get_auth_token(self.os_creds): - LOGGER.info("Got token ...OK") - - def check_public_endpoint(self): - """ Gets the public endpoint and verifies connectivity to it """ - public_endpoint = keystone_utils.get_endpoint(self.os_creds, - 'identity', - interface='public') - if not verify_connectivity(public_endpoint): - raise Exception("Public endpoint {} is not reachable.". - format(public_endpoint)) - LOGGER.info("Connectivity to the public endpoint %s ...OK", - public_endpoint) - - def check_service_endpoint(self, service): - """ Verifies connectivity to a given openstack service """ - endpoint = keystone_utils.get_endpoint(self.os_creds, - service, - interface='public') - if not verify_connectivity(endpoint): - raise Exception("{} endpoint {} is not reachable.". - format(service, endpoint)) - LOGGER.info("Connectivity to endpoint '%s' %s ...OK", - service, endpoint) - - def check_nova(self): - """ checks that a simple nova operation works """ - try: - client = nova_utils.nova_client(self.os_creds) - client.servers.list() - LOGGER.info("Nova service ...OK") - except Exception as error: - LOGGER.error("Nova service ...FAILED") - raise error - - def check_neutron(self): - """ checks that a simple neutron operation works """ - try: - client = neutron_utils.neutron_client(self.os_creds) - client.list_networks() - LOGGER.info("Neutron service ...OK") - except Exception as error: - LOGGER.error("Neutron service ...FAILED") - raise error - - def check_glance(self): - """ checks that a simple glance operation works """ - try: - client = glance_utils.glance_client(self.os_creds) - client.images.list() - LOGGER.info("Glance service ...OK") - except Exception as error: - LOGGER.error("Glance service ...FAILED") - raise error - - def check_ext_net(self): - """ checks if external network exists """ - ext_net = snaps_utils.get_ext_net_name(self.os_creds) - if ext_net: - LOGGER.info("External network found: %s", ext_net) - else: - raise Exception("ERROR: No external networks in the deployment.") - - def check_all(self): - """ - Calls all the class functions and returns 0 if all of them succeed. - This is the method called by CLI - """ - self.check_rc() - try: - self.os_creds = openstack_tests.get_credentials( - os_env_file=self.rc_file, - proxy_settings_str=None, - ssh_proxy_cmd=None) - except: - raise Exception("Problem while getting credentials object.") - if self.os_creds is None: - raise Exception("Credentials is None.") - self.check_auth_endpoint() - self.check_public_endpoint() - for service in self.services: - self.check_service_endpoint(service) - self.check_nova() - self.check_neutron() - self.check_glance() - self.check_ext_net() - return 0 - - -def main(): - """Entry point""" - logging.config.fileConfig(pkg_resources.resource_filename( - 'functest', 'ci/logging.ini')) - logging.captureWarnings(True) - deployment = CheckDeployment() - return deployment.check_all() diff --git a/functest/ci/config_aarch64_patch.yaml b/functest/ci/config_aarch64_patch.yaml index 835a82737..1e5aed410 100644 --- a/functest/ci/config_aarch64_patch.yaml +++ b/functest/ci/config_aarch64_patch.yaml @@ -80,20 +80,5 @@ os: rally_full: image: /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img - snaps: - images: - glance_tests: - disk_file: - /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img - cirros: - disk_file: - /home/opnfv/functest/images/cirros-0.4.0-aarch64-disk.img - ubuntu: - disk_file: - /home/opnfv/functest/images/ubuntu-14.04-server-cloudimg-arm64-uefi1.img - centos: - disk_file: - /home/opnfv/functest/images/CentOS-7-aarch64-GenericCloud.qcow2 - tempest: use_custom_flavors: 'True' diff --git a/functest/ci/config_functest.yaml b/functest/ci/config_functest.yaml index 07686f8fa..d7a162f73 100644 --- a/functest/ci/config_functest.yaml +++ b/functest/ci/config_functest.yaml @@ -42,47 +42,6 @@ general: neutron_private_subnet_gateway: 192.168.120.254 neutron_router_name: functest-router -snaps: - use_keystone: 'True' - use_floating_ips: 'True' - flavor_extra_specs: {} - images: - glance_tests: - disk_file: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.img - cirros: - disk_file: /home/opnfv/functest/images/cirros-0.4.0-x86_64-disk.img - ubuntu: - disk_file: - /home/opnfv/functest/images/ubuntu-14.04-server-cloudimg-amd64-disk1.img - centos: - disk_file: - /home/opnfv/functest/images/CentOS-7-x86_64-GenericCloud.qcow2 -# netconf_override: -# network_type: vlan -# physical_network: physnet2 -# segmentation_id: 2366 - -# All of these values are optional and will override the values retrieved -# by the RC file -# os_creds_override: -# username: {user} -# password: {password} -# auth_url: {auth_url} -# project_name: {project_name} -# identity_api_version: {2|3} -# network_api_version: {2} -# compute_api_version: {2} -# image_api_version: {1|2} -# user_domain_id: {user_domain_id} -# project_domain_id: {projects_domain_id} -# interface: {interface} -# cacert: {True|False} -# proxy_settings: -# host: {proxy_host} -# port: {proxy_port} -# ssh_proxy_cmd: {OpenSSH -o ProxyCommand value} - - vping: ping_timeout: 200 vm_flavor: m1.tiny # adapt to your environment diff --git a/functest/ci/config_patch.yaml b/functest/ci/config_patch.yaml index 42220832e..754f19edf 100644 --- a/functest/ci/config_patch.yaml +++ b/functest/ci/config_patch.yaml @@ -3,8 +3,6 @@ fdio: general: openstack: flavor_ram: 1024 - snaps: - flavor_extra_specs: {'hw:mem_page_size':'large'} vmready1: flavor_ram: 1024 vmready2: @@ -52,8 +50,6 @@ ovs: general: openstack: flavor_ram: 1024 - snaps: - flavor_extra_specs: {'hw:mem_page_size':'large'} vmready1: flavor_ram: 1024 vmready2: diff --git a/functest/ci/download_images.sh b/functest/ci/download_images.sh index 9044bfe99..9612f85b2 100644 --- a/functest/ci/download_images.sh +++ b/functest/ci/download_images.sh @@ -8,16 +8,11 @@ wget_opts="-N --tries=1 --connect-timeout=30" cat << EOF | wget ${wget_opts} -i - -P ${1:-/home/opnfv/functest/images} http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img https://cloud-images.ubuntu.com/releases/14.04/release/ubuntu-14.04-server-cloudimg-amd64-disk1.img -https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2 https://cloud-images.ubuntu.com/releases/16.04/release/ubuntu-16.04-server-cloudimg-amd64-disk1.img http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-aarch64-disk.img https://cloud-images.ubuntu.com/releases/14.04/release/ubuntu-14.04-server-cloudimg-arm64-uefi1.img -http://cloud.centos.org/altarch/7/images/aarch64/CentOS-7-aarch64-GenericCloud.qcow2.xz http://repository.cloudifysource.org/cloudify/19.01.24/community-release/cloudify-docker-manager-community-19.01.24.tar http://testresults.opnfv.org/functest/vyos-1.1.8-amd64.qcow2 http://testresults.opnfv.org/functest/shaker-image.qcow2 http://testresults.opnfv.org/functest/shaker-image-arm64.qcow2 EOF - -xz --decompress --force --keep \ - ${1:-/home/opnfv/functest/images}/CentOS-7-aarch64-GenericCloud.qcow2.xz diff --git a/functest/ci/testcases.yaml b/functest/ci/testcases.yaml index 71d524e5c..672349cb5 100644 --- a/functest/ci/testcases.yaml +++ b/functest/ci/testcases.yaml @@ -146,33 +146,6 @@ tiers: - /src/odl_test/csit/suites/openstack/neutron - - case_name: api_check - project_name: functest - criteria: 100 - blocking: true - description: >- - This test case verifies the retrieval of OpenStack clients: - Keystone, Glance, Neutron and Nova and may perform some - simple queries. When the config value of - snaps.use_keystone is True, functest must have access to - the cloud's private network. - run: - name: api_check - - - - case_name: snaps_health_check - project_name: functest - criteria: 100 - blocking: true - description: >- - This test case creates executes the SimpleHealthCheck - Python test class which creates an, image, flavor, network, - and Cirros VM instance and observes the console output to - validate the single port obtains the correct IP address. - run: - name: snaps_health_check - - - case_name: tempest_smoke project_name: functest criteria: 100 @@ -296,22 +269,6 @@ tiers: - 'test_auto_allocated_topology_rbac' - - case_name: snaps_smoke - project_name: functest - criteria: 100 - blocking: false - description: >- - This test case contains tests that setup and destroy - environments with VMs with and without Floating IPs - with a newly created user and project. Set the config - value snaps.use_floating_ips (True|False) to toggle - this functionality. When the config value of - snaps.use_keystone is True, functest must have access to - the cloud's private network. - run: - name: snaps_smoke - - - case_name: neutron_trunk project_name: functest criteria: 100 diff --git a/functest/opnfv_tests/openstack/snaps/__init__.py b/functest/opnfv_tests/openstack/snaps/__init__.py deleted file mode 100644 index e69de29bb..000000000 --- a/functest/opnfv_tests/openstack/snaps/__init__.py +++ /dev/null diff --git a/functest/opnfv_tests/openstack/snaps/api_check.py b/functest/opnfv_tests/openstack/snaps/api_check.py deleted file mode 100644 index d4204bff1..000000000 --- a/functest/opnfv_tests/openstack/snaps/api_check.py +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env python - -# Copyright (c) 2017 Cable Television Laboratories, Inc. and others. -# -# 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 - -"""api_check test case implementation""" - -import unittest - -from functest.opnfv_tests.openstack.snaps import snaps_suite_builder -from functest.opnfv_tests.openstack.snaps.snaps_test_runner import \ - SnapsTestRunner - - -class ApiCheck(SnapsTestRunner): - """ - This test executes the Python Tests included with the SNAPS libraries - that exercise many of the OpenStack APIs within Keystone, Glance, Neutron, - and Nova - """ - def __init__(self, **kwargs): - if "case_name" not in kwargs: - kwargs["case_name"] = "api_check" - super(ApiCheck, self).__init__(**kwargs) - - self.suite = unittest.TestSuite() - - def run(self, **kwargs): - """ - Builds the test suite then calls super.run() - :param kwargs: the arguments to pass on - :return: - """ - snaps_suite_builder.add_openstack_client_tests( - suite=self.suite, - os_creds=self.os_creds, - ext_net_name=self.ext_net_name, - use_keystone=self.use_keystone) - snaps_suite_builder.add_openstack_api_tests( - suite=self.suite, - os_creds=self.os_creds, - ext_net_name=self.ext_net_name, - use_keystone=self.use_keystone, - image_metadata=self.image_metadata) - return super(ApiCheck, self).run() diff --git a/functest/opnfv_tests/openstack/snaps/health_check.py b/functest/opnfv_tests/openstack/snaps/health_check.py deleted file mode 100644 index 3a9c821d2..000000000 --- a/functest/opnfv_tests/openstack/snaps/health_check.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python - -# Copyright (c) 2017 Cable Television Laboratories, Inc. and others. -# -# 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 - -"""snaps_health_check test case implementation""" - -import unittest - -from snaps.openstack.tests.create_instance_tests import SimpleHealthCheck -from snaps.openstack.tests.os_source_file_test import OSIntegrationTestCase - -from functest.opnfv_tests.openstack.snaps.snaps_test_runner import ( - SnapsTestRunner) - - -class HealthCheck(SnapsTestRunner): - """ - This test executes the SNAPS Python Test case SimpleHealthCheck which - creates a VM with a single port with an IPv4 address that is assigned by - DHCP. This test then validates the expected IP with the actual - """ - def __init__(self, **kwargs): - if "case_name" not in kwargs: - kwargs["case_name"] = "snaps_images_cirros" - super(HealthCheck, self).__init__(**kwargs) - - self.suite = unittest.TestSuite() - - def run(self, **kwargs): - """ - Builds the test suite then calls super.run() - :param kwargs: the arguments to pass on - :return: - """ - self.suite.addTest( - OSIntegrationTestCase.parameterize( - SimpleHealthCheck, os_creds=self.os_creds, - ext_net_name=self.ext_net_name, - use_keystone=self.use_keystone, - flavor_metadata=self.flavor_metadata, - image_metadata=self.image_metadata, - netconf_override=self.netconf_override)) - return super(HealthCheck, self).run() diff --git a/functest/opnfv_tests/openstack/snaps/smoke.py b/functest/opnfv_tests/openstack/snaps/smoke.py deleted file mode 100644 index bc6781180..000000000 --- a/functest/opnfv_tests/openstack/snaps/smoke.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env python - -# Copyright (c) 2017 Cable Television Laboratories, Inc. and others. -# -# 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 - -"""snaps_smoke test case implementation""" - -import unittest - -from functest.opnfv_tests.openstack.snaps import snaps_suite_builder -from functest.opnfv_tests.openstack.snaps.snaps_test_runner import ( - SnapsTestRunner) - - -class SnapsSmoke(SnapsTestRunner): - """ - This test executes the Python Tests included with the SNAPS libraries - that exercise many of the OpenStack APIs within Keystone, Glance, Neutron, - and Nova - """ - def __init__(self, **kwargs): - if "case_name" not in kwargs: - kwargs["case_name"] = "snaps_smoke" - super(SnapsSmoke, self).__init__(**kwargs) - - self.suite = unittest.TestSuite() - - def run(self, **kwargs): - """ - Builds the test suite then calls super.run() - :param kwargs: the arguments to pass on - :return: - """ - snaps_suite_builder.add_openstack_integration_tests( - suite=self.suite, - os_creds=self.os_creds, - ext_net_name=self.ext_net_name, - use_keystone=self.use_keystone, - flavor_metadata=self.flavor_metadata, - image_metadata=self.image_metadata, - use_floating_ips=self.use_fip, - netconf_override=self.netconf_override) - return super(SnapsSmoke, self).run() diff --git a/functest/opnfv_tests/openstack/snaps/snaps_suite_builder.py b/functest/opnfv_tests/openstack/snaps/snaps_suite_builder.py deleted file mode 100644 index 95da15ae8..000000000 --- a/functest/opnfv_tests/openstack/snaps/snaps_suite_builder.py +++ /dev/null @@ -1,416 +0,0 @@ -#!/usr/bin/env python - -# Copyright (c) 2017 Cable Television Laboratories, Inc. and others. -# -# 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 - -""" -Snaps test suite including openstack client tests, api tests and -integration tests. -add_openstack_client_tests: for connection_check -add_openstack_api_tests: for api_check -add_openstack_integration_tests: for snaps_smoke -""" - -import logging - -from snaps.openstack.tests.create_flavor_tests import ( - CreateFlavorTests) -from snaps.openstack.tests.create_image_tests import ( - CreateImageSuccessTests, CreateImageNegativeTests, - CreateMultiPartImageTests) -from snaps.openstack.tests.create_instance_tests import ( - CreateInstanceOnComputeHost, - CreateInstanceSimpleTests, InstanceSecurityGroupTests, - CreateInstancePortManipulationTests, SimpleHealthCheck, - CreateInstanceFromThreePartImage, CreateInstanceTwoNetTests) -from snaps.openstack.tests.create_keypairs_tests import ( - CreateKeypairsTests, CreateKeypairsCleanupTests) -from snaps.openstack.tests.create_network_tests import ( - CreateNetworkSuccessTests) -from snaps.openstack.tests.create_project_tests import ( - CreateProjectSuccessTests, CreateProjectUserTests) -from snaps.openstack.tests.create_qos_tests import ( - CreateQoSTests) -from snaps.openstack.tests.create_router_tests import ( - CreateRouterSuccessTests, CreateRouterNegativeTests) -from snaps.openstack.tests.create_security_group_tests import ( - CreateSecurityGroupTests) -from snaps.openstack.tests.create_stack_tests import ( - CreateStackSuccessTests, CreateStackNegativeTests, - CreateStackFlavorTests, CreateStackFloatingIpTests, - CreateStackKeypairTests, CreateStackVolumeTests, - CreateStackSecurityGroupTests) -from snaps.openstack.tests.create_user_tests import ( - CreateUserSuccessTests) -from snaps.openstack.tests.create_volume_tests import ( - CreateSimpleVolumeSuccessTests, - CreateVolumeWithTypeTests, CreateVolumeWithImageTests, - CreateSimpleVolumeFailureTests) -from snaps.openstack.tests.create_volume_type_tests import ( - CreateSimpleVolumeTypeSuccessTests, - CreateVolumeTypeComplexTests) -from snaps.openstack.tests.os_source_file_test import ( - OSComponentTestCase, OSIntegrationTestCase) -from snaps.openstack.utils.tests.cinder_utils_tests import ( - CinderSmokeTests, CinderUtilsQoSTests, CinderUtilsSimpleVolumeTypeTests, - CinderUtilsAddEncryptionTests, CinderUtilsVolumeTypeCompleteTests, - CinderUtilsVolumeTests) -from snaps.openstack.utils.tests.glance_utils_tests import ( - GlanceSmokeTests, GlanceUtilsTests) -from snaps.openstack.utils.tests.heat_utils_tests import ( - HeatSmokeTests, HeatUtilsCreateSimpleStackTests, - HeatUtilsCreateComplexStackTests, HeatUtilsFlavorTests, - HeatUtilsKeypairTests, HeatUtilsSecurityGroupTests) -from snaps.openstack.utils.tests.keystone_utils_tests import KeystoneSmokeTests -from snaps.openstack.utils.tests.neutron_utils_tests import ( - NeutronSmokeTests, NeutronUtilsNetworkTests, NeutronUtilsSubnetTests, - NeutronUtilsRouterTests, NeutronUtilsSecurityGroupTests) -from snaps.openstack.utils.tests.nova_utils_tests import ( - NovaSmokeTests, NovaUtilsKeypairTests, NovaUtilsFlavorTests, - NovaUtilsInstanceTests) - - -def add_openstack_client_tests(suite, os_creds, ext_net_name, - use_keystone=True, log_level=logging.INFO): - """ - Adds tests written to exercise OpenStack client retrieval - - :param suite: the unittest.TestSuite object to which to add the tests - :param os_creds: and instance of OSCreds that holds the credentials - required by OpenStack - :param ext_net_name: the name of an external network on the cloud under - test - :param use_keystone: when True, tests requiring direct access to Keystone - are added as these need to be running on a host that - has access to the cloud's private network - :param log_level: the logging level - :return: None as the tests will be adding to the 'suite' parameter object - """ - # Basic connection tests - suite.addTest( - OSComponentTestCase.parameterize( - GlanceSmokeTests, os_creds=os_creds, ext_net_name=ext_net_name, - log_level=log_level)) - - if use_keystone: - suite.addTest( - OSComponentTestCase.parameterize( - KeystoneSmokeTests, os_creds=os_creds, - ext_net_name=ext_net_name, log_level=log_level)) - - suite.addTest( - OSComponentTestCase.parameterize( - NeutronSmokeTests, os_creds=os_creds, ext_net_name=ext_net_name, - log_level=log_level)) - suite.addTest( - OSComponentTestCase.parameterize( - NovaSmokeTests, os_creds=os_creds, ext_net_name=ext_net_name, - log_level=log_level)) - suite.addTest( - OSComponentTestCase.parameterize( - HeatSmokeTests, os_creds=os_creds, ext_net_name=ext_net_name, - log_level=log_level)) - suite.addTest( - OSComponentTestCase.parameterize( - CinderSmokeTests, os_creds=os_creds, ext_net_name=ext_net_name, - log_level=log_level)) - - -def add_openstack_api_tests(suite, os_creds, ext_net_name, use_keystone=True, - image_metadata=None, log_level=logging.INFO): - # pylint: disable=too-many-arguments - """ - Adds tests written to exercise all existing OpenStack APIs - - :param suite: the unittest.TestSuite object to which to add the tests - :param os_creds: Instance of OSCreds that holds the credentials - required by OpenStack - :param ext_net_name: the name of an external network on the cloud under - test - :param use_keystone: when True, tests requiring direct access to Keystone - are added as these need to be running on a host that - has access to the cloud's private network - :param image_metadata: dict() object containing metadata for creating an - image with custom config - (see YAML files in examples/image-metadata) - :param log_level: the logging level - :return: None as the tests will be adding to the 'suite' parameter object - """ - # Tests the OpenStack API calls - if use_keystone: - suite.addTest(OSComponentTestCase.parameterize( - CreateUserSuccessTests, os_creds=os_creds, - ext_net_name=ext_net_name, log_level=log_level)) - suite.addTest(OSComponentTestCase.parameterize( - CreateProjectSuccessTests, os_creds=os_creds, - ext_net_name=ext_net_name, log_level=log_level)) - suite.addTest(OSComponentTestCase.parameterize( - CreateProjectUserTests, os_creds=os_creds, - ext_net_name=ext_net_name, log_level=log_level)) - - suite.addTest(OSComponentTestCase.parameterize( - GlanceUtilsTests, os_creds=os_creds, ext_net_name=ext_net_name, - image_metadata=image_metadata, - log_level=log_level)) - suite.addTest(OSComponentTestCase.parameterize( - NeutronUtilsNetworkTests, os_creds=os_creds, ext_net_name=ext_net_name, - log_level=log_level)) - suite.addTest(OSComponentTestCase.parameterize( - NeutronUtilsSubnetTests, os_creds=os_creds, ext_net_name=ext_net_name, - log_level=log_level)) - suite.addTest(OSComponentTestCase.parameterize( - NeutronUtilsRouterTests, os_creds=os_creds, ext_net_name=ext_net_name, - log_level=log_level)) - suite.addTest(OSComponentTestCase.parameterize( - NeutronUtilsSecurityGroupTests, os_creds=os_creds, - ext_net_name=ext_net_name, log_level=log_level)) - suite.addTest(OSComponentTestCase.parameterize( - NovaUtilsKeypairTests, os_creds=os_creds, ext_net_name=ext_net_name, - log_level=log_level)) - suite.addTest(OSComponentTestCase.parameterize( - NovaUtilsFlavorTests, os_creds=os_creds, ext_net_name=ext_net_name, - log_level=log_level)) - suite.addTest(OSComponentTestCase.parameterize( - NovaUtilsInstanceTests, os_creds=os_creds, ext_net_name=ext_net_name, - log_level=log_level, image_metadata=image_metadata)) - suite.addTest(OSComponentTestCase.parameterize( - CreateFlavorTests, os_creds=os_creds, ext_net_name=ext_net_name, - log_level=log_level)) - suite.addTest(OSComponentTestCase.parameterize( - HeatUtilsCreateSimpleStackTests, os_creds=os_creds, - ext_net_name=ext_net_name, log_level=log_level, - image_metadata=image_metadata)) - suite.addTest(OSComponentTestCase.parameterize( - HeatUtilsCreateComplexStackTests, os_creds=os_creds, - ext_net_name=ext_net_name, log_level=log_level, - image_metadata=image_metadata)) - suite.addTest(OSComponentTestCase.parameterize( - HeatUtilsFlavorTests, os_creds=os_creds, - ext_net_name=ext_net_name, log_level=log_level, - image_metadata=image_metadata)) - suite.addTest(OSComponentTestCase.parameterize( - HeatUtilsKeypairTests, os_creds=os_creds, - ext_net_name=ext_net_name, log_level=log_level, - image_metadata=image_metadata)) - suite.addTest(OSComponentTestCase.parameterize( - HeatUtilsSecurityGroupTests, os_creds=os_creds, - ext_net_name=ext_net_name, log_level=log_level, - image_metadata=image_metadata)) - suite.addTest(OSComponentTestCase.parameterize( - CinderUtilsQoSTests, os_creds=os_creds, - ext_net_name=ext_net_name, log_level=log_level, - image_metadata=image_metadata)) - suite.addTest(OSComponentTestCase.parameterize( - CinderUtilsVolumeTests, os_creds=os_creds, - ext_net_name=ext_net_name, log_level=log_level, - image_metadata=image_metadata)) - suite.addTest(OSComponentTestCase.parameterize( - CinderUtilsSimpleVolumeTypeTests, os_creds=os_creds, - ext_net_name=ext_net_name, log_level=log_level, - image_metadata=image_metadata)) - suite.addTest(OSComponentTestCase.parameterize( - CinderUtilsAddEncryptionTests, os_creds=os_creds, - ext_net_name=ext_net_name, log_level=log_level, - image_metadata=image_metadata)) - suite.addTest(OSComponentTestCase.parameterize( - CinderUtilsVolumeTypeCompleteTests, os_creds=os_creds, - ext_net_name=ext_net_name, log_level=log_level, - image_metadata=image_metadata)) - - -def add_openstack_integration_tests(suite, os_creds, ext_net_name, - use_keystone=True, flavor_metadata=None, - image_metadata=None, use_floating_ips=True, - netconf_override=None, - log_level=logging.INFO): - # pylint: disable=too-many-arguments - """ - Adds tests written to exercise all long-running OpenStack integration tests - meaning they will be creating VM instances and potentially performing some - SSH functions through floatingIPs - - :param suite: the unittest.TestSuite object to which to add the tests - :param os_creds: and instance of OSCreds that holds the credentials - required by OpenStack - :param ext_net_name: the name of an external network on the cloud under - test - :param use_keystone: when True, tests requiring direct access to Keystone - are added as these need to be running on a host that - has access to the cloud's private network - :param image_metadata: dict() object containing metadata for creating an - image with custom config - (see YAML files in examples/image-metadata) - :param flavor_metadata: dict() object containing the metadata required by - your flavor based on your configuration: - (i.e. {'hw:mem_page_size': 'large'}) - :param use_floating_ips: when true, all tests requiring Floating IPs will - be added to the suite - :param netconf_override: dict() containing the reconfigured network_type, - physical_network and segmentation_id - :param log_level: the logging level - :return: None as the tests will be adding to the 'suite' parameter object - """ - # Tests the OpenStack API calls via a creator. If use_keystone, objects - # will be created with a custom user and project - - # Creator Object tests - suite.addTest(OSIntegrationTestCase.parameterize( - CreateSecurityGroupTests, os_creds=os_creds, ext_net_name=ext_net_name, - use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - log_level=log_level)) - suite.addTest(OSIntegrationTestCase.parameterize( - CreateImageSuccessTests, os_creds=os_creds, ext_net_name=ext_net_name, - use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - log_level=log_level)) - suite.addTest(OSIntegrationTestCase.parameterize( - CreateImageNegativeTests, os_creds=os_creds, ext_net_name=ext_net_name, - use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - log_level=log_level)) - suite.addTest(OSIntegrationTestCase.parameterize( - CreateMultiPartImageTests, os_creds=os_creds, - ext_net_name=ext_net_name, use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - log_level=log_level)) - suite.addTest(OSIntegrationTestCase.parameterize( - CreateKeypairsTests, os_creds=os_creds, ext_net_name=ext_net_name, - use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - log_level=log_level)) - suite.addTest(OSIntegrationTestCase.parameterize( - CreateKeypairsCleanupTests, os_creds=os_creds, - ext_net_name=ext_net_name, - use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - log_level=log_level)) - suite.addTest(OSIntegrationTestCase.parameterize( - CreateNetworkSuccessTests, os_creds=os_creds, - ext_net_name=ext_net_name, use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - log_level=log_level)) - suite.addTest(OSIntegrationTestCase.parameterize( - CreateRouterSuccessTests, os_creds=os_creds, ext_net_name=ext_net_name, - use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - log_level=log_level)) - suite.addTest(OSIntegrationTestCase.parameterize( - CreateRouterNegativeTests, os_creds=os_creds, - ext_net_name=ext_net_name, use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - log_level=log_level)) - suite.addTest(OSIntegrationTestCase.parameterize( - CreateQoSTests, os_creds=os_creds, - ext_net_name=ext_net_name, use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - log_level=log_level)) - suite.addTest(OSIntegrationTestCase.parameterize( - CreateSimpleVolumeTypeSuccessTests, os_creds=os_creds, - ext_net_name=ext_net_name, use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - log_level=log_level)) - suite.addTest(OSIntegrationTestCase.parameterize( - CreateVolumeTypeComplexTests, os_creds=os_creds, - ext_net_name=ext_net_name, use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - log_level=log_level)) - suite.addTest(OSIntegrationTestCase.parameterize( - CreateSimpleVolumeSuccessTests, os_creds=os_creds, - ext_net_name=ext_net_name, use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - log_level=log_level)) - suite.addTest(OSIntegrationTestCase.parameterize( - CreateSimpleVolumeFailureTests, os_creds=os_creds, - ext_net_name=ext_net_name, use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - log_level=log_level)) - suite.addTest(OSIntegrationTestCase.parameterize( - CreateVolumeWithTypeTests, os_creds=os_creds, - ext_net_name=ext_net_name, use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - log_level=log_level)) - suite.addTest(OSIntegrationTestCase.parameterize( - CreateVolumeWithImageTests, os_creds=os_creds, - ext_net_name=ext_net_name, use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - log_level=log_level)) - - # VM Instances - suite.addTest(OSIntegrationTestCase.parameterize( - SimpleHealthCheck, os_creds=os_creds, ext_net_name=ext_net_name, - use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - log_level=log_level)) - suite.addTest(OSIntegrationTestCase.parameterize( - CreateInstanceTwoNetTests, os_creds=os_creds, - ext_net_name=ext_net_name, use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - log_level=log_level)) - suite.addTest(OSIntegrationTestCase.parameterize( - CreateInstanceSimpleTests, os_creds=os_creds, - ext_net_name=ext_net_name, use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - netconf_override=netconf_override, log_level=log_level)) - suite.addTest(OSIntegrationTestCase.parameterize( - CreateInstancePortManipulationTests, os_creds=os_creds, - ext_net_name=ext_net_name, use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - netconf_override=netconf_override, log_level=log_level)) - suite.addTest(OSIntegrationTestCase.parameterize( - InstanceSecurityGroupTests, os_creds=os_creds, - ext_net_name=ext_net_name, use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - netconf_override=netconf_override, log_level=log_level)) - suite.addTest(OSIntegrationTestCase.parameterize( - CreateInstanceOnComputeHost, os_creds=os_creds, - ext_net_name=ext_net_name, use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - netconf_override=netconf_override, log_level=log_level)) - suite.addTest(OSIntegrationTestCase.parameterize( - CreateInstanceFromThreePartImage, os_creds=os_creds, - ext_net_name=ext_net_name, use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - netconf_override=netconf_override, log_level=log_level)) - suite.addTest(OSIntegrationTestCase.parameterize( - CreateStackSuccessTests, os_creds=os_creds, ext_net_name=ext_net_name, - use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - log_level=log_level)) - suite.addTest(OSIntegrationTestCase.parameterize( - CreateStackVolumeTests, os_creds=os_creds, ext_net_name=ext_net_name, - use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - log_level=log_level)) - suite.addTest(OSIntegrationTestCase.parameterize( - CreateStackFlavorTests, os_creds=os_creds, ext_net_name=ext_net_name, - use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - log_level=log_level)) - suite.addTest(OSIntegrationTestCase.parameterize( - CreateStackKeypairTests, os_creds=os_creds, ext_net_name=ext_net_name, - use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - log_level=log_level)) - suite.addTest(OSIntegrationTestCase.parameterize( - CreateStackSecurityGroupTests, os_creds=os_creds, - ext_net_name=ext_net_name, use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - log_level=log_level)) - suite.addTest(OSIntegrationTestCase.parameterize( - CreateStackNegativeTests, os_creds=os_creds, ext_net_name=ext_net_name, - use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - log_level=log_level)) - - if use_floating_ips: - suite.addTest(OSIntegrationTestCase.parameterize( - CreateStackFloatingIpTests, os_creds=os_creds, - ext_net_name=ext_net_name, use_keystone=use_keystone, - flavor_metadata=flavor_metadata, image_metadata=image_metadata, - log_level=log_level)) diff --git a/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py b/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py deleted file mode 100644 index 9fc098a53..000000000 --- a/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py +++ /dev/null @@ -1,114 +0,0 @@ -#!/usr/bin/env python - -# Copyright (c) 2017 Cable Television Laboratories, Inc. and others. -# -# 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 - -"""configuration params to run snaps tests""" - -import logging -import uuid - -import os_client_config -import shade -from xtesting.core import unit - -from functest.core import tenantnetwork -from functest.opnfv_tests.openstack.snaps import snaps_utils -from functest.utils import config -from functest.utils import functest_utils - - -class SnapsTestRunner(unit.Suite): - # pylint: disable=too-many-instance-attributes - """ - This test executes the SNAPS Python Tests - """ - - def __init__(self, **kwargs): - super(SnapsTestRunner, self).__init__(**kwargs) - self.logger = logging.getLogger(__name__) - - try: - cloud_config = os_client_config.get_config() - self.orig_cloud = shade.OpenStackCloud(cloud_config=cloud_config) - guid = str(uuid.uuid4()) - self.project = tenantnetwork.NewProject( - self.orig_cloud, self.case_name, guid) - self.project.create() - except Exception: # pylint: disable=broad-except - raise Exception("Cannot create user or project") - - if self.orig_cloud.get_role("admin"): - role_name = "admin" - elif self.orig_cloud.get_role("Admin"): - role_name = "Admin" - else: - raise Exception("Cannot detect neither admin nor Admin") - self.orig_cloud.grant_role( - role_name, user=self.project.user.id, - project=self.project.project.id, - domain=self.project.domain.id) - self.role = None - if not self.orig_cloud.get_role("heat_stack_owner"): - self.role = self.orig_cloud.create_role("heat_stack_owner") - self.orig_cloud.grant_role( - "heat_stack_owner", user=self.project.user.id, - project=self.project.project.id, - domain=self.project.domain.id) - creds_overrides = dict( - username=self.project.user.name, - project_name=self.project.project.name, - project_id=self.project.project.id, - password=self.project.password) - self.os_creds = kwargs.get('os_creds') or snaps_utils.get_credentials( - overrides=creds_overrides) - if 'ext_net_name' in kwargs: - self.ext_net_name = kwargs['ext_net_name'] - else: - self.ext_net_name = snaps_utils.get_ext_net_name(self.os_creds) - - self.netconf_override = None - if hasattr(config.CONF, 'snaps_network_config'): - self.netconf_override = getattr( - config.CONF, 'snaps_network_config') - - self.use_fip = ( - getattr(config.CONF, 'snaps_use_floating_ips') == 'True') - self.use_keystone = ( - getattr(config.CONF, 'snaps_use_keystone') == 'True') - - self.flavor_metadata = getattr(config.CONF, 'snaps_flavor_extra_specs', - None) - self.logger.info("Using flavor metadata '%s'", self.flavor_metadata) - - self.image_metadata = None - if hasattr(config.CONF, 'snaps_images'): - self.image_metadata = getattr(config.CONF, 'snaps_images') - - def clean(self): - """Cleanup of OpenStack resources. Should be called on completion.""" - try: - super(SnapsTestRunner, self).clean() - assert self.orig_cloud - assert self.project - if self.role: - self.orig_cloud.delete_role(self.role.id) - self.project.clean() - except Exception: # pylint: disable=broad-except - self.__logger.exception("Cannot clean all resources") - - def check_requirements(self): - """Skip if OpenStack Rocky or newer.""" - try: - cloud_config = os_client_config.get_config() - cloud = shade.OpenStackCloud(cloud_config=cloud_config) - if functest_utils.get_nova_version(cloud) > (2, 60): - self.is_skipped = True - self.project.clean() - except Exception: # pylint: disable=broad-except - pass diff --git a/functest/opnfv_tests/openstack/snaps/snaps_utils.py b/functest/opnfv_tests/openstack/snaps/snaps_utils.py deleted file mode 100644 index f4a6e2ea0..000000000 --- a/functest/opnfv_tests/openstack/snaps/snaps_utils.py +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/env python - -# Copyright (c) 2015 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 - -"""Some common utils wrapping snaps functions""" - -from snaps.openstack.tests import openstack_tests -from snaps.openstack.utils import neutron_utils -from snaps.openstack.utils import nova_utils - -from functest.utils import config -from functest.utils import constants -from functest.utils import env - - -def get_ext_net_name(os_creds): - """ - Returns the configured external network name or - the first retrieved external network name - :param: os_creds: an instance of snaps OSCreds object - :return: - """ - neutron = neutron_utils.neutron_client(os_creds) - ext_nets = neutron_utils.get_external_networks(neutron) - if env.get('EXTERNAL_NETWORK'): - extnet_config = env.get('EXTERNAL_NETWORK') - for ext_net in ext_nets: - if ext_net.name == extnet_config: - return extnet_config - return ext_nets[0].name if ext_nets else "" - - -def get_active_compute_cnt(os_creds): - """ - Returns the number of active compute servers - :param: os_creds: an instance of snaps OSCreds object - :return: the number of active compute servers - """ - nova = nova_utils.nova_client(os_creds) - computes = nova_utils.get_availability_zone_hosts(nova, zone_name='nova') - return len(computes) - - -def get_credentials(proxy_settings_str=None, ssh_proxy_cmd=None, - overrides=None): - """ - Returns snaps OSCreds object instance - :param: proxy_settings_str: proxy settings string <host>:<port> - :param: ssh_proxy_cmd: the SSH proxy command for the environment - :param overrides: dict() values to override in credentials - :return: an instance of snaps OSCreds object - """ - creds_override = {} - if hasattr(config.CONF, 'snaps_os_creds_override'): - creds_override.update(getattr(config.CONF, 'snaps_os_creds_override')) - if overrides: - creds_override.update(overrides) - os_creds = openstack_tests.get_credentials( - os_env_file=constants.ENV_FILE, proxy_settings_str=proxy_settings_str, - ssh_proxy_cmd=ssh_proxy_cmd, overrides=creds_override) - return os_creds diff --git a/functest/tests/unit/ci/__init__.py b/functest/tests/unit/ci/__init__.py deleted file mode 100644 index e69de29bb..000000000 --- a/functest/tests/unit/ci/__init__.py +++ /dev/null diff --git a/functest/tests/unit/ci/test_check_deployment.py b/functest/tests/unit/ci/test_check_deployment.py deleted file mode 100644 index aeeca5871..000000000 --- a/functest/tests/unit/ci/test_check_deployment.py +++ /dev/null @@ -1,286 +0,0 @@ -#!/usr/bin/env python - -# Copyright (c) 2017 Ericsson and others. -# -# 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 - -# pylint: disable=missing-docstring - -import socket -import unittest - -import logging -import mock - -from functest.ci import check_deployment - -__author__ = "Jose Lausuch <jose.lausuch@ericsson.com>" - - -class CheckDeploymentTesting(unittest.TestCase): - """The super class which testing classes could inherit.""" - # pylint: disable=missing-docstring,too-many-public-methods - - logging.disable(logging.CRITICAL) - - def setUp(self): - self.client_test = mock.Mock() - self.deployment = check_deployment.CheckDeployment() - self.service_test = 'compute' - self.rc_file = self.deployment.rc_file - self.endpoint_test = 'http://192.168.0.6:5000/v3' - creds_attr = {'auth_url': self.endpoint_test, - 'proxy_settings': ''} - proxy_attr = {'host': '192.168.0.1', 'port': '5000'} - proxy_settings = mock.Mock() - proxy_settings.configure_mock(**proxy_attr) - self.os_creds = mock.Mock() - self.os_creds.configure_mock(**creds_attr) - self.os_creds.proxy_settings = proxy_settings - self.deployment.os_creds = self.os_creds - - @mock.patch('socket.socket.connect', side_effect=TypeError) - def test_verify_connectivity_ko1(self, *args): - self.assertFalse(check_deployment.verify_connectivity("127.0.0.1")) - args[0].assert_called_once_with((None, 80)) - - @mock.patch('socket.socket.connect', side_effect=socket.error) - def test_verify_connectivity_ko2(self, *args): - self.assertFalse( - check_deployment.verify_connectivity("http://127.0.0.1")) - args[0].assert_called_once_with(("127.0.0.1", 80)) - - @mock.patch('socket.socket.connect', side_effect=socket.error) - def test_verify_connectivity_ko3(self, *args): - self.assertFalse( - check_deployment.verify_connectivity("https://127.0.0.1")) - args[0].assert_called_once_with(("127.0.0.1", 443)) - - @mock.patch('socket.socket.connect') - def test_verify_connectivity(self, *args): - self.assertTrue( - check_deployment.verify_connectivity("https://127.0.0.1")) - args[0].assert_called_once_with(("127.0.0.1", 443)) - - @mock.patch('snaps.openstack.utils.keystone_utils.keystone_session', - return_value=mock.Mock( - get_token=mock.Mock(side_effect=Exception))) - def test_get_auth_token_ko(self, *args): - with self.assertRaises(Exception): - check_deployment.get_auth_token(self.os_creds) - args[0].assert_called_once_with(self.os_creds) - - @mock.patch('snaps.openstack.utils.keystone_utils.keystone_session', - return_value=mock.Mock( - get_token=mock.Mock(return_value="foo"))) - def test_get_auth_token(self, *args): - self.assertEqual(check_deployment.get_auth_token(self.os_creds), "foo") - args[0].assert_called_once_with(self.os_creds) - - @mock.patch('six.moves.builtins.open', - mock.mock_open(read_data='OS_AUTH_URL')) - @mock.patch('functest.ci.check_deployment.os.path.isfile', returns=True) - def test_check_rc(self, *args): - self.deployment.check_rc() - args[0].assert_called_once_with(self.rc_file) - - @mock.patch('functest.ci.check_deployment.os.path.isfile', - return_value=False) - def test_check_rc_missing_file(self, *args): - with self.assertRaises(Exception) as context: - self.deployment.check_rc() - args[0].assert_called_once_with(self.rc_file) - msg = 'RC file {} does not exist!'.format(self.rc_file) - self.assertTrue(msg in str(context.exception)) - - @mock.patch('six.moves.builtins.open', - mock.mock_open(read_data='test')) - @mock.patch('functest.ci.check_deployment.os.path.isfile', - return_value=True) - def test_check_rc_missing_os_auth(self, *args): - with self.assertRaises(Exception) as context: - self.deployment.check_rc() - args[0].assert_called_once_with(self.rc_file) - msg = 'OS_AUTH_URL not defined in {}.'.format(self.rc_file) - self.assertTrue(msg in str(context.exception)) - - @mock.patch('functest.ci.check_deployment.get_auth_token', - return_value='gAAAAABaOhXGS') - @mock.patch('functest.ci.check_deployment.verify_connectivity', - return_value=True) - def test_check_auth_endpoint(self, *args): - self.deployment.check_auth_endpoint() - args[0].assert_called_once_with(self.endpoint_test) - args[1].assert_called_once_with(mock.ANY) - - @mock.patch('functest.ci.check_deployment.verify_connectivity', - return_value=False) - def test_check_auth_endpoint_ko(self, *args): - with self.assertRaises(Exception) as context: - self.deployment.check_auth_endpoint() - msg = "OS_AUTH_URL {} is not reachable.".format(self.os_creds.auth_url) - args[0].assert_called_once_with(self.os_creds.auth_url) - self.assertTrue(msg in str(context.exception)) - - @mock.patch('functest.ci.check_deployment.verify_connectivity', - return_value=True) - @mock.patch('functest.ci.check_deployment.keystone_utils.get_endpoint') - def test_check_public_endpoint(self, *args): - args[0].return_value = self.endpoint_test - self.deployment.check_public_endpoint() - args[0].assert_called_once_with( - mock.ANY, 'identity', interface='public') - args[1].assert_called_once_with(self.endpoint_test) - - @mock.patch('functest.ci.check_deployment.verify_connectivity', - return_value=False) - @mock.patch('functest.ci.check_deployment.keystone_utils.get_endpoint') - def test_check_public_endpoint_ko(self, *args): - args[0].return_value = self.endpoint_test - with self.assertRaises(Exception) as context: - self.deployment.check_public_endpoint() - args[0].assert_called_once_with( - mock.ANY, 'identity', interface='public') - args[1].assert_called_once_with(self.endpoint_test) - msg = "Public endpoint {} is not reachable.".format(self.endpoint_test) - self.assertTrue(msg in str(context.exception)) - - @mock.patch('functest.ci.check_deployment.verify_connectivity', - return_value=True) - @mock.patch('functest.ci.check_deployment.keystone_utils.get_endpoint') - def test_check_service_endpoint(self, *args): - self.deployment.check_service_endpoint(self.service_test) - args[0].assert_called_once_with( - mock.ANY, self.service_test, interface='public') - args[1].assert_called_once_with(args[0].return_value) - - @mock.patch('functest.ci.check_deployment.verify_connectivity', - return_value=False) - @mock.patch('functest.ci.check_deployment.keystone_utils.get_endpoint') - def test_check_service_endpoint_ko(self, *args): - args[0].return_value = self.endpoint_test - with self.assertRaises(Exception) as context: - self.deployment.check_service_endpoint(self.service_test) - msg = "{} endpoint {} is not reachable.".format( - self.service_test, self.endpoint_test) - self.assertTrue(msg in str(context.exception)) - args[0].assert_called_once_with( - mock.ANY, self.service_test, interface='public') - args[1].assert_called_once_with(args[0].return_value) - - @mock.patch('functest.ci.check_deployment.nova_utils.nova_client') - def test_check_nova(self, mock_method): - self.deployment.check_nova() - mock_method.assert_called_once_with(mock.ANY) - - @mock.patch('functest.ci.check_deployment.nova_utils.nova_client', - return_value=mock.Mock( - servers=mock.Mock(list=mock.Mock(side_effect=Exception)))) - def test_check_nova_fail(self, mock_method): - with self.assertRaises(Exception): - self.deployment.check_nova() - mock_method.assert_called_once_with(mock.ANY) - - @mock.patch('functest.ci.check_deployment.neutron_utils.neutron_client') - def test_check_neutron(self, mock_method): - self.deployment.check_neutron() - mock_method.assert_called_once_with(mock.ANY) - - @mock.patch('functest.ci.check_deployment.neutron_utils.neutron_client', - return_value=mock.Mock( - list_networks=mock.Mock(side_effect=Exception))) - def test_check_neutron_fail(self, mock_method): - with self.assertRaises(Exception): - self.deployment.check_neutron() - mock_method.assert_called_once_with(mock.ANY) - - @mock.patch('functest.ci.check_deployment.glance_utils.glance_client') - def test_check_glance(self, mock_method): - self.deployment.check_glance() - mock_method.assert_called_once_with(mock.ANY) - - @mock.patch('functest.ci.check_deployment.glance_utils.glance_client', - return_value=mock.Mock( - images=mock.Mock(list=mock.Mock(side_effect=Exception)))) - def test_check_glance_fail(self, mock_method): - with self.assertRaises(Exception): - self.deployment.check_glance() - mock_method.assert_called_once_with(mock.ANY) - - @mock.patch('functest.ci.check_deployment.LOGGER.info') - @mock.patch('functest.opnfv_tests.openstack.snaps.snaps_utils.' - 'get_ext_net_name', return_value='ext-net') - def test_check_extnet(self, *args): - self.deployment.check_ext_net() - args[0].assert_called_once_with(mock.ANY) - args[1].assert_called_once_with( - "External network found: %s", "ext-net") - - @mock.patch('functest.opnfv_tests.openstack.snaps.snaps_utils.' - 'get_ext_net_name', return_value='') - def test_check_extnet_none(self, mock_getext): - with self.assertRaises(Exception) as context: - self.deployment.check_ext_net() - self.assertTrue(mock_getext.called) - msg = 'ERROR: No external networks in the deployment.' - self.assertTrue(msg in str(context.exception)) - - @mock.patch('functest.ci.check_deployment.CheckDeployment.check_rc', - side_effect=Exception) - def test_check_all_exc1(self, *args): - with self.assertRaises(Exception): - self.deployment.check_all() - args[0].assert_called_once_with() - - @mock.patch('snaps.openstack.tests.openstack_tests.get_credentials', - side_effect=Exception) - @mock.patch('functest.ci.check_deployment.CheckDeployment.check_rc') - def test_check_all_exc2(self, *args): - with self.assertRaises(Exception): - self.deployment.check_all() - args[0].assert_called_once_with() - args[1].assert_called_once_with( - os_env_file=self.rc_file, proxy_settings_str=None, - ssh_proxy_cmd=None) - - @mock.patch('snaps.openstack.tests.openstack_tests.get_credentials', - return_value=None) - @mock.patch('functest.ci.check_deployment.CheckDeployment.check_rc') - def test_check_all_exc3(self, *args): - with self.assertRaises(Exception): - self.deployment.check_all() - args[0].assert_called_once_with() - args[1].assert_called_once_with( - os_env_file=self.rc_file, proxy_settings_str=None, - ssh_proxy_cmd=None) - - @mock.patch('functest.ci.check_deployment.CheckDeployment.check_ext_net') - @mock.patch('functest.ci.check_deployment.CheckDeployment.check_glance') - @mock.patch('functest.ci.check_deployment.CheckDeployment.check_neutron') - @mock.patch('functest.ci.check_deployment.CheckDeployment.check_nova') - @mock.patch( - 'functest.ci.check_deployment.CheckDeployment.check_service_endpoint') - @mock.patch( - 'functest.ci.check_deployment.CheckDeployment.check_public_endpoint') - @mock.patch( - 'functest.ci.check_deployment.CheckDeployment.check_auth_endpoint') - @mock.patch('snaps.openstack.tests.openstack_tests.get_credentials') - @mock.patch('functest.ci.check_deployment.CheckDeployment.check_rc') - def test_check_all(self, *args): - self.assertEqual(self.deployment.check_all(), 0) - for i in [0, 2, 3, 5, 6, 7, 8]: - args[i].assert_called_once_with() - args[1].assert_called_once_with( - os_env_file=self.rc_file, proxy_settings_str=None, - ssh_proxy_cmd=None) - calls = [mock.call('compute'), mock.call('network'), - mock.call('image')] - args[4].assert_has_calls(calls) - - -if __name__ == "__main__": - logging.disable(logging.CRITICAL) - unittest.main(verbosity=2) diff --git a/functest/tests/unit/openstack/snaps/__init__.py b/functest/tests/unit/openstack/snaps/__init__.py deleted file mode 100644 index e69de29bb..000000000 --- a/functest/tests/unit/openstack/snaps/__init__.py +++ /dev/null diff --git a/functest/tests/unit/openstack/snaps/test_snaps.py b/functest/tests/unit/openstack/snaps/test_snaps.py deleted file mode 100644 index db8e3e04a..000000000 --- a/functest/tests/unit/openstack/snaps/test_snaps.py +++ /dev/null @@ -1,288 +0,0 @@ -# Copyright (c) 2017 Cable Television Laboratories, Inc. and others. -# -# 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 - -# pylint: disable=missing-docstring - -import logging -import unittest - -import mock -from snaps.openstack.os_credentials import OSCreds -from xtesting.core import testcase - -from functest.opnfv_tests.openstack.snaps import api_check -from functest.opnfv_tests.openstack.snaps import health_check -from functest.opnfv_tests.openstack.snaps import smoke - - -class APICheckTesting(unittest.TestCase): - """ - Ensures the ApiCheck class can run in Functest. This test does not - actually connect with an OpenStack pod. - """ - - def setUp(self): - self.os_creds = OSCreds( - username='user', password='pass', - auth_url='http://foo.com:5000/v3', project_name='bar') - with mock.patch('os_client_config.get_config') as mock_get_config, \ - mock.patch('shade.OpenStackCloud') as mock_shade, \ - mock.patch('functest.core.tenantnetwork.NewProject') \ - as mock_new_project: - self.api_check = api_check.ApiCheck( - os_creds=self.os_creds, ext_net_name='foo') - mock_get_config.assert_called() - mock_shade.assert_called() - mock_new_project.assert_called() - - @mock.patch('xtesting.core.unit.Suite.generate_html') - @mock.patch('xtesting.core.unit.Suite.generate_xunit') - @mock.patch('xtesting.core.unit.Suite.generate_stats') - @mock.patch('os.path.isdir', return_value=True) - @mock.patch('unittest.TestLoader') - @mock.patch('functest.opnfv_tests.openstack.snaps.snaps_suite_builder.' - 'add_openstack_client_tests') - @mock.patch('functest.opnfv_tests.openstack.snaps.snaps_suite_builder.' - 'add_openstack_api_tests') - @mock.patch('subunit.run.SubunitTestRunner.run') - def test_run_success(self, *args): - args[0].return_value = mock.Mock( - decorated=mock.Mock( - testsRun=100, errors=[], failures=[])) - with mock.patch('six.moves.builtins.open', mock.mock_open()): - self.assertEqual(testcase.TestCase.EX_OK, self.api_check.run()) - self.assertEqual( - testcase.TestCase.EX_OK, self.api_check.is_successful()) - args[0].assert_called_with(mock.ANY) - args[1].assert_called_with( - ext_net_name='foo', image_metadata=mock.ANY, - os_creds=self.os_creds, suite=mock.ANY, use_keystone=True) - - @mock.patch('xtesting.core.unit.Suite.generate_html') - @mock.patch('xtesting.core.unit.Suite.generate_xunit') - @mock.patch('xtesting.core.unit.Suite.generate_stats') - @mock.patch('os.path.isdir', return_value=True) - @mock.patch('functest.opnfv_tests.openstack.snaps.snaps_suite_builder.' - 'add_openstack_client_tests') - @mock.patch('functest.opnfv_tests.openstack.snaps.snaps_suite_builder.' - 'add_openstack_api_tests') - @mock.patch('subunit.run.SubunitTestRunner.run') - def test_run_1_of_100_ko(self, *args): - args[0].return_value = mock.Mock( - decorated=mock.Mock( - testsRun=100, errors=[], failures=['foo'])) - with mock.patch('six.moves.builtins.open', mock.mock_open()): - self.assertEqual(testcase.TestCase.EX_OK, self.api_check.run()) - self.assertEqual( - testcase.TestCase.EX_TESTCASE_FAILED, - self.api_check.is_successful()) - args[0].assert_called_with(mock.ANY) - args[1].assert_called_with( - ext_net_name='foo', image_metadata=mock.ANY, - os_creds=self.os_creds, suite=mock.ANY, use_keystone=True) - - @mock.patch('xtesting.core.unit.Suite.generate_html') - @mock.patch('xtesting.core.unit.Suite.generate_xunit') - @mock.patch('xtesting.core.unit.Suite.generate_stats') - @mock.patch('os.path.isdir', return_value=True) - @mock.patch('functest.opnfv_tests.openstack.snaps.snaps_suite_builder.' - 'add_openstack_client_tests') - @mock.patch('functest.opnfv_tests.openstack.snaps.snaps_suite_builder.' - 'add_openstack_api_tests') - @mock.patch('subunit.run.SubunitTestRunner.run') - def test_run_1_of_100_ko_criteria(self, *args): - self.api_check.criteria = 90 - args[0].return_value = mock.Mock( - decorated=mock.Mock( - testsRun=100, errors=[], failures=['foo'])) - with mock.patch('six.moves.builtins.open', mock.mock_open()): - self.assertEqual(testcase.TestCase.EX_OK, self.api_check.run()) - self.assertEqual( - testcase.TestCase.EX_OK, self.api_check.is_successful()) - args[0].assert_called_with(mock.ANY) - args[1].assert_called_with( - ext_net_name='foo', image_metadata=mock.ANY, - os_creds=self.os_creds, suite=mock.ANY, use_keystone=True) - - -class HealthCheckTesting(unittest.TestCase): - """ - Ensures the HealthCheck class can run in Functest. This test does not - actually connect with an OpenStack pod. - """ - - def setUp(self): - self.os_creds = OSCreds( - username='user', password='pass', - auth_url='http://foo.com:5000/v3', project_name='bar') - with mock.patch('os_client_config.get_config') as mock_get_config, \ - mock.patch('shade.OpenStackCloud') as mock_shade, \ - mock.patch('functest.core.tenantnetwork.NewProject') \ - as mock_new_project: - self.health_check = health_check.HealthCheck( - os_creds=self.os_creds, ext_net_name='foo') - mock_get_config.assert_called() - mock_shade.assert_called() - mock_new_project.assert_called() - - @mock.patch('xtesting.core.unit.Suite.generate_html') - @mock.patch('xtesting.core.unit.Suite.generate_xunit') - @mock.patch('xtesting.core.unit.Suite.generate_stats') - @mock.patch('os.path.isdir', return_value=True) - @mock.patch('snaps.openstack.tests.os_source_file_test.' - 'OSIntegrationTestCase.parameterize') - @mock.patch('subunit.run.SubunitTestRunner.run') - def test_run_success(self, *args): - args[0].return_value = mock.Mock( - decorated=mock.Mock( - testsRun=100, errors=[], failures=[])) - with mock.patch('six.moves.builtins.open', mock.mock_open()): - self.assertEqual(testcase.TestCase.EX_OK, self.health_check.run()) - self.assertEqual( - testcase.TestCase.EX_OK, self.health_check.is_successful()) - args[0].assert_called_with(mock.ANY) - args[1].assert_called_with( - mock.ANY, ext_net_name='foo', flavor_metadata=mock.ANY, - image_metadata=mock.ANY, netconf_override=None, - os_creds=self.os_creds, use_keystone=True) - - @mock.patch('xtesting.core.unit.Suite.generate_html') - @mock.patch('xtesting.core.unit.Suite.generate_xunit') - @mock.patch('xtesting.core.unit.Suite.generate_stats') - @mock.patch('os.path.isdir', return_value=True) - @mock.patch('snaps.openstack.tests.os_source_file_test.' - 'OSIntegrationTestCase.parameterize') - @mock.patch('subunit.run.SubunitTestRunner.run') - def test_run_1_of_100_ko(self, *args): - args[0].return_value = mock.Mock( - decorated=mock.Mock( - testsRun=100, errors=[], failures=['foo'])) - with mock.patch('six.moves.builtins.open', mock.mock_open()): - self.assertEqual(testcase.TestCase.EX_OK, self.health_check.run()) - self.assertEqual( - testcase.TestCase.EX_TESTCASE_FAILED, - self.health_check.is_successful()) - args[0].assert_called_with(mock.ANY) - args[1].assert_called_with( - mock.ANY, ext_net_name='foo', flavor_metadata=mock.ANY, - image_metadata=mock.ANY, netconf_override=None, - os_creds=self.os_creds, use_keystone=True) - - @mock.patch('xtesting.core.unit.Suite.generate_html') - @mock.patch('xtesting.core.unit.Suite.generate_xunit') - @mock.patch('xtesting.core.unit.Suite.generate_stats') - @mock.patch('os.path.isdir', return_value=True) - @mock.patch('snaps.openstack.tests.os_source_file_test.' - 'OSIntegrationTestCase.parameterize') - @mock.patch('subunit.run.SubunitTestRunner.run') - def test_run_1_of_100_ko_criteria(self, *args): - self.health_check.criteria = 90 - args[0].return_value = mock.Mock( - decorated=mock.Mock( - testsRun=100, errors=[], failures=['foo'])) - with mock.patch('six.moves.builtins.open', mock.mock_open()): - self.assertEqual(testcase.TestCase.EX_OK, self.health_check.run()) - self.assertEqual( - testcase.TestCase.EX_OK, self.health_check.is_successful()) - args[0].assert_called_with(mock.ANY) - args[1].assert_called_with( - mock.ANY, ext_net_name='foo', flavor_metadata=mock.ANY, - image_metadata=mock.ANY, netconf_override=None, - os_creds=self.os_creds, use_keystone=True) - - -class SmokeTesting(unittest.TestCase): - """ - Ensures the SnapsSmoke class can run in Functest. This test does not - actually connect with an OpenStack pod. - """ - - def setUp(self): - self.os_creds = OSCreds( - username='user', password='pass', - auth_url='http://foo.com:5000/v3', project_name='bar') - with mock.patch('os_client_config.get_config') as mock_get_config, \ - mock.patch('shade.OpenStackCloud') as mock_shade, \ - mock.patch('functest.core.tenantnetwork.NewProject') \ - as mock_new_project: - self.smoke = smoke.SnapsSmoke( - os_creds=self.os_creds, ext_net_name='foo') - mock_get_config.assert_called() - mock_shade.assert_called() - mock_new_project.assert_called() - - @mock.patch('xtesting.core.unit.Suite.generate_html') - @mock.patch('xtesting.core.unit.Suite.generate_xunit') - @mock.patch('xtesting.core.unit.Suite.generate_stats') - @mock.patch('os.path.isdir', return_value=True) - @mock.patch('functest.opnfv_tests.openstack.snaps.snaps_suite_builder.' - 'add_openstack_integration_tests') - @mock.patch('subunit.run.SubunitTestRunner.run') - def test_run_success(self, *args): - args[0].return_value = mock.Mock( - decorated=mock.Mock( - testsRun=100, errors=[], failures=[])) - with mock.patch('six.moves.builtins.open', mock.mock_open()): - self.assertEqual(testcase.TestCase.EX_OK, self.smoke.run()) - self.assertEqual(testcase.TestCase.EX_OK, self.smoke.is_successful()) - args[0].assert_called_with(mock.ANY) - args[1].assert_called_with( - ext_net_name='foo', flavor_metadata=mock.ANY, - image_metadata=mock.ANY, netconf_override=None, - os_creds=self.os_creds, suite=mock.ANY, use_floating_ips=True, - use_keystone=True) - - @mock.patch('xtesting.core.unit.Suite.generate_html') - @mock.patch('xtesting.core.unit.Suite.generate_xunit') - @mock.patch('xtesting.core.unit.Suite.generate_stats') - @mock.patch('os.path.isdir', return_value=True) - @mock.patch('functest.opnfv_tests.openstack.snaps.snaps_suite_builder.' - 'add_openstack_integration_tests') - @mock.patch('subunit.run.SubunitTestRunner.run') - def test_run_1_of_100_ko(self, *args): - args[0].return_value = mock.Mock( - decorated=mock.Mock( - testsRun=100, errors=[], failures=['foo'])) - with mock.patch('six.moves.builtins.open', mock.mock_open()): - self.assertEqual(testcase.TestCase.EX_OK, self.smoke.run()) - self.assertEqual( - testcase.TestCase.EX_TESTCASE_FAILED, self.smoke.is_successful()) - args[0].assert_called_with(mock.ANY) - args[1].assert_called_with( - ext_net_name='foo', flavor_metadata=mock.ANY, - image_metadata=mock.ANY, netconf_override=mock.ANY, - os_creds=self.os_creds, suite=mock.ANY, use_floating_ips=True, - use_keystone=True) - - @mock.patch('xtesting.core.unit.Suite.generate_html') - @mock.patch('xtesting.core.unit.Suite.generate_xunit') - @mock.patch('xtesting.core.unit.Suite.generate_stats') - @mock.patch('os.path.isdir', return_value=True) - @mock.patch('functest.opnfv_tests.openstack.snaps.snaps_suite_builder.' - 'add_openstack_integration_tests') - @mock.patch('subunit.run.SubunitTestRunner.run') - def test_run_1_of_100_ko_criteria(self, *args): - self.smoke.criteria = 90 - args[0].return_value = mock.Mock( - decorated=mock.Mock( - testsRun=100, errors=[], failures=['foo'])) - with mock.patch('six.moves.builtins.open', mock.mock_open()): - self.assertEqual(testcase.TestCase.EX_OK, self.smoke.run()) - self.assertEqual( - testcase.TestCase.EX_OK, self.smoke.is_successful()) - args[0].assert_called_with(mock.ANY) - args[1].assert_called_with( - ext_net_name='foo', flavor_metadata=mock.ANY, - image_metadata=mock.ANY, netconf_override=None, - os_creds=self.os_creds, suite=mock.ANY, use_floating_ips=True, - use_keystone=True) - - -if __name__ == "__main__": - logging.disable(logging.CRITICAL) - unittest.main(verbosity=2) diff --git a/functest/tests/unit/vnf/epc/test_juju_epc.py b/functest/tests/unit/vnf/epc/test_juju_epc.py index 6b4137069..a72c61586 100644 --- a/functest/tests/unit/vnf/epc/test_juju_epc.py +++ b/functest/tests/unit/vnf/epc/test_juju_epc.py @@ -62,7 +62,6 @@ class JujuEpcTesting(unittest.TestCase): 'test_vnf': {}} @unittest.skip("It must be fixed. Please see JIRA FUNCTEST-915") - @mock.patch('snaps.openstack.create_image.OpenStackImage.create') @mock.patch('os.system') def test_prepare_default(self, *args): """ Unittest for Prepare testcase """ diff --git a/requirements.txt b/requirements.txt index 298cc38ad..402b931e2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,7 +10,6 @@ cloudify-rest-client mock # BSD PrettyTable<0.8 # BSD six # MIT -snaps paramiko # LGPLv2.1+ Jinja2 # BSD License (3 clause) xtesting @@ -13,7 +13,6 @@ scripts = [entry_points] console_scripts = functest_odl = functest.opnfv_tests.sdn.odl.odl:main - check_deployment = functest.ci.check_deployment:main xtesting.testcase = connection_check = functest.opnfv_tests.openstack.api.connection_check:ConnectionCheck tenantnetwork1 = functest.core.tenantnetwork:TenantNetwork1 @@ -26,8 +25,6 @@ xtesting.testcase = vping_userdata = functest.opnfv_tests.openstack.vping.vping_userdata:VPingUserdata cinder_test = functest.opnfv_tests.openstack.cinder.cinder_test:CinderCheck odl = functest.opnfv_tests.sdn.odl.odl:ODLTests - api_check = functest.opnfv_tests.openstack.snaps.api_check:ApiCheck - snaps_health_check = functest.opnfv_tests.openstack.snaps.health_check:HealthCheck tempest_common = functest.opnfv_tests.openstack.tempest.tempest:TempestCommon rally_sanity = functest.opnfv_tests.openstack.rally.rally:RallySanity refstack_defcore = functest.opnfv_tests.openstack.refstack.refstack:Refstack @@ -35,7 +32,6 @@ xtesting.testcase = barbican = functest.opnfv_tests.openstack.barbican.barbican:Barbican vmtp = functest.opnfv_tests.openstack.vmtp.vmtp:Vmtp shaker = functest.opnfv_tests.openstack.shaker.shaker:Shaker - snaps_smoke = functest.opnfv_tests.openstack.snaps.smoke:SnapsSmoke vgpu = functest.opnfv_tests.openstack.vgpu.vgpu:VGPU rally_full = functest.opnfv_tests.openstack.rally.rally:RallyFull cloudify = functest.core.cloudify:Cloudify @@ -39,20 +39,16 @@ commands = flake8 basepython = python2.7 whitelist_externals = bash modules = - functest.ci functest.opnfv_tests.openstack.cinder functest.opnfv_tests.openstack.rally functest.opnfv_tests.openstack.refstack - functest.opnfv_tests.openstack.snaps functest.opnfv_tests.openstack.tempest functest.opnfv_tests.openstack.vmtp functest.opnfv_tests.openstack.vping functest.opnfv_tests.sdn.odl functest.opnfv_tests.vnf.router - functest.tests.unit.ci functest.tests.unit.odl functest.tests.unit.openstack.rally - functest.tests.unit.openstack.snaps functest.tests.unit.openstack.tempest functest.tests.unit.openstack.vmtp functest.tests.unit.openstack.vping @@ -114,12 +110,10 @@ commands = bashate {[testenv:bashate]files} [testenv:cover] basepython = python2.7 dirs = - functest/tests/unit/ci functest/tests/unit/odl functest/tests/unit/openstack/vping functest/tests/unit/openstack/cinder commands = nosetests --with-coverage --cover-tests \ - --cover-package functest.ci.check_deployment \ --cover-package functest.opnfv_tests.sdn.odl \ --cover-package functest.opnfv_tests.openstack.vping.vping_ssh \ --cover-package functest.opnfv_tests.openstack.cinder.cinder_test \ diff --git a/upper-constraints.txt b/upper-constraints.txt index 27aa7b6fc..6f15a2396 100644 --- a/upper-constraints.txt +++ b/upper-constraints.txt @@ -1,6 +1,5 @@ git+https://gerrit.opnfv.org/gerrit/functest#egg=functest git+https://gerrit.opnfv.org/gerrit/releng#egg=opnfv&subdirectory=modules -git+https://gerrit.opnfv.org/gerrit/snaps@0dacfaa2fbd2dfe7fc9d438b9350a0187506e61c#egg=snaps git+https://gerrit.opnfv.org/gerrit/barometer#egg=baro_tests git+https://gerrit.opnfv.org/gerrit/sfc#egg=sfc -e git+https://gerrit.opnfv.org/gerrit/doctor#egg=doctor-tests |