diff options
-rw-r--r-- | INFO | 1 | ||||
-rw-r--r-- | docker/Dockerfile | 14 | ||||
-rw-r--r-- | dovetail/conf/functest_config.yml | 2 | ||||
-rw-r--r-- | dovetail/conf/yardstick_config.yml | 2 | ||||
-rw-r--r-- | dovetail/container.py | 2 | ||||
-rwxr-xr-x | dovetail/run.py | 8 | ||||
-rw-r--r-- | dovetail/userconfig/hosts.yaml (renamed from userconfig/hosts.yaml) | 0 | ||||
-rw-r--r-- | dovetail/userconfig/pod.yaml.sample (renamed from userconfig/pod.yaml.sample) | 0 | ||||
-rw-r--r-- | dovetail/userconfig/sdnvpn_config_testcase1.yaml (renamed from userconfig/sdnvpn_config_testcase1.yaml) | 0 | ||||
-rw-r--r-- | dovetail/userconfig/sdnvpn_config_testcase2.yaml (renamed from userconfig/sdnvpn_config_testcase2.yaml) | 0 | ||||
-rw-r--r-- | dovetail/userconfig/sdnvpn_config_testcase3.yaml (renamed from userconfig/sdnvpn_config_testcase3.yaml) | 0 | ||||
-rw-r--r-- | dovetail/userconfig/sdnvpn_config_testcase4.yaml (renamed from userconfig/sdnvpn_config_testcase4.yaml) | 0 | ||||
-rw-r--r-- | dovetail/userconfig/sdnvpn_config_testcase8.yaml (renamed from userconfig/sdnvpn_config_testcase8.yaml) | 0 | ||||
-rw-r--r-- | dovetail/utils/dovetail_utils.py | 59 |
14 files changed, 43 insertions, 45 deletions
@@ -11,7 +11,6 @@ IRC: Server:freenode.net Channel:#opnfv-meeting Repository: dovetail Committers: -christopher.price@ericsson.com wenjing.chu@huawei.com hongbo.tianhongbo@huawei.com dneary@redhat.com diff --git a/docker/Dockerfile b/docker/Dockerfile index a700a313..fbe48495 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -2,6 +2,8 @@ FROM ubuntu:14.04 MAINTAINER Leo Wang <grakiss.wanglei@huawei.com> LABEL version="0.1" description="OPNFV Dovetail Docker Container" +ARG BRANCH=master + RUN \ apt-get update \ && \ @@ -25,17 +27,13 @@ ENV REPOS_DIR ${HOME}/dovetail WORKDIR /home/opnfv RUN \ - git config --global http.sslVerify false \ -&& \ - git clone https://git.opnfv.org/dovetail ${REPOS_DIR} \ + mkdir -p ${REPOS_DIR} \ && \ - pip install -U pip \ -&& \ - pip install -r ${REPOS_DIR}/requirements.txt \ + git config --global http.sslVerify false \ && \ - cd ${REPOS_DIR} \ + pip install git+https://git.opnfv.org/dovetail@$BRANCH#egg=dovetail \ && \ - pip install -e . + ln -s /usr/local/lib/python2.7/dist-packages/dovetail ${REPOS_DIR}/dovetail WORKDIR ${REPOS_DIR}/dovetail diff --git a/dovetail/conf/functest_config.yml b/dovetail/conf/functest_config.yml index 460506a6..05eaa909 100644 --- a/dovetail/conf/functest_config.yml +++ b/dovetail/conf/functest_config.yml @@ -1,7 +1,7 @@ --- functest: image_name: opnfv/functest - docker_tag: latest + docker_tag: danube.2.0 opts: '-id --privileged=true' config: dir: '/home/opnfv/userconfig' diff --git a/dovetail/conf/yardstick_config.yml b/dovetail/conf/yardstick_config.yml index 9f56cb11..34d5a0d8 100644 --- a/dovetail/conf/yardstick_config.yml +++ b/dovetail/conf/yardstick_config.yml @@ -1,7 +1,7 @@ --- yardstick: image_name: opnfv/yardstick - docker_tag: latest + docker_tag: danube.2.0 opts: '-id --privileged=true' config: dir: '/home/opnfv/userconfig' diff --git a/dovetail/container.py b/dovetail/container.py index dd73096d..a1e213d8 100644 --- a/dovetail/container.py +++ b/dovetail/container.py @@ -158,7 +158,7 @@ class Container(object): hosts_config = "" hosts_config_path = os.path.abspath( - os.path.join(os.path.dirname(__file__), os.pardir, 'userconfig')) + os.path.join(os.path.dirname(__file__), 'userconfig')) try: with open(os.path.join(hosts_config_path, 'hosts.yaml')) as f: hosts_info = yaml.safe_load(f) diff --git a/dovetail/run.py b/dovetail/run.py index c56b343c..a8fa6470 100755 --- a/dovetail/run.py +++ b/dovetail/run.py @@ -95,10 +95,10 @@ def check_tc_result(testcase, logger): return if os.path.isfile(result_file): logger.info("Results have been stored with file %s.", result_file) - result = Report.get_result(testcase) - Report.check_result(testcase, result) else: logger.error("Fail to store results with file %s.", result_file) + result = Report.get_result(testcase) + Report.check_result(testcase, result) def validate_input(input_dict, check_dict, logger): @@ -173,7 +173,7 @@ def clean_results_dir(): if os.path.exists(result_path): if os.path.isdir(result_path): cmd = 'sudo rm -rf %s/*' % (result_path) - dt_utils.exec_cmd(cmd, exit_on_error=False) + dt_utils.exec_cmd(cmd, exit_on_error=False, exec_msg_on=False) else: print "result_dir in dovetail_config.yml is not a directory." raise SystemExit(1) @@ -195,7 +195,7 @@ def get_result_path(): def copy_userconfig_files(logger): - dovetail_home = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + dovetail_home = os.path.dirname(os.path.abspath(__file__)) userconfig_path = os.path.join(dovetail_home, 'userconfig') pre_config_path = dt_cfg.dovetail_config['config_dir'] if not os.path.isdir(pre_config_path): diff --git a/userconfig/hosts.yaml b/dovetail/userconfig/hosts.yaml index e4687dfb..e4687dfb 100644 --- a/userconfig/hosts.yaml +++ b/dovetail/userconfig/hosts.yaml diff --git a/userconfig/pod.yaml.sample b/dovetail/userconfig/pod.yaml.sample index 26636a6b..26636a6b 100644 --- a/userconfig/pod.yaml.sample +++ b/dovetail/userconfig/pod.yaml.sample diff --git a/userconfig/sdnvpn_config_testcase1.yaml b/dovetail/userconfig/sdnvpn_config_testcase1.yaml index d9e4a1b4..d9e4a1b4 100644 --- a/userconfig/sdnvpn_config_testcase1.yaml +++ b/dovetail/userconfig/sdnvpn_config_testcase1.yaml diff --git a/userconfig/sdnvpn_config_testcase2.yaml b/dovetail/userconfig/sdnvpn_config_testcase2.yaml index 07b0adfa..07b0adfa 100644 --- a/userconfig/sdnvpn_config_testcase2.yaml +++ b/dovetail/userconfig/sdnvpn_config_testcase2.yaml diff --git a/userconfig/sdnvpn_config_testcase3.yaml b/dovetail/userconfig/sdnvpn_config_testcase3.yaml index 60592cbb..60592cbb 100644 --- a/userconfig/sdnvpn_config_testcase3.yaml +++ b/dovetail/userconfig/sdnvpn_config_testcase3.yaml diff --git a/userconfig/sdnvpn_config_testcase4.yaml b/dovetail/userconfig/sdnvpn_config_testcase4.yaml index 1e221354..1e221354 100644 --- a/userconfig/sdnvpn_config_testcase4.yaml +++ b/dovetail/userconfig/sdnvpn_config_testcase4.yaml diff --git a/userconfig/sdnvpn_config_testcase8.yaml b/dovetail/userconfig/sdnvpn_config_testcase8.yaml index c825997b..c825997b 100644 --- a/userconfig/sdnvpn_config_testcase8.yaml +++ b/dovetail/userconfig/sdnvpn_config_testcase8.yaml diff --git a/dovetail/utils/dovetail_utils.py b/dovetail/utils/dovetail_utils.py index e6a775f1..e4284ad4 100644 --- a/dovetail/utils/dovetail_utils.py +++ b/dovetail/utils/dovetail_utils.py @@ -111,21 +111,29 @@ def source_env(env_file): with open(env_file, 'r') as f: lines = f.readlines() for line in lines: - for match in re.findall(r"export (.*)=(.*)", line): - match = (match[0].strip('\"'), match[1].strip('\"')) - match = (match[0].strip('\''), match[1].strip('\'')) - os.environ.update({match[0]: match[1]}) + if line.lstrip().startswith('export'): + for match in re.findall(r"export (.*)=(.*)", line): + match = (match[0].strip('\"'), match[1].strip('\"')) + match = (match[0].strip('\''), match[1].strip('\'')) + os.environ.update({match[0]: match[1]}) def get_ext_net_name(env_file, logger=None): - source_env(env_file) - cmd_check = "openstack network list" + insecure_option = '' + insecure = os.getenv('OS_INSECURE',) + if insecure == "true" or insecure == "True": + insecure_option = ' --insecure ' + else: + print "Warn: env variable OS_INSECUE is %s, if https+no credential \ + used, it should be set as true" % insecure + + cmd_check = "openstack %s network list" % insecure_option ret, msg = exec_cmd(cmd_check, logger) if ret: logger.error("The credentials info in %s is invalid." % env_file) return None - cmd = "openstack network list --long | grep 'External' | head -1 | \ - awk '{print $4}'" + cmd = "openstack %s network list --long | grep 'External' | head -1 | \ + awk '{print $4}'" % insecure_option ret, msg = exec_cmd(cmd, logger) if not ret: return msg @@ -171,24 +179,17 @@ def show_progress_bar(length): def check_docker_version(logger=None): - ret, server_ver = exec_cmd("sudo docker version -f'{{.Server.Version}}'", - logger=logger) - ret, client_ver = exec_cmd("sudo docker version -f'{{.Client.Version}}'", - logger=logger) - logger.info("\ndocker version: \nclient:%s\nserver:%s", client_ver, - server_ver) - if(LooseVersion(client_ver) <= LooseVersion('1.8.0') or - LooseVersion(server_ver) <= LooseVersion('1.8.0')): - logger.warn("\n\nDocker version is too old, may cause unpredictable " - "errors, you can update or install the lastest docker " - "for both host and container as below:\nwget -qO- " - "https://get.docker.com/ | sh\n\nClient:%s\nServer:%s", - client_ver, server_ver) - exit(-1) - - if(client_ver != server_ver): - logger.warn("\n\nVersion mismatch, may cause unpredictable " - "errors, you can update or install the lastest " - "docker for both host and container as below:\nwget " - "-qO- https://get.docker.com/ | " - "sh\n\nClient:%s\nServer:%s", client_ver, server_ver) + server_ret, server_ver = \ + exec_cmd("sudo docker version -f'{{.Server.Version}}'", logger=logger) + client_ret, client_ver = \ + exec_cmd("sudo docker version -f'{{.Client.Version}}'", logger=logger) + if server_ret == 0: + logger.debug("docker server version: %s", server_ver) + if server_ret != 0 or (LooseVersion(server_ver) < LooseVersion('1.12.3')): + logger.error("Don't support this Docker server version. " + "Docker server should be updated to at least 1.12.3.") + if client_ret == 0: + logger.debug("docker client version: %s", client_ver) + if client_ret != 0 or (LooseVersion(client_ver) < LooseVersion('1.12.3')): + logger.error("Don't support this Docker client version. " + "Docker client should be updated to at least 1.12.3.") |