blob: b997a6afbd30590fe4c936083befe9cf7bfc8270 [file] [log] [blame]
Carmelo Casconed6615072017-12-15 00:53:43 -08001#!/bin/bash
2set -xe
3
Carmelo Casconebcb055e2019-01-08 14:33:18 -08004ONOS_BRANCH_DEV="master"
5ONOS_BRANCH_TUTORIAL="onos-1.14"
Carmelo Casconea4dc3c12019-02-12 17:30:00 -08006BAZEL_VER="0.22.0"
Carmelo Casconebcb055e2019-01-08 14:33:18 -08007
Carmelo Cascone97d36a22019-04-12 11:05:50 -07008# There is a known issue with some kernel versions that affects PTF tests:
9# https://github.com/jafingerhut/p4-guide/tree/master/linux-veth-bug
10KERNEL_VER="4.15.0-46-generic"
11
Carmelo Casconec5569c22018-04-18 10:09:15 +090012VM_TYPE=${1:-dev}
13
Carmelo Casconebcb055e2019-01-08 14:33:18 -080014if [[ ${VM_TYPE} = "tutorial" ]]
15then
16 ONOS_BRANCH=${ONOS_BRANCH_TUTORIAL}
17else
18 ONOS_BRANCH=${ONOS_BRANCH_DEV}
19fi
20
Carmelo Casconed6615072017-12-15 00:53:43 -080021# Create user sdn
22useradd -m -d /home/sdn -s /bin/bash sdn
23echo "sdn:rocks" | chpasswd
24echo "sdn ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/99_sdn
25chmod 440 /etc/sudoers.d/99_sdn
26usermod -aG vboxsf sdn
Carmelo Casconef11513d2018-01-16 00:31:14 -080027update-locale LC_ALL="en_US.UTF-8"
Carmelo Casconed6615072017-12-15 00:53:43 -080028
Carmelo Casconebcb055e2019-01-08 14:33:18 -080029if [[ ${VM_TYPE} = "tutorial" ]]
Carmelo Casconec5569c22018-04-18 10:09:15 +090030then
Carmelo Casconec5569c22018-04-18 10:09:15 +090031 su sdn <<'EOF'
Carmelo Cascone57defd32018-05-11 14:34:01 -070032cd /home/sdn
33bash /vagrant/tutorial-bootstrap.sh
Carmelo Casconec5569c22018-04-18 10:09:15 +090034EOF
Carmelo Casconec5569c22018-04-18 10:09:15 +090035fi
36
Carmelo Casconed6615072017-12-15 00:53:43 -080037# Java 8
38apt-get install software-properties-common -y
39add-apt-repository ppa:webupd8team/java -y
40apt-get update
Carmelo Casconed6615072017-12-15 00:53:43 -080041
Carmelo Cascone95e5afd2018-07-17 14:45:23 +020042DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade
43
44echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections
Carmelo Casconec5569c22018-04-18 10:09:15 +090045apt-get -y --no-install-recommends install \
Carmelo Cascone57defd32018-05-11 14:34:01 -070046 avahi-daemon \
47 bridge-utils \
48 git \
49 git-review \
50 htop \
Carmelo Casconec5569c22018-04-18 10:09:15 +090051 oracle-java8-installer \
52 oracle-java8-set-default \
Carmelo Cascone57defd32018-05-11 14:34:01 -070053 python2.7 \
54 python2.7-dev \
Carmelo Casconef11513d2018-01-16 00:31:14 -080055 valgrind \
Carmelo Cascone57defd32018-05-11 14:34:01 -070056 zip unzip \
57 tcpdump \
58 vlan \
59 ntp \
60 vim nano emacs \
Charles Chan84431b92018-08-16 20:30:09 -070061 arping \
62 gawk \
63 texinfo \
64 build-essential \
65 iptables \
66 automake \
67 autoconf \
68 libtool \
Carmelo Cascone97d36a22019-04-12 11:05:50 -070069 linux-image-${KERNEL_VER} \
Charles Chan84431b92018-08-16 20:30:09 -070070 isc-dhcp-server
71
72DEBIAN_FRONTEND=noninteractive apt-get -yq install wireshark
Carmelo Cascone57defd32018-05-11 14:34:01 -070073
Carmelo Cascone03ae0ac2018-10-11 08:31:59 -070074# Install Bazel
Carmelo Casconebcb055e2019-01-08 14:33:18 -080075BAZEL_SH="bazel-${BAZEL_VER}-installer-linux-x86_64.sh"
Carmelo Cascone03ae0ac2018-10-11 08:31:59 -070076wget https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VER}/${BAZEL_SH}
77chmod +x ${BAZEL_SH}
78./${BAZEL_SH}
79rm -f ${BAZEL_SH}
Carmelo Cascone57defd32018-05-11 14:34:01 -070080
Carmelo Cascone03ae0ac2018-10-11 08:31:59 -070081# Install pip and some python deps (others are defined in install-p4-tools.sh)
Carmelo Cascone57defd32018-05-11 14:34:01 -070082curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
83python2.7 get-pip.py --force-reinstall
84rm -f get-pip.py
Charles Chan84431b92018-08-16 20:30:09 -070085pip install ipaddress
86
Carmelo Casconed6615072017-12-15 00:53:43 -080087tee -a /etc/ssh/sshd_config <<EOF
88
89UseDNS no
90EOF
91
92su sdn <<'EOF'
93cd /home/sdn
Carmelo Casconebcb055e2019-01-08 14:33:18 -080094bash /vagrant/user-bootstrap.sh ${ONOS_BRANCH}
Carmelo Casconed6615072017-12-15 00:53:43 -080095EOF