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
10 """ global variables """
16 import functest.ci.tier_builder as tb
17 from functest.utils.constants import CONST
18 import functest.utils.functest_utils as ft_utils
21 class CliTier(object):
24 self.tiers = tb.TierBuilder(CONST.INSTALLER_TYPE,
25 CONST.DEPLOY_SCENARIO,
26 CONST.functest_testcases_yaml)
30 for tier in self.tiers.get_tiers():
31 summary += (" - %s. %s:\n\t %s\n"
34 tier.get_test_names()))
37 def show(self, tiername):
38 tier = self.tiers.get_tier(tiername)
40 tier_names = self.tiers.get_tier_names()
41 click.echo("The tier with name '%s' does not exist. "
42 "Available tiers are:\n %s\n" % (tiername, tier_names))
44 click.echo(self.tiers.get_tier(tiername))
46 def gettests(self, tiername):
47 tier = self.tiers.get_tier(tiername)
49 tier_names = self.tiers.get_tier_names()
50 click.echo("The tier with name '%s' does not exist. "
51 "Available tiers are:\n %s\n" % (tiername, tier_names))
53 tests = tier.get_test_names()
54 click.echo("Test cases in tier '%s':\n %s\n" % (tiername, tests))
57 def run(tiername, noclean=False, report=False):
65 if not os.path.isfile(CONST.env_active):
66 click.echo("Functest environment is not ready. "
67 "Run first 'functest env prepare'")
69 cmd = ("python %s/functest/ci/run_tests.py "
70 "%s -t %s" % (CONST.dir_repo_functest, flags, tiername))
71 ft_utils.execute_command(cmd)