blob: beda9a5e0b86bd2a00957e9f3a42d0b1c8349659 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
#!/bin/bash
#
# Copyright (c) 2016-2017 Intel Corporation
#
# 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
INSTALL_OVS_BIN="/usr/src"
cd $INSTALL_OVS_BIN
if [[ $EUID -ne 0 ]]; then
echo "Must be root to run $0"
exit 1;
fi
download_zip()
{
url=$1
download_type=$2
if [ -n "${download_type}" ]; then
echo "Download ${download_type} zip"
fi
# rm goes into calling code
echo "${url}"
if [ ! -e "${url##*/}" ]; then
wget "${url}"
fi
tar xvf "${url##*/}"
}
dpdk_build()
{
echo "Build DPDK libraries"
pushd .
if [[ $DPDK_VERSION != "" ]]; then
export DPDK_DIR=$INSTALL_OVS_BIN/dpdk-stable-$DPDK_VERSION
export RTE_TARGET=x86_64-native-linuxapp-gcc
export DPDK_BUILD=$DPDK_DIR/$RTE_TARGET
rm -rf "$DPDK_DIR"
DPDK_DOWNLOAD="http://fast.dpdk.org/rel/dpdk-$DPDK_VERSION.tar.xz"
download_zip "${DPDK_DOWNLOAD}" "DPDK"
cd dpdk-stable-"$DPDK_VERSION"
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"
OVS_DOWNLOAD="http://openvswitch.org/releases/openvswitch-$OVS_VERSION.tar.gz"
download_zip "${OVS_DOWNLOAD}" "OVS"
cd openvswitch-"$OVS_VERSION"
export OVS_DIR=/usr/src/openvswitch-$OVS_VERSION
./boot.sh
if [[ $DPDK_VERSION != "" ]]; then
./configure --with-dpdk="$DPDK_BUILD"
else
./configure
fi
make install -j $(nproc)
fi
popd
}
main()
{
dpdk_build
ovs
}
for i in "$@"
do
case $i in
-o=*|--ovs=*)
OVS_VERSION="${i#*=}"
;;
-d=*|--dpdk=*)
DPDK_VERSION="${i#*=}"
;;
-p=*|--proxy=*)
export http_proxy="${i#*=}"
export https_proxy="${i#*=}"
;;
-h|--help)
echo "CommandLine options:"
echo "===================="
echo "1. ovs_dpdk install mode:"
echo "./ovs_install.sh --ovs=<2.7.0> --dpdk=<supported dpdk versoin for given ovs> -p=<proxy>"
echo
exit
;;
*)
;;
esac
done
main
|