From 2f0c244d15e7014509755e8b81befec53bc9fff9 Mon Sep 17 00:00:00 2001
From: Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>
Date: Wed, 10 Jan 2018 18:59:41 +0000
Subject: Improve ovs_deploy.bash script

Improved ovs_deploy.bash script [1]:
- Check if there is an error during the execution.
- Removed "prerequisites" function because is not called.
- Modified DPDK package installation: execute "make config" and then "make"
- Added comments.

[1]https://github.com/opnfv/yardstick/blob/master/yardstick/resources/scripts/install/ovs_deploy.bash

JIRA: YARDSTICK-916

Change-Id: I3029f983dde72aa46f6fdd61dd64d086ab3c2af6
Signed-off-by: Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>
---
 .../resources/scripts/install/ovs_deploy.bash      | 23 +++++++---------------
 1 file changed, 7 insertions(+), 16 deletions(-)

diff --git a/yardstick/resources/scripts/install/ovs_deploy.bash b/yardstick/resources/scripts/install/ovs_deploy.bash
index d94f30db1..beda9a5e0 100755
--- a/yardstick/resources/scripts/install/ovs_deploy.bash
+++ b/yardstick/resources/scripts/install/ovs_deploy.bash
@@ -14,6 +14,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+set -e
+
 INSTALL_OVS_BIN="/usr/src"
 cd $INSTALL_OVS_BIN
 
@@ -22,20 +24,6 @@ if [[ $EUID -ne 0 ]]; then
   exit 1;
 fi
 
-prerequisite()
-{
-  echo "Install required libraries to run collectd..."
-  pkg=(git flex bison build-essential pkg-config automake autotools-dev libltdl-dev cmake qemu-kvm libvirt-bin bridge-utils numactl libnuma-dev libpcap-dev)
-  for i in "${pkg[@]}"; do
-  dpkg-query -W --showformat='${Status}\n' "${i}"|grep "install ok installed"
-  if [  "$?" -eq "1" ]; then
-    apt-get update
-    apt-get -y install "${i}";
-  fi
-  done
-  echo "Done"
-}
-
 download_zip()
 {
   url=$1
@@ -53,6 +41,7 @@ download_zip()
 
 dpdk_build()
 {
+  echo "Build DPDK libraries"
   pushd .
   if [[ $DPDK_VERSION != "" ]]; then
     export DPDK_DIR=$INSTALL_OVS_BIN/dpdk-stable-$DPDK_VERSION
@@ -62,13 +51,15 @@ dpdk_build()
     DPDK_DOWNLOAD="http://fast.dpdk.org/rel/dpdk-$DPDK_VERSION.tar.xz"
     download_zip "${DPDK_DOWNLOAD}" "DPDK"
     cd dpdk-stable-"$DPDK_VERSION"
-    make install -j T=$RTE_TARGET
+    make config T=$RTE_TARGET
+    make install -j $(nproc) T=$RTE_TARGET
   fi
   popd
 }
 
 ovs()
 {
+  echo "Build and install OVS with DPDK"
   pushd .
   if [[ $OVS_VERSION != "" ]]; then
     rm -rf openswitch-"$OVS_VERSION"
@@ -82,7 +73,7 @@ ovs()
     else
       ./configure
     fi
-    make install -j
+    make install -j $(nproc)
   fi
   popd
 }
-- 
cgit