blob: da51e48df830eaf20510eb3d0949f4c620b7fad6 (
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
# set default route to be the GATEWAY
declare -r GATEWAY=${1:-}
# set default gateway for bridged interface, and make it happen at reboot
if [[ -n "${GATEWAY}" ]]; then
echo "Setting default gateway through bridged interface"
ip route delete default 2>&1 >/dev/null || true
ip route add default via ${GATEWAY}
echo "GATEWAY=${GATEWAY}" >/etc/default/vagrant-bridge
[ -r /vagrant/vagrant-bridge.conf ] && cp /vagrant/vagrant-bridge.conf /etc/init/ # symlinks don't work
initctl reload-configuration
fi
# Fix grub-pc on Virtualbox with Ubuntu
export DEBIAN_FRONTEND=noninteractive
# Standard update + upgrade dance
apt-get update
apt-get upgrade -y
# Fix the silly notion that /bin/sh should point to dash by pointing it to bash
sudo update-alternatives --install /bin/sh sh /bin/bash 100
# Install build tools
apt-get install -y build-essential autoconf automake bison libssl-dev ccache libtool git dkms debhelper emacs libganglia1-dev libapr1-dev libconfuse-dev
# Install other stuff
# apt-get install -y qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils
# Install uio
apt-get install -y linux-image-extra-`uname -r`
# Install jdk and maven
apt-get install -y openjdk-7-jdk
mkdir /usr/local/apache-maven
cd /usr/local/apache-maven
wget http://apache.go-parts.com/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
tar -xzvf apache-maven-3.3.9-bin.tar.gz -C /usr/local/apache-maven/
update-alternatives --install /usr/bin/mvn mvn /usr/local/apache-maven/apache-maven-3.3.9/bin/mvn 1
update-alternatives --config mvn
cd /home/vagrant
sudo -H -u vagrant mkdir .m2
sudo -H -u vagrant cp /honeycomb/vagrant/settings.xml .m2
cat << EOF > .bash_aliases
export M2_HOME=/usr/local/apache-maven/apache-maven-3.3.9
export MAVEN_OPTS="-Xms256m -Xmx512m" # Very important to put the "m" on the end
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
EOF
chown vagrant:vagrant .bash_aliases
# Use the external Maven M2 repository if it has been mounted on /m2-repository
[ -d /m2-repository ] && sudo -u vagrant sed -i -e 's,/home/vagrant/.m2/repository,/m2-repository,g' /home/vagrant/.m2/settings.xml
# Setup for hugepages using upstart so it persists across reboots
echo "vm.nr_hugepages=1024" >> /etc/sysctl.d/20-hugepages.conf
sysctl --system
cat << EOF > /etc/init/hugepages.conf
start on runlevel [2345]
task
script
mkdir -p /run/hugepages/kvm || true
rm -f /run/hugepages/kvm/* || true
rm -f /dev/shm/* || true
mount -t hugetlbfs nodev /run/hugepages/kvm
end script
EOF
# Make sure we run that hugepages.conf right now
start hugepages
# Setup the vpp code
cd ~vagrant/
sudo -u vagrant mkdir git
cd git/
# Check if git exists and remove it before attempting clone, else clone ineffective when "reload --provision"
[ -d honeycomb ] && rm -rf honeycomb
sudo -H -u vagrant git clone /honeycomb
cd honeycomb/
# Initial honeycomb build
sudo -H -u vagrant mvn clean install -DskipTests
# Install honeycomb agent (v3po)
mkdir -p /opt/honeycomb/v3po
cp -a v3po/karaf /opt/honeycomb/v3po
# Install ODL Virtual Bridge App
mkdir -p /opt/odl/vbd
cp -a vbd/karaf /opt/odl/vbd
if [ -d /vpp ] ; then
cd ..
# Check if git exists and remove it before attempting clone, else clone ineffective when "reload --provision"
[ -d vpp ] && rm -rf vpp
sudo -H -u vagrant git clone /vpp
cd vpp/
# Initial vpp build
if [ -d build-root ]; then
# Bootstrap vpp
cd build-root/
sudo -H -u vagrant ./bootstrap.sh
# Build vpp
sudo -H -u vagrant make V=0 PLATFORM=vpp TAG=vpp_debug install-deb
# Install debian packages
dpkg -i *.deb
# Disable all ethernet interfaces other than the default route
# so VPP will use those interfaces.
for intf in $(ls /sys/class/net) ; do
if [ -d /sys/class/net/$intf/device ] && [ "$(route | grep default | grep $intf)" == "" ] ; then
ifconfig $intf down
fi
done
# Start vpp
start vpp
fi
fi
|