summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas F Herbert <therbert@redhat.com>2016-02-09 22:17:45 -0500
committerThomas F Herbert <therbert@redhat.com>2016-02-25 03:27:09 +0000
commit8b54b317c7b60011b292c408d43041e46a23a2ed (patch)
tree901619515adc387ef0141ff30cd6120eab006866
parent8e1ad8a230ec6121b73117508b3b7b6bf1c16997 (diff)
Build OVS with dpdk
Builds OVS with DPDK. Uses dpdk 2.2.0 and Open vSwitch 2.5. Includes Multi-Queue and recent patches. Open vSwitch RPM is now built with DPDK dataplane. Upstream copr (Fedora) spec files and patches are used for building. Also includes fixes of RPM building and command line options. Adds dpdk arg to RPM test script. Use "pure" COPR spec files without modifications. Fixed some function problems. Addressed reviewer comments. Delete local copies of spec files Build dpdk snapshot instead of using upstream snapshot. Fix clean script. "stack" VM with its default configuration doesn't support sse3 instruction set required by DPDK. Include workaround to test RPM script in host instead of VM. Install prereqs for dpdk build. Use 'set -e' in all scripts for error termination. Add PyQt4 Pre-req. Move functions and respond to reviewers comments. Change-Id: I8d5892ff61a814271972e8d2279628d645b2831b Signed-off-by: Thomas F Herbert <therbert@redhat.com>
-rwxr-xr-xbuild/BuildAndTestOVS.sh39
-rwxr-xr-xbuild/build_dpdk_rpm.sh133
-rwxr-xr-xbuild/build_ovs_rpm.sh190
-rw-r--r--build/config6
-rwxr-xr-xbuild/instack_ovs.sh65
-rwxr-xr-xbuild/test_ovs_rpm.sh86
-rwxr-xr-xci/build.sh1
-rwxr-xr-xci/buildovs.sh38
8 files changed, 433 insertions, 125 deletions
diff --git a/build/BuildAndTestOVS.sh b/build/BuildAndTestOVS.sh
index ff2495c..10a2f05 100755
--- a/build/BuildAndTestOVS.sh
+++ b/build/BuildAndTestOVS.sh
@@ -1,16 +1,24 @@
#!/bin/bash
-##############################################################################
-# Copyright (c) 2016 Red Hat Inc. and others.
-# therbert@redhat.com
-# 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
-##############################################################################
+
+# Copyright (c) 2016 Open Platform for NFV Project, Inc. and its contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
set -e
echo "==============================="
echo executing $0 $@
+echo
usage() {
echo "$0 -a <kernel major> -d -g <OVS TAG> -h\
@@ -81,6 +89,10 @@ else
echo Will use default kernel in ovs test vm
fi
+if [ ! -z $DPDK ]; then
+ setbuilddpdk="-d"
+fi
+
if [ -z ${WORKSPACE+1} ]; then
# We are not being run by Jenkins.
export WORKSPACE=$HOME/opnfv/ovsnfv
@@ -127,19 +139,12 @@ if [ ! -z $TESTRPM ]; then
if [ ! -z $kernel_version ]; then
instack_ovs.sh -a $kernel_major -g $TAG -i $kernel_minor -p $OVS_PATCH -t -u $OVS_REPO_URL
else
- instack_ovs.sh -g $TAG -p $OVS_PATCH -t -u $OVS_REPO_URL
+ instack_ovs.sh $setbuilddpdk -g $TAG -p $OVS_PATCH -t -u $OVS_REPO_URL
fi
else
# Run build locally.
- build_ovs_rpm.sh -d -g -p $OVS_PATCH -u $OVS_REPO_URL
+ build_ovs_rpm.sh $setbuilddpdk -g $TAG -p $OVS_PATCH -u $OVS_REPO_URL
cp $HOME/rpmbuild/RPMS/* $TMP_RELEASE_DIR
fi
-echo "--------------------------------------------------"
-echo "Build OVS RPM from upstream git $OVS_REPO_URL version $TAG"
-if [ ! -z $OVS_PATCH ]; then
- echo "Apply patches from: $OVS_PATCH"
-fi
-echo
-
exit 0
diff --git a/build/build_dpdk_rpm.sh b/build/build_dpdk_rpm.sh
new file mode 100755
index 0000000..a36403d
--- /dev/null
+++ b/build/build_dpdk_rpm.sh
@@ -0,0 +1,133 @@
+#!/bin/bash
+
+# Copyright (c) 2016 Open Platform for NFV Project, Inc. and its contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+set -e
+
+echo "==============================="
+echo executing $0 $@
+echo executing on machine `uname -a`
+
+usage() {
+ echo run BuildAndTestOVS -h for complete help on options on ovsnfv scripts.
+}
+
+while getopts "g:hp:u:v" opt; do
+ case "$opt" in
+ g)
+ DPDK_VERSION=${OPTARG}
+ ;;
+ h|\?)
+ usage
+ exit 1
+ ;;
+ p)
+ DPDK_PATCH=${OPTARG}
+ ;;
+ u)
+ DPDK_REPO_URL=${OPTARG}
+ ;;
+ v)
+ verbose="yes"
+ ;;
+ esac
+done
+
+if [ -z $DPDK_REPO_URL ]; then
+ DPDK_REPO_URL=http://dpdk.org/git/dpdk
+fi
+if [ -z $DPDK_VERSION ]; then
+ DPDK_VERSION=2.2.0
+fi
+
+HOME=`pwd`
+TOPDIR=$HOME
+TMPDIR=$TOPDIR/rpms
+
+if [ -d $TMPDIR ]
+then
+ rm -rf $TMPDIR
+fi
+
+echo "---------------------"
+echo "Install dependencies for dpdk"
+echo
+sudo yum -y install gcc make python-devel openssl-devel autoconf automake rpm-build \
+ redhat-rpm-config libtool libpcap-devel numactl-devel python-sphinx \
+ libvirt-devel
+
+
+mkdir -p $TMPDIR
+
+cd $TMPDIR
+
+mkdir -p $HOME/rpmbuild/RPMS
+mkdir -p $HOME/rpmbuild/SOURCES
+mkdir -p $HOME/rpmbuild/SPECS
+mkdir -p $HOME/rpmbuild/SRPMS
+
+RPMDIR=$HOME/rpmbuild
+
+#
+# Use Fedora copr spec file
+#
+echo "---------------------"
+echo "Get copr distribution git"
+mkdir -p copr
+cd copr
+git clone http://copr-dist-git.fedorainfracloud.org/cgit/pmatilai/dpdk/dpdk.git
+
+echo "---------------------"
+echo "Build DPDK RPM version $DPDK_VERSION"
+echo
+cd $TMPDIR
+git clone $DPDK_REPO_URL
+cd dpdk
+if [[ "$DPDK_VERSION" =~ "master" ]]; then
+ git checkout master
+ snapgit=`git log --pretty=oneline -n1|cut -c1-8`
+else
+ git checkout v$DPDK_VERSION
+ snapgit=`grep "define snapver" $TMPDIR/copr/dpdk/dpdk.spec | cut -c25-33`
+fi
+
+cp $TMPDIR/copr/dpdk/dpdk.spec $TMPDIR/dpdk
+cp $TMPDIR/copr/dpdk/dpdk.spec $RPMDIR/SPECS
+cp $TMPDIR/copr/dpdk/*.patch $TMPDIR/copr/dpdk/sources $TMPDIR/copr/dpdk/dpdk-snapshot.sh $RPMDIR/SOURCES
+snapser=`git log --pretty=oneline | wc -l`
+
+makever=`make showversion`
+basever=`echo ${makever} | cut -d- -f1`
+
+prefix=dpdk-$basever
+archive=${prefix}.tar.gz
+DPDK_VERSION=$basever
+
+echo "-------------------------------"
+echo "Creating ${archive}"
+echo
+git archive --prefix=${prefix}/ HEAD | gzip -9 > ${archive}
+cp ${archive} $RPMDIR/SOURCES/
+echo "-------------------------------"
+echo building RPM for DPDK version $DPDK_VERSION
+echo
+rpmbuild -bb --define "_topdir $RPMDIR" dpdk.spec
+
+echo "-------------------------------"
+echo Copy dpdk RPM
+echo
+cp $RPMDIR/RPMS/x86_64/*.rpm $HOME
+
+exit 0
diff --git a/build/build_ovs_rpm.sh b/build/build_ovs_rpm.sh
index 60b92e6..53e8745 100755
--- a/build/build_ovs_rpm.sh
+++ b/build/build_ovs_rpm.sh
@@ -1,14 +1,19 @@
#!/bin/bash
-##############################################################################
-# Copyright (c) 2016 Red Hat Inc. and others.
-# therbert@redhat.com
-# 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
-##############################################################################
+
+# Copyright (c) 2016 Open Platform for NFV Project, Inc. and its contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
set -e
-declare -i CNT
echo "==============================="
echo executing $0 $@
@@ -18,6 +23,22 @@ usage() {
echo run BuildAndTestOVS -h for help
}
+function delrpm() {
+ set +e
+ rpm -q $1
+ if [ $? -eq 0 ]; then
+ sudo rpm -e --allmatches $1
+ fi
+ set -e
+}
+function cleanrpms() {
+ delrpm openvswitch
+ delrpm dpdk-devel
+ delrpm dpdk-tools
+ delrpm dpdk-examples
+ delrpm dpdk
+}
+
while getopts "cdg:hkp:u:v" opt; do
case "$opt" in
c)
@@ -52,78 +73,135 @@ HOME=`pwd`
TOPDIR=$HOME
TMPDIR=$TOPDIR/ovsrpm
+echo "---------------------------------------"
+echo Clean out old working dir
+echo
if [ -d $TMPDIR ]
then
rm -rf $TMPDIR
fi
+echo "----------------------------------------"
+echo Install pre-reqs.
+echo
sudo yum -y install gcc make python-devel openssl-devel kernel-devel graphviz \
kernel-debug-devel autoconf automake rpm-build redhat-rpm-config \
- libtool
+ libtool python-twisted-core desktop-file-utils groff PyQt4
VERSION=2.3.90
os_type=fedora
kernel_version=$(uname -a | awk '{print $3}')
-mkdir -p $TMPDIR
+RPMDIR=$HOME/rpmbuild
-cd $TMPDIR
+echo "---------------------------------------"
+echo Clean out old reminents of old rpms and rpm _topdir.
+echo
+rm openvswitch*.rpm || true
+if [ -d $RPMDIR ]; then
+ rm -rf $RPMDIR
+fi
+
+echo "---------------------------------------"
+echo Create new rpm _topdir.
+echo
mkdir -p $HOME/rpmbuild/RPMS
mkdir -p $HOME/rpmbuild/SOURCES
mkdir -p $HOME/rpmbuild/SPECS
mkdir -p $HOME/rpmbuild/SRPMS
-RPMDIR=$HOME/rpmbuild
+mkdir -p $TMPDIR
-echo "---------------------"
-echo "Clone git repo $OVS_REPO_URL and checkout branch or tag $TAG"
-echo
-git clone $OVS_REPO_URL
+cd $TMPDIR
-cd ovs
-echo "--------------------"
-echo "Checkout OVS $TAG"
-echo
-if [[ ! "$TAG" =~ "master" ]]; then
- git checkout $TAG
-fi
-if [[ ! "$OVS_PATCH" =~ "no" ]]; then
- echo "Apply patches from $OVS_PATCH"
-fi
-./boot.sh
if [ ! -z $DPDK ]; then
- ./configure --with-dpdk
+ echo "----------------------------------"
+ echo "Build OVS for dpdk. Use Fedora copr repo"
+ echo
+ echo "----------------------------------"
+ echo "Clone Fedora copr repo and copy files."
+ echo
+ git clone http://copr-dist-git.fedorainfracloud.org/cgit/pmatilai/dpdk/openvswitch.git
+ cp $TMPDIR/openvswitch/openvswitch.spec $RPMDIR/SPECS
+ cp $TMPDIR/openvswitch/* $RPMDIR/SOURCES
+ snapgit=`grep "define snapver" $TMPDIR/openvswitch/openvswitch.spec | cut -c26-33`
+ echo "-------------------------------------------"
+ echo "Remove old dpdk, ovs and dpdk development rpms"
+ echo
+ cleanrpms
+ echo "-------------------------------------------"
+ echo "Install dpdk and dpdk development rpms"
+ echo
+ sudo rpm -ivh $HOME/dpdk-2*.rpm
+ sudo rpm -ivh $HOME/dpdk-devel*.rpm
+ echo "----------------------------------------"
+ echo "Copy DPDK RPM to SOURCES"
+ echo
+ cp $HOME/*.rpm $RPMDIR/SOURCES
+ echo "--------------------------------------------"
+ echo "Get commit from $snapgit User Space OVS version $TAG"
+ echo
+ cd $TMPDIR
+ git clone $OVS_REPO_URL
+ cd $TMPDIR/ovs
+ git checkout $snapgit
+ echo "--------------------------------------------"
+ echo "Creating archive, $archive using copr script"
+ echo
+ snapser=`git log --pretty=oneline | wc -l`
+ basever=`grep AC_INIT configure.ac | cut -d' ' -f2 | cut -d, -f1`
+ prefix=openvswitch-${basever}-${snapser}.git${snapgit}
+ archive=$prefix.tar.gz
+ git archive --prefix=${prefix}/ HEAD | gzip -9 > $RPMDIR/SOURCES/${archive}
+ cd $TMPDIR/openvswitch
+ echo "--------------------------------------------"
+ echo "Build openvswitch RPM"
+ echo
else
- ./configure --with-linux=/lib/modules/`uname -r`/build
+ echo "-------------------------------------------------"
+ echo "Build OVS without DPDK:"
+ echo "Use spec files for $os_type in OVS distribution."
+ echo
+ if [[ "$TAG" =~ "master" ]]; then
+ git clone $OVS_REPO_URL
+ cd ovs
+
+ if [[ ! "$OVS_PATCH" =~ "no" ]]; then
+ echo "Apply patches from $OVS_PATCH"
+ fi
+ basever=`grep AC_INIT configure.ac | cut -d' ' -f2 | cut -d, -f1`
+ export VERSION=$basever
+
+ echo "--------------------------------------------"
+ echo making distribution tarball for Open vswitch version $VERSION
+ echo
+ ./boot.sh
+ ./configure
+ make dist
+
+ echo cp openvswitch-*.tar.gz $HOME/rpmbuild/SOURCES
+ cp openvswitch-*.tar.gz $HOME/rpmbuild/SOURCES
+ else
+ export VERSION=${TAG}
+ echo "---------------------------------------------"
+ echo "Get openvswith-${VERSION}.tar.gz"
+ echo
+ curl --silent --output $HOME/rpmbuild/SOURCES/openvswitch-${VERSION}.tar.gz http://openvswitch.org/releases/openvswitch-${VERSION}.tar.gz
+ fi
+
+ if [ ! -z $kmod ]; then
+ echo "--------------------------------------------"
+ echo "Building openvswitch kernel module RPM"
+ echo
+ rpmbuild -bb -D "kversion $kernel_version" -D "kflavors default" --define "_topdir `echo $RPMDIR`" $setnocheck rhel/openvswitch-kmod-${os_type}.spec
+ fi
+ echo "--------------------------------------------"
+ echo "Build openvswitch RPM"
+ echo
fi
-echo "--------------------"
-echo "Make OVS $TAG"
-echo
-make
-
-if [[ "$TAG" =~ "master" ]]; then
- v=$($TMPDIR/ovs/utilities/ovs-vsctl --version | head -1 | cut -d' ' -f4)
- export VERSION=$v
-else
- export VERSION=${TAG:1}
-fi
-
-echo making RPM for Open vswitch version $VERSION
-make dist
-
-echo cp openvswitch-*.tar.gz $HOME/rpmbuild/SOURCES
-cp openvswitch-*.tar.gz $HOME/rpmbuild/SOURCES
-
-if [ ! -z $kmod ]; then
- echo "Building kernel module..."
- rpmbuild -bb -D "kversion $kernel_version" -D "kflavors default" --define "_topdir `echo $RPMDIR`" $setnocheck rhel/openvswitch-kmod-${os_type}.spec
-echo " Kernel RPM built!"
-fi
-
-echo "Building User Space..."
-rpmbuild -bb --define "_topdir `echo $RPMDIR`" $setnocheck rhel/openvswitch.spec
+rpmbuild -bb --define "_topdir `echo $RPMDIR`" $setnocheck openvswitch.spec
cp $RPMDIR/RPMS/x86_64/*.rpm $HOME
diff --git a/build/config b/build/config
index 78480ed..b30db9a 100644
--- a/build/config
+++ b/build/config
@@ -21,7 +21,7 @@
# built from the top of current master. The tag uses the current ovs naming and
# release convention. This option can be overriden in the command line.
#
-export OVSTAG=master
+export OVSTAG=2.4.0
#
# when NOCHECK is yes, the ovs rpm is build with the --without check option which
# Disables running "make check" as the RPM is built.
@@ -34,8 +34,10 @@ export PATCH=none
#
# DPDK configuration.
#
+export WITH_DPDK=yes
export DPDK_PATCH=none
+export DPDK_VERSION=2.2.0
#
# When KMOD is set, the Linux kernel module is built and tested.
#
-export KMOD=yes
+export KMOD=no
diff --git a/build/instack_ovs.sh b/build/instack_ovs.sh
index 83b141c..4c258a4 100755
--- a/build/instack_ovs.sh
+++ b/build/instack_ovs.sh
@@ -26,6 +26,7 @@ while getopts "a:dg:hi:p:tu:v" opt; do
;;
d)
DPDK="yes"
+ setdpdk="-d"
;;
g)
TAG=${OPTARG}
@@ -58,8 +59,10 @@ echo ===============================================
echo Default Configuration Options.
echo ===============================================
echo option NOCHECK is set to $NOCHECK
+echo build DPDK option is set to $DPDK
echo DPDK Patch URL is set to $DPDK_PATCH
-echo Build and Test OVS Kernel Module is set to $KMOD
+echo DPDK Version is set to $DPDK_VERSION
+echo Option for OVS Kernel Module is set to $KMOD
echo ===============================================
if [[ $NOCHECK =~ "yes" ]]; then
setnocheck="-c"
@@ -236,8 +239,11 @@ done
ssh -T ${SSH_OPTIONS[@]} "root@$UNDERCLOUD" <<EOI
set -e
- echo yum -y update
+ echo "----------------------------------------------------------------"
+ echo yum update and install pciutils prereqs for DPDK tools and samples.
+ echo
yum -y update
+ yum -y install pciutils libvirt
EOI
# reboot VM
@@ -330,37 +336,66 @@ echo Copy build and test scripts to undercloud vm.
echo BUILD_BASE is $BUILD_BASE
scp ${SSH_OPTIONS[@]} $BUILD_BASE/build_ovs_rpm.sh stack@$UNDERCLOUD:
scp ${SSH_OPTIONS[@]} $BUILD_BASE/test_ovs_rpm.sh stack@$UNDERCLOUD:
-
#
-# build rpm on undercloud.
+# build dpdk rpm locally.
+#
+if [[ "$DPDK" =~ "yes" ]]; then
+ echo Build DPDK RPMs
+ ./build_dpdk_rpm.sh -g $DPDK_VERSION
+fi
+#
+# Build rpm on undercloud if custom kernel module is required otherwise build
+# locally.
#
if [ ! -z $kernel_version ]; then
echo build rpm on undercloud with kernel version $kernel_version
ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
./build_ovs_rpm.sh -a $kernel_major $setnocheck -g $TAG -i $kernel_minor -k -p $OVS_PATCH -u $OVS_REPO_URL
EOI
+ scp ${SSH_OPTIONS[@]} stack@UNDERCLOUD:*.rpm $RPMDIR/RPMS/
+elif [[ "$DPDK" =~ "yes" ]]; then
+ echo Build ovs with DPDK locally
+ #
+ # Build locally and copy RPMS to undercloud vm for testing
+ # and copy RPMS to temporary release dir.
+ #
+ ./build_ovs_rpm.sh $setnocheck -d -g $TAG -p $OVS_PATCH -u $OVS_REPO_URL
else
- # build locally and copy RPMS to undercloud vm for testing
+ # Build locally and copy RPMS to undercloud vm for testing
# and copy RPMS to temporary release dir.
#
- echo build rpm on undercloud
- ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
- ./build_ovs_rpm.sh $setnocheck -g $TAG $setkmod -p $OVS_PATCH -u $OVS_REPO_URL
-EOI
+ echo build OVS rpm locally
+ ./build_ovs_rpm.sh $setnocheck -g $TAG $setkmod -p $OVS_PATCH -u $OVS_REPO_URL
fi
#
# Test rpm on undercloud vm
+# TODO: Undercloud VM doesn't support sse3 instruction needed set to run DPDK
#
-if [[ ! -z $TESTRPM ]]; then
- echo Test rpm on undercloud vm
- ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
- ./test_ovs_rpm.sh $setkmod
+if [ ! -z $TESTRPM ]; then
+ if [ -z $DPDK ]; then
+ echo "-----------------------------------------"
+ echo Test rpm on undercloud vm
+ echo Copy all RPMS to undercloud for testing.
+ echo
+ scp ${SSH_OPTIONS[@]} $RPMDIR/RPMS/x86_64/* stack@$UNDERCLOUD:
+ scp ${SSH_OPTIONS[@]} $RPMDIR/SOURCES/dpdk*.rpm stack@$UNDERCLOUD:
+ ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
+ ./test_ovs_rpm.sh $setdpdk $setkmod
EOI
+ else
+ echo "-----------------------------------------"
+ echo "TODO: Undercloud VM doesn't support sse3 instruction needed DPDK."
+ echo "DPDK is required, therefore test DPDK/OVS RPM in host"
+ echo
+ ./test_ovs_rpm.sh $setdpdk $setkmod
+ fi
fi
+
#
-# copy rpms from undercloud back to host
+# If tests pass, copy rpms to release dir
#
+echo copy rpms to release dir
echo copy rpms from undercloud back to $TMP_RELEASE_DIR in host
-scp ${SSH_OPTIONS[@]} stack@$UNDERCLOUD:rpmbuild/RPMS/x86_64/*.rpm $TMP_RELEASE_DIR
+cp $RPMDIR/RPMS/x86_64/* $TMP_RELEASE_DIR
exit 0
diff --git a/build/test_ovs_rpm.sh b/build/test_ovs_rpm.sh
index fce5ca4..264cd6e 100755
--- a/build/test_ovs_rpm.sh
+++ b/build/test_ovs_rpm.sh
@@ -1,14 +1,20 @@
#!/bin/bash
-##############################################################################
-# Copyright (c) 2016 Red Hat Inc. and others.
-# therbert@redhat.com
-# 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
-##############################################################################
+
+# Copyright (c) 2016 Open Platform for NFV Project, Inc. and its contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
set -e
-declare -i CNT
echo "==============================="
echo executing $0 $@
@@ -19,6 +25,22 @@ usage() {
echo run BuildAndTest -h for help
}
+function delrpm() {
+ set +e
+ rpm -q $1
+ if [ $? -eq 0 ]; then
+ sudo rpm -e --allmatches $1
+ fi
+ set -e
+}
+function cleanrpms() {
+ delrpm openvswitch
+ delrpm dpdk-devel
+ delrpm dpdk-tools
+ delrpm dpdk-examples
+ delrpm dpdk
+}
+
while getopts "dg:hkp:u:v" opt; do
case "$opt" in
d)
@@ -56,26 +78,58 @@ mkdir -p $TMPDIR
cd $TMPDIR
-mkdir -p $HOME/rpmbuild/RPMS
+mkdir -p $HOME/rpmbuild/RPMS/x86_64
mkdir -p $HOME/rpmbuild/SOURCES
mkdir -p $HOME/rpmbuild/SPECS
mkdir -p $HOME/rpmbuild/SRPMS
RPMDIR=$HOME/rpmbuild
+cp $HOME/*.rpm $RPMDIR/RPMS/x86_64
+
+function stopovs() {
+ set +e
+ /bin/systemctl is-active openvswitch.service
+ if [ $? -eq 0 ]; then
+ sudo /bin/systemctl stop openvswitch.service
+ fi
+ set -e
+}
+
+echo "-----------------------------------"
+echo "Clean old dpdk and ovs installations"
+echo
+stopovs
+cleanrpms
+
+if [ ! -z $DPDK ]; then
+ echo "-----------------------------------"
+ echo "Install DPDK RPMs"
+ echo
+ sudo rpm -ivh $RPMDIR/RPMS/x86_64/dpdk-2*.rpm
+ sudo rpm -ivh $RPMDIR/RPMS/x86_64/dpdk-tools-2*.rpm
+ sudo rpm -ivh $RPMDIR/RPMS/x86_64/dpdk-examples-2*.rpm
+fi
-echo " Testing installation of kmod RPM"
if [ ! -z $kmod ]; then
- echo "Install kernel module"
+ echo "-----------------------------------"
+ echo "Test installation of kmod RPM"
+ echo
sudo rpm -ivh $RPMDIR/RPMS/x86_64/openvswitch-kmod*.rpm
- echo " Kernel RPM installed."
fi
-echo "Testing User Space RPM"
+echo "-----------------------------------"
+echo "Test installation of user space RPM"
+echo
sudo rpm -ivh $RPMDIR/RPMS/x86_64/openvswitch-2*.rpm
+echo "-----------------------------------"
+echo "Start openvswitch service."
+echo
sudo service openvswitch start
sudo ovs-vsctl show
-sudo ovs-vsctl add-br br1
-sudo ovs-ofctl dump-flows br1
+sudo ovs-vsctl add-br brtest
+sudo ovs-ofctl dump-flows brtest
+sudo ovs-vsctl del-br brtest
+sudo service openvswitch stop
exit 0
diff --git a/ci/build.sh b/ci/build.sh
index c1655ad..2723abe 100755
--- a/ci/build.sh
+++ b/ci/build.sh
@@ -13,6 +13,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+set -e
echo "Hello OVSNFV community!"
diff --git a/ci/buildovs.sh b/ci/buildovs.sh
index 1164733..fead8db 100755
--- a/ci/buildovs.sh
+++ b/ci/buildovs.sh
@@ -1,12 +1,19 @@
#!/bin/bash
-##############################################################################
-# Copyright (c) 2015,2016 Red Hat Inc. and others.
-# therbert@redhat.com
-# 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
-##############################################################################
+
+# Copyright (c) 2016 Open Platform for NFV Project, Inc. and its contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
set -e
echo "==================================="
@@ -52,10 +59,6 @@ export CACHE_DIR=$TOPDIR/cache
export TMPDIR=$TOPDIR/scratch
export RPMDIR=$TOPDIR/rpmbuild
-echo "--------------------------------------------------"
-echo "Build OVS RPM from upstream git $TAG"
-echo
-
mkdir -p $RPMDIR/RPMS
mkdir -p $RPMDIR/SOURCES
mkdir -p $RPMDIR/SPECS
@@ -67,15 +70,12 @@ then
fi
#
-# Build ovs rpm without DPDK from ovs master
-#
-echo =======Build ovs rpm and ovs kmod rpm without DPDK Test in VM==========
- BuildAndTestOVS.sh -p none -t
-#
# Build ovs rpm with DPDK
#
-echo =======Build ovs rpm with DPDK Test in VM==========
-BuildAndTestOVS.sh -d -p none -t
+echo =============================================
+echo =======Build ovs rpm with DPDK and test in VM.
+echo
+BuildAndTestOVS.sh -d -g master -p none -t
#
# Build special version of ovs with patches --TODO
#