summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorge Paraskevopoulos <geopar@intracom-telecom.com>2016-09-06 12:42:13 +0300
committerJose Lausuch <jose.lausuch@ericsson.com>2016-09-06 13:26:07 +0000
commit30d7616a885a47dcc5c127b40d9b2df13d6aadb6 (patch)
tree7d100760955b777eac95d0a3a6716430b99829e4
parente8af84a1bd81becee94d6a9b9513570f253c7c45 (diff)
Reduce logging in the SFC test case
JIRA: FUNCTEST-446 Reduce the logs that appear in the Jenkins CI console to make the output of the SFC test case more readable - Redirect tacker installation logs to results folder /home/opnfv/functest/results/odl-sfc.log - Split odl-sfc preparation into a new script - Pipe STDERR in the sfc.py script so that "Added to known hosts" messages do not show in the output Change-Id: Ibf871ade6827d4817f33623b935c5f1d904086bb Signed-off-by: George Paraskevopoulos <geopar@intracom-telecom.com>
-rwxr-xr-xci/exec_test.sh17
-rwxr-xr-xtestcases/features/sfc/prepare_odl_sfc.bash38
-rwxr-xr-xtestcases/features/sfc/sfc.py13
3 files changed, 52 insertions, 16 deletions
diff --git a/ci/exec_test.sh b/ci/exec_test.sh
index deb505df9..e402e0c31 100755
--- a/ci/exec_test.sh
+++ b/ci/exec_test.sh
@@ -147,18 +147,11 @@ function run_test(){
python ${FUNCTEST_REPO_DIR}/testcases/features/domino.py $report
;;
"odl-sfc")
- bash ${FUNCTEST_REPO_DIR}/testcases/features/sfc/server_presetup_CI.bash
- ret_val=$?
- 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 $report
+ ODL_SFC_DIR=${FUNCTEST_REPO_DIR}/testcases/features/sfc
+ # pass FUNCTEST_REPO_DIR inside prepare_odl_sfc.bash
+ FUNCTEST_REPO_DIR=${FUNCTEST_REPO_DIR} bash ${ODL_SFC_DIR}/prepare_odl_sfc.bash || exit $?
+ source ${ODL_SFC_DIR}/tackerc
+ python ${ODL_SFC_DIR}/sfc.py $report
;;
"parser")
python ${FUNCTEST_REPO_DIR}/testcases/vnf/vRNC/parser.py $report
diff --git a/testcases/features/sfc/prepare_odl_sfc.bash b/testcases/features/sfc/prepare_odl_sfc.bash
new file mode 100755
index 000000000..80ed9bd92
--- /dev/null
+++ b/testcases/features/sfc/prepare_odl_sfc.bash
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+#
+# Author: George Paraskevopoulos (geopar@intracom-telecom.com)
+# Manuel Buil (manuel.buil@ericsson.com)
+# Prepares the controller and the compute nodes for the odl-sfc testcase
+#
+#
+# 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
+#
+
+ODL_SFC_LOG=/home/opnfv/functest/results/odl-sfc.log
+ODL_SFC_DIR=${FUNCTEST_REPO_DIR}/testcases/features/sfc
+
+# Split the output to the log file and redirect STDOUT and STDERR to /dev/null
+bash ${ODL_SFC_DIR}/server_presetup_CI.bash |& \
+ tee -a ${ODL_SFC_LOG} 1>/dev/null 2>&1
+
+# Get return value from PIPESTATUS array (bash specific feature)
+ret_val=${PIPESTATUS[0]}
+if [ $ret_val != 0 ]; then
+ echo "The tacker server deployment failed"
+ exit $ret_val
+fi
+echo "The tacker server was deployed successfully"
+
+bash ${ODL_SFC_DIR}/compute_presetup_CI.bash |& \
+ tee -a ${ODL_SFC_LOG} 1>/dev/null 2>&1
+
+ret_val=${PIPESTATUS[0]}
+if [ $ret_val != 0 ]; then
+ exit $ret_val
+fi
+
+exit 0
diff --git a/testcases/features/sfc/sfc.py b/testcases/features/sfc/sfc.py
index a228ed298..dbf64850e 100755
--- a/testcases/features/sfc/sfc.py
+++ b/testcases/features/sfc/sfc.py
@@ -62,7 +62,8 @@ def main():
logger.info("Executing script to get ip_server: '%s'" % contr_cmd)
process = subprocess.Popen(contr_cmd,
shell=True,
- stdout=subprocess.PIPE)
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
ip_server = process.stdout.readline().rstrip()
contr_cmd2 = ("sshpass -p r00tme ssh " + ssh_options + " root@10.20.0.2"
@@ -70,7 +71,8 @@ def main():
logger.info("Executing script to get ip_compute: '%s'" % contr_cmd2)
process = subprocess.Popen(contr_cmd2,
shell=True,
- stdout=subprocess.PIPE)
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
ip_compute = process.stdout.readline().rstrip()
iptable_cmd1 = ("sshpass -p r00tme ssh " + ssh_options + " root@10.20.0.2"
@@ -78,8 +80,11 @@ def main():
iptable_cmd2 = ("sshpass -p r00tme ssh " + ssh_options + " root@10.20.0.2"
" ssh " + ip_server + " iptables -t nat -P INPUT ACCEPT ")
- subprocess.call(iptable_cmd1, shell=True)
- subprocess.call(iptable_cmd2, shell=True)
+ logger.info("Changing firewall policy in controller: '%s'" % iptable_cmd1)
+ subprocess.call(iptable_cmd1, shell=True, stderr=subprocess.PIPE)
+
+ logger.info("Changing firewall policy in controller: '%s'" % iptable_cmd2)
+ subprocess.call(iptable_cmd2, shell=True, stderr=subprocess.PIPE)
# Getting the different clients