aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ci/config_functest.yaml2
-rwxr-xr-xci/exec_test.sh5
-rw-r--r--ci/testcases.yaml2
-rw-r--r--ci/tier_handler.py10
-rwxr-xr-xtestcases/OpenStack/tempest/run_tempest.py11
-rwxr-xr-xtestcases/features/doctor.py3
-rwxr-xr-xtestcases/features/sfc/compute_presetup_CI.bash21
-rwxr-xr-xtestcases/features/sfc/correct_classifier.bash37
-rwxr-xr-xtestcases/features/sfc/sfc.py59
-rw-r--r--testcases/vnf/RNC/parser.py27
-rw-r--r--utils/functest_utils.py21
11 files changed, 150 insertions, 48 deletions
diff --git a/ci/config_functest.yaml b/ci/config_functest.yaml
index e4468208e..fb4103d34 100644
--- a/ci/config_functest.yaml
+++ b/ci/config_functest.yaml
@@ -74,6 +74,8 @@ tempest:
tenant_description: Tenant for Tempest test suite
user_name: tempest
user_password: tempest
+ validation:
+ ssh_timeout: 130
private_net_name: tempest-net
private_subnet_name: tempest-subnet
private_subnet_cidr: 192.168.150.0/24
diff --git a/ci/exec_test.sh b/ci/exec_test.sh
index 2ef714d56..ddbe486f1 100755
--- a/ci/exec_test.sh
+++ b/ci/exec_test.sh
@@ -163,6 +163,11 @@ function run_test(){
if [ $ret_val != 0 ]; then
exit $ret_val
fi
+ bash ${FUNCTEST_REPO_DIR}/testcases/features/sfc/compute_presetup_CI.bash
+ ret_val=$?
+ if [ $ret_val != 0 ]; then
+ exit $ret_val
+ fi
source ${FUNCTEST_REPO_DIR}/testcases/features/sfc/tackerc
python ${FUNCTEST_REPO_DIR}/testcases/features/sfc/sfc.py
;;
diff --git a/ci/testcases.yaml b/ci/testcases.yaml
index cef79c692..47d544b96 100644
--- a/ci/testcases.yaml
+++ b/ci/testcases.yaml
@@ -257,7 +257,7 @@ tiers:
scenario: '(ocl)|(nosdn)|^(os-odl)((?!bgpvpn).)*$'
-
name: parser
- criteria: 'status == "PASS"'
+ criteria: 'ret == 0'
blocking: false
description: >-
Test suite from Parser project.
diff --git a/ci/tier_handler.py b/ci/tier_handler.py
index e50fbe6fd..1eadfba50 100644
--- a/ci/tier_handler.py
+++ b/ci/tier_handler.py
@@ -111,17 +111,21 @@ class TestCase:
self.criteria = criteria
self.blocking = blocking
+ @staticmethod
+ def is_none(item):
+ return item is None or item is ""
+
def is_compatible(self, ci_installer, ci_scenario):
try:
- if ci_installer is not None:
+ if not self.is_none(ci_installer):
if re.search(self.dependency.get_installer(),
ci_installer) is None:
return False
- if ci_scenario is not None:
+ if not self.is_none(ci_scenario):
if re.search(self.dependency.get_scenario(),
ci_scenario) is None:
return False
- return not (ci_scenario is None and ci_installer is None)
+ return True
except TypeError:
return False
diff --git a/testcases/OpenStack/tempest/run_tempest.py b/testcases/OpenStack/tempest/run_tempest.py
index 53a70b799..d29b3f3bc 100755
--- a/testcases/OpenStack/tempest/run_tempest.py
+++ b/testcases/OpenStack/tempest/run_tempest.py
@@ -81,6 +81,8 @@ TENANT_DESCRIPTION = functest_yaml.get("tempest").get("identity").get(
USER_NAME = functest_yaml.get("tempest").get("identity").get("user_name")
USER_PASSWORD = functest_yaml.get("tempest").get("identity").get(
"user_password")
+SSH_TIMEOUT = functest_yaml.get("tempest").get("validation").get(
+ "ssh_timeout")
DEPLOYMENT_MAME = functest_yaml.get("rally").get("deployment_name")
RALLY_INSTALLATION_DIR = functest_yaml.get("general").get("directories").get(
"dir_rally_inst")
@@ -176,12 +178,16 @@ def configure_tempest(deployment_dir):
Add/update needed parameters into tempest.conf file generated by Rally
"""
- logger.debug("Generating tempest.conf file...")
+ tempest_conf_file = deployment_dir + "/tempest.conf"
+ if os.path.isfile(tempest_conf_file):
+ logger.debug("Deleting old tempest.conf file...")
+ os.remove(tempest_conf_file)
+
+ logger.debug("Generating new tempest.conf file...")
cmd = "rally verify genconfig"
ft_utils.execute_command(cmd, logger)
logger.debug("Finding tempest.conf file...")
- tempest_conf_file = deployment_dir + "/tempest.conf"
if not os.path.isfile(tempest_conf_file):
logger.error("Tempest configuration file %s NOT found."
% tempest_conf_file)
@@ -194,6 +200,7 @@ def configure_tempest(deployment_dir):
config.set('identity', 'tenant_name', TENANT_NAME)
config.set('identity', 'username', USER_NAME)
config.set('identity', 'password', USER_PASSWORD)
+ config.set('validation', 'ssh_timeout', SSH_TIMEOUT)
if os.getenv('OS_ENDPOINT_TYPE') is not None:
services_list = ['compute', 'volume', 'image', 'network',
diff --git a/testcases/features/doctor.py b/testcases/features/doctor.py
index bdf3ddc35..184ab032b 100755
--- a/testcases/features/doctor.py
+++ b/testcases/features/doctor.py
@@ -37,7 +37,8 @@ def main():
cmd = 'cd %s/tests && ./run.sh' % DOCTOR_REPO
start_time = time.time()
- ret = functest_utils.execute_command(cmd, logger, exit_on_error=False)
+ ret = functest_utils.execute_command(cmd, logger, info=True,
+ exit_on_error=False)
stop_time = time.time()
duration = round(stop_time - start_time, 1)
diff --git a/testcases/features/sfc/compute_presetup_CI.bash b/testcases/features/sfc/compute_presetup_CI.bash
new file mode 100755
index 000000000..57d3d8278
--- /dev/null
+++ b/testcases/features/sfc/compute_presetup_CI.bash
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+# This script must be use with vxlan-gpe + nsh. Once we have eth + nsh support
+# in ODL, we will not need it anymore
+
+set -e
+ssh_options='-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
+BASEDIR=`dirname $0`
+INSTALLER_IP=${INSTALLER_IP:-10.20.0.2}
+
+pushd $BASEDIR
+ip=`sshpass -p r00tme ssh $ssh_options root@${INSTALLER_IP} 'fuel node'|grep compute|\
+awk '{print $10}' | head -1`
+
+echo $ip
+sshpass -p r00tme scp $ssh_options correct_classifier.bash ${INSTALLER_IP}:/root
+sshpass -p r00tme ssh $ssh_options root@${INSTALLER_IP} 'scp correct_classifier.bash '"$ip"':/root'
+
+sshpass -p r00tme ssh $ssh_options root@${INSTALLER_IP} 'ssh root@'"$ip"' ifconfig br-int up'
+sshpass -p r00tme ssh $ssh_options root@${INSTALLER_IP} 'ssh root@'"$ip"' ip route add 11.0.0.0/24 \
+dev br-int'
diff --git a/testcases/features/sfc/correct_classifier.bash b/testcases/features/sfc/correct_classifier.bash
new file mode 100755
index 000000000..ba34d7fe9
--- /dev/null
+++ b/testcases/features/sfc/correct_classifier.bash
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+#This scripts correct the current ODL bug which does not detect
+#when SFF and classifier are in the same swtich
+
+nsp=`ovs-ofctl -O Openflow13 dump-flows br-int table=11 | \
+grep "nsp=" | awk '{print $6}' | awk -F ',' '{print $2}' | \
+awk -F '=' '{print $2}'`
+
+ip=`ovs-ofctl -O Openflow13 dump-flows br-int table=11 | \
+grep NXM_NX_NSH_C1 | head -1 | cut -d':' -f5 | cut -d'-' -f1`
+
+output_port=`ovs-ofctl -O Openflow13 show br-int | \
+grep vxgpe | cut -d'(' -f1`
+
+output_port2=`echo $output_port`
+
+echo "This is the nsp =$(($nsp))"
+echo "This is the ip=$ip"
+echo "This is the vxlan-gpe port=$output_port2"
+
+ovs-ofctl -O Openflow13 del-flows br-int "table=11,tcp,reg0=0x1,tp_dst=80"
+ovs-ofctl -O Openflow13 del-flows br-int "table=11,tcp,reg0=0x1,tp_dst=22"
+
+ovs-ofctl -O Openflow13 add-flow br-int "table=11,tcp,reg0=0x1,tp_dst=80 \
+actions=move:NXM_NX_TUN_ID[0..31]->NXM_NX_NSH_C2[],push_nsh,\
+load:0x1->NXM_NX_NSH_MDTYPE[],load:0x3->NXM_NX_NSH_NP[],\
+load:$ip->NXM_NX_NSH_C1[],load:$nsp->NXM_NX_NSP[0..23],\
+load:0xff->NXM_NX_NSI[],load:$ip->NXM_NX_TUN_IPV4_DST[],\
+load:$nsp->NXM_NX_TUN_ID[0..31],resubmit($output_port,0)"
+
+ovs-ofctl -O Openflow13 add-flow br-int "table=11,tcp,reg0=0x1,tp_dst=22\
+ actions=move:NXM_NX_TUN_ID[0..31]->NXM_NX_NSH_C2[],push_nsh,\
+load:0x1->NXM_NX_NSH_MDTYPE[],load:0x3->NXM_NX_NSH_NP[],\
+load:$ip->NXM_NX_NSH_C1[],load:$nsp->NXM_NX_NSP[0..23],\
+load:0xff->NXM_NX_NSI[],load:$ip->NXM_NX_TUN_IPV4_DST[],\
+load:$nsp->NXM_NX_TUN_ID[0..31],resubmit($output_port,0)"
diff --git a/testcases/features/sfc/sfc.py b/testcases/features/sfc/sfc.py
index 511b5936b..c4d7fd785 100755
--- a/testcases/features/sfc/sfc.py
+++ b/testcases/features/sfc/sfc.py
@@ -59,16 +59,24 @@ def main():
ssh_options = '-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
contr_cmd = ("sshpass -p r00tme ssh " + ssh_options + " root@10.20.0.2"
" 'fuel node'|grep controller|awk '{print $10}'")
- logger.info("Executing tacker script: '%s'" % contr_cmd)
+ logger.info("Executing script to get ip_server: '%s'" % contr_cmd)
process = subprocess.Popen(contr_cmd,
shell=True,
stdout=subprocess.PIPE)
- ip = process.stdout.readline().rstrip()
+ ip_server = process.stdout.readline().rstrip()
+
+ contr_cmd2 = ("sshpass -p r00tme ssh " + ssh_options + " root@10.20.0.2"
+ " 'fuel node'|grep compute|awk '{print $10}'")
+ logger.info("Executing script to get ip_compute: '%s'" % contr_cmd2)
+ process = subprocess.Popen(contr_cmd2,
+ shell=True,
+ stdout=subprocess.PIPE)
+ ip_compute = process.stdout.readline().rstrip()
iptable_cmd1 = ("sshpass -p r00tme ssh " + ssh_options + " root@10.20.0.2"
- " ssh " + ip + " iptables -P INPUT ACCEPT ")
+ " ssh " + ip_server + " iptables -P INPUT ACCEPT ")
iptable_cmd2 = ("sshpass -p r00tme ssh " + ssh_options + " root@10.20.0.2"
- " ssh " + ip + " iptables -t nat -P INPUT ACCEPT ")
+ " ssh " + ip_server + " iptables -t nat -P INPUT ACCEPT ")
subprocess.call(iptable_cmd1, shell=True)
subprocess.call(iptable_cmd2, shell=True)
@@ -247,11 +255,14 @@ def main():
# timeout -= 1
try:
- (stdin, stdout, stderr) = ssh.exec_command("ps lax | grep python")
- if "vxlan_tool.py" in stdout.readlines()[0]:
- logger.debug("HTTP firewall started")
- else:
- logger.error("HTTP firewall not started")
+ while 1:
+ (stdin, stdout, stderr) = ssh.exec_command("ps lax | grep python")
+ if "vxlan_tool.py" in stdout.readlines()[0]:
+ logger.debug("HTTP firewall started")
+ break
+ else:
+ logger.debug("HTTP firewall not started")
+ time.sleep(3)
except:
logger.error("vxlan_tool not started in SF1")
@@ -268,21 +279,33 @@ def main():
# timeout -= 1
try:
- (stdin, stdout, stderr) = ssh.exec_command("ps lax | grep python")
- if "vxlan_tool.py" in stdout.readlines()[0]:
- logger.debug("SSH firewall started")
- else:
- logger.error("SSH firewall not started")
+ while 1:
+ (stdin, stdout, stderr) = ssh.exec_command("ps lax | grep python")
+ if "vxlan_tool.py" in stdout.readlines()[0]:
+ logger.debug("SSH firewall started")
+ break
+ else:
+ logger.debug("SSH firewall not started")
+ time.sleep(3)
except:
logger.error("vxlan_tool not started in SF2")
+ # SSH to modify the classification flows in compute
+
+ contr_cmd3 = ("sshpass -p r00tme ssh " + ssh_options + " root@10.20.0.2"
+ " 'ssh " + ip_compute + " 'bash correct_classifier.bash''")
+ logger.info("Executing script to modify the classi: '%s'" % contr_cmd3)
+ process = subprocess.Popen(contr_cmd3,
+ shell=True,
+ stdout=subprocess.PIPE)
+
# SSH TO EXECUTE cmd_client
logger.info("TEST STARTED")
try:
ssh.connect(floatip_client, username="root",
password="opnfv", timeout=2)
- command = "nc -w 5 -zv " + floatip_server + " 22 2>&1"
+ command = "nc -w 5 -zv " + instance_ip_2 + " 22 2>&1"
(stdin, stdout, stderr) = ssh.exec_command(command)
except:
logger.debug("Waiting for %s..." % floatip_client)
@@ -305,7 +328,7 @@ def main():
try:
ssh.connect(floatip_client, username="root",
password="opnfv", timeout=2)
- command = "nc -w 5 -zv " + floatip_server + " 80 2>&1"
+ command = "nc -w 5 -zv " + instance_ip_2 + " 80 2>&1"
(stdin, stdout, stderr) = ssh.exec_command(command)
except:
logger.debug("Waiting for %s..." % floatip_client)
@@ -332,7 +355,7 @@ def main():
try:
ssh.connect(floatip_client, username="root",
password="opnfv", timeout=2)
- command = "nc -w 5 -zv " + floatip_server + " 80 2>&1"
+ command = "nc -w 5 -zv " + instance_ip_2 + " 80 2>&1"
(stdin, stdout, stderr) = ssh.exec_command(command)
except:
logger.debug("Waiting for %s..." % floatip_client)
@@ -353,7 +376,7 @@ def main():
try:
ssh.connect(floatip_client, username="root",
password="opnfv", timeout=2)
- command = "nc -w 5 -zv " + floatip_server + " 22 2>&1"
+ command = "nc -w 5 -zv " + instance_ip_2 + " 22 2>&1"
(stdin, stdout, stderr) = ssh.exec_command(command)
except:
logger.debug("Waiting for %s..." % floatip_client)
diff --git a/testcases/vnf/RNC/parser.py b/testcases/vnf/RNC/parser.py
index 485af0e14..91d5bb06a 100644
--- a/testcases/vnf/RNC/parser.py
+++ b/testcases/vnf/RNC/parser.py
@@ -32,33 +32,18 @@ logger = ft_logger.Logger("parser").getLogger()
def main():
- EXIT_CODE = -1
project = 'parser'
case_name = 'parser-basics'
cmd = 'cd %s/tests && ./functest_run.sh' % PARSER_REPO
- start_time = time.time()
+ start_time = time.time()
ret = functest_utils.execute_command(cmd, logger, exit_on_error=False)
-
stop_time = time.time()
- duration = round(stop_time - start_time, 1)
- if ret == 0:
- EXIT_CODE = 0
- logger.info("parser OK")
- test_status = 'OK'
- else:
- logger.info("parser FAILED")
- test_status = 'NOK'
-
- details = {
- 'timestart': start_time,
- 'duration': duration,
- 'status': test_status,
- }
- status = "FAIL"
- if details['status'] == "OK":
- status = "PASS"
+ status, details = functest_utils.check_test_result(case_name,
+ ret,
+ start_time,
+ stop_time)
functest_utils.logger_test_results(logger,
project,
@@ -73,7 +58,7 @@ def main():
stop_time,
status,
details)
- exit(EXIT_CODE)
+ exit(ret)
if __name__ == '__main__':
main()
diff --git a/utils/functest_utils.py b/utils/functest_utils.py
index 5f790a015..cb2333d42 100644
--- a/utils/functest_utils.py
+++ b/utils/functest_utils.py
@@ -357,16 +357,33 @@ def check_success_rate(case_name, success_rate):
success_rate = float(success_rate)
criteria = get_criteria_by_test(case_name)
- def get_value(op):
+ def get_criteria_value(op):
return float(criteria.split(op)[1].rstrip('%'))
status = 'FAIL'
ops = ['==', '>=']
for op in ops:
if op in criteria:
- c_value = get_value(op)
+ c_value = get_criteria_value(op)
if eval("%s %s %s" % (success_rate, op, c_value)):
status = 'PASS'
break
return status
+
+
+def check_test_result(test_name, ret, start_time, stop_time):
+ def get_criteria_value():
+ return get_criteria_by_test(test_name).split('==')[1].strip()
+
+ status = 'FAIL'
+ if str(ret) == get_criteria_value():
+ status = 'PASS'
+
+ details = {
+ 'timestart': start_time,
+ 'duration': round(stop_time - start_time, 1),
+ 'status': status,
+ }
+
+ return status, details