X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=cli%2Fcli_base.py;h=827f8a4b6540a12f3a2a6950a95608ad92dcad89;hb=1da93778752185235e65007a6940d3af5592196a;hp=e8c1d194a4289245e3b0ae972f6a4dda93c22999;hpb=7ad2ce42a2bc2c8dc17fbc9423da71a95fed4d87;p=functest.git diff --git a/cli/cli_base.py b/cli/cli_base.py index e8c1d194a..827f8a4b6 100644 --- a/cli/cli_base.py +++ b/cli/cli_base.py @@ -1,6 +1,16 @@ +#!/usr/bin/env python +# +# jose.lausuch@ericsson.com +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +# + import click from functest.cli.commands.cli_env import CliEnv +from functest.cli.commands.cli_os import CliOpenStack from functest.cli.commands.cli_testcase import CliTestcase from functest.cli.commands.cli_tier import CliTier @@ -13,6 +23,7 @@ def cli(): pass _env = CliEnv() +_openstack = CliOpenStack() _testcase = CliTestcase() _tier = CliTier() @@ -23,6 +34,12 @@ def env(ctx): pass +@cli.group() +@click.pass_context +def openstack(ctx): + pass + + @cli.group() @click.pass_context def testcase(ctx): @@ -35,70 +52,99 @@ def tier(ctx): pass -@env.command('show', help="write the help here") -def env_show(): - _env.show() +@openstack.command('check', help="Checks connectivity and status " + "to the OpenStack deployment.") +def os_check(): + _openstack.check() -@env.command('status', help="write the help here") -def env_status(): - _env.status() +@openstack.command('snapshot-create', help="Generates a snapshot of the " + "current OpenStack resources.") +def os_snapshot_create(): + _openstack.snapshot_create() -@env.command('getrc', help="write the help here") -def env_getrc(): - _env.getrc() +@openstack.command('snapshot-show', help="Prints the OpenStack snapshot.") +def os_snapshot_show(): + _openstack.snapshot_show() -@env.command('sourcerc', help="write the help here") -def env_sourcerc(): - _env.sourcerc() +@openstack.command('clean', + help="Cleans the OpenStack resources except the snapshot.") +def os_clean(): + _openstack.clean() -@env.command('setdefaults', help="write the help here") -def env_setdefaults(): - _env.setdefaults() +@openstack.command('show-credentials', + help="Prints the OpenStack credentials.") +def os_show_credentials(): + _openstack.show_credentials() -@env.command('getdefaults', help="write the help here") -def env_getdefaults(): - _env.getdefaults() +@openstack.command('fetch-rc', help="Fetch the OpenStack RC file from " + "the installer.") +def os_fetch_rc(): + _openstack.fetch_credentials() -@env.command('clean', help="write the help here") -def env_clean(): - _env.clean() +@env.command('prepare', help="Prepares the Functest environment. This step is " + "needed run the tests.") +def env_prepare(): + _env.prepare() -@testcase.command('list', help="write the help here") +@env.command('show', help="Shows information about the current environment.") +def env_show(): + _env.show() + + +@env.command('status', help="Checks if the Functest environment is ready to " + "run the tests.") +def env_status(): + _env.status() + + +@testcase.command('list', help="Lists the available testcases.") def testcase_list(): _testcase.list() -@testcase.command('show', help="write the help here") +@testcase.command('show', help="Shows information about a test case.") @click.argument('testname', type=click.STRING, required=True) def testcase_show(testname): _testcase.show(testname) -@testcase.command('run', help="write the help here") +@testcase.command('run', help="Executes a test case.") @click.argument('testname', type=click.STRING, required=True) -def testcase_run(testname): - _testcase.run(testname) +@click.option('-n', '--noclean', is_flag=True, default=False, + help='The created openstack resources by the test' + 'will not be cleaned after the execution.') +def testcase_run(testname, noclean): + _testcase.run(testname, noclean) -@tier.command('list', help="write the help here") +@tier.command('list', help="Lists the available tiers.") def tier_list(): _tier.list() -@tier.command('show', help="write the help here") +@tier.command('show', help="Shows information about a tier.") @click.argument('tiername', type=click.STRING, required=True) def tier_show(tiername): _tier.show(tiername) -@tier.command('run', help="write the help here") +@tier.command('get-tests', help="Prints the tests in a tier.") +@click.argument('tiername', type=click.STRING, required=True) +def tier_gettests(tiername): + _tier.gettests(tiername) + + +@tier.command('run', help="Executes all the tests within a tier.") @click.argument('tiername', type=click.STRING, required=True) -def tier_run(tiername): - _tier.run(tiername) +@click.option('-n', '--noclean', is_flag=True, default=False, + help='The created openstack resources by the tests' + 'will not be cleaned after the execution.') +def tier_run(tiername, noclean): + _tier.run(tiername, noclean)