From baa8f2d5f67d45e5761f92cb93fe22050f08d0fe Mon Sep 17 00:00:00 2001 From: Cédric Ollivier Date: Tue, 27 Feb 2018 14:25:49 +0100 Subject: Clean all OpenStack related modules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Xtesting is only focused on the framework and entry points. Change-Id: I1a4146ed8519438b13810a20ddf1140c35bb6ecd Signed-off-by: Cédric Ollivier --- functest/cli/commands/__init__.py | 0 functest/cli/commands/cli_env.py | 49 -------------------- functest/cli/commands/cli_os.py | 63 ------------------------- functest/cli/commands/cli_testcase.py | 50 -------------------- functest/cli/commands/cli_tier.py | 87 ----------------------------------- 5 files changed, 249 deletions(-) delete mode 100644 functest/cli/commands/__init__.py delete mode 100644 functest/cli/commands/cli_env.py delete mode 100644 functest/cli/commands/cli_os.py delete mode 100644 functest/cli/commands/cli_testcase.py delete mode 100644 functest/cli/commands/cli_tier.py (limited to 'functest/cli/commands') diff --git a/functest/cli/commands/__init__.py b/functest/cli/commands/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/functest/cli/commands/cli_env.py b/functest/cli/commands/cli_env.py deleted file mode 100644 index 18c8895a..00000000 --- a/functest/cli/commands/cli_env.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/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 - -# pylint: disable=missing-docstring - -import click -import prettytable -import six - -from functest.utils import env - - -class Env(object): # pylint: disable=too-few-public-methods - - @staticmethod - def show(): - install_type = env.get('INSTALLER_TYPE') - scenario = env.get('DEPLOY_SCENARIO') - node = env.get('NODE_NAME') - build_tag = env.get('BUILD_TAG') - if build_tag: - build_tag = build_tag.lstrip( - "jenkins-").lstrip("functest").lstrip("-") - - env_info = {'INSTALLER': install_type, - 'SCENARIO': scenario, - 'POD': node, - 'BUILD_TAG': build_tag} - - return env_info - - -class CliEnv(object): # pylint: disable=too-few-public-methods - - @staticmethod - def show(): - env_info = Env.show() - msg = prettytable.PrettyTable( - header_style='upper', padding_width=5, - field_names=['Functest Environment', 'value']) - for key, value in six.iteritems(env_info): - if key is not None: - msg.add_row([key, value]) - click.echo(msg.get_string()) diff --git a/functest/cli/commands/cli_os.py b/functest/cli/commands/cli_os.py deleted file mode 100644 index d3e229c8..00000000 --- a/functest/cli/commands/cli_os.py +++ /dev/null @@ -1,63 +0,0 @@ -#!/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 - -# pylint: disable=missing-docstring - -import os - -import click -from six.moves import urllib - -from functest.ci import check_deployment -from functest.utils import constants - - -class OpenStack(object): - - def __init__(self): - self.os_auth_url = os.environ.get('OS_AUTH_URL', None) - self.endpoint_ip = None - self.endpoint_port = None - self.openstack_creds = constants.ENV_FILE - if self.os_auth_url: - self.endpoint_ip = urllib.parse.urlparse(self.os_auth_url).hostname - self.endpoint_port = urllib.parse.urlparse(self.os_auth_url).port - - def ping_endpoint(self): - if self.os_auth_url is None: - click.echo("Source the OpenStack credentials first") - exit(0) - response = os.system("ping -c 1 " + self.endpoint_ip + ">/dev/null") - if response == 0: - return 0 - else: - click.echo("Cannot talk to the endpoint %s\n" % self.endpoint_ip) - exit(0) - - @staticmethod - def show_credentials(): - dic_credentials = {} - for key, value in os.environ.items(): - if key.startswith('OS_'): - dic_credentials.update({key: value}) - return dic_credentials - - def check(self): - self.ping_endpoint() - deployment = check_deployment.CheckDeployment() - deployment.check_all() - - -class CliOpenStack(OpenStack): - - @staticmethod - def show_credentials(): - dic_credentials = OpenStack.show_credentials() - for key, value in dic_credentials.items(): - if key.startswith('OS_'): - click.echo("{}={}".format(key, value)) diff --git a/functest/cli/commands/cli_testcase.py b/functest/cli/commands/cli_testcase.py deleted file mode 100644 index a8ead5f5..00000000 --- a/functest/cli/commands/cli_testcase.py +++ /dev/null @@ -1,50 +0,0 @@ -#!/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 - -# pylint: disable=missing-docstring - -import click - -from functest.cli.commands import cli_tier -from functest.utils import functest_utils - - -class Testcase(cli_tier.Tier): - - def list(self): - summary = "" - for tier in self.tiers.get_tiers(): - for test in tier.get_tests(): - summary += (" %s\n" % test.get_name()) - return summary - - def show(self, name): - description = self.tiers.get_test(name) - return description - - @staticmethod - def run(name, noclean=False, report=False): - tests = name.split(",") - for test in tests: - cmd = "run_tests {}-t {}".format( - Testcase.get_flags(noclean, report), test) - functest_utils.execute_command(cmd) - - -class CliTestcase(Testcase): - - def list(self): - click.echo(super(CliTestcase, self).list()) - - def show(self, name): - testcase_show = super(CliTestcase, self).show(name) - if testcase_show: - click.echo(testcase_show) - else: - click.echo("The test case '%s' does not exist or is not supported." - % name) diff --git a/functest/cli/commands/cli_tier.py b/functest/cli/commands/cli_tier.py deleted file mode 100644 index 3694c1ae..00000000 --- a/functest/cli/commands/cli_tier.py +++ /dev/null @@ -1,87 +0,0 @@ -#!/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 - -# pylint: disable=missing-docstring - -import pkg_resources - -import click - -from functest.ci import tier_builder -from functest.utils import functest_utils -from functest.utils import env - - -class Tier(object): - - def __init__(self): - self.tiers = tier_builder.TierBuilder( - env.get('INSTALLER_TYPE'), - env.get('DEPLOY_SCENARIO'), - pkg_resources.resource_filename('functest', 'ci/testcases.yaml')) - - def list(self): - summary = "" - for tier in self.tiers.get_tiers(): - summary += (" - %s. %s:\n\t %s\n" - % (tier.get_order(), - tier.get_name(), - tier.get_test_names())) - return summary - - def show(self, name): - tier = self.tiers.get_tier(name) - if tier is None: - return None - tier_info = self.tiers.get_tier(name) - return tier_info - - def gettests(self, name): - tier = self.tiers.get_tier(name) - if tier is None: - return None - tests = tier.get_test_names() - return tests - - @staticmethod - def get_flags(noclean=False, report=False): - flags = "" - if noclean: - flags += "-n " - if report: - flags += "-r " - return flags - - @staticmethod - def run(name, noclean=False, report=False): - cmd = "run_tests {}-t {}".format(Tier.get_flags(noclean, report), name) - functest_utils.execute_command(cmd) - - -class CliTier(Tier): - - def list(self): - click.echo(super(CliTier, self).list()) - - def show(self, name): - tier_info = super(CliTier, self).show(name) - if tier_info: - click.echo(tier_info) - else: - tier_names = self.tiers.get_tier_names() - click.echo("The tier with name '%s' does not exist. " - "Available tiers are:\n %s\n" % (name, tier_names)) - - def gettests(self, name): - tests = super(CliTier, self).gettests(name) - if tests: - click.echo("Test cases in tier '%s':\n %s\n" % (name, tests)) - else: - tier_names = self.tiers.get_tier_names() - click.echo("The tier with name '%s' does not exist. " - "Available tiers are:\n %s\n" % (name, tier_names)) -- cgit 1.2.3-korg