Merge changes from topic 'add_testcase_str'
[functest.git] / functest / opnfv_tests / openstack / snaps / snaps_test_runner.py
1 # Copyright (c) 2015 All rights reserved
2 # This program and the accompanying materials
3 # are made available under the terms of the Apache License, Version 2.0
4 # which accompanies this distribution, and is available at
5 #
6 # http://www.apache.org/licenses/LICENSE-2.0
7
8 import logging
9
10 from functest.core.pytest_suite_runner import PyTestSuiteRunner
11 from functest.opnfv_tests.openstack.snaps import snaps_utils
12 from functest.utils import functest_utils
13 from functest.utils.constants import CONST
14
15 from snaps.openstack import create_flavor
16 from snaps.openstack.tests import openstack_tests
17
18
19 class SnapsTestRunner(PyTestSuiteRunner):
20     """
21     This test executes the SNAPS Python Test case SimpleHealthCheck which
22     creates a VM with a single port with an IPv4 address that is assigned by
23     DHCP. This test then validates the expected IP with the actual
24     """
25     def __init__(self, **kwargs):
26         super(SnapsTestRunner, self).__init__(**kwargs)
27         self.logger = logging.getLogger(__name__)
28
29         self.os_creds = openstack_tests.get_credentials(
30             os_env_file=CONST.__getattribute__('openstack_creds'),
31             proxy_settings_str=None, ssh_proxy_cmd=None)
32
33         self.ext_net_name = snaps_utils.get_ext_net_name(self.os_creds)
34         self.use_fip = CONST.__getattribute__('snaps_use_floating_ips')
35         self.use_keystone = CONST.__getattribute__('snaps_use_keystone')
36         scenario = functest_utils.get_scenario()
37
38         self.flavor_metadata = create_flavor.MEM_PAGE_SIZE_ANY
39         if 'ovs' in scenario or 'fdio' in scenario:
40             self.flavor_metadata = create_flavor.MEM_PAGE_SIZE_LARGE
41
42         self.logger.info("Using flavor metadata '%s'", self.flavor_metadata)