aboutsummaryrefslogtreecommitdiffstats
path: root/functest/opnfv_tests/openstack/snaps
diff options
context:
space:
mode:
Diffstat (limited to 'functest/opnfv_tests/openstack/snaps')
-rw-r--r--functest/opnfv_tests/openstack/snaps/api_check.py16
-rw-r--r--functest/opnfv_tests/openstack/snaps/connection_check.py16
-rw-r--r--functest/opnfv_tests/openstack/snaps/health_check.py16
-rw-r--r--functest/opnfv_tests/openstack/snaps/smoke.py33
-rw-r--r--functest/opnfv_tests/openstack/snaps/snaps_test_runner.py25
-rw-r--r--functest/opnfv_tests/openstack/snaps/snaps_utils.py8
6 files changed, 59 insertions, 55 deletions
diff --git a/functest/opnfv_tests/openstack/snaps/api_check.py b/functest/opnfv_tests/openstack/snaps/api_check.py
index ad77d9be..50f67094 100644
--- a/functest/opnfv_tests/openstack/snaps/api_check.py
+++ b/functest/opnfv_tests/openstack/snaps/api_check.py
@@ -11,7 +11,6 @@ from snaps import test_suite_builder
from functest.opnfv_tests.openstack.snaps.snaps_test_runner import \
SnapsTestRunner
-from functest.utils.constants import CONST
class ApiCheck(SnapsTestRunner):
@@ -20,14 +19,15 @@ class ApiCheck(SnapsTestRunner):
that exercise many of the OpenStack APIs within Keystone, Glance, Neutron,
and Nova
"""
- def __init__(self):
- super(ApiCheck, self).__init__()
+ def __init__(self, **kwargs):
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = "api_check"
+ super(ApiCheck, self).__init__(**kwargs)
self.suite = unittest.TestSuite()
- self.case_name = "api_check"
test_suite_builder.add_openstack_api_tests(
- self.suite,
- CONST.openstack_creds,
- self.ext_net_name,
- use_keystone=CONST.snaps_use_keystone)
+ suite=self.suite,
+ os_creds=self.os_creds,
+ ext_net_name=self.ext_net_name,
+ use_keystone=self.use_keystone)
diff --git a/functest/opnfv_tests/openstack/snaps/connection_check.py b/functest/opnfv_tests/openstack/snaps/connection_check.py
index 0637bcfb..f2753aea 100644
--- a/functest/opnfv_tests/openstack/snaps/connection_check.py
+++ b/functest/opnfv_tests/openstack/snaps/connection_check.py
@@ -11,7 +11,6 @@ from snaps import test_suite_builder
from functest.opnfv_tests.openstack.snaps.snaps_test_runner import \
SnapsTestRunner
-from functest.utils.constants import CONST
class ConnectionCheck(SnapsTestRunner):
@@ -20,14 +19,15 @@ class ConnectionCheck(SnapsTestRunner):
that simply obtain the different OpenStack clients and may perform
simple queries
"""
- def __init__(self):
- super(ConnectionCheck, self).__init__()
+ def __init__(self, **kwargs):
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = "connection_check"
+ super(ConnectionCheck, self).__init__(**kwargs)
self.suite = unittest.TestSuite()
- self.case_name = "connection_check"
test_suite_builder.add_openstack_client_tests(
- self.suite,
- CONST.openstack_creds,
- self.ext_net_name,
- use_keystone=CONST.snaps_use_keystone)
+ suite=self.suite,
+ os_creds=self.os_creds,
+ ext_net_name=self.ext_net_name,
+ use_keystone=self.use_keystone)
diff --git a/functest/opnfv_tests/openstack/snaps/health_check.py b/functest/opnfv_tests/openstack/snaps/health_check.py
index 8fece746..0daddcdd 100644
--- a/functest/opnfv_tests/openstack/snaps/health_check.py
+++ b/functest/opnfv_tests/openstack/snaps/health_check.py
@@ -21,19 +21,21 @@ class HealthCheck(SnapsTestRunner):
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):
- super(HealthCheck, self).__init__()
+ 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()
- self.case_name = "snaps_health_check"
image_custom_config = None
- if hasattr(CONST, 'snaps_health_check'):
- image_custom_config = CONST.snaps_health_check
+ if hasattr(CONST, 'snaps_images_cirros'):
+ image_custom_config = CONST.__getattribute__('snaps_images_cirros')
self.suite.addTest(
OSIntegrationTestCase.parameterize(
- SimpleHealthCheck, CONST.openstack_creds, self.ext_net_name,
- use_keystone=CONST.snaps_use_keystone,
+ 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=image_custom_config))
diff --git a/functest/opnfv_tests/openstack/snaps/smoke.py b/functest/opnfv_tests/openstack/snaps/smoke.py
index 45fa6de8..d9f95e90 100644
--- a/functest/opnfv_tests/openstack/snaps/smoke.py
+++ b/functest/opnfv_tests/openstack/snaps/smoke.py
@@ -21,30 +21,29 @@ class SnapsSmoke(SnapsTestRunner):
that exercise many of the OpenStack APIs within Keystone, Glance, Neutron,
and Nova
"""
- def __init__(self):
- super(SnapsSmoke, self).__init__()
+ def __init__(self, **kwargs):
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = "snaps_smoke"
+ super(SnapsSmoke, self).__init__(**kwargs)
self.suite = unittest.TestSuite()
- self.case_name = "snaps_smoke"
- use_fip = CONST.snaps_use_floating_ips
- # The snaps smoke test uses the same config as the
- # snaps_health_check suite, so reuse it here
- image_custom_config = None
- if hasattr(CONST, 'snaps_health_check'):
- image_custom_config = CONST.snaps_health_check
+ image_config = None
+ if hasattr(CONST, 'snaps_images_cirros'):
+ image_config = CONST.__getattribute__('snaps_images_cirros')
# Tests requiring floating IPs leverage files contained within the
# SNAPS repository and are found relative to that path
- if use_fip:
- snaps_dir = CONST.dir_repo_snaps + '/snaps'
+ if self.use_fip:
+ snaps_dir = os.path.join(CONST.__getattribute__('dir_repo_snaps'),
+ 'snaps')
os.chdir(snaps_dir)
test_suite_builder.add_openstack_integration_tests(
- self.suite,
- CONST.openstack_creds,
- self.ext_net_name,
- use_keystone=CONST.snaps_use_keystone,
+ 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=image_custom_config,
- use_floating_ips=use_fip)
+ image_metadata=image_config,
+ use_floating_ips=self.use_fip)
diff --git a/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py b/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py
index 9d723905..94b97551 100644
--- a/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py
+++ b/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py
@@ -5,29 +5,36 @@
#
# http://www.apache.org/licenses/LICENSE-2.0
-from functest.utils import functest_logger as ft_logger
+import logging
+
from functest.core.pytest_suite_runner import PyTestSuiteRunner
from functest.opnfv_tests.openstack.snaps import snaps_utils
from functest.utils import functest_utils
+from functest.utils.constants import CONST
from snaps.openstack import create_flavor
+from snaps.openstack.tests import openstack_tests
class SnapsTestRunner(PyTestSuiteRunner):
"""
- 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
+ This test executes the SNAPS Python Tests
"""
- def __init__(self):
- super(SnapsTestRunner, self).__init__()
+ def __init__(self, **kwargs):
+ super(SnapsTestRunner, self).__init__(**kwargs)
+ self.logger = logging.getLogger(__name__)
+
+ self.os_creds = openstack_tests.get_credentials(
+ os_env_file=CONST.__getattribute__('openstack_creds'),
+ proxy_settings_str=None, ssh_proxy_cmd=None)
- self.ext_net_name = snaps_utils.get_ext_net_name()
- self.logger = ft_logger.Logger(self.project_name).getLogger()
+ self.ext_net_name = snaps_utils.get_ext_net_name(self.os_creds)
+ self.use_fip = CONST.__getattribute__('snaps_use_floating_ips')
+ self.use_keystone = CONST.__getattribute__('snaps_use_keystone')
scenario = functest_utils.get_scenario()
self.flavor_metadata = create_flavor.MEM_PAGE_SIZE_ANY
if 'ovs' in scenario or 'fdio' in scenario:
self.flavor_metadata = create_flavor.MEM_PAGE_SIZE_LARGE
- self.logger.info("Using flavor metatdata '%s'" % self.flavor_metadata)
+ self.logger.info("Using flavor metadata '%s'", self.flavor_metadata)
diff --git a/functest/opnfv_tests/openstack/snaps/snaps_utils.py b/functest/opnfv_tests/openstack/snaps/snaps_utils.py
index 4ea1a04a..327ba073 100644
--- a/functest/opnfv_tests/openstack/snaps/snaps_utils.py
+++ b/functest/opnfv_tests/openstack/snaps/snaps_utils.py
@@ -5,19 +5,15 @@
#
# http://www.apache.org/licenses/LICENSE-2.0
-from snaps.openstack.tests import openstack_tests
from snaps.openstack.utils import neutron_utils
-from functest.utils.constants import CONST
-
-def get_ext_net_name():
+def get_ext_net_name(os_creds):
"""
Returns the first external network name
+ :param: os_creds: an instance of snaps OSCreds object
:return:
"""
- os_env_file = CONST.openstack_creds
- os_creds = openstack_tests.get_credentials(os_env_file=os_env_file)
neutron = neutron_utils.neutron_client(os_creds)
ext_nets = neutron_utils.get_external_networks(neutron)
return ext_nets[0]['network']['name']