Refactor tempest common
[functest.git] / functest / opnfv_tests / openstack / refstack / refstack.py
1 #!/usr/bin/env python
2
3 # Copyright (c) 2017 Huawei Technologies Co.,Ltd and others.
4 #
5 # All rights reserved. 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
8 # http://www.apache.org/licenses/LICENSE-2.0
9
10 """Refstack testcase implementation."""
11
12 import logging
13 import os
14 import shutil
15
16 from refstack_client import list_parser
17
18 from functest.opnfv_tests.openstack.tempest import tempest
19 from functest.utils import config
20
21
22 class Refstack(tempest.TempestCommon):
23     """Refstack testcase implementation class."""
24
25     __logger = logging.getLogger(__name__)
26
27     defcorelist = os.path.join(
28         getattr(config.CONF, 'dir_refstack_data'), 'defcore.txt')
29
30     def generate_test_list(self, **kwargs):
31         parser = list_parser.TestListParser(
32             getattr(config.CONF, 'dir_repo_tempest'))
33         nfile = parser.get_normalized_test_list(Refstack.defcorelist)
34         shutil.copyfile(nfile, self.list)