3 # jose.lausuch@ericsson.com
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # pylint: disable=missing-docstring
16 from functest.cli.commands.cli_env import CliEnv
17 from functest.cli.commands.cli_os import CliOpenStack
18 from functest.cli.commands.cli_testcase import CliTestcase
19 from functest.cli.commands.cli_tier import CliTier
22 CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
25 @click.group(context_settings=CONTEXT_SETTINGS)
26 @click.version_option(version='opnfv colorado.0.1 ')
28 logging.config.fileConfig(pkg_resources.resource_filename(
29 'functest', 'ci/logging.ini'))
30 logging.captureWarnings(True)
34 OPENSTACK = CliOpenStack()
35 TESTCASE = CliTestcase()
41 def env(ctx): # pylint: disable=unused-argument
47 def openstack(ctx): # pylint: disable=unused-argument
53 def testcase(ctx): # pylint: disable=unused-argument
59 def tier(ctx): # pylint: disable=unused-argument
63 @openstack.command('check', help="Checks connectivity and status "
64 "to the OpenStack deployment.")
69 @openstack.command('show-credentials',
70 help="Prints the OpenStack credentials.")
71 def os_show_credentials():
72 OPENSTACK.show_credentials()
75 @env.command('show', help="Shows information about the current environment.")
80 @testcase.command('list', help="Lists the available testcases.")
85 @testcase.command('show', help="Shows information about a test case.")
86 @click.argument('testname', type=click.STRING, required=True)
87 def testcase_show(testname):
88 TESTCASE.show(testname)
91 @testcase.command('run', help="Executes a test case.")
92 @click.argument('testname', type=click.STRING, required=True)
93 @click.option('-n', '--noclean', is_flag=True, default=False,
94 help='The created openstack resources by the test'
95 'will not be cleaned after the execution.')
96 @click.option('-r', '--report', is_flag=True, default=False,
97 help='Push results to the results DataBase. Only CI Pods'
98 'have rights to do that.')
99 def testcase_run(testname, noclean, report):
100 TESTCASE.run(testname, noclean, report)
103 @tier.command('list', help="Lists the available tiers.")
108 @tier.command('show', help="Shows information about a tier.")
109 @click.argument('tiername', type=click.STRING, required=True)
110 def tier_show(tiername):
114 @tier.command('get-tests', help="Prints the tests in a tier.")
115 @click.argument('tiername', type=click.STRING, required=True)
116 def tier_gettests(tiername):
117 TIER.gettests(tiername)
120 @tier.command('run', help="Executes all the tests within a tier.")
121 @click.argument('tiername', type=click.STRING, required=True)
122 @click.option('-n', '--noclean', is_flag=True, default=False,
123 help='The created openstack resources by the tests'
124 'will not be cleaned after the execution.')
125 @click.option('-r', '--report', is_flag=True, default=False,
126 help='Push results to the results DataBase. Only CI Pods'
127 'have rights to do that.')
128 def tier_run(tiername, noclean, report):
129 TIER.run(tiername, noclean, report)