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
12 from functest.cli.commands.cli_env import CliEnv
13 from functest.cli.commands.cli_os import CliOpenStack
14 from functest.cli.commands.cli_testcase import CliTestcase
15 from functest.cli.commands.cli_tier import CliTier
17 CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
20 @click.group(context_settings=CONTEXT_SETTINGS)
21 @click.version_option(version='opnfv colorado.0.1 ')
26 _openstack = CliOpenStack()
27 _testcase = CliTestcase()
55 @openstack.command('check', help="Checks connectivity and status "
56 "to the OpenStack deployment.")
61 @openstack.command('snapshot-create', help="Generates a snapshot of the "
62 "current OpenStack resources.")
63 def os_snapshot_create():
64 _openstack.snapshot_create()
67 @openstack.command('snapshot-show', help="Prints the OpenStack snapshot.")
68 def os_snapshot_show():
69 _openstack.snapshot_show()
72 @openstack.command('clean',
73 help="Cleans the OpenStack resources except the snapshot.")
78 @openstack.command('show-credentials',
79 help="Prints the OpenStack credentials.")
80 def os_show_credentials():
81 _openstack.show_credentials()
84 @openstack.command('fetch-rc', help="Fetch the OpenStack RC file from "
87 _openstack.fetch_credentials()
90 @env.command('prepare', help="Prepares the Functest environment. This step is "
91 "needed run the tests.")
96 @env.command('show', help="Shows information about the current environment.")
101 @env.command('status', help="Checks if the Functest environment is ready to "
107 @testcase.command('list', help="Lists the available testcases.")
112 @testcase.command('show', help="Shows information about a test case.")
113 @click.argument('testname', type=click.STRING, required=True)
114 def testcase_show(testname):
115 _testcase.show(testname)
118 @testcase.command('run', help="Executes a test case.")
119 @click.argument('testname', type=click.STRING, required=True)
120 @click.option('-n', '--noclean', is_flag=True, default=False,
121 help='The created openstack resources by the test'
122 'will not be cleaned after the execution.')
123 def testcase_run(testname, noclean):
124 _testcase.run(testname, noclean)
127 @tier.command('list', help="Lists the available tiers.")
132 @tier.command('show', help="Shows information about a tier.")
133 @click.argument('tiername', type=click.STRING, required=True)
134 def tier_show(tiername):
138 @tier.command('get-tests', help="Prints the tests in a tier.")
139 @click.argument('tiername', type=click.STRING, required=True)
140 def tier_gettests(tiername):
141 _tier.gettests(tiername)
144 @tier.command('run', help="Executes all the tests within a tier.")
145 @click.argument('tiername', type=click.STRING, required=True)
146 @click.option('-n', '--noclean', is_flag=True, default=False,
147 help='The created openstack resources by the tests'
148 'will not be cleaned after the execution.')
149 def tier_run(tiername, noclean):
150 _tier.run(tiername, noclean)