summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docker/Dockerfile3
-rwxr-xr-xdocker/common.sh1
-rwxr-xr-xdocker/prepare_env.sh4
-rwxr-xr-xtestcases/VIM/OpenStack/CI/libraries/run_rally-cert.py14
-rwxr-xr-xtestcases/config_functest.py1
-rw-r--r--testcases/config_functest.yaml2
-rw-r--r--testcases/functest_utils.py24
-rw-r--r--testcases/vIMS/CI/orchestrator.py8
-rw-r--r--testcases/vIMS/CI/vIMS.py13
9 files changed, 49 insertions, 21 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile
index a39775c81..4a2d87bf6 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -57,7 +57,7 @@ RUN mkdir -p /root/.ssh
RUN chmod 700 /root/.ssh
RUN git config --global http.sslVerify false
-RUN git clone https://gerrit.opnfv.org/gerrit/functest ${repos_dir}/functest
+RUN git clone -b stable/brahmaputra https://gerrit.opnfv.org/gerrit/functest ${repos_dir}/functest
RUN git clone https://gerrit.opnfv.org/gerrit/releng ${repos_dir}/releng
RUN git clone https://gerrit.opnfv.org/gerrit/doctor ${repos_dir}/doctor
RUN git clone https://github.com/openstack/rally.git ${repos_dir}/rally
@@ -75,4 +75,3 @@ ADD http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img /home/op
RUN gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
RUN curl -L https://get.rvm.io | bash -s stable
RUN bash -c 'source /etc/profile.d/rvm.sh ; rvm autolibs enable ; rvm install 1.9.3 ; rvm use 1.9.3'
-RUN bash -c 'source /etc/profile.d/rvm.sh ; cd ${repos_dir}/vims-test;rvm use system;bundle install'
diff --git a/docker/common.sh b/docker/common.sh
index eccdc252a..f21263c7e 100755
--- a/docker/common.sh
+++ b/docker/common.sh
@@ -20,6 +20,7 @@
#
# If it is not provided, take the existing one in the functest repo
#
+mkdir -p /home/opnfv/functest/conf
config_file=/home/opnfv/functest/conf/config_functest.yaml
if [ ! -f ${config_file} ]; then
default_config_file=$(find /home/opnfv/repos -name config_functest.yaml)
diff --git a/docker/prepare_env.sh b/docker/prepare_env.sh
index cf407499f..ec14391c0 100755
--- a/docker/prepare_env.sh
+++ b/docker/prepare_env.sh
@@ -82,10 +82,6 @@ if [ $offline == false ]; then
# Update repos
info "Updating Functest repository...."
cd ${FUNCTEST_REPO_DIR}
- if [ ${FUNCTEST_BRANCH} != "master" ]; then
- info "Functest repo: checkout ${FUNCTEST_BRANCH} branch..."
- git checkout ${FUNCTEST_BRANCH}
- fi
info "Functest repo: pulling to latest..."
git pull
if [ ${FUNCTEST_COMMIT} != "latest" ]; then
diff --git a/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py b/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py
index 082c0cf41..a52e7f08a 100755
--- a/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py
+++ b/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py
@@ -31,7 +31,6 @@ from neutronclient.v2_0 import client as neutronclient
tests = ['authenticate', 'glance', 'cinder', 'heat', 'keystone',
'neutron', 'nova', 'quotas', 'requests', 'vm', 'all']
parser = argparse.ArgumentParser()
-parser.add_argument("repo_path", help="Path to the repository")
parser.add_argument("test_name",
help="Module name to be tested. "
"Possible values are : "
@@ -54,9 +53,6 @@ args = parser.parse_args()
client_dict = {}
-sys.path.append(args.repo_path + "testcases/")
-import functest_utils
-
""" logging configuration """
logger = logging.getLogger("run_rally")
logger.setLevel(logging.DEBUG)
@@ -72,12 +68,18 @@ formatter = logging.Formatter("%(asctime)s - %(name)s - "
ch.setFormatter(formatter)
logger.addHandler(ch)
+REPO_PATH=os.environ['repos_dir']+'/functest/'
+if not os.path.exists(REPO_PATH):
+ logger.error("Functest repository directory not found '%s'" % REPO_PATH)
+ exit(-1)
+sys.path.append(REPO_PATH + "testcases/")
+import functest_utils
+
with open("/home/opnfv/functest/conf/config_functest.yaml") as f:
functest_yaml = yaml.safe_load(f)
f.close()
HOME = os.environ['HOME']+"/"
-REPO_PATH = args.repo_path
####todo:
#SCENARIOS_DIR = REPO_PATH + functest_yaml.get("general"). \
# get("directories").get("dir_rally_scn")
@@ -115,7 +117,7 @@ def push_results_to_db(payload):
url = TEST_DB + "/results"
installer = functest_utils.get_installer_type(logger)
- git_version = functest_utils.get_git_branch(args.repo_path)
+ git_version = functest_utils.get_git_branch(REPO_PATH)
pod_name = functest_utils.get_pod_name(logger)
# TODO pod_name hardcoded, info shall come from Jenkins
params = {"project_name": "functest", "case_name": "Rally",
diff --git a/testcases/config_functest.py b/testcases/config_functest.py
index 8ae0d1639..d392d5575 100755
--- a/testcases/config_functest.py
+++ b/testcases/config_functest.py
@@ -118,6 +118,7 @@ def action_start():
# Install ruby libraries for vims test-case
script = 'source /etc/profile.d/rvm.sh; '
script += 'cd ' + VIMS_TEST_DIR + '; '
+ script += 'rvm use system;'
script += 'bundle install'
cmd = "/bin/bash -c '" + script + "'"
diff --git a/testcases/config_functest.yaml b/testcases/config_functest.yaml
index bca4f9dcd..5c457612d 100644
--- a/testcases/config_functest.yaml
+++ b/testcases/config_functest.yaml
@@ -27,7 +27,7 @@ general:
repositories:
# branch and commit ID to which the repos will be reset (HEAD)
- functest_branch: master
+ functest_branch: stable/brahmaputra
functest_commit: latest
releng_branch: master
releng_commit: latest
diff --git a/testcases/functest_utils.py b/testcases/functest_utils.py
index 6c0c49832..401078b70 100644
--- a/testcases/functest_utils.py
+++ b/testcases/functest_utils.py
@@ -17,6 +17,7 @@ import sys
import requests
import json
import shutil
+import re
from git import Repo
@@ -166,7 +167,7 @@ def delete_neutron_net(neutron_client, network_id):
def create_neutron_subnet(neutron_client, name, cidr, net_id):
json_body = {'subnets': [{'name': name, 'cidr': cidr,
- 'ip_version': 4, 'network_id': net_id}]}
+ 'ip_version': 4, 'network_id': net_id}]}
try:
subnet = neutron_client.create_subnet(body=json_body)
return subnet['subnets'][0]['id']
@@ -382,7 +383,7 @@ def get_image_id(glance_client, image_name):
def create_glance_image(glance_client, image_name, file_path, public=True):
if not os.path.isfile(file_path):
- print "Error: file "+file_path+" does not exist."
+ print "Error: file " + file_path + " does not exist."
return False
try:
with open(file_path) as fimage:
@@ -414,6 +415,7 @@ def get_volumes(cinder_client):
except:
return None
+
def delete_volume(cinder_client, volume_id, forced=False):
try:
if forced:
@@ -433,7 +435,8 @@ def delete_volume(cinder_client, volume_id, forced=False):
# ################ CINDER #################
def get_security_groups(neutron_client):
try:
- security_groups = neutron_client.list_security_groups()['security_groups']
+ security_groups = neutron_client.list_security_groups()[
+ 'security_groups']
return security_groups
except:
return None
@@ -626,7 +629,8 @@ def get_pod_name(logger=None):
return os.environ['NODE_NAME']
except KeyError:
if logger:
- logger.error("Unable to retrieve the POD name from environment.Using pod name 'unknown-pod'")
+ logger.error(
+ "Unable to retrieve the POD name from environment.Using pod name 'unknown-pod'")
return "unknown-pod"
@@ -684,6 +688,18 @@ def get_ci_envvars():
return ci_env_var
+def get_resolvconf_ns():
+ nameservers = []
+ rconf = open("/etc/resolv.conf", "r")
+ line = rconf.readline()
+ while line:
+ ip = re.search(r"\b(?:[0-9]{1,3}\.){3}[0-9]{1,3}\b", line)
+ if ip:
+ nameservers.append(ip.group())
+ line = rconf.readline()
+ return nameservers
+
+
def isTestRunnable(test, functest_yaml):
# check getTestEnv(test) and CI env var
# check installer, controller and options
diff --git a/testcases/vIMS/CI/orchestrator.py b/testcases/vIMS/CI/orchestrator.py
index ab0b448fa..382fbd139 100644
--- a/testcases/vIMS/CI/orchestrator.py
+++ b/testcases/vIMS/CI/orchestrator.py
@@ -47,6 +47,12 @@ class orchestrator:
def set_ssh_user(self, ssh_user):
self.config['ssh_user'] = ssh_user
+ def set_nameservers(self, nameservers):
+ if 0 < len(nameservers):
+ self.config['dns_subnet_1'] = nameservers[0]
+ if 1 < len(nameservers):
+ self.config['dns_subnet_2'] = nameservers[1]
+
def set_logger(self, logger):
self.logger = logger
@@ -91,7 +97,7 @@ class orchestrator:
if self.logger:
self.logger.info("Launching the cloudify-manager deployment")
- script = "set -e; "
+ script = "set -e; "
script += "source " + self.testcase_dir + "venv_cloudify/bin/activate; "
script += "cd " + self.testcase_dir + "; "
script += "cfy init -r; "
diff --git a/testcases/vIMS/CI/vIMS.py b/testcases/vIMS/CI/vIMS.py
index 74cce9793..7a2d1979a 100644
--- a/testcases/vIMS/CI/vIMS.py
+++ b/testcases/vIMS/CI/vIMS.py
@@ -138,10 +138,13 @@ def test_clearwater():
logger.info("vIMS functional test Start Time:'%s'" % (
datetime.datetime.fromtimestamp(start_time_ts).strftime(
'%Y-%m-%d %H:%M:%S')))
+ nameservers = functest_utils.get_resolvconf_ns()
+ resolvconf = ""
+ for ns in nameservers:
+ resolvconf += "\nnameserver " + ns
if dns_ip != "":
- script = 'echo -e "nameserver ' + dns_ip + \
- '\nnameserver 8.8.8.8\nnameserver 8.8.4.4" > /etc/resolv.conf; '
+ script = 'echo -e "nameserver ' + dns_ip + resolvconf + '" > /etc/resolv.conf; '
script += 'source /etc/profile.d/rvm.sh; '
script += 'cd ' + VIMS_TEST_DIR + '; '
script += 'rake test[' + \
@@ -176,7 +179,7 @@ def test_clearwater():
logger.debug("Pushing results to DB....")
git_version = functest_utils.get_git_branch(REPO_PATH)
functest_utils.push_results_to_db(db_url=TEST_DB, case_name="vIMS",
- logger=logger, pod_name="opnfv-jump-2", git_version=git_version,
+ logger=logger, pod_name=functest_utils.get_pod_name(logger), git_version=git_version,
payload={'orchestrator': {'duration': CFY_DEPLOYMENT_DURATION,
'result': ""},
'vIMS': {'duration': CW_DEPLOYMENT_DURATION,
@@ -343,6 +346,10 @@ def main():
cfy.set_external_network_name(ext_net)
+ ns = functest_utils.get_resolvconf_ns()
+ if ns:
+ cfy.set_nameservers(ns)
+
logger.info("Prepare virtualenv for cloudify-cli")
cmd = "chmod +x " + VIMS_DIR + "create_venv.sh"
functest_utils.execute_command(cmd, logger)