summaryrefslogtreecommitdiffstats
AgeCommit message (Expand)AuthorFilesLines
2015-09-18remove external_bridge=br-ex from neutron config filescarey.xu4-4/+4
2015-09-18Merge "Documentation Improvement: add baremetal deployment in HA mode into Ho...chenshuai@huawei.com2-14/+36
2015-09-18separate the mgmt vip from public vip, remove HA_VIPcarey.xu36-145/+161
2015-09-18Documentation Improvement: add baremetal deployment in HA mode into How to us...chenshuai@huawei.com2-14/+36
2015-09-17Merge "Documentation Improvement: add network configuration into How to use c...chenshuai@huawei.com2-19/+96
2015-09-17Documentation Improvement: add network configuration into How to use compass4nfvchenshuai@huawei.com2-19/+96
2015-09-17Merge "Add parameter allows users to add their own package or scripts of maki...Justin chi7-38/+65
2015-09-17Merge "lack broadcast parameter when move ips from nic to br_install and lead...Justin chi1-18/+56
2015-09-17Add parameter allows users to add their own package or scripts of making pack...baigk7-38/+65
2015-09-17add haproxy logging filebaigk1-1/+1
2015-09-17lack broadcast parameter when move ips from nic to br_install and lead to the...baigk1-18/+56
2015-09-15Merge "add ceph integration with compass"Justin chi13-0/+312
2015-09-15Documentation:How to use compass4nfvchenshuai@huawei.com2-0/+462
2015-09-15add ceph integration with compassgrakiss13-0/+312
2015-09-15bug fix: prepare to install ipmitool and retry reset baremetal using ipmibaigk2-3/+29
2015-09-12Merge "bug fix:support centos 7.1 deployment"shuai chen11-8/+42
2015-09-12bug fix:support centos 7.1 deploymentbaigk11-8/+42
@media only all and (prefers-color-scheme: dark) { .highlight .hll { background-color: #49483e } .highlight .c { color: #75715e } /* Comment */ .highlight .err { color: #960050; background-color: #1e0010 } /* Error */ .highlight .k { color: #66d9ef } /* Keyword */ .highlight .l { color: #ae81ff } /* Literal */ .highlight .n { color: #f8f8f2 } /* Name */ .highlight .o { color: #f92672 } /* Operator */ .highlight .p { color: #f8f8f2 } /* Punctuation */ .highlight .ch { color: #75715e } /* Comment.Hashbang */ .highlight .cm { color: #75715e } /* Comment.Multiline */ .highlight .cp { color: #75715e } /* Comment.Preproc */ .highlight .cpf { color: #75715e } /* Comment.PreprocFile */ .highlight .c1 { color: #75715e } /* Comment.Single */ .highlight .cs { color: #75715e } /* Comment.Special */ .highlight .gd { color: #f92672 } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .gi { color: #a6e22e } /* Generic.Inserted */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #75715e } /* Generic.Subheading */ .highlight .kc { color: #66d9ef } /* Keyword.Constant */ .highlight .kd { color: #66d9ef } /* Keyword.Declaration */ .highlight .kn { color: #f92672 } /* Keyword.Namespace */ .highlight .kp { color: #66d9ef } /* Keyword.Pseudo */ .highlight .kr { color: #66d9ef } /* Keyword.Reserved */ .highlight .kt { color: #66d9ef } /* Keyword.Type */ .highlight .ld { color: #e6db74 } /* Literal.Date */ .highlight .m { color: #ae81ff } /* Literal.Number */ .highlight .s { color: #e6db74 } /* Literal.String */ .highlight .na { color: #a6e22e } /* Name.Attribute */ .highlight .nb { color: #f8f8f2 } /* Name.Builtin */ .highlight .nc { color: #a6e22e } /* Name.Class */ .highlight .no { color: #66d9ef } /* Name.Constant */ .highlight .nd { color: #a6e22e } /* Name.Decorator */ .highlight .ni { color: #f8f8f2 } /* Name.Entity */ .highlight .ne { color: #a6e22e } /* Name.Exception */ .highlight .nf { color: #a6e22e } /* Name.Function */ .highlight .nl { color: #f8f8f2 } /* Name.Label */ .highlight .nn { color: #f8f8f2 } /* Name.Namespace */ .highlight .nx { color: #a6e22e } /* Name.Other */ .highlight .py { color: #f8f8f2 } /* Name.Property */ .highlight .nt { color: #f92672 } /* Name.Tag */ .highlight .nv { color: #f8f8f2 } /* Name.Variable */ .highlight .ow { color: #f92672 } /* Operator.Word */ .highlight .w { color: #f8f8f2 } /* Text.Whitespace */ .highlight .mb { color: #ae81ff } /* Literal.Number.Bin */ .highlight .mf { color: #ae81ff } /* Literal.Number.Float */ .highlight .mh { color: #ae81ff } /* Literal.Number.Hex */ .highlight .mi { color: #ae81ff } /* Literal.Number.Integer */ .highlight .mo { color: #ae81ff } /* Literal.Number.Oct */ .highlight .sa { color: #e6db74 } /* Literal.String.Affix */ .highlight .sb { color: #e6db74 } /* Literal.String.Backtick */ .highlight .sc { color: #e6db74 } /* Literal.String.Char */ .highlight .dl { color: #e6db74 } /* Literal.String.Delimiter */ .highlight .sd { color: #e6db74 } /* Literal.String.Doc */ .highlight .s2 { color: #e6db74 } /* Literal.String.Double */ .highlight .se { color: #ae81ff } /* Literal.String.Escape */ .highlight .sh { color: #e6db74 } /* Literal.String.Heredoc */ .highlight .si { color: #e6db74 } /* Literal.String.Interpol */ .highlight .sx { color: #e6db74 } /* Literal.String.Other */ .highlight .sr { color: #e6db74 } /* Literal.String.Regex */ .highlight .s1 { color: #e6db74 } /* Literal.String.Single */ .highlight .ss { color: #e6db74 } /* Literal.String.Symbol */ .highlight .bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #a6e22e } /* Name.Function.Magic */ .highlight .vc { color: #f8f8f2 } /* Name.Variable.Class */ .highlight .vg { color: #f8f8f2 } /* Name.Variable.Global */ .highlight .vi { color: #f8f8f2 } /* Name.Variable.Instance */ .highlight .vm { color: #f8f8f2 } /* Name.Variable.Magic */ .highlight .il { color: #ae81ff } /* Literal.Number.Integer.Long */ } @media (prefers-color-scheme: light) { .highlight .hll { background-color: #ffffcc } .highlight .c { color: #888888 } /* Comment */ .highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ .highlight .k { color: #008800; font-weight: bold } /* Keyword */ .highlight .ch { color: #888888 } /* Comment.Hashbang */ .highlight .cm { color: #888888 } /* Comment.Multiline */ .highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ .highlight .cpf { color: #888888 } /* Comment.PreprocFile */ .highlight .c1 { color: #888888 } /* Comment.Single */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
#!/usr/bin/env python
#
# Author: Jose Lausuch (jose.lausuch@ericsson.com)
#
# Installs the Functest framework within the Docker container
# and run the tests automatically
#
#
# 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 argparse
import os
import re
import subprocess
import sys
import yaml

import functest.utils.functest_logger as ft_logger
import functest.utils.functest_utils as ft_utils
import functest.utils.generate_defaults as gen_def
import functest.utils.openstack_utils as os_utils


""" arguments """
actions = ['start', 'check']
parser = argparse.ArgumentParser()
parser.add_argument("action", help="Possible actions are: "
                    "'{d[0]}|{d[1]}' ".format(d=actions))
parser.add_argument("-d", "--debug", help="Debug mode", action="store_true")
args = parser.parse_args()


""" logging configuration """
logger = ft_logger.Logger("prepare_env").getLogger()


""" global variables """
INSTALLERS = [&#
19-0/+602
2015-08-22Merge "Neutron-related role in the compass-adapter should use the same templa...Justin chi28-3415/+14
2015-08-22Merge "Modify the compass deployment time-out Period"Justin chi3-3/+3
2015-08-18Merge "Generate ppa repositories automatically"Chigang(Justin)8-11/+8792
2015-08-18Generate ppa repositories automaticallyChigang(Justin)8-11/+8792
2015-08-17Neutron-related role in the compass-adapter should use the same template filebaigk28-3416/+15
2015-08-15Modify the compass deployment time-out Periodm001331423-3/+3
2015-08-13Merge "Add deploy scripts for compass"Justin chi20-0/+932
2015-08-13Add deploy scripts for compasscarey.xu20-0/+932
2015-08-11Merge "Provide a script for building compass install all-in-one ISO."Justin chi2-0/+320
2015-08-09support deployment openstack juno with ansible for compass in centos7.1baigk87-364/+686
2015-08-06Provide a script for building compass install all-in-one ISO.carey.xu2-0/+320
2015-08-06Merge "support deployment openstack juno with ansible for compass in ubuntu 1...Justin chi139-0/+10729
'INSTALLER_IP' is not defined. " "It is needed to fetch the OpenStack credentials. " "If the credentials are not provided to the " "container as a volume, please add this env variable " "to the 'docker run' command.") else: logger.info(" INSTALLER_IP=%s" % CI_INSTALLER_IP) if CI_SCENARIO is None: logger.warning("The env variable 'DEPLOY_SCENARIO' is not defined. " "Setting CE_SCENARIO=undefined.") CI_SCENARIO = "undefined" else: logger.info(" DEPLOY_SCENARIO=%s" % CI_SCENARIO) if CI_DEBUG: logger.info(" CI_DEBUG=%s" % CI_DEBUG) if CI_NODE: logger.info(" NODE_NAME=%s" % CI_NODE) if CI_BUILD_TAG: logger.info(" BUILD_TAG=%s" % CI_BUILD_TAG) def create_directories(): print_separator() logger.info("Creating needed directories...") if not os.path.exists(FUNCTEST_CONF_DIR): os.makedirs(FUNCTEST_CONF_DIR) logger.info(" %s created." % FUNCTEST_CONF_DIR) else: logger.debug(" %s already exists." % FUNCTEST_CONF_DIR) if not os.path.exists(FUNCTEST_DATA_DIR): os.makedirs(FUNCTEST_DATA_DIR) logger.info(" %s created." % FUNCTEST_DATA_DIR) else: logger.debug(" %s already exists." % FUNCTEST_DATA_DIR) ODL_RESULTS_DIR = FUNCTEST_RESULTS_DIR + "/ODL/" if not os.path.exists(ODL_RESULTS_DIR): os.makedirs(ODL_RESULTS_DIR) logger.info(" %s created." % ODL_RESULTS_DIR) else: logger.debug(" %s already exists." % ODL_RESULTS_DIR) def source_rc_file(): print_separator() logger.info("Fetching RC file...") rc_file = os.getenv('creds') if rc_file is None: logger.warning("The environment variable 'creds' must be set and" "pointing to the local RC file. Using default: " "/home/opnfv/functest/conf/openstack.creds ...") rc_file = "/home/opnfv/functest/conf/openstack.creds" if not os.path.isfile(rc_file): logger.info("RC file not provided. " "Fetching it from the installer...") if CI_INSTALLER_IP is None: logger.error("The env variable CI_INSTALLER_IP must be provided in" " order to fetch the credentials from the installer.") sys.exit("Missing CI_INSTALLER_IP.") if CI_INSTALLER_TYPE not in INSTALLERS: logger.error("Cannot fetch credentials. INSTALLER_TYPE=%s is " "not a valid OPNFV installer. Available " "installers are : %s." % INSTALLERS) sys.exit("Wrong INSTALLER_TYPE.") cmd = ("/home/opnfv/repos/releng/utils/fetch_os_creds.sh " "-d %s -i %s -a %s" % (rc_file, CI_INSTALLER_TYPE, CI_INSTALLER_IP)) logger.debug("Executing command: %s" % cmd) p = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE) output = p.communicate()[0] logger.debug("\n%s" % output) if p.returncode != 0: logger.error("Failed to fetch credentials from installer.") sys.exit(1) else: logger.info("RC file provided in %s." % rc_file) if os.path.getsize(rc_file) == 0: logger.error("The file %s is empty." % rc_file) sys.exit(1) logger.info("Sourcing the OpenStack RC file...") creds = os_utils.source_credentials(rc_file) str = "" for key, value in creds.iteritems(): if re.search("OS_", key): str += "\n\t\t\t\t\t\t " + key + "=" + value logger.debug("Used credentials: %s" % str) def verify_deployment(): print_separator() logger.info("Verifying OpenStack services...") cmd = ("%s/ci/check_os.sh" % FUNCTEST_REPO) logger.debug("Executing command: %s" % cmd) p = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True) while p.poll() is None: line = p.stdout.readline().rstrip() if "ERROR" in line: logger.error(line) sys.exit("Problem while running 'check_os.sh'.") logger.info(line) def install_rally(): print_separator() logger.info("Creating Rally environment...") cmd = "rally deployment destroy opnfv-rally" ft_utils.execute_command(cmd, logger=logger, exit_on_error=False, error_msg=("Deployment %s does not exist." % DEPLOYMENT_MAME), verbose=False) cmd = "rally deployment create --fromenv --name=" + DEPLOYMENT_MAME ft_utils.execute_command(cmd, logger, error_msg="Problem creating Rally deployment") logger.info("Installing tempest from existing repo...") cmd = ("rally verify install --source " + TEMPEST_REPO_DIR + " --system-wide") ft_utils.execute_command(cmd, logger, error_msg="Problem installing Tempest.") cmd = "rally deployment check" ft_utils.execute_command(cmd, logger, error_msg=("OpenStack not responding or " "faulty Rally deployment.")) cmd = "rally show images" ft_utils.execute_command(cmd, logger, error_msg=("Problem while listing " "OpenStack images.")) cmd = "rally show flavors" ft_utils.execute_command(cmd, logger, error_msg=("Problem while showing " "OpenStack flavors.")) def generate_os_defaults(): print_separator() logger.info("Generating OpenStack defaults...") gen_def.main() def check_environment(): msg_not_active = "The Functest environment is not installed." if not os.path.isfile(ENV_FILE): logger.error(msg_not_active) sys.exit(1) with open(ENV_FILE, "r") as env_file: s = env_file.read() if not re.search("1", s): logger.error(msg_not_active) sys.exit(1) logger.info("Functest environment installed.") def main(): if not (args.action in actions): logger.error('Argument not valid.') sys.exit() if args.action == "start": logger.info("######### Preparing Functest environment #########\n") check_env_variables() create_directories() source_rc_file() verify_deployment() install_rally() generate_os_defaults() with open(ENV_FILE, "w") as env_file: env_file.write("1") check_environment() if args.action == "check": check_environment() exit(0) if __name__ == '__main__': main()