summaryrefslogtreecommitdiffstats
path: root/dovetail/cli/cli_base.py
diff options
context:
space:
mode:
authorMatthewLi <matthew.lijun@huawei.com>2017-01-05 02:02:13 -0500
committerMatthewLi <matthew.lijun@huawei.com>2017-01-13 03:56:42 -0500
commit60f1f328b2ebc94330dcbf5f4374684a410d3e92 (patch)
tree6ecfa056092718997d82651c14bf3f91b1f64490 /dovetail/cli/cli_base.py
parent0c57358d86d0a1d155b66e3af015be5be7e80e79 (diff)
dovetail tool: command line
JIRA: DOVETAIL-173 details please see https://wiki.opnfv.org/display/dovetail/Dovetail+Command+Line Change-Id: Iff04b0df8c4e6310d35a45b9c8ba3c7b3b5e1105 Signed-off-by: MatthewLi <matthew.lijun@huawei.com>
Diffstat (limited to 'dovetail/cli/cli_base.py')
-rw-r--r--dovetail/cli/cli_base.py56
1 files changed, 56 insertions, 0 deletions
diff --git a/dovetail/cli/cli_base.py b/dovetail/cli/cli_base.py
new file mode 100644
index 00000000..c0d57e86
--- /dev/null
+++ b/dovetail/cli/cli_base.py
@@ -0,0 +1,56 @@
+##############################################################################
+# Copyright (c) 2016 Huawei Technologies Co.,Ltd and others.
+#
+# 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 pbr import version
+from dovetail.cli.commands.cli_testcase import CliTestcase
+
+
+CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
+cli_version = version.VersionInfo('dovetail').version_string()
+
+
+@click.group(context_settings=CONTEXT_SETTINGS)
+@click.version_option(version=cli_version)
+def cli():
+ pass
+
+
+_testcase = CliTestcase()
+
+
+@cli.command('list',
+ help='list the testsuite details')
+@click.argument('testsuite', type=click.STRING, required=False)
+def testcase_list(testsuite):
+ _testcase.list_testcase(testsuite)
+
+
+@cli.command('show',
+ help='show the testcases details')
+@click.argument('testcase', type=click.STRING, required=True)
+def testcase_show(testcase):
+ _testcase.show_testcase(testcase)
+
+
+@cli.command('run',
+ context_settings=dict(
+ ignore_unknown_options=True, help_option_names=[]),
+ help='run the testcases')
+@click.argument('run_args', nargs=-1, type=click.UNPROCESSED)
+def testcase_run(run_args):
+ args_list = [] + list(run_args)
+ args_str = ' '.join(args_list)
+ _testcase.run(args_str)
+
+
+# @cli.command('report', help='testcases running result report')
+# @click.option('--encrypt', default=True,
+# help='report the test result with encryption')
+# def run(**kwargs):
+# CliReport.execute(**kwargs)