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
14 from functest.cli.commands.cli_env import CliEnv
15 from functest.cli.commands.cli_os import CliOpenStack
16 from functest.cli.commands.cli_testcase import CliTestcase
17 from functest.cli.commands.cli_tier import CliTier
20 CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
23 @click.group(context_settings=CONTEXT_SETTINGS)
24 @click.version_option(version='opnfv colorado.0.1 ')
26 logging.config.fileConfig(pkg_resources.resource_filename(
27 'functest', 'ci/logging.ini'))
28 logging.captureWarnings(True)
32 _openstack = CliOpenStack()
33 _testcase = CliTestcase()
61 @openstack.command('check', help="Checks connectivity and status "
62 "to the OpenStack deployment.")
67 @openstack.command('snapshot-create', help="Generates a snapshot of the "
68 "current OpenStack resources.")
69 def os_snapshot_create():
70 _openstack.snapshot_create()
73 @openstack.command('snapshot-show', help="Prints the OpenStack snapshot.")
74 def os_snapshot_show():
75 _openstack.snapshot_show()
78 @openstack.command('clean',
79 help="Cleans the OpenStack resources except the snapshot.")
84 @openstack.command('show-credentials',
85 help="Prints the OpenStack credentials.")
86 def os_show_credentials():
87 _openstack.show_credentials()
90 @env.command('show', help="Shows information about the current environment.")
95 @testcase.command('list', help="Lists the available testcases.")
100 @testcase.command('show', help="Shows information about a test case.")
101 @click.argument('testname', type=click.STRING, required=True)
102 def testcase_show(testname):
103 _testcase.show(testname)
106 @testcase.command('run', help="Executes a test case.")
107 @click.argument('testname', type=click.STRING, required=True)
108 @click.option('-n', '--noclean', is_flag=True, default=False,
109 help='The created openstack resources by the test'
110 'will not be cleaned after the execution.')
111 @click.option('-r', '--report', is_flag=True, default=False,
112 help='Push results to the results DataBase. Only CI Pods'
113 'have rights to do that.')
114 def testcase_run(testname, noclean, report):
115 _testcase.run(testname, noclean, report)
118 @tier.command('list', help="Lists the available tiers.")
123 @tier.command('show', help="Shows information about a tier.")
124 @click.argument('tiername', type=click.STRING, required=True)
125 def tier_show(tiername):
129 @tier.command('get-tests', help="Prints the tests in a tier.")
130 @click.argument('tiername', type=click.STRING, required=True)
131 def tier_gettests(tiername):
132 _tier.gettests(tiername)
135 @tier.command('run', help="Executes all the tests within a tier.")
136 @click.argument('tiername', type=click.STRING, required=True)
137 @click.option('-n', '--noclean', is_flag=True, default=False,
138 help='The created openstack resources by the tests'
139 'will not be cleaned after the execution.')
140 @click.option('-r', '--report', is_flag=True, default=False,
141 help='Push results to the results DataBase. Only CI Pods'
142 'have rights to do that.')
143 def tier_run(tiername, noclean, report):
144 _tier.run(tiername, noclean, report)