3 # Copyright (c) 2017 Cable Television Laboratories, Inc. and others.
5 # This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # pylint: disable=missing-docstring
15 from functest.core import unit
16 from functest.opnfv_tests.openstack.snaps import snaps_utils
17 from functest.utils.constants import CONST
19 from snaps.openstack import create_flavor
20 from snaps.openstack.tests import openstack_tests
23 class SnapsTestRunner(unit.Suite):
24 # pylint: disable=too-many-instance-attributes
26 This test executes the SNAPS Python Tests
29 def __init__(self, **kwargs):
30 super(SnapsTestRunner, self).__init__(**kwargs)
31 self.logger = logging.getLogger(__name__)
32 if 'os_creds' in kwargs:
33 self.os_creds = kwargs['os_creds']
36 if hasattr(CONST, 'snaps_os_creds_override'):
37 creds_override = CONST.__getattribute__(
38 'snaps_os_creds_override')
39 self.os_creds = openstack_tests.get_credentials(
40 os_env_file=CONST.__getattribute__('openstack_creds'),
41 proxy_settings_str=None, ssh_proxy_cmd=None,
42 overrides=creds_override)
44 if 'ext_net_name' in kwargs:
45 self.ext_net_name = kwargs['ext_net_name']
47 self.ext_net_name = snaps_utils.get_ext_net_name(self.os_creds)
49 self.netconf_override = None
50 if hasattr(CONST, 'snaps_network_config'):
51 self.netconf_override = CONST.__getattribute__(
52 'snaps_network_config')
55 CONST.__getattribute__('snaps_use_floating_ips') == 'True')
57 CONST.__getattribute__('snaps_use_keystone') == 'True')
58 scenario = CONST.__getattribute__('DEPLOY_SCENARIO')
60 self.flavor_metadata = None
61 if 'ovs' in scenario or 'fdio' in scenario:
62 self.flavor_metadata = create_flavor.MEM_PAGE_SIZE_LARGE
64 self.logger.info("Using flavor metadata '%s'", self.flavor_metadata)
66 self.image_metadata = None
67 if hasattr(CONST, 'snaps_images'):
68 self.image_metadata = CONST.__getattribute__('snaps_images')