Merge "refactor vping using new constants provider"
[functest.git] / functest / opnfv_tests / openstack / snaps / smoke.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 functest.utils.functest_utils as ft_utils
9 from functest.core.pytest_suite_runner import PyTestSuiteRunner
10 from functest.opnfv_tests.openstack.snaps import snaps_utils
11 from snaps import test_suite_builder
12 import unittest
13 import os
14
15
16 class SnapsSmoke(PyTestSuiteRunner):
17     """
18     This test executes the Python Tests included with the SNAPS libraries
19     that exercise many of the OpenStack APIs within Keystone, Glance, Neutron,
20     and Nova
21     """
22     def __init__(self):
23         super(SnapsSmoke, self).__init__()
24
25         self.suite = unittest.TestSuite()
26         self.case_name = "snaps_smoke"
27         creds_file = ft_utils.get_functest_config('general.openstack.creds')
28         use_key = ft_utils.get_functest_config('snaps.use_keystone')
29         use_fip = ft_utils.get_functest_config('snaps.use_floating_ips')
30         ext_net_name = snaps_utils.get_ext_net_name()
31
32         # Tests requiring floating IPs leverage files contained within the
33         # SNAPS repository and are found relative to that path
34         if use_fip:
35             snaps_dir = ft_utils.get_functest_config(
36                 'general.dir.dir_repo_snaps') + '/snaps'
37             os.chdir(snaps_dir)
38
39         test_suite_builder.add_openstack_integration_tests(
40             self.suite, creds_file, ext_net_name, use_keystone=use_key,
41             use_floating_ips=use_fip)