bugfix: copy hosts file
[bottlenecks.git] / cli / bottlenecks_cli.py
1 #!/usr/bin/env python
2 ##############################################################################
3 # Copyright (c) 2016 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
11 import click
12
13 from command_group.testcase import Testcase
14
15 CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
16
17
18 @click.group(context_settings=CONTEXT_SETTINGS)
19 @click.version_option(version='0.1')
20 @click.pass_context
21 def main(ctx):
22     """cli for bottlenecks project
23
24        commands:
25        bottlenecks testcase run <testcase>
26     """
27     pass
28
29
30 _testcase = Testcase()
31
32
33 @main.group()
34 @click.pass_context
35 def testcase(ctx):
36     """testcase cli group for bottlenecks project"""
37     pass
38
39
40 @testcase.command('run', help="To execute a test case.")
41 @click.argument('testname', type=click.STRING, required=True)
42 @click.option('-n', '--noclean', is_flag=True, default=False,
43               help='Openstack resources created by the test'
44               'will not be cleaned after the testcase execution.')
45 def testcase_run(testname, noclean):
46     _testcase.run('-c ' + testname, noclean)
47
48
49 @main.group()
50 @click.pass_context
51 def teststory(ctx):
52     """teststory cli group for bottlenecks project"""
53     pass
54
55
56 @teststory.command('run', help="To execute a test story.")
57 @click.argument('testname', type=click.STRING, required=True)
58 @click.option('-n', '--noclean', is_flag=True, default=False,
59               help='Openstack resources created by the test'
60               'will not be cleaned after the teststory execution.')
61 def teststory_run(testname, noclean):
62     _testcase.run('-s ' + testname, noclean)